01: /*******************************************************************************
02: * Copyright (c) 2005, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.quickaccess;
11:
12: import org.eclipse.core.commands.AbstractHandler;
13: import org.eclipse.core.commands.ExecutionEvent;
14: import org.eclipse.jface.dialogs.PopupDialog;
15: import org.eclipse.ui.IWorkbenchWindow;
16: import org.eclipse.ui.handlers.HandlerUtil;
17:
18: /**
19: * Handler for quick access pop-up dialog, showing UI elements such as editors,
20: * views, commands.
21: *
22: */
23: public class QuickAccessHandler extends AbstractHandler {
24:
25: private IWorkbenchWindow window;
26:
27: /**
28: * The constructor.
29: */
30: public QuickAccessHandler() {
31: }
32:
33: public Object execute(ExecutionEvent executionEvent) {
34:
35: window = HandlerUtil.getActiveWorkbenchWindow(executionEvent);
36: if (window == null) {
37: return null;
38: }
39:
40: final PopupDialog popupDialog = new QuickAccessDialog(window,
41: executionEvent.getCommand());
42: popupDialog.open();
43: return null;
44: }
45:
46: }
|