KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > actions > ActionDelegate


1 /*******************************************************************************
2  * Copyright (c) 2000, 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 package org.eclipse.ui.actions;
12
13 import org.eclipse.jface.action.IAction;
14 import org.eclipse.jface.viewers.ISelection;
15 import org.eclipse.swt.widgets.Event;
16 import org.eclipse.ui.IActionDelegate2;
17
18 /**
19  * Abstract base implementation of <code>IActionDelegate</code> and
20  * <code>IActionDelegate2</code> for a client delegate action.
21  * <p>
22  * Subclasses should reimplement <code>runWithEvent</code> or <code>run</code>
23  * methods to do the action's work, and may reimplement
24  * <code>selectionChanged</code> to react to selection changes in the workbench.
25  * </p>
26  */

27 public abstract class ActionDelegate implements IActionDelegate2 {
28     /**
29      * The <code>ActionDelegate</code> implementation of this
30      * <code>IActionDelegate</code> method does nothing. Subclasses may
31      * reimplement.
32      * <p>
33      * <b>Note:</b> This method is not called directly by the proxy action. Only
34      * by the default implementation of <code>runWithEvent</code> of this
35      * abstract class.
36      */

37     public void run(IAction action) {
38     }
39
40     /**
41      * The <code>ActionDelegate</code> implementation of this
42      * <code>IActionDelegate</code> method does nothing. Subclasses may
43      * reimplement.
44      */

45     public void selectionChanged(IAction action, ISelection selection) {
46     }
47
48     /**
49      * The <code>ActionDelegate</code> implementation of this
50      * <code>IActionDelegate2</code> method does nothing. Subclasses may
51      * reimplement.
52      */

53     public void init(IAction action) {
54     }
55
56     /**
57      * The <code>ActionDelegate</code> implementation of this
58      * <code>IActionDelegate2</code> method does nothing. Subclasses may
59      * reimplement.
60      */

61     public void dispose() {
62     }
63
64     /**
65      * The <code>ActionDelegate</code> implementation of this
66      * <code>IActionDelegate2</code> method redirects to the <code>run</code>
67      * method. Subclasses may reimplement.
68      */

69     public void runWithEvent(IAction action, Event event) {
70         run(action);
71     }
72 }
73
Popular Tags