Home > Back-end >  Eclipse Plug-In uninstall event handler (to remove perspective)
Eclipse Plug-In uninstall event handler (to remove perspective)

Time:10-31

We are building a plugin for an RCP application that provides a perspective.

The problem is that, when the plugin is uninstalled, the perspective remains as an available choice. This is apparently intended behaviour (see here and here).

However, our requirements are

  1. The perspective should not be visible after plugin uninstall
  2. If the plugin is installed, it should be possible to start the application directly into the perspective (e.g. via the -Dperspective=<my-perspective> runtime option)

A workaround to achieve (1) would be to remove the perspective from the application model on application shutdown (using e.g. @EventTopic.UILifeCycle.APP_SHUTDOWN_STARTED) and add again via the plugin on each application start (@EventTopic.UILifeCycle.APP_STARTUP_COMPLETE).

The problem with this is that when starting with -Dperspective, Eclipse tries to switch to the new perspective before APP_STARTUP_COMPLETE, i.e. the perspective is not available then. This causes the platform to fall back to some other perspective.

What can I do to achieve both (1) and (2)?

CodePudding user response:

I think what I was looking for was to specify "P2 touchpoint instruction advice", a.k.a. "P2 actions".

Here's some official documentation although it's very sparse. Here's a much more helpful blog post coming with an example implementation that illustrates how to call a specific handler if a feature is (un)installed.

Here's another nice article going more into P2 touchpoints and generic P2 actions.

  • Related