Browse Source

MenuLocation documentation. Clean-up. Bug when searching for conflicting gestures.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/shortcuts@4653 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts^2
Sergej Andrejev 16 years ago
parent
commit
1fea46fd69
  1. 22
      AddIns/ICSharpCode.SharpDevelop.addin
  2. 5
      src/AddIns/Misc/ShortcutsManagement/ShortcutsManagement/Src/Data/ShortcutsFinder.cs
  3. 3
      src/Main/Core/Project/ICSharpCode.Core.csproj
  4. 23
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/CommandBindingInfoDescriptor.cs
  5. 6
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/CommandBindingInfoDoozer.cs
  6. 12
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/InputBindingCategoryDescriptor.cs
  7. 2
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/InputBindingCategoryDoozer.cs
  8. 9
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/InputBindingInfoDescriptor.cs
  9. 17
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/InputBindingInfoDoozer.cs
  10. 14
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/RoutedUICommandDescriptor.cs
  11. 20
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/RoutedUICommandDoozer.cs
  12. 44
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/MenuItem/MenuLocationDescriptor.cs
  13. 43
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/MenuItem/MenuLocationDoozer.cs
  14. 54
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/MenuItem/MenuRootDoozer.cs
  15. 2
      src/Main/ICSharpCode.Core.Presentation/CommandsService/CommandsService.cs
  16. 2
      src/Main/ICSharpCode.Core.Presentation/CommandsService/Profile/UserGestureProfile.cs
  17. 2
      src/Main/ICSharpCode.Core.Presentation/Input/InputGestureCollectionExtensions.cs

22
AddIns/ICSharpCode.SharpDevelop.addin

@ -74,20 +74,20 @@
</Path> </Path>
<Path name="/SharpDevelop/CommandManager/MenuLocations"> <Path name="/SharpDevelop/CommandManager/MenuLocations">
<MenuLocation path="/SharpDevelop/Workbench/MainMenu" category="/MainMenu" /> <MenuLocation menupath="/SharpDevelop/Workbench/MainMenu" categorypaths="/MainMenu" />
<MenuLocation path="/SharpDevelop/ViewContent/AvalonEdit/ContextMenu" category="/ContextMenus/TextEditor" /> <MenuLocation menupath="/SharpDevelop/ViewContent/AvalonEdit/ContextMenu" categorypaths="/ContextMenus/TextEditor" />
<MenuLocation path="/SharpDevelop/ViewContent/TextEditor/ContextMenu" category="/ContextMenus/TextEditor" /> <MenuLocation menupath="/SharpDevelop/ViewContent/TextEditor/ContextMenu" categorypaths="/ContextMenus/TextEditor" />
<MenuLocation path="/SharpDevelop/ViewContent/DefaultTextEditor/ClassMemberContextMenu" category="/ContextMenus/TextEditor" /> <MenuLocation menupath="/SharpDevelop/ViewContent/DefaultTextEditor/ClassMemberContextMenu" categorypaths="/ContextMenus/TextEditor" />
<MenuLocation path="/SharpDevelop/ViewContent/DefaultTextEditor/ClassBookmarkContextMenu" category="/ContextMenus/TextEditor" /> <MenuLocation menupath="/SharpDevelop/ViewContent/DefaultTextEditor/ClassBookmarkContextMenu" categorypaths="/ContextMenus/TextEditor" />
<MenuLocation path="/SharpDevelop/Workbench/OpenFileTab/ContextMenu" category="/ContextMenus/TextEditor/Tabs" /> <MenuLocation menupath="/SharpDevelop/Workbench/OpenFileTab/ContextMenu" categorypaths="/ContextMenus/TextEditor/Tabs" />
<MenuLocation path="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/Common" category="/ContextMenus/TextEditor/Refactoring" /> <MenuLocation menupath="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/Common" categorypaths="/ContextMenus/TextEditor/Refactoring" />
<MenuLocation path="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/Parameter" category="/ContextMenus/TextEditor/Refactoring" /> <MenuLocation menupath="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/Parameter" categorypaths="/ContextMenus/TextEditor/Refactoring" />
<MenuLocation path="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/LocalVariable" category="/ContextMenus/TextEditor/Refactoring" /> <MenuLocation menupath="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/LocalVariable" categorypaths="/ContextMenus/TextEditor/Refactoring" />
<MenuLocation path="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/ParameterDefinition" category="/ContextMenus/TextEditor/Refactoring" /> <MenuLocation menupath="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/ParameterDefinition" categorypaths="/ContextMenus/TextEditor/Refactoring" />
<MenuLocation path="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/LocalVariableDefinition" category="/ContextMenus/TextEditor/Refactoring" /> <MenuLocation menupath="/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/LocalVariableDefinition" categorypaths="/ContextMenus/TextEditor/Refactoring" />
</Path> </Path>

5
src/AddIns/Misc/ShortcutsManagement/ShortcutsManagement/Src/Data/ShortcutsFinder.cs

@ -161,7 +161,7 @@ namespace ICSharpCode.ShortcutsManagement.Data
{ {
// Apply filter to sub-categories // Apply filter to sub-categories
var isSubElementVisible = false; var isSubElementVisible = false;
foreach (var subCategory in category.SubCategories) { foreach (var subCategory in category.SubCategories) {
if (FilterGesture(subCategory, inputGestureTemplateCollection, mode)) { if (FilterGesture(subCategory, inputGestureTemplateCollection, mode)) {
isSubElementVisible = true; isSubElementVisible = true;
} }
@ -174,8 +174,7 @@ namespace ICSharpCode.ShortcutsManagement.Data
if (gestureMatched) { if (gestureMatched) {
shortcut.IsVisible = true; shortcut.IsVisible = true;
isSubElementVisible = true; isSubElementVisible = true;
} } else {
else {
shortcut.IsVisible = false; shortcut.IsVisible = false;
} }
} }

3
src/Main/Core/Project/ICSharpCode.Core.csproj

@ -68,7 +68,8 @@
<Compile Include="Src\AddInTree\AddIn\DefaultDoozers\Command\InputBindingCategoryDoozer.cs" /> <Compile Include="Src\AddInTree\AddIn\DefaultDoozers\Command\InputBindingCategoryDoozer.cs" />
<Compile Include="Src\AddInTree\AddIn\DefaultDoozers\Command\RoutedUICommandDescriptor.cs" /> <Compile Include="Src\AddInTree\AddIn\DefaultDoozers\Command\RoutedUICommandDescriptor.cs" />
<Compile Include="Src\AddInTree\AddIn\DefaultDoozers\Command\RoutedUICommandDoozer.cs" /> <Compile Include="Src\AddInTree\AddIn\DefaultDoozers\Command\RoutedUICommandDoozer.cs" />
<Compile Include="Src\AddInTree\AddIn\DefaultDoozers\MenuItem\MenuRootDoozer.cs" /> <Compile Include="Src\AddInTree\AddIn\DefaultDoozers\MenuItem\MenuLocationDescriptor.cs" />
<Compile Include="Src\AddInTree\AddIn\DefaultDoozers\MenuItem\MenuLocationDoozer.cs" />
<Compile Include="Src\AddInTree\AddIn\ExtensionPath.cs" /> <Compile Include="Src\AddInTree\AddIn\ExtensionPath.cs" />
<Compile Include="Src\AddInTree\AddIn\IConditionEvaluator.cs" /> <Compile Include="Src\AddInTree\AddIn\IConditionEvaluator.cs" />
<Compile Include="Src\AddInTree\AddIn\ICondition.cs" /> <Compile Include="Src\AddInTree\AddIn\ICondition.cs" />

23
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/CommandBindingInfoDescriptor.cs

@ -10,28 +10,23 @@ namespace ICSharpCode.Core
/// <summary> /// <summary>
/// Gets codon used to create this descriptor /// Gets codon used to create this descriptor
/// </summary> /// </summary>
public Codon Codon public Codon Codon {
{
get; private set; get; private set;
} }
/// <summary> /// <summary>
/// Gets full name of the command class containing user instructions /// Gets full name of the command class (should implement ICSharpCode.Core.ICommand or System.Window.Input.ICommand) containing user instructions associated with
/// /// <see cref="System.Windows.Input.CommandBinding" />
/// The class must implement <see cref="System.Windows.Input.ICommand" /> or <see cref="ICSharpCode.Core.ICommand" />
/// classes
/// </summary> /// </summary>
public string Class public string Class {
{
get; private set; get; private set;
} }
/// <summary> /// <summary>
/// Gets name of <see cref="System.Window.Input.RoutedUICommand" /> associated with descriptor /// Gets name of <see cref="System.Window.Input.RoutedUICommand" /> associated with descriptor
/// The name should be associated to a command in code using <see cref="ICSharpCode.Core.Presentation.CommandManager" /> /// A name should be associated to a command in code using <see cref="ICSharpCode.Core.Presentation.CommandManager" />
/// </summary> /// </summary>
public string Command public string Command {
{
get; private set; get; private set;
} }
@ -40,8 +35,7 @@ namespace ICSharpCode.Core
/// ///
/// If not provided <see cref="System.Window.Input.RoutedUICommand.Text" /> property value is used /// If not provided <see cref="System.Window.Input.RoutedUICommand.Text" /> property value is used
/// </summary> /// </summary>
public string CommandText public string CommandText {
{
get; private set; get; private set;
} }
@ -52,8 +46,7 @@ namespace ICSharpCode.Core
/// If this property is set then <see cref="OwnerTypeName" /> property can be ignored /// If this property is set then <see cref="OwnerTypeName" /> property can be ignored
/// If neither owner type nor owner instance is specified default owner type is applied /// If neither owner type nor owner instance is specified default owner type is applied
/// </summary> /// </summary>
public string OwnerInstanceName public string OwnerInstanceName {
{
get; private set; get; private set;
} }

6
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/CommandBindingInfoDoozer.cs

@ -8,8 +8,8 @@ namespace ICSharpCode.Core
/// or in addin file using RoutedUICommand node /// or in addin file using RoutedUICommand node
/// </attribute> /// </attribute>
/// <attribute name="class" use="required"> /// <attribute name="class" use="required">
/// Command class performing some action /// Full name of the command class (should implement ICSharpCode.Core.ICommand or System.Window.Input.ICommand) containing user instructions associated with
/// The class should implement System.Window.Input.ICommand or ICSharpCode.Core.ICommand class. /// System.Windows.Input.CommandBinding
/// </attribute> /// </attribute>
/// <attribute name="ownertype" use="optional"> /// <attribute name="ownertype" use="optional">
/// Name of binding owner type. /// Name of binding owner type.
@ -50,7 +50,7 @@ namespace ICSharpCode.Core
/// CommandBindingInfoDescriptor object /// CommandBindingInfoDescriptor object
/// </returns> /// </returns>
/// <summary> /// <summary>
/// Creates descriptor containing data describing ICSharpCode.Core.Presentation.CommandBindingInfo /// Registers ICSharpCode.Core.Presentation.CommandBindingInfo with specified pa
/// </summary> /// </summary>
public class CommandBindingInfoDoozer : IDoozer public class CommandBindingInfoDoozer : IDoozer
{ {

12
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/InputBindingCategoryDescriptor.cs

@ -12,24 +12,21 @@ namespace ICSharpCode.Core
/// <summary> /// <summary>
/// Gets category Id used to create category path /// Gets category Id used to create category path
/// </summary> /// </summary>
public string Id public string Id {
{
get; private set; get; private set;
} }
/// <summary> /// <summary>
/// Gets category name displayed to user /// Gets category name displayed to user
/// </summary> /// </summary>
public string Text public string Text {
{
get; private set; get; private set;
} }
/// <summary> /// <summary>
/// Gets children category descriptors /// Gets children category descriptors
/// </summary> /// </summary>
public List<InputBindingCategoryDescriptor> Children public List<InputBindingCategoryDescriptor> Children {
{
get; private set; get; private set;
} }
@ -38,7 +35,8 @@ namespace ICSharpCode.Core
/// </summary> /// </summary>
/// <param name="codon">Reference to codon used to create this descriptor</param> /// <param name="codon">Reference to codon used to create this descriptor</param>
/// <param name="subItems">List of sub-category descriptors</param> /// <param name="subItems">List of sub-category descriptors</param>
public InputBindingCategoryDescriptor(Codon codon, System.Collections.ArrayList subItems) { public InputBindingCategoryDescriptor(Codon codon, System.Collections.ArrayList subItems)
{
Id = codon.Properties["id"]; Id = codon.Properties["id"];
Text = codon.Properties["text"]; Text = codon.Properties["text"];
Children = subItems != null ? subItems.Cast<InputBindingCategoryDescriptor>().ToList() : new List<InputBindingCategoryDescriptor>(); Children = subItems != null ? subItems.Cast<InputBindingCategoryDescriptor>().ToList() : new List<InputBindingCategoryDescriptor>();

2
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/InputBindingCategoryDoozer.cs

@ -15,7 +15,7 @@ namespace ICSharpCode.Core
/// InputBindingCategory object /// InputBindingCategory object
/// </returns> /// </returns>
/// <summary> /// <summary>
/// Creates descriptor containing data describing ICSharpCode.Core.Presentation.InputBindingCategory /// Associates ICSharpCode.Core.Presentation.InputBindingCategory with path which can later be used to reference created ICSharpCode.Core.Presentation.InputBindingCategory
/// </summary> /// </summary>
public class InputBindingCategoryDoozer : IDoozer public class InputBindingCategoryDoozer : IDoozer
{ {

9
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/InputBindingInfoDescriptor.cs

@ -10,7 +10,8 @@ namespace ICSharpCode.Core
/// <summary> /// <summary>
/// Codon used to create this descriptor /// Codon used to create this descriptor
/// </summary> /// </summary>
public Codon Codon { public Codon Codon
{
get; private set; get; private set;
} }
@ -18,7 +19,8 @@ namespace ICSharpCode.Core
/// Gets name of <see cref="System.Window.Input.RoutedUICommand" /> associated with descriptor /// Gets name of <see cref="System.Window.Input.RoutedUICommand" /> associated with descriptor
/// The name should be associated to a command in code using <see cref="ICSharpCode.Core.Presentation.CommandManager" /> /// The name should be associated to a command in code using <see cref="ICSharpCode.Core.Presentation.CommandManager" />
/// </summary> /// </summary>
public string Command { public string Command
{
get; private set; get; private set;
} }
@ -28,7 +30,8 @@ namespace ICSharpCode.Core
/// ///
/// If not provided <see cref="System.Window.Input.RoutedUICommand.Text" /> property value is used /// If not provided <see cref="System.Window.Input.RoutedUICommand.Text" /> property value is used
/// </summary> /// </summary>
public string CommandText { public string CommandText
{
get; private set; get; private set;
} }

17
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/InputBindingInfoDoozer.cs

@ -42,20 +42,25 @@ namespace ICSharpCode.Core
/// CommandBindingInfoDescriptor object /// CommandBindingInfoDescriptor object
/// </returns> /// </returns>
/// <summary> /// <summary>
/// Creates descriptor containing data describing ICSharpCode.Core.Presentation.InputBindingInfo /// Registers ICSharpCode.Core.Presentation.InputBindingInfo with specified parameters
/// </summary> /// </summary>
public class InputBindingInfoDoozer : IDoozer public class InputBindingInfoDoozer : IDoozer
{ {
/// <see cref="IDoozer.HandleConditions" /> /// <inheritdoc />
public bool HandleConditions { public bool HandleConditions
{
get { get {
return true; return true;
} }
} }
/// <see cref="IDoozer.BuildItem(object, Codon, System.Collections.ArrayList)"> /// <summary>
/// Builds InputBindingInfoDescriptor /// Builds instance of <see cref="InputBindingInfoDescriptor" /> from codon
/// </see> /// </summary>
/// <param name="caller">Caller object</param>
/// <param name="codon">Codon</param>
/// <param name="subItems">Codon sub-items</param>
/// <returns>Instance of <see cref="InputBindingInfoDescriptor" /></returns>
public object BuildItem(object caller, Codon codon, System.Collections.ArrayList subItems) public object BuildItem(object caller, Codon codon, System.Collections.ArrayList subItems)
{ {
return new InputBindingInfoDescriptor(codon); return new InputBindingInfoDescriptor(codon);

14
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/RoutedUICommandDescriptor.cs

@ -3,32 +3,34 @@ using System;
namespace ICSharpCode.Core namespace ICSharpCode.Core
{ {
/// <summary> /// <summary>
/// Stores information about routed UI command loaded from add-in tree /// Describes <see cref="System.Windows.Input.RoutedUICommand" />
/// </summary> /// </summary>
public class RoutedUICommandDescriptor public class RoutedUICommandDescriptor
{ {
private Codon codon; private Codon codon;
/// <summary> /// <summary>
/// Text presented to user /// Gets text with routed command purpose description
/// </summary> /// </summary>
public string Text { public string Text
{
get { get {
return codon.Properties["text"]; return codon.Properties["text"];
} }
} }
/// <summary> /// <summary>
/// Routed command name /// Get routed command name
/// </summary> /// </summary>
public string Name { public string Name
{
get { get {
return codon.Properties["name"]; return codon.Properties["name"];
} }
} }
/// <summary> /// <summary>
/// Constructor /// Creates instance of <see cref="RoutedUICommandDescriptor" />
/// </summary> /// </summary>
/// <param name="codon">Reference to codon used to create this descriptor</param> /// <param name="codon">Reference to codon used to create this descriptor</param>
public RoutedUICommandDescriptor(Codon codon) public RoutedUICommandDescriptor(Codon codon)

20
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/RoutedUICommandDoozer.cs

@ -3,30 +3,34 @@ using System;
namespace ICSharpCode.Core namespace ICSharpCode.Core
{ {
/// <attribute name="name" use="required"> /// <attribute name="name" use="required">
/// Routed UI command name /// System.Window.Input.RoutedUICommand unique name
/// </attribute> /// </attribute>
/// <attribute name="text" use="required"> /// <attribute name="text" use="required">
/// Routed UI command displayed name /// Displayed text associated with created System.Window.Input.RoutedUICommand
/// </attribute> /// </attribute>
/// <usage>Only in /SharpDevelop/Workbench/CommandBindings</usage> /// <usage>Only in /SharpDevelop/CommandManager/RoutedUICommands</usage>
/// <returns> /// <returns>
/// RoutedUICommandDescriptor object /// RoutedUICommandDescriptor object
/// </returns> /// </returns>
/// <summary> /// <summary>
/// Creates descriptor containing information about routed UI command /// Creates new System.Window.Input.RoutedUICommand and associates it with a unique name which can be used later to reference routed command
/// </summary> /// </summary>
public class RoutedUICommandDoozer : IDoozer public class RoutedUICommandDoozer : IDoozer
{ {
/// <see cref="IDoozer.HandleConditions" /> /// <inheritdoc />
public bool HandleConditions { public bool HandleConditions {
get { get {
return false; return false;
} }
} }
/// <see cref="IDoozer.BuildItem(object, Codon, System.Collections.ArrayList)"> /// <summary>
/// Builds RoutedUICommandDescriptor /// Builds instance of <see cref="RoutedUICommandDescriptor" /> from codon
/// </see> /// </summary>
/// <param name="caller">Caller object</param>
/// <param name="codon">Codon</param>
/// <param name="subItems">Codon sub-items</param>
/// <returns>Instance of <see cref="RoutedUICommandDescriptor" /></returns>
public object BuildItem(object caller, Codon codon, System.Collections.ArrayList subItems) public object BuildItem(object caller, Codon codon, System.Collections.ArrayList subItems)
{ {
return new RoutedUICommandDescriptor(codon); return new RoutedUICommandDescriptor(codon);

44
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/MenuItem/MenuLocationDescriptor.cs

@ -0,0 +1,44 @@
using System;
namespace ICSharpCode.Core
{
/// <summary>
/// Describes shortcuts in menu affiliation to input binding category
///
/// Root-level ICSharpCode.Core.Presentation.InputBindingInfo are associated with provided categories. For ICSharpCode.Core.Presentation.InputBindingInfo
/// in sub-menus new ICSharpCode.Core.Presentation.InputBindingCategory is created from sub-menu id and title
/// </summary>
public class MenuLocationDescriptor
{
/// <summary>
/// Gets paths to categories associated with menu
/// </summary>
public string CategoryPaths
{
get; private set;
}
/// <summary>
/// Gets path to menu root
/// </summary>
public string MenuPath
{
get; private set;
}
/// <summary>
/// Creates new instance of <see cref="MenuLocationDescriptor" />
/// </summary>
/// <param name="caller">Caller object</param>
/// <param name="codon">Reference to codon used to create this descriptor</param>
public MenuLocationDescriptor(object caller, Codon codon)
{
if(!codon.Properties.Contains("menupath") || !codon.Properties.Contains("categorypaths")){
throw new ArgumentException("Menu location should have both menu path and category paths assigned");
}
MenuPath = codon.Properties["menupath"];
CategoryPaths = codon.Properties["categorypaths"];
}
}
}

43
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/MenuItem/MenuLocationDoozer.cs

@ -0,0 +1,43 @@
using System;
using System.Collections;
namespace ICSharpCode.Core
{
/// <attribute name="menupath" use="required">
/// Path to menu root category
/// </attribute>
/// <attribute name="name" use="required">
/// Category name displayed to user
/// </attribute>
/// <usage>Only in /SharpDevelop/CommandManager/MenuLocations</usage>
/// <returns>
/// MenuLocationDoozer object
/// </returns>
/// <summary>
/// Describes shortcuts in menu affiliation to input binding categories
///
/// Root-level ICSharpCode.Core.Presentation.InputBindingInfo are associated with provided category. For ICSharpCode.Core.Presentation.InputBindingInfo
/// in sub-menus new ICSharpCode.Core.Presentation.InputBindingCategory is created from sub-menu id and title
/// </summary>
public class MenuLocationDoozer : IDoozer
{
/// <inheritdoc />
public bool HandleConditions {
get {
return true;
}
}
/// <summary>
/// Builds instance of <see cref="MenuLocationDescriptor" /> from codon
/// </summary>
/// <param name="caller">Caller object</param>
/// <param name="codon">Codon</param>
/// <param name="subItems">Codon sub-items</param>
/// <returns>Instance of <see cref="MenuLocationDescriptor" /></returns>
public object BuildItem(object caller, Codon codon, ArrayList subItems)
{
return new MenuLocationDescriptor(caller, codon);
}
}
}

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

@ -1,54 +0,0 @@
/*
* Created by SharpDevelop.
* User: Administrator
* Date: 6/28/2009
* Time: 10:12 PM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections;
namespace ICSharpCode.Core
{
/// <summary>
/// Description of MenuDescriptionDoozer.
/// </summary>
public class MenuLocationDoozer : IDoozer
{
public bool HandleConditions {
get {
return true;
}
}
public object BuildItem(object caller, Codon codon, ArrayList subItems)
{
return new MenuLocationDescriptor(caller, codon);
}
}
public class MenuLocationDescriptor
{
public string Category
{
get; private set;
}
public string Path
{
get; private set;
}
public MenuLocationDescriptor(object caller, 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"];
Category = codon.Properties["category"];
}
}
}

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

@ -25,7 +25,7 @@ namespace ICSharpCode.Core.Presentation
{ {
var menuRoots = AddInTree.BuildItems<MenuLocationDescriptor>(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.MenuPath, caller, menuRoot.CategoryPaths);
} }
} }

2
src/Main/ICSharpCode.Core.Presentation/CommandsService/Profile/UserGestureProfile.cs

@ -89,7 +89,7 @@ namespace ICSharpCode.Core.Presentation
identifierTypeName = ownerTypeAttribute.Value; identifierTypeName = ownerTypeAttribute.Value;
} }
var identifier = BindingInfoTemplate.Create(identifierInstanceName, identifierTypeName, bindingInfoNode.Attributes["routed-command"].Value); var identifier = BindingInfoTemplate.Create(identifierInstanceName, identifierTypeName, bindingInfoNode.Attributes["routedcommand"].Value);
var gestures = (InputGestureCollection)new InputGestureCollectionConverter().ConvertFromInvariantString(bindingInfoNode.Attributes["gestures"].Value); var gestures = (InputGestureCollection)new InputGestureCollectionConverter().ConvertFromInvariantString(bindingInfoNode.Attributes["gestures"].Value);
this[identifier] = gestures; this[identifier] = gestures;
} }

2
src/Main/ICSharpCode.Core.Presentation/Input/InputGestureCollectionExtensions.cs

@ -20,7 +20,7 @@ namespace ICSharpCode.Core.Presentation
/// <returns><code>true</code> if first collection contains item which can be qualified as template for any item from second collection; otherwise <code>false</code></returns> /// <returns><code>true</code> if first collection contains item which can be qualified as template for any item from second collection; otherwise <code>false</code></returns>
public static bool ContainsTemplateForAny(this InputGestureCollection inputGestureTemplateCollection, InputGestureCollection testedInputGestureCollection, GestureCompareMode mode) { public static bool ContainsTemplateForAny(this InputGestureCollection inputGestureTemplateCollection, InputGestureCollection testedInputGestureCollection, GestureCompareMode mode) {
if((inputGestureTemplateCollection == null || inputGestureTemplateCollection.Count == 0) && (testedInputGestureCollection == null || testedInputGestureCollection.Count == 0)) { if((inputGestureTemplateCollection == null || inputGestureTemplateCollection.Count == 0) && (testedInputGestureCollection == null || testedInputGestureCollection.Count == 0)) {
return true; return mode != GestureCompareMode.Conflicting;
} }
foreach (InputGesture template in inputGestureTemplateCollection) { foreach (InputGesture template in inputGestureTemplateCollection) {
if (template.IsTemplateForAny(testedInputGestureCollection, mode)) { if (template.IsTemplateForAny(testedInputGestureCollection, mode)) {

Loading…
Cancel
Save