Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeEditor related changes and ko language added #215

Closed
wants to merge 15 commits into from

Conversation

diluculo
Copy link
Contributor

@diluculo diluculo commented Jul 18, 2016

In the CodeEditor module, I changed something not-yet-implemented :

Changes in Shell - Menu

  • [OpenFileCommandHandler] In opening a file that is already opened, just activate its tab.
  • SaveAll menu is added.
  • RecentFiles module and its menu are added.

Changes in Modules.CodeEditor

  • Caret.PositionChanged event added to update Ln# and Col# in StatusBar.
  • When opened at StartUp, ApplyOriginalText() method is failed because of null _view. Fix the issue by introducing a flag.

Changes in Demo.Modules.Startup.Module

  • IPropertyGrid is updated when ActiveDocument is changed.

Changes in language resouces

  • ko-KR language is added.

@diluculo diluculo changed the title Ko kr language CodeEditor related changes and ko-KR language added Jul 18, 2016
@EchterAgo
Copy link
Contributor

This looks great 👍 It will knock off 2 of the items on my ToDo list, MRU and Korean translation. Thanks!

@EchterAgo
Copy link
Contributor

Also 👍 for the German and Chinese translation of the new strings.

_shell = shell;
}

public override async Task Run(Command command)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nitpick, remove the async and return TaskUtility.Completed here, otherwise the compiler will give warnings.

@diluculo
Copy link
Contributor Author

EchterAgo, many thanks for warm replies. This was my first activity in the GitHub.

After initial pull requesting, I modified 3 more little things:
(1) In the Gemini.Demo.TextEditor module, I added TextWrapping and AcceptsReturn to TextBox properties.
(2) Resources.ko-KR was changed just to Resources.ko.
(3) "Async" removed as you suggested.

@diluculo diluculo changed the title CodeEditor related changes and ko-KR language added CodeEditor related changes and ko language added Jul 18, 2016
@EchterAgo
Copy link
Contributor

Nice, thank you :)

@diluculo
Copy link
Contributor Author

"ko-KR" should be used? "ko" is working fine in Gemini solution, but my other project, referencing Gemini.dll, shows a running error:

Can only set culture to an existing culture.
Check the property Cultures for a list of valid cultures.

It may be from Gu.Localization.Translator.set_CurrentCulture(CultureInfo value)
and so, Gemini.AppBootstrapper.PreInitialize()

@EchterAgo
Copy link
Contributor

I am not sure, I would check, but I somehow can't get the demo to run with your changes. I get a 'System.ComponentModel.Composition.CompositionException' indicating that there is a dependency loop:

The composition produced a single composition error, with 3 root causes. The root causes are provided below. Review the CompositionException.Errors property for more detailed information.

1) Cannot compose part 'Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel' because a cycle exists in the dependencies between the exports being composed. To break this cycle, consider changing some imports from constructor to property injection.
Element: Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel -->  Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel -->  AssemblyCatalog (Assembly="Gemini.Demo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel (ContractName="Gemini.Framework.Services.IShell")' from part 'Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel'.
Element: Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel (ContractName="Gemini.Framework.Services.IShell") -->  Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel -->  AssemblyCatalog (Assembly="Gemini.Demo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot set import 'Gemini.Modules.PropertyGrid.ViewModels.PropertyGridViewModel..ctor (Parameter="shell", ContractName="Gemini.Framework.Services.IShell")' on part 'Gemini.Modules.PropertyGrid.ViewModels.PropertyGridViewModel'.
Element: Gemini.Modules.PropertyGrid.ViewModels.PropertyGridViewModel..ctor (Parameter="shell", ContractName="Gemini.Framework.Services.IShell") -->  Gemini.Modules.PropertyGrid.ViewModels.PropertyGridViewModel -->  AssemblyCatalog (Assembly="Gemini.Modules.PropertyGrid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'Gemini.Modules.PropertyGrid.ViewModels.PropertyGridViewModel (ContractName="Gemini.Modules.PropertyGrid.IPropertyGrid")' from part 'Gemini.Modules.PropertyGrid.ViewModels.PropertyGridViewModel'.
Element: Gemini.Modules.PropertyGrid.ViewModels.PropertyGridViewModel (ContractName="Gemini.Modules.PropertyGrid.IPropertyGrid") -->  Gemini.Modules.PropertyGrid.ViewModels.PropertyGridViewModel -->  AssemblyCatalog (Assembly="Gemini.Modules.PropertyGrid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot set import 'Gemini.Demo.Modules.Startup.Module..ctor (Parameter="propertyGrid", ContractName="Gemini.Modules.PropertyGrid.IPropertyGrid")' on part 'Gemini.Demo.Modules.Startup.Module'.
Element: Gemini.Demo.Modules.Startup.Module..ctor (Parameter="propertyGrid", ContractName="Gemini.Modules.PropertyGrid.IPropertyGrid") -->  Gemini.Demo.Modules.Startup.Module -->  AssemblyCatalog (Assembly="Gemini.Demo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'Gemini.Demo.Modules.Startup.Module (ContractName="Gemini.Framework.IModule")' from part 'Gemini.Demo.Modules.Startup.Module'.
Element: Gemini.Demo.Modules.Startup.Module (ContractName="Gemini.Framework.IModule") -->  Gemini.Demo.Modules.Startup.Module -->  AssemblyCatalog (Assembly="Gemini.Demo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot set import 'Gemini.Modules.Shell.ViewModels.ShellViewModel._modules (ContractName="Gemini.Framework.IModule")' on part 'Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel'.
Element: Gemini.Modules.Shell.ViewModels.ShellViewModel._modules (ContractName="Gemini.Framework.IModule") -->  Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel -->  AssemblyCatalog (Assembly="Gemini.Demo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel (ContractName="Gemini.Framework.Services.IShell")' from part 'Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel'.
Element: Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel (ContractName="Gemini.Framework.Services.IShell") -->  Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel -->  AssemblyCatalog (Assembly="Gemini.Demo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot set import 'Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel._shell (ContractName="Gemini.Framework.Services.IShell")' on part 'Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel'.
Element: Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel._shell (ContractName="Gemini.Framework.Services.IShell") -->  Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel -->  AssemblyCatalog (Assembly="Gemini, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel (ContractName="Gemini.Framework.Services.IMainWindow")' from part 'Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel'.
Element: Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel (ContractName="Gemini.Framework.Services.IMainWindow") -->  Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel -->  AssemblyCatalog (Assembly="Gemini, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

2) Cannot compose part 'Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel' because a cycle exists in the dependencies between the exports being composed. To break this cycle, consider changing some imports from constructor to property injection.
Element: Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel -->  Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel -->  AssemblyCatalog (Assembly="Gemini, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel (ContractName="Gemini.Framework.Services.IMainWindow")' from part 'Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel'.
Element: Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel (ContractName="Gemini.Framework.Services.IMainWindow") -->  Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel -->  AssemblyCatalog (Assembly="Gemini, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot set import 'Gemini.Framework.ModuleBase._mainWindow (ContractName="Gemini.Framework.Services.IMainWindow")' on part 'Gemini.Demo.Modules.Home.Module'.
Element: Gemini.Framework.ModuleBase._mainWindow (ContractName="Gemini.Framework.Services.IMainWindow") -->  Gemini.Demo.Modules.Home.Module -->  AssemblyCatalog (Assembly="Gemini.Demo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'Gemini.Demo.Modules.Home.Module.ViewDemoMenuGroup (ContractName="Gemini.Framework.Menus.MenuItemGroupDefinition")' from part 'Gemini.Demo.Modules.Home.Module'.
Element: Gemini.Demo.Modules.Home.Module.ViewDemoMenuGroup (ContractName="Gemini.Framework.Menus.MenuItemGroupDefinition") -->  Gemini.Demo.Modules.Home.Module -->  AssemblyCatalog (Assembly="Gemini.Demo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot set import 'Gemini.Modules.MainMenu.MenuBuilder..ctor (Parameter="menuItemGroups", ContractName="Gemini.Framework.Menus.MenuItemGroupDefinition")' on part 'Gemini.Modules.MainMenu.MenuBuilder'.
Element: Gemini.Modules.MainMenu.MenuBuilder..ctor (Parameter="menuItemGroups", ContractName="Gemini.Framework.Menus.MenuItemGroupDefinition") -->  Gemini.Modules.MainMenu.MenuBuilder -->  AssemblyCatalog (Assembly="Gemini, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'Gemini.Modules.MainMenu.MenuBuilder (ContractName="Gemini.Modules.MainMenu.IMenuBuilder")' from part 'Gemini.Modules.MainMenu.MenuBuilder'.
Element: Gemini.Modules.MainMenu.MenuBuilder (ContractName="Gemini.Modules.MainMenu.IMenuBuilder") -->  Gemini.Modules.MainMenu.MenuBuilder -->  AssemblyCatalog (Assembly="Gemini, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot set import 'Gemini.Modules.MainMenu.ViewModels.MainMenuViewModel..ctor (Parameter="menuBuilder", ContractName="Gemini.Modules.MainMenu.IMenuBuilder")' on part 'Gemini.Modules.MainMenu.ViewModels.MainMenuViewModel'.
Element: Gemini.Modules.MainMenu.ViewModels.MainMenuViewModel..ctor (Parameter="menuBuilder", ContractName="Gemini.Modules.MainMenu.IMenuBuilder") -->  Gemini.Modules.MainMenu.ViewModels.MainMenuViewModel -->  AssemblyCatalog (Assembly="Gemini, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'Gemini.Modules.MainMenu.ViewModels.MainMenuViewModel (ContractName="Gemini.Modules.MainMenu.IMenu")' from part 'Gemini.Modules.MainMenu.ViewModels.MainMenuViewModel'.
Element: Gemini.Modules.MainMenu.ViewModels.MainMenuViewModel (ContractName="Gemini.Modules.MainMenu.IMenu") -->  Gemini.Modules.MainMenu.ViewModels.MainMenuViewModel -->  AssemblyCatalog (Assembly="Gemini, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot set import 'Gemini.Modules.Shell.ViewModels.ShellViewModel._mainMenu (ContractName="Gemini.Modules.MainMenu.IMenu")' on part 'Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel'.
Element: Gemini.Modules.Shell.ViewModels.ShellViewModel._mainMenu (ContractName="Gemini.Modules.MainMenu.IMenu") -->  Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel -->  AssemblyCatalog (Assembly="Gemini.Demo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel (ContractName="Gemini.Framework.Services.IShell")' from part 'Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel'.
Element: Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel (ContractName="Gemini.Framework.Services.IShell") -->  Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel -->  AssemblyCatalog (Assembly="Gemini.Demo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot set import 'Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel._shell (ContractName="Gemini.Framework.Services.IShell")' on part 'Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel'.
Element: Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel._shell (ContractName="Gemini.Framework.Services.IShell") -->  Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel -->  AssemblyCatalog (Assembly="Gemini, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel (ContractName="Gemini.Framework.Services.IMainWindow")' from part 'Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel'.
Element: Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel (ContractName="Gemini.Framework.Services.IMainWindow") -->  Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel -->  AssemblyCatalog (Assembly="Gemini, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

3) Cannot compose part 'Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel' because a cycle exists in the dependencies between the exports being composed. To break this cycle, consider changing some imports from constructor to property injection.
Element: Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel -->  Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel -->  AssemblyCatalog (Assembly="Gemini, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel (ContractName="Gemini.Framework.Services.IMainWindow")' from part 'Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel'.
Element: Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel (ContractName="Gemini.Framework.Services.IMainWindow") -->  Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel -->  AssemblyCatalog (Assembly="Gemini, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot set import 'Gemini.Framework.ModuleBase._mainWindow (ContractName="Gemini.Framework.Services.IMainWindow")' on part 'Gemini.Demo.Modules.Home.Module'.
Element: Gemini.Framework.ModuleBase._mainWindow (ContractName="Gemini.Framework.Services.IMainWindow") -->  Gemini.Demo.Modules.Home.Module -->  AssemblyCatalog (Assembly="Gemini.Demo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'Gemini.Demo.Modules.Home.Module.ViewHomeMenuItem (ContractName="Gemini.Framework.Menus.MenuItemDefinition")' from part 'Gemini.Demo.Modules.Home.Module'.
Element: Gemini.Demo.Modules.Home.Module.ViewHomeMenuItem (ContractName="Gemini.Framework.Menus.MenuItemDefinition") -->  Gemini.Demo.Modules.Home.Module -->  AssemblyCatalog (Assembly="Gemini.Demo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot set import 'Gemini.Modules.MainMenu.MenuBuilder..ctor (Parameter="menuItems", ContractName="Gemini.Framework.Menus.MenuItemDefinition")' on part 'Gemini.Modules.MainMenu.MenuBuilder'.
Element: Gemini.Modules.MainMenu.MenuBuilder..ctor (Parameter="menuItems", ContractName="Gemini.Framework.Menus.MenuItemDefinition") -->  Gemini.Modules.MainMenu.MenuBuilder -->  AssemblyCatalog (Assembly="Gemini, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'Gemini.Modules.MainMenu.MenuBuilder (ContractName="Gemini.Modules.MainMenu.IMenuBuilder")' from part 'Gemini.Modules.MainMenu.MenuBuilder'.
Element: Gemini.Modules.MainMenu.MenuBuilder (ContractName="Gemini.Modules.MainMenu.IMenuBuilder") -->  Gemini.Modules.MainMenu.MenuBuilder -->  AssemblyCatalog (Assembly="Gemini, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot set import 'Gemini.Modules.MainMenu.ViewModels.MainMenuViewModel..ctor (Parameter="menuBuilder", ContractName="Gemini.Modules.MainMenu.IMenuBuilder")' on part 'Gemini.Modules.MainMenu.ViewModels.MainMenuViewModel'.
Element: Gemini.Modules.MainMenu.ViewModels.MainMenuViewModel..ctor (Parameter="menuBuilder", ContractName="Gemini.Modules.MainMenu.IMenuBuilder") -->  Gemini.Modules.MainMenu.ViewModels.MainMenuViewModel -->  AssemblyCatalog (Assembly="Gemini, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'Gemini.Modules.MainMenu.ViewModels.MainMenuViewModel (ContractName="Gemini.Modules.MainMenu.IMenu")' from part 'Gemini.Modules.MainMenu.ViewModels.MainMenuViewModel'.
Element: Gemini.Modules.MainMenu.ViewModels.MainMenuViewModel (ContractName="Gemini.Modules.MainMenu.IMenu") -->  Gemini.Modules.MainMenu.ViewModels.MainMenuViewModel -->  AssemblyCatalog (Assembly="Gemini, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot set import 'Gemini.Modules.Shell.ViewModels.ShellViewModel._mainMenu (ContractName="Gemini.Modules.MainMenu.IMenu")' on part 'Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel'.
Element: Gemini.Modules.Shell.ViewModels.ShellViewModel._mainMenu (ContractName="Gemini.Modules.MainMenu.IMenu") -->  Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel -->  AssemblyCatalog (Assembly="Gemini.Demo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel (ContractName="Gemini.Framework.Services.IShell")' from part 'Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel'.
Element: Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel (ContractName="Gemini.Framework.Services.IShell") -->  Gemini.Demo.Modules.Shell.ViewModels.ShellViewModel -->  AssemblyCatalog (Assembly="Gemini.Demo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot set import 'Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel._shell (ContractName="Gemini.Framework.Services.IShell")' on part 'Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel'.
Element: Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel._shell (ContractName="Gemini.Framework.Services.IShell") -->  Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel -->  AssemblyCatalog (Assembly="Gemini, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel (ContractName="Gemini.Framework.Services.IMainWindow")' from part 'Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel'.
Element: Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel (ContractName="Gemini.Framework.Services.IMainWindow") -->  Gemini.Modules.MainWindow.ViewModels.MainWindowViewModel -->  AssemblyCatalog (Assembly="Gemini, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")

@EchterAgo
Copy link
Contributor

EchterAgo commented Jul 18, 2016

I was able to get the demo to run with your changes by changing the demo startup module to use IoC.Get to get the propertygrid like this:

        private void RefreshPropertyGrid()
        {
            var propertyGrid = IoC.Get<IPropertyGrid>();
            if (Shell.ActiveItem != null)
                propertyGrid.SelectedObject = Shell.ActiveItem;
            else
                propertyGrid.SelectedObject = null;
        }

In my application Korean seems to be working fine with just "ko", no "ko-KR" needed

@EchterAgo
Copy link
Contributor

Got an exception when testing the MRU files. Opened two files, they appeared in the MRU list. Restarted application, used first MRU entry, got this exception:

---------------------------
Unhandled exception
---------------------------
Unhandled exception in thread  (10)Message: Value cannot be null.

Parameter name: pathStack trace:   at System.IO.Path.GetFullPathInternal(String path)

   at System.IO.Path.GetFullPath(String path)

   at Gemini.Modules.RecentFiles.Commands.OpenRecentFileCommandHandler.<Run>d__3.MoveNext() in D:\dev\gemini\src\Gemini\Modules\RecentFiles\Commands\OpenRecentFileCommandHandler.cs:line 48

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()

   at Gemini.Framework.Commands.TargetableCommand.<Execute>d__4.MoveNext() in D:\dev\gemini\src\Gemini\Framework\Commands\TargetableCommand.cs:line 36

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)

   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
---------------------------
OK   
---------------------------

@EchterAgo
Copy link
Contributor

Ok, it seems like the code does not handle having an unsaved document open correctly. When you check if the document is open already, you need to check if the document actually has a filename. I would suggest checking for !IsNew like this:

        public async Task Run(Command command)
        {
            var newPath = (string)command.Tag;

            // Check if the document is already open
            foreach (var document in _shell.Documents.OfType<PersistedDocument>().Where(d => !d.IsNew))
            {
                if (string.IsNullOrEmpty(document.FilePath))
                    continue;

                var docPath = Path.GetFullPath(document.FilePath);
                if (string.Equals(newPath, docPath, System.StringComparison.OrdinalIgnoreCase))
                {
                    _shell.OpenDocument(document);
                    return;
                }
            }

            _shell.OpenDocument(await GetEditor(newPath));

            // Add the file to the recent documents list
            _shell.RecentFiles.Update(newPath);
        }

@EchterAgo
Copy link
Contributor

Same for OpenFileCommandHandler. Also, I would suggest not duplicating the GetEditor function, maybe put it somewhere into the Framework.

@tgjones
Copy link
Owner

tgjones commented Jul 18, 2016

@diluculo, these changes look great, thank you.

I'm just about to get on a plane, so I can't review this properly now, but my initial feedback is that I'd like to see this split up into separate pull requests. (It's hard to review the differences when they're all in one big PR.) I hope that won't create too much work for you - where the commits don't depend on each other, you should be able to get them on their own branch without needing to redo or rebase the commits.

@EchterAgo
Copy link
Contributor

EchterAgo commented Jul 18, 2016

I already made a cleanup of the pull request here:

https://github.com/EchterAgo/gemini/tree/ko_kr_cleanup

Just needs to be pulled apart and made into separate branches.

@diluculo
Copy link
Contributor Author

Thanks for comments and changes. I will try to separate chunks into small branches and keep my master branch clean.

By the way, wrt CodeEditor, I couldn't find a way to activate Undo/Redo menus in the menu bar and the toolbar. I think simple solution may be linking them to AvalonEdit's UndoStack. Please give me a hint where I have to start.

@EchterAgo
Copy link
Contributor

I created a ticket for the UndoRedo stack integration here #216

@EchterAgo
Copy link
Contributor

@diluculo are you using the cleaned up version I made? Because if not, I have some change suggestions

@diluculo
Copy link
Contributor Author

In the meantime, I reset my master to match the remote original, and I am trying to fork your cleaned up version, as a new starting point...

@EchterAgo
Copy link
Contributor

BTW, there is one change I forgot, I moved the duplicate document check
into the shell, called TryActivateByName. It returns true if the document
is already open. I made the file open command use it, but the MRU list
still does its own check. This should be changed to also use the new
function

On Jul 19, 2016 16:54, "diluculo" [email protected] wrote:

In the meantime, I reset my master to match the remote original, and I am
trying to fork your cleaned up version, as a new starting point...


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#215 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AA4SeeW4yiElbgictogEAIuLa4MEmstTks5qXJ5_gaJpZM4JOYTY
.

@diluculo
Copy link
Contributor Author

@EchterAgo , Please let me know how to fork your cleanup branch and clone it to my local PC. Today, I searched and tried, but failed. Is there any good reference?

@EchterAgo
Copy link
Contributor

If you use the Git command line, you can use the following on your local PC:

git remote add EchterAgo https://github.com/EchterAgo/gemini.git
git remote update
git checkout -b ko_kr_cleanup EchterAgo/ko_kr_cleanup

This will create a local branch with just my changes. If you want, I can also do the work to get this into separate branches, although there will be some dependencies, but if you want to learn how to use git for this, I will be happy to help you learn.

@EchterAgo
Copy link
Contributor

EchterAgo commented Jul 19, 2016

Basically to send clean patches to an open source project, you need to do a lot of rebasing and commit squashing. You should generally try to keep one change unit in one commit without intermediate commits, which is achieved by rebasing and squashing. To rebase you would use something like:

git rebase -i upstream/master

This assumes that you have a remote called upstream which points to @tgjones repository. When you do this you can edit the order of your commits and squash them together. It is a very powerful feature of git, but also easy to mess up with it, so make sure you have a backup branch.

Just tell me if you need help. You can email me at [email protected] if you need help with this, just to keep that discussion out of the pull request.

@diluculo
Copy link
Contributor Author

@EchterAgo Really many thanks for your kind help. Now, I can start to code again based on your branch.

@diluculo
Copy link
Contributor Author

diluculo commented Jul 22, 2016

When a CodeEditor document is new, but dirty, SaveState() method throws NullReferenceException. To restart application without error, ApplicationState.bin file should be deleted.

To fix it, I modified ShouldReopenOnStart:

    public override bool ShouldReopenOnStart
    {
        get { return (FilePath != null); } // original code is return true.
    }

I think ShouldReopenonStart, SaveState(), and LoadState() can be basic properties/methods of PersistedDocument class. How about insert them into the class? Please give me advice.

This was referenced Aug 25, 2016
@diluculo
Copy link
Contributor Author

This is split up into #237, #238, #239, and #240.

@diluculo diluculo closed this Aug 25, 2016
@diluculo diluculo deleted the ko-KR_Language branch May 15, 2018 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants