javaeclipseeclipse-plugineclipse-rcp

How to access the Eclipse Servers plugin from my plugin


I'm writing an Eclipse plugin in Java. I'd like to be able to access the Servers plugin (that comes with the Eclipse Java EE version). For example, I'm hoping I can trigger the Start or Terminate buttons from my plugin.

I found this answer: Getting the content of a view Eclipse RCP

In order to make it work, I need to know:

Where do I find the ID for the Servers view? What plugin/package do I need to import? What implementation of IViewPart do I cast too?

And then I can hope that they provided some public methods that I can call that do what I want.

EDIT: The Plugin Selection Spy provided some helpful information-- I know the relevant classes and packages now. If I could get access the TreeSelection class and the Server objects, I think I can do what I want. Unfortunately, ServersView2 doesn't seem to provide any public access to the TreeSelection...enter image description here


Solution

  • You can skip dealing with the plugin-- to get access to the server instances in eclipse, use ServerCore:

    https://eclipse.dev/webtools/wst/api/org/eclipse/wst/server/core/ServerCore.html#getServers()