import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.handlers.HandlerUtil;
import org.simantics.Simantics;
+import org.simantics.databoard.type.Datatype;
import org.simantics.db.ReadGraph;
import org.simantics.db.RequestProcessor;
import org.simantics.db.Resource;
import org.simantics.db.common.primitiverequest.Types;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.layer0.request.PossibleGUID;
-import org.simantics.db.layer0.request.PossibleVariableGUID;
import org.simantics.db.layer0.request.PossibleURI;
+import org.simantics.db.layer0.request.PossibleVariableGUID;
import org.simantics.db.layer0.request.PossibleVariableRepresents;
import org.simantics.db.layer0.request.VariableRead;
import org.simantics.db.layer0.request.VariableURI;
if(var != null) {
String uri = processor.syncRequest(new VariableURI(var));
String guid = processor.syncRequest(new PossibleVariableGUID(var));
+
+ Set<String> classifications = processor.syncRequest(new VariableRead<Set<String>>(var) {
+ @Override
+ public Set<String> perform(ReadGraph graph) throws DatabaseException {
+ return var.getClassifications(graph);
+ }
+ });
+ String classificationsStr = toJSONStringArray(new ArrayList<>(classifications));
+
+ Datatype datatype = processor.syncRequest(new VariableRead<Datatype>(var) {
+ @Override
+ public Datatype perform(ReadGraph graph) throws DatabaseException {
+ return var.getPossibleDatatype(graph);
+ }
+ });
+
return toJSONObjectString(
"type", "\"Variable\"",
"uri", safeQuotedString(uri),
"guid", safeQuotedString(guid),
"resourceId", res == null ? "" : Long.toString(res.getResourceId()),
- "typeResources", typesStr);
+ "typeResources", typesStr,
+ "classifications", classificationsStr,
+ "datatype", safeQuotedString(datatype != null ? datatype.getClass().getName() : null));
}
if(res != null) {
String uri = processor.syncRequest(new PossibleURI(res));