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
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