What is the elegant way to register TypedActionHandler?

Answered

Hi,

 

I am a newbie and heard that Idea uses some sort of OSGI for plugins but at example I found a hack way with a static section.

There is an AnAction class which contract is not used by me at all. It's used just to reference class from plugin.xml

 

public class EditorIllustration extends AnAction {
static {

final EditorActionManager actionManager = EditorActionManager.getInstance();
final TypedAction typedAction = actionManager.getTypedAction();
typedAction.setupHandler(new MyTypeHandler());

}

 

So is there a way to register MyTypeHandler directly via plugin.xml?

 

1
2 comments

You can register you MyTypeHandler in plugin.xml as an extension for extension point 'com.intellij.editorTypedHandler'.

0

@Dmitry Batrak 

Can you give me an example

 

0

Please sign in to leave a comment.