import org.simantics.layer0.Layer0;
import org.simantics.modeling.ModelingUtils;
import org.simantics.modeling.internal.Activator;
+import org.simantics.modeling.scl.ontologymodule.OntologyModuleSourceRepository;
import org.simantics.scl.compiler.internal.codegen.types.JavaReferenceValidatorFactory;
import org.simantics.scl.compiler.module.repository.UpdateListener;
import org.simantics.scl.compiler.module.repository.UpdateListener.Observable;
else
return Simantics.getAvailableRequestProcessor().syncRequest(request);
} catch (DatabaseException e) {
- LOGGER.error("Failed to read graph module " + moduleName + ".", e);
+ LOGGER.error("Failed to read graph module {}.", moduleName, e);
return null;
}
}
@Override
public void exception(ReadGraph graph, Throwable t)
throws DatabaseException {
- t.printStackTrace();
+ LOGGER.error("Could not listen {}", this, t);
if(alreadyExecutedOnce && listener != null)
fireUpdate(graph);
}
+
+ @Override
+ public String toString() {
+ return moduleName + " " + listener + " (" + alreadyExecutedOnce + ") [" + getClass().toString() + "]";
+ }
};
public static class GraphModuleSource extends StringModuleSource {
try {
Simantics.getSession().syncRequest(new WriteModuleSource(getModuleName(), newSourceText));
} catch (DatabaseException e) {
- e.printStackTrace();
+ LOGGER.error("Could not update {} with newSourceText {}", this, newSourceText);
}
}
Collection<Resource> ontologies = Simantics.applySCL("Simantics/SharedOntologies", "getSharedOntologies", graph, Tuple0.INSTANCE);
for (Resource ontology : ontologies) {
for(Resource module : ModelingUtils.searchByType(graph, ontology, L0.SCLModule))
- result.add(graph.getURI(module));
+ try {
+ result.add(graph.getURI(module));
+ } catch(DatabaseException e) {
+ LOGGER.error("Failed to find uri for " + module + ".");
+ }
}
return result;
@Override
public void forAllModules(TObjectProcedure<String> procedure) {
+ THashSet<String> moduleURIs = null;
try {
- THashSet<String> moduleURIs = Simantics.getAvailableRequestProcessor().syncRequest(new Read<THashSet<String>>() {
+ moduleURIs = Simantics.getAvailableRequestProcessor().syncRequest(new Read<THashSet<String>>() {
@Override
public THashSet<String> perform(ReadGraph graph)
throws DatabaseException {
});
moduleURIs.forEach(procedure);
} catch (DatabaseException e) {
- e.printStackTrace();
+ LOGGER.error("Could not execute procedure {} for all modules {}", procedure, String.valueOf(moduleURIs), e);
}
}