[svn] r7097: vs-plugin/trunk:
Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Refactoring/TestProjectTwo/...
phantom
svnadmin at nemerle.org
Fri Dec 15 20:50:15 CET 2006
Log:
Menu stubs added (not tied up to handler, try to leash them, please).
Author: phantom
Date: Fri Dec 15 20:50:12 2006
New Revision: 7097
Modified:
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Refactoring/TestProjectTwo/Christianity.n
vs-plugin/trunk/Nemerle.VsIntegration/CtcComponents/Guids.h
vs-plugin/trunk/Nemerle.VsIntegration/CtcComponents/PkgCmd.ctc
vs-plugin/trunk/Nemerle.VsIntegration/CtcComponents/PkgCmdID.h
vs-plugin/trunk/Nemerle.VsIntegration/NemerleConstants.cs
vs-plugin/trunk/Nemerle.VsIntegration/NemerlePackage.cs
vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleEditorFactory.cs
vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleMenus.cs
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Refactoring/TestProjectTwo/Christianity.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Refactoring/TestProjectTwo/Christianity.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/Tests/Refactoring/TestProjectTwo/Christianity.n Fri Dec 15 20:50:12 2006
@@ -32,7 +32,7 @@
WriteLine($"I am God, receiving message: $message");
}
- public RobeFirstHumanInFlesh() : void // definition {7} RobeFirstHumanInFlesh //possibly not found definition {7}
+ public RobeFirstHumanInFlesh() : void // definition {7} RobeFirstHumanInFlesh
{
RemoveFirstHumanFrom(Instance); // usage {4}
}
@@ -103,7 +103,7 @@
{
reasons()
}
- def someReasons = (ChristianVision.TheFallOf(firstHuman), God.Instance.RobeFirstHumanInFlesh); // usage {1} // definition {2} someReasons // usage {4} // usage {7} //possibly not found usage {7}
+ def someReasons = (ChristianVision.TheFallOf(firstHuman), God.Instance.RobeFirstHumanInFlesh); // usage {1} // definition {2} someReasons // usage {4} // usage {7}
actualize(someReasons[0]); // usage {2}
actualize(someReasons[1]); // usage {2}
try
Modified: vs-plugin/trunk/Nemerle.VsIntegration/CtcComponents/Guids.h
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/CtcComponents/Guids.h (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/CtcComponents/Guids.h Fri Dec 15 20:50:12 2006
@@ -18,8 +18,21 @@
// Guid of this package
// FBA89739-12DE-4598-9374-DF0082489563
#define guidNemerleProjectPkg {0xfba89739, 0x12de, 0x4598, {0x93, 0x74, 0xdf, 0x00, 0x82, 0x48, 0x95, 0x63} }
-
+//phantom: don't know, it's needed or not
+#ifdef DEFINE_GUID
+DEFINE_GUID(CLSID_guidNemerleProjectCmdSet,
+0xfba89739, 0x12de, 0x4598, 0x93, 0x74, 0xdf, 0x00, 0x82, 0x48, 0x95, 0x63);
+#endif
// Guid of the command set containing the command IDs of this package
// {D6DDF8E8-9A9E-425c-AB18-7BBCC70A6489}
#define guidNemerleProjectCmdSet {0xd6ddf8e8, 0x9a9e, 0x425c, {0xab, 0x18, 0x7b, 0xbc, 0xc7, 0x0a, 0x64, 0x89} }
+//phantom: don't know, it's needed or not
+#ifdef DEFINE_GUID
+DEFINE_GUID(CLSID_guidNemerleProjectCmdSet,
+0xd6ddf8e8, 0x9a9e, 0x425c, 0xab, 0x18, 0x7b, 0xbc, 0xc7, 0x0a, 0x64, 0x89);
+#endif
+
+// Guid of the command set containing the command IDs of this package
+// {EDCC3B7F-0BAD-11DB-BC1A-00112FDE8B61}
+//#define guidNemerleEditorFactory {0xEDCC3B7F, 0x0BAD, 0x11DB, {0xBC, 0x1A, 0x00, 0x11, 0x2F, 0xDE, 0x8B, 0x61} }
Modified: vs-plugin/trunk/Nemerle.VsIntegration/CtcComponents/PkgCmd.ctc
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/CtcComponents/PkgCmd.ctc (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/CtcComponents/PkgCmd.ctc Fri Dec 15 20:50:12 2006
@@ -63,6 +63,9 @@
// use the menu as parent for itself because this it is not supposed to have any parent.
// Menu's ID Parent Priority Type Name Text
+ guidNemerleProjectCmdSet:NemerleTopLevelMenu, guidNemerleProjectCmdSet:VsTopLevelMenuGroup, 0x000, , "NemerleMenu", "&Nemerle" ;
+ guidNemerleProjectCmdSet:Selection, guidNemerleProjectCmdSet:NemerleGroup, 0x000, , "NemerleSelection", "&Selection" ;
+ guidNemerleProjectCmdSet:Refactor, guidNemerleProjectCmdSet:NemerleGroup, 0x000, , "NemerleRefactor", "&Refactor" ;
MENUS_END
@@ -78,6 +81,15 @@
// Group's ID Parent Priority
guidNemerleProjectCmdSet:CodeFileGroup, guidSHLMainMenu:IDM_VS_MENU_PROJECT, 0x600;
+ guidNemerleProjectCmdSet:VsTopLevelMenuGroup, guidSHLMainMenu:IDM_VS_TOOL_MAINMENU, 0x600;
+ guidNemerleProjectCmdSet:NemerleGroup, guidNemerleProjectCmdSet:NemerleTopLevelMenu, 0x600;
+
+ guidNemerleProjectCmdSet:SelectionGroup, guidNemerleProjectCmdSet:Selection, 0x600;
+ guidNemerleProjectCmdSet:RefactorGroup, guidNemerleProjectCmdSet:Refactor, 0x600;
+
+ // TODO: kill it
+ guidNemerleProjectCmdSet:TestMenuGroup, guidSHLMainMenu:IDM_VS_MENU_TOOLS, 0x0600;
+
NEWGROUPS_END
// Button section.
@@ -85,12 +97,31 @@
// or combo box in a toolbar.
BUTTONS_BEGIN
+ // To define a menu group you have to specify its ID, the parent menu and its display priority.
+ // Some commands are not defined as shared, so they use our package CLSID
+ // as the command set GUID. Also, by specifying blank for the FLAGS, the command is
+ // default visible and enabled. Other valid values for FLAGS are the following:
+ // DEFAULTDISABLED, DEFAULTINVISIBLE, DYNAMICVISIBILITY, TEXTCHANGES
+ // These values for FLAGS can be or'ed together, e.g. "DEFAULTINVISIBLE | DYNAMICVISIBILITY"
+ // If you do not want an image next to your command, set the image to "guidOfficeIcon:msotcidNoIcon"
+
// An element inside this section is defined by its ID and must specify a parent group, a display
// priority, an image, a type, some visibility flags (optional) and a default text.
// Command ID, Parent Group Priority, Image, Type, Visibility, Text
guidNemerleProjectCmdSet:cmdidSetAsMain, guidNemerleProjectCmdSet:CodeFileGroup, 0x100, guidOfficeIcon:msotcidNoIcon, BUTTON, DYNAMICVISIBILITY | DEFAULTINVISIBLE, "Set as Main";
+ // TODO: kill it
+ guidNemerleProjectCmdSet:cmdIdTestCommand, guidNemerleProjectCmdSet:TestMenuGroup, 0x0100, guidOfficeIcon:msotcidNoIcon, BUTTON, , "Test (nemerle) command";
+
+ guidNemerleProjectCmdSet:cmdIdExtendSelection, guidNemerleProjectCmdSet:SelectionGroup, 0x100, guidOfficeIcon:msotcidNoIcon, BUTTON, , "&Extend";
+ guidNemerleProjectCmdSet:cmdIdShrinkSelection, guidNemerleProjectCmdSet:SelectionGroup, 0x100, guidOfficeIcon:msotcidNoIcon, BUTTON, , "&Shrink";
+
+ guidNemerleProjectCmdSet:cmdIdRename, guidNemerleProjectCmdSet:RefactorGroup, 0x100, guidOfficeIcon:msotcidNoIcon, BUTTON, , "&Rename...";
+ guidNemerleProjectCmdSet:cmdIdInline, guidNemerleProjectCmdSet:RefactorGroup, 0x100, guidOfficeIcon:msotcidNoIcon, BUTTON, , "&Inline";
+
+ guidNemerleProjectCmdSet:cmdIdOptions, guidNemerleProjectCmdSet:NemerleGroup, 0x100, guidOfficeIcon:msotcidNoIcon, BUTTON, , "&Options...";
+
BUTTONS_END
// The bitmaps section is used to define the bitmaps that are used for the commands.
@@ -122,6 +153,13 @@
guidNemerleProjectCmdSet:CodeFileGroup, guidSHLMainMenu:IDM_VS_CTXT_ITEMNODE, 0x600;
CMDPLACEMENT_END
+VISIBILITY_SECTION
+
+ // Command GUID when visible
+ //phantom: try to play with it only after menu will be fixed (handlers leashing)
+ //guidNemerleProjectCmdSet:cmdIdExtendSelection, guidNemerleEditorFactory;
+
+VISIBILITY_END
// This section is where you can associate a command with a keyboard shortcut; this association is
// valid within a specific UI context, that is when the shell is inside a specific mode, e.g. during
@@ -148,5 +186,8 @@
// the BUTTON section above, so this is its definition:
// Command ID when available emulation keybinding
+ //phantom: try to play with it only after menu will be fixed (handlers leashing)
+ //guidNemerleProjectCmdSet:cmdIdExtendSelection, guidNemerleEditorFactory, guidNemerleEditorFactory, 'W':C;
+ //guidNemerleProjectCmdSet:cmdIdShrinkSelection, guidNemerleEditorFactory, guidNemerleEditorFactory, 'W':CS;
KEYBINDINGS_END
Modified: vs-plugin/trunk/Nemerle.VsIntegration/CtcComponents/PkgCmdID.h
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/CtcComponents/PkgCmdID.h (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/CtcComponents/PkgCmdID.h Fri Dec 15 20:50:12 2006
@@ -17,17 +17,38 @@
/////////////////////////////////////////////////////////////////////
// Menus
//
+#define NemerleTopLevelMenu 0x1001
+#define Selection 0x1002
+#define Refactor 0x1003
/////////////////////////////////////////////////////////////////////
// Menu Groups
//
#define CodeFileGroup 0x2001
+#define VsTopLevelMenuGroup 0x2100
+#define NemerleGroup 0x2101
+
+#define SelectionGroup 0x2102
+#define RefactorGroup 0x2103
+
+#define TestMenuGroup 0x1020
+
/////////////////////////////////////////////////////////////////////
// Commands
//
#define cmdidSetAsMain 0x3001
+#define cmdIdExtendSelection 0x3101
+#define cmdIdShrinkSelection 0x3102
+
+#define cmdIdRename 0x3103
+#define cmdIdInline 0x3104
+
+#define cmdIdOptions 0x3105
+
+#define cmdIdTestCommand 0x100
+
/////////////////////////////////////////////////////////////////////
// Bitmaps
//
Modified: vs-plugin/trunk/Nemerle.VsIntegration/NemerleConstants.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/NemerleConstants.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/NemerleConstants.cs Fri Dec 15 20:50:12 2006
@@ -31,7 +31,7 @@
public const string EditorFactoryGuidString = "EDCC3B7F-0BAD-11DB-BC1A-00112FDE8B61";
public const string FileNodePropertiesGuidString = "EDCC3B80-0BAD-11DB-BC1A-00112FDE8B61";
public const string LibraryGuidString = "EDCC3B81-0BAD-11DB-BC1A-00112FDE8B61";
- public const string ProjectCmdSetGuidString = "EDCC3B82-0BAD-11DB-BC1A-00112FDE8B61";
+ public const string ProjectCmdSetGuidString = "D6DDF8E8-9A9E-425C-AB18-7BBCC70A6489";
public const string LanguageIntellisenseProviderGuidString = "EDCC3B83-0BAD-11DB-BC1A-00112FDE8B61";
public const string EditorLogicalViewGuidString = "EDCC3B84-0BAD-11DB-BC1A-00112FDE8B61";
public const string ProjectFactoryViewGuidString = "EDCC3B85-0BAD-11DB-BC1A-00112FDE8B61";
Modified: vs-plugin/trunk/Nemerle.VsIntegration/NemerlePackage.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/NemerlePackage.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/NemerlePackage.cs Fri Dec 15 20:50:12 2006
@@ -14,6 +14,8 @@
using Nemerle.VisualStudio.LanguageService;
using Nemerle.VisualStudio.Project;
+using System.Diagnostics;
+
namespace Nemerle.VisualStudio
{
#region Registration Attributes
@@ -84,6 +86,8 @@
@"CodeSnippets\SnippetsIndex.xml",
@"CodeSnippets\Snippets\",
@"CodeSnippets\Snippets\")]
+ //phantom: try to play with it only after menu will be fixed (handlers leashing)
+ //[ProvideKeyBindingTable(NemerleConstants.EditorFactoryGuidString, 102)]
#endregion
@@ -118,6 +122,57 @@
//int result = registerEditors.RegisterEditor(ref riid, editorFactory, out cookie);
//NativeMethods.ThrowOnFailure(result);
+
+ registerNemerleCommands();
+ }
+
+ private void registerNemerleCommands()
+ {
+ OleMenuCommandService menuService = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
+ if (menuService != null)
+ {
+ registerCommand(menuService, NemerleMenus.ExtendSelection, new EventHandler(OnExtendSelection));
+ // TODO: change handlers
+ registerCommand(menuService, NemerleMenus.ShrinkSelection, new EventHandler(OnExtendSelection));
+
+ registerCommand(menuService, NemerleMenus.Rename, new EventHandler(OnExtendSelection));
+ registerCommand(menuService, NemerleMenus.Inline, new EventHandler(OnExtendSelection));
+
+ registerCommand(menuService, NemerleMenus.Options, new EventHandler(OnExtendSelection));
+
+ // TODO: kill it
+ registerCommand(menuService, NemerleMenus.TestCommand, new EventHandler(OnExtendSelection));
+ }
+ else
+ Trace.WriteLine("Command Service is null!");
+ }
+
+ private static void registerCommand(OleMenuCommandService service, CommandID commandId, EventHandler handler)
+ {
+ MenuCommand command = new MenuCommand(handler, commandId);
+ service.AddCommand(command);
+ Debug.WriteLine(string.Format("Menu command {0} added", command));
+ }
+
+ //phantom: this handler doesn't want to be leashed, try to do tie it up, guys!
+ private void OnExtendSelection(object sender, EventArgs e)
+ {
+ Debug.WriteLine("Extend Selection called");
+ IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell));
+ Guid clsid = Guid.Empty;
+ int result;
+ uiShell.ShowMessageBox(
+ 0,
+ ref clsid,
+ "Package Name",
+ string.Format(System.Globalization.CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.ToString()),
+ string.Empty,
+ 0,
+ OLEMSGBUTTON.OLEMSGBUTTON_OK,
+ OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST,
+ OLEMSGICON.OLEMSGICON_INFO,
+ 0, // false
+ out result);
}
private object CreateService(IServiceContainer container, Type serviceType)
Modified: vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleEditorFactory.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleEditorFactory.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleEditorFactory.cs Fri Dec 15 20:50:12 2006
@@ -11,6 +11,9 @@
using IOleServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider;
+using System.ComponentModel.Design;
+using System.Diagnostics;
+
namespace Nemerle.VisualStudio.Project
{
[Guid(NemerleConstants.EditorFactoryGuidString)]
@@ -21,6 +24,50 @@
public NemerleEditorFactory(NemerlePackage package)
{
_package = package;
+ //registerNemerleCommands();
+ }
+
+ private void registerNemerleCommands()
+ {
+ IMenuCommandService menuService = GetService(typeof(IMenuCommandService)) as IMenuCommandService;
+ if (menuService != null)
+ {
+ registerCommand(menuService, NemerleMenus.ExtendSelection, new EventHandler(OnExtendSelection));
+ //registerCommand(NemerleMenus.ShrinkSelection);
+
+ //registerCommand(NemerleMenus.Rename);
+ //registerCommand(NemerleMenus.Inline);
+
+ //registerCommand(NemerleMenus.Options);
+ }
+ else
+ Trace.WriteLine("Command Service is null!");
+ }
+
+ private static void registerCommand(IMenuCommandService service, CommandID commandId, EventHandler handler)
+ {
+ MenuCommand command = new MenuCommand(handler, commandId);
+ service.AddCommand(command);
+ }
+
+ private void OnExtendSelection(object sender, EventArgs e)
+ {
+ Debug.WriteLine("Extend Selection called");
+ IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell));
+ Guid clsid = Guid.Empty;
+ int result;
+ uiShell.ShowMessageBox(
+ 0,
+ ref clsid,
+ "Package Name",
+ string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.ToString()),
+ string.Empty,
+ 0,
+ OLEMSGBUTTON.OLEMSGBUTTON_OK,
+ OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST,
+ OLEMSGICON.OLEMSGICON_INFO,
+ 0, // false
+ out result);
}
#endregion
Modified: vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleMenus.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleMenus.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleMenus.cs Fri Dec 15 20:50:12 2006
@@ -8,11 +8,19 @@
/// </summary>
public sealed class NemerleMenus
{
- internal static readonly Guid guidNemerleProjectCmdSet =
- new Guid(NemerleConstants.ProjectCmdSetGuidString);
+ internal static readonly Guid guidNemerleProjectCmdSet = new Guid(NemerleConstants.ProjectCmdSetGuidString);
- internal static readonly CommandID SetAsMain =
- new CommandID(guidNemerleProjectCmdSet, 0x3001);
+ internal static readonly CommandID SetAsMain = new CommandID(guidNemerleProjectCmdSet, 0x3001);
+
+ internal static readonly CommandID TestCommand = new CommandID(guidNemerleProjectCmdSet, 0x100);
+
+ internal static readonly CommandID ExtendSelection = new CommandID(guidNemerleProjectCmdSet, 0x3101);
+ internal static readonly CommandID ShrinkSelection = new CommandID(guidNemerleProjectCmdSet, 0x3102);
+
+ internal static readonly CommandID Rename = new CommandID(guidNemerleProjectCmdSet, 0x3103);
+ internal static readonly CommandID Inline = new CommandID(guidNemerleProjectCmdSet, 0x3104);
+
+ internal static readonly CommandID Options = new CommandID(guidNemerleProjectCmdSet, 0x3105);
}
}
More information about the svn
mailing list