]> gerrit.simantics Code Review - simantics/3d.git/blob - dev/org.simantics.proconf.g3d/src/org/simantics/proconf/g3d/actions/ContextAction.java
Release
[simantics/3d.git] / dev / org.simantics.proconf.g3d / src / org / simantics / proconf / g3d / actions / ContextAction.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 java.util.List;\r
14 \r
15 import org.eclipse.jface.action.Action;\r
16 import org.simantics.db.Graph;\r
17 import org.simantics.db.Resource;\r
18 import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
19 \r
20 \r
21 /**\r
22  * Context / selection dependent action\r
23  * \r
24  * @author Marko Luukkainen\r
25  *\r
26  */\r
27 public abstract class ContextAction extends Action {\r
28     protected ThreeDimensionalEditorBase parent;\r
29 \r
30     public ContextAction(ThreeDimensionalEditorBase parent) {\r
31         this.parent = parent;\r
32         init();\r
33     }\r
34     \r
35     /**\r
36      * Initialization\r
37      */\r
38     public void init(){};\r
39  \r
40     /**\r
41      * Runs the action\r
42      */\r
43     public abstract void run();\r
44     \r
45     /**\r
46      * Used to check if action is usable for given resources\r
47      * @param resources\r
48      * @return\r
49      */\r
50     public abstract boolean usable(Graph graph, List<Resource> resources);\r
51     \r
52     \r
53 }\r