]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.g3d/src/org/simantics/proconf/g3d/actions/InteractiveAction.java
git-svn-id: https://www.simantics.org/svn/simantics/3d/trunk@22280 ac1ea38d-2e2b...
[simantics/3d.git] / org.simantics.g3d / src / org / simantics / proconf / g3d / actions / InteractiveAction.java
diff --git a/org.simantics.g3d/src/org/simantics/proconf/g3d/actions/InteractiveAction.java b/org.simantics.g3d/src/org/simantics/proconf/g3d/actions/InteractiveAction.java
new file mode 100644 (file)
index 0000000..7631c47
--- /dev/null
@@ -0,0 +1,64 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.proconf.g3d.actions;\r
+\r
+import org.eclipse.jface.action.IToolBarManager;\r
+import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
+import org.simantics.proconf.g3d.input.InputProvider;\r
+\r
+\r
+\r
+/**\r
+ * Context / selection dependent action that requires user's interaction\r
+ * \r
+ * @author Marko Luukkainen\r
+ *\r
+ */\r
+public abstract class InteractiveAction extends ContextAction {\r
+    protected InputProvider input;\r
+    \r
+    public InteractiveAction(ThreeDimensionalEditorBase parent) {\r
+        super(parent);\r
+        input = parent.getInputProvider();\r
+    }\r
+    \r
+    public abstract void update() ;\r
+\r
+    /**\r
+     * Activates the action\r
+     */\r
+    public abstract void activate();\r
+\r
+    /**\r
+     * Deactivates / ends the action\r
+     */\r
+    public abstract void deactivate();\r
+    \r
+    /**\r
+     * Activates the action in the viewer. Normally there's no need to override this method.\r
+     */\r
+    public final void run() {\r
+        parent.setCurrentAction(this);\r
+    }\r
+    \r
+    /**\r
+     * This method is used to end the action, call this from <code>update()</code>.\r
+     *\r
+     */\r
+    public void end() {\r
+        parent.setCurrentAction(parent.getDefaultAction());\r
+    }\r
+    \r
+    public void fillToolBar(IToolBarManager manager) {\r
+        \r
+    }\r
+\r
+}\r