01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 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.actions;
11:
12: import org.eclipse.jface.action.IAction;
13: import org.eclipse.jface.viewers.ISelection;
14: import org.eclipse.swt.widgets.Event;
15: import org.eclipse.ui.IActionDelegate2;
16:
17: /**
18: * Abstract base implementation of <code>IActionDelegate</code> and
19: * <code>IActionDelegate2</code> for a client delegate action.
20: * <p>
21: * Subclasses should reimplement <code>runWithEvent</code> or <code>run</code>
22: * methods to do the action's work, and may reimplement
23: * <code>selectionChanged</code> to react to selection changes in the workbench.
24: * </p>
25: */
26: public abstract class ActionDelegate implements IActionDelegate2 {
27: /**
28: * The <code>ActionDelegate</code> implementation of this
29: * <code>IActionDelegate</code> method does nothing. Subclasses may
30: * reimplement.
31: * <p>
32: * <b>Note:</b> This method is not called directly by the proxy action. Only
33: * by the default implementation of <code>runWithEvent</code> of this
34: * abstract class.
35: */
36: public void run(IAction action) {
37: }
38:
39: /**
40: * The <code>ActionDelegate</code> implementation of this
41: * <code>IActionDelegate</code> method does nothing. Subclasses may
42: * reimplement.
43: */
44: public void selectionChanged(IAction action, ISelection selection) {
45: }
46:
47: /**
48: * The <code>ActionDelegate</code> implementation of this
49: * <code>IActionDelegate2</code> method does nothing. Subclasses may
50: * reimplement.
51: */
52: public void init(IAction action) {
53: }
54:
55: /**
56: * The <code>ActionDelegate</code> implementation of this
57: * <code>IActionDelegate2</code> method does nothing. Subclasses may
58: * reimplement.
59: */
60: public void dispose() {
61: }
62:
63: /**
64: * The <code>ActionDelegate</code> implementation of this
65: * <code>IActionDelegate2</code> method redirects to the <code>run</code>
66: * method. Subclasses may reimplement.
67: */
68: public void runWithEvent(IAction action, Event event) {
69: run(action);
70: }
71: }
|