javaeclipseeclipse-rcpeclipse-pde

Eclipse RCP - active dialog from command handler


I've registered a key binding in the org.eclipse.ui.contexts.dialogAndWindow context.
I've then associated a command handler

public class QuickActionsHandler extends AbstractHandler {
  @Override
  public Object execute(final ExecutionEvent event) throws ExecutionException {
     ...

Now, how do I get the active Dialog view part from the ExecutionEvent?


Solution

  • Dialogs are not view parts - they are generally just windows extending org.eclipse.jface.dialogs.Dialog

    Probably the best you can do is get the currently active Shell:

    Shell shell = HandlerUtil.getActiveShell(event);