4 comments
Comment actions Permalink

Why do you want to do that? Are you sure the users of your plugin would be happy with that behavior? It is completely different from all the UI principles used in IntelliJ IDEA.

0
Comment actions Permalink

Suppose If i wanna provide an context menu which will convert java class into xml file,so it would be good to make that menu visible only when user will select java file.
Such things can be done easily in ECLIPSE IDE by defining visible when tag in plugin.xml, so i was just curious whether it is possible in INTELLJ IDE or not.

0
Comment actions Permalink

Ah, so you don't actually want the menu to appear when the file is selected. When the file is right-clicked, a menu already appears, and you don't need to do anything for that.

To show an action only when some condition is true, you need to override AnAction.update() and set the visibility of the action according to your requirements. Something like that:

    publicvoid update(AnActionEvent event) {
        PsiFile psiFile = event.getData(DataKeys.PSI_FILE);
        event.getPresentation().setVisible(psiFile instanceof PsiJavaFile);
    }

0
Comment actions Permalink

thanks for support
I have to admit JETBRAINS developer forum is really responsive and helpful
and i hope it will help me to switch from eclipse to intellij idea:):)

0

Please sign in to leave a comment.