Eclipse Plugin development showing and hiding menuContribution when opening and closing perspective

You can do this in the ‘Visible-When Expression’ for the menu items.

Set the expression to be ‘ImperativeExpression’. And create a class to handle the expression. This class just has a single method annotated with @Evaluate which is called each time the menu item might be displayed:

@Evaluate
public boolean evaluate(EModelService modelService, .... other parameters)
{
  // TODO determine if menu item should be visible
}

This class can then use the getActivePerspective method of EModelService to check if the menu item should be visible.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top