]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.workbench/src/org/simantics/workbench/internal/SimanticsWorkbenchAdvisor.java
Easier baselines
[simantics/platform.git] / bundles / org.simantics.workbench / src / org / simantics / workbench / internal / SimanticsWorkbenchAdvisor.java
index f5bda18b0a137816c209b12972bfeb346605eb2e..8a8b493753e3be04b14156483ba9f4df63dba9a8 100644 (file)
@@ -88,6 +88,7 @@ import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.Version;
 import org.simantics.CancelStartupException;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.Version;
 import org.simantics.CancelStartupException;
+import org.simantics.DatabaseBaselines;
 import org.simantics.PlatformException;
 import org.simantics.Simantics;
 import org.simantics.SimanticsPlatform;
 import org.simantics.PlatformException;
 import org.simantics.Simantics;
 import org.simantics.SimanticsPlatform;
@@ -105,7 +106,6 @@ import org.simantics.ui.SimanticsUI;
 import org.simantics.ui.jobs.SessionGarbageCollectorJob;
 import org.simantics.ui.workbench.PerspectiveBarsActivator;
 import org.simantics.ui.workbench.PerspectiveContextActivator;
 import org.simantics.ui.jobs.SessionGarbageCollectorJob;
 import org.simantics.ui.workbench.PerspectiveBarsActivator;
 import org.simantics.ui.workbench.PerspectiveContextActivator;
-import org.simantics.ui.workbench.WorkbenchShutdownService;
 import org.simantics.utils.logging.TimeLogger;
 import org.simantics.utils.ui.dialogs.ShowError;
 import org.simantics.utils.ui.dialogs.ShowMessage;
 import org.simantics.utils.logging.TimeLogger;
 import org.simantics.utils.ui.dialogs.ShowError;
 import org.simantics.utils.ui.dialogs.ShowMessage;
@@ -432,6 +432,11 @@ public class SimanticsWorkbenchAdvisor extends WorkbenchAdvisor {
             if (PROFILE_PLATFORM_STARTUP)
                 mon = new TimingProgressMonitor();
             SimanticsPlatform.INSTANCE.startUp(databaseDriverId, mon, workspacePolicy, ontologyPolicy, requireSynchronize, new JFaceUserAgent());
             if (PROFILE_PLATFORM_STARTUP)
                 mon = new TimingProgressMonitor();
             SimanticsPlatform.INSTANCE.startUp(databaseDriverId, mon, workspacePolicy, ontologyPolicy, requireSynchronize, new JFaceUserAgent());
+            if(DatabaseBaselines.shouldCreateAutomaticBaseline(SimanticsPlatform.INSTANCE.databaseExists() != null)) {
+                SimanticsPlatform.INSTANCE.shutdown(null);
+                DatabaseBaselines.createAutomaticBaseline(SimanticsPlatform.INSTANCE.dbLocation());
+                SimanticsPlatform.INSTANCE.reconnect(Simantics.getDefaultDatabaseDriver());
+            }
 
             // Make sure that the default perspective comes from the project if
             // the project has set ProjectKeys#DEFAULT_PERSPECTIVE.
 
             // Make sure that the default perspective comes from the project if
             // the project has set ProjectKeys#DEFAULT_PERSPECTIVE.