KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > quickaccess > QuickAccessHandler


1 /*******************************************************************************
2  * Copyright (c) 2005, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.quickaccess;
12
13 import org.eclipse.core.commands.AbstractHandler;
14 import org.eclipse.core.commands.ExecutionEvent;
15 import org.eclipse.jface.dialogs.PopupDialog;
16 import org.eclipse.ui.IWorkbenchWindow;
17 import org.eclipse.ui.handlers.HandlerUtil;
18
19 /**
20  * Handler for quick access pop-up dialog, showing UI elements such as editors,
21  * views, commands.
22  *
23  */

24 public class QuickAccessHandler extends AbstractHandler {
25
26     private IWorkbenchWindow window;
27
28     /**
29      * The constructor.
30      */

31     public QuickAccessHandler() {
32     }
33
34     public Object JavaDoc execute(ExecutionEvent executionEvent) {
35
36         window = HandlerUtil.getActiveWorkbenchWindow(executionEvent);
37         if (window == null) {
38             return null;
39         }
40
41         final PopupDialog popupDialog = new QuickAccessDialog(window, executionEvent.getCommand());
42         popupDialog.open();
43         return null;
44     }
45
46 }
Popular Tags