X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2FCompilePGraphs.java;h=879a57d19a637935bd7164fb03c32af6fe738088;hp=10e23c65bbd72340277652d8c9618ab4f7032147;hb=6b5821ad728bf2f127091cb36d57b87749a6532f;hpb=573f14d784e6e300c4bf23b60ca88acf14b6f40a diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/CompilePGraphs.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/CompilePGraphs.java index 10e23c65b..879a57d19 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/CompilePGraphs.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/CompilePGraphs.java @@ -16,6 +16,8 @@ import java.util.Map; 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; @@ -49,6 +51,8 @@ import org.simantics.graph.compiler.ExternalFileLoader; import org.simantics.graph.compiler.GraphCompiler; import org.simantics.graph.compiler.GraphCompilerPreferences; import org.simantics.graph.compiler.ValidationMode; +import org.simantics.graph.compiler.internal.ltk.ISource; +import org.simantics.graph.compiler.internal.ltk.Problem; import org.simantics.graph.db.TransferableGraphException; import org.simantics.graph.db.TransferableGraphSource; import org.simantics.graph.db.TransferableGraphs; @@ -59,17 +63,18 @@ import org.simantics.graph.representation.Root; import org.simantics.graph.representation.TransferableGraph1; import org.simantics.graphfile.ontology.GraphFileResource; import org.simantics.layer0.Layer0; -import org.simantics.ltk.ISource; -import org.simantics.ltk.Problem; import org.simantics.modeling.internal.Activator; import org.simantics.utils.FileUtils; import org.simantics.utils.datastructures.Pair; +import org.slf4j.LoggerFactory; /** * @author Antti Villberg */ public class CompilePGraphs { + private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(CompilePGraphs.class); + public static interface UserAgent { void reportProblems(CompilationResult result); } @@ -86,6 +91,10 @@ public class CompilePGraphs { } 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 sources = new ArrayList<>(); Collection dependencies = new ArrayList<>(); @@ -249,6 +258,9 @@ public class CompilePGraphs { } }); } + + // 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 { @@ -278,7 +290,7 @@ public class CompilePGraphs { Logger.defaultLogError(e); } } else { - System.err.println("Unsupported URL protocol '" + url + "' for FastLZ native library file '" + fileName); + LOGGER.warn("Unsupported URL protocol"); } return null; }