]> gerrit.simantics Code Review - simantics/3d.git/blob - dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/InteractiveAction.java
latest release (0.41)
[simantics/3d.git] / dev / org.simantics.proconf.g3d / src / org / simantics / proconf / g3d / actions / InteractiveAction.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.\r
3  * All rights reserved. This program and the accompanying materials\r
4  * are made available under the terms of the Eclipse Public License v1.0\r
5  * which accompanies this distribution, and is available at\r
6  * http://www.eclipse.org/legal/epl-v10.html\r
7  *\r
8  * Contributors:\r
9  *     VTT Technical Research Centre of Finland - initial API and implementation\r
10  *******************************************************************************/\r
11 package org.simantics.proconf.g3d.actions;\r
12 \r
13 import org.eclipse.jface.action.IToolBarManager;\r
14 import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
15 import org.simantics.proconf.g3d.input.InputProvider;\r
16 \r
17 \r
18 \r
19 /**\r
20  * Context / selection dependent action that requires user's interaction\r
21  * \r
22  * @author Marko Luukkainen\r
23  *\r
24  */\r
25 public abstract class InteractiveAction extends ContextAction {\r
26     protected InputProvider input;\r
27     \r
28     public InteractiveAction(ThreeDimensionalEditorBase parent) {\r
29         super(parent);\r
30         input = parent.getInputProvider();\r
31     }\r
32     \r
33     public abstract void update() ;\r
34 \r
35     /**\r
36      * Activates the action\r
37      */\r
38     public abstract void activate();\r
39 \r
40     /**\r
41      * Deactivates / ends the action\r
42      */\r
43     public abstract void deactivate();\r
44     \r
45     /**\r
46      * Activates the action in the viewer. Normally there's no need to override this method.\r
47      */\r
48     public final void run() {\r
49         parent.setCurrentAction(this);\r
50     }\r
51     \r
52     /**\r
53      * This method is used to end the action, call this from <code>update()</code>.\r
54      *\r
55      */\r
56     public void end() {\r
57         parent.setCurrentAction(parent.getDefaultAction());\r
58     }\r
59     \r
60     public void fillToolBar(IToolBarManager manager) {\r
61         \r
62     }\r
63 \r
64 }\r