X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.g3d%2Fsrc%2Forg%2Fsimantics%2Fproconf%2Fg3d%2Factions%2FInteractiveAction.java;fp=org.simantics.g3d%2Fsrc%2Forg%2Fsimantics%2Fproconf%2Fg3d%2Factions%2FInteractiveAction.java;h=7631c47bf4df65590f83b956ab8c6b1fd2312d99;hb=10f144a2bb2d7bec98b812b83acecb333fd098ea;hp=0000000000000000000000000000000000000000;hpb=3055b543aa5afc0cca4bb3b341704e7c5103fa6a;p=simantics%2F3d.git 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 index 00000000..7631c47b --- /dev/null +++ b/org.simantics.g3d/src/org/simantics/proconf/g3d/actions/InteractiveAction.java @@ -0,0 +1,64 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.proconf.g3d.actions; + +import org.eclipse.jface.action.IToolBarManager; +import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase; +import org.simantics.proconf.g3d.input.InputProvider; + + + +/** + * Context / selection dependent action that requires user's interaction + * + * @author Marko Luukkainen + * + */ +public abstract class InteractiveAction extends ContextAction { + protected InputProvider input; + + public InteractiveAction(ThreeDimensionalEditorBase parent) { + super(parent); + input = parent.getInputProvider(); + } + + public abstract void update() ; + + /** + * Activates the action + */ + public abstract void activate(); + + /** + * Deactivates / ends the action + */ + public abstract void deactivate(); + + /** + * Activates the action in the viewer. Normally there's no need to override this method. + */ + public final void run() { + parent.setCurrentAction(this); + } + + /** + * This method is used to end the action, call this from update(). + * + */ + public void end() { + parent.setCurrentAction(parent.getDefaultAction()); + } + + public void fillToolBar(IToolBarManager manager) { + + } + +}