[Monodevelop-patches-list] r2474 - in trunk/MonoDevelop/Core/src/MonoDevelop.Base: . Commands Gui Gui/Components Gui/Dialogs Gui/Pads/ClassPad Gui/Pads/ProjectPad Gui/Pads/SolutionPad Gui/Workbench Gui/Workbench/Layouts Internal/Codons Internal/Codons/Commands Internal/Codons/Pads Internal/Conditions Internal/Project/Combine Internal/Project/Project Services Services/File Services/Project
Lluis Sanchez <lluis@ximian.com>
lluis at mono-cvs.ximian.com
Mon Apr 25 16:35:12 EDT 2005
Author: lluis
Date: 2005-04-25 16:35:11 -0400 (Mon, 25 Apr 2005)
New Revision: 2474
Added:
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/ViewCommands.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/CommandService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectSolutionPad.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/ViewCommandHandlers.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/CommandCodon.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/CommandItemCodon.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/ItemSetCodon.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/LinkItemCodon.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/SeparatorItemCodon.cs
Removed:
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/ClassBrowserCommands/
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/MenuItemBuilders.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/ProjectBrowserCommands/
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/RunCommands.cs
Modified:
trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/EditCommands.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/FileCommands.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/HelpCommands.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/ProjectCommands.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/ToolsCommands.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/WindowCommands.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Components/SdMenu.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/NewFileDialog.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/NewProjectDialog.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/TreeViewOptions.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/GuiService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/IWorkbench.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ClassPad/ProjectNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/CombineNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/FolderNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFileNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFolderNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectReferenceFolderNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectReferenceNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ResourceFolderNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ShowAllFilesBuilderExtension.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/SystemFileNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/NodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/NodeCommandHandler.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/SolutionPad.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TreeViewPad.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/DefaultWorkbench.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Pads/SolutionPadCodon.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Conditions/WorkbenchContextCondition.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProject.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am
trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/File/DefaultFileService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/File/IFileService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/IDebuggerService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/IProjectService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/ProjectService.cs
Log:
2005-04-25 Lluis Sanchez Gual <lluis at novell.com>
* Commands/MenuItemBuilders.cs: Removed. Menu builders are now
implemented as command arrays and handled in the following files.
* Commands/RunCommands.cs: Removed. Moved to ProjectCommands.
* Commands/EditCommands.cs: Most of code moved to
MonoDevelop.Gui.ViewCommandHandlers.
* Commands/ClassBrowserCommands/ClassBrowserCommands.cs
* ProjectBrowserCommands/*:
Removed. Handlers for tree commands are handled by NodeCommandHandler
objects.
* Commands/FileCommands.cs:
* ProjectCommands.cs:
* WindowCommands.cs:
* HelpCommands.cs:
* ViewCommands.cs:
Added enums with IDs for the commands.
Use the new CommandHandler base class for global commands.
Removed commands that are not global.
* Gui/ViewCommandHandlers.cs: Implements edit commands for workspace
windows.
* Services/File/IFileService.cs:
* Services/File/DefaultFileService.cs: Moved here the code that shows
the UI for saving files.
* Services/IDebuggerService.cs: The Run method now takes a progress
monitor, and will (should) stop if the monitor notifies a cancel request.
* Services/Project/IProjectService.cs:
* Services/Project/ProjectService.cs:
Factorized the Build* methods into a single Build method which takes
as parameter what you want to build. The same for Execute* methods.
Moved here several operations previously implemeted in commands, to
make it easier to reuse code. This includes: Debug(), Deploy(),
ShowOptions(), CreateProject(), CreateCombine(),
AddCombineEntry(), CreateProjectFile(), AddReferenceToProject().
* Gui/Dialogs/NewFileDialog.cs:
* Gui/Dialogs/NewProjectDialog.cs: Added Run method to show the window
as a modal dialog.
* Gui/Workbench/Layouts/SdiWorkspaceLayout.cs:
* Gui/IWorkbench.cs:
* Gui/Dialogs/TreeViewOptions.cs: Removed old menu code.
* Gui/Workbench/Layouts/SdiWorkspaceWindow.cs: Removed obsolete code.
Plug the handler class for generic Edit commands into the window.
* Gui/Workbench/DefaultWorkbench.cs: Use the new command service.
* Gui/Components/SdMenu.cs: Moved here the ISubmenuItem interface,
which was implemented in MenuItemBuilders.cs.
* Gui/Pads/SolutionPad/NodeCommandHandler.cs:
* Gui/Pads/SolutionPad/TreeViewPad.cs: Plug node command handlers into
the new command system.
* Gui/Pads/SolutionPad/NodeBuilder.cs: Don't reuse command handlers
since they may store command state information.
* Gui/Pads/SolutionPad/SolutionPad.cs: Made OnOpenCombine and
OnCloseCombine virtual.
* Gui/Pads/ProjectPad/ProjectSolutionPad.cs: Subclass of SolutionPad
which keeps track of the current selected project.
* Gui/Pads/ProjectPad/*:
Moved here the handlers for commands previously implemented in
MonoDevelop.Commands.
* Gui/CommandService.cs:
* Gui/GuiService.cs: Added the new command service.
* Internal/Codons/Pads/SolutionPadCodon.cs: Subclasses of SolutionPad
can now be specified in the "class" attribute.
* Internal/Project/Project/DotNetProject.cs: Made the Debug method
synchronous.
* Internal/Conditions/WorkbenchContextCondition.cs: Set the correct
class name.
* Internal/Codons/Commands/*: Codons for the new command infrastructure.
* MonoDevelopCore.addin.xml: Defined the new menu and toolbar
structure.
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-04-25 20:35:11 UTC (rev 2474)
@@ -1,3 +1,92 @@
+2005-04-25 Lluis Sanchez Gual <lluis at novell.com>
+
+ * Commands/MenuItemBuilders.cs: Removed. Menu builders are now
+ implemented as command arrays and handled in the following files.
+ * Commands/RunCommands.cs: Removed. Moved to ProjectCommands.
+ * Commands/EditCommands.cs: Most of code moved to
+ MonoDevelop.Gui.ViewCommandHandlers.
+
+ * Commands/ClassBrowserCommands/ClassBrowserCommands.cs
+ * ProjectBrowserCommands/*:
+ Removed. Handlers for tree commands are handled by NodeCommandHandler
+ objects.
+
+ * Commands/FileCommands.cs:
+ * ProjectCommands.cs:
+ * WindowCommands.cs:
+ * HelpCommands.cs:
+ * ViewCommands.cs:
+ Added enums with IDs for the commands.
+ Use the new CommandHandler base class for global commands.
+ Removed commands that are not global.
+
+ * Gui/ViewCommandHandlers.cs: Implements edit commands for workspace
+ windows.
+
+ * Services/File/IFileService.cs:
+ * Services/File/DefaultFileService.cs: Moved here the code that shows
+ the UI for saving files.
+
+ * Services/IDebuggerService.cs: The Run method now takes a progress
+ monitor, and will (should) stop if the monitor notifies a cancel request.
+
+ * Services/Project/IProjectService.cs:
+ * Services/Project/ProjectService.cs:
+ Factorized the Build* methods into a single Build method which takes
+ as parameter what you want to build. The same for Execute* methods.
+ Moved here several operations previously implemeted in commands, to
+ make it easier to reuse code. This includes: Debug(), Deploy(),
+ ShowOptions(), CreateProject(), CreateCombine(),
+ AddCombineEntry(), CreateProjectFile(), AddReferenceToProject().
+
+ * Gui/Dialogs/NewFileDialog.cs:
+ * Gui/Dialogs/NewProjectDialog.cs: Added Run method to show the window
+ as a modal dialog.
+
+ * Gui/Workbench/Layouts/SdiWorkspaceLayout.cs:
+ * Gui/IWorkbench.cs:
+ * Gui/Dialogs/TreeViewOptions.cs: Removed old menu code.
+
+ * Gui/Workbench/Layouts/SdiWorkspaceWindow.cs: Removed obsolete code.
+ Plug the handler class for generic Edit commands into the window.
+
+ * Gui/Workbench/DefaultWorkbench.cs: Use the new command service.
+
+ * Gui/Components/SdMenu.cs: Moved here the ISubmenuItem interface,
+ which was implemented in MenuItemBuilders.cs.
+
+ * Gui/Pads/SolutionPad/NodeCommandHandler.cs:
+ * Gui/Pads/SolutionPad/TreeViewPad.cs: Plug node command handlers into
+ the new command system.
+
+ * Gui/Pads/SolutionPad/NodeBuilder.cs: Don't reuse command handlers
+ since they may store command state information.
+ * Gui/Pads/SolutionPad/SolutionPad.cs: Made OnOpenCombine and
+ OnCloseCombine virtual.
+ * Gui/Pads/ProjectPad/ProjectSolutionPad.cs: Subclass of SolutionPad
+ which keeps track of the current selected project.
+
+ * Gui/Pads/ProjectPad/*:
+ Moved here the handlers for commands previously implemented in
+ MonoDevelop.Commands.
+
+ * Gui/CommandService.cs:
+ * Gui/GuiService.cs: Added the new command service.
+
+ * Internal/Codons/Pads/SolutionPadCodon.cs: Subclasses of SolutionPad
+ can now be specified in the "class" attribute.
+
+ * Internal/Project/Project/DotNetProject.cs: Made the Debug method
+ synchronous.
+
+ * Internal/Conditions/WorkbenchContextCondition.cs: Set the correct
+ class name.
+
+ * Internal/Codons/Commands/*: Codons for the new command infrastructure.
+
+ * MonoDevelopCore.addin.xml: Defined the new menu and toolbar
+ structure.
+
2005-04-25 John Luke <john.luke at gmail.com>
* Gui/Dialogs/NewProjectDialog.cs
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/EditCommands.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/EditCommands.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/EditCommands.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -1,274 +1,36 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
using System;
-using System.IO;
-using System.Threading;
-using System.Drawing;
-using System.Drawing.Printing;
-using System.Collections;
-using System.ComponentModel;
-using System.Diagnostics;
-
+using MonoDevelop.Gui.Dialogs;
+using MonoDevelop.Services;
+using MonoDevelop.Core.Properties;
using MonoDevelop.Core.AddIns;
-using MonoDevelop.Core.Properties;
-using MonoDevelop.Core.AddIns.Codons;
-
-using MonoDevelop.Gui;
-using MonoDevelop.Gui.Dialogs;
-
namespace MonoDevelop.Commands
{
- public class Undo : AbstractMenuCommand
+ public enum EditCommands
{
- public override void Run()
- {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- IEditable editable = window != null ? window.ActiveViewContent as IEditable : null;
- if (editable != null) {
- editable.Undo();
- }
- }
+ Copy,
+ Cut,
+ Paste,
+ Delete,
+ Rename,
+ Undo,
+ Redo,
+ SelectAll,
+ CommentCode,
+ UncommentCode,
+ IndentSelection,
+ UnIndentSelection,
+ WordCount,
+ MonodevelopPreferences
}
- public class Redo : AbstractMenuCommand
+ public class MonodevelopPreferencesHandler: CommandHandler
{
- public override void Run()
+ protected override void Run ()
{
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- IEditable editable = window != null ? window.ActiveViewContent as IEditable : null;
- if (editable != null) {
- editable.Redo();
- }
+ new TreeViewOptions((IProperties)Runtime.Properties.GetProperty("MonoDevelop.TextEditor.Document.Document.DefaultDocumentAggregatorProperties", new DefaultProperties()),
+ AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Dialogs/OptionsDialog"));
}
}
-
- public class Cut : AbstractMenuCommand
- {
- public override bool IsEnabled {
- get {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- IEditable editable = window != null ? window.ActiveViewContent as IEditable : null;
- if (editable != null) {
- return editable.ClipboardHandler.EnableCut;
- }
- return false;
- }
- }
-
- public override void Run()
- {
- if (IsEnabled) {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- IEditable editable = window != null ? window.ActiveViewContent as IEditable : null;
- if (editable != null) {
- editable.ClipboardHandler.Cut(null, null);
- }
- }
- }
- }
-
- public class Copy : AbstractMenuCommand
- {
- public override bool IsEnabled {
- get {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- IEditable editable = window != null ? window.ActiveViewContent as IEditable : null;
- if (editable != null) {
- return editable.ClipboardHandler.EnableCopy;
- }
- return false;
- }
- }
-
- public override void Run()
- {
- if (IsEnabled) {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- IEditable editable = window != null ? window.ActiveViewContent as IEditable : null;
- if (editable != null) {
- editable.ClipboardHandler.Copy(null, null);
- }
- }
- }
- }
-
- public class Paste : AbstractMenuCommand
- {
- public override bool IsEnabled {
- get {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- IEditable editable = window != null ? window.ActiveViewContent as IEditable : null;
- if (editable != null) {
- return editable.ClipboardHandler.EnablePaste;
- }
- return false;
- }
- }
- public override void Run()
- {
- if (IsEnabled) {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- IEditable editable = window != null ? window.ActiveViewContent as IEditable : null;
- if (editable != null) {
- editable.ClipboardHandler.Paste(null, null);
- }
- }
- }
- }
-
- public class Delete : AbstractMenuCommand
- {
- public override bool IsEnabled {
- get {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- IEditable editable = window != null ? window.ActiveViewContent as IEditable : null;
- if (editable != null) {
- return editable.ClipboardHandler.EnableDelete;
- }
- return false;
- }
- }
- public override void Run()
- {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
-
- if (window != null && window.ViewContent is IEditable) {
- if (((IEditable)window.ViewContent).ClipboardHandler != null) {
- ((IEditable)window.ViewContent).ClipboardHandler.Delete(null, null);
- }
- }
- }
- }
-
- public class SelectAll : AbstractMenuCommand
- {
- public override bool IsEnabled {
- get {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- IEditable editable = window != null ? window.ActiveViewContent as IEditable : null;
- if (editable != null) {
- return editable.ClipboardHandler.EnableSelectAll;
- }
- return false;
- }
- }
- public override void Run()
- {
- if (IsEnabled) {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- IEditable editable = window != null ? window.ActiveViewContent as IEditable : null;
- if (editable != null) {
- editable.ClipboardHandler.SelectAll(null, null);
- }
- }
- }
- }
-
- public class WordCount : AbstractMenuCommand
- {
- public override void Run()
- {
- WordCountDialog wcd = new WordCountDialog ();
- wcd.Run ();
- wcd.Hide ();
- }
- }
-
- public class CommentCode : AbstractMenuCommand
- {
- public override bool IsEnabled {
- get {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- IEditable editable = window != null ? window.ActiveViewContent as IEditable : null;
- if (editable != null) {
- return true;
- }
- return false;
- }
- }
-
- public override void Run()
- {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- ICodeStyleOperations styling = window != null ? window.ActiveViewContent as ICodeStyleOperations : null;
- if (styling != null) {
- styling.CommentCode ();
- }
- }
- }
-
- public class UncommentCode : AbstractMenuCommand
- {
- public override bool IsEnabled {
- get {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- IEditable editable = window != null ? window.ActiveViewContent as IEditable : null;
- if (editable != null) {
- return true;
- }
- return false;
- }
- }
-
- public override void Run()
- {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- ICodeStyleOperations styling = window != null ? window.ActiveViewContent as ICodeStyleOperations : null;
- if (styling != null) {
- styling.UncommentCode ();
- }
- }
- }
-
- public class IndentSelection : AbstractMenuCommand
- {
- public override bool IsEnabled {
- get {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- IEditable editable = window != null ? window.ActiveViewContent as IEditable : null;
- if (editable != null) {
- return true;
- }
- return false;
- }
- }
-
- public override void Run()
- {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- ICodeStyleOperations styling = window != null ? window.ActiveViewContent as ICodeStyleOperations : null;
- if (styling != null) {
- styling.IndentSelection ();
- }
- }
- }
-
- public class UnIndentSelection : AbstractMenuCommand
- {
- public override bool IsEnabled {
- get {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- IEditable editable = window != null ? window.ActiveViewContent as IEditable : null;
- if (editable != null) {
- return true;
- }
- return false;
- }
- }
-
- public override void Run()
- {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- ICodeStyleOperations styling = window != null ? window.ActiveViewContent as ICodeStyleOperations : null;
- if (styling != null) {
- styling.UnIndentSelection ();
- }
- }
- }
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/FileCommands.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/FileCommands.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/FileCommands.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -19,178 +19,62 @@
using MonoDevelop.Gui.Widgets;
using MonoDevelop.Gui.Dialogs;
using MonoDevelop.Gui.ErrorHandlers;
+using Freedesktop.RecentFiles;
namespace MonoDevelop.Commands
{
- public class CreateNewProject : AbstractMenuCommand
+ public enum FileCommands
{
- public override void Run ()
- {
- new NewProjectDialog (true);
- }
+ OpenFile,
+ NewFile,
+ NewProject,
+ CloseFile,
+ CloseAllFiles,
+ CloseCombine,
+ ReloadFile,
+ Save,
+ SaveAll,
+ SaveAs,
+ RecentFileList,
+ ClearRecentFiles,
+ RecentProjectList,
+ ClearRecentProjects,
+ Exit,
+ ClearCombine
}
- public class CreateNewFile : AbstractMenuCommand
+ public class NewProjectHandler : CommandHandler
{
- public override void Run ()
+ protected override void Run ()
{
- new NewFileDialog ();
+ NewProjectDialog pd = new NewProjectDialog (true);
+ pd.Run ();
}
}
- public class CloseFile : AbstractMenuCommand
+ public class NewFileHandler : CommandHandler
{
- public override void Run()
+ protected override void Run ()
{
- if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
- WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.CloseWindow(false, true, 0);
- }
+ NewFileDialog fd = new NewFileDialog ();
+ fd.Run ();
}
}
- public class CloseAllFiles : AbstractMenuCommand
+ public class CloseAllFilesHandler : CommandHandler
{
- public override void Run()
+ protected override void Run()
{
if ( WorkbenchSingleton.Workbench != null ) {
WorkbenchSingleton.Workbench.CloseAllViews();
}
}
}
-
- public class SaveFile : AbstractMenuCommand
- {
- public override void Run()
- {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- if (window != null) {
- if (window.ViewContent.IsViewOnly) {
- return;
- }
-
- if (window.ViewContent.ContentName == null) {
- SaveFileAs sfa = new SaveFileAs();
- sfa.Run();
- } else {
- FileAttributes attr = FileAttributes.ReadOnly | FileAttributes.Directory | FileAttributes.Offline | FileAttributes.System;
- // FIXME
- // bug #59731 is if the file is moved out from under us, we were crashing
- // I changed it to make it ask for a new
- // filename instead, but maybe we should
- // detect the move and update the reference
- // to the name instead
- if (!File.Exists (window.ViewContent.ContentName) || (File.GetAttributes(window.ViewContent.ContentName) & attr) != 0) {
- SaveFileAs sfa = new SaveFileAs();
- sfa.Run();
- } else {
- Runtime.ProjectService.MarkFileDirty(window.ViewContent.ContentName);
- string fileName = window.ViewContent.ContentName;
- // save backup first
- if((bool) Runtime.Properties.GetProperty ("SharpDevelop.CreateBackupCopy", false)) {
- Runtime.FileUtilityService.ObservedSave (new NamedFileOperationDelegate(window.ViewContent.Save), fileName + "~");
- }
- Runtime.FileUtilityService.ObservedSave (new NamedFileOperationDelegate(window.ViewContent.Save), fileName);
- }
- }
- }
- }
-
- public override bool IsEnabled {
- get {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- IViewContent content = window != null ? window.ActiveViewContent as IViewContent : null;
- if (content != null) {
- return content.IsDirty;
- }
- return false;
- }
- }
- }
-
- public class ReloadFile : AbstractMenuCommand
- {
- public override void Run()
- {
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
-
- if (window != null && window.ViewContent.ContentName != null && !window.ViewContent.IsViewOnly) {
- if (Runtime.MessageService.AskQuestion(GettextCatalog.GetString ("Are you sure that you want to reload the file?"))) {
- IXmlConvertable memento = null;
- if (window.ViewContent is IMementoCapable) {
- memento = ((IMementoCapable)window.ViewContent).CreateMemento();
- }
- window.ViewContent.Load(window.ViewContent.ContentName);
- if (memento != null) {
- ((IMementoCapable)window.ViewContent).SetMemento(memento);
- }
- }
- }
- }
- }
- public class SaveFileAs : AbstractMenuCommand
+ public class SaveAllHandler : CommandHandler
{
- public override void Run()
+ protected override void Run()
{
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
-
- if (window != null) {
- if (window.ViewContent.IsViewOnly) {
- return;
- }
- if (window.ViewContent is ICustomizedCommands) {
- if (((ICustomizedCommands)window.ViewContent).SaveAsCommand()) {
- return;
- }
- }
- /*
- using (SaveFileDialog fdiag = new SaveFileDialog()) {
- fdiag.OverwritePrompt = true;
- fdiag.AddExtension = true;
-
- string[] fileFilters = (string[])(AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Workbench/FileFilter").BuildChildItems(this)).ToArray(typeof(string));
- fdiag.Filter = String.Join("|", fileFilters);
- for (int i = 0; i < fileFilters.Length; ++i) {
- if (fileFilters[i].IndexOf(Path.GetExtension(window.ViewContent.ContentName == null ? window.ViewContent.UntitledName : window.ViewContent.ContentName)) >= 0) {
- fdiag.FilterIndex = i + 1;
- break;
- }
- }*/
- FileSelector fdiag = new FileSelector (GettextCatalog.GetString ("Save as..."), Gtk.FileChooserAction.Save);
- fdiag.SetFilename (window.ViewContent.ContentName);
- int response = fdiag.Run ();
- string filename = fdiag.Filename;
- fdiag.Hide ();
-
- if (response == (int)Gtk.ResponseType.Ok) {
- if (!Runtime.FileUtilityService.IsValidFileName (filename)) {
- Runtime.MessageService.ShowMessage(String.Format (GettextCatalog.GetString ("File name {0} is invalid"), filename));
- return;
- }
- // detect preexisting file
- if(File.Exists(filename)){
- if(!Runtime.MessageService.AskQuestion(String.Format (GettextCatalog.GetString ("File {0} already exists. Overwrite?"), filename))){
- return;
- }
- }
- // save backup first
- if((bool) Runtime.Properties.GetProperty ("SharpDevelop.CreateBackupCopy", false)) {
- Runtime.FileUtilityService.ObservedSave (new NamedFileOperationDelegate(window.ViewContent.Save), filename + "~");
- }
-
- // do actual save
- if (Runtime.FileUtilityService.ObservedSave (new NamedFileOperationDelegate(window.ViewContent.Save), filename) == FileOperationResult.OK) {
- Runtime.FileService.RecentOpen.AddLastFile (filename, null);
- }
- }
- }
- }
- }
-
- public class SaveAllFiles : AbstractMenuCommand
- {
- public override void Run()
- {
foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) {
if (content.IsViewOnly) {
continue;
@@ -226,42 +110,12 @@
}
}
}
- }
+ }
- public class OpenCombine : AbstractMenuCommand
- {
- public override void Run()
- {
- using (FileSelector fs = new FileSelector (GettextCatalog.GetString ("File to Open"))) {
- int response = fs.Run ();
- string name = fs.Filename;
- fs.Hide ();
- if (response == (int)Gtk.ResponseType.Ok) {
- switch (Path.GetExtension(name).ToUpper()) {
- case ".CMBX": // Don't forget the 'recent' projects if you chance something here
- case ".PRJX":
- case ".MDP":
- case ".MDS":
- try {
- //Runtime.ProjectService.OpenCombine(name);
- Runtime.FileService.OpenFile(name);
- } catch (Exception ex) {
- CombineLoadError.HandleError(ex, name);
- }
- break;
- default:
- Runtime.MessageService.ShowError(String.Format (GettextCatalog.GetString ("Can't open file {0} as project"), name));
- break;
- }
- }
- }
- }
- }
-
- public class OpenFile : AbstractMenuCommand
+ public class OpenFileHandler : CommandHandler
{
- public override void Run()
+ protected override void Run()
{
//string[] fileFilters = (string[])(AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Workbench/FileFilter").BuildChildItems(this)).ToArray(typeof(string));
//bool foundFilter = false;
@@ -307,17 +161,22 @@
}
}
- public class ClearCombine : AbstractMenuCommand
+ public class CloseCombineHandler : CommandHandler
{
- public override void Run()
+ protected override void Run()
{
Runtime.ProjectService.CloseCombine();
}
+
+ protected override void Update (CommandInfo info)
+ {
+ info.Enabled = (Runtime.ProjectService.CurrentOpenCombine != null);
+ }
}
- public class ExitWorkbenchCommand : AbstractMenuCommand
+ public class ExitHandler : CommandHandler
{
- public override void Run()
+ protected override void Run()
{
if (((DefaultWorkbench)WorkbenchSingleton.Workbench).Close()) {
Gtk.Application.Quit();
@@ -325,9 +184,10 @@
}
}
- public class Print : AbstractMenuCommand
+
+ public class PrintHandler : CommandHandler
{
- public override void Run()
+ protected override void Run()
{/*
IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
@@ -354,9 +214,9 @@
}
}
- public class PrintPreview : AbstractMenuCommand
+ public class PrintPreviewHandler : CommandHandler
{
- public override void Run()
+ protected override void Run()
{
/* try {
IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
@@ -382,9 +242,9 @@
}
}
- public class ClearRecentFiles : AbstractMenuCommand
+ public class ClearRecentFilesHandler : CommandHandler
{
- public override void Run()
+ protected override void Run()
{
try {
if (Runtime.FileService.RecentOpen.RecentFile != null && Runtime.FileService.RecentOpen.RecentFile.Length > 0 && Runtime.MessageService.AskQuestion(GettextCatalog.GetString ("Are you sure you want to clear recent files list?"), GettextCatalog.GetString ("Clear recent files")))
@@ -393,11 +253,17 @@
}
} catch {}
}
+
+ protected override void Update (CommandInfo info)
+ {
+ RecentOpen recentOpen = Runtime.FileService.RecentOpen;
+ info.Enabled = (recentOpen.RecentFile != null && recentOpen.RecentFile.Length > 0);
+ }
}
- public class ClearRecentProjects : AbstractMenuCommand
+ public class ClearRecentProjectsHandler : CommandHandler
{
- public override void Run()
+ protected override void Run()
{
try {
if (Runtime.FileService.RecentOpen.RecentProject != null && Runtime.FileService.RecentOpen.RecentProject.Length > 0 && Runtime.MessageService.AskQuestion(GettextCatalog.GetString ("Are you sure you want to clear recent projects list?"), GettextCatalog.GetString ("Clear recent projects")))
@@ -406,5 +272,64 @@
}
} catch {}
}
+
+ protected override void Update (CommandInfo info)
+ {
+ RecentOpen recentOpen = Runtime.FileService.RecentOpen;
+ info.Enabled = (recentOpen.RecentProject != null && recentOpen.RecentProject.Length > 0);
+ }
}
+
+ public class RecentFileListHandler : CommandHandler
+ {
+ protected override void Update (CommandArrayInfo info)
+ {
+ RecentOpen recentOpen = Runtime.FileService.RecentOpen;
+ if (recentOpen.RecentFile != null && recentOpen.RecentFile.Length > 0) {
+ for (int i = 0; i < recentOpen.RecentFile.Length; ++i) {
+ string accelaratorKeyPrefix = i < 10 ? "_" + ((i + 1) % 10).ToString() + " " : "";
+ RecentItem ri = recentOpen.RecentFile[i];
+ string label = ((ri.Private == null || ri.Private.Length < 1) ? Path.GetFileName (ri.ToString ()) : ri.Private);
+ CommandInfo cmd = new CommandInfo (accelaratorKeyPrefix + label.Replace ("_", "__"));
+ info.Add (cmd, ri);
+ }
+ }
+ }
+
+ protected override void Run (object dataItem)
+ {
+ Runtime.FileService.OpenFile (dataItem.ToString());
+ }
+ }
+
+ public class RecentProjectListHandler : CommandHandler
+ {
+ protected override void Update (CommandArrayInfo info)
+ {
+ RecentOpen recentOpen = Runtime.FileService.RecentOpen;
+ if (recentOpen.RecentProject != null && recentOpen.RecentProject.Length > 0) {
+ for (int i = 0; i < recentOpen.RecentProject.Length; ++i) {
+ string accelaratorKeyPrefix = i < 10 ? "_" + ((i + 1) % 10).ToString() + " " : "";
+ RecentItem ri = recentOpen.RecentProject[i];
+ string label = ((ri.Private == null || ri.Private.Length < 1) ? Path.GetFileNameWithoutExtension (ri.ToString ()) : ri.Private);
+ CommandInfo cmd = new CommandInfo (accelaratorKeyPrefix + label.Replace ("_", "__"));
+ cmd.Description = String.Format (GettextCatalog.GetString ("load solution {0}"), ri.ToString ());
+ info.Add (cmd, ri);
+ }
+ }
+ }
+
+ protected override void Run (object dataItem)
+ {
+ //FIXME:THIS IS BROKEN!!
+
+ string filename = dataItem.ToString();
+
+ try {
+ Runtime.ProjectService.OpenCombine(filename);
+ } catch (Exception ex) {
+ CombineLoadError.HandleError(ex, filename);
+ }
+ }
+ }
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/HelpCommands.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/HelpCommands.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/HelpCommands.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -20,20 +20,31 @@
namespace MonoDevelop.Commands
{
- public class ShowHelp : AbstractMenuCommand
+ public enum HelpCommands
{
- public override void Run()
+ TipOfTheDay,
+ About
+ }
+
+ public class TipOfTheDayHandler: CommandHandler
+ {
+ protected override void Run ()
{
-/* string fileName = Runtime.FileUtilityService.SharpDevelopRootPath +
- Path.DirectorySeparatorChar + "doc" +
- Path.DirectorySeparatorChar + "help" +
- Path.DirectorySeparatorChar + "sharpdevelop.chm";
- //if (fileUtilityService.TestFileExists(fileName)) {
- // Help.ShowHelp((Gtk.Window)WorkbenchSingleton.Workbench, fileName);
- //}
-*/
+ TipOfTheDayWindow totdw = new TipOfTheDayWindow ();
+ totdw.Show ();
}
}
+
+ public class AboutHandler: CommandHandler
+ {
+ protected override void Run ()
+ {
+ using (CommonAboutDialog ad = new CommonAboutDialog ()) {
+ ad.Run ();
+ ad.Hide ();
+ }
+ }
+ }
public class GotoWebSite : AbstractMenuCommand
{
@@ -70,24 +81,4 @@
}
}
}
-
- public class ViewTipOfTheDay : AbstractMenuCommand
- {
- public override void Run()
- {
- TipOfTheDayWindow totdw = new TipOfTheDayWindow ();
- totdw.Show ();
- }
- }
-
- public class AboutSharpDevelop : AbstractMenuCommand
- {
- public override void Run()
- {
- using (CommonAboutDialog ad = new CommonAboutDialog ()) {
- ad.Run ();
- ad.Hide ();
- }
- }
- }
}
Deleted: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/MenuItemBuilders.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/MenuItemBuilders.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/MenuItemBuilders.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -1,440 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.Collections;
-
-using MonoDevelop.Core.AddIns;
-using MonoDevelop.Core.AddIns.Codons;
-using MonoDevelop.Core.AddIns.Conditions;
-using MonoDevelop.Core.Properties;
-using MonoDevelop.Core.Services;
-using MonoDevelop.Services;
-using MonoDevelop.Gui;
-using MonoDevelop.Gui.Components;
-using MonoDevelop.Gui.ErrorHandlers;
-using MonoDevelop.Gui.Dialogs;
-using MonoDevelop.Internal.Project;
-using MonoDevelop.Internal.ExternalTool;
-using MonoDevelop.Gui.Pads;
-
-using Freedesktop.RecentFiles;
-
-namespace MonoDevelop.Commands
-{
-
- public interface ISubmenuItem
- {
- }
-
- public class RecentFilesMenuBuilder : ISubmenuBuilder
- {
-
- class RFMItem : SdMenuCommand, ISubmenuItem {
- public RFMItem (ConditionCollection a, object b, string c) : base (a, b, c) {
- }
- public RFMItem (ConditionCollection a, object b, string c, EventHandler d) : base (a, b, c, d) {
- }
- }
-
-
- public Gtk.MenuItem[] BuildSubmenu(ConditionCollection conditionCollection, object owner)
- {
- RecentOpen recentOpen = Runtime.FileService.RecentOpen;
-
- if (recentOpen.RecentFile != null && recentOpen.RecentFile.Length > 0) {
- RFMItem[] items = new RFMItem[recentOpen.RecentFile.Length];
-
- for (int i = 0; i < recentOpen.RecentFile.Length; ++i) {
- string accelaratorKeyPrefix = i < 10 ? "&" + ((i + 1) % 10).ToString() + " " : "";
- RecentItem ri = recentOpen.RecentFile[i];
- string label = ((ri.Private == null || ri.Private.Length < 1) ? Path.GetFileName (ri.ToString ()) : ri.Private);
- items[i] = new RFMItem (null, null, accelaratorKeyPrefix + label.Replace ("_", "__"), new EventHandler (LoadRecentFile));
- items[i].Tag = ri.ToString ();
- }
- return items;
- }
-
- RFMItem defaultMenu = new RFMItem(null, null, GettextCatalog.GetString("recent files"));
- defaultMenu.Sensitive = false;
-
- return new RFMItem[] { defaultMenu };
- }
-
- void LoadRecentFile(object sender, EventArgs e)
- {
- SdMenuCommand item = (SdMenuCommand)sender;
- Runtime.FileService.OpenFile (item.Tag.ToString());
- }
- }
-
- public class RecentProjectsMenuBuilder : ISubmenuBuilder
- {
- class RPMItem : SdMenuCommand, ISubmenuItem {
- public RPMItem (ConditionCollection a, object b, string c) : base (a, b, c) {
- }
- public RPMItem (ConditionCollection a, object b, string c, EventHandler d) : base (a, b, c, d) {
- }
- }
-
- public Gtk.MenuItem[] BuildSubmenu(ConditionCollection conditionCollection, object owner)
- {
- RecentOpen recentOpen = Runtime.FileService.RecentOpen;
-
- if (recentOpen.RecentProject != null && recentOpen.RecentProject.Length > 0) {
- RPMItem[] items = new RPMItem[recentOpen.RecentProject.Length];
- for (int i = 0; i < recentOpen.RecentProject.Length; ++i) {
- string accelaratorKeyPrefix = i < 10 ? "&" + ((i + 1) % 10).ToString() + " " : "";
- RecentItem ri = recentOpen.RecentProject[i];
- string label = ((ri.Private == null || ri.Private.Length < 1) ? Path.GetFileNameWithoutExtension (ri.ToString ()) : ri.Private);
- items[i] = new RPMItem(null, null, accelaratorKeyPrefix + label.Replace ("_", "__"), new EventHandler(LoadRecentProject));
- items[i].Tag = ri.ToString ();
- items[i].Description = String.Format (GettextCatalog.GetString ("load solution {0}"), ri.ToString ());
- }
- return items;
- }
-
- RPMItem defaultMenu = new RPMItem(null, null, GettextCatalog.GetString ("recent solutions"));
- defaultMenu.Sensitive = false;
-
- return new RPMItem[] { defaultMenu };
- }
- void LoadRecentProject(object sender, EventArgs e)
- {
- SdMenuCommand item = (SdMenuCommand)sender;
-
- //FIXME:THIS IS BROKEN!!
-
- string filename = item.Tag.ToString();
-
- try {
- Runtime.ProjectService.OpenCombine(filename);
- } catch (Exception ex) {
- CombineLoadError.HandleError(ex, filename);
- }
- }
- }
-
- public class ToolMenuBuilder : ISubmenuBuilder
- {
- class TMItem : SdMenuCommand, ISubmenuItem {
- public TMItem (ConditionCollection a, object b, string c, EventHandler d) : base (a, b, c, d) {
- }
- }
-
- public Gtk.MenuItem[] BuildSubmenu(ConditionCollection conditionCollection, object owner)
- {
- // IconMenuStyle iconMenuStyle = (IconMenuStyle)propertyService.GetProperty("IconMenuItem.IconMenuStyle", IconMenuStyle.VSNet);
- TMItem[] items = new TMItem[ToolLoader.Tool.Count];
- for (int i = 0; i < ToolLoader.Tool.Count; ++i) {
- TMItem item = new TMItem(null, null, ToolLoader.Tool[i].ToString(), new EventHandler(ToolEvt));
- item.Description = GettextCatalog.GetString ("Start tool") + " " + String.Join(String.Empty, ToolLoader.Tool[i].ToString().Split('&'));
- items[i] = item;
- }
- return items;
- }
-
- void ToolEvt(object sender, EventArgs e)
- {
- SdMenuCommand item = (SdMenuCommand)sender;
-
- for (int i = 0; i < ToolLoader.Tool.Count; ++i) {
- if (item.Text == ToolLoader.Tool[i].ToString()) {
- ExternalTool tool = (ExternalTool)ToolLoader.Tool[i];
- Runtime.DispatchService.BackgroundDispatch (new StatefulMessageHandler (RunTool), tool);
- break;
- }
- }
- }
-
- private void RunTool (object ob)
- {
- StringParserService stringParserService = Runtime.StringParserService;
- ExternalTool tool = (ExternalTool) ob;
-
- // set the command
- string command = tool.Command;
- // set the args
- string args = stringParserService.Parse(tool.Arguments);
- // prompt for args if needed
- if (tool.PromptForArguments) {
- args = Runtime.MessageService.GetTextResponse(String.Format (GettextCatalog.GetString ("Enter any arguments you want to use while launching tool, {0}:"), tool.MenuCommand), String.Format (GettextCatalog.GetString ("Command Arguments for {0}"), tool.MenuCommand), args);
-
- // if user selected cancel string will be null
- if (args == null) {
- args = stringParserService.Parse(tool.Arguments);
- }
- }
-
- // debug command and args
- Runtime.LoggingService.Info("command : " + command);
- Runtime.LoggingService.Info("args : " + args);
-
- // create the process
- IProgressMonitor monitor = Runtime.TaskService.GetRunProgressMonitor ();
- monitor.Log.WriteLine ("Running: {0} {1} ...", command, args);
- monitor.Log.WriteLine ();
-
- try {
- ProcessWrapper p;
- string workingDirectory = stringParserService.Parse(tool.InitialDirectory);
- if (tool.UseOutputPad)
- p = Runtime.ProcessService.StartProcess (command, args, workingDirectory, monitor.Log, monitor.Log, null);
- else
- p = Runtime.ProcessService.StartProcess (command, args, workingDirectory, null);
-
- p.WaitForOutput ();
- Runtime.LoggingService.Info ("DONE");
-
- monitor.Log.WriteLine ();
- if (p.ExitCode == 0) {
- monitor.Log.WriteLine ("Process '{0}' has completed succesfully.", p.ProcessName);
- } else {
- monitor.Log.WriteLine ("Process '{0}' has exited with errorcode {1}.", p.ProcessName, p.ExitCode);
- }
-
- } catch (Exception ex) {
- monitor.ReportError (String.Format (GettextCatalog.GetString ("External program execution failed.\nError while starting:\n '{0} {1}'"), command, args), ex);
- } finally {
- monitor.Dispose ();
- }
- }
- }
-
- public class OpenContentsMenuBuilder : ISubmenuBuilder
- {
-
- class MyMenuItem : SdMenuCheckBox, ISubmenuItem
- {
- public MyMenuItem(string name) : base(null, null, name)
- {
- }
-
- protected override void OnToggled ()
- {
- base.OnToggled ();
- ((IWorkbenchWindow)Tag).SelectWindow();
- Active = true;
- }
- }
-
- public Gtk.MenuItem[] BuildSubmenu(ConditionCollection conditionCollection, object owner)
- {
- int contentCount = WorkbenchSingleton.Workbench.ViewContentCollection.Count;
- if (contentCount == 0) {
- return new Gtk.MenuItem[] {};
- }
- Gtk.MenuItem[] items = new Gtk.MenuItem[contentCount];
- for (int i = 0; i < contentCount; ++i) {
- IViewContent content = (IViewContent)WorkbenchSingleton.Workbench.ViewContentCollection[i];
-
- MyMenuItem item = null;
- if (content.WorkbenchWindow.ShowNotification) {
- item = new MyMenuItem("<span foreground=\"blue\">" + content.WorkbenchWindow.Title + "</span>");
- } else {
- item = new MyMenuItem (content.WorkbenchWindow.Title);
- }
- item.Tag = content.WorkbenchWindow;
- if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == content.WorkbenchWindow) {
- item.Active = true;
- } else {
- item.Active = false;
- }
- item.Description = GettextCatalog.GetString ("Activate this window");
- if (i + 1 <= 9) {
- string accel_path = "<MonoDevelop>/MainWindow/OpenContents_" + (i + 1).ToString ();
- if (!Gtk.AccelMap.LookupEntry (accel_path, new Gtk.AccelKey ())) {
- Gtk.AccelMap.AddEntry (accel_path, Gdk.Keyval.FromName ((i + 1).ToString ()), Gdk.ModifierType.Mod1Mask);
- } else {
- Gtk.AccelMap.ChangeEntry (accel_path, Gdk.Keyval.FromName ((i + 1).ToString()), Gdk.ModifierType.Mod1Mask, true);
- }
- item.AccelPath = accel_path;
- }
- items[i] = item;
- }
- return items;
- }
- }
-
- public class IncludeFilesBuilder : ISubmenuBuilder
- {
- public SolutionPad browser;
-
- SdMenuCheckBox includeInCompileItem;
- SdMenuCheckBox includeInDeployItem;
-
- class MyMenuItem : SdMenuCheckBox, ISubmenuItem
- {
- public MyMenuItem(string name) : base(null, null, name)
- {
- }
- }
-
- public Gtk.MenuItem[] BuildSubmenu(ConditionCollection conditionCollection, object owner)
- {
- browser = (SolutionPad) owner;
- ITreeNavigator nav = browser.GetSelectedNode ();
- if (nav == null) return new Gtk.MenuItem[0];
-
- ProjectFile finfo = nav.DataItem as ProjectFile;
- if (finfo == null) return new Gtk.MenuItem[0];
-
- Project project = (Project) nav.GetParentDataItem (typeof(Project), false);
-
- includeInCompileItem = new MyMenuItem (GettextCatalog.GetString ("Compile"));
- includeInDeployItem = new MyMenuItem (GettextCatalog.GetString ("Deploy"));
-
- includeInCompileItem.Active = finfo.BuildAction == BuildAction.Compile;
- includeInDeployItem.Active = !project.DeployInformation.IsFileExcluded (finfo.Name);
-
- includeInCompileItem.Toggled += new EventHandler (ChangeCompileInclude);
- includeInDeployItem.Toggled += new EventHandler (ChangeDeployInclude);
-
- return new Gtk.MenuItem[] {
- includeInCompileItem,
- includeInDeployItem
- };
-
- }
- void ChangeCompileInclude (object sender, EventArgs e)
- {
- ITreeNavigator nav = browser.GetSelectedNode ();
- if (nav == null) return;
-
- ProjectFile finfo = nav.DataItem as ProjectFile;
- if (finfo != null) {
- if (finfo.BuildAction == BuildAction.Compile) {
- finfo.BuildAction = BuildAction.Nothing;
- } else {
- finfo.BuildAction = BuildAction.Compile;
- }
- }
- Runtime.ProjectService.SaveCombine();
- }
-
- void ChangeDeployInclude(object sender, EventArgs e)
- {
- ITreeNavigator nav = browser.GetSelectedNode ();
- if (nav == null) return;
-
- ProjectFile finfo = nav.DataItem as ProjectFile;
- if (finfo != null) {
- Project project = (Project) nav.GetParentDataItem (typeof(Project), false);
- if (project.DeployInformation.IsFileExcluded (finfo.Name)) {
- project.DeployInformation.RemoveExcludedFile (finfo.Name);
- } else {
- project.DeployInformation.AddExcludedFile (finfo.Name);
- }
- }
- Runtime.ProjectService.SaveCombine();
- }
- }
-
-
- public class ViewMenuBuilder : ISubmenuBuilder
- {
- class MyMenuItem : SdMenuCheckBox, ISubmenuItem
- {
- IPadContent padContent;
-
- bool IsPadVisible {
- get {
- return WorkbenchSingleton.Workbench.WorkbenchLayout.IsVisible(padContent);
- }
- }
-
- public MyMenuItem(IPadContent padContent) : base(null, null, padContent.Title)
- {
- Active = WorkbenchSingleton.Workbench.WorkbenchLayout.IsVisible (padContent);
- this.padContent = padContent;
- }
-
- protected override void OnToggled ()
- {
- base.OnToggled ();
- if (padContent == null) return;
-
- if (IsPadVisible) {
- WorkbenchSingleton.Workbench.WorkbenchLayout.HidePad(padContent);
- } else {
- WorkbenchSingleton.Workbench.WorkbenchLayout.ShowPad(padContent);
- }
- Active = IsPadVisible;
- }
-
- public override void UpdateStatus()
- {
- base.UpdateStatus();
- }
- }
-
- public Gtk.MenuItem[] BuildSubmenu(ConditionCollection conditionCollection, object owner)
- {
- ArrayList items = new ArrayList();
- IWorkbench wb = WorkbenchSingleton.Workbench;
- if (wb.WorkbenchLayout != null)
- {
- PadContentCollection pads = wb.WorkbenchLayout.PadContentCollection;
- foreach (IPadContent padContent in pads) {
- items.Add(new MyMenuItem(padContent));
- }
- }
-
- return (MyMenuItem[])items.ToArray(typeof(MyMenuItem));
- }
- }
-
- public class LayoutsMenuBuilder : ISubmenuBuilder
- {
- class MyMenuItem : SdMenuCheckBox, ISubmenuItem
- {
- string layoutName;
-
- bool IsCurrentLayout {
- get {
- return (WorkbenchSingleton.Workbench.WorkbenchLayout.CurrentLayout == layoutName);
- }
- }
-
- public MyMenuItem (string name) : base (null, null, name)
- {
- Active = WorkbenchSingleton.Workbench.WorkbenchLayout.CurrentLayout == layoutName;
- this.layoutName = name;
- }
-
- protected override void OnToggled ()
- {
- base.OnToggled ();
- if (layoutName != null)
- WorkbenchSingleton.Workbench.WorkbenchLayout.CurrentLayout = layoutName;
- }
-
- public override void UpdateStatus()
- {
- base.UpdateStatus();
- }
- }
-
- public Gtk.MenuItem[] BuildSubmenu(ConditionCollection conditionCollection, object owner)
- {
- ArrayList items = new ArrayList();
- IWorkbench wb = WorkbenchSingleton.Workbench;
- if (wb.WorkbenchLayout != null)
- {
- string[] layouts = wb.WorkbenchLayout.Layouts;
- Array.Sort (layouts);
- foreach (string layout in layouts) {
- items.Add (new MyMenuItem (layout));
- }
- }
-
- return (MyMenuItem[]) items.ToArray (typeof (MyMenuItem));
- }
- }
-}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/ProjectCommands.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/ProjectCommands.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/ProjectCommands.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -6,82 +6,210 @@
// </file>
using System;
+using System.IO;
using System.Diagnostics;
-using System.IO;
-using System.Collections;
-
-using MonoDevelop.Core.AddIns;
-using MonoDevelop.Core.Properties;
-using MonoDevelop.Core.AddIns.Codons;
-using MonoDevelop.Core.Services;
using MonoDevelop.Services;
using MonoDevelop.Gui;
-using MonoDevelop.Gui.Dialogs;
using MonoDevelop.Internal.Project;
namespace MonoDevelop.Commands
{
- public class RunTestsInProject : AbstractMenuCommand
+ public enum ProjectCommands
{
- public override void Run()
+ Compile,
+ AddNewProject,
+ AddNewCombine,
+ AddProject,
+ AddCombine,
+ RemoveFromProject,
+ Options,
+ AddResource,
+ AddReference,
+ AddNewFiles,
+ AddFiles,
+ NewFolder,
+ IncludeToProject,
+ Build,
+ Rebuild,
+ SetAsStartupProject,
+ GenerateMakefiles,
+ Run,
+ IncludeInBuild,
+ IncludeInDeploy,
+ Deploy,
+ ConfigurationSelector,
+ Debug,
+ Stop
+ }
+
+ public class CompileHandler: CommandHandler
+ {
+ protected override void Run ()
{
- if (Runtime.ProjectService.CurrentSelectedProject != null) {
- string assembly = Runtime.ProjectService.CurrentSelectedProject.GetOutputFileName ();
-
- if (!File.Exists(assembly)) {
- Runtime.MessageService.ShowError (GettextCatalog.GetString ("Assembly not Found (Compile the project first)"));
- } else {
- string command = Runtime.FileUtilityService.SharpDevelopRootPath +
- Path.DirectorySeparatorChar + "bin" +
- Path.DirectorySeparatorChar + "nunit" +
- Path.DirectorySeparatorChar + "nunit-gui.exe";
- string args = '"' + assembly + '"';
- Process.Start(command, args);
- }
+ IProjectService projectService = Runtime.ProjectService;
+ if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
+ Runtime.FileService.SaveFile (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow);
+ projectService.BuildFile (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName);
}
}
+
+ protected override void Update (CommandInfo info)
+ {
+ info.Enabled = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null;
+ }
}
- public class ViewProjectOptions : AbstractMenuCommand
+ public class RunHandler: CommandHandler
{
- public override void Run()
+ CombineEntry entry;
+ string file;
+
+ protected override void Run ()
{
- Project selectedProject = Runtime.ProjectService.CurrentSelectedProject;
- if (selectedProject == null) {
- return;
+ if (Runtime.ProjectService.CurrentOpenCombine != null) {
+ entry = Runtime.ProjectService.CurrentSelectedCombineEntry;
+ if (entry != null) {
+ IAsyncOperation op = Runtime.ProjectService.Build (entry);
+ op.Completed += new OperationHandler (ExecuteCombine);
+ }
+ } else {
+ if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
+ file = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName;
+ IAsyncOperation op = Runtime.ProjectService.ExecuteFile (file);
+ op.Completed += new OperationHandler (ExecuteFile);
+ }
}
-
- IAddInTreeNode generalOptionsNode = AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Workbench/ProjectOptions/GeneralOptions");
- IAddInTreeNode configurationPropertiesNode = AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Workbench/ProjectOptions/ConfigurationProperties");
-
- ProjectOptionsDialog optionsDialog = new ProjectOptionsDialog(selectedProject, generalOptionsNode, configurationPropertiesNode);
- if (optionsDialog.Run() == (int)Gtk.ResponseType.Ok) {
- Runtime.ProjectService.CurrentSelectedProject.NeedsBuilding = true;
+ }
+
+ protected override void Update (CommandInfo info)
+ {
+ if (Runtime.ProjectService.CurrentOpenCombine != null) {
+ info.Enabled = Runtime.ProjectService.CurrentSelectedCombineEntry != null &&
+ Runtime.ProjectService.CurrentRunOperation.IsCompleted;
+ } else {
+ info.Enabled = (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null);
}
-
- Runtime.ProjectService.SaveCombine();
}
+
+ void ExecuteCombine (IAsyncOperation op)
+ {
+ if (op.Success)
+ Runtime.ProjectService.Execute (entry);
+ }
+
+ void ExecuteFile (IAsyncOperation op)
+ {
+ if (op.Success)
+ Runtime.ProjectService.ExecuteFile (file);
+ }
}
- public class DeployProject : AbstractMenuCommand
+ public class DebugHandler: CommandHandler
{
- public override void Run()
+ CombineEntry entry;
+ string file;
+
+ protected override void Run ()
{
- foreach (IViewContent viewContent in WorkbenchSingleton.Workbench.ViewContentCollection) {
- if (viewContent.IsDirty) {
- viewContent.Save();
+ if (Runtime.ProjectService.CurrentOpenCombine != null) {
+ entry = Runtime.ProjectService.CurrentSelectedCombineEntry;
+ if (entry != null) {
+ IAsyncOperation op = Runtime.ProjectService.Build (entry);
+ op.Completed += new OperationHandler (ExecuteCombine);
}
+ } else {
+ if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
+ file = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName;
+ IAsyncOperation op = Runtime.ProjectService.ExecuteFile (file);
+ op.Completed += new OperationHandler (ExecuteFile);
+ }
}
- if (Runtime.ProjectService.CurrentSelectedProject != null) {
- DeployInformation.Deploy (Runtime.ProjectService.CurrentSelectedProject);
+ }
+
+ protected override void Update (CommandInfo info)
+ {
+ if (Runtime.ProjectService.CurrentOpenCombine != null) {
+ info.Enabled = Runtime.ProjectService.CurrentSelectedCombineEntry != null &&
+ Runtime.ProjectService.CurrentRunOperation.IsCompleted;
+ } else {
+ info.Enabled = (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null);
}
}
+
+ void ExecuteCombine (IAsyncOperation op)
+ {
+ if (op.Success)
+ Runtime.ProjectService.Debug (entry);
+ }
+
+ void ExecuteFile (IAsyncOperation op)
+ {
+ if (op.Success)
+ Runtime.ProjectService.DebugFile (file);
+ }
}
- public class GenerateProjectDocumentation : AbstractMenuCommand
+ public class BuildHandler: CommandHandler
{
- public override void Run()
+ protected override void Run ()
{
+ if (Runtime.ProjectService.CurrentSelectedCombineEntry != null)
+ Runtime.ProjectService.Build (Runtime.ProjectService.CurrentSelectedCombineEntry);
+ }
+
+ protected override void Update (CommandInfo info)
+ {
+ info.Enabled = Runtime.ProjectService.CurrentBuildOperation.IsCompleted &&
+ (Runtime.ProjectService.CurrentSelectedCombineEntry != null);
+ }
+ }
+
+ public class RebuildHandler: CommandHandler
+ {
+ protected override void Run ()
+ {
+ if (Runtime.ProjectService.CurrentSelectedCombineEntry != null)
+ Runtime.ProjectService.Rebuild (Runtime.ProjectService.CurrentSelectedCombineEntry);
+ }
+
+ protected override void Update (CommandInfo info)
+ {
+ info.Enabled = Runtime.ProjectService.CurrentBuildOperation.IsCompleted &&
+ (Runtime.ProjectService.CurrentSelectedCombineEntry != null);
+ }
+ }
+
+ public class StopHandler: CommandHandler
+ {
+ protected override void Run ()
+ {
+ if (!Runtime.ProjectService.CurrentBuildOperation.IsCompleted)
+ Runtime.ProjectService.CurrentBuildOperation.Cancel ();
+ if (!Runtime.ProjectService.CurrentRunOperation.IsCompleted)
+ Runtime.ProjectService.CurrentRunOperation.Cancel ();
+ }
+
+ protected override void Update (CommandInfo info)
+ {
+ info.Enabled = !Runtime.ProjectService.CurrentBuildOperation.IsCompleted ||
+ !Runtime.ProjectService.CurrentRunOperation.IsCompleted;
+ }
+ }
+
+ public class GenerateMakefilesHandler: CommandHandler
+ {
+ protected override void Run ()
+ {
+ if (Runtime.ProjectService.CurrentOpenCombine != null) {
+ Runtime.ProjectService.CurrentOpenCombine.GenerateMakefiles ();
+ }
+ }
+ }
+
+ public class GenerateProjectDocumentation : CommandHandler
+ {
+ protected override void Run ()
+ {
try {
if (Runtime.ProjectService.CurrentSelectedProject != null) {
string assembly = Runtime.ProjectService.CurrentSelectedProject.GetOutputFileName ();
Deleted: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/RunCommands.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/RunCommands.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/RunCommands.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -1,121 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-
-//
-//
-// FIX ME
-// We need to do the compile in the background
-//
-
-using System;
-using System.IO;
-using System.Threading;
-using System.Drawing;
-using System.Drawing.Printing;
-using System.Collections;
-using Gtk;
-using System.Diagnostics;
-
-using MonoDevelop.Core.AddIns;
-
-using MonoDevelop.Core.Properties;
-using MonoDevelop.Core.AddIns.Codons;
-using System.CodeDom.Compiler;
-
-using MonoDevelop.Gui;
-using MonoDevelop.Internal.Project;
-using MonoDevelop.Gui.Dialogs;
-using MonoDevelop.Services;
-
-namespace MonoDevelop.Commands
-{
- public class Compile : AbstractMenuCommand
- {
- public override void Run()
- {
- IProjectService projectService = Runtime.ProjectService;
- if (projectService.CurrentOpenCombine != null) {
- projectService.BuildActiveCombine ();
- } else {
- if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
- new SaveFile().Run();
- projectService.BuildFile (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName);
- }
- }
- }
- }
-
- public class CompileAll : AbstractMenuCommand
- {
- public override void Run()
- {
- IProjectService projectService = Runtime.ProjectService;
- if (projectService.CurrentOpenCombine != null) {
- projectService.RebuildActiveCombine ();
- } else {
- if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
- new SaveFile().Run();
- projectService.BuildFile (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName);
- }
- }
- }
- }
-
- public class RunCommand : AbstractMenuCommand
- {
- public override void Run()
- {
- if (Runtime.ProjectService.CurrentOpenCombine != null) {
- IAsyncOperation op = Runtime.ProjectService.BuildActiveCombine ();
- op.Completed += new OperationHandler (ExecuteCombine);
- } else {
- if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
- IAsyncOperation op = Runtime.ProjectService.ExecuteFile (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.ContentName);
- op.Completed += new OperationHandler (ExecuteFile);
- }
- }
- }
-
- void ExecuteCombine (IAsyncOperation op)
- {
- if (op.Success)
- Runtime.ProjectService.ExecuteActiveCombine ();
- }
-
- void ExecuteFile (IAsyncOperation op)
- {
- if (op.Success)
- Runtime.ProjectService.ExecuteActiveCombine ();
- }
- }
-
- public class BuildCurrentProject : AbstractMenuCommand
- {
- public override void Run()
- {
- Runtime.ProjectService.BuildActiveProject ();
- }
- }
-
- public class RebuildCurrentProject : AbstractMenuCommand
- {
- public override void Run()
- {
- Runtime.ProjectService.RebuildActiveProject ();
- }
- }
-
- public class GenerateMakefiles : AbstractMenuCommand {
-
- public override void Run ()
- {
- if (Runtime.ProjectService.CurrentOpenCombine != null) {
- Runtime.ProjectService.CurrentOpenCombine.GenerateMakefiles ();
- }
- }
- }
-}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/ToolsCommands.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/ToolsCommands.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/ToolsCommands.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -13,36 +13,85 @@
using MonoDevelop.Core.AddIns;
using MonoDevelop.Core.Properties;
using MonoDevelop.Core.AddIns.Codons;
+using MonoDevelop.Core.Services;
using MonoDevelop.Gui;
-using MonoDevelop.Gui.Dialogs;
+using MonoDevelop.Internal.ExternalTool;
namespace MonoDevelop.Commands
{
- public class OptionsCommand : AbstractMenuCommand
+ public enum ToolCommands
{
- public override void Run()
- {
- new TreeViewOptions((IProperties)Runtime.Properties.GetProperty("MonoDevelop.TextEditor.Document.Document.DefaultDocumentAggregatorProperties", new DefaultProperties()),
- AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Dialogs/OptionsDialog"));
- }
+ ToolList
}
- public class ToggleFullscreenCommand : AbstractMenuCommand
+ public class ToolListHandler: CommandHandler
{
- public override void Run()
+ protected override void Update (CommandArrayInfo info)
{
- ((DefaultWorkbench)WorkbenchSingleton.Workbench).FullScreen = !((DefaultWorkbench)WorkbenchSingleton.Workbench).FullScreen;
+ for (int i = 0; i < ToolLoader.Tool.Count; ++i) {
+ CommandInfo cmd = new CommandInfo (ToolLoader.Tool[i].ToString());
+ cmd.Description = GettextCatalog.GetString ("Start tool") + " " + String.Join(String.Empty, ToolLoader.Tool[i].ToString().Split('&'));
+ info.Add (cmd, ToolLoader.Tool[i]);
+ }
}
- }
-
- public class NewLayoutCommand : AbstractMenuCommand
- {
- public override void Run()
+
+ protected override void Run (object tool)
{
- using (NewLayoutDialog dlg = new NewLayoutDialog ()) {
- dlg.Run ();
+ Runtime.DispatchService.BackgroundDispatch (new StatefulMessageHandler (RunTool), tool);
+ }
+
+ private void RunTool (object ob)
+ {
+ StringParserService stringParserService = Runtime.StringParserService;
+ ExternalTool tool = (ExternalTool) ob;
+
+ // set the command
+ string command = tool.Command;
+ // set the args
+ string args = stringParserService.Parse(tool.Arguments);
+ // prompt for args if needed
+ if (tool.PromptForArguments) {
+ args = Runtime.MessageService.GetTextResponse(String.Format (GettextCatalog.GetString ("Enter any arguments you want to use while launching tool, {0}:"), tool.MenuCommand), String.Format (GettextCatalog.GetString ("Command Arguments for {0}"), tool.MenuCommand), args);
+
+ // if user selected cancel string will be null
+ if (args == null) {
+ args = stringParserService.Parse(tool.Arguments);
+ }
}
+
+ // debug command and args
+ Runtime.LoggingService.Info("command : " + command);
+ Runtime.LoggingService.Info("args : " + args);
+
+ // create the process
+ IProgressMonitor monitor = Runtime.TaskService.GetRunProgressMonitor ();
+ monitor.Log.WriteLine ("Running: {0} {1} ...", command, args);
+ monitor.Log.WriteLine ();
+
+ try {
+ ProcessWrapper p;
+ string workingDirectory = stringParserService.Parse(tool.InitialDirectory);
+ if (tool.UseOutputPad)
+ p = Runtime.ProcessService.StartProcess (command, args, workingDirectory, monitor.Log, monitor.Log, null);
+ else
+ p = Runtime.ProcessService.StartProcess (command, args, workingDirectory, null);
+
+ p.WaitForOutput ();
+ Runtime.LoggingService.Info ("DONE");
+
+ monitor.Log.WriteLine ();
+ if (p.ExitCode == 0) {
+ monitor.Log.WriteLine ("Process '{0}' has completed succesfully.", p.ProcessName);
+ } else {
+ monitor.Log.WriteLine ("Process '{0}' has exited with errorcode {1}.", p.ProcessName, p.ExitCode);
+ }
+
+ } catch (Exception ex) {
+ monitor.ReportError (String.Format (GettextCatalog.GetString ("External program execution failed.\nError while starting:\n '{0} {1}'"), command, args), ex);
+ } finally {
+ monitor.Dispose ();
+ }
}
}
}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/ViewCommands.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/ViewCommands.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/ViewCommands.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -0,0 +1,98 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.Collections;
+using System.CodeDom.Compiler;
+
+using MonoDevelop.Services;
+using MonoDevelop.Core.AddIns;
+using MonoDevelop.Core.Properties;
+using MonoDevelop.Core.AddIns.Codons;
+
+using MonoDevelop.Gui;
+using MonoDevelop.Gui.Dialogs;
+
+namespace MonoDevelop.Commands
+{
+ public enum ViewCommands
+ {
+ ViewList,
+ LayoutList,
+ NewLayout,
+ FullScreen,
+ Open,
+ TreeDisplayOptionList,
+ ResetTreeDisplayOptions
+ }
+
+ public class FullScreenHandler: CommandHandler
+ {
+ protected override void Run ()
+ {
+ ((DefaultWorkbench)WorkbenchSingleton.Workbench).FullScreen = !((DefaultWorkbench)WorkbenchSingleton.Workbench).FullScreen;
+ }
+ }
+
+ public class NewLayoutHandler: CommandHandler
+ {
+ protected override void Run ()
+ {
+ using (NewLayoutDialog dlg = new NewLayoutDialog ()) {
+ dlg.Run ();
+ }
+ }
+ }
+
+ public class ViewListHandler: CommandHandler
+ {
+ protected override void Update (CommandArrayInfo info)
+ {
+ IWorkbench wb = WorkbenchSingleton.Workbench;
+ if (wb.WorkbenchLayout != null) {
+ PadContentCollection pads = wb.WorkbenchLayout.PadContentCollection;
+ foreach (IPadContent padContent in pads) {
+ CommandInfo cmd = new CommandInfo (padContent.Title);
+ cmd.Checked = WorkbenchSingleton.Workbench.WorkbenchLayout.IsVisible (padContent);
+ info.Add (cmd, padContent);
+ }
+ }
+ }
+
+ protected override void Run (object ob)
+ {
+ IPadContent padContent = (IPadContent) ob;
+ if (WorkbenchSingleton.Workbench.WorkbenchLayout.IsVisible (padContent)) {
+ WorkbenchSingleton.Workbench.WorkbenchLayout.HidePad (padContent);
+ } else {
+ WorkbenchSingleton.Workbench.WorkbenchLayout.ShowPad (padContent);
+ }
+ }
+ }
+
+ public class LayoutListHandler: CommandHandler
+ {
+ protected override void Update (CommandArrayInfo info)
+ {
+ IWorkbench wb = WorkbenchSingleton.Workbench;
+ if (wb.WorkbenchLayout != null) {
+ string[] layouts = wb.WorkbenchLayout.Layouts;
+ Array.Sort (layouts);
+ foreach (string layout in layouts) {
+ CommandInfo cmd = new CommandInfo (layout);
+ cmd.Checked = (layout == wb.WorkbenchLayout.CurrentLayout);
+ info.Add (cmd, layout);
+ }
+ }
+ }
+
+ protected override void Run (object layout)
+ {
+ WorkbenchSingleton.Workbench.WorkbenchLayout.CurrentLayout = (string) layout;
+ }
+ }
+}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/WindowCommands.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/WindowCommands.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/WindowCommands.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -11,12 +11,20 @@
using MonoDevelop.Core.Properties;
using MonoDevelop.Core.AddIns.Codons;
using MonoDevelop.Gui;
+using MonoDevelop.Services;
namespace MonoDevelop.Commands
{
- public class SelectNextWindow : AbstractMenuCommand
+ public enum WindowCommands
{
- public override void Run()
+ NextWindow,
+ PrevWindow,
+ OpenWindowList
+ }
+
+ public class NextWindowHandler: CommandHandler
+ {
+ protected override void Run ()
{
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == null) {
return;
@@ -26,9 +34,9 @@
}
}
- public class SelectPrevWindow : AbstractMenuCommand
+ public class PrevWindowHandler: CommandHandler
{
- public override void Run()
+ protected override void Run ()
{
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == null) {
return;
@@ -38,12 +46,37 @@
}
}
- public class CloseAllWindows : AbstractMenuCommand
+ public class OpenWindowListHandler: CommandHandler
{
- public override void Run()
+ protected override void Update (CommandArrayInfo info)
{
- WorkbenchSingleton.Workbench.CloseAllViews();
+ int contentCount = WorkbenchSingleton.Workbench.ViewContentCollection.Count;
+ if (contentCount == 0) return;
+
+ for (int i = 0; i < contentCount; ++i) {
+ IViewContent content = (IViewContent)WorkbenchSingleton.Workbench.ViewContentCollection[i];
+
+ CommandInfo item = null;
+ if (content.WorkbenchWindow.ShowNotification) {
+ item = new CommandInfo ("<span foreground=\"blue\">" + content.WorkbenchWindow.Title + "</span>");
+ item.UseMarkup = true;
+ } else {
+ item = new CommandInfo (content.WorkbenchWindow.Title);
+ }
+
+ item.Checked = (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == content.WorkbenchWindow);
+ item.Description = GettextCatalog.GetString ("Activate this window");
+
+ if (i + 1 <= 9)
+ item.AccelKey = "Alt|" + (i+1);
+
+ info.Add (item, content.WorkbenchWindow);
+ }
}
+
+ protected override void Run (object window)
+ {
+ ((IWorkbenchWindow)window).SelectWindow();
+ }
}
-
}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/CommandService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/CommandService.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/CommandService.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -0,0 +1,113 @@
+//
+// CommandService.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Xml;
+using System.Collections;
+
+using MonoDevelop.Core.Services;
+using MonoDevelop.Commands;
+using MonoDevelop.Core.AddIns;
+using MonoDevelop.Gui;
+
+namespace MonoDevelop.Services
+{
+ public class CommandService : AbstractService
+ {
+ CommandManager manager = new CommandManager ();
+
+ public override void InitializeService()
+ {
+ base.InitializeService();
+
+ ArrayList commandCodons = AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Commands").BuildChildItems (null);
+ foreach (Command cmd in commandCodons)
+ manager.RegisterCommand (cmd, null);
+ }
+
+ public void SetRootWindow (Gtk.Window root)
+ {
+ manager.SetRootWindow (root);
+ }
+
+ public void RegisterGlobalHandler (object handler)
+ {
+ manager.RegisterGlobalHandler (handler);
+ }
+
+ public void UnregisterGlobalHandler (object handler)
+ {
+ manager.UnregisterGlobalHandler (handler);
+ }
+
+ public Gtk.MenuBar CreateMenuBar (string addinPath)
+ {
+ CommandEntrySet cset = CreateCommandEntrySet (addinPath);
+ return manager.CreateMenuBar (addinPath, cset);
+ }
+
+ public Gtk.Toolbar[] CreateToolbarSet (string addinPath)
+ {
+ ArrayList bars = new ArrayList ();
+
+ CommandEntrySet cset = CreateCommandEntrySet (addinPath);
+ foreach (CommandEntry ce in cset) {
+ CommandEntrySet ces = ce as CommandEntrySet;
+ if (ces != null)
+ bars.Add (manager.CreateToolbar (addinPath + "/" + ces.Name, ces));
+ }
+ return (Gtk.Toolbar[]) bars.ToArray (typeof(Gtk.Toolbar));
+ }
+
+ public Gtk.Toolbar CreateToolbar (string addinPath)
+ {
+ CommandEntrySet cset = CreateCommandEntrySet (addinPath);
+ return manager.CreateToolbar (addinPath, cset);
+ }
+
+ public Gtk.Menu CreateMenu (string addinPath)
+ {
+ CommandEntrySet cset = CreateCommandEntrySet (addinPath);
+ return manager.CreateMenu (cset);
+ }
+
+ public Gtk.Menu CreateMenu (CommandEntrySet cset)
+ {
+ return manager.CreateMenu (cset);
+ }
+
+ public CommandEntrySet CreateCommandEntrySet (string addinPath)
+ {
+ CommandEntrySet cset = new CommandEntrySet ();
+ ArrayList items = AddInTreeSingleton.AddInTree.GetTreeNode (addinPath).BuildChildItems (null);
+ foreach (CommandEntry e in items)
+ cset.Add (e);
+ return cset;
+ }
+ }
+}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Components/SdMenu.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Components/SdMenu.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Components/SdMenu.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -26,6 +26,10 @@
void UpdateStatus();
}
+ public interface ISubmenuItem
+ {
+ }
+
public class SdMenu : Gtk.ImageMenuItem, IStatusUpdate
{
ConditionCollection conditionCollection;
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/NewFileDialog.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/NewFileDialog.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/NewFileDialog.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -49,7 +49,7 @@
this.BorderWidth = 6;
this.HasSeparator = false;
- Runtime.DispatchService.BackgroundDispatch (new MessageHandler (InitializeTemplates));
+ InitializeTemplates ();
}
void InitializeView()
@@ -132,7 +132,7 @@
}
alltemplates.Add(titem);
}
- Runtime.DispatchService.GuiDispatch (new MessageHandler (InitializeComponents));
+ InitializeComponents ();
}
// tree view event handlers
@@ -208,12 +208,13 @@
}
}
- Destroy ();
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.SelectWindow();
}
if (OnOked != null)
OnOked (null, null);
+ Respond (Gtk.ResponseType.Ok);
+ Destroy ();
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/NewProjectDialog.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/NewProjectDialog.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/NewProjectDialog.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -59,9 +59,14 @@
new Glade.XML (null, "Base.glade", "NewProjectDialog", null).Autoconnect (this);
dialog.TransientFor = (Window) WorkbenchSingleton.Workbench;
- Runtime.DispatchService.BackgroundDispatch (new MessageHandler (InitializeTemplates));
+ InitializeTemplates ();
}
+ public int Run ()
+ {
+ return dialog.Run ();
+ }
+
void InitializeView()
{
InsertCategories (TreeIter.Zero, categories);
@@ -113,7 +118,7 @@
// titem.Selected = true;
alltemplates.Add(titem);
}
- Runtime.DispatchService.GuiDispatch (new MessageHandler (InitializeComponents));
+ InitializeComponents ();
}
void CategoryChange(object sender, EventArgs e)
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/TreeViewOptions.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/TreeViewOptions.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/TreeViewOptions.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -55,7 +55,6 @@
if (!pane.ReceiveDialogMessage (DialogMessage.OK))
return;
}
- WorkbenchSingleton.Workbench.UpdateMenu (null, null);
TreeViewOptionDialog.Hide ();
}
@@ -176,7 +175,6 @@
private void CancelEvent (object o, EventArgs args)
{
- WorkbenchSingleton.Workbench.UpdateMenu (null, null);
TreeViewOptionDialog.Hide ();
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/GuiService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/GuiService.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/GuiService.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -13,6 +13,7 @@
IconService icons;
ResourceService resourceService;
IStatusBarService statusBarService;
+ CommandService commandService;
public IWorkbench Workbench {
get { return MonoDevelop.Gui.WorkbenchSingleton.Workbench; }
@@ -65,5 +66,13 @@
return icons;
}
}
+
+ public CommandService CommandService {
+ get {
+ if (commandService == null)
+ commandService = (CommandService) ServiceManager.GetService (typeof(CommandService));
+ return commandService;
+ }
+ }
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/IWorkbench.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/IWorkbench.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/IWorkbench.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -114,9 +114,6 @@
/// </summary>
void RedrawAllComponents();
- void UpdateMenu (object o, EventArgs e);
-
-
/// <summary>
/// Is called, when the workbench window which the user has into
/// the foreground (e.g. editable) changed to a new one.
@@ -128,6 +125,7 @@
/// </summary>
WorkbenchContext Context {
get;
+ set;
}
/// <summary>
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ClassPad/ProjectNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ClassPad/ProjectNodeBuilder.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ClassPad/ProjectNodeBuilder.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -118,12 +118,6 @@
return true;
}
- void OnRenameFile (object sender, ProjectFileRenamedEventArgs e)
- {
- ITreeBuilder tb = Context.GetTreeBuilder (e.ProjectFile);
- if (tb != null) tb.Update ();
- }
-
void OnProjectRenamed (object sender, CombineEntryRenamedEventArgs e)
{
ITreeBuilder tb = Context.GetTreeBuilder (e.CombineEntry);
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/CombineNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/CombineNodeBuilder.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/CombineNodeBuilder.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -31,6 +31,7 @@
using MonoDevelop.Internal.Project;
using MonoDevelop.Services;
+using MonoDevelop.Commands;
namespace MonoDevelop.Gui.Pads.ProjectPad
{
@@ -160,8 +161,23 @@
Runtime.ProjectService.SaveCombine();
}
- public override void RemoveItem ()
+ public override DragOperation CanDragNode ()
{
+ return DragOperation.Move;
+ }
+
+ public override bool CanDropNode (object dataObject, DragOperation operation)
+ {
+ return dataObject is CombineEntry;
+ }
+
+ public override void OnNodeDrop (object dataObject, DragOperation operation)
+ {
+ }
+
+ [CommandHandler (EditCommands.Delete)]
+ public void RemoveItem ()
+ {
Combine combine = CurrentNode.DataItem as Combine;
Combine parent = CurrentNode.GetParentDataItem (typeof(Combine), false) as Combine;
if (parent == null) return;
@@ -173,18 +189,56 @@
}
}
- public override DragOperation CanDragNode ()
+ [CommandHandler (ProjectCommands.AddNewProject)]
+ public void AddNewProjectToCombine()
{
- return DragOperation.Move;
+ Combine combine = (Combine) CurrentNode.DataItem;
+ CombineEntry ce = Runtime.ProjectService.CreateProject (combine);
+ if (ce == null) return;
+ Tree.AddNodeInsertCallback (ce, new TreeNodeCallback (OnEntryInserted));
+ CurrentNode.Expanded = true;
}
- public override bool CanDropNode (object dataObject, DragOperation operation)
+ [CommandHandler (ProjectCommands.AddProject)]
+ public void AddProjectToCombine()
{
- return dataObject is CombineEntry;
+ Combine combine = (Combine) CurrentNode.DataItem;
+ CombineEntry ce = Runtime.ProjectService.AddCombineEntry (combine);
+ if (ce == null) return;
+ Tree.AddNodeInsertCallback (ce, new TreeNodeCallback (OnEntryInserted));
+ CurrentNode.Expanded = true;
}
- public override void OnNodeDrop (object dataObject, DragOperation operation)
+ [CommandHandler (ProjectCommands.AddNewCombine)]
+ public void AddNewCombineToCombine()
{
+ Combine combine = (Combine) CurrentNode.DataItem;
+ CombineEntry ce = Runtime.ProjectService.CreateCombine (combine);
+ if (ce == null) return;
+ Tree.AddNodeInsertCallback (ce, new TreeNodeCallback (OnEntryInserted));
+ CurrentNode.Expanded = true;
}
+
+ [CommandHandler (ProjectCommands.AddCombine)]
+ public void AddCombineToCombine()
+ {
+ Combine combine = (Combine) CurrentNode.DataItem;
+ CombineEntry ce = Runtime.ProjectService.AddCombineEntry (combine);
+ if (ce == null) return;
+ Tree.AddNodeInsertCallback (ce, new TreeNodeCallback (OnEntryInserted));
+ CurrentNode.Expanded = true;
+ }
+
+ void OnEntryInserted (ITreeNavigator nav)
+ {
+ nav.Selected = true;
+ nav.Expanded = true;
+ }
+
+ [CommandHandler (ProjectCommands.Options)]
+ public void OnCombineOptions ()
+ {
+ Runtime.ProjectService.ShowOptions ((Combine) CurrentNode.DataItem);
+ }
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/FolderNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/FolderNodeBuilder.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/FolderNodeBuilder.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -30,9 +30,12 @@
using System.IO;
using System.Collections;
using System.Text;
+using Gtk;
using MonoDevelop.Internal.Project;
using MonoDevelop.Services;
+using MonoDevelop.Commands;
+using MonoDevelop.Gui.Widgets;
namespace MonoDevelop.Gui.Pads.ProjectPad
{
@@ -174,5 +177,123 @@
}
Runtime.ProjectService.SaveCombine();
}
+
+ [CommandHandler (ProjectCommands.AddFiles)]
+ public void AddFilesToProject()
+ {
+ Project project = CurrentNode.GetParentDataItem (typeof(Project), true) as Project;
+
+ using (FileSelector fdiag = new FileSelector (GettextCatalog.GetString ("Add files"))) {
+ fdiag.SelectMultiple = true;
+
+ int result = fdiag.Run ();
+ try {
+ if (result != (int) ResponseType.Ok)
+ return;
+
+ foreach (string file in fdiag.Filenames) {
+ if (file.StartsWith (project.BaseDirectory)) {
+ MoveCopyFile (project, CurrentNode, file, true, true);
+ } else {
+ using (MessageDialog md = new MessageDialog (
+ (Window) WorkbenchSingleton.Workbench,
+ DialogFlags.Modal | DialogFlags.DestroyWithParent,
+ MessageType.Question, ButtonsType.None,
+ String.Format (GettextCatalog.GetString ("{0} is outside the project directory, what should I do?"), file))) {
+ md.AddButton (Gtk.Stock.Copy, 1);
+ md.AddButton (GettextCatalog.GetString ("_Move"), 2);
+ md.AddButton (Gtk.Stock.Cancel, ResponseType.Cancel);
+
+ int ret = md.Run ();
+ md.Hide ();
+
+ if (ret < 0)
+ return;
+
+ try {
+ MoveCopyFile (project, CurrentNode, file, ret == 2, false);
+ }
+ catch {
+ Runtime.MessageService.ShowError (GettextCatalog.GetString ("An error occurred while attempt to move/copy that file. Please check your permissions."));
+ }
+ }
+ }
+ }
+ } finally {
+ fdiag.Hide ();
+ }
+ }
+ }
+
+ public static void MoveCopyFile (Project project, ITreeNavigator nav, string filename, bool move, bool alreadyInPlace)
+ {
+ if (Runtime.FileUtilityService.IsDirectory (filename))
+ return;
+
+ ProjectFolder folder = nav.GetParentDataItem (typeof(ProjectFolder), true) as ProjectFolder;
+
+ string name = System.IO.Path.GetFileName (filename);
+ string baseDirectory = folder != null ? folder.Path : project.BaseDirectory;
+ string newfilename = alreadyInPlace ? filename : Path.Combine (baseDirectory, name);
+
+ if (filename != newfilename) {
+ File.Copy (filename, newfilename);
+ if (move)
+ Runtime.FileService.RemoveFile (filename);
+ }
+
+ if (project.IsCompileable (newfilename)) {
+ project.AddFile (newfilename, BuildAction.Compile);
+ } else {
+ project.AddFile (newfilename, BuildAction.Nothing);
+ }
+
+ Runtime.ProjectService.SaveCombine();
+ }
+
+ [CommandHandler (ProjectCommands.AddNewFiles)]
+ public void AddNewFileToProject()
+ {
+ Project project = CurrentNode.GetParentDataItem (typeof(Project), true) as Project;
+ ProjectFile file = Runtime.ProjectService.CreateProjectFile (project, GetFolderPath (CurrentNode.DataItem));
+ if (file != null) {
+ Runtime.ProjectService.SaveCombine();
+ CurrentNode.Expanded = true;
+ Tree.AddNodeInsertCallback (file, new TreeNodeCallback (OnFileInserted));
+ }
+ }
+
+ void OnFileInserted (ITreeNavigator nav)
+ {
+ Tree.StealFocus ();
+ nav.Selected = true;
+ Tree.StartLabelEdit ();
+ }
+
+ [CommandHandler (ProjectCommands.NewFolder)]
+ public void AddNewFolder ()
+ {
+ Project project = CurrentNode.GetParentDataItem (typeof(Project), true) as Project;
+
+ string baseFolderPath = GetFolderPath (CurrentNode.DataItem);
+ string directoryName = Path.Combine (baseFolderPath, GettextCatalog.GetString("New Folder"));
+ int index = -1;
+
+ if (Directory.Exists(directoryName)) {
+ while (Directory.Exists(directoryName + (++index + 1))) ;
+ }
+
+ if (index >= 0) {
+ directoryName += index + 1;
+ }
+
+ Directory.CreateDirectory (directoryName);
+
+ ProjectFile newFolder = new ProjectFile (directoryName);
+ newFolder.Subtype = Subtype.Directory;
+ project.ProjectFiles.Add (newFolder);
+
+ Tree.AddNodeInsertCallback (newFolder, new TreeNodeCallback (OnFileInserted));
+ }
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFileNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFileNodeBuilder.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFileNodeBuilder.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -32,6 +32,7 @@
using MonoDevelop.Internal.Project;
using MonoDevelop.Services;
+using MonoDevelop.Commands;
namespace MonoDevelop.Gui.Pads.ProjectPad
{
@@ -103,8 +104,23 @@
Runtime.FileService.OpenFile (file.FilePath);
}
- public override void RemoveItem ()
+ public override DragOperation CanDragNode ()
{
+ return DragOperation.Copy | DragOperation.Move;
+ }
+
+ public override bool CanDropNode (object dataObject, DragOperation operation)
+ {
+ return dataObject is CombineEntry;
+ }
+
+ public override void OnNodeDrop (object dataObject, DragOperation operation)
+ {
+ }
+
+ [CommandHandler (EditCommands.Delete)]
+ public void RemoveItem ()
+ {
ProjectFile file = CurrentNode.DataItem as ProjectFile;
Project project = CurrentNode.GetParentDataItem (typeof(Project), false) as Project;
@@ -123,18 +139,45 @@
Runtime.ProjectService.SaveCombine();
}
- public override DragOperation CanDragNode ()
+ [CommandUpdateHandler (ProjectCommands.IncludeInBuild)]
+ public void OnUpdateIncludeInBuild (CommandInfo info)
{
- return DragOperation.Copy | DragOperation.Move;
+ ProjectFile file = CurrentNode.DataItem as ProjectFile;
+ info.Checked = (file.BuildAction == BuildAction.Compile);
}
- public override bool CanDropNode (object dataObject, DragOperation operation)
+ [CommandHandler (ProjectCommands.IncludeInBuild)]
+ public void OnIncludeInBuild ()
{
- return dataObject is CombineEntry;
+ ProjectFile finfo = CurrentNode.DataItem as ProjectFile;
+ if (finfo.BuildAction == BuildAction.Compile) {
+ finfo.BuildAction = BuildAction.Nothing;
+ } else {
+ finfo.BuildAction = BuildAction.Compile;
+ }
+ Runtime.ProjectService.SaveCombine();
}
- public override void OnNodeDrop (object dataObject, DragOperation operation)
+ [CommandUpdateHandler (ProjectCommands.IncludeInDeploy)]
+ public void OnUpdateIncludeInDeploy (CommandInfo info)
{
+ Project project = (Project) CurrentNode.GetParentDataItem (typeof(Project), false);
+ ProjectFile finfo = CurrentNode.DataItem as ProjectFile;
+ info.Checked = !project.DeployInformation.IsFileExcluded (finfo.Name);
}
+
+ [CommandHandler (ProjectCommands.IncludeInDeploy)]
+ public void OnIncludeInDeploy ()
+ {
+ ProjectFile finfo = CurrentNode.DataItem as ProjectFile;
+ Project project = (Project) CurrentNode.GetParentDataItem (typeof(Project), false);
+
+ if (project.DeployInformation.IsFileExcluded (finfo.Name)) {
+ project.DeployInformation.RemoveExcludedFile (finfo.Name);
+ } else {
+ project.DeployInformation.AddExcludedFile (finfo.Name);
+ }
+ Runtime.ProjectService.SaveCombine();
+ }
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFolderNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFolderNodeBuilder.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectFolderNodeBuilder.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -32,6 +32,7 @@
using MonoDevelop.Internal.Project;
using MonoDevelop.Services;
+using MonoDevelop.Commands;
namespace MonoDevelop.Gui.Pads.ProjectPad
{
@@ -150,7 +151,8 @@
}
}
- public override void RemoveItem ()
+ [CommandHandler (EditCommands.Delete)]
+ public void RemoveItem ()
{
ProjectFolder folder = (ProjectFolder) CurrentNode.DataItem as ProjectFolder;
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectNodeBuilder.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectNodeBuilder.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -32,6 +32,7 @@
using MonoDevelop.Internal.Project;
using MonoDevelop.Services;
+using MonoDevelop.Commands;
namespace MonoDevelop.Gui.Pads.ProjectPad
{
@@ -254,8 +255,34 @@
{
}
- public override void RemoveItem ()
+ [CommandHandler (ProjectCommands.Options)]
+ public void OnProjectOptions ()
{
+ Project selectedProject = CurrentNode.DataItem as Project;
+ Runtime.ProjectService.ShowOptions (selectedProject);
+ }
+
+ [CommandHandler (ProjectCommands.Deploy)]
+ public void OnProjectDeploy ()
+ {
+ Project selectedProject = CurrentNode.DataItem as Project;
+ Runtime.ProjectService.Deploy (selectedProject);
+ }
+
+ [CommandHandler (ProjectCommands.SetAsStartupProject)]
+ public void SetAsStartupProject ()
+ {
+ Project project = CurrentNode.DataItem as Project;
+ Combine combine = CurrentNode.GetParentDataItem (typeof(Combine), false) as Combine;
+
+ combine.StartupEntry = project;
+ combine.SingleStartupProject = true;
+ Runtime.ProjectService.SaveCombine ();
+ }
+
+ [CommandHandler (EditCommands.Delete)]
+ public void RemoveItem ()
+ {
Combine cmb = CurrentNode.GetParentDataItem (typeof(Combine), false) as Combine;;
Project prj = CurrentNode.DataItem as Project;
@@ -266,6 +293,14 @@
}
}
+ [CommandHandler (ProjectCommands.AddReference)]
+ public void AddReferenceToProject ()
+ {
+ Project p = (Project) CurrentNode.DataItem;
+ if (Runtime.ProjectService.AddReferenceToProject (p))
+ Runtime.ProjectService.SaveCombine();
+ }
+
public override DragOperation CanDragNode ()
{
return DragOperation.Copy | DragOperation.Move;
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectReferenceFolderNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectReferenceFolderNodeBuilder.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectReferenceFolderNodeBuilder.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -31,6 +31,7 @@
using MonoDevelop.Internal.Project;
using MonoDevelop.Services;
+using MonoDevelop.Commands;
namespace MonoDevelop.Gui.Pads.ProjectPad
{
@@ -146,5 +147,15 @@
}
Runtime.ProjectService.SaveCombine();
}
+
+ [CommandHandler (ProjectCommands.AddReference)]
+ public void AddReferenceToProject ()
+ {
+ Project p = (Project) CurrentNode.GetParentDataItem (typeof(Project), false);
+ if (Runtime.ProjectService.AddReferenceToProject (p)) {
+ Runtime.ProjectService.SaveCombine();
+ CurrentNode.Expanded = true;
+ }
+ }
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectReferenceNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectReferenceNodeBuilder.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectReferenceNodeBuilder.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -32,6 +32,7 @@
using MonoDevelop.Internal.Project;
using MonoDevelop.Services;
+using MonoDevelop.Commands;
namespace MonoDevelop.Gui.Pads.ProjectPad
{
@@ -86,7 +87,8 @@
public class ProjectReferenceNodeCommandHandler: NodeCommandHandler
{
- public override void RemoveItem ()
+ [CommandHandler (EditCommands.Delete)]
+ public void RemoveItem ()
{
ProjectReference pref = (ProjectReference) CurrentNode.DataItem;
Project project = CurrentNode.GetParentDataItem (typeof(Project), false) as Project;
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectSolutionPad.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectSolutionPad.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ProjectSolutionPad.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -0,0 +1,60 @@
+//
+// ProjectSolutionPad.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Resources;
+
+using MonoDevelop.Internal.Project;
+using MonoDevelop.Services;
+using MonoDevelop.Core.Properties;
+
+namespace MonoDevelop.Gui.Pads.ProjectPad
+{
+ public class ProjectSolutionPad: SolutionPad
+ {
+ protected override void OnSelectionChanged (object sender, EventArgs args)
+ {
+ base.OnSelectionChanged (sender, args);
+ ITreeNavigator nav = GetSelectedNode ();
+ if (nav != null) {
+ Project p = (Project) nav.GetParentDataItem (typeof(Project), true);
+ Runtime.ProjectService.CurrentSelectedProject = p;
+ Combine c = (Combine) nav.GetParentDataItem (typeof(Combine), true);
+ Runtime.ProjectService.CurrentSelectedCombine = c;
+ }
+ }
+
+ protected override void OnCloseCombine (object sender, CombineEventArgs e)
+ {
+ base.OnCloseCombine (sender, e);
+ Runtime.ProjectService.CurrentSelectedProject = null;
+ Runtime.ProjectService.CurrentSelectedCombine = null;
+ }
+ }
+}
+
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ResourceFolderNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ResourceFolderNodeBuilder.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ResourceFolderNodeBuilder.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -32,6 +32,8 @@
using MonoDevelop.Internal.Project;
using MonoDevelop.Services;
+using MonoDevelop.Commands;
+using MonoDevelop.Gui.Widgets;
namespace MonoDevelop.Gui.Pads.ProjectPad
{
@@ -47,6 +49,10 @@
return "Resources";
}
+ public override Type CommandHandlerType {
+ get { return typeof(ResourceFolderNodeCommandHandler); }
+ }
+
public override string ContextMenuAddinPath {
get { return "/SharpDevelop/Views/ProjectBrowser/ContextMenu/ResourceFolderNode"; }
}
@@ -83,4 +89,54 @@
builder.AddChild (file);
}
}
+
+ public class ResourceFolderNodeCommandHandler: NodeCommandHandler
+ {
+ [CommandHandler (ProjectCommands.AddResource)]
+ public void AddResourceToProject ()
+ {
+ Project project = CurrentNode.GetParentDataItem (typeof(Project), true) as Project;
+ if (project == null) return;
+
+ string [] files;
+ do {
+ files = AskFiles (project);
+ if (files == null) return;
+ }
+ while (!CheckFiles (files));
+
+ CurrentNode.Expanded = true;
+
+ foreach (string fileName in files)
+ project.AddFile (fileName, BuildAction.EmbedAsResource);
+ Runtime.ProjectService.SaveCombine ();
+ }
+
+ string[] AskFiles (Project project)
+ {
+ using (FileSelector fs = new FileSelector (GettextCatalog.GetString ("File to Open"))) {
+ fs.SelectMultiple = true;
+ fs.SetFilename (project.BaseDirectory);
+ int response = fs.Run ();
+ string [] files = fs.Filenames;
+ fs.Hide ();
+
+ if (response != (int)Gtk.ResponseType.Ok)
+ return null;
+ else
+ return files;
+ }
+ }
+
+ bool CheckFiles (string[] files)
+ {
+ foreach (string file in files) {
+ if (!System.IO.File.Exists (file)) {
+ Runtime.MessageService.ShowError (String.Format (GettextCatalog.GetString ("Resource file '{0}' does not exist"), file));
+ return false;
+ }
+ }
+ return true;
+ }
+ }
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ShowAllFilesBuilderExtension.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ShowAllFilesBuilderExtension.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/ShowAllFilesBuilderExtension.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -205,20 +205,6 @@
}
}
- bool RemoveFile (string file, Project project)
- {
- ITreeBuilder tb = Context.GetTreeBuilder (new SystemFile (file, project));
- if (tb != null) {
- tb.Remove (true);
- while (tb.DataItem is ProjectFolder) {
- tb.Update ();
- tb.MoveToParent ();
- }
- return true;
- }
- return false;
- }
-
ITreeBuilder FindParentFolderNode (string path, Project project, out string lastChildPath)
{
lastChildPath = path;
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/SystemFileNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/SystemFileNodeBuilder.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ProjectPad/SystemFileNodeBuilder.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -32,6 +32,7 @@
using MonoDevelop.Internal.Project;
using MonoDevelop.Services;
+using MonoDevelop.Commands;
namespace MonoDevelop.Gui.Pads.ProjectPad
{
@@ -108,7 +109,8 @@
Runtime.FileService.OpenFile (file.Path);
}
- public override void RemoveItem ()
+ [CommandHandler (EditCommands.Delete)]
+ public void RemoveItem ()
{
SystemFile file = CurrentNode.DataItem as SystemFile;
@@ -126,5 +128,17 @@
{
return DragOperation.Copy | DragOperation.Move;
}
+
+ [CommandHandler (ProjectCommands.IncludeToProject)]
+ public void IncludeFileToProject ()
+ {
+ Project project = CurrentNode.GetParentDataItem (typeof(Project), true) as Project;
+ SystemFile file = (SystemFile) CurrentNode.DataItem;
+
+ if (project.IsCompileable (file.Path))
+ project.AddFile (file.Path, BuildAction.Compile);
+ else
+ project.AddFile (file.Path, BuildAction.Nothing);
+ }
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/NodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/NodeBuilder.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/NodeBuilder.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -47,8 +47,10 @@
internal NodeCommandHandler CommandHandler {
get {
- if (commandHandler == null)
+// if (commandHandler == null) {
commandHandler = (NodeCommandHandler) Activator.CreateInstance (CommandHandlerType);
+ commandHandler.Initialize (context.Tree);
+// }
return commandHandler;
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/NodeCommandHandler.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/NodeCommandHandler.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/NodeCommandHandler.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -27,22 +27,44 @@
//
using System;
+using MonoDevelop.Commands;
namespace MonoDevelop.Gui.Pads
{
- public class NodeCommandHandler
+ public class NodeCommandHandler: ICommandRouter
{
ITreeNavigator currentNode;
+ TreeViewPad tree;
+ object nextTarget;
+ internal void Initialize (TreeViewPad tree)
+ {
+ this.tree = tree;
+ }
+
internal void SetCurrentNode (ITreeNavigator currentNode)
{
this.currentNode = currentNode;
}
+ internal void SetNextTarget (object nextTarget)
+ {
+ this.nextTarget = nextTarget;
+ }
+
+ object ICommandRouter.GetNextCommandTarget ()
+ {
+ return nextTarget;
+ }
+
protected ITreeNavigator CurrentNode {
get { return currentNode; }
}
+ protected TreeViewPad Tree {
+ get { return tree; }
+ }
+
public virtual void RenameItem (string newName)
{
}
@@ -51,10 +73,6 @@
{
}
- public virtual void RemoveItem ()
- {
- }
-
public virtual DragOperation CanDragNode ()
{
return DragOperation.None;
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/SolutionPad.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/SolutionPad.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/SolutionPad.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -37,10 +37,10 @@
{
public class SolutionPad : TreeViewPad
{
- public SolutionPad (string label, string icon, NodeBuilder[] builders, TreePadOption[] options): base (label, icon, builders, options)
+ public SolutionPad ()
{
- Runtime.ProjectService.CombineOpened += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OpenCombine));
- Runtime.ProjectService.CombineClosed += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (CloseCombine));
+ Runtime.ProjectService.CombineOpened += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnOpenCombine));
+ Runtime.ProjectService.CombineClosed += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnCloseCombine));
WorkbenchSingleton.Workbench.ActiveWorkbenchWindowChanged += new EventHandler(ActiveWindowChanged);
Runtime.Properties.PropertyChanged += (PropertyEventHandler) Runtime.DispatchService.GuiDispatch (new PropertyEventHandler (TrackPropertyChange));
}
@@ -60,12 +60,12 @@
}
}
- void OpenCombine(object sender, CombineEventArgs e)
+ protected virtual void OnOpenCombine (object sender, CombineEventArgs e)
{
LoadTree (e.Combine);
}
- void CloseCombine(object sender, CombineEventArgs e)
+ protected virtual void OnCloseCombine (object sender, CombineEventArgs e)
{
Clear ();
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TreeViewPad.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TreeViewPad.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TreeViewPad.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -46,13 +46,14 @@
using MonoDevelop.Gui.Dialogs;
using MonoDevelop.Services;
using MonoDevelop.Gui.Widgets;
+using MonoDevelop.Commands;
namespace MonoDevelop.Gui.Pads
{
/// <summary>
/// This class implements a project browser.
/// </summary>
- public class TreeViewPad : IPadContent, IMementoCapable
+ public class TreeViewPad : IPadContent, IMementoCapable, ICommandRouter
{
string title;
string icon;
@@ -89,7 +90,7 @@
object copyObject;
DragOperation currentTransferOperation;
- Gtk.Frame contentPanel = new Gtk.Frame();
+ Gtk.Frame contentPanel;
private static Gtk.TargetEntry [] target_table = new Gtk.TargetEntry [] {
new Gtk.TargetEntry ("text/uri-list", 0, 11 ),
@@ -131,8 +132,17 @@
{
}
+ public TreeViewPad ()
+ {
+ }
+
public TreeViewPad (string label, string icon, NodeBuilder[] builders, TreePadOption[] options)
{
+ Initialize (label, icon, builders, options);
+ }
+
+ public virtual void Initialize (string label, string icon, NodeBuilder[] builders, TreePadOption[] options)
+ {
// Create default options
this.options = options;
@@ -206,7 +216,7 @@
Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow ();
sw.Add(tree);
- contentPanel = new Gtk.Frame();
+ contentPanel = new TreeFrame (this);
contentPanel.Add(sw);
tree.TestExpandRow += new Gtk.TestExpandRowHandler (OnTestExpandRow);
@@ -227,9 +237,10 @@
tree.DragDrop += new Gtk.DragDropHandler (OnDragDrop);
tree.DragEnd += new Gtk.DragEndHandler (OnDragEnd);
tree.DragMotion += new Gtk.DragMotionHandler (OnDragMotion);
+
+ tree.CursorChanged += new EventHandler (OnSelectionChanged);
}
-
void OnDragBegin (object o, Gtk.DragBeginArgs arg)
{
ITreeNavigator nav = GetSelectedNode ();
@@ -291,11 +302,12 @@
DragOperation oper = ctx.Action == Gdk.DragAction.Copy ? DragOperation.Copy : DragOperation.Move;
foreach (NodeBuilder nb in chain) {
- nb.CommandHandler.SetCurrentNode (nav);
- if (nb.CommandHandler.CanDropNode (obj, oper)) {
+ NodeCommandHandler handler = nb.CommandHandler;
+ handler.SetCurrentNode (nav);
+ if (handler.CanDropNode (obj, oper)) {
foundHandler = true;
if (drop)
- nb.CommandHandler.OnNodeDrop (obj, oper);
+ handler.OnNodeDrop (obj, oper);
}
}
return foundHandler;
@@ -389,40 +401,53 @@
}
}
- public void ActivateCurrentItem ()
+ object ICommandRouter.GetNextCommandTarget ()
{
TreeNodeNavigator node = (TreeNodeNavigator) GetSelectedNode ();
if (node != null) {
NodeBuilder[] chain = node.NodeBuilderChain;
- NodePosition pos = node.CurrentPosition;
- foreach (NodeBuilder b in chain) {
- b.CommandHandler.SetCurrentNode (node);
- b.CommandHandler.ActivateItem ();
- node.MoveToPosition (pos);
+ if (chain.Length > 0) {
+ NodeCommandHandler[] handlers = new NodeCommandHandler [chain.Length];
+ for (int n=0; n<chain.Length; n++)
+ handlers [n] = chain [n].CommandHandler;
+
+ for (int n=0; n<handlers.Length; n++) {
+ handlers [n].SetCurrentNode (node);
+ if (n < chain.Length - 1)
+ handlers [n].SetNextTarget (handlers [n+1]);
+ else
+ handlers [n].SetNextTarget (contentPanel.Parent);
+ }
+ return handlers [0];
}
}
+ return contentPanel.Parent;
}
- public void RemoveCurrentItem ()
+ [CommandHandler (ViewCommands.Open)]
+ public void ActivateCurrentItem ()
{
TreeNodeNavigator node = (TreeNodeNavigator) GetSelectedNode ();
if (node != null) {
NodeBuilder[] chain = node.NodeBuilderChain;
NodePosition pos = node.CurrentPosition;
foreach (NodeBuilder b in chain) {
- b.CommandHandler.SetCurrentNode (node);
- b.CommandHandler.RemoveItem ();
+ NodeCommandHandler handler = b.CommandHandler;
+ handler.SetCurrentNode (node);
+ handler.ActivateItem ();
node.MoveToPosition (pos);
}
}
}
+ [CommandHandler (EditCommands.Copy)]
public void CopyCurrentItem ()
{
CancelTransfer ();
TransferCurrentItem (DragOperation.Copy);
}
+ [CommandHandler (EditCommands.Cut)]
public void CutCurrentItem ()
{
CancelTransfer ();
@@ -435,14 +460,16 @@
}
}
- public bool CanCopyCurrentItem ()
+ [CommandUpdateHandler (EditCommands.Copy)]
+ protected void UpdateCopyCurrentItem (CommandInfo info)
{
- return CanTransferCurrentItem (DragOperation.Copy);
+ info.Enabled = CanTransferCurrentItem (DragOperation.Copy);
}
- public bool CanCutCurrentItem ()
+ [CommandUpdateHandler (EditCommands.Cut)]
+ protected void UpdateCutCurrentItem (CommandInfo info)
{
- return CanTransferCurrentItem (DragOperation.Move);
+ info.Enabled = CanTransferCurrentItem (DragOperation.Move);
}
void TransferCurrentItem (DragOperation oper)
@@ -452,8 +479,9 @@
NodeBuilder[] chain = node.NodeBuilderChain;
NodePosition pos = node.CurrentPosition;
foreach (NodeBuilder b in chain) {
- b.CommandHandler.SetCurrentNode (node);
- if ((b.CommandHandler.CanDragNode () & oper) != 0) {
+ NodeCommandHandler handler = b.CommandHandler;
+ handler.SetCurrentNode (node);
+ if ((handler.CanDragNode () & oper) != 0) {
node.MoveToPosition (pos);
copyObject = node.DataItem;
currentTransferOperation = oper;
@@ -471,8 +499,9 @@
NodeBuilder[] chain = node.NodeBuilderChain;
NodePosition pos = node.CurrentPosition;
foreach (NodeBuilder b in chain) {
- b.CommandHandler.SetCurrentNode (node);
- if ((b.CommandHandler.CanDragNode () & oper) != 0)
+ NodeCommandHandler handler = b.CommandHandler;
+ handler.SetCurrentNode (node);
+ if ((handler.CanDragNode () & oper) != 0)
return true;
node.MoveToPosition (pos);
}
@@ -480,6 +509,7 @@
return false;
}
+ [CommandHandler (EditCommands.Paste)]
public void PasteToCurrentItem ()
{
if (copyObject == null) return;
@@ -489,10 +519,11 @@
NodeBuilder[] chain = node.NodeBuilderChain;
NodePosition pos = node.CurrentPosition;
foreach (NodeBuilder b in chain) {
- b.CommandHandler.SetCurrentNode (node);
- if (b.CommandHandler.CanDropNode (copyObject, currentTransferOperation)) {
+ NodeCommandHandler handler = b.CommandHandler;
+ handler.SetCurrentNode (node);
+ if (handler.CanDropNode (copyObject, currentTransferOperation)) {
node.MoveToPosition (pos);
- b.CommandHandler.OnNodeDrop (copyObject, currentTransferOperation);
+ handler.OnNodeDrop (copyObject, currentTransferOperation);
}
node.MoveToPosition (pos);
}
@@ -500,22 +531,26 @@
CancelTransfer ();
}
- public bool CanPasteToCurrentItem ()
+ [CommandUpdateHandler (EditCommands.Paste)]
+ protected void UpdatePasteToCurrentItem (CommandInfo info)
{
- if (copyObject == null) return false;
-
- TreeNodeNavigator node = (TreeNodeNavigator) GetSelectedNode ();
- if (node != null) {
- NodeBuilder[] chain = node.NodeBuilderChain;
- NodePosition pos = node.CurrentPosition;
- foreach (NodeBuilder b in chain) {
- b.CommandHandler.SetCurrentNode (node);
- if (b.CommandHandler.CanDropNode (copyObject, currentTransferOperation))
- return true;
- node.MoveToPosition (pos);
+ if (copyObject != null) {
+ TreeNodeNavigator node = (TreeNodeNavigator) GetSelectedNode ();
+ if (node != null) {
+ NodeBuilder[] chain = node.NodeBuilderChain;
+ NodePosition pos = node.CurrentPosition;
+ foreach (NodeBuilder b in chain) {
+ NodeCommandHandler handler = b.CommandHandler;
+ handler.SetCurrentNode (node);
+ if (handler.CanDropNode (copyObject, currentTransferOperation)) {
+ info.Enabled = true;
+ return;
+ }
+ node.MoveToPosition (pos);
+ }
}
}
- return false;
+ info.Enabled = false;
}
void CancelTransfer ()
@@ -536,6 +571,7 @@
/// call this method, instead of using the LabelEdit Property and the BeginEdit
/// Method directly.
/// </summary>
+ [CommandHandler (EditCommands.Rename)]
public void StartLabelEdit()
{
Gtk.TreeModel foo;
@@ -566,8 +602,9 @@
NodeBuilder[] chain = (NodeBuilder[]) store.GetValue (iter, BuilderChainColumn);
foreach (NodeBuilder b in chain) {
- b.CommandHandler.SetCurrentNode (nav);
- b.CommandHandler.RenameItem (e.NewText);
+ NodeCommandHandler handler = b.CommandHandler;
+ handler.SetCurrentNode (nav);
+ handler.RenameItem (e.NewText);
nav.MoveToPosition (pos);
}
}
@@ -869,63 +906,54 @@
void ShowPopup ()
{
ITreeNavigator tnav = GetSelectedNode ();
- Runtime.ProjectService.CurrentSelectedProject = tnav.GetParentDataItem (typeof(Project), true) as Project;
- Runtime.ProjectService.CurrentSelectedCombine = tnav.GetParentDataItem (typeof(Combine), true) as Combine;
-
TypeNodeBuilder nb = GetTypeNodeBuilder (tnav.CurrentPosition._iter);
if (nb == null || nb.ContextMenuAddinPath == null) {
- if (options.Length > 0)
- Runtime.Gui.Menus.ShowContextMenu (BuildTreeOptionsMenu (tnav));
- } else {
- Gtk.Menu menu = Runtime.Gui.Menus.CreateContextMenu (this, nb.ContextMenuAddinPath);
if (options.Length > 0) {
- Gtk.MenuItem mi = new Gtk.SeparatorMenuItem ();
- mi.Show ();
- menu.Append (mi);
-
- mi = new Gtk.MenuItem (GettextCatalog.GetString ("Display Options"));
- menu.Append (mi);
- mi.Submenu = BuildTreeOptionsMenu (tnav);
- mi.Show ();
+ CommandEntrySet opset = new CommandEntrySet ();
+ opset.AddItem (ViewCommands.TreeDisplayOptionList);
+ opset.AddItem (Command.Separator);
+ opset.AddItem (ViewCommands.ResetTreeDisplayOptions);
+ Gtk.Menu menu = Runtime.Gui.CommandService.CreateMenu (opset);
+ Runtime.Gui.Menus.ShowContextMenu (menu);
}
+ } else {
+ CommandEntrySet eset = Runtime.Gui.CommandService.CreateCommandEntrySet (nb.ContextMenuAddinPath);
+ eset.AddItem (Command.Separator);
+ CommandEntrySet opset = eset.AddItemSet (GettextCatalog.GetString ("Display Options"));
+ opset.AddItem (ViewCommands.TreeDisplayOptionList);
+ opset.AddItem (Command.Separator);
+ opset.AddItem (ViewCommands.ResetTreeDisplayOptions);
+ Gtk.Menu menu = Runtime.Gui.CommandService.CreateMenu (eset);
Runtime.Gui.Menus.ShowContextMenu (menu);
}
}
- Gtk.Menu BuildTreeOptionsMenu (ITreeNavigator tnav)
+ [CommandUpdateHandler (ViewCommands.TreeDisplayOptionList)]
+ void BuildTreeOptionsMenu (CommandArrayInfo info)
{
+ ITreeNavigator tnav = GetSelectedNode ();
ITreeOptions currentOptions = tnav.Options;
- Gtk.Menu omenu = new Gtk.Menu ();
-
foreach (TreePadOption op in options) {
- PadCheckMenuItem cmi = new PadCheckMenuItem (op.Label, op.Id);
- cmi.Active = currentOptions [op.Id];
- omenu.Append (cmi);
- cmi.Toggled += new EventHandler (OptionToggled);
+ CommandInfo ci = new CommandInfo (op.Label);
+ ci.Checked = currentOptions [op.Id];
+ info.Add (ci, op.Id);
}
-
- omenu.Append (new Gtk.SeparatorMenuItem ());
-
- Gtk.MenuItem mi = new Gtk.MenuItem (GettextCatalog.GetString ("Reset Options"));
- mi.Activated += new EventHandler (ResetOptions);
- omenu.Append (mi);
- omenu.ShowAll ();
-
- return omenu;
}
- void OptionToggled (object sender, EventArgs args)
+ [CommandHandler (ViewCommands.TreeDisplayOptionList)]
+ void OptionToggled (string optionId)
{
Gtk.TreeModel foo;
Gtk.TreeIter iter;
if (!tree.Selection.GetSelected (out foo, out iter))
return;
- PadCheckMenuItem mi = (PadCheckMenuItem) sender;
- GetOptions (iter, true) [mi.Id] = mi.Active;
+ TreeOptions ops = GetOptions (iter, true);
+ ops [optionId] = !ops [optionId];
}
- void ResetOptions (object sender, EventArgs args)
+ [CommandHandler (ViewCommands.ResetTreeDisplayOptions)]
+ void ResetOptions ()
{
Gtk.TreeModel foo;
Gtk.TreeIter iter;
@@ -950,11 +978,15 @@
}
}
- private void OnNodeActivated (object sender, Gtk.RowActivatedArgs args)
+ protected virtual void OnNodeActivated (object sender, Gtk.RowActivatedArgs args)
{
ActivateCurrentItem ();
}
+ protected virtual void OnSelectionChanged (object sender, EventArgs args)
+ {
+ }
+
public IXmlConvertable CreateMemento ()
{
return new TreeViewPadMemento (this);
@@ -1650,5 +1682,20 @@
}
}
+ class TreeFrame: Gtk.Frame, ICommandRouter
+ {
+ object nextTarget;
+
+ public TreeFrame (object nextTarget)
+ {
+ this.nextTarget = nextTarget;
+ }
+
+ object ICommandRouter.GetNextCommandTarget ()
+ {
+ return nextTarget;
+ }
+ }
+
public delegate void TreeNodeCallback (ITreeNavigator nav);
}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/ViewCommandHandlers.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/ViewCommandHandlers.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/ViewCommandHandlers.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -0,0 +1,266 @@
+
+using System;
+using System.Collections;
+using System.IO;
+using Gtk;
+
+using Gdl;
+
+using MonoDevelop.Core.Services;
+using MonoDevelop.Services;
+
+using MonoDevelop.Gui.Utils;
+using MonoDevelop.Gui.Widgets;
+using MonoDevelop.Gui.Dialogs;
+using MonoDevelop.Core.Properties;
+using MonoDevelop.Core.AddIns;
+using MonoDevelop.Commands;
+
+namespace MonoDevelop.Gui
+{
+ public class ViewCommandHandlers: ICommandRouter
+ {
+ IWorkbenchWindow window;
+ object nextTarget;
+
+ public ViewCommandHandlers (IWorkbenchWindow window)
+ {
+ this.window = window;
+ }
+
+ object ICommandRouter.GetNextCommandTarget ()
+ {
+ return nextTarget;
+ }
+
+ public void SetNextCommandTarget (object nextTarget)
+ {
+ this.nextTarget = nextTarget;
+ }
+
+ [CommandHandler (FileCommands.CloseFile)]
+ protected void OnCloseFile ()
+ {
+ window.CloseWindow (false, true, 0);
+ }
+
+ [CommandHandler (FileCommands.Save)]
+ protected void OnSaveFile ()
+ {
+ Runtime.FileService.SaveFile (window);
+ }
+
+ [CommandUpdateHandler (FileCommands.Save)]
+ protected void OnUpdateSaveFile (CommandInfo info)
+ {
+ if (window.ViewContent.IsViewOnly) {
+ info.Enabled = false;
+ return;
+ }
+
+ IViewContent content = window.ActiveViewContent as IViewContent;
+ if (content != null)
+ info.Enabled = content.IsDirty;
+ else
+ info.Enabled = false;
+ }
+
+ [CommandHandler (FileCommands.SaveAs)]
+ protected void OnSaveFileAs ()
+ {
+ Runtime.FileService.SaveFileAs (window);
+ }
+
+ [CommandHandler (FileCommands.ReloadFile)]
+ protected void OnReloadFile ()
+ {
+ if (Runtime.MessageService.AskQuestion(GettextCatalog.GetString ("Are you sure that you want to reload the file?"))) {
+ IXmlConvertable memento = null;
+ if (window.ViewContent is IMementoCapable) {
+ memento = ((IMementoCapable)window.ViewContent).CreateMemento();
+ }
+ window.ViewContent.Load(window.ViewContent.ContentName);
+ if (memento != null) {
+ ((IMementoCapable)window.ViewContent).SetMemento(memento);
+ }
+ }
+ }
+
+ [CommandUpdateHandler (FileCommands.ReloadFile)]
+ protected void OnUpdateReloadFile (CommandInfo info)
+ {
+ info.Enabled = window.ViewContent.ContentName != null && !window.ViewContent.IsViewOnly;
+ }
+
+
+ /*** Edit commands ***/
+
+ [CommandHandler (EditCommands.Undo)]
+ protected void OnUndo ()
+ {
+ IEditable editable = window.ActiveViewContent as IEditable;
+ if (editable != null)
+ editable.Undo();
+ }
+
+ [CommandUpdateHandler (EditCommands.Undo)]
+ protected void OnUpdateUndo (CommandInfo info)
+ {
+ info.Enabled = window.ActiveViewContent is IEditable;
+ }
+
+ [CommandHandler (EditCommands.Redo)]
+ protected void OnRedo ()
+ {
+ IEditable editable = window.ActiveViewContent as IEditable;
+ if (editable != null) {
+ editable.Redo();
+ }
+ }
+
+ [CommandUpdateHandler (EditCommands.Redo)]
+ protected void OnUpdateRedo (CommandInfo info)
+ {
+ info.Enabled = window.ActiveViewContent is IEditable;
+ }
+
+ [CommandHandler (EditCommands.Cut)]
+ protected void OnCut ()
+ {
+ IEditable editable = window.ActiveViewContent as IEditable;
+ if (editable != null)
+ editable.ClipboardHandler.Cut(null, null);
+ }
+
+ [CommandUpdateHandler (EditCommands.Cut)]
+ protected void OnUpdateCut (CommandInfo info)
+ {
+ IEditable editable = window.ActiveViewContent as IEditable;
+ info.Enabled = editable != null && editable.ClipboardHandler.EnableCut;
+ }
+
+ [CommandHandler (EditCommands.Copy)]
+ protected void OnCopy ()
+ {
+ IEditable editable = window.ActiveViewContent as IEditable;
+ if (editable != null)
+ editable.ClipboardHandler.Copy(null, null);
+ }
+
+ [CommandUpdateHandler (EditCommands.Copy)]
+ protected void OnUpdateCopy (CommandInfo info)
+ {
+ IEditable editable = window.ActiveViewContent as IEditable;
+ info.Enabled = editable != null && editable.ClipboardHandler.EnableCopy;
+ }
+
+ [CommandHandler (EditCommands.Paste)]
+ protected void OnPaste ()
+ {
+ IEditable editable = window.ActiveViewContent as IEditable;
+ if (editable != null)
+ editable.ClipboardHandler.Paste(null, null);
+ }
+
+ [CommandUpdateHandler (EditCommands.Paste)]
+ protected void OnUpdatePaste (CommandInfo info)
+ {
+ IEditable editable = window.ActiveViewContent as IEditable;
+ info.Enabled = editable != null && editable.ClipboardHandler.EnablePaste;
+ }
+
+ [CommandHandler (EditCommands.Delete)]
+ protected void OnDelete ()
+ {
+ IEditable editable = window.ActiveViewContent as IEditable;
+ if (editable != null)
+ editable.ClipboardHandler.Delete(null, null);
+ }
+
+ [CommandUpdateHandler (EditCommands.Delete)]
+ protected void OnUpdateDelete (CommandInfo info)
+ {
+ IEditable editable = window.ActiveViewContent as IEditable;
+ info.Enabled = editable != null && editable.ClipboardHandler.EnableDelete;
+ }
+
+ [CommandHandler (EditCommands.SelectAll)]
+ protected void OnSelectAll ()
+ {
+ IEditable editable = window.ActiveViewContent as IEditable;
+ if (editable != null)
+ editable.ClipboardHandler.SelectAll(null, null);
+ }
+
+ [CommandUpdateHandler (EditCommands.SelectAll)]
+ protected void OnUpdateSelectAll (CommandInfo info)
+ {
+ IEditable editable = window.ActiveViewContent as IEditable;
+ info.Enabled = editable != null && editable.ClipboardHandler.EnableSelectAll;
+ }
+
+ [CommandHandler (EditCommands.WordCount)]
+ protected void OnWordCount()
+ {
+ WordCountDialog wcd = new WordCountDialog ();
+ wcd.Run ();
+ wcd.Hide ();
+ }
+
+ [CommandHandler (EditCommands.CommentCode)]
+ public void OnCommentCode()
+ {
+ ICodeStyleOperations styling = window.ActiveViewContent as ICodeStyleOperations;
+ if (styling != null)
+ styling.CommentCode ();
+ }
+
+ [CommandUpdateHandler (EditCommands.CommentCode)]
+ protected void OnUpdateCommentCode (CommandInfo info)
+ {
+ info.Enabled = window.ActiveViewContent is ICodeStyleOperations;
+ }
+
+ [CommandHandler (EditCommands.UncommentCode)]
+ public void OnUncommentCode()
+ {
+ ICodeStyleOperations styling = window.ActiveViewContent as ICodeStyleOperations;
+ if (styling != null)
+ styling.UncommentCode ();
+ }
+
+ [CommandUpdateHandler (EditCommands.UncommentCode)]
+ protected void OnUpdateUncommentCode (CommandInfo info)
+ {
+ info.Enabled = window.ActiveViewContent is ICodeStyleOperations;
+ }
+
+ [CommandHandler (EditCommands.IndentSelection)]
+ public void OnIndentSelection()
+ {
+ ICodeStyleOperations styling = window.ActiveViewContent as ICodeStyleOperations;
+ if (styling != null)
+ styling.IndentSelection ();
+ }
+
+ [CommandUpdateHandler (EditCommands.IndentSelection)]
+ protected void OnUpdateIndentSelection (CommandInfo info)
+ {
+ info.Enabled = window.ActiveViewContent is ICodeStyleOperations;
+ }
+
+ [CommandHandler (EditCommands.UnIndentSelection)]
+ public void OnUnIndentSelection()
+ {
+ ICodeStyleOperations styling = window.ActiveViewContent as ICodeStyleOperations;
+ if (styling != null)
+ styling.UnIndentSelection ();
+ }
+
+ [CommandUpdateHandler (EditCommands.UnIndentSelection)]
+ protected void OnUpdateUnIndentSelection (CommandInfo info)
+ {
+ info.Enabled = window.ActiveViewContent is ICodeStyleOperations;
+ }
+ }
+}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/DefaultWorkbench.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/DefaultWorkbench.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/DefaultWorkbench.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -36,6 +36,7 @@
{
readonly static string mainMenuPath = "/SharpDevelop/Workbench/MainMenu";
readonly static string viewContentPath = "/SharpDevelop/Workbench/Pads";
+ readonly static string toolbarsPath = "/SharpDevelop/Workbench/ToolBar";
PadContentCollection viewContentCollection = new PadContentCollection();
ViewContentCollection workbenchContentCollection = new ViewContentCollection();
@@ -53,6 +54,7 @@
static GType gtype;
public Gtk.MenuBar TopMenu = null;
+ private Gtk.Toolbar[] toolbars = null;
enum TargetList {
UriList = 100
@@ -147,7 +149,6 @@
IDebuggingService dbgr = Runtime.DebuggingService;
if (dbgr != null) {
- dbgr.StartedEvent += new EventHandler (onDebuggerStarted);
dbgr.PausedEvent += new EventHandler (onDebuggerPaused);
dbgr.ResumedEvent += new EventHandler (onDebuggerResumed);
dbgr.StoppedEvent += new EventHandler (onDebuggerStopped);
@@ -155,12 +156,13 @@
Gtk.Drag.DestSet (this, Gtk.DestDefaults.Motion | Gtk.DestDefaults.Highlight | Gtk.DestDefaults.Drop, targetEntryTypes, Gdk.DragAction.Copy);
DragDataReceived += new Gtk.DragDataReceivedHandler (onDragDataRec);
+
+ Runtime.Gui.CommandService.SetRootWindow (this);
}
void onDebuggerStarted (object o, EventArgs e)
{
- context = WorkbenchContext.Debug;
- ContextChanged (this, new EventArgs());
+ Context = WorkbenchContext.Debug;
}
void onDragDataRec (object o, Gtk.DragDataReceivedArgs args)
@@ -218,17 +220,12 @@
break;
}
}
- context = WorkbenchContext.Edit;
- ContextChanged (this, new EventArgs());
}
public void InitializeWorkspace()
{
// FIXME: GTKize
- ActiveWorkbenchWindowChanged += new EventHandler(UpdateMenu);
-
Runtime.ProjectService.CurrentProjectChanged += (ProjectEventHandler) Runtime.DispatchService.GuiDispatch (new ProjectEventHandler(SetProjectTitle));
- Runtime.ProjectService.CombineOpened += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler(CombineOpened));
Runtime.FileService.FileRemoved += new FileEventHandler(CheckRemovedFile);
Runtime.FileService.FileRenamed += new FileEventHandler(CheckRenamedFile);
@@ -239,8 +236,8 @@
// TopMenu.Selected += new CommandHandler(OnTopMenuSelected);
// TopMenu.Deselected += new CommandHandler(OnTopMenuDeselected);
- CreateToolBars();
- CreateMainMenu();
+ TopMenu = Runtime.Gui.CommandService.CreateMenuBar (mainMenuPath);
+ toolbars = Runtime.Gui.CommandService.CreateToolbarSet (toolbarsPath);
}
public void CloseContent(IViewContent content)
@@ -302,8 +299,6 @@
public void RedrawAllComponents()
{
- UpdateMenu(null, null);
-
foreach (IViewContent content in workbenchContentCollection) {
content.RedrawContent();
}
@@ -494,14 +489,8 @@
return true;
}
- void CombineOpened(object sender, CombineEventArgs e)
- {
- UpdateMenu(null, null);
- }
-
void SetProjectTitle(object sender, ProjectEventArgs e)
{
- UpdateMenu(null, null);
if (e.Project != null) {
Title = String.Concat(e.Project.Name, " - ", "MonoDevelop");
} else {
@@ -521,14 +510,8 @@
}
}
- private Gtk.Toolbar[] toolbars = null;
public Gtk.Toolbar[] ToolBars {
- get {
- return toolbars;
- }
- set {
- toolbars = value;
- }
+ get { return toolbars; }
}
public IPadContent GetPad(Type type)
@@ -540,47 +523,7 @@
}
return null;
}
- void CreateMainMenu()
- {
- TopMenu = new Gtk.MenuBar ();
- object[] items = (object[])(AddInTreeSingleton.AddInTree.GetTreeNode(mainMenuPath).BuildChildItems(this)).ToArray(typeof(object));
- foreach (object item in items) {
- TopMenu.Append ((Gtk.Widget)item);
- }
- UpdateMenu (null, null);
- }
- public void UpdateMenu(object sender, EventArgs e)
- {
- // update menu
- foreach (object o in TopMenu.Children) {
- if (o is SdMenu) {
- ((SdMenu)o).OnDropDown(null, null);
- }
- }
-
- UpdateToolbars();
- }
-
- public void UpdateToolbars()
- {
- foreach (Gtk.Toolbar toolbar in ToolBars) {
- foreach (object item in toolbar.Children) {
- if (item is IStatusUpdate) {
- ((IStatusUpdate)item).UpdateStatus();
- }
- }
- }
- }
-
- void CreateToolBars()
- {
- if (ToolBars == null) {
- Gtk.Toolbar[] toolBars = Runtime.Gui.Toolbars.CreateToolbars();
- ToolBars = toolBars;
- }
- }
-
public void UpdateViews(object sender, EventArgs e)
{
PadCodon[] padCodons = (PadCodon[])(AddInTreeSingleton.AddInTree.GetTreeNode(viewContentPath).BuildChildItems(this)).ToArray(typeof(PadCodon));
@@ -597,8 +540,11 @@
WorkbenchContext context = WorkbenchContext.Edit;
public WorkbenchContext Context {
- get {
- return context;
+ get { return context; }
+ set {
+ context = value;
+ if (ContextChanged != null)
+ ContextChanged (this, new EventArgs());
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -144,7 +144,6 @@
void OnContextChanged (object o, EventArgs e)
{
SwitchContext (workbench.Context);
- workbench.UpdateMenu (null, null);
}
void SwitchContext (WorkbenchContext ctxt)
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -17,10 +17,11 @@
using MonoDevelop.Gui.Utils;
using MonoDevelop.Gui.Widgets;
+using MonoDevelop.Commands;
namespace MonoDevelop.Gui
{
- public class SdiWorkspaceWindow : Frame, IWorkbenchWindow
+ public class SdiWorkspaceWindow : Frame, IWorkbenchWindow, ICommandRouter
{
Notebook viewTabControl = null;
IViewContent content;
@@ -37,6 +38,8 @@
bool show_notification = false;
+ ViewCommandHandlers commandHandler;
+
public Widget TabPage {
get {
return tabPage;
@@ -90,16 +93,6 @@
}
}
- void ThreadSafeSelectWindow()
- {
- foreach (IViewContent viewContent in WorkbenchSingleton.Workbench.ViewContentCollection) {
- if (viewContent != this.content) {
- viewContent.WorkbenchWindow.OnWindowDeselected(EventArgs.Empty);
- }
- }
- OnWindowSelected(EventArgs.Empty);
- }
-
public void SwitchView(int viewNumber)
{
if (viewTabControl != null) {
@@ -131,6 +124,8 @@
content.Control.ShowAll ();
ShowAll ();
SetTitleEvent(null, null);
+
+ commandHandler = new ViewCommandHandlers (this);
}
void BeforeSave(object sender, EventArgs e)
@@ -141,11 +136,6 @@
}
}
- void LeaveTabPage(object sender, EventArgs e)
- {
- OnWindowDeselected(EventArgs.Empty);
- }
-
public IViewContent ViewContent {
get {
return content;
@@ -220,7 +210,7 @@
if (save) {
if (content.ContentName == null) {
while (true) {
- new MonoDevelop.Commands.SaveFileAs().Run();
+ Runtime.FileService.SaveFileAs (this);
if (ViewContent.IsDirty) {
if (Runtime.MessageService.AskQuestion(GettextCatalog.GetString ("Do you really want to discard your changes ?"))) {
break;
@@ -277,6 +267,7 @@
OnContentChanged (null, null);*/
}
+
int oldIndex = -1;
void viewTabControlIndexChanged(object sender, EventArgs e)
{
@@ -296,6 +287,12 @@
oldIndex = viewTabControl.CurrentPage;
}
+ object ICommandRouter.GetNextCommandTarget ()
+ {
+ commandHandler.SetNextCommandTarget (Parent);
+ return commandHandler;
+ }
+
protected virtual void OnTitleChanged(EventArgs e)
{
if (show_notification) {
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/CommandCodon.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/CommandCodon.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/CommandCodon.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -0,0 +1,176 @@
+//
+// CommandCodon.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+
+using System;
+using System.Collections;
+using MonoDevelop.Core.AddIns.Conditions;
+using MonoDevelop.Commands;
+using MonoDevelop.Core.Services;
+using MonoDevelop.Services;
+
+namespace MonoDevelop.Core.AddIns.Codons
+{
+ [CodonNameAttribute ("Command")]
+ public class CommandCodon : AbstractCodon
+ {
+ [XmlMemberAttribute ("_label", IsRequired=true)]
+ string label;
+
+ [XmlMemberAttribute ("description")]
+ string description;
+
+ [XmlMemberAttribute ("shortcut")]
+ string shortcut;
+
+ [XmlMemberAttribute("icon")]
+ string icon;
+
+ [XmlMemberAttribute("disabledVisible")]
+ bool disabledVisible = true;
+
+ [XmlMemberAttribute("type")]
+ string type = "normal";
+
+ [XmlMemberAttribute("widget")]
+ string widget = null;
+
+ [XmlMemberAttribute("defaultHandler")]
+ string defaultHandler;
+
+ public override object BuildItem (object owner, ArrayList subItems, ConditionCollection conditions)
+ {
+ ActionType ct = ActionType.Normal;
+ bool isArray = false;
+ bool custom = false;
+ bool isAction = false;
+
+ foreach (string p in type.Split ('|')) {
+ switch (p) {
+ case "check":
+ ct = ActionType.Check;
+ if (isAction)
+ throw new InvalidOperationException ("Action type specified twice.");
+ isAction = true;
+ break;
+
+ case "radio":
+ ct = ActionType.Radio;
+ if (isAction)
+ throw new InvalidOperationException ("Action type specified twice.");
+ isAction = true;
+ break;
+
+ case "normal":
+ ct = ActionType.Normal;
+ if (isAction)
+ throw new InvalidOperationException ("Action type specified twice.");
+ isAction = true;
+ break;
+
+ case "custom":
+ if (widget == null)
+ throw new InvalidOperationException ("Widget type not specified in custom command.");
+ custom = true;
+ break;
+
+ case "array":
+ isArray = true;
+ break;
+
+ default:
+ throw new InvalidOperationException ("Unknown command type: " + p);
+ }
+ }
+
+ if (isAction && custom)
+ throw new InvalidOperationException ("Invalid command type combination: " + type);
+
+ Command cmd;
+
+ if (custom) {
+ if (isArray)
+ throw new InvalidOperationException ("Array custom commands are not allowed.");
+
+ CustomCommand ccmd = new CustomCommand ();
+ ccmd.WidgetType = AddIn.GetType (widget);
+ if (ccmd.WidgetType == null)
+ throw new InvalidOperationException ("Could not find command type '" + widget + "'.");
+ cmd = ccmd;
+ } else {
+ if (widget != null)
+ throw new InvalidOperationException ("Widget type can only be specified for custom commands.");
+
+ ActionCommand acmd = new ActionCommand ();
+ acmd.ActionType = ct;
+ acmd.CommandArray = isArray;
+
+ if (defaultHandler != null) {
+ acmd.DefaultHandlerType = AddIn.GetType (defaultHandler);
+ if (acmd.DefaultHandlerType == null)
+ throw new InvalidOperationException ("Could not find handler type '" + defaultHandler + "' for command " + ID);
+ }
+
+ cmd = acmd;
+ }
+
+ cmd.Id = ParseCommandId (this);
+ cmd.Text = Runtime.StringParserService.Parse (GettextCatalog.GetString (label));
+ cmd.Description = GettextCatalog.GetString (description);
+ if (icon != null)
+ cmd.Icon = ResourceService.GetStockId (icon);
+ cmd.AccelKey = shortcut;
+ cmd.DisabledVisible = disabledVisible;
+
+ return cmd;
+ }
+
+ internal static object ParseCommandId (ICodon codon)
+ {
+ string id = codon.ID;
+ Type enumType = null;
+ int i = id.LastIndexOf (".");
+ if (i != -1)
+ enumType = codon.AddIn.GetType (id.Substring (0,i));
+
+ if (enumType == null)
+ enumType = Type.GetType (id.Substring (0,i));
+
+ if (enumType == null || !enumType.IsEnum)
+ throw new InvalidOperationException ("Could not find an enum type for the command '" + id + "'.");
+
+ try {
+ return Enum.Parse (enumType, id.Substring (i+1));
+ } catch {
+ throw new InvalidOperationException ("Could not find an enum value for the command '" + id + "'.");
+ }
+ }
+ }
+}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/CommandItemCodon.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/CommandItemCodon.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/CommandItemCodon.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -0,0 +1,48 @@
+//
+// CommandItemCodon.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+
+using System;
+using System.Collections;
+using MonoDevelop.Core.AddIns.Conditions;
+using MonoDevelop.Commands;
+
+namespace MonoDevelop.Core.AddIns.Codons
+{
+ [CodonNameAttribute ("CommandItem")]
+ public class CommandItemCodon : AbstractCodon
+ {
+ public override object BuildItem (object owner, ArrayList subItems, ConditionCollection conditions)
+ {
+ object id = CommandCodon.ParseCommandId (this);
+ return new CommandEntry (id);
+ }
+ }
+}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/ItemSetCodon.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/ItemSetCodon.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/ItemSetCodon.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -0,0 +1,67 @@
+//
+// ItemSetCodon.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+
+using System;
+using System.Collections;
+using MonoDevelop.Core.AddIns.Conditions;
+using MonoDevelop.Commands;
+using MonoDevelop.Core.Services;
+using MonoDevelop.Services;
+
+namespace MonoDevelop.Core.AddIns.Codons
+{
+ [CodonNameAttribute ("ItemSet")]
+ public class ItemSetCodon : AbstractCodon
+ {
+ [XmlMemberAttribute ("_label")]
+ string label;
+
+ [XmlMemberAttribute("icon")]
+ string icon;
+
+ public override object BuildItem (object owner, ArrayList subItems, ConditionCollection conditions)
+ {
+ if (label == null) label = ID;
+
+ label = Runtime.StringParserService.Parse (GettextCatalog.GetString (label));
+ if (icon != null) icon = ResourceService.GetStockId (icon);
+ CommandEntrySet cset = new CommandEntrySet (label, icon);
+ foreach (object e in subItems) {
+ CommandEntry ce = e as CommandEntry;
+ if (ce != null)
+ cset.Add (ce);
+ else
+ throw new InvalidOperationException ("Invalid ItemSet child: " + e);
+ }
+ return cset;
+ }
+ }
+}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/LinkItemCodon.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/LinkItemCodon.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/LinkItemCodon.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -0,0 +1,58 @@
+//
+// LinkItemCodon.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+
+using System;
+using System.Collections;
+using MonoDevelop.Core.AddIns.Conditions;
+using MonoDevelop.Commands;
+using MonoDevelop.Services;
+using MonoDevelop.Core.Services;
+
+namespace MonoDevelop.Core.AddIns.Codons
+{
+ [CodonNameAttribute ("LinkItem")]
+ public class LinkItemCodon : AbstractCodon
+ {
+ [XmlMemberAttribute ("_label")]
+ string label;
+
+ [XmlMemberAttribute("link")]
+ string link;
+
+ [XmlMemberAttribute("description")]
+ string description;
+
+ public override object BuildItem (object owner, ArrayList subItems, ConditionCollection conditions)
+ {
+ return new LinkCommandEntry (label, link, ResourceService.GetStockId ("Icons.16x16.WebSearchIcon"));
+ }
+ }
+}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/SeparatorItemCodon.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/SeparatorItemCodon.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/SeparatorItemCodon.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -0,0 +1,47 @@
+//
+// SeparatorItemCodon.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+
+using System;
+using System.Collections;
+using MonoDevelop.Core.AddIns.Conditions;
+using MonoDevelop.Commands;
+
+namespace MonoDevelop.Core.AddIns.Codons
+{
+ [CodonNameAttribute ("SeparatorItem")]
+ public class SeparatorItemCodon : AbstractCodon
+ {
+ public override object BuildItem (object owner, ArrayList subItems, ConditionCollection conditions)
+ {
+ return new CommandEntry (Command.Separator);
+ }
+ }
+}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Pads/SolutionPadCodon.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Pads/SolutionPadCodon.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Pads/SolutionPadCodon.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -90,7 +90,16 @@
protected override IPadContent CreatePad ()
{
- SolutionPad pad = new SolutionPad (label, icon, builders, options);
+ TreeViewPad pad;
+ if (Class != null) {
+ object ob = AddIn.CreateObject (Class);
+ if (!(ob is TreeViewPad))
+ throw new InvalidOperationException ("'" + Class + "' is not a subclass of TreeViewPad.");
+ pad = (TreeViewPad) ob;
+ } else
+ pad = new SolutionPad ();
+
+ pad.Initialize (label, icon, builders, options);
pad.DefaultPlacement = placement;
pad.Id = ID;
return pad;
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Conditions/WorkbenchContextCondition.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Conditions/WorkbenchContextCondition.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Conditions/WorkbenchContextCondition.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -7,7 +7,7 @@
namespace MonoDevelop.Core.AddIns
{
[ConditionAttribute()]
- public class WorkbenchContext : AbstractCondition
+ public class WorkbenchContextCondition : AbstractCondition
{
[XmlMemberAttribute("context", IsRequired = true)]
string context;
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -328,6 +328,40 @@
public CombineEntry Entry;
}
+ public string[] GetAllConfigurations ()
+ {
+ ArrayList names = new ArrayList ();
+ GetAllConfigurations (this, names);
+ return (string[]) names.ToArray (typeof(string));
+ }
+
+ void GetAllConfigurations (CombineEntry entry, ArrayList names)
+ {
+ foreach (IConfiguration conf in Configurations)
+ if (!names.Contains (conf.Name))
+ names.Add (conf.Name);
+
+ if (entry is Combine) {
+ foreach (CombineEntry ce in ((Combine)entry).Entries)
+ GetAllConfigurations (ce, names);
+ }
+ }
+
+ public void SetAllConfigurations (string configName)
+ {
+ IConfiguration conf = GetConfiguration (configName);
+ if (conf != null) ActiveConfiguration = conf;
+
+ foreach (CombineEntry ce in Entries) {
+ if (ce is Combine)
+ ((Combine)ce).SetAllConfigurations (configName);
+ else {
+ conf = ce.GetConfiguration (configName);
+ if (conf != null) ce.ActiveConfiguration = conf;
+ }
+ }
+ }
+
/// <remarks>
/// Returns an ArrayList containing all ProjectEntries in this combine and
/// undercombines
@@ -424,6 +458,9 @@
int failedBuilds = 0;
foreach (Project entry in allProjects) {
+ if (monitor.IsCancelRequested)
+ break;
+
ICompilerResult res = entry.Build (monitor);
builds++;
cres.Errors.AddRange (res.CompilerResults.Errors);
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProject.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProject.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProject.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -9,6 +9,7 @@
using System.IO;
using System.Diagnostics;
using System.Xml;
+using System.Threading;
using MonoDevelop.Internal.Serialization;
using MonoDevelop.Internal.Templates;
using MonoDevelop.Services;
@@ -21,6 +22,8 @@
[ItemProperty]
string language;
+ object debugStopEvent = new object ();
+
ILanguageBinding languageBinding;
public override string ProjectType {
@@ -124,12 +127,27 @@
public override void Debug (IProgressMonitor monitor)
{
- if (Runtime.TaskService.Errors != 0) return;
-
DotNetProjectConfiguration configuration = (DotNetProjectConfiguration) ActiveConfiguration;
- if (Runtime.DebuggingService != null)
- Runtime.DebuggingService.Run (new string[] { configuration.CompiledOutputName } );
+ if (Runtime.DebuggingService != null) {
+ Runtime.DebuggingService.StoppedEvent += new EventHandler (OnStopDebug);
+ lock (debugStopEvent) {
+ try {
+ Runtime.DebuggingService.Run (monitor, new string[] { configuration.CompiledOutputName } );
+ Monitor.Wait (debugStopEvent);
+ } catch (Exception ex) {
+ monitor.ReportError (null, ex);
+ }
+ }
+ Runtime.DebuggingService.StoppedEvent -= new EventHandler (OnStopDebug);
+ }
}
+
+ void OnStopDebug (object sender, EventArgs e)
+ {
+ lock (debugStopEvent) {
+ Monitor.PulseAll (debugStopEvent);
+ }
+ }
protected override void DoExecute (IProgressMonitor monitor)
{
@@ -168,13 +186,18 @@
string.Format ("-c \"{0} {1}\"", runtimeStarter, args),
Path.GetDirectoryName (configuration.CompiledOutputName),
false, false, null);
-
+
+ monitor.CancelRequested += new MonitorHandler (new ProcessStopper (p).OnStopExecution);
p.WaitForOutput ();
monitor.Log.WriteLine ("The application exited with code: {0}", p.ExitCode);
} catch (Exception ex) {
monitor.ReportError ("Can not execute " + "\"" + configuration.CompiledOutputName + "\"", ex);
}
}
+
+ void OnStopExecution (IProgressMonitor monitor)
+ {
+ }
public override void GenerateMakefiles (Combine parentCombine)
{
@@ -186,5 +209,20 @@
{
return languageBinding.CanCompile(fileName);
}
+
+ class ProcessStopper
+ {
+ Process p;
+
+ public ProcessStopper (Process p)
+ {
+ this.p = p;
+ }
+
+ public void OnStopExecution (IProgressMonitor monitor)
+ {
+ p.Kill ();
+ }
+ }
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am 2005-04-25 20:35:11 UTC (rev 2474)
@@ -47,6 +47,7 @@
Gui/Pads/ProjectPad/ProjectNodeBuilder.cs \
Gui/Pads/ProjectPad/ProjectReferenceFolderNodeBuilder.cs \
Gui/Pads/ProjectPad/ProjectReferenceNodeBuilder.cs \
+Gui/Pads/ProjectPad/ProjectSolutionPad.cs \
Gui/Pads/ProjectPad/ResourceFolder.cs \
Gui/Pads/ProjectPad/ResourceFolderNodeBuilder.cs \
Gui/Pads/ProjectPad/ShowAllFilesBuilderExtension.cs \
@@ -72,6 +73,7 @@
Gui/IViewContent.cs \
Gui/AbstractViewContent.cs \
Gui/GuiService.cs \
+Gui/CommandService.cs \
Gui/Components/SdMenuSeparator.cs \
Gui/Components/StatusBar/SdStatusBar.cs \
Gui/Components/StatusBar/IStatusIcon.cs \
@@ -150,6 +152,7 @@
Gui/PixbufList.cs \
Gui/AbstractSecondaryViewContent.cs \
Gui/ViewContentCollection.cs \
+Gui/ViewCommandHandlers.cs \
Gui/IWorkbenchWindow.cs \
Gui/HtmlControl/IHTMLDocument2.cs \
Gui/HtmlControl/IHTMLElement.cs \
@@ -159,17 +162,9 @@
Gui/Workbench/Layouts/SdiWorkspaceLayout.cs \
Gui/Workbench/WorkbenchMemento.cs \
Gui/Workbench/DefaultWorkbench.cs \
-Commands/ClassBrowserCommands/ClassBrowserCommands.cs \
Commands/FileCommands.cs \
Commands/HelpCommands.cs \
Commands/CustomStringTagProvider.cs \
-Commands/RunCommands.cs \
-Commands/ProjectBrowserCommands/FolderNodeCommands.cs \
-Commands/ProjectBrowserCommands/ReferenceFolderNodeCommands.cs \
-Commands/ProjectBrowserCommands/GeneralNodeCommands.cs \
-Commands/ProjectBrowserCommands/CombineNodeCommands.cs \
-Commands/ProjectBrowserCommands/ResourceFolderNodeCommands.cs \
-Commands/ProjectBrowserCommands/ProjectNodeCommands.cs \
Commands/ProjectCommands.cs \
Commands/VBConverter/ConvertProject.cs \
Commands/VBConverter/ConvertBuffer.cs \
@@ -178,7 +173,7 @@
Commands/WindowCommands.cs \
Commands/AutostartCommands.cs \
Commands/ToolsCommands.cs \
-Commands/MenuItemBuilders.cs \
+Commands/ViewCommands.cs \
Services/File/IFileService.cs \
Services/File/DefaultFileService.cs \
Services/File/FileEventArgs.cs \
@@ -258,6 +253,11 @@
Internal/Conditions/CombineOpenCondition.cs \
Internal/Conditions/ProjectOpenCondition.cs \
Internal/Conditions/WorkbenchContextCondition.cs \
+Internal/Codons/Commands/CommandCodon.cs \
+Internal/Codons/Commands/CommandItemCodon.cs \
+Internal/Codons/Commands/ItemSetCodon.cs \
+Internal/Codons/Commands/LinkItemCodon.cs \
+Internal/Codons/Commands/SeparatorItemCodon.cs \
Internal/Codons/DisplayBinding/IDisplayBinding.cs \
Internal/Codons/DisplayBinding/ISubDisplayBinding.cs \
Internal/Codons/DisplayBinding/DisplayBindingCodon.cs \
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml 2005-04-25 20:35:11 UTC (rev 2474)
@@ -62,6 +62,8 @@
class = "MonoDevelop.Services.MenuService"/>
<Class id = "ProcessService"
class = "MonoDevelop.Services.ProcessService"/>
+ <Class id = "CommandService"
+ class = "MonoDevelop.Services.CommandService"/>
</Extension>
<Extension path = "/SharpDevelop/Workbench/ProjectBindings">
@@ -92,306 +94,406 @@
_label = "ExportSignature"
class = "MonoDevelop.Commands.ClassScoutCommands.ExportClassSignature"/>
</Extension>
+
+
+ <Extension path = "/SharpDevelop/Commands">
- <Extension path = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/CombineBrowserNode">
- <MenuItem id = "Compile"
- _label = "Compile"
- class = "MonoDevelop.Commands.Compile"/>
- <MenuItem id = "CompileAll"
- _label = "Rebuild _Solution"
- class = "MonoDevelop.Commands.CompileAll"/>
- <MenuItem id = "CombineBuildGroupSeparator" _label = "-" />
-
- <MenuItem id = "CombineAddMenu" _label = "Add" >
- <MenuItem id = "AddNewProject"
- _label = "Add New Project..."
- icon = "Icons.16x16.NewProjectIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.AddNewProjectToCombine"/>
- <MenuItem id = "AddNewCombine"
- _label = "Add New Solution..."
- icon = "Icons.16x16.NewProjectIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.AddNewCombineToCombine"/>
- <MenuItem id = "Separator1" _label = "-" />
- <MenuItem id = "AddProject"
- _label = "Add existing _Project"
- class = "MonoDevelop.Commands.ProjectBrowser.AddProjectToCombine"/>
- <MenuItem id = "AddCombine"
- _label = "Add existing Solution"
- class = "MonoDevelop.Commands.ProjectBrowser.AddCombineToCombine"/>
- </MenuItem>
- <MenuItem id = "RemoveCombine"
- _label = "_Remove"
- icon = "Icons.16x16.DeleteIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.RemoveEntryEvent"/>
+ <!-- EditCommands -->
+
+ <Command id = "MonoDevelop.Commands.EditCommands.Copy"
+ _label = "_Copy"
+ icon = "Icons.16x16.CopyIcon"
+ description = "${res:XML.MainMenu.EditMenu.Copy.Description}"
+ shortcut = "Control|C"/>
+ <Command id = "MonoDevelop.Commands.EditCommands.Cut"
+ _label = "Cu_t"
+ icon = "Icons.16x16.CutIcon"
+ description = "${res:XML.MainMenu.EditMenu.Cut.Description}"
+ shortcut = "Control|X"/>
+ <Command id = "MonoDevelop.Commands.EditCommands.Paste"
+ _label = "_Paste"
+ icon = "Icons.16x16.PasteIcon"
+ shortcut = "Control|V"/>
+ <Command id = "MonoDevelop.Commands.EditCommands.Delete"
+ _label = "_Delete"
+ description = "${res:XML.MainMenu.EditMenu.Delete.Description}"
+ icon = "Icons.16x16.DeleteIcon" />
+ <Command id = "MonoDevelop.Commands.EditCommands.Rename"
+ _label = "Re_name" />
+ <Command id = "MonoDevelop.Commands.EditCommands.Undo"
+ _label = "_Undo"
+ icon = "Icons.16x16.UndoIcon"
+ description = "${res:XML.MainMenu.EditMenu.Undo.Description}"
+ shortcut = "Control|Z" />
+ <Command id = "MonoDevelop.Commands.EditCommands.Redo"
+ _label = "_Redo"
+ icon = "Icons.16x16.RedoIcon"
+ description = "${res:XML.MainMenu.EditMenu.Redo.Description}"
+ shortcut = "Control|Y" />
+ <Command id = "MonoDevelop.Commands.EditCommands.SelectAll"
+ _label = "Select _All"
+ description = "${res:XML.MainMenu.EditMenu.SelectAll.Description}"
+ shortcut = "Control|A" />
+ <Command id = "MonoDevelop.Commands.EditCommands.CommentCode"
+ shortcut = "Control|Alt|C"
+ _label = "C_omment Line(s)" />
+ <Command id = "MonoDevelop.Commands.EditCommands.UncommentCode"
+ shortcut = "Control|Alt|U"
+ _label = "_Uncomment Line(s)" />
+ <Command id = "MonoDevelop.Commands.EditCommands.IndentSelection"
+ shortcut = "Control|Alt|Home"
+ _label = "_Indent Selection" />
+ <Command id = "MonoDevelop.Commands.EditCommands.UnIndentSelection"
+ shortcut = "Control|Alt|End"
+ _label = "_Unindent Selection" />
+ <Command id = "MonoDevelop.Commands.EditCommands.WordCount"
+ _label = "_Word Count..."
+ description = "${res:XML.MainMenu.EditMenu.WordCount.Description}"/>
+ <Command id = "MonoDevelop.Commands.EditCommands.MonodevelopPreferences"
+ defaultHandler = "MonoDevelop.Commands.MonodevelopPreferencesHandler"
+ _label = "_Preferences"
+ icon = "Icons.16x16.Options"
+ description = "${res:XML.MainMenu.ToolMenu.Options.Description}" />
+
+ <!-- ProjectCommands -->
+
+ <Command id = "MonoDevelop.Commands.ProjectCommands.Compile"
+ defaultHandler = "MonoDevelop.Commands.CompileHandler"
+ description = "Compile"
+ _label = "_Compile" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.AddNewProject"
+ _label = "Add New Project..."
+ description = "Add a new project to the selected solution"
+ icon = "Icons.16x16.NewProjectIcon" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.AddNewCombine"
+ _label = "Add New Solution..."
+ description = "Add a new solution to the selected solution"
+ icon = "Icons.16x16.NewProjectIcon" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.AddProject"
+ description = "Add a project to the selected solution"
+ _label = "Add existing _Project" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.AddCombine"
+ description = "Add a solution to the selected solution"
+ _label = "Add existing Solution" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.RemoveFromProject"
+ _label = "_Remove From Project"
+ icon = "Icons.16x16.DeleteIcon" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.Options"
+ _label = "Options"
+ description = "Show options window"
+ icon = "Icons.16x16.PropertiesIcon" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.AddResource"
+ _label = "Add Resource" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.AddReference"
+ _label = "Edit References" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.AddNewFiles"
+ _label = "New _File"
+ icon = "Icons.16x16.NewDocumentIcon" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.AddFiles"
+ _label = "Add Files" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.NewFolder"
+ _label = "New Folder"
+ icon = "Icons.16x16.NewFolderIcon" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.IncludeToProject"
+ _label = "Include To Project" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.Build"
+ defaultHandler = "MonoDevelop.Commands.BuildHandler"
+ _label = "Buil_d"
+ shortcut = "F8"
+ icon = "Icons.16x16.BuildCurrentSelectedProject" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.Rebuild"
+ defaultHandler = "MonoDevelop.Commands.RebuildHandler"
+ _label = "Rebuild" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.SetAsStartupProject"
+ _label = "Set As Startup Project" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.Run"
+ defaultHandler = "MonoDevelop.Commands.RunHandler"
+ icon = "Icons.16x16.RunProgramIcon"
+ shortcut = "F5"
+ _label = "Run" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.Debug"
+ defaultHandler = "MonoDevelop.Commands.DebugHandler"
+ icon = "Icons.16x16.RunProgramIcon"
+ shortcut = "Control|F5"
+ _label = "Debug" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.IncludeInBuild"
+ type="check"
+ _label = "Build" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.IncludeInDeploy"
+ type="check"
+ _label = "Deploy" />
+ <Command id = "MonoDevelop.Commands.ProjectCommands.Stop"
+ defaultHandler = "MonoDevelop.Commands.StopHandler"
+ icon = "gtk-stop"
+ shortcut = "Shift|F5"
+ description = "Stop current build or application execution"
+ _label = "Stop" />
+<!-- <Command id = "MonoDevelop.Commands.ProjectCommands.ConfigurationSelector"
+ type = "custom"
+ widget = "MonoDevelop.Gui.ConfigurationComboBox"
+ _label = "Configuration Box" />
+-->
- <MenuItem id = "RenameCombine"
- _label = "Re_name"
- shortcut = "F2"
- class = "MonoDevelop.Commands.ProjectBrowser.RenameEntryEvent"/>
-
- <MenuItem id = "CombineOptionsSeparator" _label = "-" />
-
- <MenuItem id = "CombineOptions"
- _label = "Solution Options"
- icon = "Icons.16x16.PropertiesIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.CombineOptions"/>
+ <!-- FileCommands -->
+
+ <Command id = "MonoDevelop.Commands.FileCommands.OpenFile"
+ defaultHandler = "MonoDevelop.Commands.OpenFileHandler"
+ _label = "O_pen"
+ shortcut = "Control|O"
+ icon = "Icons.16x16.OpenFileIcon" />
+ <Command id = "MonoDevelop.Commands.FileCommands.NewFile"
+ defaultHandler = "MonoDevelop.Commands.NewFileHandler"
+ _label = "New File"
+ shortcut = "Control|N"
+ description = "${res:XML.MainMenu.FileMenu.New.File.Description}"
+ icon = "Icons.16x16.NewDocumentIcon" />
+ <Command id = "MonoDevelop.Commands.FileCommands.Save"
+ icon = "Icons.16x16.SaveIcon"
+ shortcut = "Control|S"
+ _label = "Save" />
+ <Command id = "MonoDevelop.Commands.FileCommands.SaveAll"
+ defaultHandler = "MonoDevelop.Commands.SaveAllHandler"
+ icon = "Icons.16x16.SaveAllIcon"
+ _label = "Save All" />
+ <Command id = "MonoDevelop.Commands.FileCommands.NewProject"
+ defaultHandler = "MonoDevelop.Commands.NewProjectHandler"
+ _label = "N_ew Solution/Project..."
+ icon = "Icons.16x16.NewProjectIcon"
+ description = "${res:XML.MainMenu.FileMenu.New.Project.Description}"
+ shortcut = "Control|Shift|N" />
+ <Command id = "MonoDevelop.Commands.FileCommands.CloseFile"
+ _label = "_Close File"
+ description = "${res:XML.MainMenu.FileMenu.Close.File.Desription}"
+ icon = "Icons.16x16.CloseIcon"
+ shortcut = "Control|W"/>
+ <Command id = "MonoDevelop.Commands.FileCommands.CloseAllFiles"
+ defaultHandler = "MonoDevelop.Commands.CloseAllFilesHandler"
+ _label = "Close All"
+ description = "Close All Files"
+ icon = "Icons.16x16.CloseIcon"
+ shortcut = "Control|Shift|W" />
+ <Command id = "MonoDevelop.Commands.FileCommands.CloseCombine"
+ defaultHandler = "MonoDevelop.Commands.CloseCombineHandler"
+ _label = "Close Sol_ution"
+ description = "${res:XML.MainMenu.FileMenu.Close.Project.Desription}"
+ icon = "Icons.16x16.CloseCombineIcon" />
+ <Command id = "MonoDevelop.Commands.FileCommands.ReloadFile"
+ _label = "_Reload File"
+ shortcut = "Control|U"
+ description = "${res:XML.MainMenu.FileMenu.Reload.Description}" />
+ <Command id = "MonoDevelop.Commands.FileCommands.SaveAs"
+ _label = "Save _As..."
+ icon = "Icons.16x16.SaveAsIcon"
+ shortcut = "Control|Shift|S"
+ description = "${res:XML.MainMenu.FileMenu.SaveAs.Description}" />
+ <Command id = "MonoDevelop.Commands.FileCommands.RecentFileList"
+ defaultHandler = "MonoDevelop.Commands.RecentFileListHandler"
+ type="array"
+ _label = "Recent Files" />
+ <Command id = "MonoDevelop.Commands.FileCommands.ClearRecentFiles"
+ defaultHandler = "MonoDevelop.Commands.ClearRecentFilesHandler"
+ _label = "_Clear Recent Files"
+ description = "${res:XML.MainMenu.FileMenu.ClearRecentFiles.Description}" />
+ <Command id = "MonoDevelop.Commands.FileCommands.RecentProjectList"
+ defaultHandler = "MonoDevelop.Commands.RecentProjectListHandler"
+ type="array"
+ _label = "Recent Projects" />
+ <Command id = "MonoDevelop.Commands.FileCommands.ClearRecentProjects"
+ defaultHandler = "MonoDevelop.Commands.ClearRecentProjectsHandler"
+ _label = "_Clear Recent Solutions"
+ description = "${res:XML.MainMenu.FileMenu.ClearRecentProjects.Description}" />
+ <Command id = "MonoDevelop.Commands.FileCommands.Exit"
+ defaultHandler = "MonoDevelop.Commands.ExitHandler"
+ _label = "_Quit"
+ icon = "Icons.16x16.QuitIcon"
+ description = "${res:XML.MainMenu.FileMenu.Exit.Description}"
+ shortcut = "Control|Q" />
+
+ <!-- ViewCommands -->
+
+ <Command id = "MonoDevelop.Commands.ViewCommands.ViewList"
+ defaultHandler = "MonoDevelop.Commands.ViewListHandler"
+ type="check|array"
+ _label = "View List" />
+ <Command id = "MonoDevelop.Commands.ViewCommands.LayoutList"
+ defaultHandler = "MonoDevelop.Commands.LayoutListHandler"
+ type="radio|array"
+ _label = "Layout List" />
+ <Command id = "MonoDevelop.Commands.ViewCommands.NewLayout"
+ defaultHandler = "MonoDevelop.Commands.NewLayoutHandler"
+ _label = "_New Layout" />
+ <Command id = "MonoDevelop.Commands.ViewCommands.FullScreen"
+ defaultHandler = "MonoDevelop.Commands.FullScreenHandler"
+ _label = "_Full Screen"
+ icon = "Icons.16x16.FullScreen"
+ shortcut = "F11"
+ description = "${res:XML.MainMenu.ViewMenu.FullScreen.Description}" />
+ <Command id = "MonoDevelop.Commands.ViewCommands.Open"
+ _label = "Open" />
+ <Command id = "MonoDevelop.Commands.ViewCommands.TreeDisplayOptionList"
+ type = "array|check"
+ _label = "Display Options List" />
+ <Command id = "MonoDevelop.Commands.ViewCommands.ResetTreeDisplayOptions"
+ _label = "Reset Options" />
+
+ <!-- ToolCommands -->
+
+ <Command id = "MonoDevelop.Commands.ToolCommands.ToolList"
+ defaultHandler = "MonoDevelop.Commands.ToolListHandler"
+ type="array"
+ _label = "Tool List" />
+
+ <!-- WindowCommands -->
+
+ <Command id = "MonoDevelop.Commands.WindowCommands.NextWindow"
+ defaultHandler = "MonoDevelop.Commands.NextWindowHandler"
+ _label = "_Next Window"
+ icon = "Icons.16x16.NextWindowIcon"
+ description = "${res:XML.MainMenu.WindowMenu.NxtWindow.Description}"
+ shortcut = "Control|Page_Down" />
+ <Command id = "MonoDevelop.Commands.WindowCommands.PrevWindow"
+ defaultHandler = "MonoDevelop.Commands.PrevWindowHandler"
+ _label = "_Previous Window"
+ icon = "Icons.16x16.PrevWindowIcon"
+ description = "${res:XML.MainMenu.WindowMenu.PrvWindow.Description}"
+ shortcut = "Control|Page_Up" />
+ <Command id = "MonoDevelop.Commands.WindowCommands.OpenWindowList"
+ defaultHandler = "MonoDevelop.Commands.OpenWindowListHandler"
+ type="radio|array"
+ _label = "Window List" />
+
+ <!-- HelpCommands -->
+
+ <Command id = "MonoDevelop.Commands.HelpCommands.TipOfTheDay"
+ defaultHandler = "MonoDevelop.Commands.TipOfTheDayHandler"
+ _label = "_Tip of the Day..."
+ icon = "Icons.16x16.TipOfTheDay"
+ description = "${res:XML.MainMenu.HelpMenu.Tips.Description}" />
+ <Command id = "MonoDevelop.Commands.HelpCommands.About"
+ defaultHandler = "MonoDevelop.Commands.AboutHandler"
+ _label = "_About"
+ icon = "Icons.16x16.AboutIcon"
+ description = "${res:XML.MainMenu.HelpMenu.About.Description}" />
</Extension>
+
+ <Extension path = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/CombineBrowserNode">
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.Build" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.Rebuild" />
+ <SeparatorItem id = "CombineBuildGroupSeparator" />
+ <ItemSet id = "CombineAddMenu" _label = "Add" >
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.AddNewProject" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.AddNewCombine" />
+ <SeparatorItem id = "Separator1" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.AddProject" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.AddCombine" />
+ </ItemSet>
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Delete" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Rename" />
+ <SeparatorItem id = "CombineOptionsSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.Options" />
+ </Extension>
<Extension path = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/ResourceFolderNode">
- <MenuItem id = "AddResource"
- _label = "Add Resource"
- class = "MonoDevelop.Commands.ProjectBrowser.AddResourceToProject"/>
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.AddResource" />
</Extension>
-
+
<Extension path = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/ReferenceFolderNode">
- <MenuItem id = "AddReference"
- _label = "Edit References"
- class = "MonoDevelop.Commands.ProjectBrowser.AddReferenceToProject"/>
- <MenuItem id = "Paste"
- _label = "_Paste"
- icon = "Icons.16x16.PasteIcon"
- shortcut = "Control|V"
- class = "MonoDevelop.Commands.ProjectBrowser.PasteNodeCommand"/>
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.AddReference" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Paste" />
</Extension>
<Extension path = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/ReferenceNode">
- <MenuItem id = "OpenFile"
- _label = "O_pen"
- icon = "Icons.16x16.OpenFileIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.OpenFileEvent"/>
- <MenuItem id = "OpenSeparator" _label = "-" />
- <MenuItem id = "Copy"
- _label = "_Copy"
- icon = "Icons.16x16.CopyIcon"
- shortcut = "Control|C"
- class = "MonoDevelop.Commands.ProjectBrowser.CopyNodeCommand"/>
- <MenuItem id = "Remove"
- _label = "_Remove"
- icon = "Icons.16x16.DeleteIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.RemoveEntryEvent"/>
+ <CommandItem id = "MonoDevelop.Commands.ViewCommands.Open" />
+ <SeparatorItem id = "OpenSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Copy" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Delete" />
</Extension>
- <Extension path = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/DefaultFileNode">
- <MenuItem id = "OpenFile"
- _label = "O_pen"
- icon = "Icons.16x16.OpenFileIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.OpenFileEvent"/>
- <MenuItem id = "OpenSeparator" _label = "-" />
- <MenuItem id = "Copy"
- _label = "_Copy"
- icon = "Icons.16x16.CopyIcon"
- shortcut = "Control|C"
- class = "MonoDevelop.Commands.ProjectBrowser.CopyNodeCommand"/>
- <MenuItem id = "Cut"
- _label = "_Cut"
- icon = "Icons.16x16.CutIcon"
- shortcut = "Control|X"
- class = "MonoDevelop.Commands.ProjectBrowser.CutNodeCommand"/>
- <MenuItem id = "CutSeparator" _label = "-" />
- <MenuItem id = "Remove"
- _label = "_Remove"
- icon = "Icons.16x16.DeleteIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.RemoveEntryEvent"/>
- <MenuItem id = "Rename"
- _label = "Re_name"
- shortcut = "F2"
- class = "MonoDevelop.Commands.ProjectBrowser.RenameEntryEvent"/>
- </Extension>
+ <Extension path = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/DefaultFileNode">
+ <CommandItem id = "MonoDevelop.Commands.ViewCommands.Open" />
+ <SeparatorItem id = "OpenSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Copy" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Cut" />
+ <SeparatorItem id = "CutSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Delete" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Rename" />
+ </Extension>
- <Extension path = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/ProjectFileNode">
- <MenuItem id = "OpenFile"
- _label = "O_pen"
- icon = "Icons.16x16.OpenFileIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.OpenFileEvent"/>
- <MenuItem id = "OpenSeparator" _label = "-" />
- <MenuItem id = "Add" _label = "Add">
- <MenuItem id = "NewFiles"
- _label = "New _File"
- icon = "Icons.16x16.NewDocumentIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.AddNewFileEvent"/>
- <MenuItem id = "AddFiles"
- _label = "Add Files"
- class = "MonoDevelop.Commands.ProjectBrowser.AddFilesToProject"/>
- <MenuItem id = "Separator1" _label = "-" />
- <MenuItem id = "NewFolder"
- _label = "New Folder"
- icon = "Icons.16x16.NewFolderIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.NewFolderEvent"/>
- </MenuItem>
- <MenuItem id = "Include" _label = "Include">
- <MenuItem id = "IncludeFileIn" _label = "bogus_label"
- class = "MonoDevelop.Commands.IncludeFilesBuilder" />
- </MenuItem>
- <MenuItem id = "IncludeSeparator" _label = "-" />
- <MenuItem id = "Copy"
- _label = "_Copy"
- icon = "Icons.16x16.CopyIcon"
- shortcut = "Control|C"
- class = "MonoDevelop.Commands.ProjectBrowser.CopyNodeCommand"/>
- <MenuItem id = "Cut"
- _label = "_Cut"
- icon = "Icons.16x16.CutIcon"
- shortcut = "Control|X"
- class = "MonoDevelop.Commands.ProjectBrowser.CutNodeCommand"/>
- <MenuItem id = "CutSeparator" _label = "-" />
- <MenuItem id = "Remove"
- _label = "Remove"
- icon = "Icons.16x16.DeleteIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.RemoveEntryEvent"/>
- <MenuItem id = "Rename"
- _label = "Rename"
- shortcut = "F2"
- class = "MonoDevelop.Commands.ProjectBrowser.RenameEntryEvent"/>
- </Extension>
+ <Extension path = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/ProjectFileNode">
+ <CommandItem id = "MonoDevelop.Commands.ViewCommands.Open" />
+ <SeparatorItem id = "OpenSeparator" />
+ <ItemSet id = "Add" _label = "Add">
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.AddNewFiles" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.AddFiles" />
+ <SeparatorItem id = "Separator1" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.NewFolder" />
+ </ItemSet>
+ <ItemSet id = "Include" _label = "Include">
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.IncludeInBuild" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.IncludeInDeploy" />
+ </ItemSet>
+ <SeparatorItem id = "IncludeSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Copy" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Cut" />
+ <SeparatorItem id = "CutSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Delete" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Rename" />
+ </Extension>
- <Extension path = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/SystemFileNode">
- <MenuItem id = "OpenFile"
- _label = "O_pen"
- icon = "Icons.16x16.OpenFileIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.OpenFileEvent"/>
- <MenuItem id = "IncludeToProject"
- _label = "Include To Project"
- class = "MonoDevelop.Commands.ProjectBrowser.IncludeFileToProject"/>
- <MenuItem id = "IncludeToProjectSeparator" _label = "-" />
- <MenuItem id = "Copy"
- _label = "_Copy"
- icon = "Icons.16x16.CopyIcon"
- shortcut = "Control|C"
- class = "MonoDevelop.Commands.ProjectBrowser.CopyNodeCommand"/>
- <MenuItem id = "Cut"
- _label = "_Cut"
- icon = "Icons.16x16.CutIcon"
- shortcut = "Control|X"
- class = "MonoDevelop.Commands.ProjectBrowser.CutNodeCommand"/>
- <MenuItem id = "CutSeparator" _label = "-" />
- <MenuItem id = "Remove"
- _label = "Remove"
- icon = "Icons.16x16.DeleteIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.RemoveEntryEvent"/>
- <MenuItem id = "Rename"
- _label = "Rename"
- shortcut = "F2"
- class = "MonoDevelop.Commands.ProjectBrowser.RenameEntryEvent"/>
- </Extension>
-
- <Extension path = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/DefaultDirectoryNode">
- <MenuItem id = "Add" _label = "Add">
- <MenuItem id = "NewFiles"
- _label = "Add New File"
- icon = "Icons.16x16.NewDocumentIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.AddNewFileEvent"/>
- <MenuItem id = "AddFiles"
- _label = "Add Files"
- class = "MonoDevelop.Commands.ProjectBrowser.AddFilesToProject"/>
- <MenuItem id = "Separator1" _label = "-" />
- <MenuItem id = "NewFolder"
- _label = "Add New Folder"
- icon = "Icons.16x16.NewFolderIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.NewFolderEvent"/>
- </MenuItem>
- <MenuItem id = "AddSeparator" _label = "-" />
- <MenuItem id = "Copy"
- _label = "_Copy"
- icon = "Icons.16x16.CopyIcon"
- shortcut = "Control|C"
- class = "MonoDevelop.Commands.ProjectBrowser.CopyNodeCommand"/>
- <MenuItem id = "Cut"
- _label = "_Cut"
- icon = "Icons.16x16.CutIcon"
- shortcut = "Control|X"
- class = "MonoDevelop.Commands.ProjectBrowser.CutNodeCommand"/>
- <MenuItem id = "Paste"
- _label = "_Paste"
- icon = "Icons.16x16.PasteIcon"
- shortcut = "Control|V"
- class = "MonoDevelop.Commands.ProjectBrowser.PasteNodeCommand"/>
- <MenuItem id = "CutSeparator" _label = "-" />
- <MenuItem id = "Remove"
- _label = "_Remove"
- icon = "Icons.16x16.DeleteIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.RemoveEntryEvent"/>
- <MenuItem id = "Rename"
- _label = "Re_name"
- shortcut = "F2"
- class = "MonoDevelop.Commands.ProjectBrowser.RenameEntryEvent"/>
- </Extension>
-
- <Extension path = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/ProjectBrowserNode">
- <MenuItem id = "BuildProject"
- _label = "Buil_d Project"
- icon = "Icons.16x16.BuildCurrentSelectedProject"
- class = "MonoDevelop.Commands.BuildCurrentProject"/>
- <MenuItem id = "RebuildProject"
- _label = "Rebuild Project"
- class = "MonoDevelop.Commands.RebuildCurrentProject"/>
- <MenuItem id = "BuildGroupSeparator" _label = "-" />
- <MenuItem id = "Add" _label = "Add">
- <MenuItem id = "NewFiles"
- _label = "Add New File"
- icon = "Icons.16x16.NewDocumentIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.AddNewFileEvent"/>
- <MenuItem id = "AddFiles"
- _label = "Add Files"
- class = "MonoDevelop.Commands.ProjectBrowser.AddFilesToProject"/>
- <MenuItem id = "Separator1" _label = "-" />
- <MenuItem id = "NewFolder"
- _label = "Add New Folder"
- icon = "Icons.16x16.NewFolderIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.NewFolderEvent"/>
- </MenuItem>
- <MenuItem id = "AddSeparator" _label = "-" />
- <MenuItem id = "Copy"
- _label = "_Copy"
- icon = "Icons.16x16.CopyIcon"
- shortcut = "Control|C"
- class = "MonoDevelop.Commands.ProjectBrowser.CopyNodeCommand"/>
- <MenuItem id = "Cut"
- _label = "_Cut"
- icon = "Icons.16x16.CutIcon"
- shortcut = "Control|X"
- class = "MonoDevelop.Commands.ProjectBrowser.CutNodeCommand"/>
- <MenuItem id = "Paste"
- _label = "_Paste"
- icon = "Icons.16x16.PasteIcon"
- shortcut = "Control|V"
- class = "MonoDevelop.Commands.ProjectBrowser.PasteNodeCommand"/>
- <MenuItem id = "CutSeparator" _label = "-" />
- <MenuItem id = "Remove"
- _label = "_Remove"
- icon = "Icons.16x16.DeleteIcon"
- class = "MonoDevelop.Commands.ProjectBrowser.RemoveEntryEvent"/>
- <MenuItem id = "Rename"
- _label = "Re_name"
- shortcut = "F2"
- class = "MonoDevelop.Commands.ProjectBrowser.RenameEntryEvent"/>
- <!-- <MenuItem id = "RemoveRenameSeparator" _label = "-" /> -->
- <!-- <MenuItem id = "RunTests"
- _label = "${res:ProjectComponent.ContextMenu.RunTests}"
- class = "MonoDevelop.Commands.RunTestsInProject"/>
- <MenuItem id = "Deploy"
- _label = "${res:ProjectComponent.ContextMenu.Deploy}" />
- <MenuItem id = "TestsDeploySeparator" _label = "-" /> -->
+ <Extension path = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/SystemFileNode">
+ <CommandItem id = "MonoDevelop.Commands.ViewCommands.Open" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.IncludeToProject" />
+ <SeparatorItem id = "IncludeToProjectSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Copy" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Cut" />
+ <SeparatorItem id = "CutSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Delete" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Rename" />
+ </Extension>
-<!-- <MenuItem id = "ViewDocumentation"
- _label = "${res:ProjectComponent.ContextMenu.ViewDocumentation}"
- class = "MonoDevelop.Commands.ViewProjectDocumentation"/> -->
+ <Extension path = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/DefaultDirectoryNode">
+ <ItemSet id = "Add" _label = "Add">
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.AddNewFiles" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.AddFiles" />
+ <SeparatorItem id = "Separator1" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.NewFolder" />
+ </ItemSet>
+ <SeparatorItem id = "AddSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Copy" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Cut" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Paste" />
+ <SeparatorItem id = "CutSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Delete" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Rename" />
+ </Extension>
+
+ <Extension path = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/ProjectBrowserNode">
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.Build" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.Rebuild"/>
+ <SeparatorItem id = "BuildGroupSeparator" />
+ <ItemSet id = "Add" _label = "Add">
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.AddNewFiles" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.AddFiles" />
+ <SeparatorItem id = "Separator1" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.NewFolder" />
+ </ItemSet>
+
+ <SeparatorItem id = "AddSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Copy" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Cut" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Paste" />
+ <SeparatorItem id = "CutSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Delete" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Rename" />
- <!-- <MenuItem id = "GenerateDocumentation"
- _label = "${res:ProjectComponent.ContextMenu.GenerateDocumentation}"
- class = "MonoDevelop.Commands.GenerateProjectDocumentation"/> -->
+ <SeparatorItem id = "SetAsStartupProjectSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.SetAsStartupProject" />
- <MenuItem id = "SetAsStartupProjectSeparator" _label = "-" />
- <MenuItem id = "SetAsStartupProject"
- _label = "Set As Startup Project"
- class = "MonoDevelop.Commands.ProjectBrowser.SetAsStartupProject"/>
-
- <MenuItem id = "OptionsSeparator" _label = "-" />
- <MenuItem id = "ProjectOptions"
- _label = "Project _Options"
- icon = "Icons.16x16.PropertiesIcon"
- class = "MonoDevelop.Commands.ViewProjectOptions"/>
- </Extension>
+ <SeparatorItem id = "OptionsSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.Options" />
+ </Extension>
+
<Extension path = "/SharpDevelop/Workbench/ProjectOptions/ConfigNodeMenu">
<MenuItem id = "Add"
_label = "Add"
@@ -502,7 +604,7 @@
<Pad id = "MonoDevelop.Gui.Pads.OpenTaskView" class = "MonoDevelop.Gui.Pads.OpenTaskView"/>
<Pad id = "MonoDevelop.Gui.Pads.HelpTree" class = "MonoDevelop.Gui.Pads.HelpTree"/>
- <SolutionPad id = "MonoDevelop.Gui.Pads.ProjectPad" defaultPlacement = "Left" _label = "Solution" icon = "md-combine-icon">
+ <SolutionPad id = "MonoDevelop.Gui.Pads.ProjectPad" defaultPlacement = "Left" _label = "Solution" icon = "md-combine-icon" class = "MonoDevelop.Gui.Pads.ProjectPad.ProjectSolutionPad">
<PadOption id = "ShowAllFiles" _label = "Show All Files" defaultValue = "False" />
<NodeBuilder id = "Combine" class = "MonoDevelop.Gui.Pads.ProjectPad.CombineNodeBuilder"/>
<NodeBuilder id = "Project" class = "MonoDevelop.Gui.Pads.ProjectPad.ProjectNodeBuilder"/>
@@ -601,504 +703,141 @@
extensions = "*.*"/>
</Extension>
+ <!-- Main Toolbar -->
+
<Extension path = "/SharpDevelop/Workbench/ToolBar">
- <ToolbarItem id = "Standard">
- <ToolbarItem id = "New"
- icon = "Icons.16x16.NewDocumentIcon"
- _tooltip = "New File"
- class = "MonoDevelop.Commands.CreateNewFile"/>
- <ToolbarItem id = "Open"
- icon = "Icons.16x16.OpenFileIcon"
- _tooltip = "Open File"
- class = "MonoDevelop.Commands.OpenFile"/>
- <Conditional activewindow="*" action="Disable">
- <ToolbarItem id = "Save"
- icon = "Icons.16x16.SaveIcon"
- _tooltip = "Save"
- class = "MonoDevelop.Commands.SaveFile"/>
-
- <ToolbarItem id = "SaveAll"
- icon = "Icons.16x16.SaveAllIcon"
- _tooltip = "Save All"
- class = "MonoDevelop.Commands.SaveAllFiles"/>
- </Conditional>
- <ToolbarItem id = "Separator1" _tooltip = "-"/>
- <!-- <Conditional activewindow="*" action="Disable">-->
- <ToolbarItem id = "Cut"
- icon = "Icons.16x16.CutIcon"
- _tooltip = "Cut"
- class = "MonoDevelop.Commands.Cut"/>
- <ToolbarItem id = "Copy"
- icon = "Icons.16x16.CopyIcon"
- _tooltip = "Copy"
- class = "MonoDevelop.Commands.Copy"/>
- <ToolbarItem id = "Paste"
- icon = "Icons.16x16.PasteIcon"
- _tooltip = "Paste"
- class = "MonoDevelop.Commands.Paste"/>
- <ToolbarItem id = "Delete"
- icon = "Icons.16x16.DeleteIcon"
- _tooltip = "Delete"
- class = "MonoDevelop.Commands.Delete"/>
- <!-- </Conditional>-->
- <ToolbarItem id = "CutSeparator" insertafter ="Delete" insertbefore ="Find" _tooltip = "-"/>
- <!-- <Conditional action="Disable">
- <Or>
- <Condition activewindow="MonoDevelop.DefaultEditor.Gui.Editor.ITextAreaControlProvider"/>
- <Condition iscombineopen="True"/>
- </Or>
- </Conditional> -->
-
- <ToolbarItem id = "CompileSeparator" insertafter = "ClearBookmarks" _tooltip = "-"/>
- <Conditional action="Disable">
- <Or>
- <Condition activewindow="MonoDevelop.DefaultEditor.Gui.Editor.ITextAreaControlProvider"/>
- <Condition iscombineopen="True"/>
- </Or>
- <ToolbarItem id = "Compile"
- icon = "Icons.16x16.BuildCombine"
- _tooltip = "Compile"
- class = "MonoDevelop.Commands.Compile"/>
-
- <ToolbarItem id = "BuildProject"
- icon = "Icons.16x16.BuildCurrentSelectedProject"
- _tooltip = "Build Project"
- class = "MonoDevelop.Commands.BuildCurrentProject"/>
- <ToolbarItem id = "Run"
- icon = "Icons.16x16.RunProgramIcon"
- _tooltip = "Run"
- class = "MonoDevelop.Commands.RunCommand"/>
- </Conditional>
- </ToolbarItem>
+ <ItemSet id = "Standard">
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.NewFile" />
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.OpenFile" />
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.Save" />
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.SaveAll" />
+ <SeparatorItem id = "Separator1" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Cut" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Copy" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Paste" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Delete" />
+ <SeparatorItem id = "CutSeparator" />
+ <SeparatorItem id = "CompileSeparator" />
+<!-- <CommandItem id = "MonoDevelop.Commands.ProjectCommands.ConfigurationSelector" />-->
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.Build" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.Run" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.Stop" />
+ </ItemSet>
</Extension>
- <Extension path = "/SharpDevelop/Workbench/MainMenu">
- <MenuItem id = "File" _label = "_File">
- <MenuItem id = "File"
- _label = "_New File..."
- icon = "Icons.16x16.NewDocumentIcon"
- description = "${res:XML.MainMenu.FileMenu.New.File.Description}"
- shortcut = "Control|N"
- class = "MonoDevelop.Commands.CreateNewFile"/>
-
- <MenuItem id = "Project"
- _label = "N_ew Solution/Project..."
- icon = "Icons.16x16.NewProjectIcon"
- description = "${res:XML.MainMenu.FileMenu.New.Project.Description}"
- shortcut = "Control|Shift|N"
- class = "MonoDevelop.Commands.CreateNewProject"/>
-
- <!-- <MenuItem id = "Open" _label = "_Open">
- <MenuItem id = "File"
- _label = "File..."
- icon = "Icons.16x16.OpenFileIcon"
- description = "${res:XML.MainMenu.FileMenu.Open.File.Description}"
- shortcut = "Control|O"
- class = "MonoDevelop.Commands.OpenFile"/>
-
- <MenuItem id = "Project"
- _label = "Solution/Project..."
- icon = "Icons.16x16.OpenProjectIcon"
- description = "${res:XML.MainMenu.FileMenu.Open.Project.Description}"
- shortcut = "Control|Shift|O"
- class = "MonoDevelop.Commands.OpenCombine"/>
- </MenuItem> -->
+ <!-- Main Menu -->
- <MenuItem id = "Open" _label = "_Open..."
- icon = "Icons.16x16.OpenFileIcon"
- shortcut = "Control|O"
- class = "MonoDevelop.Commands.OpenFile"/>
-
- <MenuItem id = "OpenSep" _label = "-"/>
-
- <Conditional activewindow="*" action="Disable">
- <MenuItem id = "CloseFile"
- _label = "_Close File"
- description = "${res:XML.MainMenu.FileMenu.Close.File.Desription}"
- icon = "Icons.16x16.CloseIcon"
- shortcut = "Control|W"
- class ="MonoDevelop.Commands.CloseFile"/>
- <MenuItem id = "CloseAllFiles"
- _label = "Close All"
- description = "Close All Files"
- icon = "Icons.16x16.CloseIcon"
- shortcut = "Control|Shift|W"
- class = "MonoDevelop.Commands.CloseAllFiles"/>
- </Conditional>
- <Conditional iscombineopen="True" action="Disable">
- <MenuItem id = "CloseCombine"
- _label = "Close Sol_ution"
- description = "${res:XML.MainMenu.FileMenu.Close.Project.Desription}"
- icon = "Icons.16x16.CloseCombineIcon"
- class = "MonoDevelop.Commands.ClearCombine"/>
- </Conditional>
-
- <MenuItem id = "ReloadSeparator" _label = "-" />
- <MenuItem id = "Reloadfile"
- _label = "_Reload File"
- shortcut = "Control|U"
- description = "${res:XML.MainMenu.FileMenu.Reload.Description}"
- class = "MonoDevelop.Commands.ReloadFile" />
+ <Extension path = "/SharpDevelop/Workbench/MainMenu">
+ <ItemSet id = "File" _label = "_File">
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.NewFile" />
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.NewProject" />
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.OpenFile" />
+ <SeparatorItem id = "OpenSep" />
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.Save" />
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.SaveAs" />
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.SaveAll" />
+ <SeparatorItem id = "SaveSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.CloseFile" />
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.CloseAllFiles" />
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.CloseCombine" />
+ <SeparatorItem id = "ReloadSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.ReloadFile" />
- <MenuItem id = "SaveSeparator" _label = "-" />
+ <SeparatorItem id = "RecentSeparator" />
+ <ItemSet id = "RecentFiles" _label = "Recent _Files">
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.RecentFileList" />
+ <SeparatorItem id = "RecentFilesSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.ClearRecentFiles" />
+ </ItemSet>
- <Conditional activewindow="*" action="Disable">
- <MenuItem id = "_Save"
- _label = "_Save"
- icon = "Icons.16x16.SaveIcon"
- description = "${res:XML.MainMenu.FileMenu.Save.Description}"
- shortcut = "Control|S"
- class = "MonoDevelop.Commands.SaveFile"/>
- <MenuItem id = "SaveAs"
- _label = "Save _As..."
- icon = "Icons.16x16.SaveAsIcon"
- description = "${res:XML.MainMenu.FileMenu.SaveAs.Description}"
- class = "MonoDevelop.Commands.SaveFileAs"/>
- <MenuItem id = "SaveAll"
- _label = "Save A_ll"
- icon = "Icons.16x16.SaveAllIcon"
- shortcut = "Control|Shift|S"
- description = "${res:XML.MainMenu.FileMenu.SaveAll.Description}"
- class = "MonoDevelop.Commands.SaveAllFiles"/>
- </Conditional>
- <!--
- <MenuItem id = "PrintSeparator" _label = "-" />
- <Conditional activewindow="*" action="Disable">
- <MenuItem id = "Print"
- _label = "${res:XML.MainMenu.FileMenu.Print}"
- icon = "Icons.16x16.Print"
- description = "${res:XML.MainMenu.FileMenu.Print.Description}"
- shortcut = "Control|P"
- class = "MonoDevelop.Commands.Print"/>
- <MenuItem id = "PrintPreview"
- _label = "${res:XML.MainMenu.FileMenu.PrintPreview}"
- icon = "Icons.16x16.PreView"
- description = "${res:XML.MainMenu.FileMenu.PrintPreview.Description}"
- class = "MonoDevelop.Commands.PrintPreview"/>
- </Conditional>
- -->
- <MenuItem id = "RecentSeparator" _label = "-" />
- <MenuItem id = "RecentFiles" attribute = "RecentFiles" _label = "Recent _Files">
- <MenuItem id = "RecentFilesBuilder" _label = "bogus_label" class = "MonoDevelop.Commands.RecentFilesMenuBuilder" />
- <MenuItem id = "RecentFilesSeparator" _label = "-" />
- <MenuItem id = "ClearRecentFiles"
- _label = "_Clear Recent Files"
- description = "${res:XML.MainMenu.FileMenu.ClearRecentFiles.Description}"
- class = "MonoDevelop.Commands.ClearRecentFiles" />
- </MenuItem>
-
- <MenuItem id = "RecentProjects" attribute = "RecentProjects" _label = "Recent Solu_tions">
- <MenuItem id = "RecentProjectsBuilder" _label = "bogus_label" class = "MonoDevelop.Commands.RecentProjectsMenuBuilder" />
- <MenuItem id = "RecentProjectsSeparator" _label = "-" />
- <MenuItem id = "ClearRecentFiles"
- _label = "_Clear Recent Solutions"
- description = "${res:XML.MainMenu.FileMenu.ClearRecentProjects.Description}"
- class = "MonoDevelop.Commands.ClearRecentProjects" />
- </MenuItem>
-
- <MenuItem id = "ExitSeparator" _label = "-" />
- <MenuItem id = "Exit"
- _label = "_Quit"
- icon = "Icons.16x16.QuitIcon"
- description = "${res:XML.MainMenu.FileMenu.Exit.Description}"
- shortcut = "Control|Q"
- class = "MonoDevelop.Commands.ExitWorkbenchCommand" />
- </MenuItem>
+ <ItemSet id = "RecentProjects" _label = "Recent Solu_tions">
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.RecentProjectList" />
+ <SeparatorItem id = "RecentProjectsSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.ClearRecentProjects" />
+ </ItemSet>
+
+ <SeparatorItem id = "ExitSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.Exit" />
+ </ItemSet>
- <MenuItem id = "Edit" _label = "_Edit">
- <Conditional activewindow="*" action="Disable">
- <MenuItem id = "Undo"
- _label = "_Undo"
- icon = "Icons.16x16.UndoIcon"
- description = "${res:XML.MainMenu.EditMenu.Undo.Description}"
- shortcut = "Control|Z"
- class = "MonoDevelop.Commands.Undo"/>
- <MenuItem id = "Redo"
- _label = "_Redo"
- icon = "Icons.16x16.RedoIcon"
- description = "${res:XML.MainMenu.EditMenu.Redo.Description}"
- shortcut = "Control|Y"
- class = "MonoDevelop.Commands.Redo"/>
- </Conditional>
- <MenuItem id = "Separator1" _label = "-" />
- <Conditional activewindow="*" action="Disable">
- <MenuItem id = "Cut"
- _label = "Cu_t"
- icon = "Icons.16x16.CutIcon"
- description = "${res:XML.MainMenu.EditMenu.Cut.Description}"
- shortcut = "Control|X"
- class = "MonoDevelop.Commands.Cut"/>
- <MenuItem id = "Copy"
- _label = "_Copy"
- icon = "Icons.16x16.CopyIcon"
- description = "${res:XML.MainMenu.EditMenu.Copy.Description}"
- shortcut = "Control|C"
- class = "MonoDevelop.Commands.Copy"/>
- <MenuItem id = "Paste"
- _label = "_Paste"
- icon = "Icons.16x16.PasteIcon"
- description = "${res:XML.MainMenu.EditMenu.Paste.Description}"
- shortcut = "Control|V"
- class = "MonoDevelop.Commands.Paste"/>
- <MenuItem id = "Delete"
- _label = "_Delete"
- icon = "Icons.16x16.DeleteIcon"
- description = "${res:XML.MainMenu.EditMenu.Delete.Description}"
- class = "MonoDevelop.Commands.Delete"/>
- <MenuItem id = "SelectAll"
- _label = "Select _All"
- description = "${res:XML.MainMenu.EditMenu.SelectAll.Description}"
- shortcut = "Control|A"
- class = "MonoDevelop.Commands.SelectAll"/>
- <MenuItem id = "Separator4" _label = "-" />
- <MenuItem id = "CommentCode"
- shortcut = "Control|Alt|C"
- _label = "C_omment Line(s)"
- class = "MonoDevelop.Commands.CommentCode"/>
- <MenuItem id = "UncommentCode"
- shortcut = "Control|Alt|U"
- _label = "_Uncomment Line(s)"
- class = "MonoDevelop.Commands.UncommentCode"/>
- <MenuItem id = "IndentSelection"
- shortcut = "Control|Alt|Home"
- _label = "_Indent Selection"
- class = "MonoDevelop.Commands.IndentSelection"/>
- <MenuItem id = "UnIndentSelection"
- shortcut = "Control|Alt|End"
- _label = "_Unindent Selection"
- class = "MonoDevelop.Commands.UnIndentSelection"/>
- </Conditional>
- <MenuItem id = "Separator5" _label = "-" />
- <Conditional action="Disable">
- <Or>
- <Condition activewindow="*"/>
- <Condition iscombineopen="True"/>
- </Or>
- <MenuItem id = "WordCount"
- _label = "_Word Count..."
- description = "${res:XML.MainMenu.EditMenu.WordCount.Description}"
- class = "MonoDevelop.Commands.WordCount"/>
- </Conditional>
- <MenuItem id = "optionssep5" _label = "-" />
- <MenuItem id = "Options"
- _label = "_Preferences"
- icon = "Icons.16x16.Options"
- description = "${res:XML.MainMenu.ToolMenu.Options.Description}"
- class = "MonoDevelop.Commands.OptionsCommand"/>
+ <ItemSet id = "Edit" _label = "_Edit">
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Undo" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Redo" />
+
+ <SeparatorItem id = "Separator1" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Cut" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Copy" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Paste" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.Delete" />
- </MenuItem>
-
- <MenuItem id = "View" _label = "_View">
- <MenuItem id = "ViewBuilder" _label = "" class = "MonoDevelop.Commands.ViewMenuBuilder" />
- <MenuItem id = "ViewItemsSeparator" _label = "-" />
- <MenuItem id = "ViewLayouts" _label = "_Layouts">
- <MenuItem id = "ViewLayoutsBuilder" _label = "" class = "MonoDevelop.Commands.LayoutsMenuBuilder" />
- <MenuItem id = "ViewLayoutsSeparator" _label = "-" />
- <MenuItem id = "ViewLayoutsNew" _label = "_New" class = "MonoDevelop.Commands.NewLayoutCommand" />
- </MenuItem>
- <MenuItem id = "ViewItemsSeparator2" _label = "-" />
- <MenuItem id = "FullScreen"
- _label = "_Full Screen"
- icon = "Icons.16x16.FullScreen"
- shortcut = "F11"
- description = "${res:XML.MainMenu.ViewMenu.FullScreen.Description}"
- class = "MonoDevelop.Commands.ToggleFullscreenCommand" />
- </MenuItem>
+ <SeparatorItem id = "Separator2" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.SelectAll" />
+
+ <SeparatorItem id = "Separator4" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.CommentCode" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.UncommentCode" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.IndentSelection" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.UnIndentSelection" />
+
+ <SeparatorItem id = "Separator5" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.WordCount" />
+
+ <SeparatorItem id = "optionssep5" />
+ <CommandItem id = "MonoDevelop.Commands.EditCommands.MonodevelopPreferences" />
+ </ItemSet>
- <!-- <Conditional iscombineopen="True">
- <MenuItem id = "Project" _label = "${res:XML.MainMenu.ProjectMenu}">
- <Conditional activeproject="*" action="Disable">
- <MenuItem id = "RunTests"
- _label = "${res:XML.MainMenu.ProjectMenu.RunTests}"
- description = "${res:XML.MainMenu.ProjectMenu.RunTests.Description}"
- class = "MonoDevelop.Commands.RunTestsInProject"/>
-
- <MenuItem id = "Deploy"
- _label = "${res:XML.MainMenu.ProjectMenu.Deploy}"
- description = "${res:XML.MainMenu.ProjectMenu.Deploy.Description}"
- class = "MonoDevelop.Commands.DeployProject"/>
- <MenuItem id = "Separator1" _label = "-" />
- <MenuItem id = "ViewDocumentation"
- _label = "${res:ProjectComponent.ContextMenu.ViewDocumentation}"
- class = "MonoDevelop.Commands.ViewProjectDocumentation"/>
-
- <MenuItem id = "GenerateDocumentation"
- _label = "${res:ProjectComponent.ContextMenu.GenerateDocumentation}"
- class = "MonoDevelop.Commands.GenerateProjectDocumentation"/>
-
- <MenuItem id = "Separator2" _label = "-" />
- <MenuItem id = "Options"
- _label = "${res:XML.MainMenu.ProjectMenu.Options}"
- description = "${res:XML.MainMenu.ProjectMenu.Options.Description}"
- class = "MonoDevelop.Commands.ViewProjectOptions"/>
- </Conditional>
- </MenuItem>
- </Conditional> -->
+ <ItemSet id = "View" _label = "_View">
+ <CommandItem id = "MonoDevelop.Commands.ViewCommands.ViewList" />
+ <SeparatorItem id = "ViewItemsSeparator" />
+ <ItemSet id = "ViewLayouts" _label = "_Layouts">
+ <CommandItem id = "MonoDevelop.Commands.ViewCommands.LayoutList" />
+ <SeparatorItem id = "ViewItemsSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.ViewCommands.NewLayout" />
+ </ItemSet>
+ <SeparatorItem id = "ViewItemsSeparator2" />
+ <CommandItem id = "MonoDevelop.Commands.ViewCommands.FullScreen" />
+ </ItemSet>
- <MenuItem id = "Run" _label = "_Run">
- <Conditional action="Disable">
- <Or>
- <Condition activewindow="MonoDevelop.SourceEditor.Gui.SourceEditorDisplayBindingWrapper"/>
- <Condition iscombineopen="True"/>
- </Or>
-
- <MenuItem id = "Compile"
- _label = "_Compile"
- description = "${res:XML.MainMenu.RunMenu.Compile.Description}"
- shortcut = "F8"
- icon = "Icons.16x16.BuildCombine"
- class = "MonoDevelop.Commands.Compile"/>
- <MenuItem id = "CompileAll"
- _label = "Compile _All"
- description = "${res:XML.MainMenu.RunMenu.CompileAll.Description}"
- shortcut = "Control|F8"
- class = "MonoDevelop.Commands.CompileAll"/>
- <MenuItem id = "Separator1" _label = "-" />
- <!-- <Conditional activeproject="*">
- <MenuItem id = "BuildProject"
- _label = "${res:XML.MainMenu.RunMenu.BuildProject}"
- description = "${res:XML.MainMenu.RunMenu.BuildProject.Description}"
- shortcut = "F9"
- icon = "Icons.16x16.BuildCurrentSelectedProject"
- class = "MonoDevelop.Commands.BuildCurrentProject"/>
- <MenuItem id = "RebuildProject"
- _label = "${res:XML.MainMenu.RunMenu.RebuildProject}"
- description = "${res:XML.MainMenu.RunMenu.RebuildProject.Description}"
- shortcut = "Alt|F9"
- class = "MonoDevelop.Commands.RebuildCurrentProject"/>
- <MenuItem id = "Separator2" _label = "-" />
- </Conditional> -->
- <MenuItem id = "Run"
- _label = "_Run"
- icon = "Icons.16x16.RunProgramIcon"
- description = "${res:XML.MainMenu.RunMenu.Run.Description}"
- shortcut = "F5"
- class = "MonoDevelop.Commands.RunCommand"/>
- <!-- <MenuItem id = "GenerateMakefiles"
- _label = "Generate Makefiles"
- class = "MonoDevelop.Commands.GenerateMakefiles"/>-->
-
- </Conditional>
- </MenuItem>
+ <ItemSet id = "Run" _label = "_Run">
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.Compile" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.Build" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.Rebuild" />
+ <SeparatorItem id = "Separator1" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.Run" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.Debug" />
+ <SeparatorItem id = "Separator2" />
+ <CommandItem id = "MonoDevelop.Commands.ProjectCommands.Stop" />
+ </ItemSet>
- <MenuItem id = "Tools"
- _label = "Tools">
- <MenuItem id = "ToolBuilder" _label = "bogus_label" class = "MonoDevelop.Commands.ToolMenuBuilder" />
- <!-- <MenuItem id = "Separator1" _label = "-" /> -->
-
- <!-- <MenuItem id = "Separator4" _label = "-" /> -->
- <!-- <Conditional action = "Disable">
- <Or>
- <Condition activewindow="MonoDevelop.FormDesigner.FormDesignerDisplayBindingWrapper"/>
- <Condition activewindow="MonoDevelop.FormDesigner.CSharpDesignerDisplayBindingWrapper"/>
- <Condition activewindow="MonoDevelop.DefaultEditor.Gui.Editor.TextEditorDisplayBindingWrapper"/>
- </Or>
- <MenuItem id = "ConvertBuffer"
- _label = "${res:XML.MainMenu.ToolMenu.ConvertBufferToVBNET}"
- description = "${res:XML.MainMenu.ToolMenu.ConvertBufferToVBNET.Description}"
- class = "MonoDevelop.Commands.VBConvertBuffer"/>
- </Conditional> -->
-
- <!-- ORIGINAL #D COMMENT <MenuItem id = "ConvertProject"
- _label = "Convert C# Project to VB.NET"
- description = "Converts the current selected C# project to VB.NET"
- class = "MonoDevelop.Commands.VBConvertProject"/>-->
-
- <!-- <MenuItem id = "Separator5" _label = "-" /> -->
-
- </MenuItem>
+ <ItemSet id = "Tools" _label = "Tools">
+ <CommandItem id = "MonoDevelop.Commands.ToolCommands.ToolList" />
+ </ItemSet>
-<!-- ORIGINAL #D COMMENT <MenuItem id = "AddIns" _label = "${res:XML.MainMenu.PluginMenu}">
- <MenuItem _label = "-" />
- <MenuItem _label = "${res:XML.MainMenu.PluginMenu.Manager}" description = "${res:XML.MainMenu.PluginMenu.Manager.Description}" class = "SharpDevelop.Actions.Edit.ShowPlugInManager"/>
- </MenuItem>-->
+ <ItemSet id = "Window" _label = "_Window">
+ <CommandItem id = "MonoDevelop.Commands.WindowCommands.NextWindow" />
+ <CommandItem id = "MonoDevelop.Commands.WindowCommands.PrevWindow" />
+ <SeparatorItem id ="NxtPrvSeparator" />
+ <CommandItem id = "MonoDevelop.Commands.FileCommands.CloseAllFiles" />
+ <SeparatorItem id = "contentSep" />
+ <CommandItem id = "MonoDevelop.Commands.WindowCommands.OpenWindowList" />
+ </ItemSet>
- <MenuItem id = "Window" _label = "_Window">
- <Conditional action="Disable">
- <Condition activewindow="*" />
- <MenuItem id = "NextWindow"
- _label = "_Next Window"
- icon = "Icons.16x16.NextWindowIcon"
- description = "${res:XML.MainMenu.WindowMenu.NxtWindow.Description}"
- shortcut = "Control|Page_Down"
- class = "MonoDevelop.Commands.SelectNextWindow" />
- <MenuItem id = "PrevWindow"
- _label = "_Previous Window"
- icon = "Icons.16x16.PrevWindowIcon"
- description = "${res:XML.MainMenu.WindowMenu.PrvWindow.Description}"
- shortcut = "Control|Page_Up"
- class = "MonoDevelop.Commands.SelectPrevWindow" />
- <MenuItem id ="NxtPrvSeparator" _label = "-" />
- <MenuItem id = "CloseAll"
- _label = "_Close All"
- icon = "Icons.16x16.CloseAllDocuments"
- description = "${res:XML.MainMenu.FileMenu.CloseAll.Description}"
- class = "MonoDevelop.Commands.CloseAllWindows" />
- </Conditional>
-<MenuItem id = "contentSep" _label = "-" />
- <MenuItem id = "ContentBuilder" _label = "bogus_label" class="MonoDevelop.Commands.OpenContentsMenuBuilder"/>
- </MenuItem>
-
- <MenuItem id = "Help" _label = "_Help">
- <!--<MenuItem id = "Help"
- _label = "_Help..."
- icon = "Icons.16x16.HelpIcon"
- description = "${res:XML.MainMenu.HelpMenu.Topics.Description}"
- shortcut = "Alt|F1"
- class = "MonoDevelop.Commands.ShowHelp"/>-->
- <MenuItem id = "TipOfTheDay"
- _label = "_Tip of the Day..."
- icon = "Icons.16x16.TipOfTheDay"
- description = "${res:XML.MainMenu.HelpMenu.Tips.Description}"
- class = "MonoDevelop.Commands.ViewTipOfTheDay" />
-
-<!-- <MenuItem id = "Separator1" _label = "-" />
- <MenuItem id = "ViewGPL"
- _label = "${res:XML.MainMenu.HelpMenu.GPL}"
- icon = "Icons.16x16.CopyLeftIcon"
- description = "${res:XML.MainMenu.HelpMenu.GPL.Description}"
- class = "MonoDevelop.Commands.ViewGPL" /> -->
-
- <!-- <MenuItem id = "ViewReadme"
- _label = "${res:XML.MainMenu.HelpMenu.ReadMe}"
- description = "${res:XML.MainMenu.HelpMenu.ReadMe.Description}"
- link = "home://../doc/ReadMe.html" />
- <MenuItem id = "ViewStyleguide"
- _label = "${res:XML.MainMenu.HelpMenu.StyleGuide}"
- description = "${res:XML.MainMenu.HelpMenu.StyleGuide.Description}"
- link = "home://../doc/CodingStyleGuide.pdf" /> -->
- <MenuItem id = "Separator2" _label = "-" />
- <MenuItem id = "Web" _label = "_Web">
- <!-- <MenuItem id = "ASP" _label = "&AlphaSierraPapa" icon = "Icons.16x16.WebSearchIcon" description = "Visit my sponsors" link = "http://www.alphasierrapapa.com/" /> -->
- <MenuItem id = "MonoDevelop" _label = "MonoDevelop" icon = "Icons.16x16.WebSearchIcon" link = "http://www.monodevelop.com" />
- <!-- <MenuItem id = "SharpDevelop" _label = "SharpDevelop">
- <MenuItem id = "Downloads" _label = "Downloads" icon = "Icons.16x16.WebSearchIcon" link = "http://www.icsharpcode.net/opensource/sd/download/" />
- <MenuItem id = "Forum" _label = "Community Forums" icon = "Icons.16x16.WebSearchIcon" link = "http://www.icsharpcode.net/opensource/sd/forum/" />
- <MenuItem id = "Announcement" _label = "Announcement List" icon = "Icons.16x16.WebSearchIcon" link = "http://www.icsharpcode.net/opensource/sd/announcementlist.asp" />
- <MenuItem id = "Mail" _label = "Send Us a Mail" icon = "Icons.16x16.WebSearchIcon" link = "http://www.icsharpcode.net/opensource/sd/ContactUs.asp" />
- </MenuItem> -->
- <MenuItem id = "C#" _label = "C#">
- <MenuItem id = "cshrp.net" _label = "cshrp.net" icon = "Icons.16x16.WebSearchIcon" link = "http://www.cshrp.net/" />
- <MenuItem id = "C# Help" _label = "C# Help" icon = "Icons.16x16.WebSearchIcon" link = "http://www.csharphelp.com" />
- <MenuItem id = "C# Corner" _label = "C# Corner" icon = "Icons.16x16.WebSearchIcon" link = "http://www.c-sharpcorner.com" />
- <MenuItem id = "GotDotNet" _label = "GotDotNet" icon = "Icons.16x16.WebSearchIcon" description = "Visit one of the best NET sites on the web" link = "http://www.gotdotnet.com/" />
- </MenuItem>
- <!-- <MenuItem id = "IntegratedProjects" _label = "Integrated Projects">
- <MenuItem id = "Magic Library" _label = "Magic Library" icon = "Icons.16x16.WebSearchIcon" description = "One of the best .NET control libraries around." link = "http://www.dotnetmagic.com" />
- <MenuItem id = "NAnt" _label = "NAnt" icon = "Icons.16x16.WebSearchIcon" description = "THE .NET building tool." link = "http://nant.sourceforge.net/" />
- <MenuItem id = "NDoc" _label = "NDoc" icon = "Icons.16x16.WebSearchIcon" description = "I used the NDoc as the SharpDevelop documentation generator. Look out it is cool." link = "http://ndoc.sourceforge.net/" />
- <MenuItem id = "#ZipLib" _label = "#ZipLib" icon = "Icons.16x16.WebSearchIcon" description = "I used the NDoc as the SharpDevelop documentation generator. Look out it is cool." link = "http://www.icsharpcode.net/OpenSource/NZipLib" />
- <MenuItem id = "#CvsLib" _label = "#CvsLib" icon = "Icons.16x16.WebSearchIcon" description = "I used the NDoc as the SharpDevelop documentation generator. Look out it is cool." link = "http://www.icsharpcode.net/OpenSource/NetCvsLib" />
- </MenuItem> -->
- <MenuItem id = "Mono" _label = "Mono Project" icon = "Icons.16x16.WebSearchIcon" description = "A free .NET implementation effort, worth visiting" link = "http://www.go-mono.com" />
- </MenuItem>
- <MenuItem id = "Separator3" _label = "-" />
- <MenuItem id = "About"
- _label = "_About"
- icon = "Icons.16x16.AboutIcon"
- description = "${res:XML.MainMenu.HelpMenu.About.Description}"
- class = "MonoDevelop.Commands.AboutSharpDevelop" />
- </MenuItem>
+ <ItemSet id = "Help" _label = "_Help">
+ <CommandItem id = "MonoDevelop.Commands.HelpCommands.TipOfTheDay" />
+ <SeparatorItem id = "Separator2" />
+ <ItemSet id = "Web" _label = "_Web">
+ <LinkItem id = "MonoDevelop" _label = "MonoDevelop" link = "http://www.monodevelop.com" />
+ <ItemSet id = "C#" _label = "C#">
+ <LinkItem id = "cshrp.net" _label = "cshrp.net" link = "http://www.cshrp.net/" />
+ <LinkItem id = "C# Help" _label = "C# Help" link = "http://www.csharphelp.com" />
+ <LinkItem id = "C# Corner" _label = "C# Corner" link = "http://www.c-sharpcorner.com" />
+ <LinkItem id = "GotDotNet" _label = "GotDotNet" description = "Visit one of the best NET sites on the web" link = "http://www.gotdotnet.com/" />
+ </ItemSet>
+ <LinkItem id = "Mono" _label = "Mono Project" description = "A free .NET implementation effort, worth visiting" link = "http://www.mono-project.com" />
+ </ItemSet>
+ <SeparatorItem id = "Separator3" />
+ <CommandItem id = "MonoDevelop.Commands.HelpCommands.About" />
+ </ItemSet>
</Extension>
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/File/DefaultFileService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/File/DefaultFileService.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/File/DefaultFileService.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -15,6 +15,7 @@
using MonoDevelop.Core.Services;
using MonoDevelop.Internal.Project;
using MonoDevelop.Gui;
+using MonoDevelop.Gui.Widgets;
using MonoDevelop.Core.AddIns.Codons;
using MonoDevelop.Gui.Utils;
@@ -297,7 +298,70 @@
Directory.CreateDirectory (path);
OnFileCreated (new FileEventArgs (path, true));
}
-
+
+ public void SaveFile (IWorkbenchWindow window)
+ {
+ if (window.ViewContent.ContentName == null) {
+ SaveFileAs (window);
+ } else {
+ FileAttributes attr = FileAttributes.ReadOnly | FileAttributes.Directory | FileAttributes.Offline | FileAttributes.System;
+ // FIXME
+ // bug #59731 is if the file is moved out from under us, we were crashing
+ // I changed it to make it ask for a new
+ // filename instead, but maybe we should
+ // detect the move and update the reference
+ // to the name instead
+ if (!File.Exists (window.ViewContent.ContentName) || (File.GetAttributes(window.ViewContent.ContentName) & attr) != 0) {
+ SaveFileAs (window);
+ } else {
+ Runtime.ProjectService.MarkFileDirty (window.ViewContent.ContentName);
+ string fileName = window.ViewContent.ContentName;
+ // save backup first
+ if((bool) Runtime.Properties.GetProperty ("SharpDevelop.CreateBackupCopy", false)) {
+ Runtime.FileUtilityService.ObservedSave (new NamedFileOperationDelegate(window.ViewContent.Save), fileName + "~");
+ }
+ Runtime.FileUtilityService.ObservedSave (new NamedFileOperationDelegate(window.ViewContent.Save), fileName);
+ }
+ }
+ }
+
+ public void SaveFileAs (IWorkbenchWindow window)
+ {
+ if (window.ViewContent is ICustomizedCommands) {
+ if (((ICustomizedCommands)window.ViewContent).SaveAsCommand()) {
+ return;
+ }
+ }
+
+ FileSelector fdiag = new FileSelector (GettextCatalog.GetString ("Save as..."), Gtk.FileChooserAction.Save);
+ fdiag.SetFilename (window.ViewContent.ContentName);
+ int response = fdiag.Run ();
+ string filename = fdiag.Filename;
+ fdiag.Hide ();
+
+ if (response == (int)Gtk.ResponseType.Ok) {
+ if (!Runtime.FileUtilityService.IsValidFileName (filename)) {
+ Runtime.MessageService.ShowMessage(String.Format (GettextCatalog.GetString ("File name {0} is invalid"), filename));
+ return;
+ }
+ // detect preexisting file
+ if(File.Exists(filename)){
+ if(!Runtime.MessageService.AskQuestion(String.Format (GettextCatalog.GetString ("File {0} already exists. Overwrite?"), filename))){
+ return;
+ }
+ }
+ // save backup first
+ if((bool) Runtime.Properties.GetProperty ("SharpDevelop.CreateBackupCopy", false)) {
+ Runtime.FileUtilityService.ObservedSave (new NamedFileOperationDelegate(window.ViewContent.Save), filename + "~");
+ }
+
+ // do actual save
+ if (Runtime.FileUtilityService.ObservedSave (new NamedFileOperationDelegate(window.ViewContent.Save), filename) == FileOperationResult.OK) {
+ Runtime.FileService.RecentOpen.AddLastFile (filename, null);
+ }
+ }
+ }
+
protected virtual void OnFileCreated (FileEventArgs e)
{
if (FileCreated != null) {
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/File/IFileService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/File/IFileService.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/File/IFileService.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -47,6 +47,9 @@
/// </remarks>
IWorkbenchWindow GetOpenFile(string fileName);
+ void SaveFile (IWorkbenchWindow window);
+ void SaveFileAs (IWorkbenchWindow window);
+
/// <remarks>
/// Removes a file physically
/// CAUTION : Use only this file for a remove operation, because it is important
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/IDebuggerService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/IDebuggerService.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/IDebuggerService.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -28,7 +28,7 @@
void Pause ();
void Resume ();
- void Run (string[] args);
+ void Run (IProgressMonitor monitor, string[] args);
void Stop ();
void StepInto ();
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/IProjectService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/IProjectService.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/IProjectService.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -41,12 +41,23 @@
}
/// <remarks>
+ /// Gets the current selected combine or project.
+ /// </remarks>
+ CombineEntry CurrentSelectedCombineEntry {
+ get;
+ }
+
+ /// <remarks>
/// Gets the root combine, if no combine is open it returns null.
/// </remarks>
Combine CurrentOpenCombine {
get;
}
+ IAsyncOperation CurrentBuildOperation { get; }
+
+ IAsyncOperation CurrentRunOperation { get; }
+
bool IsCombineEntryFile (string filename);
/// <remarks>
@@ -81,43 +92,34 @@
void CloseCombine(bool saveCombinePreferencies);
/// <remarks>
- /// Compile the root combine.
+ /// Builds the provided project or combine
/// </remarks>
- IAsyncOperation BuildActiveCombine();
+ IAsyncOperation Build (CombineEntry entry);
/// <remarks>
- /// Compile the root combine. Forces Recompile for all projects.
+ /// Rebuilds the provided project or combine
/// </remarks>
- IAsyncOperation RebuildActiveCombine();
+ IAsyncOperation Rebuild (CombineEntry entry);
- /// <remarks>
- /// Compiles the active project, if the project isn't dirty this
- /// method does nothing
- /// </remarks>
- IAsyncOperation BuildActiveProject ();
+ IAsyncOperation BuildFile (string file);
- /// <remarks>
- /// Compiles the active project (forced!)
- /// </remarks>
- IAsyncOperation RebuildActiveProject ();
+ IAsyncOperation Execute (CombineEntry entry);
+ IAsyncOperation ExecuteFile (string sourceFile);
- /// <remarks>
- /// Compiles a specific project, if the project isn't dirty this
- /// method does nothing
- /// </remarks>
- IAsyncOperation BuildProject (Project project);
+ IAsyncOperation Debug (CombineEntry entry);
+ IAsyncOperation DebugFile (string sourceFile);
- /// <remarks>
- /// Compiles a specific project (forced!)
- /// </remarks>
- IAsyncOperation RebuildProject (Project project);
+ void Deploy (Project project);
- IAsyncOperation BuildFile (string file);
+ void ShowOptions (CombineEntry entry);
- IAsyncOperation ExecuteActiveCombine ();
- IAsyncOperation ExecuteProject (Project project);
- IAsyncOperation ExecuteFile (string sourceFile);
+ CombineEntry CreateProject (Combine parentCombine);
+ CombineEntry CreateCombine (Combine parentCombine);
+ CombineEntry AddCombineEntry (Combine parentCombine);
+ ProjectFile CreateProjectFile (Project parentProject, string basePath);
+ bool AddReferenceToProject (Project project);
+
/// <remarks>
/// Opens a new root combine, closes the old root combine automatically.
/// </remarks>
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/ProjectService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/ProjectService.cs 2005-04-25 17:50:19 UTC (rev 2473)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/ProjectService.cs 2005-04-25 20:35:11 UTC (rev 2474)
@@ -14,6 +14,8 @@
using System.Threading;
using MonoDevelop.Gui;
+using MonoDevelop.Gui.Dialogs;
+using MonoDevelop.Gui.Widgets;
using MonoDevelop.Internal.Project;
using MonoDevelop.Internal.Serialization;
@@ -40,8 +42,8 @@
DataContext dataContext = new DataContext ();
ProjectBindingCodon[] projectBindings;
- IAsyncOperation currentBuildOperation;
- IAsyncOperation currentRunOperation;
+ IAsyncOperation currentBuildOperation = NullAsyncOperation.Success;
+ IAsyncOperation currentRunOperation = NullAsyncOperation.Success;
FileFormatManager formatManager = new FileFormatManager ();
IFileFormat defaultProjectFormat = new MdpFileFormat ();
@@ -54,7 +56,7 @@
return currentProject;
}
set {
- Debug.Assert(openCombine != null);
+ System.Diagnostics.Debug.Assert(openCombine != null);
currentProject = value;
OnCurrentProjectChanged(new ProjectEventArgs(currentProject));
}
@@ -65,12 +67,29 @@
return currentCombine;
}
set {
- Debug.Assert(openCombine != null);
+ System.Diagnostics.Debug.Assert(openCombine != null);
currentCombine = value;
OnCurrentSelectedCombineChanged(new CombineEventArgs(currentCombine));
}
}
+ public CombineEntry CurrentSelectedCombineEntry {
+ get {
+ if (currentProject != null)
+ return currentProject;
+ else
+ return currentCombine;
+ }
+ }
+
+ public IAsyncOperation CurrentBuildOperation {
+ get { return currentBuildOperation; }
+ }
+
+ public IAsyncOperation CurrentRunOperation {
+ get { return currentRunOperation; }
+ }
+
public Combine CurrentOpenCombine {
get {
return openCombine;
@@ -313,52 +332,80 @@
}
}
- public IAsyncOperation ExecuteActiveCombine ()
+ public IAsyncOperation Execute (CombineEntry entry)
{
if (openCombine == null) return NullAsyncOperation.Success;
if (currentRunOperation != null && !currentRunOperation.IsCompleted) return currentRunOperation;
+
IProgressMonitor monitor = new NullProgressMonitor ();
- Runtime.DispatchService.ThreadDispatch (new StatefulMessageHandler (ExecuteActiveCombineAsync), monitor);
+ Runtime.DispatchService.ThreadDispatch (new StatefulMessageHandler (ExecuteCombineEntryAsync), new object[] {entry, monitor});
currentRunOperation = monitor.AsyncOperation;
return currentRunOperation;
}
- void ExecuteActiveCombineAsync (object ob)
+ void ExecuteCombineEntryAsync (object ob)
{
- IProgressMonitor monitor = (IProgressMonitor) ob;
-
+ object[] data = (object[]) ob;
+ CombineEntry entry = (CombineEntry) data[0];
+ IProgressMonitor monitor = (IProgressMonitor) data[1];
OnBeforeStartProject ();
try {
- openCombine.Execute (monitor);
+ entry.Execute (monitor);
} catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("Execution failed."), ex);
} finally {
monitor.Dispose ();
}
}
+
+ public IAsyncOperation Debug (CombineEntry entry)
+ {
+ if (openCombine == null) return NullAsyncOperation.Success;
+ if (currentRunOperation != null && !currentRunOperation.IsCompleted) return currentRunOperation;
+
+ WorkbenchSingleton.Workbench.Context = WorkbenchContext.Debug;
- public IAsyncOperation ExecuteProject (Project project)
- {
IProgressMonitor monitor = new NullProgressMonitor ();
- Runtime.DispatchService.ThreadDispatch (new StatefulMessageHandler (ExecuteProjectAsync), new object[] {project, monitor});
- return monitor.AsyncOperation;
+ Runtime.DispatchService.ThreadDispatch (new StatefulMessageHandler (DebugCombineEntryAsync), new object[] {entry, monitor});
+ currentRunOperation = monitor.AsyncOperation;
+ return currentRunOperation;
}
- void ExecuteProjectAsync (object ob)
+ void DebugCombineEntryAsync (object ob)
{
object[] data = (object[]) ob;
- Project project = (Project) data[0];
+ CombineEntry entry = (CombineEntry) data[0];
IProgressMonitor monitor = (IProgressMonitor) data[1];
- OnBeforeStartProject ();
try {
- project.Execute (monitor);
+ entry.Debug (monitor);
} catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("Execution failed."), ex);
} finally {
monitor.Dispose ();
}
+ Runtime.DispatchService.GuiDispatch (new MessageHandler (RestoreWorkbenchContext));
}
+ void RestoreWorkbenchContext ()
+ {
+ WorkbenchSingleton.Workbench.Context = WorkbenchContext.Edit;
+ }
+
+ public IAsyncOperation DebugFile (string file)
+ {
+ Project tempProject = CreateSingleFileProject (file);
+ if (tempProject != null) {
+ IAsyncOperation aop = Debug (tempProject);
+ ProjectOperationHandler h = new ProjectOperationHandler ();
+ h.Project = tempProject;
+ aop.Completed += new OperationHandler (h.Run);
+ return aop;
+ } else {
+ Runtime.MessageService.ShowError(GettextCatalog.GetString ("No runnable executable found."));
+ return NullAsyncOperation.Failure;
+ }
+ }
+
class ProjectOperationHandler {
public Project Project;
public void Run (IAsyncOperation op) { Project.Dispose (); }
@@ -368,7 +415,7 @@
{
Project tempProject = CreateSingleFileProject (file);
if (tempProject != null) {
- IAsyncOperation aop = BuildProject (tempProject);
+ IAsyncOperation aop = Build (tempProject);
ProjectOperationHandler h = new ProjectOperationHandler ();
h.Project = tempProject;
aop.Completed += new OperationHandler (h.Run);
@@ -383,7 +430,7 @@
{
Project tempProject = CreateSingleFileProject (file);
if (tempProject != null) {
- IAsyncOperation aop = ExecuteProject (tempProject);
+ IAsyncOperation aop = Execute (tempProject);
ProjectOperationHandler h = new ProjectOperationHandler ();
h.Project = tempProject;
aop.Completed += new OperationHandler (h.Run);
@@ -394,72 +441,37 @@
}
}
- public IAsyncOperation BuildActiveCombine ()
+ public IAsyncOperation Rebuild (CombineEntry entry)
{
if (openCombine == null) return NullAsyncOperation.Success;
if (currentBuildOperation != null && !currentBuildOperation.IsCompleted) return currentBuildOperation;
-
- DoBeforeCompileAction();
-
- IProgressMonitor monitor = Runtime.TaskService.GetBuildProgressMonitor ();
- Runtime.DispatchService.ThreadDispatch (new StatefulMessageHandler (BuildActiveCombineAsync), monitor);
- currentBuildOperation = monitor.AsyncOperation;
- return currentBuildOperation;
+
+ entry.Clean ();
+ return Build (entry);
}
- void BuildActiveCombineAsync (object ob)
+ public IAsyncOperation Build (CombineEntry entry)
{
- IProgressMonitor monitor = (IProgressMonitor) ob;
- try {
- BeginBuild ();
- ICompilerResult result = openCombine.Build (monitor);
- BuildDone (monitor, result);
- } catch (Exception ex) {
- monitor.ReportError (GettextCatalog.GetString ("Build failed."), ex);
- } finally {
- monitor.Dispose ();
- }
- }
-
- public IAsyncOperation RebuildActiveCombine()
- {
if (openCombine == null) return NullAsyncOperation.Success;
- openCombine.Clean ();
- return BuildActiveCombine ();
- }
-
- public IAsyncOperation BuildActiveProject ()
- {
- if (CurrentSelectedProject == null) {
- Runtime.MessageService.ShowError (GettextCatalog.GetString ("Active project not set."));
- return NullAsyncOperation.Failure;
- }
+ if (currentBuildOperation != null && !currentBuildOperation.IsCompleted) return currentBuildOperation;
+
+ BeforeCompile (entry);
- return BuildProject (CurrentSelectedProject);
- }
-
- public IAsyncOperation RebuildActiveProject ()
- {
- return RebuildProject (CurrentSelectedProject);
- }
-
- public IAsyncOperation BuildProject (Project project)
- {
- BeforeCompile (project);
IProgressMonitor monitor = Runtime.TaskService.GetBuildProgressMonitor ();
- Runtime.DispatchService.ThreadDispatch (new StatefulMessageHandler (BuildProjectAsync), new object[] {project, monitor});
- return monitor.AsyncOperation;
+ Runtime.DispatchService.ThreadDispatch (new StatefulMessageHandler (BuildCombineEntryAsync), new object[] {entry, monitor});
+ currentBuildOperation = monitor.AsyncOperation;
+ return currentBuildOperation;
}
- public void BuildProjectAsync (object ob)
+ public void BuildCombineEntryAsync (object ob)
{
object[] data = (object[]) ob;
- Project project = (Project) data [0];
+ CombineEntry entry = (CombineEntry) data [0];
IProgressMonitor monitor = (IProgressMonitor) data [1];
ICompilerResult result = null;
try {
BeginBuild ();
- result = project.Build (monitor);
+ result = entry.Build (monitor);
BuildDone (monitor, result);
} catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("Build failed."), ex);
@@ -468,12 +480,6 @@
}
}
- public IAsyncOperation RebuildProject (Project project)
- {
- project.Clean ();
- return BuildProject (project);
- }
-
void BeginBuild ()
{
Runtime.TaskService.ClearTasks();
@@ -503,21 +509,24 @@
OnEndBuild (lastResult.FailedBuildCount == 0);
}
- void BeforeCompile (Project project)
+ void BeforeCompile (CombineEntry entry)
{
DoBeforeCompileAction();
- // cut&pasted from CombineEntry.cs
- Runtime.StringParserService.Properties["Project"] = project.Name;
-
- string outputDir = ((AbstractProjectConfiguration)project.ActiveConfiguration).OutputDirectory;
- try {
- DirectoryInfo directoryInfo = new DirectoryInfo(outputDir);
- if (!directoryInfo.Exists) {
- directoryInfo.Create();
+ if (entry is Project) {
+ Project project = (Project) entry;
+
+ Runtime.StringParserService.Properties["Project"] = project.Name;
+
+ string outputDir = ((AbstractProjectConfiguration)project.ActiveConfiguration).OutputDirectory;
+ try {
+ DirectoryInfo directoryInfo = new DirectoryInfo(outputDir);
+ if (!directoryInfo.Exists) {
+ directoryInfo.Create();
+ }
+ } catch (Exception e) {
+ throw new ApplicationException("Can't create project output directory " + outputDir + " original exception:\n" + e.ToString());
}
- } catch (Exception e) {
- throw new ApplicationException("Can't create project output directory " + outputDir + " original exception:\n" + e.ToString());
}
}
@@ -553,7 +562,7 @@
}
break;
default:
- Debug.Assert(false);
+ System.Diagnostics.Debug.Assert(false);
break;
}
}
@@ -633,7 +642,7 @@
void CheckFileRename(object sender, FileEventArgs e)
{
- Debug.Assert(e.SourceFile != e.TargetFile);
+ System.Diagnostics.Debug.Assert(e.SourceFile != e.TargetFile);
if (openCombine != null) {
if (e.IsDirectory) {
RenameDirectoryInAllProjects(e.SourceFile, e.TargetFile);
@@ -643,6 +652,165 @@
}
}
+ public void Deploy (Project project)
+ {
+ foreach (IViewContent viewContent in WorkbenchSingleton.Workbench.ViewContentCollection) {
+ if (viewContent.IsDirty) {
+ viewContent.Save();
+ }
+ }
+ DeployInformation.Deploy (project);
+ }
+
+ public void ShowOptions (CombineEntry entry)
+ {
+ if (entry is Project) {
+ Project selectedProject = (Project) entry;
+
+ IAddInTreeNode generalOptionsNode = AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Workbench/ProjectOptions/GeneralOptions");
+ IAddInTreeNode configurationPropertiesNode = AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Workbench/ProjectOptions/ConfigurationProperties");
+
+ ProjectOptionsDialog optionsDialog = new ProjectOptionsDialog(selectedProject, generalOptionsNode, configurationPropertiesNode);
+ if (optionsDialog.Run() == (int)Gtk.ResponseType.Ok) {
+ selectedProject.NeedsBuilding = true;
+ }
+ } else if (entry is Combine) {
+ Combine combine = (Combine) entry;
+
+ DefaultProperties defaultProperties = new DefaultProperties();
+ defaultProperties.SetProperty ("Combine", combine);
+ TreeViewOptions optionsDialog = new TreeViewOptions (defaultProperties,
+ AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Workbench/CombineOptions"));
+ // optionsDialog.SetDefaultSize = new Size(700, 450);
+ // optionsDialog.FormBorderStyle = FormBorderStyle.FixedDialog;
+ //
+ // optionsDialog.TransientFor = (Gtk.Window)WorkbenchSingleton.Workbench;
+ optionsDialog.Run ();
+ // optionsDialog.Hide ();
+ }
+
+ SaveCombine ();
+ }
+
+ public CombineEntry CreateProject (Combine parentCombine)
+ {
+ return CreateCombineEntry (parentCombine, false);
+ }
+
+ public CombineEntry CreateCombine (Combine parentCombine)
+ {
+ return CreateCombineEntry (parentCombine, true);
+ }
+
+ CombineEntry CreateCombineEntry (Combine parentCombine, bool createCombine)
+ {
+ CombineEntry res = null;
+ NewProjectDialog npdlg = new NewProjectDialog (createCombine);
+ if (npdlg.Run () == (int) Gtk.ResponseType.Ok) {
+ IProgressMonitor monitor = Runtime.TaskService.GetLoadProgressMonitor ();
+ try {
+ if (createCombine)
+ res = parentCombine.AddEntry (npdlg.NewCombineLocation, monitor);
+ else
+ res = parentCombine.AddEntry (npdlg.NewProjectLocation, monitor);
+ }
+ catch {
+ Runtime.MessageService.ShowError (string.Format (GettextCatalog.GetString ("The file '{0}' could not be loaded."), npdlg.NewProjectLocation));
+ res = null;
+ }
+ monitor.Dispose ();
+ }
+
+ npdlg = null;
+
+ if (res != null)
+ SaveCombine ();
+
+ return res;
+ }
+
+ public CombineEntry AddCombineEntry (Combine parentCombine)
+ {
+ CombineEntry res = null;
+
+ using (FileSelector fdiag = new FileSelector (GettextCatalog.GetString ("Add to Solution"))) {
+ fdiag.SelectMultiple = false;
+ if (fdiag.Run () == (int) Gtk.ResponseType.Ok) {
+ try {
+ using (IProgressMonitor monitor = Runtime.TaskService.GetLoadProgressMonitor ()) {
+ res = parentCombine.AddEntry (fdiag.Filename, monitor);
+ }
+ }
+ catch {
+ Runtime.MessageService.ShowError (string.Format (GettextCatalog.GetString ("The file '{0}' could not be loaded."), fdiag.Filename));
+ }
+ }
+
+ fdiag.Hide ();
+ }
+ if (res != null)
+ SaveCombine ();
+
+ return res;
+ }
+
+ public ProjectFile CreateProjectFile (Project parentProject, string basePath)
+ {
+ NewFileDialog nfd = new NewFileDialog ();
+ int res = nfd.Run ();
+ nfd.Dispose ();
+ if (res != (int) Gtk.ResponseType.Ok) return null;
+
+ IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
+ int count = 1;
+
+ string baseName = Path.GetFileNameWithoutExtension(window.ViewContent.UntitledName);
+ string extension = Path.GetExtension(window.ViewContent.UntitledName);
+
+ // first try the default untitled name of the viewcontent filename
+ string fileName = Path.Combine (basePath, baseName + extension);
+
+ // if it is already in the project, or it does exists we try to get a name that is
+ // untitledName + Numer + extension
+ while (parentProject.IsFileInProject (fileName) || System.IO.File.Exists (fileName)) {
+ fileName = Path.Combine (basePath, baseName + count.ToString() + extension);
+ ++count;
+ }
+
+ // now we have a valid filename which we could use
+ window.ViewContent.Save (fileName);
+
+ ProjectFile newFileInformation = new ProjectFile(fileName, BuildAction.Compile);
+ parentProject.ProjectFiles.Add (newFileInformation);
+ return newFileInformation;
+ }
+
+ public bool AddReferenceToProject (Project project)
+ {
+ bool res = false;
+
+ SelectReferenceDialog selDialog = new SelectReferenceDialog(project);
+ if (selDialog.Run() == (int)Gtk.ResponseType.Ok) {
+ ProjectReferenceCollection newRefs = selDialog.ReferenceInformations;
+
+ ArrayList toDelete = new ArrayList ();
+ foreach (ProjectReference refInfo in project.ProjectReferences)
+ if (!newRefs.Contains (refInfo))
+ toDelete.Add (refInfo);
+
+ foreach (ProjectReference refInfo in toDelete)
+ project.ProjectReferences.Remove (refInfo);
+
+ foreach (ProjectReference refInfo in selDialog.ReferenceInformations)
+ if (!project.ProjectReferences.Contains (refInfo))
+ project.ProjectReferences.Add(refInfo);
+
+ res = true;
+ }
+ selDialog.Hide ();
+ return res;
+ }
+
public override void InitializeService()
{
base.InitializeService();
More information about the Monodevelop-patches-list
mailing list