diff options
author | Michael Hutchinson <mhutchinson@novell.com> | 2009-12-17 08:24:24 +0300 |
---|---|---|
committer | Michael Hutchinson <mhutchinson@novell.com> | 2009-12-17 08:24:24 +0300 |
commit | 1332edafb583416eec1f8f958c2bb4ffec9902d9 (patch) | |
tree | 6a8cfe1e114058f3d3518f6be93aa26cd229fdd5 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands | |
parent | 5566fbfd03344addfc623fc386c274eb8c64f14e (diff) |
* MonoDevelop.Ide.addin.xml:
* MonoDevelop.Ide.Gui/DefaultWorkbench.cs:
* MonoDevelop.Ide.Commands/WindowCommands.cs: Make the document
switcher into a pair of commands, instead of hardcoding it into the
main view, so it can be triggered from floating pads.
svn path=/trunk/monodevelop/; revision=148656
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/WindowCommands.cs | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/WindowCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/WindowCommands.cs index 08021a7d69..1b888b7c5f 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/WindowCommands.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/WindowCommands.cs @@ -27,6 +27,7 @@ using System; +using System.Linq; using MonoDevelop.Core.Gui.Dialogs; using MonoDevelop.Core; using Mono.Addins; @@ -49,7 +50,9 @@ namespace MonoDevelop.Ide.Commands SplitWindowVertically, SplitWindowHorizontally, UnsplitWindow, - SwitchSplitWindow + SwitchSplitWindow, + SwitchNextDocument, + SwitchPreviousDocument } internal class NextWindowHandler : CommandHandler @@ -220,5 +223,40 @@ namespace MonoDevelop.Ide.Commands splittUnsplitt.SwitchWindow (); } } - + + internal class SwitchNextDocument : CommandHandler + { + protected static void Switch (bool next) + { + //FIXME: does this option need to exist? + if (!PropertyService.Get ("MonoDevelop.Core.Gui.EnableDocumentSwitchDialog", true)) { + IdeApp.CommandService.DispatchCommand (next? WindowCommands.NextWindow : WindowCommands.PrevWindow); + return; + } + + var toplevel = Window.ListToplevels ().FirstOrDefault (w => w.HasToplevelFocus) + ?? IdeApp.Workbench.RootWindow; + var sw = new DocumentSwitcher (toplevel, next); + sw.ShowAll (); + sw.GrabFocus (); + } + + protected override void Update (CommandInfo info) + { + info.Enabled = IdeApp.Workbench.HasToplevelFocus; + } + + protected override void Run () + { + Switch (true); + } + } + + internal class SwitchPreviousDocument : SwitchNextDocument + { + protected override void Run () + { + Switch (false); + } + } } |