import org.simantics.db.common.procedure.wrapper.SyncToAsyncSetProcedure;
import org.simantics.db.common.request.AdaptValue;
import org.simantics.db.common.request.ResourceRead;
+import org.simantics.db.common.utils.Functions;
import org.simantics.db.common.utils.Logger;
import org.simantics.db.common.utils.NameUtils;
import org.simantics.db.common.validation.L0Validations;
import org.simantics.db.impl.procedure.ResultCallWrappedSingleQueryProcedure4;
import org.simantics.db.impl.query.CacheEntry;
import org.simantics.db.impl.query.QueryCache;
+import org.simantics.db.impl.query.QueryCacheBase;
import org.simantics.db.impl.query.QueryProcessor;
import org.simantics.db.impl.query.QuerySupport;
import org.simantics.db.impl.query.TripleIntProcedure;
import org.simantics.scl.compiler.types.exceptions.SCLTypeParseException;
import org.simantics.scl.reflection.ReflectionUtils;
import org.simantics.scl.reflection.ValueNotFoundException;
+import org.simantics.scl.runtime.function.Function1;
import org.simantics.scl.runtime.function.Function3;
import org.simantics.utils.DataContainer;
import org.simantics.utils.Development;
throw (DatabaseException) exception;
else
throw new DatabaseException(
- "Unexpected exception in ReadGraph.syncRequest(AsyncMultiRead)",
+ "Unexpected exception in ReadGraph.syncRequest(AsyncRead)",
exception);
}
}
final public <T> T syncRequest(final ExternalRead<T> request,
final Procedure<T> procedure) throws DatabaseException {
- assert (request != null);
-
- ListenerBase listener = getListenerBase(procedure);
-
- final DataContainer<Throwable> exception = new DataContainer<Throwable>();
- final DataContainer<T> result = new DataContainer<T>();
+ assert (request != null);
- processor.query(this, request, parent, new Procedure<T>() {
+ ListenerBase listener = procedure != null ? getListenerBase(procedure) : null;
+ return QueryCache.resultExternalReadEntry(this, request, parent, listener, procedure);
- @Override
- public void exception(Throwable throwable) {
- exception.set(throwable);
- procedure.exception(throwable);
- }
-
- @Override
- public void execute(T t) {
- result.set(t);
- procedure.execute(t);
- }
-
- }, listener);
+//
+// ListenerBase listener = getListenerBase(procedure);
+//
+// return QueryCache.resultExternalReadEntry(this, request, parent, listener, procedure);
+
+// assert (request != null);
+//
+// ListenerBase listener = getListenerBase(procedure);
+//
+// final DataContainer<Throwable> exception = new DataContainer<Throwable>();
+// final DataContainer<T> result = new DataContainer<T>();
+//
+// processor.query(this, request, parent, new Procedure<T>() {
+//
+// @Override
+// public void exception(Throwable throwable) {
+// exception.set(throwable);
+// procedure.exception(throwable);
+// }
+//
+// @Override
+// public void execute(T t) {
+// result.set(t);
+// procedure.execute(t);
+// }
+//
+// }, listener);
// }
//
// }
-
- Throwable t = exception.get();
- if (t != null) {
- if (t instanceof DatabaseException)
- throw (DatabaseException) t;
- else
- throw new DatabaseException(
- "Unexpected exception in ReadGraph.syncRequest(Read)",
- t);
- }
-
- return result.get();
+//
+// Throwable t = exception.get();
+// if (t != null) {
+// if (t instanceof DatabaseException)
+// throw (DatabaseException) t;
+// else
+// throw new DatabaseException(
+// "Unexpected exception in ReadGraph.syncRequest(Read)",
+// t);
+// }
+//
+// return result.get();
}
final public <T> void asyncRequest(final ExternalRead<T> request,
final Procedure<T> procedure) {
- assert (request != null);
- assert (procedure != null);
-
- ListenerBase listener = getListenerBase(procedure);
-
- if (parent != null || listener != null) {
-
- processor.query(this, request, parent, procedure, listener);
-
- } else {
-
- try {
+
+ assert (request != null);
+ assert (procedure != null);
- request.register(this, new Listener<T>() {
+ final ListenerBase listener = getListenerBase(procedure);
- @Override
- public void execute(T result) {
- procedure.execute(result);
- }
+ if (parent != null || listener != null) {
- @Override
- public void exception(Throwable t) {
- procedure.exception(t);
- }
+ try {
+ QueryCacheBase.resultExternalReadEntry(this, request, parent, listener, procedure);
+ //processor.query(this, request, parent, procedure,listener);
+ } catch (DatabaseException e) {
+ Logger.defaultLogError(e);
+ // This throwable has already been transferred to procedure at this point - do nothing about it
+ //
+ }
+
+ } else {
- @Override
- public String toString() {
- return "asyncRequest(PrimitiveRead) -> " + request;
- }
+ request.register(this, new Listener<T>() {
+ //
+ @Override
+ public void execute(T result) {
+ procedure.execute(result);
+ }
- @Override
- public boolean isDisposed() {
- return true;
- }
+ @Override
+ public void exception(Throwable t) {
+ procedure.exception(t);
+ }
- });
+ @Override
+ public String toString() {
+ return "asyncRequest(PrimitiveRead) -> " + request;
+ }
- } catch (Throwable t) {
+ @Override
+ public boolean isDisposed() {
+ return true;
+ }
- if (t instanceof DatabaseException)
- procedure.exception(t);
- else
- procedure
- .exception(new DatabaseException(
- "Unexpected exception in ReadGraph.asyncRequest(SingleAsyncRead, SingleProcedure)",
- t));
+ });
+
+// final ReadGraphImpl newGraph = newSync();
- }
+// try {
+//
+// T result = request.perform(this);
+//
+// try {
+// procedure.execute(this, result);
+// } catch (Throwable t) {
+// Logger.defaultLogError(t);
+// }
+//
+// } catch (Throwable t) {
+//
+// try {
+// procedure.exception(this, t);
+// } catch (Throwable t2) {
+// Logger.defaultLogError(t2);
+// }
+//
+// } finally {
+//
+// }
- }
+ }
+
+// assert (request != null);
+// assert (procedure != null);
+//
+// ListenerBase listener = getListenerBase(procedure);
+//
+// if (parent != null || listener != null) {
+//
+// processor.query(this, request, parent, procedure, listener);
+//
+// } else {
+//
+// try {
+//
+// request.register(this, new Listener<T>() {
+//
+// @Override
+// public void execute(T result) {
+// procedure.execute(result);
+// }
+//
+// @Override
+// public void exception(Throwable t) {
+// procedure.exception(t);
+// }
+//
+// @Override
+// public String toString() {
+// return "asyncRequest(PrimitiveRead) -> " + request;
+// }
+//
+// @Override
+// public boolean isDisposed() {
+// return true;
+// }
+//
+// });
+//
+// } catch (Throwable t) {
+//
+// if (t instanceof DatabaseException)
+// procedure.exception(t);
+// else
+// procedure
+// .exception(new DatabaseException(
+// "Unexpected exception in ReadGraph.asyncRequest(SingleAsyncRead, SingleProcedure)",
+// t));
+//
+// }
+//
+// }
}
return getValue(r);
}
}
+ else if(types.contains(L0.Function)) {
+ return Functions.exec(this, r, this, r, context);
+ }
else if(types.contains(L0.ExternalValue)) {
return (T)syncRequest(new AdaptValue(r), TransientCacheListener.<Object>instance());
}
return getVariantValue(r);
}
}
+ else if(types.contains(L0.Function)) {
+ Object value = Functions.exec(this, r, this, r, context);
+ try {
+ return new Variant(Bindings.OBJECT.getContentBinding(value), value);
+ } catch ( org.simantics.databoard.binding.error.BindingException e ) {
+ throw new BindingException( "No binding found for class " + value.getClass().getName(), e );
+ }
+ }
else if(types.contains(L0.ExternalValue)) {
Object value = syncRequest(new AdaptValue(r), TransientCacheListener.<Object>instance());
try {
} else {
return getValue(r, binding);
}
+ } else if(types.contains(L0.Function)) {
+ Object value = Functions.exec(this, r, this, r, context);
+ if(binding.isInstance(value)) return (T)value;
+ try {
+ Binding srcBinding = Bindings.OBJECT.getContentBinding(value);
+ return (T)Bindings.adapt(value, srcBinding, binding);
+ } catch(RuntimeException e) {
+ DatabaseException dte = findPossibleRootException(e);
+ if(dte != null) throw dte;
+ else throw new DatabaseException(e);
+ } catch (AdaptException e) {
+ throw new DatabaseException(e);
+ } catch (org.simantics.databoard.binding.error.BindingException e) {
+ throw new DatabaseException(e);
+ }
} else if(types.contains(L0.ExternalValue)) {
try {
ExternalValue ev = adapt(r, ExternalValue.class);
}
}
+ private static ThreadLocal<Boolean> syncGraph = new ThreadLocal<Boolean>() {
+ protected Boolean initialValue() {
+ return true;
+ }
+ };
+
@Override
public boolean setSynchronous(boolean value) {
- boolean old = processor.synch;
- processor.synch = value;
+ boolean old = getSynchronous();
+ syncGraph.set(value);
return old;
}
@Override
public boolean getSynchronous() {
- return processor.synch;
+ return syncGraph.get();
}
public void ensureLoaded(int resource) {
<T> void query(ReadGraphImpl graph, MultiRead<T> request, CacheEntry parent, AsyncMultiProcedure<T> procedure, ListenerBase listener);
// <T> void query(ReadGraphImpl graph, AsyncRead<T> request, CacheEntry parent, AsyncProcedure<T> procedure, ListenerBase listener) throws DatabaseException;
<T> void query(ReadGraphImpl graph, AsyncMultiRead<T> request, CacheEntry parent, AsyncMultiProcedure<T> procedure, ListenerBase listener);
- <T> void query(ReadGraphImpl graph, ExternalRead<T> request, CacheEntry parent, Procedure<T> procedure, ListenerBase listener);
+ //<T> void query(ReadGraphImpl graph, ExternalRead<T> request, CacheEntry parent, Procedure<T> procedure, ListenerBase listener);
// <T> T tryQuery(final ReadGraphImpl graph, final Read<T> request) throws DatabaseException;
// <T> void tryQuery(final ReadGraphImpl graph, final AsyncRead<T> request, final AsyncProcedure<T> procedure);
abstract int makeHash();
// This can be tested to see if the result is finished
- private Object result = NO_RESULT;
+ Object result = NO_RESULT;
final public boolean isFresh() {
return REQUIRES_COMPUTATION == statusOrException;
}
@Override
- final public void except(Throwable t) {
+ public void except(Throwable t) {
if(DebugPolicy.QUERY_STATE) System.out.println("[QUERY STATE]: excepted " + this);
if(statusOrException != DISCARDED) {
statusOrException = EXCEPTED;
}
@Override
- final public void setPending() {
+ public void setPending() {
statusOrException = PENDING;
}
import java.util.LinkedList;
import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.impl.DebugPolicy;
import org.simantics.db.impl.graph.ReadGraphImpl;
import org.simantics.db.procedure.AsyncProcedure;
import org.simantics.db.procedure.Procedure;
request = null;
super.discard();
}
+
+ @Override
+ public void setPending() {
+ if(result != NO_RESULT) {
+ //new Exception("result = " + result).printStackTrace();
+ }
+ statusOrException = PENDING;
+ result = REQUIRES_COMPUTATION;
+ }
public ExternalReadEntry(ExternalRead<T> request) {
assert request != null;
}
+ @Override
+ public void except(Throwable t) {
+ if(DebugPolicy.QUERY_STATE) System.out.println("[QUERY STATE]: excepted " + this);
+ if(statusOrException != DISCARDED) {
+ statusOrException = EXCEPTED;
+ result = t;
+ } else {
+ result = t;
+ }
+ assert(isExcepted());
+ }
+
+ @Override
+ public void setResult(Object result) {
+ super.setResult(result);
+ assert(!(result instanceof Throwable));
+ assert(!isExcepted());
+ }
+
@Override
final public Query getQuery() {
// Update
if(!items.isEmpty()) {
+ setReady();
setResult(items.removeFirst());
}
// Reschedule
import org.simantics.db.procedure.AsyncProcedure;
import org.simantics.db.procedure.Listener;
import org.simantics.db.procedure.ListenerBase;
+import org.simantics.db.procedure.Procedure;
import org.simantics.db.request.AsyncMultiRead;
import org.simantics.db.request.AsyncRead;
import org.simantics.db.request.ExternalRead;
// Just for safety
if(entry.isDiscarded()) return;
- if(entry.isExcepted()) entry.setPending();
if(used.compareAndSet(false, true)) {
+ //entry.setPending();
entry.addOrSet(parentGraph.processor, result);
procedure.execute(parentGraph, result);
} else {
}
+ static class ExternalProcedureWrapper<T> implements AsyncProcedure<T> {
+
+ private Procedure<T> procedure;
+ private T result = null;
+ private Throwable throwable = null;
+
+ ExternalProcedureWrapper(Procedure<T> procedure) {
+ this.procedure = procedure;
+ }
+
+ @Override
+ public void execute(AsyncReadGraph graph, T result) {
+ if(procedure != null) procedure.execute(result);
+ this.result = result;
+ }
+
+ @Override
+ public void exception(AsyncReadGraph graph, Throwable throwable) {
+ if(procedure != null) procedure.exception(throwable);
+ this.throwable = throwable;
+ }
+
+ public T get() throws DatabaseException {
+ if(throwable != null) {
+ if(throwable instanceof DatabaseException) throw (DatabaseException)throwable;
+ else throw new DatabaseException(throwable);
+ } else {
+ return result;
+ }
+ }
+
+ }
+
static class InternalProcedureWrapper<T> implements InternalProcedure<T> {
}
+ public static <T> T resultExternalReadEntry(ReadGraphImpl graph, ExternalRead r, CacheEntry parent, ListenerBase listener, Procedure<T> procedure) throws DatabaseException {
+ ExternalProcedureWrapper<T> wrap = new ExternalProcedureWrapper<>(procedure);
+ QueryCache.runnerExternalReadEntry(graph, r, parent, listener, wrap);
+ return wrap.get();
+ }
+
public static <T> T resultReadEntry(ReadGraphImpl graph, Read r, CacheEntry parent, ListenerBase listener, AsyncProcedure<T> procedure) throws DatabaseException {
AsyncProcedureWrapper<T> wrap = new AsyncProcedureWrapper<>(procedure);
QueryCache.runnerReadEntry(graph, r, parent, listener, wrap);
ArrayList<SessionTask>[] delayQueues;
- public boolean synch = true;
-
final Object querySupportLock;
public Long modificationCounter = 0L;
});
} catch (DatabaseException e) {
- Logger.defaultLogError(e);
+
+ try {
+
+ procedure.exception(graph, e);
+
+ } catch (DatabaseException e1) {
+
+ Logger.defaultLogError(e1);
+
+ }
+
}
}
CacheEntry entry = e.entry;
- System.err.println("updateQuery " + entry);
+ //System.err.println("updateQuery " + entry);
/*
* If the dependency graph forms a DAG, some entries are inserted in the
}
- @Override
- final public <T> void query(final ReadGraphImpl impl, final ExternalRead<T> request, final CacheEntry parent, final Procedure<T> procedure, ListenerBase listener) {
-
- assert(request != null);
- assert(procedure != null);
-
- try {
-
- queryPrimitiveRead(impl, request, parent, listener, new AsyncProcedure<T>() {
-
- @Override
- public String toString() {
- return procedure.toString();
- }
-
- @Override
- public void execute(AsyncReadGraph graph, T result) {
- try {
- procedure.execute(result);
- } catch (Throwable t2) {
- Logger.defaultLogError(t2);
- }
- }
-
- @Override
- public void exception(AsyncReadGraph graph, Throwable throwable) {
- try {
- procedure.exception(throwable);
- } catch (Throwable t2) {
- Logger.defaultLogError(t2);
- }
- }
-
- });
-
- } catch (DatabaseException e) {
-
- throw new IllegalStateException(e);
-
- }
-
- }
+// @Override
+// final public <T> void query(final ReadGraphImpl impl, final ExternalRead<T> request, final CacheEntry parent, final Procedure<T> procedure, ListenerBase listener) throws DatabaseException {
+//
+// assert(request != null);
+// assert(procedure != null);
+//
+// try {
+//
+// queryPrimitiveRead(impl, request, parent, listener, new AsyncProcedure<T>() {
+//
+// @Override
+// public String toString() {
+// return procedure.toString();
+// }
+//
+// @Override
+// public void execute(AsyncReadGraph graph, T result) {
+// try {
+// procedure.execute(result);
+// } catch (Throwable t2) {
+// Logger.defaultLogError(t2);
+// }
+// }
+//
+// @Override
+// public void exception(AsyncReadGraph graph, Throwable throwable) {
+// try {
+// procedure.exception(throwable);
+// } catch (Throwable t2) {
+// Logger.defaultLogError(t2);
+// }
+// }
+//
+// });
+//
+// } catch (DatabaseException e) {
+//
+// throw new IllegalStateException(e);
+//
+// }
+//
+// }
@Override
public VirtualGraph getProvider(Resource subject, Resource predicate, Resource object) {
import org.simantics.db.ObjectResourceIdMap;
import org.simantics.db.common.exception.DebugException;
import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.exception.ResourceNotFoundException;
import org.simantics.db.impl.graph.ReadGraphImpl;
import org.simantics.db.impl.procedure.InternalProcedure;
} else {
- DatabaseException e = new DatabaseException("No URI for " + id);
+ ResourceNotFoundException e = new ResourceNotFoundException("No resource for URI: " + id);
if(entry != null) entry.except(e);
procedure.exception(graph, e);
public Map<String, Variable> getVariables(ReadGraph graph, Variable context, String classification, Map<String, Variable> map) throws DatabaseException {
Map<String,Variable> all = getVariables(graph, context, null);
+ if(all.isEmpty()) return all;
- for(Map.Entry<String, Variable> entry : all.entrySet()) { if(all.isEmpty()) return all;
+ for(Map.Entry<String, Variable> entry : all.entrySet()) {
Set<String> classifications = entry.getValue().getClassifications(graph);
if(classifications.contains(classification)) {
import org.simantics.db.impl.procedure.ResultCallWrappedQueryProcedure4;
import org.simantics.db.impl.procedure.ResultCallWrappedSingleQueryProcedure4;
import org.simantics.db.impl.query.QueryCache;
+import org.simantics.db.impl.query.QueryCacheBase;
import org.simantics.db.impl.query.QueryProcessor;
import org.simantics.db.impl.query.QueryProcessor.SessionRead;
import org.simantics.db.impl.query.QueryProcessor.SessionTask;
if (listener != null) {
- newGraph.processor.query(newGraph, request, null, new Procedure<T>() {
-
- @Override
- public void exception(Throwable t) {
- procedure.exception(t);
- if(throwable != null) {
- throwable.set(t);
- }
- }
-
- @Override
- public void execute(T t) {
- if(result != null) result.set(t);
- procedure.execute(t);
- }
-
- }, listener);
+ try {
+ QueryCacheBase.resultExternalReadEntry(newGraph, request, null, listener, procedure);
+ } catch (DatabaseException e) {
+ Logger.defaultLogError(e);
+ }
+
+
+// newGraph.processor.query(newGraph, request, null, new Procedure<T>() {
+//
+// @Override
+// public void exception(Throwable t) {
+// procedure.exception(t);
+// if(throwable != null) {
+// throwable.set(t);
+// }
+// }
+//
+// @Override
+// public void execute(T t) {
+// if(result != null) result.set(t);
+// procedure.execute(t);
+// }
+//
+// }, listener);
// newGraph.waitAsync(request);
if (ClusterTraitsSmall.resourceRefIsLocal(resourceRef)) {
key = clusterBits | resourceRef;
} else {
- foreignTable.fillResourceUID(ClusterTraitsSmall.resourceRefGetForeignIndex((short)resourceRef), this);
- key = ClusterTraitsBase.createResourceKey(clusterSupport.getClusterKeyByClusterUIDOrMake(clusterUID1, clusterUID2), executeIndex);
+ // TODO: not so nice
+ synchronized(this) {
+ foreignTable.fillResourceUID(ClusterTraitsSmall.resourceRefGetForeignIndex((short)resourceRef), this);
+ key = ClusterTraitsBase.createResourceKey(clusterSupport.getClusterKeyByClusterUIDOrMake(clusterUID1, clusterUID2), executeIndex);
+ }
}
if (DEBUG)
System.out.println("ClusterSmall.execute key=" + key);
COMPONENTS.CommandEvent <T COMPONENTS.Event
@connectionPoint RELATIONS.data1
- @sclAttribute PROPERTIES.dataDefinitions "dataDefinitions self" "[DataDefinition]"
+ @sclAttribute PROPERTIES.dataDefinitions "computeDataDefinitions self" "[DataDefinition]"
@sclAttribute PROPERTIES.SCLFunction "emptyOnClick ()" "String"
DOC.commandEvent : L0.Template
dataDefinitions :: Variable -> <ReadGraph> [DataDefinition]
+ @JavaName "dataDefinitions"
+ computeDataDefinitions :: Variable -> <ReadGraph> [DataDefinition]
+
emptyOnClick :: () -> <ReadGraph> AbstractEventHandler
writeEventHandler :: Variable -> (Variable -> (String -> Maybe String) -> <WriteGraph> String) -> <ReadGraph> AbstractEventHandler
parent = parent.getParent(graph);
represents = parent.getPossibleRepresents(graph);
}
- Resource root = graph.syncRequest(new IndexRoot(property.getRepresents(graph)));
- return Pair.make(parent.getType(graph), root);
+ Resource componentType = parent.getType(graph);
+ Resource root = graph.syncRequest(new IndexRoot(parent.getRepresents(graph)));
+ return Pair.make(componentType, root);
}
public static List<TCon> getEffects(ReadGraph graph, Variable context) throws DatabaseException {
return Pair.make(type, root);
} else {
Resource doc = graph.syncRequest(new PossibleTypedParent(component, DocumentationResource.getInstance(graph).Document));
- Resource root = graph.syncRequest(new IndexRoot(component));
- return Pair.make(graph.getSingleType(doc), root);
+ Resource componentType = graph.getSingleType(doc);
+ Resource root = graph.syncRequest(new IndexRoot(doc));
+ return Pair.make(componentType, root);
}
}
throw new IllegalStateException();
Resource type = graph.syncRequest(new FindPossibleComponentTypeRequest(represents));
if(type != null) {
Resource root = graph.syncRequest(new IndexRoot(type));
+ //System.err.println("getComponentTypeAndRoot1 " + property.getURI(graph) + " => " + graph.getPossibleURI(type) + " " + graph.getPossibleURI(root));
return Pair.make(type, root);
}
}
parent = parent.getParent(graph);
represents = parent.getPossibleRepresents(graph);
}
- Resource root = graph.syncRequest(new IndexRoot(property.getRepresents(graph)));
- return Pair.make(parent.getType(graph), root);
+// Resource root = graph.syncRequest(new IndexRoot(property.getRepresents(graph)));
+ Resource componentType = parent.getType(graph);
+ Resource root = graph.syncRequest(new IndexRoot(parent.getRepresents(graph)));
+ //System.err.println("getComponentTypeAndRoot2 " + property.getURI(graph) + " => " + graph.getPossibleURI(componentType) + " " + graph.getPossibleURI(root));
+ return Pair.make(componentType, root);
}
private static Pair<Resource,Resource> getComponentTypeAndRoot(ReadGraph graph, Resource component) throws DatabaseException {
Resource type = graph.syncRequest(new FindPossibleComponentTypeRequest(component));
if(type != null) {
Resource root = graph.syncRequest(new IndexRoot(type));
+ // System.err.println("getComponentTypeAndRoot3 " + graph.getPossibleURI(component) + " => " + graph.getPossibleURI(type) + " " + graph.getPossibleURI(root));
return Pair.make(type, root);
} else {
Resource doc = graph.syncRequest(new PossibleTypedParent(component, DocumentationResource.getInstance(graph).Document));
- Resource root = graph.syncRequest(new IndexRoot(component));
- return Pair.make(graph.getSingleType(doc), root);
+ Resource componentType = graph.getSingleType(doc);
+ Resource root = graph.syncRequest(new IndexRoot(doc));
+ // System.err.println("getComponentTypeAndRoot4 " + graph.getPossibleURI(component) + " => " + graph.getPossibleURI(componentType) + " " + graph.getPossibleURI(root));
+ return Pair.make(componentType, root);
}
}
throw new IllegalStateException();
import org.simantics.modeling.ui.property.TypicalPropertyTester;
import org.simantics.modeling.ui.typicals.RuleChooserDialog;
import org.simantics.ui.workbench.IResourceEditorInput;
+import org.simantics.ui.workbench.ResourceEditorActionContributor;
import org.simantics.utils.ui.ErrorLogger;
import org.simantics.utils.ui.workbench.WorkbenchUtils;
}
if (activeEditor == null)
return false;
- IResourceEditorInput input = (IResourceEditorInput) activeEditor.getEditorInput();
- return TypicalPropertyTester.isTypicalInstanceEditor(Simantics.getSession(), input.getResource());
+ if(activeEditor.getEditorInput() instanceof IResourceEditorInput) {
+ IResourceEditorInput input = (IResourceEditorInput) activeEditor.getEditorInput();
+ return TypicalPropertyTester.isTypicalInstanceEditor(Simantics.getSession(), input.getResource());
+ } else {
+ return false;
+ }
}
@Execute
}
if (activeEditor == null)
return false;
- IResourceEditorInput input = (IResourceEditorInput) activeEditor.getEditorInput();
- return TypicalPropertyTester.isTypicalMasterEditor(Simantics.getSession(), input.getResource());
+ if(activeEditor.getEditorInput() instanceof IResourceEditorInput) {
+ IResourceEditorInput input = (IResourceEditorInput) activeEditor.getEditorInput();
+ return TypicalPropertyTester.isTypicalMasterEditor(Simantics.getSession(), input.getResource());
+ } else {
+ return false;
+ }
}
@Execute
editorAdapters :: a -> <ReadGraph> [EditorAdapter]
editorAdapters object = vectorToList $ editorAdapters_ getEditorRegistryInstance object
+
+importJava "org.simantics.utils.strings.StringInputValidator" where
+ data StringInputValidator
+
+importJava "org.simantics.browsing.ui.swt.widgets.DragSourceListenerFactory" where
+ data DragSourceListenerFactory
\ No newline at end of file
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
import org.simantics.db.common.request.ResourceRead;
+import org.simantics.db.common.utils.NameUtils;
import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.scl.SCLDatabaseException;
import org.simantics.db.layer0.util.Layer0Utils;
import org.simantics.layer0.Layer0;
import org.simantics.scl.compiler.environment.Environment;
import org.simantics.scl.compiler.environment.Environments;
+import org.simantics.scl.compiler.errors.CompilationError;
import org.simantics.scl.compiler.top.SCLExpressionCompilationException;
import org.simantics.scl.compiler.types.Type;
try {
type = Environments.getType(environment, typeName);
} catch(SCLExpressionCompilationException e) {
- e.printStackTrace();
- continue;
+ StringBuilder b = new StringBuilder();
+ b.append("Couldn't compile interface properties in type '" + NameUtils.getSafeName(graph, t) + " for environment " + environment);
+ b.append("':\n");
+ StringBuilder b2 = new StringBuilder();
+ for(CompilationError error : e.getErrors()) {
+ b2.append(error.description);
+ b2.append('\n');
+ }
+ System.err.println(b.toString() + b2.toString());
+ throw new SCLDatabaseException(b.toString()+b2.toString(), b2.toString(), e.getErrors());
}
ComponentTypeProperty property = new ComponentTypeProperty(relation, type);
result.put(name, property);
id="org.simantics.scl.rest.feature"
version="0.0.0"/>
- <includes
- id="fi.semantum.simupedia"
- version="0.0.0"/>
-
<plugin
id="org.simantics.desktop.product"
download-size="0"