]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.document.ui/src/org/simantics/document/ui/Activator.java
Fall back to HasName if HasResourceName not available for GraphFile
[simantics/platform.git] / bundles / org.simantics.document.ui / src / org / simantics / document / ui / Activator.java
index a4db0a578a5f4eb72ecbc5dd30c6530e06fb975c..5a25c5b6b7f8708d0c7865ff20ad0ee8150ca68a 100644 (file)
  *******************************************************************************/
 package org.simantics.document.ui;
 
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.simantics.document.ui.graphfile.ExternalEditorAdapter;
 
 /**
  * The activator class controls the plug-in life cycle
@@ -31,6 +37,8 @@ public class Activator extends AbstractUIPlugin {
     
        public ImageDescriptor cross;
        public ImageDescriptor clock_red;
+
+    private static Path location;
        
        /**
         * The constructor
@@ -54,6 +62,8 @@ public class Activator extends AbstractUIPlugin {
                cross = ImageDescriptor.createFromURL(bundle.getResource("icons/silk_small/cross.png"));
                clock_red = ImageDescriptor.createFromURL(bundle.getResource("icons/silk_small/clock_red.png"));
                
+               IPath ipath = Platform.getStateLocation(bundle);
+               location = Paths.get(ipath.toOSString());
        }
 
        /*
@@ -61,6 +71,7 @@ public class Activator extends AbstractUIPlugin {
         * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
         */
        public void stop(BundleContext context) throws Exception {
+           ExternalEditorAdapter.stopFileWatcher();
                plugin = null;
                super.stop(context);
        }
@@ -74,4 +85,7 @@ public class Activator extends AbstractUIPlugin {
                return plugin;
        }
 
+       public static Path getInstanceLocation() {
+           return location;
+       }
 }