Exemplo n.º 1
0
		public void AddTo (IMenuCommandService commands)
		{
			commands.AddCommand (new MenuCommand (Copy, StandardCommands.Copy));
			commands.AddCommand (new MenuCommand (Cut, StandardCommands.Cut));
			commands.AddCommand (new MenuCommand (Paste, StandardCommands.Paste));
			commands.AddCommand (new MenuCommand (Delete, StandardCommands.Delete));
			commands.AddCommand (new MenuCommand (SelectAll, StandardCommands.SelectAll));
		}
        public override void AddCommandHandlers(IMenuCommandService menuCommandService)
        {
            //ModelExplorerCut = new CommandID(GuidSymbol, CutIDSymbol);
            ModelExplorerCopy = new CommandID(GuidSymbol, CopyIDSymbol);
            ModelExplorerPaste = new CommandID(GuidSymbol, PasteIDSymbol);

            //menuCommandService.AddCommand(
            //    new DynamicStatusMenuCommand(new EventHandler(OnStatusCut), new EventHandler(OnMenuCut), ModelExplorerCut));
            menuCommandService.AddCommand(
                new DynamicStatusMenuCommand(new EventHandler(OnStatusCopy), new EventHandler(OnMenuCopy), ModelExplorerCopy));
            menuCommandService.AddCommand(
                new DynamicStatusMenuCommand(new EventHandler(OnStatusPaste), new EventHandler(OnMenuPaste), ModelExplorerPaste));

            base.AddCommandHandlers(menuCommandService);
        }
Exemplo n.º 3
0
 public virtual void Register(IMenuCommandService mcs)
 {
     var menuCommandID = new CommandID(GuidList.GuidEasyCodeCmdSet, CommandID);
     var menuCommand = new OleMenuCommand(ExcuteCommand, menuCommandID);
     menuCommand.BeforeQueryStatus += new EventHandler(menuCommand_BeforeQueryStatus);
     mcs.AddCommand(menuCommand);
 }
 private OleMenuCommand RegisterCommand(Guid guidId, int id, IMenuCommandService menuCommandService)
 {
     var menuCommandID = new CommandID(guidId, id);
     var menuItem = new OleMenuCommand(Exec, menuCommandID);
     menuItem.BeforeQueryStatus += QueryStatus;
     menuCommandService.AddCommand(menuItem);
     return menuItem;
 }
 public CompareToBranchCommand(IMenuCommandService menuCommandService, ILogger _logger, ITFSVersionControl _tfs)
 {
     branches = new List<string>();
     logger = _logger;
     tfsVersionControl = _tfs;
     CommandID compareToBranchId = new CommandID(GuidList.guidTFSProductivityPackCmdSet, PkgCmdIDList.cmdIdDynamicCompareToBranchCommand);
     compareToBranchOleCommand = new OleDynamicCommand(compareToBranchId, IsValidDynamicItem, Exec, QueryStatus);
     menuCommandService.AddCommand(compareToBranchOleCommand);
 }
 /// <summary>
 /// Add a command handler and status query handler for a menu item
 /// </summary>
 private static OleMenuCommand AddCommand(
     IMenuCommandService menuCommandService,
     int commandId,
     EventHandler invokeHandler,
     EventHandler beforeQueryStatus)
 {
     var commandIdWithGroupId = new CommandID(Guids.RoslynGroupId, commandId);
     var command = new OleMenuCommand(invokeHandler, delegate { }, beforeQueryStatus, commandIdWithGroupId);
     menuCommandService.AddCommand(command);
     return command;
 }
        public static void Bind(IMenuCommandService menuCommandService)
        {
            var menuHandlers = IoC.GetInstances<IComboBoxCommandHandler>();

            foreach (IComboBoxCommandHandler handler in menuHandlers)
            {
                var handlesComboBoxdAttributes = (HandlesComboBoxCommandAttribute[])handler.GetType().GetCustomAttributes(typeof(HandlesComboBoxCommandAttribute), false);

                foreach (HandlesComboBoxCommandAttribute attribute in handlesComboBoxdAttributes)
                {
                    var requestItemsCommandId = new CommandID(Identifiers.CommandGroupId, attribute.RequestItemsCommandId);
                    var menuItem = new OleMenuCommand(ProvideItemsCallback, requestItemsCommandId);
                    menuCommandService.AddCommand(menuItem);

                    var itemSelectionCommandId = new CommandID(Identifiers.CommandGroupId, attribute.SelectionCommandId);
                    var itemSelectionMenuItem = new OleMenuCommand(ItemSelectionCallback, itemSelectionCommandId);
                    menuCommandService.AddCommand(itemSelectionMenuItem);
                }
            }
        }
Exemplo n.º 8
0
        internal ShowToolWindowCommand(CommandID commandId, Guid toolWindowId,
                                       IToolWindowService toolWindowService, IMenuCommandService commandService, ILogger logger)
        {
            this.toolWindowId = toolWindowId;

            this.toolWindowService = toolWindowService ?? throw new ArgumentNullException(nameof(toolWindowService));
            this.logger            = logger ?? throw new ArgumentNullException(nameof(logger));

            if (commandService == null)
            {
                throw new ArgumentNullException(nameof(commandService));
            }

            var menuItem = new MenuCommand(Execute, commandId);

            commandService.AddCommand(menuItem);
        }
Exemplo n.º 9
0
        public void TryToShowMenuCommands()
        {
            if (!_shouldDisplay())
            {
                return;
            }

            foreach (var menuCommand in _menuCommands)
            {
                var existingMenuCommand = _menuCommandService.FindCommand(menuCommand.CommandID);
                if (existingMenuCommand != null)
                {
                    _menuCommandService.RemoveCommand(existingMenuCommand);
                }
                _menuCommandService.AddCommand(menuCommand);
            }
        }
Exemplo n.º 10
0
 private void OnSelectionChanged(object sender, EventArgs e)
 {
     if (this.selectionSvc.PrimarySelection == this.panel)
     {
         this.designerShortCutCommand = new MenuCommand(new EventHandler(this.OnKeyShowDesignerActions), MenuCommands.KeyInvokeSmartTag);
         IMenuCommandService service = (IMenuCommandService)this.GetService(typeof(IMenuCommandService));
         if (service != null)
         {
             this.oldShortCutCommand = service.FindCommand(MenuCommands.KeyInvokeSmartTag);
             if (this.oldShortCutCommand != null)
             {
                 service.RemoveCommand(this.oldShortCutCommand);
             }
             service.AddCommand(this.designerShortCutCommand);
         }
     }
 }
Exemplo n.º 11
0
        private WindowCommand(AsyncPackage Package, IMenuCommandService CommandService)
        {
            if (Package == null)
            {
                return;
            }
            if (CommandService == null)
            {
                return;
            }

            this.Package = Package;

            var MenuCommandID = new CommandID(CommandSet, CommandID);
            var MenuItem      = new MenuCommand(Execute, MenuCommandID);

            CommandService.AddCommand(MenuItem);
        }
        private static OleMenuCommand AddCommand(
            IMenuCommandService menuCommandService,
            int commandId,
            EventHandler invokeHandler,
            EventHandler beforeQueryStatus
            )
        {
            var commandIdWithGroupId = new CommandID(Guids.RoslynGroupId, commandId);
            var command = new OleMenuCommand(
                invokeHandler,
                delegate { },
                beforeQueryStatus,
                commandIdWithGroupId
                );

            menuCommandService.AddCommand(command);
            return(command);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DisableRuleCommand"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        /// <param name="menuCommandService">Command service to add command to, not null.</param>
        internal /* for testing */ CFamilyReproducerCommand(IMenuCommandService menuCommandService,
                                                            IActiveDocumentLocator activeDocumentLocator, ISonarLanguageRecognizer languageRecognizer,
                                                            IAnalysisRequester analysisRequester, ILogger logger)
        {
            if (menuCommandService == null)
            {
                throw new ArgumentNullException(nameof(menuCommandService));
            }

            this.activeDocumentLocator   = activeDocumentLocator ?? throw new ArgumentNullException(nameof(activeDocumentLocator));
            this.sonarLanguageRecognizer = languageRecognizer ?? throw new ArgumentNullException(nameof(languageRecognizer));
            this.analysisRequester       = analysisRequester ?? throw new ArgumentNullException(nameof(analysisRequester));
            this.logger = logger ?? throw new ArgumentNullException(nameof(logger));

            var menuCommandID = new CommandID(CommandSet, CommandId);

            menuItem = new OleMenuCommand(Execute, null, QueryStatus, menuCommandID);
            menuCommandService.AddCommand(menuItem);
        }
        public CopyFunctionBreakpointNameService(IVsTextManager textManager,
                                                 IVsEditorAdaptersFactoryService editorAdaptersFactoryService,
                                                 IMenuCommandService menuCommandService,
                                                 IVsStatusbar statusBar,
                                                 JoinableTaskFactory joinableTaskFactory)
        {
            if (menuCommandService == null)
            {
                throw new ArgumentNullException(nameof(menuCommandService));
            }

            this.textManager = textManager ?? throw new ArgumentNullException(nameof(textManager));
            this.editorAdaptersFactoryService = editorAdaptersFactoryService ?? throw new ArgumentNullException(nameof(editorAdaptersFactoryService));
            this.statusBar           = statusBar ?? throw new ArgumentNullException(nameof(statusBar));
            this.joinableTaskFactory = joinableTaskFactory ?? throw new ArgumentNullException(nameof(joinableTaskFactory));

            menuCommandService.AddCommand(
                new OleMenuCommand(OnMenuCommandInvoked, changeHandler: null, UpdateMenuCommandStatus, MenuCommand));
        }
Exemplo n.º 15
0
        internal void AddCommand(Guid group, int commandId, EventHandler doCmd, EventHandler queryCmd)
        {
            IMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as IMenuCommandService;

            if (mcs == null)
            {
                return;
            }


            CommandID      cmd = new CommandID(group, commandId);
            OleMenuCommand mc  = new OleMenuCommand(doCmd, cmd);

            if (queryCmd != null)
            {
                mc.BeforeQueryStatus += queryCmd;
            }
            mcs.AddCommand(mc);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Helper function used to add commands using IMenuCommandService
        /// </summary>
        /// <param name="menuCommandService"> The IMenuCommandService interface.</param>
        /// <param name="menuGroup"> This guid represents the menu group of the command.</param>
        /// <param name="cmdID"> The command ID of the command.</param>
        /// <param name="commandEvent"> An EventHandler which will be called whenever the command is invoked.</param>
        /// <param name="queryEvent"> An EventHandler which will be called whenever we want to query the status of
        /// the command.  If null is passed in here then no EventHandler will be added.</param>
        private static void AddCommand(IMenuCommandService menuCommandService,
                                       Guid menuGroup,
                                       int cmdID,
                                       EventHandler commandEvent,
                                       EventHandler queryEvent)
        {
            // Create the OleMenuCommand from the menu group, command ID, and command event
            var menuCommandID = new CommandID(menuGroup, cmdID);
            var command       = new OleMenuCommand(commandEvent, menuCommandID);

            // Add an event handler to BeforeQueryStatus if one was passed in
            if (null != queryEvent)
            {
                command.BeforeQueryStatus += queryEvent;
            }

            // Add the command using our IMenuCommandService instance
            menuCommandService.AddCommand(command);
        }
Exemplo n.º 17
0
        private void AddAttachCommand(IMenuCommandService mcs, int commandId, AttachDescriptor descriptor)
        {
            if (mcs == null)
            {
                return;
            }

            var commandIdentifier = new CommandID(ATAGuids.guidAnotherAttachToAnyCmdGroup, commandId);
            var existing          = mcs.FindCommand(commandIdentifier);

            if (existing != null)
            {
                ((DescriptorMenuCommand)existing).Descriptor = descriptor;
                return;
            }
            var menuItem = new DescriptorMenuCommand(MenuCommandInvokeHandler, commandId, descriptor);

            mcs.AddCommand(menuItem);
        }
Exemplo n.º 18
0
        DebuggerOptionsCommand(JoinableTaskContext taskContext,
                               YetiVSIService vsiService,
                               IDebugEngineManager debugEngineManager,
                               IVsCommandWindow commandWindow,
                               IMenuCommandService menuCommandService)
        {
            taskContext.ThrowIfNotOnMainThread();

            this.taskContext        = taskContext;
            this.debugEngineManager = debugEngineManager;
            this.vsiService         = vsiService;

            commandWindowWriter = new CommandWindowWriter(taskContext, commandWindow);
            var menuCommand = new OleMenuCommand(HandleCommand,
                                                 new CommandID(YetiConstants.CommandSetGuid, PkgCmdID.cmdidDebuggerOptionsCommand));

            // Accept any parameter value.
            menuCommand.ParametersDescription = "$";
            menuCommandService?.AddCommand(menuCommand);
        }
        public static void Bind(IMenuCommandService menuCommandService)
        {
            var menuHandlers = IoC.GetInstances <IMenuCommandHandler>();

            foreach (IMenuCommandHandler menuCommandHandler in menuHandlers)
            {
                var handlesCommandAttributes = (HandlesMenuCommandAttribute[])menuCommandHandler.GetType().GetCustomAttributes(typeof(HandlesMenuCommandAttribute), false);

                IEnumerable <int> coomandIdentifiers = handlesCommandAttributes.SelectMany(attr => attr.CommandIdentifiers);

                foreach (int commandId in coomandIdentifiers)
                {
                    var menuCommandId = new CommandID(Identifiers.CommandGroupId, commandId);
                    var menuItem      = new OleMenuCommand(MenuItemCallback, menuCommandId);
                    menuItem.BeforeQueryStatus += OnBeforeQueryStatus;

                    menuCommandService.AddCommand(menuItem);
                }
            }
        }
        public static void Bind(IMenuCommandService menuCommandService)
        {
            var menuHandlers = IoC.GetInstances<IMenuCommandHandler>();

            foreach (IMenuCommandHandler menuCommandHandler in menuHandlers)
            {
                var handlesCommandAttributes = (HandlesMenuCommandAttribute[])menuCommandHandler.GetType().GetCustomAttributes(typeof(HandlesMenuCommandAttribute), false);

                IEnumerable<int> coomandIdentifiers = handlesCommandAttributes.SelectMany(attr => attr.CommandIdentifiers);

                foreach (int commandId in coomandIdentifiers)
                {
                    var menuCommandId = new CommandID(Identifiers.CommandGroupId, commandId);
                    var menuItem = new OleMenuCommand(MenuItemCallback, menuCommandId);
                    menuItem.BeforeQueryStatus += OnBeforeQueryStatus;

                    menuCommandService.AddCommand(menuItem);
                }
            }
        }
Exemplo n.º 21
0
        private MyButton(AsyncPackage package, IMenuCommandService commandService)
        {
            _package       = package ?? throw new ArgumentNullException(nameof(package));
            commandService = commandService ?? throw new ArgumentNullException(nameof(commandService));

            var cmdID   = new CommandID(CommandSet, CommandId);
            var command = new OleMenuCommand(Execute, cmdID)
            {
                // This defers the visibility logic back to the VisibilityConstraints in the .vsct file
                Supported = false
            };

            // The MyQueryStatus method makes the exact same check as the ProvideUIContextRule attribute
            // does on the MyPackage class. When that is the case, there is no need to specify
            // a QueryStatus method and we can set command.Supported=false to defer the logic back
            // to the VisibilityConstraint in the .vsct file.
            //command.BeforeQueryStatus += MyQueryStatus;

            commandService.AddCommand(command);
        }
Exemplo n.º 22
0
        private SolutionRestoreCommand(
            IMenuCommandService commandService,
            IVsMonitorSelection vsMonitorSelection,
            IComponentModel componentModel)
        {
            if (componentModel == null)
            {
                throw new ArgumentNullException(nameof(componentModel));
            }

            var menuCommandId = new CommandID(CommandSet, CommandId);
            var menuItem      = new OleMenuCommand(
                OnRestorePackages, null, BeforeQueryStatusForPackageRestore, menuCommandId);

            // call AddCommand through explicitly moving to UI thread since this is now being
            // initiliazed as part of AsynPackage
            ThreadHelper.JoinableTaskFactory.Run(async() =>
            {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
                commandService?.AddCommand(menuItem);
            });

            _vsMonitorSelection = vsMonitorSelection;

            // get the solution not building and not debugging cookie
            var guid = VSConstants.UICONTEXT.SolutionExistsAndNotBuildingAndNotDebugging_guid;

            _vsMonitorSelection.GetCmdUIContextCookie(ref guid, out _solutionNotBuildingAndNotDebuggingContextCookie);

            _logger = new Lazy <INuGetUILogger>(
                () => componentModel.GetService <INuGetUILogger>());

            _solutionRestoreWorker = new Lazy <ISolutionRestoreWorker>(
                () => componentModel.GetService <ISolutionRestoreWorker>());

            _solutionManager = new Lazy <ISolutionManager>(
                () => componentModel.GetService <ISolutionManager>());

            _consoleStatus = new Lazy <IConsoleStatus>(
                () => componentModel.GetService <IConsoleStatus>());
        }
        public static async System.Threading.Tasks.Task InitializeAsync(AsyncPackage package)
        {
            { // Adding callback method to "Parallel Builds Monitor" menu item into "VS -> Menu -> View -> Other Windows" menu
                IMenuCommandService commandService = (IMenuCommandService)await package.GetServiceAsync(typeof(IMenuCommandService));

                Microsoft.Assumes.Present(commandService);
                CommandID   menuCommandID = new CommandID(typeof(MainMenuCommandSet).GUID, (int)MainMenuCommandSet.ShowToolWindow);
                MenuCommand menuItem      = new MenuCommand((s, e) => Execute(package), menuCommandID);
                commandService.AddCommand(menuItem);
            }

            { // Start listening VS Events...
                // Should we always collect data even when "Parallel Builds Monitor" pane is closed?
                // What if user open PBM pane in the the middle of build? Should we show Gantt chart or draw notice like "Restart build to see results"?
                // If we decide not to collect data when PBM pane is closed, then user must manually activate PBM before build in order to have Gantt.
                // This is because "Output" pane is left as active after each build, so "Output" pane will be active pane after VS restart.
                PBMCommand.Initialize(package);
            }

            { // Show and Activate "Parallel Builds Monitor" pane
              // Do we really want to activate "Parallel Builds Monitor" pane after each solution load?
              // Or maybe we want to do that only once after installation?
              // Will it work when PBM plugin is installed whn solution is already opened?

                const string          collectionName            = "PBMSettings";
                const string          propertyName              = "FirstRun";
                SettingsManager       settingsManager           = new ShellSettingsManager(PBMCommand.ServiceProvider);
                WritableSettingsStore writableUserSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
                if (!writableUserSettingsStore.CollectionExists(collectionName))
                {
                    writableUserSettingsStore.CreateCollection(collectionName);
                }

                bool firstRun = writableUserSettingsStore.GetBoolean(collectionName, propertyName, true);
                if (firstRun)
                {
                    writableUserSettingsStore.SetBoolean(collectionName, propertyName, false);
                    Execute(package);
                }
            }
        }
Exemplo n.º 24
0
        public override void Initialize(IComponent component)
        {
            base.Initialize(component);
            mcs = (IMenuCommandService)component.Site.GetService(typeof(IMenuCommandService));

            dv = new DesignerVerb("Global menu",
                                  new EventHandler(OnClickGlobalMenu));
            dv.Enabled   = true;
            dv.Visible   = true;
            dv.Supported = true;
            mcs.RemoveVerb(dv);
            mcs.AddVerb(dv);

            ms = new MenuCommand(new EventHandler(OnKeyHome),
                                 MenuCommands.KeyHome);
            ms.Enabled   = true;
            ms.Visible   = true;
            ms.Supported = true;
            mcs.RemoveCommand(ms);
            mcs.AddCommand(ms);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Initializes the singleton instance of the command.
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        /// <param name="token">The token to cancel adding the command.</param>
        public static async Task InitializeAsync(IGoogleCloudExtensionPackage package, CancellationToken token)
        {
            package.ThrowIfNull(nameof(package));

            IMenuCommandService commandService =
                await package.GetServiceAsync <IMenuCommandService, IMenuCommandService>();

            await package.JoinableTaskFactory.SwitchToMainThreadAsync(token);

            var menuCommandID = new CommandID(CommandSet, CommandId);
            var menuItem      = new OleMenuCommand(
                async(sender, e) =>
            {
                await ToolWindowCommandUtils.ShowToolWindowAsync <ErrorReportingToolWindow>();
                EventsReporterWrapper.ReportEvent(ErrorsViewerOpenEvent.Create());
            },
                menuCommandID);

            menuItem.BeforeQueryStatus += ToolWindowCommandUtils.EnableMenuItemOnValidProjectId;
            commandService.AddCommand(menuItem);
        }
        /// <summary>
        /// Initializes the command. This method must be called from the <see cref="AsyncPackage.InitializeAsync"/> method for the command to work.
        /// </summary>
        public static async Task <T> InitializeAsync(AsyncPackage package)
        {
            BaseCommand <T> instance = (BaseCommand <T>)(object) new T();

            CommandAttribute?attr = (CommandAttribute)instance.GetType().GetCustomAttributes(typeof(CommandAttribute), true).FirstOrDefault();

            if (attr is null)
            {
                throw new InvalidOperationException($"No [Command(GUID, ID)] attribute was added to {typeof(T).Name}");
            }

            // Use package GUID if no command set GUID has been specified
            Guid      cmdGuid = attr.Guid == Guid.Empty ? package.GetType().GUID : attr.Guid;
            CommandID cmd     = new(cmdGuid, attr.Id);

            if (instance is IBaseDynamicCommand dynamicCommand)
            {
                instance.Command = new DynamicItemMenuCommand(dynamicCommand.IsMatch, instance.Execute, instance.BeforeQueryStatus, cmd);
            }
            else
            {
                instance.Command = new OleMenuCommand(instance.Execute, changeHandler: null, instance.BeforeQueryStatus, cmd);
            }

            instance.Package = package;


            await package.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);

            IMenuCommandService commandService = (IMenuCommandService)await package.GetServiceAsync(typeof(IMenuCommandService));

            Assumes.Present(commandService);

            commandService.AddCommand(instance.Command);  // Requires main/UI thread

            await instance.InitializeCompletedAsync();

            return((T)(object)instance);
        }
Exemplo n.º 27
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
            base.Initialize();

            // register the editor factories
            RegisterEditorFactory(new MarkdownEditorFactoryWithoutEncoding(this));
            RegisterEditorFactory(new MarkdownEditorFactoryWithEncoding(this));

            // register the language service
            _languageInfo = new MarkdownLanguageInfo(new VsServiceProviderWrapper(this));
            ((IServiceContainer)this).AddService(typeof(MarkdownLanguageInfo), _languageInfo, true);

            // Add our command handlers for menu (commands must exist in the .vsct file)
            IMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as IMenuCommandService;

            if (mcs != null)
            {
                // Create the command for the tool window
                CommandID   toolwndCommandID = new CommandID(GuidList.guidMarkdownPackageCmdSet, PkgCmdId.cmdidMarkdownPreviewWindow);
                MenuCommand menuToolWin      = new MenuCommand(ShowToolWindow, toolwndCommandID);
                mcs.AddCommand(menuToolWin);
            }
        }
Exemplo n.º 28
0
        private MenuCommand AddCommandHandler(IMenuCommandService menuCommandService, int roslynCommand, EventHandler handler)
        {
            var commandID = new CommandID(Guids.RoslynGroupId, roslynCommand);
            var menuCommand = new MenuCommand(handler, commandID);
            menuCommandService.AddCommand(menuCommand);

            return menuCommand;
        }
Exemplo n.º 29
0
        private void RegisterCommand <T>(IMenuCommandService menuCommandService) where T : MenuCommandExplorerBase, new()
        {
            var menuCommand = CommandsUtil.CreateCommand <T>(this);

            menuCommandService.AddCommand(menuCommand);
        }
Exemplo n.º 30
0
        /// <summary>
        ///  Creates a new tab order control that displays the tab order
        ///  UI for a form.
        /// </summary>
        public TabOrder(IDesignerHost host)
        {
            this.host = host;

            // Determine a font for us to use.
            //
            IUIService uisvc = (IUIService)host.GetService(typeof(IUIService));

            if (uisvc != null)
            {
                tabFont = (Font)uisvc.Styles["DialogFont"];
            }
            else
            {
                tabFont = DefaultFont;
            }

            tabFont = new Font(tabFont, FontStyle.Bold);

            // And compute the proper highlight dimensions.
            //
            selSize = DesignerUtils.GetAdornmentDimensions(AdornmentType.GrabHandle).Width;

            // Colors and brushes...
            //
            drawString         = new StringBuilder(12);
            highlightTextBrush = new SolidBrush(SystemColors.HighlightText);
            highlightPen       = new Pen(SystemColors.Highlight);

            // The decimal separator
            //
            NumberFormatInfo formatInfo = (NumberFormatInfo)CultureInfo.CurrentCulture.GetFormat(typeof(NumberFormatInfo));

            if (formatInfo != null)
            {
                decimalSep = formatInfo.NumberDecimalSeparator;
            }
            else
            {
                decimalSep = ".";
            }

            tabProperties = new Hashtable();

            // Set up a NULL brush so we never try to invalidate the control.  This is
            // more efficient for what we're doing
            //
            SetStyle(ControlStyles.Opaque, true);

            // We're an overlay on top of the form
            //
            IOverlayService os = (IOverlayService)host.GetService(typeof(IOverlayService));

            Debug.Assert(os != null, "No overlay service -- tab order UI cannot be shown");
            if (os != null)
            {
                os.PushOverlay(this);
            }

            // Push a help keyword so the help system knows we're in place.
            //
            IHelpService hs = (IHelpService)host.GetService(typeof(IHelpService));

            if (hs != null)
            {
                hs.AddContextAttribute("Keyword", "TabOrderView", HelpKeywordType.FilterKeyword);
            }

            commands = new MenuCommand[]
            {
                new MenuCommand(new EventHandler(OnKeyCancel),
                                MenuCommands.KeyCancel),

                new MenuCommand(new EventHandler(OnKeyDefault),
                                MenuCommands.KeyDefaultAction),

                new MenuCommand(new EventHandler(OnKeyPrevious),
                                MenuCommands.KeyMoveUp),

                new MenuCommand(new EventHandler(OnKeyNext),
                                MenuCommands.KeyMoveDown),

                new MenuCommand(new EventHandler(OnKeyPrevious),
                                MenuCommands.KeyMoveLeft),

                new MenuCommand(new EventHandler(OnKeyNext),
                                MenuCommands.KeyMoveRight),

                new MenuCommand(new EventHandler(OnKeyNext),
                                MenuCommands.KeySelectNext),

                new MenuCommand(new EventHandler(OnKeyPrevious),
                                MenuCommands.KeySelectPrevious),
            };

            newCommands = new MenuCommand[]
            {
                new MenuCommand(new EventHandler(OnKeyDefault),
                                MenuCommands.KeyTabOrderSelect),
            };

            IMenuCommandService mcs = (IMenuCommandService)host.GetService(typeof(IMenuCommandService));

            if (mcs != null)
            {
                foreach (MenuCommand mc in newCommands)
                {
                    mcs.AddCommand(mc);
                }
            }

            // We also override keyboard, menu and mouse handlers.  Our override relies on the
            // above array of menu commands, so this must come after we initialize the array.
            //
            IEventHandlerService ehs = (IEventHandlerService)host.GetService(typeof(IEventHandlerService));

            if (ehs != null)
            {
                ehs.PushHandler(this);
            }

            // We sync add, remove and change events so we remain in sync with any nastiness that the
            // form may pull on us.
            //
            IComponentChangeService cs = (IComponentChangeService)host.GetService(typeof(IComponentChangeService));

            if (cs != null)
            {
                cs.ComponentAdded   += new ComponentEventHandler(OnComponentAddRemove);
                cs.ComponentRemoved += new ComponentEventHandler(OnComponentAddRemove);
                cs.ComponentChanged += new ComponentChangedEventHandler(OnComponentChanged);
            }
        }
        private OleMenuCommand BuildMenuItem(IMenuCommandService menuCommandService, Int32 commandId, EventHandler onExecute, EventHandler onBeforeQueryStatus)
        {
            var command = new CommandID(new Guid(Constants.ALIAS_BE_GONE_COMMANDSET_ID_STRING), commandId);
            var menuItem = new OleMenuCommand(onExecute, command);

            menuItem.BeforeQueryStatus += onBeforeQueryStatus;
            menuCommandService.AddCommand(menuItem);

            return menuItem;
        }
Exemplo n.º 32
0
        public TabOrder(IDesignerHost host)
        {
            this.host = host;
            IUIService service = (IUIService)host.GetService(typeof(IUIService));

            if (service != null)
            {
                this.tabFont = (Font)service.Styles["DialogFont"];
            }
            else
            {
                this.tabFont = Control.DefaultFont;
            }
            this.tabFont            = new Font(this.tabFont, FontStyle.Bold);
            this.selSize            = DesignerUtils.GetAdornmentDimensions(AdornmentType.GrabHandle).Width;
            this.drawString         = new StringBuilder(12);
            this.highlightTextBrush = new SolidBrush(SystemColors.HighlightText);
            this.highlightPen       = new Pen(SystemColors.Highlight);
            NumberFormatInfo format = (NumberFormatInfo)CultureInfo.CurrentCulture.GetFormat(typeof(NumberFormatInfo));

            if (format != null)
            {
                this.decimalSep = format.NumberDecimalSeparator;
            }
            else
            {
                this.decimalSep = ".";
            }
            this.tabProperties = new Hashtable();
            base.SetStyle(ControlStyles.Opaque, true);
            IOverlayService service2 = (IOverlayService)host.GetService(typeof(IOverlayService));

            if (service2 != null)
            {
                service2.PushOverlay(this);
            }
            IHelpService service3 = (IHelpService)host.GetService(typeof(IHelpService));

            if (service3 != null)
            {
                service3.AddContextAttribute("Keyword", "TabOrderView", HelpKeywordType.FilterKeyword);
            }
            this.commands    = new MenuCommand[] { new MenuCommand(new EventHandler(this.OnKeyCancel), MenuCommands.KeyCancel), new MenuCommand(new EventHandler(this.OnKeyDefault), MenuCommands.KeyDefaultAction), new MenuCommand(new EventHandler(this.OnKeyPrevious), MenuCommands.KeyMoveUp), new MenuCommand(new EventHandler(this.OnKeyNext), MenuCommands.KeyMoveDown), new MenuCommand(new EventHandler(this.OnKeyPrevious), MenuCommands.KeyMoveLeft), new MenuCommand(new EventHandler(this.OnKeyNext), MenuCommands.KeyMoveRight), new MenuCommand(new EventHandler(this.OnKeyNext), MenuCommands.KeySelectNext), new MenuCommand(new EventHandler(this.OnKeyPrevious), MenuCommands.KeySelectPrevious) };
            this.newCommands = new MenuCommand[] { new MenuCommand(new EventHandler(this.OnKeyDefault), MenuCommands.KeyTabOrderSelect) };
            IMenuCommandService service4 = (IMenuCommandService)host.GetService(typeof(IMenuCommandService));

            if (service4 != null)
            {
                foreach (MenuCommand command in this.newCommands)
                {
                    service4.AddCommand(command);
                }
            }
            IEventHandlerService service5 = (IEventHandlerService)host.GetService(typeof(IEventHandlerService));

            if (service5 != null)
            {
                service5.PushHandler(this);
            }
            IComponentChangeService service6 = (IComponentChangeService)host.GetService(typeof(IComponentChangeService));

            if (service6 != null)
            {
                service6.ComponentAdded   += new ComponentEventHandler(this.OnComponentAddRemove);
                service6.ComponentRemoved += new ComponentEventHandler(this.OnComponentAddRemove);
                service6.ComponentChanged += new ComponentChangedEventHandler(this.OnComponentChanged);
            }
        }
Exemplo n.º 33
0
        public static void Register(this IMenuCommandService instance, Guid guid, uint cmd, EventHandler method)
        {
            var menuCommandID = new CommandID(guid, (int)cmd);

            instance.AddCommand(new MenuCommand(method, menuCommandID));
        }
Exemplo n.º 34
0
 private static OleMenuCommand AddCommand(IMenuCommandService menuCommandService, int commandID, EventHandler eventHandler)
 {
     CommandID menuCommandID = new CommandID(GuidList.guidModelViewerCmdSet, commandID);
     OleMenuCommand menuItem = new OleMenuCommand(eventHandler, menuCommandID);
     menuCommandService.AddCommand(menuItem);
     return menuItem;
 }
Exemplo n.º 35
0
 protected MenuCommandBase(IMenuCommandService menuCommandService, Guid menuGroup, int commandId)
 {
     MenuCommand = new OleMenuCommand(OnExec, OnChange, OnQueryStatus, new CommandID(menuGroup, commandId));
     menuCommandService.AddCommand(MenuCommand);
 }
Exemplo n.º 36
0
 private static void AddCommandForMenuItem(IMenuCommandService mcs, uint cmdid, EventHandler handler)
 {
     mcs.AddCommand(new MenuCommand(handler, new CommandID(Guids.GuidEndOfTheLineCmdSet,
                                                           (int)cmdid)));
 }
        private void InitializeCommands(XmlRepository repository, IConfiguration configuration, IMenuCommandService commandService)
        {
            var activeDocument = new ActiveDocument();

            var subMenu = CreateSubMenu(activeDocument);
            commandService.AddCommand(subMenu);

            var copyGenericXPathCommand = new CopyXPathCommand(Symbols.CommandIDs.CopyGenericXPath, repository, activeDocument, () => new XPathWriter(new[] {new AttributeFilter(configuration.AlwaysDisplayedAttributes)}), new CommandTextFormatter());
            commandService.AddCommand(copyGenericXPathCommand);

            var copyAbsoluteXPathCommand = new CopyXPathCommand(Symbols.CommandIDs.CopyAbsoluteXPath, repository, activeDocument, () => new AbsoluteXPathWriter(new[] {new AttributeFilter(configuration.AlwaysDisplayedAttributes)}), new CommandTextFormatter());
            commandService.AddCommand(copyAbsoluteXPathCommand);

            var copyDistinctXPathCommand = new CopyXPathCommand(Symbols.CommandIDs.CopyDistinctXPath, repository, activeDocument, () => new XPathWriter(new[] {new AttributeFilter(configuration.AlwaysDisplayedAttributes), new DistinctAttributeFilter(configuration.PreferredAttributeCandidates)}), new CommandTextFormatter());
            commandService.AddCommand(copyDistinctXPathCommand);

            var copySimplifiedXPathCommand = new CopyXPathCommand(Symbols.CommandIDs.CopySimplifiedXPath, repository, activeDocument, () => new SimplifiedXPathWriter(new[] { new AttributeFilter(configuration.AlwaysDisplayedAttributes) }), new TrimCommandTextFormatter());
            commandService.AddCommand(copySimplifiedXPathCommand);

            var showXPathWorkbenchCommand = new ShowXPathWorkbenchCommand(this, commandService, Symbols.CommandIDs.ShowXPathWorkbench, repository, activeDocument);
            commandService.AddCommand(showXPathWorkbenchCommand.Command);

            var copyXmlStructureCommand = new CopyXmlStructureCommand(Symbols.CommandIDs.CopyXmlStructure, repository, activeDocument, () => new XmlStructureWriter(), new CommandTextFormatter());
            commandService.AddCommand(copyXmlStructureCommand);
        }
        private static void AddCommand(IMenuCommandService mcs, Guid menuGroup, int cmdId, EventHandler invokeHandler, EventHandler beforeQueryStatus)
        {
            var id = new CommandID(menuGroup, cmdId);
            var command = new OleMenuCommand(invokeHandler, id) { Visible = true };

            if (beforeQueryStatus != null)
            {
                command.BeforeQueryStatus += beforeQueryStatus;
            }

            mcs.AddCommand(command);
        }
Exemplo n.º 39
0
 void AddSolutionExplorerCommand(IMenuCommandService mcs, OleMenuCommand command, UDNDocRunningTableMonitor rdtm)
 {
     command.BeforeQueryStatus += (sender, args) =>
     {
         var cmd = sender as OleMenuCommand;
         if (cmd != null)
         {
             var selectedItems = (Array)uih.SelectedItems;
             if (null != selectedItems)
             {
                 foreach (UIHierarchyItem selectedItem in selectedItems)
                 {
                     var projectItem = selectedItem.Object as ProjectItem;
                     var pathString = projectItem.Properties.Item("FullPath").Value.ToString();
                     if (!pathString.EndsWith(".udn"))
                     {
                         cmd.Visible = false;
                         break;
                     }
                     cmd.Visible = true;
                 }
             }
         }
     };
     mcs.AddCommand(command);
 }
Exemplo n.º 40
0
        /// <summary>
        /// Helper function used to add commands using IMenuCommandService
        /// </summary>
        /// <param name="mcs"> The IMenuCommandService interface.</param>
        /// <param name="menuGroup"> This guid represents the menu group of the command.</param>
        /// <param name="cmdID"> The command ID of the command.</param>
        /// <param name="commandEvent"> An EventHandler which will be called whenever the command is invoked.</param>
        /// <param name="queryEvent"> An EventHandler which will be called whenever we want to query the status of
        /// the command.  If null is passed in here then no EventHandler will be added.</param>
        private static void AddCommand(IMenuCommandService mcs, Guid menuGroup, int cmdID,
            EventHandler commandEvent, EventHandler queryEvent)
        {
            // Create the OleMenuCommand from the menu group, command ID, and command event
            CommandID menuCommandID = new CommandID(menuGroup, cmdID);
            OleMenuCommand command = new OleMenuCommand(commandEvent, menuCommandID);

            // Add an event handler to BeforeQueryStatus if one was passed in
            if (null != queryEvent)
            {
                command.BeforeQueryStatus += queryEvent;
            }

            // Add the command using our IMenuCommandService instance
            mcs.AddCommand(command);
        }
Exemplo n.º 41
0
 private void InitCommands(IVsShell shellService, IMenuCommandService menuCommandService)
 {
     menuCommandService.AddCommand(ExecuteImagingToolsCommand.GetCreateCommand(this));
     menuCommandService.AddCommand(ManageDebuggerVisualizerInstallationsCommand.GetCreateCommand(this, shellService));
 }
Exemplo n.º 42
0
        void AddCommandWithEnableFlag(IMenuCommandService mcs, OleMenuCommand command, UDNDocRunningTableMonitor rdtm)
        {
            command.BeforeQueryStatus += new EventHandler((sender, args) =>
            {
                var cmd = sender as OleMenuCommand;
                cmd.Enabled = (cmd.CommandID.ID == PkgCmdId.cmdidMarkdownRebuildDoxygenDatabase)
                                  ? (!_doxygenIsRebuilding && rdtm.CommandsEnabled)
                                  : rdtm.CommandsEnabled;
                cmd.Visible = rdtm.CommandsEnabled;
                if (cmd.CommandID.ID == PkgCmdId.cmdidMarkdownDisableParsing)
                {
                    cmd.Checked = Settings.Default.DisableAllParsing;
                }
                if (cmd.CommandID.ID == PkgCmdId.cmdidMarkdownDisableHighlighting)
                {
                    cmd.Enabled = !Settings.Default.DisableAllParsing;  //Turn off the highlighting button when full parsing is disabled
                    cmd.Checked = Settings.Default.DisableHighlighting;
                }
                if (cmd.CommandID.ID == PkgCmdId.cmdidMarkdownPreviewWindow)
                {
                    cmd.Enabled = !Settings.Default.DisableAllParsing;
                }
                
            });

            mcs.AddCommand(command);
        }
Exemplo n.º 43
0
		/// <summary>
		/// Called by the framework when the designer is being initialized with the designed control
		/// </summary>
		/// <param name="component"></param>
		public override void Initialize(IComponent component)
		{
			base.Initialize(component);

			if (Control is TreeView)
			{
				try
				{
					m_oSelectionService = (ISelectionService) GetService(typeof (ISelectionService));
				}
				catch
				{
				}
				try
				{
					m_oSelectionService.SelectionChanged += new EventHandler(this.OnSelectionServiceChanged);
				}
				catch
				{
				}
				try
				{
					m_oDesignerHost = (IDesignerHost) GetService(typeof (IDesignerHost));
				}
				catch
				{
				}
				try
				{
					m_oMenuService = (IMenuCommandService) GetService(typeof (IMenuCommandService));
				}
				catch
				{
				}
				try
				{
					m_oDesignerSerializationService = (IDesignerSerializationService) GetService(typeof (IDesignerSerializationService));
				}
				catch
				{
				}
				try
				{
					m_oToolboxService = (IToolboxService) GetService(typeof (IToolboxService));
				}
				catch
				{
				}
				try
				{
					m_oUIService = (IUIService) GetService(typeof (IUIService));
				}
				catch
				{
				}
				try
				{
					m_oComponentChangeService = (IComponentChangeService) GetService(typeof (IComponentChangeService));
				}
				catch
				{
				}

				m_oTreeView = (TreeView) Control;
				m_oTreeView.m_bFocus = true;
				m_oTreeView.ClearAllSelection();
				m_oTreeView.DesignerHost = m_oDesignerHost;
				m_oTreeView.IsDesignMode = true;

				if (m_bFirstTime == true)
				{
					OnComponentCreated(m_oTreeView);
					m_bFirstTime = false;
				}

				try
				{
					m_oComponentAddedHandler = new ComponentEventHandler(this.OnComponentAdded);
				}
				catch
				{
				}
				try
				{
					m_oComponentRemovingHandler = new ComponentEventHandler(this.OnComponentRemoving);
				}
				catch
				{
				}
				try
				{
					m_oComponentChangeService.ComponentAdded += m_oComponentAddedHandler;
				}
				catch
				{
				}
				try
				{
					m_oComponentChangeService.ComponentRemoving += m_oComponentRemovingHandler;
				}
				catch
				{
				}
				try
				{
					m_oNodeParentChanged = new EventHandler(this.OnNodeParentChanged);
				}
				catch
				{
				}

				try
				{
					m_oOldCmdCopy = m_oMenuService.FindCommand(StandardCommands.Copy);
				}
				catch
				{
				}
				try
				{
					m_oOldCmdPaste = m_oMenuService.FindCommand(StandardCommands.Paste);
				}
				catch
				{
				}
				try
				{
					m_oOldCmdCut = m_oMenuService.FindCommand(StandardCommands.Cut);
				}
				catch
				{
				}
				try
				{
					m_oOldBringFront = m_oMenuService.FindCommand(StandardCommands.BringToFront);
				}
				catch
				{
				}
				try
				{
					m_oOldSendBack = m_oMenuService.FindCommand(StandardCommands.SendToBack);
				}
				catch
				{
				}
				try
				{
					m_oOldAlignGrid = m_oMenuService.FindCommand(StandardCommands.AlignToGrid);
				}
				catch
				{
				}
				try
				{
					m_oOldLockControls = m_oMenuService.FindCommand(StandardCommands.LockControls);
				}
				catch
				{
				}
				try
				{
					m_oOldDelete = m_oMenuService.FindCommand(StandardCommands.Delete);
				}
				catch
				{
				}

				try
				{
					m_oNewCmdCopy = new MenuCommand(new EventHandler(this.OnMenuCopy), StandardCommands.Copy);
				}
				catch
				{
				}
				try
				{
					m_oNewCmdPaste = new MenuCommand(new EventHandler(this.OnMenuPaste), StandardCommands.Paste);
				}
				catch
				{
				}

				if (TreeViewDesigner.MenuAdded == false)
				{
					try
					{
						m_oMenuService.RemoveCommand(m_oOldCmdCopy);
					}
					catch
					{
					}
					try
					{
						m_oMenuService.RemoveCommand(m_oOldCmdPaste);
					}
					catch
					{
					}
					try
					{
						m_oMenuService.AddCommand(m_oNewCmdCopy);
					}
					catch
					{
					}
					try
					{
						m_oMenuService.AddCommand(m_oNewCmdPaste);
					}
					catch
					{
					}

					TreeViewDesigner.MenuAdded = true;
				}

				m_oTreeView.Invalidate();

				#region action menus

				#region node menu

				m_oActionMenuNode = new ActionMenuNative();
				m_oActionMenuNode.Width = 170;
				m_oActionMenuNode.Title = "Node Action Menu";

				ActionMenuGroup oMenuGroup = m_oActionMenuNode.AddMenuGroup("Editing");
				oMenuGroup.Expanded = true;
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Add Node");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Delete Node");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Add Panel");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "-");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Clear Content");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Delete TreeView");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "-");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Copy");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Paste");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "-");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Properties");
				oMenuGroup = m_oActionMenuNode.AddMenuGroup("Arranging");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Expand");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Collapse");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Move Top");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Move Bottom");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Move Up");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Move Down");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Move Left");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Move Right");
				oMenuGroup = m_oActionMenuNode.AddMenuGroup("Color Schemes");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Default");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Forest");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Gold");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Ocean");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Rose");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Silver");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Sky");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Sunset");
				m_oActionMenuNode.AddMenuItem(oMenuGroup, "Wood");

				m_oActionMenuNode.ItemClick += new ActionMenuNative.ItemClickEventHandler(this.OnActionMenuNodeItemClicked);

				#endregion			

				#region TreeView menu

				m_oActionMenuTreeView = new ActionMenuNative();
				m_oActionMenuTreeView.Width = 170;
				m_oActionMenuTreeView.Title = "TreeView Action Menu";

				oMenuGroup = m_oActionMenuTreeView.AddMenuGroup("Editing");
				oMenuGroup.Expanded = true;
				m_oActionMenuTreeView.AddMenuItem(oMenuGroup, "Add Node");
				m_oActionMenuTreeView.AddMenuItem(oMenuGroup, "Color Scheme Picker...");
				m_oActionMenuTreeView.AddMenuItem(oMenuGroup, "-");
				m_oActionMenuTreeView.AddMenuItem(oMenuGroup, "Clear Content");
				m_oActionMenuTreeView.AddMenuItem(oMenuGroup, "Delete TreeView");
				m_oActionMenuTreeView.AddMenuItem(oMenuGroup, "-");
				m_oActionMenuTreeView.AddMenuItem(oMenuGroup, "Copy");
				m_oActionMenuTreeView.AddMenuItem(oMenuGroup, "Paste");
				m_oActionMenuTreeView.AddMenuItem(oMenuGroup, "-");
				m_oActionMenuTreeView.AddMenuItem(oMenuGroup, "Properties");
				oMenuGroup = m_oActionMenuTreeView.AddMenuGroup("Arranging");
				m_oActionMenuTreeView.AddMenuItem(oMenuGroup, "Expand All");
				m_oActionMenuTreeView.AddMenuItem(oMenuGroup, "Collapse All");
				oMenuGroup = m_oActionMenuTreeView.AddMenuGroup("Layout");
				m_oActionMenuTreeView.AddMenuItem(oMenuGroup, "Bring to Front");
				m_oActionMenuTreeView.AddMenuItem(oMenuGroup, "Send to Back");
				m_oActionMenuTreeView.AddMenuItem(oMenuGroup, "Align to Grid");
				m_oActionMenuTreeView.AddMenuItem(oMenuGroup, "Lock Controls");

				m_oActionMenuTreeView.ItemClick += new ActionMenuNative.ItemClickEventHandler(this.OnActionMenuTreeViewItemClicked);

				#endregion

				#endregion

				// enable the drag drop operations
				m_oTreeView.AllowDrop = true;
				this.EnableDragDrop(true);

				m_oTreeView.CollapseAll();
				m_oSelector.SelectionService = m_oSelectionService;
				m_oSelector.TreeView = m_oTreeView;
			}
		}