import org.simantics.datatypes.literal.RGB;
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
-import org.simantics.db.common.request.IndexRoot;
+import org.simantics.db.common.request.PossibleIndexRoot;
import org.simantics.db.common.request.UnaryRead;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.procedure.Listener;
public void dispose() {
DistrictDiagramViewerListener[] listeners = Activator.getInstance().getDistrictDiagramViewerListeners();
if (listeners != null) {
+ Resource runtime = getRuntime();
for (DistrictDiagramViewerListener listener : listeners) {
- listener.diagramDisposed(getRuntime(), canvasContext);
+ listener.diagramDisposed(runtime, canvasContext);
}
}
super.dispose();
@Override
public ColorBarOptions perform(ReadGraph graph) throws DatabaseException {
DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- Resource model = graph.syncRequest(new IndexRoot(parameter));
- Resource vf = DynamicVisualisations.getVisualisationFolder(graph, model);
- if (vf != null) {
- Resource activeVisualisation = graph.getPossibleObject(vf, DN.Diagram_hasActiveVisualisation);
- if (activeVisualisation != null) {
- return DynamicVisualisations.colorBarOptions(graph, activeVisualisation);
+ Resource model = graph.syncRequest(new PossibleIndexRoot(parameter));
+ if (model != null) {
+ Resource vf = DynamicVisualisations.getVisualisationFolder(graph, model);
+ if (vf != null) {
+ Resource activeVisualisation = graph.getPossibleObject(vf, DN.Diagram_hasActiveVisualisation);
+ if (activeVisualisation != null) {
+ return DynamicVisualisations.colorBarOptions(graph, activeVisualisation);
+ }
+ } else {
+ LOGGER.debug("No visualisation folder available for model {}", model);
}
- } else {
- LOGGER.debug("No visualisation folder available for model {}", model);
}
return ColorBarOptions.useDefault();
}
@Override
public Map<String, DynamicColorContribution> perform(ReadGraph graph) throws DatabaseException {
DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- Resource model = graph.syncRequest(new IndexRoot(parameter));
- Resource vf = DynamicVisualisations.getVisualisationFolder(graph, model);
- if (vf != null) {
- Resource activeVisualisation = graph.getPossibleObject(vf, DN.Diagram_hasActiveVisualisation);
- if (activeVisualisation != null) {
- return DynamicVisualisations.colorContributions(graph, activeVisualisation);
+ Resource model = graph.syncRequest(new PossibleIndexRoot(parameter));
+ if (model != null) {
+ Resource vf = DynamicVisualisations.getVisualisationFolder(graph, model);
+ if (vf != null) {
+ Resource activeVisualisation = graph.getPossibleObject(vf, DN.Diagram_hasActiveVisualisation);
+ if (activeVisualisation != null) {
+ return DynamicVisualisations.colorContributions(graph, activeVisualisation);
+ }
+ } else {
+ LOGGER.debug("No visualisation folder available for model {}", model);
}
- } else {
- LOGGER.debug("No visualisation folder available for model {}", model);
}
return Collections.emptyMap();
}
@Override
public SizeBarOptions perform(ReadGraph graph) throws DatabaseException {
DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- Resource model = graph.syncRequest(new IndexRoot(parameter));
- Resource vf = DynamicVisualisations.getVisualisationFolder(graph, model);
- if (vf != null) {
- Resource activeVisualisation = graph.getPossibleObject(vf, DN.Diagram_hasActiveVisualisation);
- if (activeVisualisation != null) {
- return DynamicVisualisations.sizeBarOptions(graph, activeVisualisation);
+ Resource model = graph.syncRequest(new PossibleIndexRoot(parameter));
+ if (model != null) {
+ Resource vf = DynamicVisualisations.getVisualisationFolder(graph, model);
+ if (vf != null) {
+ Resource activeVisualisation = graph.getPossibleObject(vf, DN.Diagram_hasActiveVisualisation);
+ if (activeVisualisation != null) {
+ return DynamicVisualisations.sizeBarOptions(graph, activeVisualisation);
+ }
+ } else {
+ LOGGER.debug("No visualisation folder available for model {}", model);
}
- } else {
- LOGGER.debug("No visualisation folder available for model {}", model);
}
return SizeBarOptions.useDefault();
}
@Override
public Map<String, DynamicSizeContribution> perform(ReadGraph graph) throws DatabaseException {
DistrictNetworkResource DN = DistrictNetworkResource.getInstance(graph);
- Resource model = graph.syncRequest(new IndexRoot(parameter));
- Resource vf = DynamicVisualisations.getVisualisationFolder(graph, model);
- if (vf != null) {
- Resource activeVisualisation = graph.getPossibleObject(vf, DN.Diagram_hasActiveVisualisation);
- if (activeVisualisation != null) {
- return DynamicVisualisations.sizeContributions(graph, activeVisualisation);
+ Resource model = graph.syncRequest(new PossibleIndexRoot(parameter));
+ if (model != null) {
+ Resource vf = DynamicVisualisations.getVisualisationFolder(graph, model);
+ if (vf != null) {
+ Resource activeVisualisation = graph.getPossibleObject(vf, DN.Diagram_hasActiveVisualisation);
+ if (activeVisualisation != null) {
+ return DynamicVisualisations.sizeContributions(graph, activeVisualisation);
+ }
+ } else {
+ LOGGER.debug("No visualisation folder available for model {}", model);
}
- } else {
- LOGGER.debug("No visualisation folder available for model {}", model);
}
return Collections.emptyMap();
}