1 package org.simantics.district.network.ui.visualisations;
3 import javax.annotation.PostConstruct;
4 import javax.annotation.PreDestroy;
6 import org.eclipse.swt.widgets.Composite;
7 import org.simantics.Simantics;
8 import org.simantics.db.AsyncReadGraph;
9 import org.simantics.db.Resource;
10 import org.simantics.db.common.procedure.adapter.AsyncListenerAdapter;
11 import org.simantics.db.layer0.request.PossibleActiveModel;
13 public class DynamicVisualisationsView {
15 private DynamicVisualisationsUI ui;
18 public void postConstruct(Composite parent) {
19 ui = new DynamicVisualisationsUI(parent, 0);
21 Simantics.getSession().asyncRequest(new PossibleActiveModel(Simantics.getProjectResource()), new AsyncListenerAdapter<Resource>() {
24 public void execute(AsyncReadGraph graph, Resource result) {
25 if (ui != null && !ui.isDisposed()) {
26 ui.getDisplay().asyncExec(() -> {
27 ui.setParentResource(result);
33 public boolean isDisposed() {
34 return ui != null ? ui.isDisposed() : true;
40 public void dispose() {