0
votes

I have added an extension command handler which would be active when the short cut command is executed from a particular editor or view. In the same handler class, I would want to have some part of implementation specific to view. How do we identify whether the event was triggered from view or from an editor using ExecutionEvent

1

1 Answers

0
votes

The org.eclipse.ui.handlers.HandlerUtil class provides a lot of helper methods for things like this.

In this case getActivePart is probably what you want:

public static IWorkbenchPart getActivePart(ExecutionEvent event)

The part will be an IViewPart or IEditorPart depending on what was active