Add mute feature for existing eclipse plugin

I have an existing Eclipse plugin that runs as a regular IDE plugin, accepts commands from the GUI and returns the output in user views.

I want to add the ability to also be able to run this plugin in headless mode, with the input received from the command line and the output going to some file. Is there a way to modify an existing plugin to support this runtime in addition to the existing regular execution , or do I need to create a new plugin without a header and just use the code from the first?

+3
source share
1 answer

It depends on how you plan to use this plugin and the main question: is there a case where your dependencies in the user interface will not be available, i.e. Is there a package configuration without SWT and RCP packets?

No user interfaces available

In this case, you will need to extract the headless part of your plugin into a new plugin, which then registers a mute entry point. Part of the plugin's user interface will depend on the new plugin and simply delegate the user interface requests to the corresponding API in the headless part.

To provide a headless application, you should take a look at the org.eclipse.equinox.app.IApplication interface and the org.eclipse.equinox.applications extension point, respectively. When you have defined the application, you launch it by simply calling:

eclipse -application <app-id> <app-param>

More information can be found in the Eclipse Help .

Accessible user interface

The simplest case. You need to specify only the access point without a head, and everything will work as before.

However, my experience shows that sooner or later a case arises when a plug-in needs to be divided, and depending on its complexity, it can cause more problems than it would if it had been unchained earlier.

+1
source

Source: https://habr.com/ru/post/908925/


All Articles