use of org.csstudio.display.builder.representation.swt.SWTRepresentation in project org.csstudio.display.builder by kasemir.
the class RepresentationDemoSWT method main.
public static void main(final String[] args) throws Exception {
// final DisplayModel model = ExampleModels.getModel(1);
final DisplayModel model = ExampleModels.createModel();
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setText(model.getPropertyValue(propName));
shell.setSize(model.getPropertyValue(propWidth), model.getPropertyValue(propHeight));
final ToolkitRepresentation<Composite, Control> toolkit = new SWTRepresentation(display);
toolkit.representModel(shell, model);
final DummyRuntime runtime = new DummyRuntime(model);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
runtime.shutdown();
toolkit.shutdown();
display.dispose();
}
use of org.csstudio.display.builder.representation.swt.SWTRepresentation in project org.csstudio.display.builder by kasemir.
the class RuntimeDemoSWT method run.
@Override
public void run() {
final Display display = new Display();
toolkit = new SWTRepresentation(display);
RuntimeUtil.hookRepresentationListener(toolkit);
// Load model in background
RuntimeUtil.getExecutor().execute(() -> loadModel(display));
while (!display.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
toolkit.shutdown();
display.dispose();
int refs = 0;
for (final RefCountMap.ReferencedEntry<PV> ref : PVPool.getPVReferences()) {
refs += ref.getReferences();
logger.log(Level.SEVERE, "PV {0} left with {1} references", new Object[] { ref.getEntry().getName(), ref.getReferences() });
}
if (refs == 0)
logger.log(Level.FINE, "All PV references were released, good job, get a cookie!");
// JCA Context remains running, so need to exit() to really quit
System.exit(0);
}
Aggregations