KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > handlers > WorkbenchWindowHandlerDelegate


1 /*******************************************************************************
2  * Copyright (c) 2004, 2006 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
12 package org.eclipse.ui.internal.handlers;
13
14 import org.eclipse.core.commands.ExecutionEvent;
15 import org.eclipse.core.commands.ExecutionException;
16 import org.eclipse.jface.action.IAction;
17 import org.eclipse.jface.viewers.ISelection;
18 import org.eclipse.ui.IWorkbenchWindow;
19
20 /**
21  * A handler that can be used to imitate a IWorkbenchWindowActionDelegate.
22  *
23  * @since 3.1
24  */

25 public abstract class WorkbenchWindowHandlerDelegate extends
26         ExecutableExtensionHandler implements IWorkbenchWindowHandlerDelegate {
27
28     /**
29      * By default, this will do nothing. Subclasses may override.
30      *
31      * @param window
32      * the window that provides the context for this delegate
33      * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
34      */

35     public void init(final IWorkbenchWindow window) {
36         // Do nothing by default.
37
}
38
39     /**
40      * This simply calls execute with a <code>null</code> map of parameter
41      * values. If an <code>ExecutionException</code> occurs, then this should
42      * be handle somehow. It's not clear what we'll do yet.
43      *
44      * @param action
45      * The action proxy that handles the presentation portion of the
46      * action
47      * @see org.eclipse.ui.IActionDelegate#run(IAction)
48      */

49     public void run(final IAction action) {
50         try {
51             execute(new ExecutionEvent());
52         } catch (final ExecutionException e) {
53             // TODO Do something meaningful and poignant.
54
}
55     }
56
57     /**
58      * By default, this will do nothing. Subclasses may override.
59      *
60      * @param action
61      * The action proxy that handles presentation portion of the
62      * action
63      * @param selection
64      * The current selection, or <code>null</code> if there is no
65      * selection.
66      *
67      * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
68      */

69     public void selectionChanged(IAction action, ISelection selection) {
70         // Do nothing be default.
71
}
72 }
73
Popular Tags