How can I check the plugin-module-state?

Marc October 16, 2012

Hello everone,

I develop a jira-plugin with 3 moduels.

Now I need a state of one Module from this plugin. Can anybody tell me how I can get it.

Best regards

MarC

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Adrien Ragot 2
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 28, 2013

Hi Marc,

Use PluginAccessor#isPluginModuleEnabled(completeKey). Example:

public MyAction(PluginAccessor pluginAccessor) { 
    this.pluginAccessor = pluginAccessor;
}
boolean myMethod() {
return pluginAccessor.isPluginModuleEnabled("org.marc:my-plugin-module-key");
}

Note that PluginController allows you to control the plugin too:

public MyAction(PluginController pluginController) {
    this.pluginController = pluginController;
}
void myMethodToDisable() {
pluginController.disablePluginModule("org.marc:my-plugin-module-key");
}

0 votes
Bhushan Nagaraj
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 17, 2012

Hi Marc,

Sorry your question initially wasn't very clear.

If you want to do it through code, try this

Collection<Plugin> plugins = ComponentAccessor.getPluginAccessor().getPlugins();
        for(Plugin plugin:plugins){
            //If it is the servlet plugin thaty ou are after
            if(plugin.getModuleDescriptor().getPluginKey() == <key of your servlet module>){
                //Check if it is enabled
                plugin.isEnabled();
                //Do something
            }
        }

Marc October 17, 2012

Iam Soory but your code-examble doesn't work under jira 5.1.3...

The mothode getModuleDescriptor() need a string as parameter and the methode
isEnabled()is deprecated.

Can you write a new example-code?

Marc October 25, 2012

Has nobody a fix for the code to make it runnable under JIRA 5.1.x/5.2.EAP?

0 votes
Bhushan Nagaraj
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 16, 2012

Hi Marc,

Refer to "Viewing Installed Plugins" at

https://confluence.atlassian.com/display/JIRA/Managing+JIRA's+Plugins

Marc October 16, 2012

Hello nbhushan,

Iam looking for a java-code, to query the plugin-module-step. I know that user can enable and disable the completly plugin or some plugin-module (plugin-components).

My develop plugin consist of 3 plugin-modules (IssueTabPanel, Servlet, Gadget). The IssueTabPanel can only work when Servlet-module is enabel. How can I check it in my java-code?

Best regards

MarC

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events