import org.simantics.databoard.Bindings;
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
+import org.simantics.db.common.request.IndexRoot;
import org.simantics.db.common.request.UniqueRead;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.layer0.SelectionHints;
import org.simantics.layer0.Layer0;
import org.simantics.modeling.ModelingUtils;
import org.simantics.modeling.ModelingUtils.LibraryInfo;
+import org.simantics.simulation.ontology.SimulationResource;
import org.simantics.utils.strings.AlphanumComparator;
import org.simantics.utils.ui.ISelectionUtils;
public List<LibraryInfo> perform(ReadGraph graph) throws DatabaseException {
List<LibraryInfo> result = new ArrayList<>();
Layer0 L0 = Layer0.getInstance(graph);
+ SimulationResource SIMU = SimulationResource.getInstance(graph);
for (Resource r : selected) {
- String name = graph.getRelatedValue(r, L0.HasName, Bindings.STRING);
- DraftStatusBean draft = ModelingUtils.getDependencyDraftStatus(graph, r);
- result.add(new LibraryInfo(name, r, draft));
+ Resource model = r;
+ if(!graph.isInstanceOf(model, SIMU.Model)) {
+ model = graph.syncRequest(new IndexRoot(r));
+ if(!graph.isInstanceOf(model, SIMU.Model))
+ continue;
+ }
+ String name = graph.getRelatedValue(model, L0.HasName, Bindings.STRING);
+ DraftStatusBean draft = ModelingUtils.getDependencyDraftStatus(graph, model);
+ result.add(new LibraryInfo(name, model, draft));
}
Collections.sort(result, new Comparator<LibraryInfo>() {
@Override