}
public static class CompileUserAgent implements CompilePGraphs.UserAgent {
+
@Override
public void reportProblems(CompilationResult result) {
- class ErrorMessageDialog extends MessageDialog {
- public ErrorMessageDialog(Shell shell) {
- super(shell,
- "Unsatisfied dependencies", null,
- "The following dependencies were missing. Please import the dependencies and try again.",
- MessageDialog.ERROR, new String[] { "Continue" }, 0);
- }
+ Runnable runnable = () -> {
+ class ErrorMessageDialog extends MessageDialog {
+ public ErrorMessageDialog(Shell shell) {
+ super(shell,
+ "Problems in the Ontology Definition File", null,
+ "The following issues were found:",
+ MessageDialog.ERROR, new String[] { "Continue" }, 0);
+ }
- @Override
- protected Control createCustomArea(Composite composite) {
- GridLayoutFactory.fillDefaults().applyTo(composite);
+ @Override
+ protected Control createCustomArea(Composite composite) {
+ GridLayoutFactory.fillDefaults().applyTo(composite);
- org.eclipse.swt.widgets.List list = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.READ_ONLY);
- GridDataFactory.fillDefaults().grab(true, true).applyTo(list);
- for (Problem problem : result.getErrors())
- list.add(problem.getLocation() + ": " + problem.getDescription() + "\n");
- for (Problem problem : result.getWarnings())
- list.add(problem.getLocation() + ": " + problem.getDescription() + "\n");
+ org.eclipse.swt.widgets.List list = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.READ_ONLY);
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(list);
+ for (Problem problem : result.getErrors())
+ list.add(problem.getLocation() + ": " + problem.getDescription() + "\n");
+ for (Problem problem : result.getWarnings())
+ list.add(problem.getLocation() + ": " + problem.getDescription() + "\n");
- return composite;
- }
- }
+ return composite;
+ }
+ }
- ErrorMessageDialog md = new ErrorMessageDialog(Display.getCurrent().getActiveShell());
- md.open();
+ ErrorMessageDialog md = new ErrorMessageDialog(Display.getCurrent().getActiveShell());
+ md.open();
+ };
+
+ Display display = Display.getCurrent();
+ if (display == null)
+ display = Display.getDefault();
+ display.asyncExec(runnable);
}
+
}
}