]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics/src/org/simantics/internal/Activator.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics / src / org / simantics / internal / Activator.java
index 74c9900397f02cc56f1f10d9815d16fb8f53232f..4830bd8cfe5021de8dc952877403d82a4d23060a 100644 (file)
-package org.simantics.internal;\r
-\r
-import java.io.File;\r
-import java.io.UnsupportedEncodingException;\r
-import java.net.MalformedURLException;\r
-import java.net.URL;\r
-import java.net.URLDecoder;\r
-\r
-import org.eclipse.core.runtime.Plugin;\r
-import org.osgi.framework.BundleContext;\r
-import org.simantics.internal.startup.StartupRegistry;\r
-\r
-public class Activator extends Plugin {\r
-\r
-       /**\r
-        * Name of the log file. \r
-        */\r
-       public static String LOG_FILE_NAME = "simantics.log";\r
-\r
-       public static final String PLUGIN_ID = "org.simantics";\r
-\r
-       // The shared instance\r
-       private static Activator plugin;\r
-\r
-       private static BundleContext context;\r
-\r
-       private StartupRegistry startupRegistry;\r
-\r
-       static BundleContext getContext() {\r
-               return context;\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)\r
-        */\r
-       public void start(BundleContext bundleContext) throws Exception {\r
-               super.start(bundleContext);\r
-               Activator.context = bundleContext;\r
-               plugin = this;\r
-\r
-               String prop = System.getProperty("osgi.instance.area", null);\r
-               if (prop != null) {\r
-                       try {\r
-                               URL url = new URL(prop);\r
-                               if ("file".equals(url .getProtocol())) {\r
-                                       try {\r
-                                               File path = new File(URLDecoder.decode(url.getPath(), "UTF-8"));\r
-                                               if (!path.exists())\r
-                                                       path.mkdirs();\r
-                                               if (path.exists() && path.canWrite()) {\r
-                                                       File logFile = new File(path, LOG_FILE_NAME);\r
-                                                       if (!logFile.exists() || (logFile.isFile() && logFile.canWrite()))\r
-                                                               LOG_FILE_NAME = logFile.getAbsolutePath();\r
-\r
-                                               }\r
-                                       } catch (UnsupportedEncodingException e) {\r
-                                               // Should never happen since UTF-8 is always supported.\r
-                                       }\r
-                               }\r
-                       } catch (MalformedURLException e) {\r
-                               // Ignore.\r
-                       }\r
-               }               \r
-\r
-               startupRegistry = new StartupRegistry();\r
-       }\r
-\r
-       /*\r
-        * (non-Javadoc)\r
-        * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)\r
-        */\r
-       public void stop(BundleContext bundleContext) throws Exception {\r
-               Activator.context = null;\r
-               plugin = null;\r
-               super.stop(bundleContext);\r
-       }\r
-\r
-       /**\r
-        * @return the context of this bundle.\r
-        */\r
-       public static BundleContext getBundleContext() {\r
-               return context;\r
-       }\r
-\r
-       /**\r
-        * Returns the shared instance\r
-        *\r
-        * @return the shared instance\r
-        */\r
-       public static Activator getDefault() {\r
-               return plugin;\r
-       }\r
-\r
-       /**\r
-        * @return\r
-        */\r
-       public StartupRegistry getStartupRegistry() {\r
-               return startupRegistry;\r
-       }\r
-\r
-}\r
+package org.simantics.internal;
+
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLDecoder;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+import org.simantics.internal.startup.StartupRegistry;
+
+public class Activator extends Plugin {
+
+       /**
+        * Name of the log file. 
+        */
+       public static String LOG_FILE_NAME = "simantics.log";
+
+       public static final String PLUGIN_ID = "org.simantics";
+
+       // The shared instance
+       private static Activator plugin;
+
+       private static BundleContext context;
+
+       private StartupRegistry startupRegistry;
+
+       static BundleContext getContext() {
+               return context;
+       }
+
+       /*
+        * (non-Javadoc)
+        * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+        */
+       public void start(BundleContext bundleContext) throws Exception {
+               super.start(bundleContext);
+               Activator.context = bundleContext;
+               plugin = this;
+
+               String prop = System.getProperty("osgi.instance.area", null);
+               if (prop != null) {
+                       try {
+                               URL url = new URL(prop);
+                               if ("file".equals(url .getProtocol())) {
+                                       try {
+                                               File path = new File(URLDecoder.decode(url.getPath(), "UTF-8"));
+                                               if (!path.exists())
+                                                       path.mkdirs();
+                                               if (path.exists() && path.canWrite()) {
+                                                       File logFile = new File(path, LOG_FILE_NAME);
+                                                       if (!logFile.exists() || (logFile.isFile() && logFile.canWrite()))
+                                                               LOG_FILE_NAME = logFile.getAbsolutePath();
+
+                                               }
+                                       } catch (UnsupportedEncodingException e) {
+                                               // Should never happen since UTF-8 is always supported.
+                                       }
+                               }
+                       } catch (MalformedURLException e) {
+                               // Ignore.
+                       }
+               }               
+
+               startupRegistry = new StartupRegistry();
+       }
+
+       /*
+        * (non-Javadoc)
+        * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+        */
+       public void stop(BundleContext bundleContext) throws Exception {
+               Activator.context = null;
+               plugin = null;
+               super.stop(bundleContext);
+       }
+
+       /**
+        * @return the context of this bundle.
+        */
+       public static BundleContext getBundleContext() {
+               return context;
+       }
+
+       /**
+        * Returns the shared instance
+        *
+        * @return the shared instance
+        */
+       public static Activator getDefault() {
+               return plugin;
+       }
+
+       /**
+        * @return
+        */
+       public StartupRegistry getStartupRegistry() {
+               return startupRegistry;
+       }
+
+}