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

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

@ -75,7 +75,6 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -75,7 +75,6 @@ namespace ICSharpCode.SharpDevelop.Gui
public void Initialize()
{
CommandsService.RegisterInputBindingCategories(this, "/SharpDevelop/Workbench/InputBindingCategories");
// Use shortened assembly qualified name to not lose user defined gestures
// when sharp develop is updated
@ -85,10 +84,11 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -85,10 +84,11 @@ namespace ICSharpCode.SharpDevelop.Gui
CommandsService.RegisterBuiltInRoutedUICommands();
// Load all commands and and key bindings from addin tree
CommandsService.RegisterRoutedUICommands(this, "/SharpDevelop/Workbench/RoutedUICommands");
CommandsService.RegisterCommandBindings(this, "/SharpDevelop/Workbench/CommandBindings");
CommandsService.RegisterInputBindings(this, "/SharpDevelop/Workbench/InputBindings");
CommandsService.RegisterMenuBindings("/SharpDevelop/MenuLocations", this);
CommandsService.RegisterInputBindingCategories(this, "/SharpDevelop/CommandManager/InputBindingCategories");
CommandsService.RegisterRoutedUICommands(this, "/SharpDevelop/CommandManager/RoutedUICommands");
CommandsService.RegisterCommandBindings(this, "/SharpDevelop/CommandManager/CommandBindings");
CommandsService.RegisterInputBindings(this, "/SharpDevelop/CommandManager/InputBindings");
CommandsService.RegisterMenuBindings(this, "/SharpDevelop/CommandManager/MenuLocations");
// Register context and load all commands from addin
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 @@ -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)
/// assign this input binding to provided category
/// </summary>
public string Category {
public string Categories {
get; private set;
}
@ -92,7 +92,7 @@ namespace ICSharpCode.Core @@ -92,7 +92,7 @@ namespace ICSharpCode.Core
OwnerInstanceName = Codon.Properties["owner-instance"];
OwnerTypeName = Codon.Properties["owner-type"];
Gestures = Codon.Properties["gestures"];
Category = Codon.Properties["category"];
Categories = Codon.Properties["categories"];
Name = Codon.Properties["name"];
}
}

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

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

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

@ -14,7 +14,7 @@ namespace ICSharpCode.Core @@ -14,7 +14,7 @@ namespace ICSharpCode.Core
/// <summary>
/// Description of MenuDescriptionDoozer.
/// </summary>
public class MenuRootDoozer : IDoozer
public class MenuLocationDoozer : IDoozer
{
public bool HandleConditions {
get {
@ -24,15 +24,13 @@ namespace ICSharpCode.Core @@ -24,15 +24,13 @@ namespace ICSharpCode.Core
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
{
get; private set;
@ -43,15 +41,14 @@ namespace ICSharpCode.Core @@ -43,15 +41,14 @@ namespace ICSharpCode.Core
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"];
if(codon.Properties.Contains("category")){
Category = codon.Properties["category"];
}
Category = codon.Properties["category"];
}
}
}

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

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

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

@ -14,9 +14,9 @@ namespace ICSharpCode.Core.Presentation @@ -14,9 +14,9 @@ namespace ICSharpCode.Core.Presentation
/// </summary>
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) {
CommandsService.RegisterSingleMenuBindings(menuRoot.Path, caller, menuRoot.Category);
}
@ -75,8 +75,8 @@ namespace ICSharpCode.Core.Presentation @@ -75,8 +75,8 @@ namespace ICSharpCode.Core.Presentation
inputBindingInfo.Categories.Add(menuCategory);
// User defined categories
if(codon.Properties.Contains("category")) {
var additionalCategories = CommandManager.GetInputBindingCategoryCollection(codon.Properties["category"], true);
if(codon.Properties.Contains("inputbindingcategories")) {
var additionalCategories = CommandManager.GetInputBindingCategoryCollection(codon.Properties["inputbindingcategories"], true);
inputBindingInfo.Categories.AddRange(additionalCategories);
}
@ -187,8 +187,8 @@ namespace ICSharpCode.Core.Presentation @@ -187,8 +187,8 @@ namespace ICSharpCode.Core.Presentation
inputBindingInfo.RoutedCommandText = desc.CommandText;
}
if(!string.IsNullOrEmpty(desc.Category)) {
var categories = CommandManager.GetInputBindingCategoryCollection(desc.Category, true);
if(!string.IsNullOrEmpty(desc.Categories)) {
var categories = CommandManager.GetInputBindingCategoryCollection(desc.Categories, true);
inputBindingInfo.Categories.AddRange(categories);
}
@ -221,8 +221,8 @@ namespace ICSharpCode.Core.Presentation @@ -221,8 +221,8 @@ namespace ICSharpCode.Core.Presentation
inputBindingInfo.RoutedCommandText = desc.CommandText;
}
if(!string.IsNullOrEmpty(desc.Category)) {
var categories = CommandManager.GetInputBindingCategoryCollection(desc.Category, true);
if(!string.IsNullOrEmpty(desc.Categories)) {
var categories = CommandManager.GetInputBindingCategoryCollection(desc.Categories, true);
inputBindingInfo.Categories.AddRange(categories);
}

Loading…
Cancel
Save