From 6a98de0ec279869a23d14cb9b3ed6cb0999a820d Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Tue, 26 Mar 2019 15:27:55 +0200 Subject: [PATCH] Allow "doNotSynchronizeOntologies" to work. Additionally, using the flag bypasses shared library synchronisation. Change-Id: I384a2f878483be25c92e9644113e4d5b2ae95bca --- .../workbench/internal/SimanticsWorkbenchAdvisor.java | 1 + .../internal/SimanticsWorkbenchApplication.java | 1 + .../src/org/simantics/SimanticsPlatform.java | 10 +++++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/SimanticsWorkbenchAdvisor.java b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/SimanticsWorkbenchAdvisor.java index f590b5e0e..6f70bc56e 100644 --- a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/SimanticsWorkbenchAdvisor.java +++ b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/SimanticsWorkbenchAdvisor.java @@ -408,6 +408,7 @@ public class SimanticsWorkbenchAdvisor extends WorkbenchAdvisor { if (args.contains(SimanticsArguments.DO_NOT_SYNCHRONIZE_ONTOLOGIES)) { requireSynchronize = false; + ontologyPolicy = OntologyRecoveryPolicy.Bypass; } if (args.contains(SimanticsArguments.DISABLE_INDEX)) { diff --git a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/SimanticsWorkbenchApplication.java b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/SimanticsWorkbenchApplication.java index 50e8aada7..e69f90669 100644 --- a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/SimanticsWorkbenchApplication.java +++ b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/SimanticsWorkbenchApplication.java @@ -221,6 +221,7 @@ public class SimanticsWorkbenchApplication implements IApplication, IExecutableE SimanticsArguments.EXPERIMENT, SimanticsArguments.DISABLE_INDEX, SimanticsArguments.DATABASE_ID, + SimanticsArguments.DO_NOT_SYNCHRONIZE_ONTOLOGIES }; IArguments result = Arguments.parse(args, accepted); return result; diff --git a/bundles/org.simantics/src/org/simantics/SimanticsPlatform.java b/bundles/org.simantics/src/org/simantics/SimanticsPlatform.java index a4206e7da..2504ba62d 100644 --- a/bundles/org.simantics/src/org/simantics/SimanticsPlatform.java +++ b/bundles/org.simantics/src/org/simantics/SimanticsPlatform.java @@ -153,7 +153,7 @@ public class SimanticsPlatform implements LifecycleListener { * It is applied when the ontology in the database of a workspace doesn't match * a newer ontology in the Eclipse workspace. */ - public static enum OntologyRecoveryPolicy { ThrowError, Merge, ReinstallDatabase } + public static enum OntologyRecoveryPolicy { ThrowError, Merge, ReinstallDatabase, Bypass} /** * This policy dictates how the Simantics platform startup should react if @@ -346,7 +346,7 @@ public class SimanticsPlatform implements LifecycleListener { session.getService(XSupport.class).setServiceMode(true, true); // Throw error - if (ontologyPolicy == OntologyRecoveryPolicy.ThrowError) { + if (ontologyPolicy == OntologyRecoveryPolicy.ThrowError || ontologyPolicy == OntologyRecoveryPolicy.Bypass) { StringBuilder sb = new StringBuilder("The following graphs are not installed in the database: "); if (!installTGs.isEmpty()) { int i = 0; @@ -367,8 +367,12 @@ public class SimanticsPlatform implements LifecycleListener { sb.append(" Database/Platform Bundle version mismatch.\n"); } sb.append("Hint: Use -fixErrors to install the graphs."); - throw new PlatformException(sb.toString()); + if (ontologyPolicy == OntologyRecoveryPolicy.ThrowError) + throw new PlatformException(sb.toString()); + else + log.log(new Status(IStatus.WARNING, Activator.PLUGIN_ID, sb.toString())); } + // Reinstall database if (ontologyPolicy == OntologyRecoveryPolicy.ReinstallDatabase) { log.log(new Status(IStatus.INFO, Activator.PLUGIN_ID, "Reinstalling the database.")); -- 2.47.1