]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.charts/src/org/simantics/charts/editor/SendCommandAction.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.charts / src / org / simantics / charts / editor / SendCommandAction.java
diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/editor/SendCommandAction.java b/bundles/org.simantics.charts/src/org/simantics/charts/editor/SendCommandAction.java
new file mode 100644 (file)
index 0000000..fc3edff
--- /dev/null
@@ -0,0 +1,28 @@
+package org.simantics.charts.editor;\r
+\r
+import org.eclipse.jface.action.Action;\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.simantics.g2d.canvas.ICanvasContext;\r
+import org.simantics.g2d.utils.CanvasUtils;\r
+import org.simantics.scenegraph.g2d.events.command.Command;\r
+\r
+/**\r
+ * @author Tuukka Lehtonen\r
+ */\r
+public class SendCommandAction extends Action {\r
+\r
+    private final ICanvasContext ctx;\r
+    private final Command command;\r
+\r
+    public SendCommandAction(String name, ImageDescriptor image, ICanvasContext ctx, Command command) {\r
+        super(name, image);\r
+        this.ctx = ctx;\r
+        this.command = command;\r
+    }\r
+\r
+    @Override\r
+    public void run() {\r
+        CanvasUtils.sendCommand(ctx, command);\r
+    }\r
+\r
+}\r