0

I have 2 plugins that work properly when I start them from the menu. I would however like to start the second plugin when I click on a button on the UI of the first plugin.

I have looked into getBundle().start() method as advised here: https://www.eclipse.org/forums/index.php/t/99869/ but it did not produce any result. The second bundle shows its bundle state as ACTIVE when printed on console, but its UI doesn't show on the screen.

Any help would be greatly appreciated!

  • The Activator start method should only be called by Eclipse itself, this will be done automatically at the appropriate time. What exactly is it that this second plugin is supposed to do? Note that the start method is not an appropriate place to be doing GUI operations. – greg-449 Feb 08 '17 at 08:09
  • The second plugin has its own GUI on which it displays graphs. My first plugin provides the information which the second plugin could use to display the graph. I am not able to start the second plugin programmatically though. – Anish Kanchan Feb 08 '17 at 22:23

2 Answers2

0

Make your second plugin provide an API that displays the graph that the first plugin can call when the button is clicked. This API might be as simple as a single method to call, it will probably be similar to the code you use in the menu.

In the second plugin add the package containing the API to the 'Export-Package' list in the MANIFEST.MF (in the MANIFEST.MF editor you do this on the 'Runtime' tab in the 'Exported Packages' list).

In the first plugin add the second plugin to its dependencies - the 'Require-Bundle' list in the MANIFEST.MF (in the editor this is the 'Required Plug-ins' on the 'Dependencies' tab).

greg-449
  • 109,219
  • 232
  • 102
  • 145
0

I referred to the following post: Programmatically showing a View from an Eclipse Plug-in

The following code finally worked for me:

Display.getDefault().asyncExec(new Runnable() {
    @Override
    public void run() {
       PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("viewId");

    }
});
Community
  • 1
  • 1