KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > IActionDelegate2


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;
12
13 import org.eclipse.jface.action.IAction;
14 import org.eclipse.swt.widgets.Event;
15
16 /**
17  * Interface extension to <code>IActionDelegate</code> adding lifecycle methods.
18  * In addition, a <code>runWithEvent</code> method that includes the triggering
19  * SWT event.
20  * <p>
21  * An action delegate that implements this interface will have its
22  * <code>runWithEvent(IAction, Event)</code> called instead of its
23  * <code>run(IAction)</code> method.
24  * </p><p>
25  * Clients should implement this interface, in addition to
26  * <code>IActionDelegate</code> or sub-interfaces, if interested in the
27  * triggering event or in the lifecycle of the delegate object.
28  * </p><p>
29  * Clients can choose to subclass the provided abstract implementation
30  * <code>org. eclipse. ui. actions. ActionDelegate</code> or implement the
31  * interface directly.
32  * </p>
33  *
34  * @see org.eclipse.ui.actions.ActionDelegate
35  * @see org.eclipse.ui.IActionDelegate
36  * @since 2.1
37  */

38 public interface IActionDelegate2 extends IActionDelegate {
39     /**
40      * Allows the action delegate to initialize itself after being created by
41      * the proxy action. This lifecycle method is called after the
42      * action delegate has been created and before any other method of the
43      * action delegate is called.
44      *
45      * @param action the proxy action that handles the presentation portion of
46      * the action.
47      */

48     public void init(IAction action);
49
50     /**
51      * Allows the action delegate to clean up. This lifecycle method is called
52      * when the proxy action is done with this action delegate. This is the last
53      * method called.
54      */

55     public void dispose();
56
57     /**
58      * Performs this action, passing the SWT event which triggered it. This
59      * method is called by the proxy action when the action has been triggered.
60      * Implement this method to do the actual work.
61      * <p>
62      * <b>Note:</b> This method is called instead of <code>run(IAction)</code>.
63      * </p>
64      *
65      * @param action the action proxy that handles the presentation portion of
66      * the action
67      * @param event the SWT event which triggered this action being run
68      * @since 2.0
69      */

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