import java.io.IOException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.simantics.graph.compiler.CompilationResult;
import org.simantics.ltk.Problem;
import org.simantics.modeling.CompilePGraphs;
+import org.simantics.modeling.ui.Activator;
import org.simantics.utils.ui.ExceptionUtils;
/**
if (!(target instanceof Resource))
return null;
return () -> {
- try {
- CompilePGraphs.compilePGraphs((Resource) target, new CompileUserAgent());
- } catch (IOException | DatabaseException e) {
- ExceptionUtils.logAndShowError(e);
- }
+ Job job = new Job("Compile PGraphs") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ CompilePGraphs.compilePGraphs((Resource) target, new CompileUserAgent(), monitor);
+ return Status.OK_STATUS;
+ } catch (IOException | DatabaseException e) {
+ ExceptionUtils.logAndShowError(e);
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage());
+ } finally {
+ monitor.done();
+ }
+ }
+ };
+ job.schedule();
};
}
import java.util.Set;
import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.osgi.framework.Bundle;
import org.simantics.Simantics;
import org.simantics.databoard.Bindings;
}
public static void compilePGraphs(Resource r, UserAgent userAgent) throws IOException, DatabaseException {
+ compilePGraphs(r, userAgent, new NullProgressMonitor());
+ }
+
+ public static void compilePGraphs(Resource r, UserAgent userAgent, IProgressMonitor monitor) throws IOException, DatabaseException {
final Collection<ISource> sources = new ArrayList<>();
Collection<TransferableGraph1> dependencies = new ArrayList<>();
}
});
}
+
+ // Delete index to get rid of floating old instances of the same ontology
+// DatabaseIndexing.deleteAllIndexes();
}
private static File extractLib(URL libURL, String libName) throws FileNotFoundException, IOException {