Invoking a dialog from another plugin

Answered

I wrote two plugins each with their own functionality. Now i would like to invoke a dialog from plugin A in plugin B.

I've added <depends>plugin A</depends> to plugin B plugins.xml

The dialog class is available in plugin B. When I start the dialog, it tries to retrieve the ProjectState for plugin A. This is necessary for the dialog to work properly.

I get the following Exception (TPCM is plugin A).

java.lang.ClassCastException: nl.frankdekker.TPCM.Config.TargetProcessProjectState cannot be cast to nl.frankdekker.TPCM.Config.TargetProcessProjectState
at nl.frankdekker.TPCM.Config.TargetProcessProjectState.getInstance(TargetProcessProjectState.java:31)
at nl.frankdekker.TPCM.TaskDialog.restoreState(TaskDialog.java:143)
at nl.frankdekker.TPCM.TaskDialog.createCenterPanel(TaskDialog.java:93)
at com.intellij.openapi.ui.DialogWrapper.init(DialogWrapper.java:1279)

It seems im unable to retrieve the ProjectState for plugin A. How can this be solved?

 

Much appreciated

0
2 comments

Hi Frank,

such errors may happen if there are two TargetProcessProjectState classes loaded by different classloaders. Probably you packaged TargetProcessProjectState.class into the both plugins, you should package it into plugin A jars only.

0

Doh, I had indeed included the plugin in the other plugin project. For code completion purposes. Didn't realize it was actually included in the final jar.

Thanks!

0

Please sign in to leave a comment.