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(); }
public RefactorMenu(Boolean createSurroundMenu) { this.Text = TextHelper.GetString("Label.Refactor"); this.renameMenuItem = this.DropDownItems.Add(TextHelper.GetString("Label.Rename")) 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; this.DropDownItems.Add(new ToolStripSeparator()); this.batchMenuItem = this.DropDownItems.Add(TextHelper.GetString("Label.BatchProcess"), null) as ToolStripMenuItem; }
/// <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); }