How to bring up a plugin

Hi,
          I m new to Intellij. I followed the steps here https://confluence.jetbrains.com/display/IDEADEV/Getting+Started+with+Plugin+Development ,  to create a sample menu (plugin). When i run the plugin, i am not able to see the new menu i have created. Can someone point out what i am missing. I am using Idea 12.0.1 and java. I tried with 1.6 with no luck.

plugin.xml:

     <actions>

          <group id="MyPlugin.SampleMenu" text="_Sample Menu" description="Sample menu">
              <add-to-group group-id="MainMenu" anchor="last"  />
              <action id="Myplugin.Textboxes" text="Text _Boxes" description="A test menu item" />
          <!--    <action id="Myplugin.Dialogs" text="Show _Dialog" description="A test menu item" />-->
          </group>
    </action>

Class:

package org.sample;
public class TextBoxAction extends AnAction {

     public TextBoxAction() {
           super("Text _Boxes");
     }


         @Override
        public void actionPerformed(AnActionEvent event) {

            Project project = event.getData(PlatformDataKeys.PROJECT);
            String txt= Messages.showInputDialog(project, "What is your name?", "Input your name", Messages.getQuestionIcon());
            Messages.showMessageDialog(project, "Hello, " + txt + "!\n I am glad to see you.", "Information", Messages.getInformationIcon());
        }
}

11 comments
Comment actions Permalink

Please check Project Settings | Modules | <your module> | Plugin Deployment and make sure that the "Path to META-INF\plugin.xml" is specified correctly and points to your plugin.xml file.

0
Comment actions Permalink

yes, looks like it is correct. I am attaching the screen shot



Attachment(s):
project structure.png
0
Comment actions Permalink
When i run the plugin, i am not able to see the new menu i have created


How do you run it?
I have just tried your code on a fresh new plugin using idea 13 and it works fine, your menu is there, also the text boxes work.
You need to specify a run configuration of type plugin and a sdk which must be an intellij sdk.

Bildschirmfoto 2014-11-29 um 05.58.54.png
Bildschirmfoto 2014-11-29 um 06.00.24.png

0
Comment actions Permalink

for sdk, i first selected the java installation folder, then the idea installation folder.
for testing the plugin,, i went to edit configuration, clicked on +, selected plugin, then gave it a name, my project name "sample" was selected by default.
attaching the screen shots as well.



Attachment(s):
sdk settings.png
run configuration.png
project sdk.png
0
Comment actions Permalink

looks all good
now if you run it should start an other IDE and you should see the new menu.
can you post the screenshot of new running IDE

0
Comment actions Permalink

attached is the screen shot of the 2nd ide



Attachment(s):
2nd ide.png
0
Comment actions Permalink

just realisied you are doing it with intellij 12.0.1, propably this is the problem ;-)

0
Comment actions Permalink

Yes could be, to clarify this, i installed idea 14.0.1 community edition. but had the same results. My system is win 7. Attaching the screen shots.

I thought the system could be the problem and tried in another system win xp, with the community edition, but same thing there also.



Attachment(s):
module_14.0.1_community.png
second ide 14.0.1 community.png
project sdk 14.0.1 community.png
project 14.0.1 communit.png
0
Comment actions Permalink

one more thing, it could be you caused somehow an exception on plugin startup in past, then idea will deactivate the plugin in that case.

check if it is enabled inside the new running instance

Bildschirmfoto 2014-12-01 um 04.17.06.png

0
Comment actions Permalink

I dind not have that plugin at all...I installed it (in the 14.0.1 community edition), and then i was a ble to see two of the actions getting executed, except the one on the group-id="MainMenu". Attached are the scree shots of the other two.
I checked in the 12.0.1,, there also i did not find this plugin, i tried to install, but did not get one which is compatible with 12.0.1.

finally 2 more issues remain open

1.) how to get the action added "to MainMenu" working?
2.) do we have "plugin name here" plugin for 12.0.1 ultimate, if yes can you please provide the link...



Attachment(s):
action 2.png
action 1.png
0
Comment actions Permalink

nothe issues got resolved:

issue 1.) to add action to the main menu, looks like we need to use group

i had this, and it did not show up in the menu bar

<action id="MyTextAction" text="MyTextBox" description="testing plugin">
          <add-to-group group-id="MainMenu" anchor="last"/>
      </action>

i changed it to

<group id="MyPlugin.SampleMenu" text="_Sample Menu" description="Sample menu">
              <add-to-group group-id="MainMenu" anchor="last"  />
              <action id="MypluginTextboxes" text="Text _Boxes" description="A test menu item" />
              <!--<action id="Myplugin.Dialogs" text="Show _Dialog" description="A test menu item" />-->
          </group>


issue 2.) cleaning the sand box did the job...

Thank you all for the help!!

0

Please sign in to leave a comment.