]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.commands/src/org/simantics/scl/commands/internal/ErrorCommand.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scl.commands / src / org / simantics / scl / commands / internal / ErrorCommand.java
diff --git a/bundles/org.simantics.scl.commands/src/org/simantics/scl/commands/internal/ErrorCommand.java b/bundles/org.simantics.scl.commands/src/org/simantics/scl/commands/internal/ErrorCommand.java
new file mode 100644 (file)
index 0000000..7eb7a8a
--- /dev/null
@@ -0,0 +1,34 @@
+package org.simantics.scl.commands.internal;\r
+\r
+import org.simantics.db.RequestProcessor;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.procedure.Procedure;\r
+import org.simantics.scl.commands.Command;\r
+\r
+public class ErrorCommand implements Command {\r
+\r
+    String name;\r
+    \r
+    public ErrorCommand(String name) {\r
+        this.name = name;\r
+    }\r
+\r
+    @Override\r
+    public Object execute(RequestProcessor processor, Resource model, Object... parameters) throws DatabaseException {\r
+        throw new DatabaseException("Command " + name + " is not available.");\r
+    }\r
+\r
+    @Override\r
+    public boolean check(RequestProcessor processor, Resource model,\r
+            Object... parameters) throws DatabaseException {\r
+        return false;\r
+    }\r
+\r
+    @Override\r
+    public void asyncExecute(RequestProcessor processor, Resource model,\r
+            Object[] parameters, Procedure<Object> procedure) {\r
+        procedure.exception(new DatabaseException("Command " + name + " is not available."));\r
+    }\r
+\r
+}\r