idea插件编写之二

做人要有始有终,答应的下一篇一定会给你们写,虽然以后可能不再会做插件这类的技术了,但也很开心给我这个机会,让我做机试题。

idea插件自定义按钮打开EditRunConfigurations

上一篇教大家学会了创建idea的自定义按钮,这一节在action创建完毕的基础上,给大家讲一下点击事件。

1.打开一个idea已有的面板,离不开这四句话,而第一句,想必不用解释了,看不懂得,请看一下getInstance()的用法,以及单例模式;第二句是根据点击事件的id查找action,这个Id是定死的,给大家提供一些Id在文章末端,喜欢的宝宝,请关注

ActionManager instance = ActionManager.getInstance();
AnAction action1 = instance.getAction("editRunConfigurations");
InputEvent inputEvent1 = ActionCommand.getInputEvent("editRunConfigurations");
ActionCallback callback1 = ActionManager.getInstance().tryToExecute(action1, inputEvent1, null, null, true);


然后点击打开的时候,就会弹出下面的框


是不是很简单呢

ActionId

Built-in Action ID's

These are the names of the actions built into IntelliJ IDEA. You can use these ID's and group names in <add-to-group> tags in your plugin's plugin.xml.

Each table shows the actions in a group, whose ID is shown in fixed-width font, along with the ID of its parent groups (for reference) and its displayed name. You can use the group ID in <add-to-group>'s group-idattribute.

Each row in the table represents an action, whose ID can be used in <add-to-group>'s relative-to-action attribute.

Last updated: IDEA 5.0.2 build 3511.

Root Action Group
ID Name
CaptureMemorySnapShot Capture memory snapshot
CaptureCPUUsageData Capture cpu usage data
ContextHelp Context Help
RunConfiguration Select Run/Debug Configuration
ShowIntentionActions Show Intention Actions
ToggleReadOnlyAttribute Toggle Read-Only Attribute
TogglePopupHints Toggle Popup Hints for Current File
RunGc Run Garbage Collector
ShowPopupMenu Show Context Menu
CloseWindow Close Active Window
Vcs.ShowHistory Show File History
Vcs.ShowHistoryForBlock Show History for Selection
Vcs.ShowTabbedFileHistory Show History
AddToFavoritesPopup Add To Favorites
AddNewFavoritesList Add New Favorites List
ExpandAll Expand All
CollapseAll Collapse All
ExportToTextFile Export to Text File
ExpandTreeNode Expand Tree Node
CollapseTreeNode Collapse Tree Node
FullyExpandTreeNode Fully Expand Tree Node
NextDiff Move to the next difference
PreviousDiff Move to the previous difference
Refresh Refresh
CheckinProject Check In Project
CheckinFiles Check In
UpdateFiles Update
CheckStatusForFiles Check Status
Annotate Annotate
Compare.SameVersion Compare with The Same Repository Version
Compare.LastVersion Compare with The Last Repository Version
Compare.Selected Compare with...
Compare.Specified Compare with Specified Revision...
CompareTwoFiles Compare Two Files
CompareFileWithEditor Compare File with Editor
ModuleSettings Module Settings...
RunContextGroup
ID Name
CreateRunConfiguration Create Run Configuration
EditorActions (Editor Actions)
ID Name
EditorChooseLookupItem Choose Lookup Item
EditorChooseLookupItemReplace Choose Lookup Item Replace
NextTemplateVariable Next Template Variable
PreviousTemplateVariable Previous Template Variable
NextParameter Next Parameter
PrevParameter Prev Parameter
EditorPageUp Page Up
EditorPageDown Page Down
EditorPageUpWithSelection Page Up with Selection
EditorPageDownWithSelection Page Up with Selection
EditorCopy Copy
EditorCut Cut
EditorPaste Paste
EditorPasteSimple Paste Simple
EditorPasteFromX11 Paste from X clipboard
EditorDelete Delete
EditorBackSpace Backspace
EditorMoveToPageTop Move Caret to Page Top
EditorMoveToPageBottom Move Caret to Page Bottom
EditorMoveToPageTopWithSelection Move Caret to Page Top with Selection
EditorMoveToPageBottomWithSelection Move Caret to Page Bottom with Selection
EditorEnter Enter
EditorEscape Escape
EditorUp Up
EditorDown Down
EditorLeft Left
EditorRight Right
EditorUpWithSelection Up with Selection
EditorDownWithSelection Down with Selection
EditorLeftWithSelection Left with Selection
EditorRightWithSelection Right with Selection
EditorIndentSelection Indent Selection
EditorUnindentSelection Unindent Selection
EditorTab Tab
EmacsStyleIndent Emacs Tab
EditorScrollUp Scroll Up
EditorScrollDown Scroll Down
EditorMoveUpAndScroll Move Up and Scroll
EditorMoveDownAndScroll Move Down and Scroll
EditorMoveUpAndScrollWithSelection Move Up and Scroll with Selection
EditorMoveDownAndScrollWithSelection Move Down and Scroll with Selection
EditorLineStart Move Caret to Line Start
EditorLineEnd Move Caret to Line End
EditorCutLineEnd Cut up to Line End
EditorTextStart Move Caret to Text Start
EditorTextEnd Move Caret to Text End
EditorLineStartWithSelection Move Caret to Line Start with Selection
EditorLineEndWithSelection Move Caret to Line End with Selection
EditorTextStartWithSelection Move Caret to Text Start with Selection
EditorTextEndWithSelection Move Caret to Text End with Selection
EditorNextWord Move Caret to Next Word
EditorPreviousWord Move Caret to Previous Word
EditorNextWordWithSelection Move Caret to Next Word with Selection
EditorPreviousWordWithSelection Move Caret to Previous Word with Selection
EditorCodeBlockStart Move Caret to Code Block Start
EditorCodeBlockEnd Move Caret to Code Block End
EditorCodeBlockStartWithSelection Move Caret to Code Block Start with Selection
EditorCodeBlockEndWithSelection Move Caret to Code Block End with Selection
EditorDeleteToWordStart Delete to Word Start
EditorDeleteToWordEnd Delete to Word End
EditorDeleteLine Delete Line at Caret
EditorDuplicate Duplicate Line or Block
EditorSelectWord Select Word at Caret
EditorUnSelectWord Unselect Word at Caret
EditorToggleInsertState Toggle Insert/Overwrite
EditorToggleColumnMode Column Mode
EditorToggleShowWhitespaces Show Whitespaces
EditorToggleShowLineNumbers Show Line Numbers
EditorScrollToCenter Scroll to Center
EditorToggleCase Toggle Case
EditorJoinLines Join Lines
EditorSelectLine Select Line at Caret
EditorSplitLine Split Line
EditorStartNewLine Start New Line
EditorCompleteStatement Complete Current Statement
J2EEGenerateGroup
ID Name
CreateSessionBean Session Bean
CreateContainerManagedEntityBeanAction CMP Entity Bean
CreateBeanManagedEntityBeanAction BMP Entity Bean
CreateMessageBean Message Bean
CreateTransferObject Transfer Object
CreateCMPField CMP Field
CreateEJBRelationship EJB Relationship
CreateJSPAction Jsp
CreateJSPXAction Jspx
CreateServletAction Servlet
CreateFilterAction Filter
CreateListenerAction Listener
GenerateGroup (Generate)
ID Name
GenerateConstructor Constructor
GenerateGetter Getter
GenerateSetter Setter
GenerateGetterAndSetter Getter and Setter
GenerateEquals equals() and hashCode()
OverrideMethods Override Methods...
ImplementMethods Implement Methods...
DelegateMethods Delegate Methods...
GenerateSuperMethodCall super method call
NewGroup (New)
ID Name
NewClass Class
NewInterface Interface
NewEnum Enum
NewAnnotationType @Interface
NewFile File
NewDir Directory/Package
NewFromTemplate From Template
NewDialog Dialog
LocalVcsGroup (Local History)
ID Name
LocalVcs.ShowHistory Show History
LocalVcs.HistoryForBlock Show History for Selection
LocalVcs.AddLabel Add Label...
VcsGroups (Version Control)
ID Name
Vcs.MarkSourcesAsCurrent Mark Project as Current
VcsGroups > VcsGlobalGroup (Version Control Group)
ID Name
Vcs.FileView Show File View
Vcs.UpdateProject Update Project
Vcs.ProjectStatus Check Project Status
MainMenu > FileMenu (File)
ID Name
NewProject New Project...
NewModule New Module...
OpenProject Open Project...
OpenFile Open File...
CloseProject Close Project
ShowSettings Settings
TemplateProjectProperties Template Project Settings
SaveAll Save All
ExportSettings Export Settings...
ImportSettings Import Settings...
ImportFromJBuilder Import From JBuilder
Synchronize Synchronize
ReloadFromDisk Reload from Disk
ExportToHTML Export to HTML...
Print Print...
Exit Exit
MainMenu > EditMenu (Edit)
ID Name
$Undo Undo
$Redo Redo
$SelectAll Select All
NewElement New...
$Delete Delete
ToggleBookmark Toggle Bookmark
ShowBookmarks Show Bookmarks
MainMenu > EditMenu > CutCopyPasteGroup
ID Name
$Cut Cut
$Copy Copy
CopyPaths Copy Paths
CopyReference Copy Reference
$Paste Paste
PasteMultiple Paste...
MainMenu > SearchMenu (Search)
ID Name
Find Find...
Replace Replace...
FindNext Find Next
FindPrevious Find Previous
FindWordAtCaret Find Word at Caret
IncrementalSearch Incremental Search
FindUsages Find Usages...
FindUsagesInFile Find Usages in File...
HighlightUsagesInFile Highlight Usages in File
FindJoinpointsByPointcutAction Find Join Point Identified by Pointcut
FindInPath Find in Path...
ReplaceInPath Replace in Path...
MainMenu > ViewMenu (View)
ID Name
ViewToolBar Toolbar
ViewStatusBar Status Bar
ToggleFullScreenMode Full Screen
EditSource Jump to Source
ViewSource Show Source
OpenInBrowser Open in Browser
ExternalJavaDoc External JavaDoc
RecentFiles Recent Files...
QuickChangeScheme Quick Switch Scheme...
TypeHierarchy Type Hierarchy
MethodHierarchy Method Hierarchy
CallHierarchy Call Hierarchy
RecentChanges Recent Changes...
MainMenu > ViewMenu > CodeEditorViewGroup
ID Name
FileStructurePopup File Structure Popup
SelectIn Select In...
QuickJavaDoc Quick Documentation Lookup
QuickImplementations Quick Definition Lookup
ParameterInfo Parameter Info
EditorContextInfo Context Info
ShowErrorDescription Error Description
MainMenu > ViewMenu > CommanderViewGroup
ID Name
CommanderSyncViews Synchronize Views
CommanderSwapPanels Swap Panels
MainMenu > ViewMenu > ProjectViewGroup
ID Name
ProjectViewChangeView Change View
MainMenu > ViewMenu > FoldingGroup (Folding)
ID Name
ExpandRegion Expand
CollapseRegion Collapse
ExpandAllRegions Expand All
CollapseAllRegions Collapse All
ExpandJavadocs Expand Javadocs
CollapseJavadocs Collapse Javadocs
CollapseSelection Fold Selection / Remove region
CollapseBlock Fold Code Block
MainMenu > GoToMenu (Go To)
ID Name
GotoClass Class...
GotoFile File...
GotoSymbol Symbol...
GotoLine Line...
GotoDeclaration Declaration
GotoDefinition Definition
GotoUsage Usage
GotoImplementation Implementation(s)
SmartGotoImplementation Called Implementation(s)
GotoTypeDeclaration Type Declaration
GotoSuperMethod Super Method
GotoAspect Aspect
GotoNextError Next Highlighted Error
GotoPreviousError Previous Highlighted Error
MethodDown Next Method
MethodUp Previous Method
GotoNextBookmark Next Bookmark
GotoPreviousBookmark Previous Bookmark
Back Back
Forward Forward
JumpToLastChange Last Edit Location
PreviousOccurence Previous Occurrence
NextOccurence Next Occurrence
VcsShowNextChangeMarker Go To Next Change
VcsShowPrevChangeMarker Go To Prev Change
MainMenu > CodeMenu (Code)
ID Name
SurroundWith Surround With...
Generate Generate...
InsertLiveTemplate Insert Live Template...
SurroundWithLiveTemplate Surround with Live Template...
CommentByLineComment Comment with Line Comment
CommentByBlockComment Comment with Block Comment
ReformatCode Reformat Code...
AutoIndentLines Auto-Indent Lines
OptimizeImports Optimize Imports...
MoveStatementDown Move Statement Down
MoveStatementUp Move Statement Up
MainMenu > CodeMenu > CodeCompletionGroup (Complete Code)
ID Name
CodeCompletion Basic
WordCompletion Complete Word
SmartTypeCompletion SmartType
ClassNameCompletion Class Name
MainMenu > AnalyzeMenu (Analyze)
ID Name
InspectCode Inspect Code...
InspectCodeWithEditorProfile Inspect Code With Editor Settings
ViewOfflineInspection View Offline Inspection Results...
ShowPackageDeps Analyze Dependencies...
ShowBackwardPackageDeps Analyze Backward Dependencies...
ShowPackageCycles Analyze Cyclic Dependencies...
ShowModulesDependencies Analyze Module Dependencies...
DupLocate Locate Duplicates...
Unscramble Analyze Stacktrace...
MainMenu > RefactoringMenu (Refactor)
ID Name
RenameElement Rename...
ChangeSignature Change Signature...
MakeStatic Make Static...
ConvertToInstanceMethod Convert To Instance Method...
Move Move...
CopyElement Copy...
CloneElement Clone...
SafeDelete Safe Delete...
ExtractMethod Extract Method...
MethodDuplicates Replace Method Code Duplicates...
IntroduceVariable Introduce Variable...
IntroduceField Introduce Field...
IntroduceConstant Introduce Constant...
IntroduceParameter Introduce Parameter...
ExtractInterface Extract Interface...
ExtractSuperclass Extract Superclass...
TurnRefsToSuper Use Interface Where Possible...
MembersPullUp Pull Members Up...
MemberPushDown Push Members Down...
InheritanceToDelegation Replace Inheritance with Delegation...
Inline Inline...
AnonymousToInner Convert Anonymous to Inner...
EncapsulateFields Encapsulate Fields...
ReplaceTempWithQuery Replace Temp with Query...
ReplaceConstructorWithFactory Replace Constructor with Factory Method...
Generify Generify...
Migrate Migrate...
Type Migration Type Migration...
ExtractInclude Extract Include File...
MainMenu > BuildMenu (Build)
ID Name
CompileProject Rebuild Project
CompileDirty Make Project
MakeModule Make Module
Compile Compile
GenerateAntBuild Generate Ant Build
BuildJar Build Jars...
MainMenu > RunMenu (Run)
ID Name
editRunConfigurations Edit Configurations
Stop Stop
Hotswap Reload Changed Classes
StepOver Step Over
StepInto Step Into
StepOut Step Out
ForceStepOver Force Step Over
ForceStepInto Force Step Into
RunToCursor Run to Cursor
Debugger.PopFrame Pop Frame
Pause Pause Program
Resume Resume Program
EvaluateExpression Evaluate Expression...
QuickEvaluateExpression Quick Evaluate Expression
ShowExecutionPoint Show Execution Point
ToggleLineBreakpoint Toggle Line Breakpoint
ToggleMethodBreakpoint Toggle Method Breakpoint
ToggleFieldBreakpoint Toggle Field Watchpoint
ToggleBreakpointEnabled Toggle Breakpoint Enabled
ViewBreakpoints View Breakpoints
ExportThreads Export Threads...
MainMenu > ToolsMenu (Tools)
ID Name
SaveAsTemplate Save as Live Template...
SaveFileAsTemplate Save File as Template...
GenerateJavadoc Generate JavaDoc...
DataSources Data Sources...
MainMenu > ToolsMenu > Macros > StanardMacroActions (Standard Macro Actions)
ID Name
PlaybackLastMacro Playback Last Macro
StartStopMacroRecording Start/Stop Macro Recording
EditMacros Edit Macros...
MainMenu > ToolsMenu >
ID Name
ValidateXml Validate
AddAntBuildFile Add as Ant Build File
GenerateDTD Generate DTD from XML file
MainMenu > ToolsMenu > (Internal Actions)
ID Name
PsiViewer View PSI Structure
DebugListen Throw Debug Exception
VirtualFileInfo Virtual File Info
Merge3Files Merge
DecodeBytesAction Decode Bytes
LocalVcs.ShowStatistics Show Local VCS Statistics...
LocalVcs.ShowRepHistory Repository History
DropAnError Drop an error
ShowUserActivities Show Activities
MainMenu > ToolsMenu > MemoryManagement (Memory Management)
ID Name
DumpPsiMemoryCaches Dump what is cached in PSI
MainMenu > WindowMenu (Window)
ID Name
StoreDefaultLayout Store Current Layout as Default
RestoreDefaultLayout Restore Default Layout
HideActiveWindow Hide Active Window
HideAllWindows Hide All Windows
JumpToLastWindow Jump to Last Window
TogglePinnedMode Pinned Mode
ToggleDockMode Docked Mode
ToggleFloatingMode Floating Mode
NextTab Select Next Tab
PreviousTab Select Previous Tab
CloseActiveTab Close Active Tab
PinActiveTab Pin Active Tab
CloseEditor Close Active Editor
CloseAllEditors Close All Editors
CloseAllEditorsButActive Close All Editors But Active
CloseAllUnmodifiedEditors Close All Unmodified Editors
SplitVertically Split Vertically
SplitHorizontally Split Horizontally
ChangeSplitOrientation Change Splitter Orientation
Unsplit Unsplit
UnsplitAll Unsplit All
NextSplitter Goto Next Splitter
PrevSplitter Goto Previous Splitter
MainMenu > HelpMenu (Help)
ID Name
HelpTopics Help Topics
ShowTips Tip of the Day
ProductivityGude Productivity Guide
OnlineDocAction Online Documentation
WhatsNewAction What's New in IDEA 5.0
Help.KeymapReference Default Keymap Reference
Register Register...
CheckForUpdate Check for Update...
About About
Bookmarks (Bookmarks)
ID Name
ToggleBookmark0 Toggle Bookmark 0
ToggleBookmark1 Toggle Bookmark 1
ToggleBookmark2 Toggle Bookmark 2
ToggleBookmark3 Toggle Bookmark 3
ToggleBookmark4 Toggle Bookmark 4
ToggleBookmark5 Toggle Bookmark 5
ToggleBookmark6 Toggle Bookmark 6
ToggleBookmark7 Toggle Bookmark 7
ToggleBookmark8 Toggle Bookmark 8
ToggleBookmark9 Toggle Bookmark 9
GotoBookmark0 Go to Bookmark 0
GotoBookmark1 Go to Bookmark 1
GotoBookmark2 Go to Bookmark 2
GotoBookmark3 Go to Bookmark 3
GotoBookmark4 Go to Bookmark 4
GotoBookmark5 Go to Bookmark 5
GotoBookmark6 Go to Bookmark 6
GotoBookmark7 Go to Bookmark 7
GotoBookmark8 Go to Bookmark 8
GotoBookmark9 Go to Bookmark 9
DebuggerActions
ID Name
Debugger.AdjustArrayRange Adjust Range...
Debugger.Inspect Inspect
Debugger.CopyValue Copy Value
Debugger.CustomizeContextView Customize Data Views...
Debugger.CustomizeThreadsView Customize Threads View...
Debugger.NewWatch New Watch...
Debugger.EditWatch Edit Watch
Debugger.EditFrameSource EditFrameSource
Debugger.EditNodeSource EditNodeSource
Debugger.EditTypeSource Jump to Object Source
Debugger.RemoveAllWatches Remove All Watches
Debugger.RemoveWatch Remove Watch
Debugger.ViewAsGroup View as
Debugger.SetValue Set Value...
Debugger.ShowFrame Show Frame
Debugger.ResumeThread Resume
Debugger.FreezeThread Freeze
Debugger.MuteBreakpoints Mute Breakpoints
Debugger.ToggleStepThreadSuspendPolicy Suspend All Threads While Stepping
Debugger.AddToWatch Add to Watches
Debugger.Representation
ID Name
Debugger.AutoRenderer Auto
EditorPopupMenu (Editor Popup Menu)
ID Name
Add to migration roots Add to migration roots
ValidateJsp Validate JSP
PackageFile Package file
CompareClipboardWithSelection Compare with Clipboard
ShowAppliedStylesAction Show Applied Styles For Tag
ChangeScheme
ID Name
ChangeColorScheme Switch Color Scheme
ChangeCodeStyleScheme Switch Code Style Scheme
ChangeKeymap Switch Keymap
ChangeLaf Switch Look&Feel
ChangeInspectionProfile Switch Editor Highlighting
ChangeCustomizationSchema Switch Customization Schema
EditorTabPopupMenu
ID Name
MoveEditorToOppositeTabGroup Move Editor To Opposite Tab Group
ProjectViewPopupMenu
ID Name
AssociateWithFileType Associate with File Type
SynchronizeCurrentFile Synchronize selected file
J2EEViewPopupMenu
ID Name
OpenCustomEditor Edit...
FavoritesViewPopupMenu
ID Name
RemoveFromFavorites Remove From Favorites
TypeHierarchyPopupMenu
ID Name
TypeHierarchy.BaseOnThisType Base On This Type
TypeHierarchy.Class Class Hierarchy
TypeHierarchy.Subtypes Subtypes Hierarchy
TypeHierarchy.Supertypes Supertypes Hierarchy
MethodHierarchyPopupMenu
ID Name
MethodHierarchy.ImplementMethodAction Implement Method
MethodHierarchy.OverrideMethodAction Override Method
MethodHierarchy.BaseOnThisType Base On This Type
CallHierarchyPopupMenu
ID Name
CallHierarchy.BaseOnThisType Base On This Method
Lvcs.DirectoryHistoryPopup
ID Name
Lvcs.ShowLvcsDiffAction Compare Versions
Lvcs.RollbackFileAction Rollback File
Vcs.CheckinProjectPopup
ID Name
Vcs.ShowDiffAction Show Changes
Vcs.RollbackChanges Rollback Changes
Vcs.EditSourceAction Edit Source
Vcs.ExcludeAction Exclude from Commit
Vcs.IncludeAction Include into Commit
TestTreePopupMenu
ID Name
openAssertEqualsDiff View assertEquals Difference
TestStatisticsTablePopupMenu
ID Name
JUnitTesting.SelectInTree Select in Tree
UsageView.Popup
ID Name
UsageView.Include Include
UsageView.Exclude Exclude
GuiDesigner.EditorPopupMenu
ID Name
GuiDesigner.PreviewForm Preview
GuiDesigner.DataBindingWizard Data Binding Wizard...
GuiDesigner.LayOutHorizontally Lay Out Horizontally
GuiDesigner.LayOutVertically Lay Out Vertically
GuiDesigner.LayOutInGrid Lay Out In a Grid
GuiDesigner.BreakLayout Break Layout
GuiDesigner.ExpandSelection Expand Selection
GuiDesigner.ShrinkSelection Shrink Selection
GuiDesigner.PropertyInspectorPopupMenu
ID Name
GuiDesigner.QuickJavadoc Quick JavaDoc
StructuralSearchActions
ID Name
StructuralSearchPlugin.StructuralSearchAction Search Structurally...
StructuralSearchPlugin.StructuralReplaceAction Replace Structurally...

This file was generated by Keith Lea using this XSL stylesheet using the file ActionManager.xml . This file is located inside lib/resources.jar , in your IDEA installation folder. under its idea/ folder.


猜你喜欢

转载自blog.csdn.net/weixin_37525569/article/details/79583911
今日推荐