Actionクラスを作成ActionクラスはIEditorActionDelegateインターフェースを実装。 今回、net.sf.amateras.air.actions.CommentAction
という名前で作成。
plugin.xmlはこんな感じ <extension point="org.eclipse.ui.editorActions" name="AIR GEAREditorContribution" id="net.sf.amateras.air.editor.editorContribution"> <editorContribution targetID="net.sf.amateras.air.as.ActionScriptEditor" id="net.sf.amateras.air.editor.editorContribution"> <action class="net.sf.amateras.air.actions.CommentAction" label="Toggle Comment" id="net.sf.amateras.air.actions.ToggleComment" definitionId="net.sf.amateras.air.actions.ToggleComment"/> </editorContribution> </extension>
<extension point="org.eclipse.ui.commands"> <category name="AIR GEAR - Editor" description="AIR GEAR editor category" id="net.sf.amateras.air.category.source"> </category> <command id="net.sf.amateras.air.actions.ToggleComment" name="ToggleComment" categoryId="net.sf.amateras.air.category.source" /> </extension>
<extension point="org.eclipse.ui.bindings"> <key sequence="M1+/" contextId="net.sf.amateras.air.editor.textEditorScope" commandId="net.sf.amateras.air.actions.ToggleComment" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" /> </extension> <extension point="org.eclipse.ui.contexts"> <context name="AIR GEAR AS3editor" parentId="org.eclipse.ui.textEditorScope" description="AIR GEAR editor scope" id="net.sf.amateras.air.editor.textEditorScope"> </context> </extension>
全てが必要かどうかは不明。。。
自作Editorには以下のコードを追加 @Override protected void initializeKeyBindingScopes() { super.initializeKeyBindingScopes(); setKeyBindingScopes(new String[] { "net.sf.amateras.air.editor.textEditorScope" }); }
plugin.xmlでEditorのScopeを作ったが、Editorクラスとのマッピング情報ないよね? ってちょっとハマったが、これはEditorで書かなければいけないみたい。
|
|