]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.commands/src/org/simantics/scl/commands/internal/ErrorCommand.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.scl.commands / src / org / simantics / scl / commands / internal / ErrorCommand.java
1 package org.simantics.scl.commands.internal;
2
3 import org.simantics.db.RequestProcessor;
4 import org.simantics.db.Resource;
5 import org.simantics.db.exception.DatabaseException;
6 import org.simantics.db.procedure.Procedure;
7 import org.simantics.scl.commands.Command;
8
9 public class ErrorCommand implements Command {
10
11     String name;
12     
13     public ErrorCommand(String name) {
14         this.name = name;
15     }
16
17     @Override
18     public Object execute(RequestProcessor processor, Resource model, Object... parameters) throws DatabaseException {
19         throw new DatabaseException("Command " + name + " is not available.");
20     }
21
22     @Override
23     public boolean check(RequestProcessor processor, Resource model,
24             Object... parameters) throws DatabaseException {
25         return false;
26     }
27
28     @Override
29     public void asyncExecute(RequestProcessor processor, Resource model,
30             Object[] parameters, Procedure<Object> procedure) {
31         procedure.exception(new DatabaseException("Command " + name + " is not available."));
32     }
33
34 }