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>
group-id
attribute.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... |
| |
---|---|
ID | Name |
CreateRunConfiguration | Create Run Configuration |
(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 |
| |
---|---|
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 |
(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 |
(New) | |
---|---|
ID | Name |
NewClass | Class |
NewInterface | Interface |
NewEnum | Enum |
NewAnnotationType | @Interface |
NewFile | File |
NewDir | Directory/Package |
NewFromTemplate | From Template |
NewDialog | Dialog |
(Local History) | |
---|---|
ID | Name |
LocalVcs.ShowHistory | Show History |
LocalVcs.HistoryForBlock | Show History for Selection |
LocalVcs.AddLabel | Add Label... |
(Version Control) | |
---|---|
ID | Name |
Vcs.MarkSourcesAsCurrent | Mark Project as Current |
(Version Control Group) | |
---|---|
ID | Name |
Vcs.FileView | Show File View |
Vcs.UpdateProject | Update Project |
Vcs.ProjectStatus | Check Project Status |
(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 |
(Edit) | |
---|---|
ID | Name |
$Undo | Undo |
$Redo | Redo |
$SelectAll | Select All |
NewElement | New... |
$Delete | Delete |
ToggleBookmark | Toggle Bookmark |
ShowBookmarks | Show Bookmarks |
| |
---|---|
ID | Name |
$Cut | Cut |
$Copy | Copy |
CopyPaths | Copy Paths |
CopyReference | Copy Reference |
$Paste | Paste |
PasteMultiple | Paste... |
(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... |
(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... |
| |
---|---|
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 |
| |
---|---|
ID | Name |
CommanderSyncViews | Synchronize Views |
CommanderSwapPanels | Swap Panels |
| |
---|---|
ID | Name |
ProjectViewChangeView | Change View |
(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 |
(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 |
(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 |
(Complete Code) | |
---|---|
ID | Name |
CodeCompletion | Basic |
WordCompletion | Complete Word |
SmartTypeCompletion | SmartType |
ClassNameCompletion | Class Name |
(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... |
(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... |
(Build) | |
---|---|
ID | Name |
CompileProject | Rebuild Project |
CompileDirty | Make Project |
MakeModule | Make Module |
Compile | Compile |
GenerateAntBuild | Generate Ant Build |
BuildJar | Build Jars... |
(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... |
(Tools) | |
---|---|
ID | Name |
SaveAsTemplate | Save as Live Template... |
SaveFileAsTemplate | Save File as Template... |
GenerateJavadoc | Generate JavaDoc... |
DataSources | Data Sources... |
(Standard Macro Actions) | |
---|---|
ID | Name |
PlaybackLastMacro | Playback Last Macro |
StartStopMacroRecording | Start/Stop Macro Recording |
EditMacros | Edit Macros... |
| |
---|---|
ID | Name |
ValidateXml | Validate |
AddAntBuildFile | Add as Ant Build File |
GenerateDTD | Generate DTD from XML file |
|
---|