Browse Source

Move command manager path to the same location (/SharpDevelop/CommandManager)

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/shortcuts@4398 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts^2
Sergej Andrejev 16 years ago
parent
commit
bf7a01a00e
  1. 120
      AddIns/ICSharpCode.SharpDevelop.addin
  2. 10
      src/Main/Base/Project/Src/Gui/Workbench/WpfWorkbench.cs
  3. 4
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/CommandBindingDescriptor.cs
  4. 4
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/InputBindingDescriptor.cs
  5. 19
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/MenuItem/MenuRootDoozer.cs
  6. 4
      src/Main/Core/Project/Src/AddInTree/AddInTree.cs
  7. 16
      src/Main/ICSharpCode.Core.Presentation/CommandsService/CommandsService.cs

120
AddIns/ICSharpCode.SharpDevelop.addin

@ -51,24 +51,48 @@
<Import assembly=":ICSharpCode.TextEditor"/> <Import assembly=":ICSharpCode.TextEditor"/>
</Runtime> </Runtime>
<Path name="/SharpDevelop/MenuLocations"> <Path name="/SharpDevelop/CommandManager/InputBindingCategories">
<MenuRoot path="/SharpDevelop/Workbench/MainMenu" name="Main Menu" /> <InputBindingCategory id="Test" text="Test">
<InputBindingCategory id="Test" text="Test" />
</InputBindingCategory>
<MenuRoot path="/SharpDevelop/Workbench/OpenFileTab/ContextMenu" name="Context menus/Tabs" /> <InputBindingCategory id="ProjectViewer" text="Project viewer" />
<InputBindingCategory id="Project" text="Project" />
<InputBindingCategory id="Debugger" text="Debugger" />
<InputBindingCategory id="Search" text="Search" />
<InputBindingCategory id="MainMenu" text="Main menu" />
<InputBindingCategory id="ContextMenus" text="Context Menus">
<InputBindingCategory id="TextEditor" text="Text Editor">
<InputBindingCategory id="Tabs" text="Tabs" />
<InputBindingCategory id="Refactoring" text="Refactoring" />
</InputBindingCategory>
</InputBindingCategory>
<InputBindingCategory id="Building" text="Building">
<InputBindingCategory id="Building" text="Building" />
</InputBindingCategory>
</Path>
<MenuRoot path="/SharpDevelop/ViewContent/AvalonEdit/ContextMenu" name="Context menus/Text Editor" /> <Path name="/SharpDevelop/CommandManager/MenuLocations">
<MenuRoot path="/SharpDevelop/ViewContent/TextEditor/ContextMenu" name="Context menus/Text Editor" /> <MenuLocation path="/SharpDevelop/Workbench/MainMenu" category="/MainMenu" />
<MenuRoot path="/SharpDevelop/ViewContent/DefaultTextEditor/ClassMemberContextMenu" name="Context menus/Text Editor" />
<MenuRoot path="/SharpDevelop/ViewContent/DefaultTextEditor/ClassBookmarkContextMenu" name="Context menus/Text Editor" /> <MenuLocation path="/SharpDevelop/ViewContent/AvalonEdit/ContextMenu" category="/ContextMenus/TextEditor" />
<MenuRoot path="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/Common" name="Context menus/Text Editor/Refactoring" /> <MenuLocation path="/SharpDevelop/ViewContent/TextEditor/ContextMenu" category="/ContextMenus/TextEditor" />
<MenuRoot path="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/Parameter" name="Context menus/Text Editor/Refactoring" /> <MenuLocation path="/SharpDevelop/ViewContent/DefaultTextEditor/ClassMemberContextMenu" category="/ContextMenus/TextEditor" />
<MenuRoot path="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/LocalVariable" name="Context menus/Text Editor/Refactoring" /> <MenuLocation path="/SharpDevelop/ViewContent/DefaultTextEditor/ClassBookmarkContextMenu" category="/ContextMenus/TextEditor" />
<MenuRoot path="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/ParameterDefinition" name="Context menus/Text Editor/Refactoring" />
<MenuRoot path="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/LocalVariableDefinition" name="Context menus/Text Editor/Refactoring" /> <MenuLocation path="/SharpDevelop/Workbench/OpenFileTab/ContextMenu" category="/ContextMenus/TextEditor/Tabs" />
<MenuLocation path="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/Common" category="/ContextMenus/TextEditor/Refactoring" />
<MenuLocation path="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/Parameter" category="/ContextMenus/TextEditor/Refactoring" />
<MenuLocation path="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/LocalVariable" category="/ContextMenus/TextEditor/Refactoring" />
<MenuLocation path="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/ParameterDefinition" category="/ContextMenus/TextEditor/Refactoring" />
<MenuLocation path="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/LocalVariableDefinition" category="/ContextMenus/TextEditor/Refactoring" />
</Path> </Path>
<Path name="/SharpDevelop/Workbench/RoutedUICommands"> <Path name="/SharpDevelop/CommandManager/RoutedUICommands">
<RoutedUICommand name="SDTestCommands.Test" text="Create new file" /> <RoutedUICommand name="SDTestCommands.Test" text="Create new file" />
<RoutedUICommand name="SDBuildCommands.BuildSolution" text="${res:XML.MainMenu.BuildMenu.BuildSolution}" /> <RoutedUICommand name="SDBuildCommands.BuildSolution" text="${res:XML.MainMenu.BuildMenu.BuildSolution}" />
@ -113,164 +137,160 @@
</Path> </Path>
<Path name="/SharpDevelop/Workbench/CommandBindings"> <Path name="/SharpDevelop/CommandManager/CommandBindings">
<CommandBinding <CommandBinding
command="SDTestCommands.Test" command="SDTestCommands.Test"
class="ICSharpCode.SharpDevelop.Commands.TestCommand" class="ICSharpCode.SharpDevelop.Commands.TestCommand"
gestures="Ctrl+M" gestures="Ctrl+M"
category="Test" /> categories="/Test" />
<CommandBinding <CommandBinding
command = "SDProjectCommands.ShowSelectedProjectBrowserNodeProperties" command = "SDProjectCommands.ShowSelectedProjectBrowserNodeProperties"
class = "ICSharpCode.SharpDevelop.Project.Commands.ShowPropertiesForNode" class = "ICSharpCode.SharpDevelop.Project.Commands.ShowPropertiesForNode"
category="Project viewer" /> categories="/ProjectViewer" />
<CommandBinding <CommandBinding
command="SDBuildCommands.BuildSolution" command="SDBuildCommands.BuildSolution"
class="ICSharpCode.SharpDevelop.Project.Commands.Build" class="ICSharpCode.SharpDevelop.Project.Commands.Build"
gestures="Ctrl+Alt+R,R;Ctrl+B,B" gestures="Ctrl+Alt+R,R;Ctrl+B,B"
category="Building" categories="/Building"
/> />
<CommandBinding <CommandBinding
command="SDBuildCommands.RebuildSolution" command="SDBuildCommands.RebuildSolution"
class="ICSharpCode.SharpDevelop.Project.Commands.Rebuild" class="ICSharpCode.SharpDevelop.Project.Commands.Rebuild"
gestures="Alt+F8" gestures="Alt+F8"
category="Building" categories="/Building"
/> />
<CommandBinding <CommandBinding
command="SDBuildCommands.CleanSolution" command="SDBuildCommands.CleanSolution"
class="ICSharpCode.SharpDevelop.Project.Commands.Clean" class="ICSharpCode.SharpDevelop.Project.Commands.Clean"
category="Building" /> categories="/Building" />
<CommandBinding <CommandBinding
command="SDBuildCommands.BuildProject" command="SDBuildCommands.BuildProject"
class="ICSharpCode.SharpDevelop.Project.Commands.BuildProject" class="ICSharpCode.SharpDevelop.Project.Commands.BuildProject"
gestures="F9" gestures="F9"
category="Building" /> categories="/Building" />
<CommandBinding <CommandBinding
command="SDBuildCommands.RebuildProject" command="SDBuildCommands.RebuildProject"
class="ICSharpCode.SharpDevelop.Project.Commands.RebuildProject" class="ICSharpCode.SharpDevelop.Project.Commands.RebuildProject"
gestures="Alt+F9" gestures="Alt+F9"
category="Building" /> categories="/Building" />
<CommandBinding <CommandBinding
command="SDBuildCommands.CleanProject" command="SDBuildCommands.CleanProject"
class="ICSharpCode.SharpDevelop.Project.Commands.CleanProject" class="ICSharpCode.SharpDevelop.Project.Commands.CleanProject"
category="Buildin" /> categories="/Buildin" />
<CommandBinding <CommandBinding
command="SDBuildCommands.AbortBuild" command="SDBuildCommands.AbortBuild"
class="ICSharpCode.SharpDevelop.Project.Commands.AbortBuild" class="ICSharpCode.SharpDevelop.Project.Commands.AbortBuild"
category="Buildin" /> categories="/Buildin" />
<CommandBinding <CommandBinding
command="SDBuildCommands.EditConfigurationsCommand" command="SDBuildCommands.EditConfigurationsCommand"
class="ICSharpCode.SharpDevelop.Project.Commands.EditConfigurationsCommand" class="ICSharpCode.SharpDevelop.Project.Commands.EditConfigurationsCommand"
category="Buildin" /> categories="/Buildin" />
<CommandBinding <CommandBinding
command="SDProjectCommands.AddNewProjectToSolution" command="SDProjectCommands.AddNewProjectToSolution"
class="ICSharpCode.SharpDevelop.Project.Commands.AddNewProjectToSolution" class="ICSharpCode.SharpDevelop.Project.Commands.AddNewProjectToSolution"
category="Project" /> categories="/Project" />
<CommandBinding <CommandBinding
command="SDProjectCommands.AddExitingProjectToSolution" command="SDProjectCommands.AddExitingProjectToSolution"
class="ICSharpCode.SharpDevelop.Project.Commands.AddExitingProjectToSolution" class="ICSharpCode.SharpDevelop.Project.Commands.AddExitingProjectToSolution"
category="Project" /> categories="/Project" />
<CommandBinding <CommandBinding
command="SDProjectCommands.AddExistingItemToSolution" command="SDProjectCommands.AddExistingItemToSolution"
class="ICSharpCode.SharpDevelop.Project.Commands.AddExistingItemToSolution" class="ICSharpCode.SharpDevelop.Project.Commands.AddExistingItemToSolution"
category="Project" /> categories="/Project" />
<CommandBinding <CommandBinding
command="SDProjectCommands.AddNewSolutionFolderToSolution" command="SDProjectCommands.AddNewSolutionFolderToSolution"
class="ICSharpCode.SharpDevelop.Project.Commands.AddNewSolutionFolderToSolution" class="ICSharpCode.SharpDevelop.Project.Commands.AddNewSolutionFolderToSolution"
category="Project" /> categories="/Project" />
<CommandBinding <CommandBinding
command="SDDebugCommands.Execute" command="SDDebugCommands.Execute"
class="ICSharpCode.SharpDevelop.Project.Commands.Execute" class="ICSharpCode.SharpDevelop.Project.Commands.Execute"
gestures="F5" gestures="F5"
category="Debugger" /> categories="/Debugger" />
<CommandBinding <CommandBinding
command="SDDebugCommands.ExecuteWithoutDebugger" command="SDDebugCommands.ExecuteWithoutDebugger"
class="ICSharpCode.SharpDevelop.Project.Commands.ExecuteWithoutDebugger" class="ICSharpCode.SharpDevelop.Project.Commands.ExecuteWithoutDebugger"
gestures="Ctrl+F5" gestures="Ctrl+F5"
category="Debugger" /> categories="/Debugger" />
<CommandBinding <CommandBinding
command="SDDebugCommands.StopDebugging" command="SDDebugCommands.StopDebugging"
class="ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand" class="ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand"
category="Debugger" /> categories="/Debugger" />
<CommandBinding <CommandBinding
command="SDDebugCommands.AttachToProcess" command="SDDebugCommands.AttachToProcess"
class="ICSharpCode.SharpDevelop.Project.Commands.AttachToProcessCommand" class="ICSharpCode.SharpDevelop.Project.Commands.AttachToProcessCommand"
category="Project" /> categories="/Project" />
<CommandBinding <CommandBinding
command="SDDebugCommands.DetachFromProcess" command="SDDebugCommands.DetachFromProcess"
class="ICSharpCode.SharpDevelop.Project.Commands.DetachFromProcessCommand" class="ICSharpCode.SharpDevelop.Project.Commands.DetachFromProcessCommand"
category="Debugger" /> categories="/Debugger" />
<CommandBinding <CommandBinding
command="SDDebugCommands.BreakDebugging" command="SDDebugCommands.BreakDebugging"
class="ICSharpCode.SharpDevelop.Project.Commands.BreakDebuggingCommand" class="ICSharpCode.SharpDevelop.Project.Commands.BreakDebuggingCommand"
gestures="Ctrl+Alt+B" gestures="Ctrl+Alt+B"
category="Debugger" /> categories="/Debugger" />
<CommandBinding <CommandBinding
command="SDDebugCommands.ContinueDebugging" command="SDDebugCommands.ContinueDebugging"
class="ICSharpCode.SharpDevelop.Project.Commands.ContinueDebuggingCommand" class="ICSharpCode.SharpDevelop.Project.Commands.ContinueDebuggingCommand"
gestures="Ctrl+Alt+B; Ctrl+Alt+D" gestures="Ctrl+Alt+B; Ctrl+Alt+D"
category="Debugger" /> categories="/Debugger" />
<CommandBinding <CommandBinding
command="SDDebugCommands.StepOver" command="SDDebugCommands.StepOver"
class="ICSharpCode.SharpDevelop.Project.Commands.StepDebuggingCommand" class="ICSharpCode.SharpDevelop.Project.Commands.StepDebuggingCommand"
gestures="F10" gestures="F10"
category="Debugger" /> categories="/Debugger" />
<CommandBinding <CommandBinding
command="SDDebugCommands.StepInto" command="SDDebugCommands.StepInto"
class="ICSharpCode.SharpDevelop.Project.Commands.StepIntoDebuggingCommand" class="ICSharpCode.SharpDevelop.Project.Commands.StepIntoDebuggingCommand"
gestures="F11" gestures="F11"
category="Debugger" /> categories="/Debugger" />
<CommandBinding <CommandBinding
command="SDDebugCommands.StepOut" command="SDDebugCommands.StepOut"
class="ICSharpCode.SharpDevelop.Project.Commands.StepOutDebuggingCommand" class="ICSharpCode.SharpDevelop.Project.Commands.StepOutDebuggingCommand"
gestures="Shift+F11" gestures="Shift+F11"
category="Debugger" /> categories="/Debugger" />
<CommandBinding <CommandBinding
command="SDDebugCommands.ToggleBreakpoint" command="SDDebugCommands.ToggleBreakpoint"
class="ICSharpCode.SharpDevelop.Project.Commands.ToggleBreakpointCommand" class="ICSharpCode.SharpDevelop.Project.Commands.ToggleBreakpointCommand"
gestures="F7" gestures="F7"
category="Debugger" /> categories="/Debugger" />
<CommandBinding <CommandBinding
command="SDSearchCommands.ToggleBookmark" command="SDSearchCommands.ToggleBookmark"
class="ICSharpCode.SharpDevelop.Bookmarks.ToggleBookmark" class="ICSharpCode.SharpDevelop.Bookmarks.ToggleBookmark"
gestures="Ctrl+F2" gestures="Ctrl+F2"
category="Search" /> categories="/Search" />
<CommandBinding <CommandBinding
command="SDSearchCommands.PrevBookmark" command="SDSearchCommands.PrevBookmark"
class="ICSharpCode.SharpDevelop.Bookmarks.PrevBookmark" class="ICSharpCode.SharpDevelop.Bookmarks.PrevBookmark"
gestures="Alt+F2" gestures="Alt+F2"
category="Search" /> categories="/Search" />
<CommandBinding <CommandBinding
command="SDSearchCommands.NextBookmark" command="SDSearchCommands.NextBookmark"
class="ICSharpCode.SharpDevelop.Bookmarks.NextBookmark" class="ICSharpCode.SharpDevelop.Bookmarks.NextBookmark"
gestures="F2" gestures="F2"
category="Search" /> categories="/Search" />
<CommandBinding <CommandBinding
command="SDSearchCommands.ClearBookmarks" command="SDSearchCommands.ClearBookmarks"
class="ICSharpCode.SharpDevelop.Bookmarks.ClearBookmarks" class="ICSharpCode.SharpDevelop.Bookmarks.ClearBookmarks"
category="Search" /> categories="/Search" />
<CommandBinding <CommandBinding
command="SDSearchCommands.GotoLineNumber" command="SDSearchCommands.GotoLineNumber"
class="ICSharpCode.SharpDevelop.DefaultEditor.Commands.GotoLineNumber" class="ICSharpCode.SharpDevelop.DefaultEditor.Commands.GotoLineNumber"
gestures="Ctrl+G" gestures="Ctrl+G"
category="Search" /> categories="/Search" />
<CommandBinding <CommandBinding
command="SDSearchCommands.GotoBrace" command="SDSearchCommands.GotoBrace"
class="ICSharpCode.SharpDevelop.DefaultEditor.Commands.GotoMatchingBrace" class="ICSharpCode.SharpDevelop.DefaultEditor.Commands.GotoMatchingBrace"
gestures="Ctrl+B" gestures="Ctrl+B"
category="Search" /> categories="/Search" />
</Path>
<Path name="/SharpDevelop/Workbench/InputBindings">
</Path> </Path>
<Path name = "/SharpDevelop/Workbench/Ambiences"> <Path name = "/SharpDevelop/Workbench/Ambiences">
@ -1633,7 +1653,7 @@
label = "${res:XML.MainMenu.BuildMenu.BuildSolution}" label = "${res:XML.MainMenu.BuildMenu.BuildSolution}"
icon = "Icons.16x16.BuildCombine" icon = "Icons.16x16.BuildCombine"
command = "SDBuildCommands.BuildSolution" command = "SDBuildCommands.BuildSolution"
category = "Test/Test" inputbindingcategories = "/Test/Test"
/> />
<MenuItem id = "Rebuild" <MenuItem id = "Rebuild"
label = "${res:XML.MainMenu.BuildMenu.RebuildSolution}" label = "${res:XML.MainMenu.BuildMenu.RebuildSolution}"

10
src/Main/Base/Project/Src/Gui/Workbench/WpfWorkbench.cs

@ -75,7 +75,6 @@ namespace ICSharpCode.SharpDevelop.Gui
public void Initialize() public void Initialize()
{ {
CommandsService.RegisterInputBindingCategories(this, "/SharpDevelop/Workbench/InputBindingCategories");
// Use shortened assembly qualified name to not lose user defined gestures // Use shortened assembly qualified name to not lose user defined gestures
// when sharp develop is updated // when sharp develop is updated
@ -85,10 +84,11 @@ namespace ICSharpCode.SharpDevelop.Gui
CommandsService.RegisterBuiltInRoutedUICommands(); CommandsService.RegisterBuiltInRoutedUICommands();
// Load all commands and and key bindings from addin tree // Load all commands and and key bindings from addin tree
CommandsService.RegisterRoutedUICommands(this, "/SharpDevelop/Workbench/RoutedUICommands"); CommandsService.RegisterInputBindingCategories(this, "/SharpDevelop/CommandManager/InputBindingCategories");
CommandsService.RegisterCommandBindings(this, "/SharpDevelop/Workbench/CommandBindings"); CommandsService.RegisterRoutedUICommands(this, "/SharpDevelop/CommandManager/RoutedUICommands");
CommandsService.RegisterInputBindings(this, "/SharpDevelop/Workbench/InputBindings"); CommandsService.RegisterCommandBindings(this, "/SharpDevelop/CommandManager/CommandBindings");
CommandsService.RegisterMenuBindings("/SharpDevelop/MenuLocations", this); CommandsService.RegisterInputBindings(this, "/SharpDevelop/CommandManager/InputBindings");
CommandsService.RegisterMenuBindings(this, "/SharpDevelop/CommandManager/MenuLocations");
// Register context and load all commands from addin // Register context and load all commands from addin
CommandManager.LoadAddinCommands(AddInTree.AddIns.FirstOrDefault(a => a.Name == "SharpDevelop")); CommandManager.LoadAddinCommands(AddInTree.AddIns.FirstOrDefault(a => a.Name == "SharpDevelop"));

4
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/CommandBindingDescriptor.cs

@ -63,7 +63,7 @@ namespace ICSharpCode.Core
/// If input binding is created in the same context (this is done by setting <see cref="Gestures" /> property) /// If input binding is created in the same context (this is done by setting <see cref="Gestures" /> property)
/// assign this input binding to provided category /// assign this input binding to provided category
/// </summary> /// </summary>
public string Category { public string Categories {
get; private set; get; private set;
} }
@ -92,7 +92,7 @@ namespace ICSharpCode.Core
OwnerInstanceName = Codon.Properties["owner-instance"]; OwnerInstanceName = Codon.Properties["owner-instance"];
OwnerTypeName = Codon.Properties["owner-type"]; OwnerTypeName = Codon.Properties["owner-type"];
Gestures = Codon.Properties["gestures"]; Gestures = Codon.Properties["gestures"];
Category = Codon.Properties["category"]; Categories = Codon.Properties["categories"];
Name = Codon.Properties["name"]; Name = Codon.Properties["name"];
} }
} }

4
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/InputBindingDescriptor.cs

@ -50,7 +50,7 @@ namespace ICSharpCode.Core
/// <summary> /// <summary>
/// Category to which this binding belongs /// Category to which this binding belongs
/// </summary> /// </summary>
public string Category { public string Categories {
get; private set; get; private set;
} }
@ -66,7 +66,7 @@ namespace ICSharpCode.Core
OwnerInstanceName = codon.Properties["owner-instance"]; OwnerInstanceName = codon.Properties["owner-instance"];
OwnerTypeName = codon.Properties["owner-type"]; OwnerTypeName = codon.Properties["owner-type"];
Gestures = codon.Properties["gestures"]; Gestures = codon.Properties["gestures"];
Category = codon.Properties["category"]; Categories = codon.Properties["categories"];
Name = codon.Properties["name"]; Name = codon.Properties["name"];
} }
} }

19
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/MenuItem/MenuRootDoozer.cs

@ -14,7 +14,7 @@ namespace ICSharpCode.Core
/// <summary> /// <summary>
/// Description of MenuDescriptionDoozer. /// Description of MenuDescriptionDoozer.
/// </summary> /// </summary>
public class MenuRootDoozer : IDoozer public class MenuLocationDoozer : IDoozer
{ {
public bool HandleConditions { public bool HandleConditions {
get { get {
@ -24,15 +24,13 @@ namespace ICSharpCode.Core
public object BuildItem(object caller, Codon codon, ArrayList subItems) public object BuildItem(object caller, Codon codon, ArrayList subItems)
{ {
return new MenuRootDescriptor(caller, codon); return new MenuLocationDescriptor(caller, codon);
} }
} }
public class MenuRootDescriptor public class MenuLocationDescriptor
{ {
private Codon codon;
public string Category public string Category
{ {
get; private set; get; private set;
@ -43,15 +41,14 @@ namespace ICSharpCode.Core
get; private set; get; private set;
} }
public MenuRootDescriptor(object caller, Codon codon) public MenuLocationDescriptor(object caller, Codon codon)
{ {
this.codon = codon; if(!codon.Properties.Contains("path") || !codon.Properties.Contains("category")){
throw new ArgumentException("Menu location should have path and category");
}
Path = codon.Properties["path"]; Path = codon.Properties["path"];
Category = codon.Properties["category"];
if(codon.Properties.Contains("category")){
Category = codon.Properties["category"];
}
} }
} }
} }

4
src/Main/Core/Project/Src/AddInTree/AddInTree.cs

@ -31,14 +31,16 @@ namespace ICSharpCode.Core
doozers.Add("String", new StringDoozer()); doozers.Add("String", new StringDoozer());
doozers.Add("Icon", new IconDoozer()); doozers.Add("Icon", new IconDoozer());
doozers.Add("MenuItem", new MenuItemDoozer()); doozers.Add("MenuItem", new MenuItemDoozer());
doozers.Add("MenuRoot", new MenuRootDoozer());
doozers.Add("ToolbarItem", new ToolbarItemDoozer()); doozers.Add("ToolbarItem", new ToolbarItemDoozer());
doozers.Add("Include", new IncludeDoozer()); doozers.Add("Include", new IncludeDoozer());
// Command manager doozers
doozers.Add("InputBinding", new InputBindingDoozer()); doozers.Add("InputBinding", new InputBindingDoozer());
doozers.Add("InputBindingCategory", new InputBindingCategoryDoozer()); doozers.Add("InputBindingCategory", new InputBindingCategoryDoozer());
doozers.Add("CommandBinding", new CommandBindingDoozer()); doozers.Add("CommandBinding", new CommandBindingDoozer());
doozers.Add("RoutedUICommand", new RoutedUICommandDoozer()); doozers.Add("RoutedUICommand", new RoutedUICommandDoozer());
doozers.Add("GesturesPlaceHolder", new GesturesPlaceHolderDoozer()); doozers.Add("GesturesPlaceHolder", new GesturesPlaceHolderDoozer());
doozers.Add("MenuLocation", new MenuLocationDoozer());
conditionEvaluators.Add("Compare", new CompareConditionEvaluator()); conditionEvaluators.Add("Compare", new CompareConditionEvaluator());
conditionEvaluators.Add("Ownerstate", new OwnerStateConditionEvaluator()); conditionEvaluators.Add("Ownerstate", new OwnerStateConditionEvaluator());

16
src/Main/ICSharpCode.Core.Presentation/CommandsService/CommandsService.cs

@ -14,9 +14,9 @@ namespace ICSharpCode.Core.Presentation
/// </summary> /// </summary>
public static class CommandsService public static class CommandsService
{ {
public static void RegisterMenuBindings(string menuRootsLocationPath, object caller) public static void RegisterMenuBindings(object caller, string menuRootsLocationPath)
{ {
var menuRoots = AddInTree.BuildItems<MenuRootDescriptor>(menuRootsLocationPath, caller); var menuRoots = AddInTree.BuildItems<MenuLocationDescriptor>(menuRootsLocationPath, caller);
foreach(var menuRoot in menuRoots) { foreach(var menuRoot in menuRoots) {
CommandsService.RegisterSingleMenuBindings(menuRoot.Path, caller, menuRoot.Category); CommandsService.RegisterSingleMenuBindings(menuRoot.Path, caller, menuRoot.Category);
} }
@ -75,8 +75,8 @@ namespace ICSharpCode.Core.Presentation
inputBindingInfo.Categories.Add(menuCategory); inputBindingInfo.Categories.Add(menuCategory);
// User defined categories // User defined categories
if(codon.Properties.Contains("category")) { if(codon.Properties.Contains("inputbindingcategories")) {
var additionalCategories = CommandManager.GetInputBindingCategoryCollection(codon.Properties["category"], true); var additionalCategories = CommandManager.GetInputBindingCategoryCollection(codon.Properties["inputbindingcategories"], true);
inputBindingInfo.Categories.AddRange(additionalCategories); inputBindingInfo.Categories.AddRange(additionalCategories);
} }
@ -187,8 +187,8 @@ namespace ICSharpCode.Core.Presentation
inputBindingInfo.RoutedCommandText = desc.CommandText; inputBindingInfo.RoutedCommandText = desc.CommandText;
} }
if(!string.IsNullOrEmpty(desc.Category)) { if(!string.IsNullOrEmpty(desc.Categories)) {
var categories = CommandManager.GetInputBindingCategoryCollection(desc.Category, true); var categories = CommandManager.GetInputBindingCategoryCollection(desc.Categories, true);
inputBindingInfo.Categories.AddRange(categories); inputBindingInfo.Categories.AddRange(categories);
} }
@ -221,8 +221,8 @@ namespace ICSharpCode.Core.Presentation
inputBindingInfo.RoutedCommandText = desc.CommandText; inputBindingInfo.RoutedCommandText = desc.CommandText;
} }
if(!string.IsNullOrEmpty(desc.Category)) { if(!string.IsNullOrEmpty(desc.Categories)) {
var categories = CommandManager.GetInputBindingCategoryCollection(desc.Category, true); var categories = CommandManager.GetInputBindingCategoryCollection(desc.Categories, true);
inputBindingInfo.Categories.AddRange(categories); inputBindingInfo.Categories.AddRange(categories);
} }

Loading…
Cancel
Save