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

2 comments
Comment actions Permalink

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
Comment actions Permalink

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.