Pascal
Pascal

Reputation: 2174

eclipse e4 PartStack change listener

i need a listener for my partstack when someone clicks on another tab.

I have seen that PartStack should have an function addListener. But it seems this function is not avaliable anymore :(

https://www.cct.lsu.edu/~rguidry/ecl31docs/api/org/eclipse/ui/internal/PartStack.html

Also the idea to register an IPartListener on EPartService seems to be wrong here.

Upvotes: 0

Views: 259

Answers (1)

greg-449
greg-449

Reputation: 111216

You can use the IPartListener from EPartService.

The listener tells you about changes to the state of all parts, you can check if the part is in the part stack you are interested with something like:

@Override
public void partActivated(final MPart part)
{
  Object parent = part.getParent();

  if (parent instanceof MPartStack)
   {
     MPartStack partStack = (MPartStack)parent;

     String stackId = partStack.getElementId();

     // TODO check the id is your stack
   }      

Upvotes: 1

Related Questions