/// <summary> /// Creates the required menu items /// </summary> private void CreateMenuItems() { MenuStrip mainMenu = PluginBase.MainForm.MenuStrip; ContextMenuStrip editorMenu = PluginBase.MainForm.EditorMenu; this.refactorMainMenu = new RefactorMenu(true); this.refactorMainMenu.RenameMenuItem.Click += new EventHandler(this.RenameClicked); this.refactorMainMenu.OrganizeMenuItem.Click += new EventHandler(this.OrganizeImportsClicked); this.refactorMainMenu.TruncateMenuItem.Click += new EventHandler(this.TruncateImportsClicked); this.refactorMainMenu.ExtractMethodMenuItem.Click += new EventHandler(this.ExtractMethodClicked); this.refactorMainMenu.DelegateMenuItem.Click += new EventHandler(this.DelegateMethodsClicked); this.refactorMainMenu.ExtractLocalVariableMenuItem.Click += new EventHandler(this.ExtractLocalVariableClicked); this.refactorMainMenu.CodeGeneratorMenuItem.Click += new EventHandler(this.CodeGeneratorMenuItemClicked); this.refactorContextMenu = new RefactorMenu(false); this.refactorContextMenu.RenameMenuItem.Click += new EventHandler(this.RenameClicked); this.refactorContextMenu.OrganizeMenuItem.Click += new EventHandler(this.OrganizeImportsClicked); this.refactorContextMenu.TruncateMenuItem.Click += new EventHandler(this.TruncateImportsClicked); this.refactorContextMenu.DelegateMenuItem.Click += new EventHandler(this.DelegateMethodsClicked); this.refactorContextMenu.ExtractMethodMenuItem.Click += new EventHandler(this.ExtractMethodClicked); this.refactorContextMenu.ExtractLocalVariableMenuItem.Click += new EventHandler(this.ExtractLocalVariableClicked); this.refactorContextMenu.CodeGeneratorMenuItem.Click += new EventHandler(this.CodeGeneratorMenuItemClicked); this.surroundContextMenu = new SurroundMenu(); editorMenu.Items.Insert(3, this.refactorContextMenu); editorMenu.Items.Insert(4, this.surroundContextMenu); mainMenu.Items.Insert(5, this.refactorMainMenu); ToolStripMenuItem searchMenu = PluginBase.MainForm.FindMenuItem("SearchMenu") as ToolStripMenuItem; this.viewReferencesItem = new ToolStripMenuItem(TextHelper.GetString("Label.FindAllReferences"), null, new EventHandler(this.FindAllReferencesClicked)); this.editorReferencesItem = new ToolStripMenuItem(TextHelper.GetString("Label.FindAllReferences"), null, new EventHandler(this.FindAllReferencesClicked)); PluginBase.MainForm.RegisterShortcutItem("SearchMenu.ViewReferences", this.viewReferencesItem); searchMenu.DropDownItems.Add(new ToolStripSeparator()); searchMenu.DropDownItems.Add(this.viewReferencesItem); editorMenu.Items.Insert(7, this.editorReferencesItem); }
public RefactorMenu(Settings settings, Boolean createSurroundMenu) { this.settings = settings; this.Text = TextHelper.GetString("Label.Refactor"); this.renameMenuItem = this.DropDownItems.Add(TextHelper.GetString("Label.Rename"), null) as ToolStripMenuItem; this.extractMethodMenuItem = this.DropDownItems.Add(TextHelper.GetString("Label.ExtractMethod"), null) as ToolStripMenuItem; this.extractLocalVariableMenuItem = this.DropDownItems.Add(TextHelper.GetString("Label.ExtractLocalVariable"), null) as ToolStripMenuItem; this.delegateMenuItem = this.DropDownItems.Add(TextHelper.GetString("Label.DelegateMethods"), null) as ToolStripMenuItem; if (createSurroundMenu) { this.surroundMenu = new SurroundMenu(); this.DropDownItems.Add(this.surroundMenu); } this.DropDownItems.Add(new ToolStripSeparator()); this.organizeMenuItem = this.DropDownItems.Add(TextHelper.GetString("Label.OrganizeImports"), null) as ToolStripMenuItem; this.truncateMenuItem = this.DropDownItems.Add(TextHelper.GetString("Label.TruncateImports"), null) as ToolStripMenuItem; this.ApplyShortcutKeys(); }
public RefactorMenu(Boolean createSurroundMenu) { this.Text = TextHelper.GetString("Label.Refactor"); this.renameMenuItem = this.DropDownItems.Add(TextHelper.GetString("Label.Rename"), null) as ToolStripMenuItem; this.extractMethodMenuItem = this.DropDownItems.Add(TextHelper.GetString("Label.ExtractMethod"), null) as ToolStripMenuItem; this.extractLocalVariableMenuItem = this.DropDownItems.Add(TextHelper.GetString("Label.ExtractLocalVariable"), null) as ToolStripMenuItem; this.delegateMenuItem = this.DropDownItems.Add(TextHelper.GetString("Label.DelegateMethods"), null) as ToolStripMenuItem; if (createSurroundMenu) { this.surroundMenu = new SurroundMenu(); this.DropDownItems.Add(this.surroundMenu); } this.DropDownItems.Add(new ToolStripSeparator()); this.generatorMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.InvokeCodeGenerator"), null, null, createSurroundMenu ? Keys.Control | Keys.Shift | Keys.D1 : Keys.None); this.DropDownItems.Add(this.generatorMenuItem); this.DropDownItems.Add(new ToolStripSeparator()); this.organizeMenuItem = this.DropDownItems.Add(TextHelper.GetString("Label.OrganizeImports"), null) as ToolStripMenuItem; this.truncateMenuItem = this.DropDownItems.Add(TextHelper.GetString("Label.TruncateImports"), null) as ToolStripMenuItem; if (createSurroundMenu) RegisterMenuItems(); }
/// <summary> /// Creates the required menu items /// </summary> private void CreateMenuItems() { MenuStrip mainMenu = PluginBase.MainForm.MenuStrip; ContextMenuStrip editorMenu = PluginBase.MainForm.EditorMenu; this.refactorMainMenu = new RefactorMenu(this.settingObject, true); this.refactorMainMenu.RenameMenuItem.Click += new EventHandler(this.RenameClicked); this.refactorMainMenu.OrganizeMenuItem.Click += new EventHandler(this.OrganizeImportsClicked); this.refactorMainMenu.TruncateMenuItem.Click += new EventHandler(this.TruncateImportsClicked); this.refactorMainMenu.ExtractMethodMenuItem.Click += new EventHandler(this.ExtractMethodClicked); this.refactorMainMenu.DelegateMenuItem.Click += new EventHandler(this.DelegateMethodsClicked); this.refactorMainMenu.ExtractLocalVariableMenuItem.Click += new EventHandler(this.ExtractLocalVariableClicked); this.refactorContextMenu = new RefactorMenu(this.settingObject, false); this.refactorContextMenu.RenameMenuItem.Click += new EventHandler(this.RenameClicked); this.refactorContextMenu.OrganizeMenuItem.Click += new EventHandler(this.OrganizeImportsClicked); this.refactorContextMenu.TruncateMenuItem.Click += new EventHandler(this.TruncateImportsClicked); this.refactorContextMenu.DelegateMenuItem.Click += new EventHandler(this.DelegateMethodsClicked); this.refactorContextMenu.ExtractMethodMenuItem.Click += new EventHandler(this.ExtractMethodClicked); this.refactorContextMenu.ExtractLocalVariableMenuItem.Click += new EventHandler(this.ExtractLocalVariableClicked); this.surroundContextMenu = new SurroundMenu(); editorMenu.Opening += new CancelEventHandler(this.EditorMenuOpening); mainMenu.MenuActivate += new EventHandler(this.MainMenuActivate); editorMenu.Items.Insert(3, this.refactorContextMenu); editorMenu.Items.Insert(4, this.surroundContextMenu); mainMenu.Items.Insert(5, this.refactorMainMenu); ToolStripMenuItem searchMenu = PluginBase.MainForm.FindMenuItem("SearchMenu") as ToolStripMenuItem; this.viewReferencesItem = new ToolStripMenuItem(TextHelper.GetString("Label.FindAllReferences"), null, new EventHandler(this.FindAllReferencesClicked)); this.editorReferencesItem = new ToolStripMenuItem(TextHelper.GetString("Label.FindAllReferences"), null, new EventHandler(this.FindAllReferencesClicked)); this.editorReferencesItem.ShortcutKeys = this.settingObject.FindRefsShortcut; this.viewReferencesItem.ShortcutKeys = this.settingObject.FindRefsShortcut; searchMenu.DropDownItems.Add(new ToolStripSeparator()); searchMenu.DropDownItems.Add(this.viewReferencesItem); editorMenu.Items.Insert(7, this.editorReferencesItem); this.ApplyIgnoredKeys(); }
/// <summary> /// Creates the required menu items /// </summary> private void CreateMenuItems() { this.refactorMainMenu = new RefactorMenu(true); this.refactorMainMenu.RenameMenuItem.Click += this.RenameClicked; this.refactorMainMenu.OrganizeMenuItem.Click += this.OrganizeImportsClicked; this.refactorMainMenu.TruncateMenuItem.Click += this.TruncateImportsClicked; this.refactorMainMenu.ExtractMethodMenuItem.Click += this.ExtractMethodClicked; this.refactorMainMenu.DelegateMenuItem.Click += this.DelegateMethodsClicked; this.refactorMainMenu.ExtractLocalVariableMenuItem.Click += this.ExtractLocalVariableClicked; this.refactorMainMenu.CodeGeneratorMenuItem.Click += this.CodeGeneratorMenuItemClicked; this.refactorContextMenu = new RefactorMenu(false); this.refactorContextMenu.RenameMenuItem.Click += this.RenameClicked; this.refactorContextMenu.OrganizeMenuItem.Click += this.OrganizeImportsClicked; this.refactorContextMenu.TruncateMenuItem.Click += this.TruncateImportsClicked; this.refactorContextMenu.DelegateMenuItem.Click += this.DelegateMethodsClicked; this.refactorContextMenu.ExtractMethodMenuItem.Click += this.ExtractMethodClicked; this.refactorContextMenu.ExtractLocalVariableMenuItem.Click += this.ExtractLocalVariableClicked; this.refactorContextMenu.CodeGeneratorMenuItem.Click += this.CodeGeneratorMenuItemClicked; ContextMenuStrip editorMenu = PluginBase.MainForm.EditorMenu; this.surroundContextMenu = new SurroundMenu(); editorMenu.Items.Insert(3, this.refactorContextMenu); editorMenu.Items.Insert(4, this.surroundContextMenu); PluginBase.MainForm.MenuStrip.Items.Insert(5, this.refactorMainMenu); ToolStripMenuItem searchMenu = PluginBase.MainForm.FindMenuItem("SearchMenu") as ToolStripMenuItem; this.viewReferencesItem = new ToolStripMenuItem(TextHelper.GetString("Label.FindAllReferences"), null, this.FindAllReferencesClicked); this.editorReferencesItem = new ToolStripMenuItem(TextHelper.GetString("Label.FindAllReferences"), null, this.FindAllReferencesClicked); PluginBase.MainForm.RegisterShortcutItem("SearchMenu.ViewReferences", this.viewReferencesItem); searchMenu.DropDownItems.Add(new ToolStripSeparator()); searchMenu.DropDownItems.Add(this.viewReferencesItem); editorMenu.Items.Insert(7, this.editorReferencesItem); }