[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform] Popup Menu item enablement

I enable/disable an action in the selectionChanged() event, see below:

public class PublishAction implements IViewActionDelegate
{......

	public void selectionChanged(IAction action, ISelection selection) {
		
		boolean canPublish = false;
		boolean isEnabled = false;
		
		canPublish = .....
		isEnabled = ...(checks some outside condition)

		action.setEnabled(canPublish && isEnabled);
	}
}

So when user selects a tree item, right click to bring up the popup menu, "publish" can be enabled/disabled.

The problem I have is, when the outside condition is changed, if the user come back to the same selected tree item, selectionChanged() is not triggered, even the enablement should be changed for "publish", it won't happen.

It isn't an option to add enablement to the action in the plugin.xml. the algorithm isn't a simple object property.

Appreciate your help.