Browse Source

Use WPF commands for Build and Run main menus

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4143 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts^2
Sergej Andrejev 17 years ago
parent
commit
0e385eded1
  1. 202
      AddIns/ICSharpCode.SharpDevelop.addin
  2. 212
      data/schemas/AddIn.xsd
  3. 33
      doc/technotes/ConditionList.html
  4. 264
      doc/technotes/DoozerList.html
  5. 2
      src/Main/Base/Project/Src/Gui/Workbench/Layouts/AvalonWorkbenchWindow.cs
  6. 7
      src/Main/Base/Project/Src/Gui/Workbench/WpfWorkbench.cs
  7. 1
      src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs
  8. 16
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/CommandBindingDoozer.cs
  9. 10
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/InputBindingDoozer.cs
  10. 2
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/RoutedUICommandDescriptor.cs
  11. 10
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/RoutedUICommandDoozer.cs
  12. 4
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/MenuItem/MenuItemDoozer.cs
  13. 191
      src/Main/ICSharpCode.Core.Presentation/CommandsService/CommandsRegistry.cs
  14. 17
      src/Main/ICSharpCode.Core.Presentation/CommandsService/CommandsService.cs
  15. 5
      src/Main/ICSharpCode.Core.Presentation/CommandsService/WpfCommandWrapper.cs
  16. 9
      src/Main/ICSharpCode.Core.Presentation/Menu/MenuCommand.cs

202
AddIns/ICSharpCode.SharpDevelop.addin

@ -51,22 +51,87 @@ @@ -51,22 +51,87 @@
<Import assembly=":ICSharpCode.TextEditor"/>
</Runtime>
<!-- Commands registry test -->
<Path name="/SharpDevelop/Workbench/RoutedUICommands">
<RoutedUICommand id="SharpDevelop.CreateNewFile" text="Create new file" />
<RoutedUICommand name="SharpDevelop.CreateNewFile" text="Create new file" />
<RoutedUICommand name="SDBuildCommands.BuildSolution" text="${res:XML.MainMenu.BuildMenu.BuildSolution}" />
<RoutedUICommand name="SDBuildCommands.RebuildSolution" text="${res:XML.MainMenu.BuildMenu.RebuildSolution}" />
<RoutedUICommand name="SDBuildCommands.CleanSolution" text="${res:XML.MainMenu.BuildMenu.CleanSolution}" />
<RoutedUICommand name="SDBuildCommands.BuildProject" text="${res:XML.MainMenu.BuildMenu.BuildProject}" />
<RoutedUICommand name="SDBuildCommands.RebuildProject" text="${res:XML.MainMenu.BuildMenu.RebuildProject}" />
<RoutedUICommand name="SDBuildCommands.CleanProject" text="${res:XML.MainMenu.BuildMenu.CleanProject}" />
<RoutedUICommand name="SDBuildCommands.AbortBuild" text="${res:XML.MainMenu.BuildMenu.AbortBuild}" />
<RoutedUICommand name="SDBuildCommands.EditConfigurationsCommand" text="${res:XML.MainMenu.BuildMenu.EditConfigurationsPlatforms}" />
<RoutedUICommand name="SDWindowCommands.SplitView" text="TODO: Split view" />
<RoutedUICommand name="SDProjectCommands.AddNewProjectToSolution" text="${res:ProjectComponent.ContextMenu.NewProject}" />
<RoutedUICommand name="SDProjectCommands.AddExitingProjectToSolution" text="${res:ProjectComponent.ContextMenu.ExistingProject}" />
<RoutedUICommand name="SDProjectCommands.AddExistingItemToSolution" text="${res:ProjectComponent.ContextMenu.AddItem}" />
<RoutedUICommand name="SDProjectCommands.AddNewSolutionFolderToSolution" text="${res:ProjectComponent.ContextMenu.NewSolutionFolder}" />
<RoutedUICommand name="SDDebugCommands.Execute" text="${res:XML.MainMenu.RunMenu.Run}" />
<RoutedUICommand name="SDDebugCommands.ExecuteWithoutDebugger" text="${res:XML.MainMenu.DebugMenu.RunWithoutDebug}" />
<RoutedUICommand name="SDDebugCommands.StopDebugging" text="${res:XML.MainMenu.DebugMenu.Stop}" />
<RoutedUICommand name="SDDebugCommands.AttachToProcess" text="${res:XML.MainMenu.DebugMenu.Attach}" />
<RoutedUICommand name="SDDebugCommands.DetachFromProcess" text="${res:XML.MainMenu.DebugMenu.Detach}" />
<RoutedUICommand name="SDDebugCommands.BreakDebugging" text="${res:XML.MainMenu.DebugMenu.Break}" />
<RoutedUICommand name="SDDebugCommands.ContinueDebugging" text="${res:XML.MainMenu.DebugMenu.Continue}" />
<RoutedUICommand name="SDDebugCommands.StepOver" text="${res:XML.MainMenu.DebugMenu.StepOver}" />
<RoutedUICommand name="SDDebugCommands.StepInto" text="${res:XML.MainMenu.DebugMenu.StepInto}" />
<RoutedUICommand name="SDDebugCommands.StepOut" text="${res:XML.MainMenu.DebugMenu.StepOut}" />
<RoutedUICommand name="SDDebugCommands.ToggleBreakpoint" text="${res:XML.MainMenu.DebugMenu.ToggleBreakpoint}" />
</Path>
<Path name="/SharpDevelop/Workbench/CommandBindings">
<CommandBinding id="CreateNewFile"
command="SharpDevelop.CreateNewFile"
class="ICSharpCode.SharpDevelop.Commands.TestCommand"
lazy="true" />
<CommandBinding command="SharpDevelop.CreateNewFile" class="ICSharpCode.SharpDevelop.Commands.TestCommand" />
<CommandBinding command="SDBuildCommands.BuildSolution" class="ICSharpCode.SharpDevelop.Project.Commands.Build" />
<CommandBinding command="SDBuildCommands.RebuildSolution" class="ICSharpCode.SharpDevelop.Project.Commands.Rebuild" />
<CommandBinding command="SDBuildCommands.CleanSolution" class="ICSharpCode.SharpDevelop.Project.Commands.Clean" />
<CommandBinding command="SDBuildCommands.BuildProject" class="ICSharpCode.SharpDevelop.Project.Commands.BuildProject" />
<CommandBinding command="SDBuildCommands.RebuildProject" class="ICSharpCode.SharpDevelop.Project.Commands.RebuildProject" />
<CommandBinding command="SDBuildCommands.CleanProject" class="ICSharpCode.SharpDevelop.Project.Commands.CleanProject" />
<CommandBinding command="SDBuildCommands.AbortBuild" class="ICSharpCode.SharpDevelop.Project.Commands.AbortBuild" />
<CommandBinding command="SDBuildCommands.EditConfigurationsCommand" class="ICSharpCode.SharpDevelop.Project.Commands.EditConfigurationsCommand" />
<CommandBinding command="SDProjectCommands.AddNewProjectToSolution" class="ICSharpCode.SharpDevelop.Project.Commands.AddNewProjectToSolution" />
<CommandBinding command="SDProjectCommands.AddExitingProjectToSolution" class="ICSharpCode.SharpDevelop.Project.Commands.AddExitingProjectToSolution" />
<CommandBinding command="SDProjectCommands.AddExistingItemToSolution" class="ICSharpCode.SharpDevelop.Project.Commands.AddExistingItemToSolution" />
<CommandBinding command="SDProjectCommands.AddNewSolutionFolderToSolution" class="ICSharpCode.SharpDevelop.Project.Commands.AddNewSolutionFolderToSolution" />
<CommandBinding command="SDDebugCommands.Execute" class="ICSharpCode.SharpDevelop.Project.Commands.Execute" />
<CommandBinding command="SDDebugCommands.ExecuteWithoutDebugger" class="ICSharpCode.SharpDevelop.Project.Commands.ExecuteWithoutDebugger" />
<CommandBinding command="SDDebugCommands.StopDebugging" class="ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand" />
<CommandBinding command="SDDebugCommands.AttachToProcess" class="ICSharpCode.SharpDevelop.Project.Commands.AttachToProcessCommand" />
<CommandBinding command="SDDebugCommands.DetachFromProcess" class="ICSharpCode.SharpDevelop.Project.Commands.DetachFromProcessCommand" />
<CommandBinding command="SDDebugCommands.BreakDebugging" class="ICSharpCode.SharpDevelop.Project.Commands.BreakDebuggingCommand" />
<CommandBinding command="SDDebugCommands.ContinueDebugging" class="ICSharpCode.SharpDevelop.Project.Commands.ContinueDebuggingCommand" />
<CommandBinding command="SDDebugCommands.StepOver" class="ICSharpCode.SharpDevelop.Project.Commands.StepDebuggingCommand" />
<CommandBinding command="SDDebugCommands.StepInto" class="ICSharpCode.SharpDevelop.Project.Commands.StepIntoDebuggingCommand" />
<CommandBinding command="SDDebugCommands.StepOut" class="ICSharpCode.SharpDevelop.Project.Commands.StepOutDebuggingCommand" />
<CommandBinding command="SDDebugCommands.ToggleBreakpoint" class="ICSharpCode.SharpDevelop.Project.Commands.ToggleBreakpointCommand" />
</Path>
<Path name="/SharpDevelop/Workbench/InputBindings">
<InputBinding id="CreateNewFile1"
command="SharpDevelop.CreateNewFile"
gesture="Ctrl+M" />
<InputBinding command="SharpDevelop.CreateNewFile" gesture="Ctrl+M" />
<InputBinding command="SDBuildCommands.BuildSolution" gesture="F8" />
<InputBinding command="SDBuildCommands.RebuildSolution" gesture="Alt+F8" />
<InputBinding command="SDBuildCommands.BuildProject" gesture="F9" />
<InputBinding command="SDBuildCommands.RebuildProject" gesture="Alt+F9" />
<InputBinding command="SDDebugCommands.Execute" gesture="F5" />
<InputBinding command="SDDebugCommands.ExecuteWithoutDebugger" gesture="Control+F5" />
<InputBinding command="SDDebugCommands.BreakDebugging" gesture="Control+Alt+B" />
<InputBinding command="SDDebugCommands.ContinueDebugging" gesture="Control+Alt+B" />
<InputBinding command="SDDebugCommands.StepOver" gesture="F10" />
<InputBinding command="SDDebugCommands.StepInto" gesture="F11" />
<InputBinding command="SDDebugCommands.StepOut" gesture="Shift+F11" />
<InputBinding command="SDDebugCommands.ToggleBreakpoint" gesture="F7" />
</Path>
<!-- Commands registry test -->
@ -226,33 +291,41 @@ @@ -226,33 +291,41 @@
label = "${res:XML.MainMenu.BuildMenu.BuildSolution}"
shortcut = "F8"
icon = "Icons.16x16.BuildCombine"
class = "ICSharpCode.SharpDevelop.Project.Commands.Build"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.Build"
command = "BuildCommands.Build" />
<MenuItem id = "Rebuild"
label = "${res:XML.MainMenu.BuildMenu.RebuildSolution}"
shortcut = "Alt|F8"
class = "ICSharpCode.SharpDevelop.Project.Commands.Rebuild"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.Rebuild"
command = "BuildCommands.Rebuild" />
<MenuItem id = "Clean"
label = "${res:XML.MainMenu.BuildMenu.CleanSolution}"
class = "ICSharpCode.SharpDevelop.Project.Commands.Clean"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.Clean"
command = "BuildCommands.Clean" />
<MenuItem id = "CombineBuildGroupSeparator" type = "Separator"/>
<Condition name="WriteableSolution" action="Disable">
<MenuItem id = "CombineAddMenu" label = "${res:ProjectComponent.ContextMenu.AddMenu}" type = "Menu">
<MenuItem id = "AddNewProjectToSolution"
label = "${res:ProjectComponent.ContextMenu.NewProject}"
icon = "Icons.16x16.NewProjectIcon"
class = "ICSharpCode.SharpDevelop.Project.Commands.AddNewProjectToSolution"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.AddNewProjectToSolution"
command = "SDProjectCommands.AddNewProjectToSolution" />
<MenuItem id = "AddExitingProjectToSolution"
label = "${res:ProjectComponent.ContextMenu.ExistingProject}"
class = "ICSharpCode.SharpDevelop.Project.Commands.AddExitingProjectToSolution"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.AddExitingProjectToSolution"
command = "SDProjectCommands.AddExitingProjectToSolution" />
<MenuItem id = "Separator1" type = "Separator" />
<MenuItem id = "AddItem"
label = "${res:ProjectComponent.ContextMenu.AddItem}"
class = "ICSharpCode.SharpDevelop.Project.Commands.AddExistingItemToSolution"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.AddExistingItemToSolution"
command = "SDProjectCommands.AddExistingItemToSolution" />
<MenuItem id = "AddNewSolutionFolderToSolution"
icon = "ProjectBrowser.SolutionFolder.CreateNew"
label = "${res:ProjectComponent.ContextMenu.NewSolutionFolder}"
class = "ICSharpCode.SharpDevelop.Project.Commands.AddNewSolutionFolderToSolution"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.AddNewSolutionFolderToSolution"
command = "SDProjectCommands.AddNewSolutionFolderToSolution" />
</MenuItem>
</Condition>
@ -261,7 +334,8 @@ @@ -261,7 +334,8 @@
label = "${res:XML.MainMenu.EditMenu.Paste}"
icon = "Icons.16x16.PasteIcon"
loadclasslazy = "false"
class = "ICSharpCode.SharpDevelop.Project.Commands.PasteProjectBrowserNode"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.PasteProjectBrowserNode"
command = "" />
<MenuItem id = "Rename"
label = "${res:ProjectComponent.ContextMenu.Rename}"
shortcut = "F2"
@ -297,13 +371,16 @@ @@ -297,13 +371,16 @@
<MenuItem id = "Build project"
label = "${res:ProjectComponent.ContextMenu.Build}"
icon = "Icons.16x16.BuildCurrentSelectedProject"
class = "ICSharpCode.SharpDevelop.Project.Commands.BuildProject"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.BuildProject"
command = "SDBuildCommands.BuildProject" />
<MenuItem id = "Rebuild project"
label = "${res:ProjectComponent.ContextMenu.Rebuild}"
class = "ICSharpCode.SharpDevelop.Project.Commands.RebuildProject"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.RebuildProject"
command = "SDBuildCommands.RebuildProject" />
<MenuItem id = "Clean project"
label = "${res:ProjectComponent.ContextMenu.Clean}"
class = "ICSharpCode.SharpDevelop.Project.Commands.CleanProject"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.CleanProject"
command = "SDBuildCommands.CleanProject" />
<!--<MenuItem id = "Publish project"
label = "${res:XML.MainMenu.BuildMenu.PublishProject}"
class = "ICSharpCode.SharpDevelop.Project.Commands.PublishProject"/>-->
@ -496,7 +573,8 @@ @@ -496,7 +573,8 @@
type = "Item"
icon = "Icons.16x16.PasteIcon"
loadclasslazy = "false"
class = "ICSharpCode.SharpDevelop.Project.Commands.PasteProjectBrowserNode"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.PasteProjectBrowserNode"
/>
<MenuItem id = "Remove"
label = "${res:Global.RemoveButtonText}"
type = "Item"
@ -1269,37 +1347,37 @@ @@ -1269,37 +1347,37 @@
icon = "Icons.16x16.UndoIcon"
type = "Item"
shortcut = "Control|Z"
command = "Undo"/>
command = "ApplicationCommands.Undo"/>
<MenuItem id = "Redo"
label = "${res:XML.MainMenu.EditMenu.Redo}"
icon = "Icons.16x16.RedoIcon"
type = "Item"
shortcut = "Control|Y"
command = "Redo"/>
command = "ApplicationCommands.Redo"/>
<MenuItem id = "Separator1" type = "Separator" />
<MenuItem id = "Cut"
label = "${res:XML.MainMenu.EditMenu.Cut}"
icon = "Icons.16x16.CutIcon"
type = "Item"
shortcut = "Control|X"
command = "Cut"/>
command = "ApplicationCommands.Cut"/>
<MenuItem id = "Copy"
label = "${res:XML.MainMenu.EditMenu.Copy}"
icon = "Icons.16x16.CopyIcon"
type = "Item"
shortcut = "Control|C"
command = "Copy"/>
command = "ApplicationCommands.Copy"/>
<MenuItem id = "Paste"
label = "${res:XML.MainMenu.EditMenu.Paste}"
icon = "Icons.16x16.PasteIcon"
type = "Item"
shortcut = "Control|V"
command = "Paste"/>
command = "ApplicationCommands.Paste"/>
<MenuItem id = "Delete"
label = "${res:XML.MainMenu.EditMenu.Delete}"
icon = "Icons.16x16.DeleteIcon"
type = "Item"
command = "Delete"/>
command = "ApplicationCommands.Delete"/>
<MenuItem id = "Separator2" type = "Separator" />
<Condition name = "WindowActive" activewindow="ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.ITextEditorControlProvider" action="Disable">
<MenuItem id = "Insert" label = "${res:XML.MainMenu.EditMenu.Insert}" type="Menu">
@ -1325,7 +1403,7 @@ @@ -1325,7 +1403,7 @@
label = "${res:XML.MainMenu.EditMenu.SelectAll}"
type = "Item"
shortcut = "Control|A"
command = "SelectAll"/>
command = "ApplicationCommands.SelectAll"/>
<MenuItem id = "Separator4" type = "Separator" />
<ComplexCondition action="Disable">
<Or>
@ -1405,28 +1483,35 @@ @@ -1405,28 +1483,35 @@
label = "${res:XML.MainMenu.BuildMenu.BuildSolution}"
shortcut = "F8"
icon = "Icons.16x16.BuildCombine"
class = "ICSharpCode.SharpDevelop.Project.Commands.Build"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.Build"
command = "SDBuildCommands.BuildSolution"
/>
<MenuItem id = "Rebuild"
label = "${res:XML.MainMenu.BuildMenu.RebuildSolution}"
shortcut = "Alt|F8"
class = "ICSharpCode.SharpDevelop.Project.Commands.Rebuild"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.Rebuild"
command = "SDBuildCommands.RebuildSolution" />
<MenuItem id = "Clean"
label = "${res:XML.MainMenu.BuildMenu.CleanSolution}"
class = "ICSharpCode.SharpDevelop.Project.Commands.Clean"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.Clean"
command = "SDBuildCommands.CleanSolution" />
<Condition name = "ProjectActive" activeproject="*">
<MenuItem id = "Separator1" type = "Separator" />
<MenuItem id = "Build project"
label = "${res:XML.MainMenu.BuildMenu.BuildProject}"
shortcut = "F9"
icon = "Icons.16x16.BuildCurrentSelectedProject"
class = "ICSharpCode.SharpDevelop.Project.Commands.BuildProject"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.BuildProject"
command = "SDBuildCommands.BuildProject" />
<MenuItem id = "Rebuild project"
label = "${res:XML.MainMenu.BuildMenu.RebuildProject}"
shortcut = "Alt|F9"
class = "ICSharpCode.SharpDevelop.Project.Commands.RebuildProject"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.RebuildProject"
command = "SDBuildCommands.RebuildProject" />
<MenuItem id = "Clean project"
label = "${res:XML.MainMenu.BuildMenu.CleanProject}"
class = "ICSharpCode.SharpDevelop.Project.Commands.CleanProject"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.CleanProject"
command = "SDBuildCommands.CleanProject" />
<!--<MenuItem id = "Publish project"
label = "${res:XML.MainMenu.BuildMenu.PublishProject}"
class = "ICSharpCode.SharpDevelop.Project.Commands.PublishProject"/>-->
@ -1436,21 +1521,28 @@ @@ -1436,21 +1521,28 @@
label="${res:XML.MainMenu.BuildMenu.AbortBuild}"
shortcut="Pause"
class="ICSharpCode.SharpDevelop.Project.Commands.AbortBuild"
loadclasslazy="false"/>
loadclasslazy="false"
command="SDBuildCommands.AbortBuild" />
<MenuItem id = "Separator3" type = "Separator" />
<MenuItem id = "SetConfiguration"
label = "${res:XML.MainMenu.BuildMenu.SetConfiguration}"
type = "Menu">
<MenuItem id = "ConfigurationBuilder" type = "Builder" class = "ICSharpCode.SharpDevelop.Project.Commands.SetConfigurationMenuBuilder"/>
<MenuItem id = "ConfigurationBuilder"
type = "Builder"
class = "ICSharpCode.SharpDevelop.Project.Commands.SetConfigurationMenuBuilder" />
</MenuItem>
<MenuItem id = "SetPlatform"
label = "${res:XML.MainMenu.BuildMenu.SetPlatform}"
type = "Menu">
<MenuItem id = "PlatformBuilder" type = "Builder" class = "ICSharpCode.SharpDevelop.Project.Commands.SetPlatformMenuBuilder"/>
<MenuItem
id = "PlatformBuilder"
type = "Builder"
class = "ICSharpCode.SharpDevelop.Project.Commands.SetPlatformMenuBuilder" />
</MenuItem>
<MenuItem id = "EditConfigurations"
label = "${res:XML.MainMenu.BuildMenu.EditConfigurationsPlatforms}"
class = "ICSharpCode.SharpDevelop.Project.Commands.EditConfigurationsCommand"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.EditConfigurationsCommand"
command = "SDBuildCommands.EditConfigurationsCommand" />
</ComplexCondition>
</MenuItem> <!-- end BUILD menu -->
@ -1462,7 +1554,9 @@ @@ -1462,7 +1554,9 @@
label = "${res:XML.MainMenu.RunMenu.Run}"
icon = "Icons.16x16.RunProgramIcon"
shortcut = "F5"
class = "ICSharpCode.SharpDevelop.Project.Commands.Execute"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.Execute"
command = "SDDebugCommands.Execute"
/>
</Condition>
</Condition>
</Condition>
@ -1474,7 +1568,8 @@ @@ -1474,7 +1568,8 @@
label = "${res:XML.MainMenu.DebugMenu.RunWithoutDebug}"
icon = "Icons.16x16.Debug.StartWithoutDebugging"
shortcut = "Control|F5"
class = "ICSharpCode.SharpDevelop.Project.Commands.ExecuteWithoutDebugger"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.ExecuteWithoutDebugger"
command = "SDDebugCommands.ExecuteWithoutDebugger" />
</Condition>
</Condition>
</Condition>
@ -1484,7 +1579,8 @@ @@ -1484,7 +1579,8 @@
<MenuItem id = "Stop"
label = "${res:XML.MainMenu.DebugMenu.Stop}"
icon = "Icons.16x16.StopProcess"
class = "ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand"
command = "SDDebugCommands.StopDebugging" />
</Condition>
</Condition>
@ -1492,7 +1588,8 @@ @@ -1492,7 +1588,8 @@
<Condition name="IsProcessRunning" isprocessrunning="False" isdebugging="False" action="Disable">
<MenuItem id = "Attach"
label = "${res:XML.MainMenu.DebugMenu.Attach}"
class = "ICSharpCode.SharpDevelop.Project.Commands.AttachToProcessCommand"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.AttachToProcessCommand"
command = "SDDebugCommands.AttachToProcess" />
</Condition>
</Condition>
@ -1500,7 +1597,8 @@ @@ -1500,7 +1597,8 @@
<Condition name="IsProcessRunning" isdebugging="True" action="Disable">
<MenuItem id = "Detach"
label = "${res:XML.MainMenu.DebugMenu.Detach}"
class = "ICSharpCode.SharpDevelop.Project.Commands.DetachFromProcessCommand"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.DetachFromProcessCommand"
command = "SDDebugCommands.DetachFromProcess" />
</Condition>
</Condition>
@ -1511,14 +1609,16 @@ @@ -1511,14 +1609,16 @@
label = "${res:XML.MainMenu.DebugMenu.Break}"
icon = "Icons.16x16.Debug.Break"
shortcut = "Control|Alt|B"
class = "ICSharpCode.SharpDevelop.Project.Commands.BreakDebuggingCommand"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.BreakDebuggingCommand"
command = "SDDebugCommands.BreakDebugging" />
</Condition>
<Condition name="IsProcessRunning" isprocessrunning = "False" isdebugging = "True" action = "Disable">
<MenuItem id = "Continue"
label = "${res:XML.MainMenu.DebugMenu.Continue}"
icon = "Icons.16x16.Debug.Continue"
shortcut = "F6"
class = "ICSharpCode.SharpDevelop.Project.Commands.ContinueDebuggingCommand"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.ContinueDebuggingCommand"
command = "SDDebugCommands.ContinueDebugging" />
</Condition>
</Condition>
@ -1529,17 +1629,20 @@ @@ -1529,17 +1629,20 @@
label = "${res:XML.MainMenu.DebugMenu.StepOver}"
icon = "Icons.16x16.Debug.StepOver"
shortcut = "F10"
class = "ICSharpCode.SharpDevelop.Project.Commands.StepDebuggingCommand"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.StepDebuggingCommand"
command = "SDDebugCommands.StepOver" />
<MenuItem id = "Step into"
label = "${res:XML.MainMenu.DebugMenu.StepInto}"
icon = "Icons.16x16.Debug.StepInto"
shortcut = "F11"
class = "ICSharpCode.SharpDevelop.Project.Commands.StepIntoDebuggingCommand"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.StepDebuggingCommand"
command = "SDDebugCommands.StepInto" />
<MenuItem id = "Step out"
label = "${res:XML.MainMenu.DebugMenu.StepOut}"
icon = "Icons.16x16.Debug.StepOut"
shortcut = "Shift|F11"
class = "ICSharpCode.SharpDevelop.Project.Commands.StepOutDebuggingCommand"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.StepOutDebuggingCommand"
command = "SDDebugCommands.StepOut" />
</Condition>
</Condition>
@ -1553,7 +1656,8 @@ @@ -1553,7 +1656,8 @@
label = "${res:XML.MainMenu.DebugMenu.ToggleBreakpoint}"
shortcut = "F7"
icon = "Bookmarks.Breakpoint"
class = "ICSharpCode.SharpDevelop.Project.Commands.ToggleBreakpointCommand"/>
class = "ICSharpCode.SharpDevelop.Project.Commands.ToggleBreakpointCommand"
command = "SDDebugCommands.ToggleBreakpoint" />
</ComplexCondition>
</MenuItem> <!-- end DEBUG menu -->
@ -1617,7 +1721,7 @@ @@ -1617,7 +1721,7 @@
<MenuItem id = "SplitView"
label = "${res:XML.MainMenu.WindowMenu.Split}"
icon = "Icons.16x16.SplitWindow"
command = "SplitView"/>
command = "SDWindowCommands.SplitView"/>
<MenuItem id = "CloseAll"
label = "${res:XML.MainMenu.FileMenu.CloseAll}"
icon = "Icons.16x16.CloseAllDocuments"

212
data/schemas/AddIn.xsd

@ -114,24 +114,27 @@ @@ -114,24 +114,27 @@
<!-- !!! INSERT DOOZER LIST !!! -->
<xs:element ref="Class" />
<xs:element ref="CodeCompletionBinding" />
<xs:element ref="CommandBinding" />
<xs:element ref="CustomProperty" />
<xs:element ref="CustomTool" />
<xs:element ref="Debugger" />
<xs:element ref="DialogPanel" />
<xs:element ref="Directory" />
<xs:element ref="DisplayBinding" />
<xs:element ref="EditAction" />
<xs:element ref="FileFilter" />
<xs:element ref="Icon" />
<xs:element ref="Include" />
<xs:element ref="InputBinding" />
<xs:element ref="LanguageBinding" />
<xs:element ref="MenuItem" />
<xs:element ref="OptionPanel" />
<xs:element ref="Pad" />
<xs:element ref="Parser" />
<xs:element ref="ProjectContentRegistry" />
<xs:element ref="RoutedUICommand" />
<xs:element ref="SchemeExtension" />
<xs:element ref="String" />
<xs:element ref="SyntaxMode" />
<xs:element ref="String" />
<xs:element ref="TaskBoundAdditionalLogger" />
<xs:element ref="ToolbarItem" />
</xs:choice>
@ -184,24 +187,27 @@ @@ -184,24 +187,27 @@
<!-- !!! INSERT DOOZER LIST !!! -->
<xs:element ref="Class" />
<xs:element ref="CodeCompletionBinding" />
<xs:element ref="CommandBinding" />
<xs:element ref="CustomProperty" />
<xs:element ref="CustomTool" />
<xs:element ref="Debugger" />
<xs:element ref="DialogPanel" />
<xs:element ref="Directory" />
<xs:element ref="DisplayBinding" />
<xs:element ref="EditAction" />
<xs:element ref="FileFilter" />
<xs:element ref="Icon" />
<xs:element ref="Include" />
<xs:element ref="InputBinding" />
<xs:element ref="LanguageBinding" />
<xs:element ref="MenuItem" />
<xs:element ref="OptionPanel" />
<xs:element ref="Pad" />
<xs:element ref="Parser" />
<xs:element ref="ProjectContentRegistry" />
<xs:element ref="RoutedUICommand" />
<xs:element ref="SchemeExtension" />
<xs:element ref="String" />
<xs:element ref="SyntaxMode" />
<xs:element ref="String" />
<xs:element ref="TaskBoundAdditionalLogger" />
<xs:element ref="ToolbarItem" />
</xs:choice>
@ -307,6 +313,51 @@ @@ -307,6 +313,51 @@
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="CommandBinding">
<xs:complexContent>
<xs:extension base="AbstractCodon">
<xs:attribute name="command" use="required" type="xs:string">
<xs:annotation>
<xs:documentation>
Name of routed UI command which triggers this binding
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="class" use="required" type="xs:string">
<xs:annotation>
<xs:documentation>
Class implementing System.Window.Input.ICommand or
ICSharpCode.Core class. CanExecute and Executed methods
are used to handle raised event
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="lazy" use="optional">
<xs:annotation>
<xs:documentation>
Use lazy loading. If addin containing binded command is
not loaded yet load asseblies referenced in add-in
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="1" />
<xs:enumeration value="0" />
<xs:enumeration value="true" />
<xs:enumeration value="false" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="CommandBinding" type="CommandBinding">
<xs:annotation>
<xs:documentation>
Creates descriptor containing information about command binding
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="CustomProperty">
<xs:complexContent>
<xs:extension base="AbstractCodon">
@ -439,39 +490,6 @@ @@ -439,39 +490,6 @@
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="DialogPanel">
<xs:complexContent>
<xs:extension base="AbstractCodon">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="ComplexCondition" />
<xs:element ref="Condition" />
<xs:element ref="DialogPanel" />
<xs:element ref="Include" />
</xs:choice>
<xs:attribute name="class" use="optional" type="xs:string">
<xs:annotation>
<xs:documentation>
Name of the IDialogPanel class. Optional if the page has subpages.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="label" use="required" type="xs:string">
<xs:annotation>
<xs:documentation>
Caption of the dialog panel.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="DialogPanel" type="DialogPanel">
<xs:annotation>
<xs:documentation>
Creates DefaultDialogPanelDescriptor objects that are used in option dialogs.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="Directory">
<xs:complexContent>
<xs:extension base="AbstractCodon">
@ -667,6 +685,33 @@ @@ -667,6 +685,33 @@
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="InputBinding">
<xs:complexContent>
<xs:extension base="AbstractCodon">
<xs:attribute name="command" use="required" type="xs:string">
<xs:annotation>
<xs:documentation>
Name of routed UI command which is triggered by this binding
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="gesture" use="required" type="xs:string">
<xs:annotation>
<xs:documentation>
Gesture which triggers this binding
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="InputBinding" type="InputBinding">
<xs:annotation>
<xs:documentation>
Creates descriptor containing information about input binding
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="LanguageBinding">
<xs:complexContent>
<xs:extension base="AbstractCodon">
@ -764,6 +809,15 @@ @@ -764,6 +809,15 @@
<xs:annotation>
<xs:documentation>
Command class that is run when item is clicked.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="command" use="optional" type="xs:string">
<xs:annotation>
<xs:documentation>
A WPF routed command that is executed when item is clicked.
Currently, this property is supported only for WPF Menus.
Only one of the "class" and "command" attributes can be used on a menu entry.
</xs:documentation>
</xs:annotation>
</xs:attribute>
@ -792,6 +846,39 @@ @@ -792,6 +846,39 @@
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="OptionPanel">
<xs:complexContent>
<xs:extension base="AbstractCodon">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="ComplexCondition" />
<xs:element ref="Condition" />
<xs:element ref="IOptionPanel" />
<xs:element ref="Include" />
</xs:choice>
<xs:attribute name="class" use="optional" type="xs:string">
<xs:annotation>
<xs:documentation>
Name of the IOptionPanel class. Optional if the page has subpages.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="label" use="required" type="xs:string">
<xs:annotation>
<xs:documentation>
Caption of the dialog panel.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="OptionPanel" type="OptionPanel">
<xs:annotation>
<xs:documentation>
Creates DefaultOptionPanelDescriptor objects that are used in option dialogs.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="Pad">
<xs:complexContent>
<xs:extension base="AbstractCodon">
@ -901,50 +988,57 @@ @@ -901,50 +988,57 @@
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="SchemeExtension">
<xs:complexType name="RoutedUICommand">
<xs:complexContent>
<xs:extension base="AbstractCodon">
<xs:attribute name="scheme" use="required" type="xs:string">
<xs:attribute name="name" use="required" type="xs:string">
<xs:annotation>
<xs:documentation>
Specifies the name of the protocol the extension handles. (e.g. 'ms-help' or 'startpage')
Routed UI command name
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="class" use="required" type="xs:string">
<xs:attribute name="text" use="required" type="xs:string">
<xs:annotation>
<xs:documentation>
Name of the ISchemeExtension class (normally deriving from DefaultSchemeExtension).
Routed UI command displayed name
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="SchemeExtension" type="SchemeExtension">
<xs:element name="RoutedUICommand" type="RoutedUICommand">
<xs:annotation>
<xs:documentation>
Creates browser scheme extensions that can intercept calls on one protocol.
Creates descriptor containing information about routed UI command
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="String">
<xs:complexType name="SchemeExtension">
<xs:complexContent>
<xs:extension base="AbstractCodon">
<xs:attribute name="text" use="required" type="xs:string">
<xs:attribute name="scheme" use="required" type="xs:string">
<xs:annotation>
<xs:documentation>
The string to return.
Specifies the name of the protocol the extension handles. (e.g. 'ms-help' or 'startpage')
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="class" use="required" type="xs:string">
<xs:annotation>
<xs:documentation>
Name of the ISchemeExtension class (normally deriving from DefaultSchemeExtension).
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="String" type="String">
<xs:element name="SchemeExtension" type="SchemeExtension">
<xs:annotation>
<xs:documentation>
Creates a string.
Creates browser scheme extensions that can intercept calls on one protocol.
</xs:documentation>
</xs:annotation>
</xs:element>
@ -983,6 +1077,26 @@ @@ -983,6 +1077,26 @@
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="String">
<xs:complexContent>
<xs:extension base="AbstractCodon">
<xs:attribute name="text" use="required" type="xs:string">
<xs:annotation>
<xs:documentation>
The string to return.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="String" type="String">
<xs:annotation>
<xs:documentation>
Creates a string.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="TaskBoundAdditionalLogger">
<xs:complexContent>
<xs:extension base="AbstractCodon">

33
doc/technotes/ConditionList.html

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
</head><body>
<h1>Condition List</h1>
<p class="notice">This file was generated by the tool 'BuildAddinDocumentation'.
It is based on SharpDevelop 3.0.0.3062.</p>
It is based on SharpDevelop 4.0.0.4126.</p>
<ul>
<li><a href="#ActiveContentExtension">ActiveContentExtension</a>
<li><a href="#ActiveViewContentUntitled">ActiveViewContentUntitled</a>
@ -26,6 +26,8 @@ It is based on SharpDevelop 3.0.0.3062.</p> @@ -26,6 +26,8 @@ It is based on SharpDevelop 3.0.0.3062.</p>
<li><a href="#TextContent">TextContent</a>
<li><a href="#WindowActive">WindowActive</a>
<li><a href="#WindowOpen">WindowOpen</a>
<li><a href="#WriteableProject">WriteableProject</a>
<li><a href="#WriteableSolution">WriteableSolution</a>
</ul>
<div>
<h2><a name="ActiveContentExtension">ActiveContentExtension</a></h2>
@ -176,7 +178,7 @@ It is based on SharpDevelop 3.0.0.3062.</p> @@ -176,7 +178,7 @@ It is based on SharpDevelop 3.0.0.3062.</p>
<th colspan=2>comparisonType:</td>
<td>
The mode of the comparison: a field of the System.StringComparison enumeration. The default is
'InvariantCultureIgnoreCase'.
'OrdinalIgnoreCase'.
</td>
</tr>
</table>
@ -213,7 +215,7 @@ It is based on SharpDevelop 3.0.0.3062.</p> @@ -213,7 +215,7 @@ It is based on SharpDevelop 3.0.0.3062.</p>
<th colspan=2>comparisonType:</td>
<td>
The mode of the comparison: a field of the System.StringComparison enumeration. The default is
'InvariantCultureIgnoreCase'.
'OrdinalIgnoreCase'.
</td>
</tr>
</table>
@ -492,4 +494,29 @@ It is based on SharpDevelop 3.0.0.3062.</p> @@ -492,4 +494,29 @@ It is based on SharpDevelop 3.0.0.3062.</p>
<br><pre>
&lt;Condition name="WindowOpen" openwindow="*"&gt;</pre></p>
</div>
<div>
<h2><a name="WriteableProject">WriteableProject</a></h2>
<p>
Tests if the caller project is writable. If caller is not an IProject it tests
Project.CurrentProject.
</p>
<table>
<tr>
<th colspan=2>Condition name:</td>
<td>ICSharpCode.SharpDevelop.WriteableProjectConditionEvaluator</td>
</tr>
</table>
</div>
<div>
<h2><a name="WriteableSolution">WriteableSolution</a></h2>
<p>
Description of WriteableSolutionEvaluator.
</p>
<table>
<tr>
<th colspan=2>Condition name:</td>
<td>ICSharpCode.SharpDevelop.WriteableSolutionConditionEvaluator</td>
</tr>
</table>
</div>
</body></html>

264
doc/technotes/DoozerList.html

@ -5,28 +5,31 @@ @@ -5,28 +5,31 @@
</head><body>
<h1>Doozer List</h1>
<p class="notice">This file was generated by the tool 'BuildAddinDocumentation'.
It is based on SharpDevelop 3.0.0.3062.</p>
It is based on SharpDevelop 4.0.0.4126.</p>
<ul>
<li><a href="#Class">Class</a>
<li><a href="#CodeCompletionBinding">CodeCompletionBinding</a>
<li><a href="#CommandBinding">CommandBinding</a>
<li><a href="#CustomProperty">CustomProperty</a>
<li><a href="#CustomTool">CustomTool</a>
<li><a href="#Debugger">Debugger</a>
<li><a href="#DialogPanel">DialogPanel</a>
<li><a href="#Directory">Directory</a>
<li><a href="#DisplayBinding">DisplayBinding</a>
<li><a href="#EditAction">EditAction</a>
<li><a href="#FileFilter">FileFilter</a>
<li><a href="#Icon">Icon</a>
<li><a href="#Include">Include</a>
<li><a href="#InputBinding">InputBinding</a>
<li><a href="#LanguageBinding">LanguageBinding</a>
<li><a href="#MenuItem">MenuItem</a>
<li><a href="#OptionPanel">OptionPanel</a>
<li><a href="#Pad">Pad</a>
<li><a href="#Parser">Parser</a>
<li><a href="#ProjectContentRegistry">ProjectContentRegistry</a>
<li><a href="#RoutedUICommand">RoutedUICommand</a>
<li><a href="#SchemeExtension">SchemeExtension</a>
<li><a href="#String">String</a>
<li><a href="#SyntaxMode">SyntaxMode</a>
<li><a href="#String">String</a>
<li><a href="#TaskBoundAdditionalLogger">TaskBoundAdditionalLogger</a>
<li><a href="#ToolbarItem">ToolbarItem</a>
</ul>
@ -70,7 +73,7 @@ It is based on SharpDevelop 3.0.0.3062.</p> @@ -70,7 +73,7 @@ It is based on SharpDevelop 3.0.0.3062.</p>
<table>
<tr>
<th colspan=2>Doozer name:</td>
<td>ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.CodeCompletionBindingDoozer</td>
<td>ICSharpCode.SharpDevelop.Editor.CodeCompletionBindingDoozer</td>
</tr>
<tr><td colspan=3><hr><h3>Attributes:</h3></td></tr>
<tr>
@ -103,6 +106,54 @@ It is based on SharpDevelop 3.0.0.3062.</p> @@ -103,6 +106,54 @@ It is based on SharpDevelop 3.0.0.3062.</p>
</tr>
</table>
</div>
<div>
<h2><a name="CommandBinding">CommandBinding</a></h2>
<p>
Creates descriptor containing information about command binding
</p>
<table>
<tr>
<th colspan=2>Doozer name:</td>
<td>ICSharpCode.Core.CommandBindingDoozer</td>
</tr>
<tr><td colspan=3><hr><h3>Attributes:</h3></td></tr>
<tr>
<th>command:</td>
<td class="userequired">required</td>
<td>
Name of routed UI command which triggers this binding
</td>
</tr>
<tr>
<th>class:</td>
<td class="userequired">required</td>
<td>
Class implementing System.Window.Input.ICommand or
ICSharpCode.Core class. CanExecute and Executed methods
are used to handle raised event
</td>
</tr>
<tr>
<th>lazy:</td>
<td class="userequired">optional</td>
<td>
Use lazy loading. If addin containing binded command is
not loaded yet load asseblies referenced in add-in
</td>
</tr>
<tr><td colspan=3><hr></td></tr>
<tr>
<th colspan=2>Usage:</td>
<td>Only in /SharpDevelop/Workbench/CommandBindings</td>
</tr>
<tr>
<th colspan=2>Returns:</td>
<td>
CommandBindingDescriptor object
</td>
</tr>
</table>
</div>
<div>
<h2><a name="CustomProperty">CustomProperty</a></h2>
<p>
@ -275,50 +326,6 @@ It is based on SharpDevelop 3.0.0.3062.</p> @@ -275,50 +326,6 @@ It is based on SharpDevelop 3.0.0.3062.</p>
</tr>
</table>
</div>
<div>
<h2><a name="DialogPanel">DialogPanel</a></h2>
<p>
Creates DefaultDialogPanelDescriptor objects that are used in option dialogs.
</p>
<table>
<tr>
<th colspan=2>Doozer name:</td>
<td>ICSharpCode.SharpDevelop.DialogPanelDoozer</td>
</tr>
<tr><td colspan=3><hr><h3>Attributes:</h3></td></tr>
<tr>
<th colspan=2>class:</td>
<td>
Name of the IDialogPanel class. Optional if the page has subpages.
</td>
</tr>
<tr>
<th>label:</td>
<td class="userequired">required</td>
<td>
Caption of the dialog panel.
</td>
</tr>
<tr><td colspan=3><hr></td></tr>
<tr>
<th colspan=2>Children:</td>
<td>
In the SharpDevelop options, option pages can have subpages by specifying them
as children in the AddInTree.
</td>
</tr>
<tr>
<th colspan=2>Usage:</td>
<td>In /SharpDevelop/BackendBindings/ProjectOptions/ and /SharpDevelop/Dialogs/OptionsDialog</td>
</tr>
<tr>
<th colspan=2>Returns:</td>
<td>
A DefaultDialogPanelDescriptor object.
</td>
</tr>
</table>
</div>
<div>
<h2><a name="Directory">Directory</a></h2>
<p>
@ -590,6 +597,44 @@ It is based on SharpDevelop 3.0.0.3062.</p> @@ -590,6 +597,44 @@ It is based on SharpDevelop 3.0.0.3062.</p>
</tr>
</table>
</div>
<div>
<h2><a name="InputBinding">InputBinding</a></h2>
<p>
Creates descriptor containing information about input binding
</p>
<table>
<tr>
<th colspan=2>Doozer name:</td>
<td>ICSharpCode.Core.InputBindingDoozer</td>
</tr>
<tr><td colspan=3><hr><h3>Attributes:</h3></td></tr>
<tr>
<th>command:</td>
<td class="userequired">required</td>
<td>
Name of routed UI command which is triggered by this binding
</td>
</tr>
<tr>
<th>gesture:</td>
<td class="userequired">required</td>
<td>
Gesture which triggers this binding
</td>
</tr>
<tr><td colspan=3><hr></td></tr>
<tr>
<th colspan=2>Usage:</td>
<td>Only in /SharpDevelop/Workbench/InputBindings</td>
</tr>
<tr>
<th colspan=2>Returns:</td>
<td>
InputBindingDescriptor object
</td>
</tr>
</table>
</div>
<div>
<h2><a name="LanguageBinding">LanguageBinding</a></h2>
<p>
@ -693,6 +738,15 @@ It is based on SharpDevelop 3.0.0.3062.</p> @@ -693,6 +738,15 @@ It is based on SharpDevelop 3.0.0.3062.</p>
Command class that is run when item is clicked.
</td>
</tr>
<tr>
<th>command:</td>
<td class="userequired">optional</td>
<td>
A WPF routed command that is executed when item is clicked.
Currently, this property is supported only for WPF Menus.
Only one of the "class" and "command" attributes can be used on a menu entry.
</td>
</tr>
<tr>
<th>link:</td>
<td class="userequired">optional</td>
@ -722,7 +776,7 @@ It is based on SharpDevelop 3.0.0.3062.</p> @@ -722,7 +776,7 @@ It is based on SharpDevelop 3.0.0.3062.</p>
<tr>
<th colspan=2>Returns:</td>
<td>
Any ToolStrip* object, depending on the type attribute.
A MenuItemDescriptor object.
</td>
</tr>
<tr>
@ -731,6 +785,50 @@ It is based on SharpDevelop 3.0.0.3062.</p> @@ -731,6 +785,50 @@ It is based on SharpDevelop 3.0.0.3062.</p>
</tr>
</table>
</div>
<div>
<h2><a name="OptionPanel">OptionPanel</a></h2>
<p>
Creates DefaultOptionPanelDescriptor objects that are used in option dialogs.
</p>
<table>
<tr>
<th colspan=2>Doozer name:</td>
<td>ICSharpCode.SharpDevelop.OptionPanelDoozer</td>
</tr>
<tr><td colspan=3><hr><h3>Attributes:</h3></td></tr>
<tr>
<th colspan=2>class:</td>
<td>
Name of the IOptionPanel class. Optional if the page has subpages.
</td>
</tr>
<tr>
<th>label:</td>
<td class="userequired">required</td>
<td>
Caption of the dialog panel.
</td>
</tr>
<tr><td colspan=3><hr></td></tr>
<tr>
<th colspan=2>Children:</td>
<td>
In the SharpDevelop options, option pages can have subpages by specifying them
as children in the AddInTree.
</td>
</tr>
<tr>
<th colspan=2>Usage:</td>
<td>In /SharpDevelop/BackendBindings/ProjectOptions/ and /SharpDevelop/Dialogs/OptionsDialog</td>
</tr>
<tr>
<th colspan=2>Returns:</td>
<td>
A DefaultOptionPanelDescriptor object.
</td>
</tr>
</table>
</div>
<div>
<h2><a name="Pad">Pad</a></h2>
<p>
@ -878,66 +976,77 @@ It is based on SharpDevelop 3.0.0.3062.</p> @@ -878,66 +976,77 @@ It is based on SharpDevelop 3.0.0.3062.</p>
</table>
</div>
<div>
<h2><a name="SchemeExtension">SchemeExtension</a></h2>
<h2><a name="RoutedUICommand">RoutedUICommand</a></h2>
<p>
Creates browser scheme extensions that can intercept calls on one protocol.
Creates descriptor containing information about routed UI command
</p>
<table>
<tr>
<th colspan=2>Doozer name:</td>
<td>ICSharpCode.SharpDevelop.BrowserDisplayBinding.SchemeExtensionDoozer</td>
<td>ICSharpCode.Core.RoutedUICommandDoozer</td>
</tr>
<tr><td colspan=3><hr><h3>Attributes:</h3></td></tr>
<tr>
<th>scheme:</td>
<th>name:</td>
<td class="userequired">required</td>
<td>
Specifies the name of the protocol the extension handles. (e.g. 'ms-help' or 'startpage')
Routed UI command name
</td>
</tr>
<tr>
<th>class:</td>
<th>text:</td>
<td class="userequired">required</td>
<td>
Name of the ISchemeExtension class (normally deriving from DefaultSchemeExtension).
Routed UI command displayed name
</td>
</tr>
<tr><td colspan=3><hr></td></tr>
<tr>
<th colspan=2>Usage:</td>
<td>Only in /SharpDevelop/Views/Browser/SchemeExtensions</td>
<td>Only in /SharpDevelop/Workbench/CommandBindings</td>
</tr>
<tr>
<th colspan=2>Returns:</td>
<td>
An SchemeExtensionDescriptor object that exposes the protocol name and ISchemeExtension object (lazy-loading).
RoutedUICommandDescriptor object
</td>
</tr>
</table>
</div>
<div>
<h2><a name="String">String</a></h2>
<h2><a name="SchemeExtension">SchemeExtension</a></h2>
<p>
Creates a string.
Creates browser scheme extensions that can intercept calls on one protocol.
</p>
<table>
<tr>
<th colspan=2>Doozer name:</td>
<td>ICSharpCode.Core.StringDoozer</td>
<td>ICSharpCode.SharpDevelop.BrowserDisplayBinding.SchemeExtensionDoozer</td>
</tr>
<tr><td colspan=3><hr><h3>Attributes:</h3></td></tr>
<tr>
<th>text:</td>
<th>scheme:</td>
<td class="userequired">required</td>
<td>
The string to return.
Specifies the name of the protocol the extension handles. (e.g. 'ms-help' or 'startpage')
</td>
</tr>
<tr>
<th>class:</td>
<td class="userequired">required</td>
<td>
Name of the ISchemeExtension class (normally deriving from DefaultSchemeExtension).
</td>
</tr>
<tr><td colspan=3><hr></td></tr>
<tr>
<th colspan=2>Usage:</td>
<td>Only in /SharpDevelop/Views/Browser/SchemeExtensions</td>
</tr>
<tr>
<th colspan=2>Returns:</td>
<td>
The string specified by 'text', passed through the StringParser.
An SchemeExtensionDescriptor object that exposes the protocol name and ISchemeExtension object (lazy-loading).
</td>
</tr>
</table>
@ -989,6 +1098,33 @@ It is based on SharpDevelop 3.0.0.3062.</p> @@ -989,6 +1098,33 @@ It is based on SharpDevelop 3.0.0.3062.</p>
</tr>
</table>
</div>
<div>
<h2><a name="String">String</a></h2>
<p>
Creates a string.
</p>
<table>
<tr>
<th colspan=2>Doozer name:</td>
<td>ICSharpCode.Core.StringDoozer</td>
</tr>
<tr><td colspan=3><hr><h3>Attributes:</h3></td></tr>
<tr>
<th>text:</td>
<td class="userequired">required</td>
<td>
The string to return.
</td>
</tr>
<tr><td colspan=3><hr></td></tr>
<tr>
<th colspan=2>Returns:</td>
<td>
The string specified by 'text', passed through the StringParser.
</td>
</tr>
</table>
</div>
<div>
<h2><a name="TaskBoundAdditionalLogger">TaskBoundAdditionalLogger</a></h2>
<p>

2
src/Main/Base/Project/Src/Gui/Workbench/Layouts/AvalonWorkbenchWindow.cs

@ -97,6 +97,8 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -97,6 +97,8 @@ namespace ICSharpCode.SharpDevelop.Gui
CommandsRegistry.LoadContext(contextName, (UIElement)Content);
CommandsRegistry.LoadContext(contextName, (UIElement)Content);
CommandsRegistry.RegisterCommandBindingsUpdateHandler(
contextName,
delegate {

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

@ -82,6 +82,8 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -82,6 +82,8 @@ namespace ICSharpCode.SharpDevelop.Gui
CommandsRegistry.DefaultContext = this.GetType().Name;
CommandsService.RegisterBuiltInRoutedUICommands();
// Load all commands and and key bindings from addin tree
CommandsService.RegisterRoutedUICommands(this, "/SharpDevelop/Workbench/RoutedUICommands");
CommandsService.RegisterCommandBindings(this, "/SharpDevelop/Workbench/CommandBindings");
@ -91,16 +93,17 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -91,16 +93,17 @@ namespace ICSharpCode.SharpDevelop.Gui
CommandsRegistry.LoadAddinCommands(AddInTree.AddIns.FirstOrDefault(a => a.Name == "SharpDevelop"));
CommandsRegistry.RegisterCommandBindingsUpdateHandler(CommandsRegistry.DefaultContext, delegate {
var bindings = CommandsRegistry.GetCommandBindings(CommandsRegistry.DefaultContext);
var bindings = CommandsRegistry.GetCommandBindings(CommandsRegistry.DefaultContext, null, null);
CommandsRegistry.RemoveManagedCommandBindings(CommandBindings);
CommandBindings.AddRange(bindings);
});
CommandsRegistry.RegisterInputBindingUpdateHandler(CommandsRegistry.DefaultContext, delegate {
var bindings = CommandsRegistry.GetInputBindings(CommandsRegistry.DefaultContext);
var bindings = CommandsRegistry.GetInputBindings(CommandsRegistry.DefaultContext, null, null);
CommandsRegistry.RemoveManagedInputBindings(InputBindings);
InputBindings.AddRange(bindings);
});
CommandsRegistry.InvokeCommandBindingUpdateHandlers(CommandsRegistry.DefaultContext);
CommandsRegistry.InvokeInputBindingUpdateHandlers(CommandsRegistry.DefaultContext);

1
src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs

@ -236,6 +236,7 @@ namespace ICSharpCode.Core @@ -236,6 +236,7 @@ namespace ICSharpCode.Core
throw new AddInLoadException("Import node requires ONE attribute.");
}
string pathName = reader.GetAttribute(0);
ExtensionPath extensionPath = addIn.GetExtensionPath(pathName);
if (!reader.IsEmptyElement) {
ExtensionPath.SetUp(extensionPath, reader, "Path");

16
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/CommandBindingDoozer.cs

@ -2,6 +2,22 @@ using System; @@ -2,6 +2,22 @@ using System;
namespace ICSharpCode.Core
{
/// <attribute name="command" use="required">
/// Name of routed UI command which triggers this binding
/// </attribute>
/// <attribute name="class" use="required">
/// Class implementing System.Window.Input.ICommand or
/// ICSharpCode.Core class. CanExecute and Executed methods
/// are used to handle raised event
/// </attribute>
/// <attribute name="lazy" use="optional" enum="1;0;true;false">
/// Use lazy loading. If addin containing binded command is
/// not loaded yet load asseblies referenced in add-in
/// </attribute>
/// <usage>Only in /SharpDevelop/Workbench/CommandBindings</usage>
/// <returns>
/// CommandBindingDescriptor object
/// </returns>
/// <summary>
/// Creates descriptor containing information about command binding
/// </summary>

10
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/Command/InputBindingDoozer.cs

@ -2,6 +2,16 @@ using System; @@ -2,6 +2,16 @@ using System;
namespace ICSharpCode.Core
{
/// <attribute name="command" use="required">
/// Name of routed UI command which is triggered by this binding
/// </attribute>
/// <attribute name="gesture" use="required">
/// Gesture which triggers this binding
/// </attribute>
/// <usage>Only in /SharpDevelop/Workbench/InputBindings</usage>
/// <returns>
/// InputBindingDescriptor object
/// </returns>
/// <summary>
/// Creates descriptor containing information about input binding
/// </summary>

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

@ -23,7 +23,7 @@ namespace ICSharpCode.Core @@ -23,7 +23,7 @@ namespace ICSharpCode.Core
/// </summary>
public string Name {
get {
return codon.Properties["id"];
return codon.Properties["name"];
}
}

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

@ -2,6 +2,16 @@ using System; @@ -2,6 +2,16 @@ using System;
namespace ICSharpCode.Core
{
/// <attribute name="name" use="required">
/// Routed UI command name
/// </attribute>
/// <attribute name="text" use="required">
/// Routed UI command displayed name
/// </attribute>
/// <usage>Only in /SharpDevelop/Workbench/CommandBindings</usage>
/// <returns>
/// RoutedUICommandDescriptor object
/// </returns>
/// <summary>
/// Creates descriptor containing information about routed UI command
/// </summary>

4
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/MenuItem/MenuItemDoozer.cs

@ -67,6 +67,10 @@ namespace ICSharpCode.Core @@ -67,6 +67,10 @@ namespace ICSharpCode.Core
public object BuildItem(object caller, Codon codon, ArrayList subItems)
{
if(codon.Properties["command"] == "BuildCommands.Rebuild")
{
}
return new MenuItemDescriptor(caller, codon, subItems);
}
}

191
src/Main/ICSharpCode.Core.Presentation/CommandsService/CommandsRegistry.cs

@ -30,8 +30,8 @@ namespace ICSharpCode.Core.Presentation @@ -30,8 +30,8 @@ namespace ICSharpCode.Core.Presentation
internal static Dictionary<string, System.Windows.Input.ICommand> commands = new Dictionary<string, System.Windows.Input.ICommand>();
internal static Dictionary<string, UIElement> contexts = new Dictionary<string, UIElement>();
private static Dictionary<string, List<BindingsUpdatedHandler>> commandBindingsUpdateHandlers = new Dictionary<string, List<BindingsUpdatedHandler>>();
private static Dictionary<string, List<BindingsUpdatedHandler>> inputBindingsUpdateHandlers = new Dictionary<string, List<BindingsUpdatedHandler>>();
private static Dictionary<string, List<WeakReference>> commandBindingsUpdateHandlers = new Dictionary<string, List<WeakReference>>();
private static Dictionary<string, List<WeakReference>> inputBindingsUpdateHandlers = new Dictionary<string, List<WeakReference>>();
/// <summary>
/// Get reference to routed UI command by name
@ -39,10 +39,11 @@ namespace ICSharpCode.Core.Presentation @@ -39,10 +39,11 @@ namespace ICSharpCode.Core.Presentation
/// <param name="routedCommandName">Routed command name</param>
/// <returns>Routed command instance</returns>
public static RoutedUICommand GetRoutedUICommand(string routedCommandName) {
RoutedUICommand routedUICommand;
routedCommands.TryGetValue(routedCommandName, out routedUICommand);
return routedUICommand;
if(routedCommands.ContainsKey(routedCommandName)) {
return routedCommands[routedCommandName];
} else {
throw new IndexOutOfRangeException("Routed UI command with name " + routedCommandName + " was not found");
}
}
/// <summary>
@ -59,7 +60,7 @@ namespace ICSharpCode.Core.Presentation @@ -59,7 +60,7 @@ namespace ICSharpCode.Core.Presentation
if(!routedCommands.ContainsKey(routedCommandName)) {
routedCommands.Add(routedCommandName, routedCommand);
} else {
throw new IndexOutOfRangeException("Routed command with name " + routedCommandName + " is already registered");
throw new IndexOutOfRangeException("Routed UI command with name " + routedCommandName + " is already registered");
}
}
@ -89,15 +90,15 @@ namespace ICSharpCode.Core.Presentation @@ -89,15 +90,15 @@ namespace ICSharpCode.Core.Presentation
}
/// <summary>
/// Remove input binding from global registry
/// Remove input bindings which satisfy provided arguments
///
/// Null attributes are ignored and oly bindings which satisfy not null arguments are removed
/// Null arguments are ignored
/// </summary>
/// <param name="contextName">Context class full name</param>
/// <param name="routedCommandName">Routed UI command name</param>
/// <param name="gesture">Gesture</param>
public static void UnregisterInputBindings(string contextName, string routedCommandName, KeyGesture gesture) {
for(var i = inputBidnings.Count - 1; i >= 0; i--) {
for(int i = inputBidnings.Count - 1; i >= 0; i--) {
if((contextName == null || inputBidnings[i].ContextName == contextName)
&& (routedCommandName == null || inputBidnings[i].RoutedCommandName == routedCommandName)
&& (gesture == null || inputBidnings[i].Gesture == gesture)) {
@ -113,12 +114,28 @@ namespace ICSharpCode.Core.Presentation @@ -113,12 +114,28 @@ namespace ICSharpCode.Core.Presentation
/// <param name="handler">Update handler delegate</param>
public static void RegisterInputBindingUpdateHandler(string contextName, BindingsUpdatedHandler handler) {
if(!inputBindingsUpdateHandlers.ContainsKey(contextName)) {
inputBindingsUpdateHandlers.Add(contextName, new List<BindingsUpdatedHandler>());
inputBindingsUpdateHandlers.Add(contextName, new List<WeakReference>());
}
inputBindingsUpdateHandlers[contextName].Add(handler);
inputBindingsUpdateHandlers[contextName].Add(new WeakReference(handler));
}
/// <summary>
/// Remove input bindings update handler
/// </summary>
/// <param name="contextName">Context class full name</param>
/// <param name="handler">Update handler delegate</param>
public static void UnregisterInputBindingUpdateHandler(string contextName, BindingsUpdatedHandler handler) {
if(!inputBindingsUpdateHandlers.ContainsKey(contextName)) {
for(int i = inputBindingsUpdateHandlers[contextName].Count - 1; i >= 0; i++) {
if(inputBindingsUpdateHandlers[contextName][i].Target == handler) {
inputBindingsUpdateHandlers[contextName].RemoveAt(i);
}
}
}
}
/// <summary>
/// Invoke registered input bindings update handlers registered in specified context
/// </summary>
@ -127,13 +144,17 @@ namespace ICSharpCode.Core.Presentation @@ -127,13 +144,17 @@ namespace ICSharpCode.Core.Presentation
if(contextName != null) {
if(inputBindingsUpdateHandlers.ContainsKey(contextName)) {
foreach(var handler in inputBindingsUpdateHandlers[contextName]) {
handler.Invoke();
if(handler != null && handler.Target != null) {
((BindingsUpdatedHandler)handler.Target).Invoke();
}
}
}
} else {
foreach(var contextHandlers in inputBindingsUpdateHandlers) {
foreach(var handler in contextHandlers.Value) {
handler.Invoke();
if(handler != null && handler.Target != null) {
((BindingsUpdatedHandler)handler.Target).Invoke();
}
}
}
}
@ -144,7 +165,7 @@ namespace ICSharpCode.Core.Presentation @@ -144,7 +165,7 @@ namespace ICSharpCode.Core.Presentation
/// </summary>
/// <param name="inputBindingCollection"></param>
public static void RemoveManagedInputBindings(InputBindingCollection inputBindingCollection) {
for(var i = inputBindingCollection.Count - 1; i >= 0; i--) {
for(int i = inputBindingCollection.Count - 1; i >= 0; i--) {
if(inputBindingCollection[i] is ManagedInputBinding) {
inputBindingCollection.RemoveAt(i);
}
@ -168,13 +189,15 @@ namespace ICSharpCode.Core.Presentation @@ -168,13 +189,15 @@ namespace ICSharpCode.Core.Presentation
}
/// <summary>
/// Remove registered command bindnig from global registry
/// Remove all command bindings which satisfy provided parameters
///
/// Null arguments are ignored
/// </summary>
/// <param name="contextName"></param>
/// <param name="routedCommandName"></param>
/// <param name="className"></param>
/// <param name="contextName">Context class full name</param>
/// <param name="routedCommandName">Routed UI command name</param>
/// <param name="className">Command full name to which invokation event is routed</param>
public static void UnregisterCommandBindings(string contextName, string routedCommandName, string className) {
for(var i = commandBindings.Count - 1; i >= 0; i--) {
for(int i = commandBindings.Count - 1; i >= 0; i--) {
if((contextName == null || commandBindings[i].ContextName == contextName)
&& (routedCommandName == null || commandBindings[i].RoutedCommandName == routedCommandName)
&& (className == null || commandBindings[i].ClassName == className)) {
@ -190,10 +213,25 @@ namespace ICSharpCode.Core.Presentation @@ -190,10 +213,25 @@ namespace ICSharpCode.Core.Presentation
/// <param name="handler">Update handler delegate</param>
public static void RegisterCommandBindingsUpdateHandler(string contextName, BindingsUpdatedHandler handler) {
if(!commandBindingsUpdateHandlers.ContainsKey(contextName)) {
commandBindingsUpdateHandlers.Add(contextName, new List<BindingsUpdatedHandler>());
commandBindingsUpdateHandlers.Add(contextName, new List<WeakReference>());
}
commandBindingsUpdateHandlers[contextName].Add(handler);
commandBindingsUpdateHandlers[contextName].Add(new WeakReference(handler));
}
/// <summary>
/// Remove handler command bindings update handler
/// </summary>
/// <param name="contextName">Context class full name</param>
/// <param name="handler">Update handler delegate</param>
public static void UnregisterCommandBindingsUpdateHandler(string contextName, BindingsUpdatedHandler handler) {
if(commandBindingsUpdateHandlers.ContainsKey(contextName)) {
for(int i = commandBindingsUpdateHandlers[contextName].Count - 1; i >= 0; i--) {
if(commandBindingsUpdateHandlers[contextName][i].Target == handler) {
commandBindingsUpdateHandlers[contextName].RemoveAt(i);
}
}
}
}
/// <summary>
@ -204,13 +242,17 @@ namespace ICSharpCode.Core.Presentation @@ -204,13 +242,17 @@ namespace ICSharpCode.Core.Presentation
if(contextName != null) {
if(commandBindingsUpdateHandlers.ContainsKey(contextName)) {
foreach(var handler in commandBindingsUpdateHandlers[contextName]) {
handler.Invoke();
if(handler != null && handler.Target != null) {
((BindingsUpdatedHandler)handler.Target).Invoke();
}
}
}
} else {
foreach(var contextHandlers in commandBindingsUpdateHandlers) {
foreach(var handler in contextHandlers.Value) {
handler.Invoke();
if(handler != null && handler.Target != null) {
((BindingsUpdatedHandler)handler.Target).Invoke();
}
}
}
}
@ -221,7 +263,7 @@ namespace ICSharpCode.Core.Presentation @@ -221,7 +263,7 @@ namespace ICSharpCode.Core.Presentation
/// </summary>
/// <param name="commandBindingsCollection"></param>
public static void RemoveManagedCommandBindings(CommandBindingCollection commandBindingsCollection) {
for(var i = commandBindingsCollection.Count - 1; i >= 0; i--) {
for(int i = commandBindingsCollection.Count - 1; i >= 0; i--) {
if(commandBindingsCollection[i] is ManagedCommandBinding) {
commandBindingsCollection.RemoveAt(i);
}
@ -265,19 +307,79 @@ namespace ICSharpCode.Core.Presentation @@ -265,19 +307,79 @@ namespace ICSharpCode.Core.Presentation
/// <summary>
/// Get all commands bindings registered in provided context
/// Get list of all command bindings which satisfy provided parameters
///
/// Null arguments are ignored
/// </summary>
/// <param name="contextName">Context class full name</param>
/// <param name="routedCommandName">Context class full name</param>
/// <param name="className">Context class full name</param>
/// <returns>Collection of managed command bindings</returns>
public static CommandBindingCollection GetCommandBindings(string contextName) {
public static CommandBindingCollection GetCommandBindings(string contextName, string routedCommandName, string className) {
var bindings = new CommandBindingCollection();
foreach(var binding in commandBindings) {
if(binding.ContextName != contextName) continue;
if((contextName == null || binding.ContextName == contextName)
&& (routedCommandName == null || binding.RoutedCommandName == routedCommandName)
&& (className == null || binding.ClassName == className)) {
var handlers = new CommandBindingHandlersContainer(binding);
var managedCommandBinding = new ManagedCommandBinding(binding.RoutedCommand);
managedCommandBinding.CanExecute += handlers.CanExecuteHandler;
managedCommandBinding.Executed += handlers.ExecutedHanler;
bindings.Add(managedCommandBinding);
}
}
return bindings;
}
/// <summary>
/// Get list of all input bindings which satisfy provided parameters
///
/// Null arguments are ignored
/// </summary>
/// <param name="contextName">Context class full name</param>
/// <param name="routedCommandName">Routed UI command name</param>
/// <param name="gesture">Gesture</param>
public static InputBindingCollection GetInputBindings(string contextName, string routedCommandName, KeyGesture gesture) {
var bindings = new InputBindingCollection();
foreach(var binding in inputBidnings) {
if((contextName == null || binding.ContextName == contextName)
&& (routedCommandName == null || binding.RoutedCommandName == routedCommandName)
&& (gesture == null || binding.Gesture == gesture)) {
bindings.Add(new ManagedInputBinding(binding.RoutedCommand, binding.Gesture));
}
}
managedCommandBinding.CanExecute += delegate(Object sender, CanExecuteRoutedEventArgs e) {
return bindings;
}
/// <summary>
/// Stores Executed and CanExecute event handlers used in command bindings
/// </summary>
class CommandBindingHandlersContainer
{
private CommandBindingInfo binding;
/// <summary>
/// Constructor
/// </summary>
/// <param name="binding">Reference to object holding command bining details</param>
public CommandBindingHandlersContainer(CommandBindingInfo binding) {
this.binding = binding;
}
/// <summary>
/// CanExecute event handler
/// </summary>
/// <param name="sender">Object which raised this event</param>
/// <param name="e">Event arguments</param>
public void CanExecuteHandler(Object sender, CanExecuteRoutedEventArgs e) {
if(binding.IsLazy && binding.Class == null) {
e.CanExecute = true;
} else if(binding.Class == null) {
@ -285,9 +387,14 @@ namespace ICSharpCode.Core.Presentation @@ -285,9 +387,14 @@ namespace ICSharpCode.Core.Presentation
} else {
e.CanExecute = binding.Class.CanExecute(e.Parameter);
}
};
}
managedCommandBinding.Executed += delegate(Object sender, ExecutedRoutedEventArgs e) {
/// <summary>
/// Executed event handler
/// </summary>
/// <param name="sender">Object which raised this event</param>
/// <param name="e">Event arguments</param>
public void ExecutedHanler(Object sender, ExecutedRoutedEventArgs e) {
if(binding.IsLazy && binding.Class == null) {
binding.AddIn.LoadRuntimeAssemblies();
@ -298,29 +405,7 @@ namespace ICSharpCode.Core.Presentation @@ -298,29 +405,7 @@ namespace ICSharpCode.Core.Presentation
if(binding.Class != null) {
binding.Class.Execute(e.Parameter);
}
};
bindings.Add(managedCommandBinding);
}
return bindings;
}
/// <summary>
/// Get list of all input bindings registered in provided context
/// </summary>
/// <param name="contextName">Context class full name</param>
/// <returns>Collection of managed command bindings</returns>
public static InputBindingCollection GetInputBindings(string contextName) {
var bindings = new InputBindingCollection();
foreach(var binding in inputBidnings) {
if(binding.ContextName != contextName) continue;
bindings.Add(new ManagedInputBinding(binding.RoutedCommand, binding.Gesture));
}
return bindings;
}
}
}

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

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
using System;
using System.Reflection;
using System.Windows.Input;
using System.Windows.Documents;
using ICSharpCode.Core;
namespace ICSharpCode.Core.Presentation
@ -10,6 +11,22 @@ namespace ICSharpCode.Core.Presentation @@ -10,6 +11,22 @@ namespace ICSharpCode.Core.Presentation
/// </summary>
public static class CommandsService
{
private static void RegisterRoutedCommands(Type type) {
var typeProperties = type.GetProperties(BindingFlags.Static | BindingFlags.Public);
foreach(var property in typeProperties) {
var command = (RoutedUICommand)property.GetValue(null, null);
CommandsRegistry.RegisterRoutedUICommand(type.Name + "." + command.Name, command.Text);
}
}
public static void RegisterBuiltInRoutedUICommands() {
RegisterRoutedCommands(typeof(ApplicationCommands));
RegisterRoutedCommands(typeof(ComponentCommands));
RegisterRoutedCommands(typeof(MediaCommands));
RegisterRoutedCommands(typeof(NavigationCommands));
RegisterRoutedCommands(typeof(EditingCommands));
}
public static void RegisterRoutedUICommands(object caller, string path)
{
var descriptors = AddInTree.BuildItems<RoutedUICommandDescriptor>(path, caller, false);

5
src/Main/ICSharpCode.Core.Presentation/CommandsService/WpfCommandWrapper.cs

@ -24,7 +24,10 @@ namespace ICSharpCode.Core.Presentation @@ -24,7 +24,10 @@ namespace ICSharpCode.Core.Presentation
/// Not used because SharpDevelop's native command implementation
/// doesn't support it
/// </see>
public event EventHandler CanExecuteChanged;
public event EventHandler CanExecuteChanged {
add { }
remove { }
}
/// <see cref="System.Windows.Input.ICommand.Execute(object)" />
public void Execute(object parameter)

9
src/Main/ICSharpCode.Core.Presentation/Menu/MenuCommand.cs

@ -118,10 +118,12 @@ namespace ICSharpCode.Core.Presentation @@ -118,10 +118,12 @@ namespace ICSharpCode.Core.Presentation
{
public MenuCommand(UIElement inputBindingOwner, Codon codon, object caller, bool createCommand) : base(codon, caller)
{
//if(!string.IsNullOrEmpty(codon.Properties["command"])) {
// this.Command = CommandsRegistry.GetRoutedUICommand(codon.Properties["command"]);
//}
if(!string.IsNullOrEmpty(codon.Properties["command"])) {
this.Command = CommandsRegistry.GetRoutedUICommand(codon.Properties["command"]);
var bindings = CommandsRegistry.GetInputBindings(null, codon.Properties["command"], null);
this.InputGestureText = "M: " + (bindings.Count > 0 ? ((KeyGesture)bindings[0].Gesture).GetDisplayStringForCulture(Thread.CurrentThread.CurrentUICulture) : "-");
} else {
this.Command = CommandWrapper.GetCommand(codon, caller, createCommand);
if (!string.IsNullOrEmpty(codon.Properties["shortcut"])) {
KeyGesture kg = MenuService.ParseShortcut(codon.Properties["shortcut"]);
@ -133,3 +135,4 @@ namespace ICSharpCode.Core.Presentation @@ -133,3 +135,4 @@ namespace ICSharpCode.Core.Presentation
}
}
}
}

Loading…
Cancel
Save