]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.document.ui/src/org/simantics/document/ui/Activator.java
Externalize strings in org.simantics.document.ui
[simantics/platform.git] / bundles / org.simantics.document.ui / src / org / simantics / document / ui / Activator.java
index a4db0a578a5f4eb72ecbc5dd30c6530e06fb975c..82e1588549d0327815284b0c73072049fa3bd5c6 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
@@ -50,10 +58,12 @@ public class Activator extends AbstractUIPlugin {
 
                Bundle bundle = context.getBundle();
                
-               DOCUMENT_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/document_decoration.png"));
-               cross = ImageDescriptor.createFromURL(bundle.getResource("icons/silk_small/cross.png"));
-               clock_red = ImageDescriptor.createFromURL(bundle.getResource("icons/silk_small/clock_red.png"));
+               DOCUMENT_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/document_decoration.png")); //$NON-NLS-1$
+               cross = ImageDescriptor.createFromURL(bundle.getResource("icons/silk_small/cross.png")); //$NON-NLS-1$
+               clock_red = ImageDescriptor.createFromURL(bundle.getResource("icons/silk_small/clock_red.png")); //$NON-NLS-1$
                
+               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;
+       }
 }