]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/internal/Activator.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.issues.ui / src / org / simantics / issues / ui / internal / Activator.java
index a6d323416e61f9af92138f0b26608b03c710e2cb..790c0047198c3e2d66b9d2bd682088855bc6a565 100644 (file)
-/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.issues.ui.internal;\r
-\r
-import java.net.URL;\r
-\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
-import org.eclipse.jface.resource.ImageRegistry;\r
-import org.eclipse.ui.plugin.AbstractUIPlugin;\r
-import org.osgi.framework.Bundle;\r
-import org.osgi.framework.BundleContext;\r
-import org.osgi.util.tracker.ServiceTracker;\r
-import org.simantics.issues.Severity;\r
-import org.simantics.message.IMessageSchemeManager;\r
-import org.simantics.utils.ui.gfx.AlphaAdjustmentImageDescriptor;\r
-import org.simantics.utils.ui.gfx.HSVAdjustmentImageDescriptor;\r
-\r
-public class Activator extends AbstractUIPlugin {\r
-\r
-    public static final String PLUGIN_ID = "org.simantics.issues.ui";\r
-    \r
-    static Activator instance;\r
-    ServiceTracker   messageScheme;\r
-\r
-    public static ImageDescriptor HIDE_ICON;\r
-    public static ImageDescriptor UNHIDE_ICON;\r
-    public static ImageDescriptor RESOLVE_ICON;\r
-    public static ImageDescriptor UNRESOLVE_ICON;\r
-\r
-    public static ImageDescriptor PURGE_ICON;\r
-\r
-    public static ImageDescriptor FATAL_ICON;\r
-    public static ImageDescriptor ERROR_ICON;\r
-    public static ImageDescriptor WARNING_ICON;\r
-    public static ImageDescriptor INFO_ICON;\r
-    public static ImageDescriptor NOTE_ICON;\r
-    public static ImageDescriptor OK_ICON;\r
-\r
-    public static ImageDescriptor FATAL_DECORATION_ICON;\r
-    public static ImageDescriptor ERROR_DECORATION_ICON;\r
-    public static ImageDescriptor WARNING_DECORATION_ICON;\r
-    public static ImageDescriptor INFO_DECORATION_ICON;\r
-    public static ImageDescriptor NOTE_DECORATION_ICON;\r
-\r
-    @Override\r
-    public void start(BundleContext context) throws Exception {\r
-        super.start(context);\r
-        instance = this;\r
-        messageScheme = new ServiceTracker(context, IMessageSchemeManager.class.getName(), null);\r
-\r
-        Bundle bundle = context.getBundle();\r
-\r
-        HIDE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/hide.png"));\r
-        UNHIDE_ICON = AlphaAdjustmentImageDescriptor.adjustAlpha(HSVAdjustmentImageDescriptor.adjust(\r
-                HIDE_ICON, 0f, 0f, 1f), 96);\r
-        //RESOLVE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/lightbulb.png"));\r
-        //UNRESOLVE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/lightbulb_off.png"));\r
-        RESOLVE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tick.png"));\r
-        UNRESOLVE_ICON = AlphaAdjustmentImageDescriptor.adjustAlpha(HSVAdjustmentImageDescriptor.adjust(\r
-                RESOLVE_ICON, 0f, 0f, 1f), 96);\r
-\r
-        PURGE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/purge.gif"));\r
-\r
-        FATAL_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/fatal.png"));\r
-        ERROR_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/error.png"));\r
-        WARNING_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/warning.png"));\r
-        INFO_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/information.png"));\r
-        NOTE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/note.png"));\r
-        OK_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/noissue.png"));\r
-\r
-        FATAL_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/fatal_decoration.png"));\r
-        ERROR_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/error_decoration.png"));\r
-        WARNING_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/warning_decoration.png"));\r
-        INFO_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/information_decoration.png"));\r
-        NOTE_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/note_decoration.png"));\r
-    }\r
-\r
-    @Override\r
-    protected ImageRegistry createImageRegistry() {\r
-        return super.createImageRegistry();\r
-    }\r
-\r
-    @Override\r
-    protected void initializeImageRegistry(ImageRegistry reg) {\r
-        reg.put(Severity.FATAL.toString()+"-full", FATAL_ICON);\r
-        reg.put(Severity.ERROR.toString()+"-full", ERROR_ICON);\r
-        reg.put(Severity.WARNING.toString()+"-full", WARNING_ICON);\r
-        reg.put(Severity.INFO.toString()+"-full", INFO_ICON);\r
-        reg.put(Severity.NOTE.toString()+"-full", NOTE_ICON);\r
-        reg.put(Severity.FATAL.toString(), FATAL_DECORATION_ICON);\r
-        reg.put(Severity.ERROR.toString(), ERROR_DECORATION_ICON);\r
-        reg.put(Severity.WARNING.toString(), WARNING_DECORATION_ICON);\r
-        reg.put(Severity.INFO.toString(), INFO_DECORATION_ICON);\r
-        reg.put(Severity.NOTE.toString(), NOTE_DECORATION_ICON);\r
-    }\r
-\r
-    @Override\r
-    public void stop(BundleContext context) throws Exception {\r
-        messageScheme.close();\r
-        instance = null;\r
-        super.stop(context);\r
-    }\r
-\r
-    /**\r
-     * Returns the shared instance\r
-     *\r
-     * @return the shared instance\r
-     */\r
-    public static Activator getDefault() {\r
-        return instance;\r
-    }\r
-\r
-    public static ImageDescriptor getImageDescriptor(String path) {\r
-        return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);\r
-    }\r
-\r
-    public static URL getDefaultResource(String name) {\r
-        Activator plugin = getDefault();\r
-        if(plugin == null) throw new IllegalStateException("The plugin is not active.");\r
-        Bundle bundle = plugin.getBundle(); \r
-        return bundle.getResource(name);\r
-    }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.issues.ui.internal;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTracker;
+import org.simantics.issues.Severity;
+import org.simantics.message.IMessageSchemeManager;
+import org.simantics.utils.ui.gfx.AlphaAdjustmentImageDescriptor;
+import org.simantics.utils.ui.gfx.HSVAdjustmentImageDescriptor;
+
+public class Activator extends AbstractUIPlugin {
+
+    public static final String PLUGIN_ID = "org.simantics.issues.ui";
+    
+    static Activator instance;
+    ServiceTracker   messageScheme;
+
+    public static ImageDescriptor HIDE_ICON;
+    public static ImageDescriptor UNHIDE_ICON;
+    public static ImageDescriptor RESOLVE_ICON;
+    public static ImageDescriptor UNRESOLVE_ICON;
+
+    public static ImageDescriptor PURGE_ICON;
+
+    public static ImageDescriptor FATAL_ICON;
+    public static ImageDescriptor ERROR_ICON;
+    public static ImageDescriptor WARNING_ICON;
+    public static ImageDescriptor INFO_ICON;
+    public static ImageDescriptor NOTE_ICON;
+    public static ImageDescriptor OK_ICON;
+
+    public static ImageDescriptor FATAL_DECORATION_ICON;
+    public static ImageDescriptor ERROR_DECORATION_ICON;
+    public static ImageDescriptor WARNING_DECORATION_ICON;
+    public static ImageDescriptor INFO_DECORATION_ICON;
+    public static ImageDescriptor NOTE_DECORATION_ICON;
+
+    @Override
+    public void start(BundleContext context) throws Exception {
+        super.start(context);
+        instance = this;
+        messageScheme = new ServiceTracker(context, IMessageSchemeManager.class.getName(), null);
+
+        Bundle bundle = context.getBundle();
+
+        HIDE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/hide.png"));
+        UNHIDE_ICON = AlphaAdjustmentImageDescriptor.adjustAlpha(HSVAdjustmentImageDescriptor.adjust(
+                HIDE_ICON, 0f, 0f, 1f), 96);
+        //RESOLVE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/lightbulb.png"));
+        //UNRESOLVE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/lightbulb_off.png"));
+        RESOLVE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/tick.png"));
+        UNRESOLVE_ICON = AlphaAdjustmentImageDescriptor.adjustAlpha(HSVAdjustmentImageDescriptor.adjust(
+                RESOLVE_ICON, 0f, 0f, 1f), 96);
+
+        PURGE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/purge.gif"));
+
+        FATAL_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/fatal.png"));
+        ERROR_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/error.png"));
+        WARNING_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/warning.png"));
+        INFO_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/information.png"));
+        NOTE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/note.png"));
+        OK_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/noissue.png"));
+
+        FATAL_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/fatal_decoration.png"));
+        ERROR_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/error_decoration.png"));
+        WARNING_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/warning_decoration.png"));
+        INFO_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/information_decoration.png"));
+        NOTE_DECORATION_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/note_decoration.png"));
+    }
+
+    @Override
+    protected ImageRegistry createImageRegistry() {
+        return super.createImageRegistry();
+    }
+
+    @Override
+    protected void initializeImageRegistry(ImageRegistry reg) {
+        reg.put(Severity.FATAL.toString()+"-full", FATAL_ICON);
+        reg.put(Severity.ERROR.toString()+"-full", ERROR_ICON);
+        reg.put(Severity.WARNING.toString()+"-full", WARNING_ICON);
+        reg.put(Severity.INFO.toString()+"-full", INFO_ICON);
+        reg.put(Severity.NOTE.toString()+"-full", NOTE_ICON);
+        reg.put(Severity.FATAL.toString(), FATAL_DECORATION_ICON);
+        reg.put(Severity.ERROR.toString(), ERROR_DECORATION_ICON);
+        reg.put(Severity.WARNING.toString(), WARNING_DECORATION_ICON);
+        reg.put(Severity.INFO.toString(), INFO_DECORATION_ICON);
+        reg.put(Severity.NOTE.toString(), NOTE_DECORATION_ICON);
+    }
+
+    @Override
+    public void stop(BundleContext context) throws Exception {
+        messageScheme.close();
+        instance = null;
+        super.stop(context);
+    }
+
+    /**
+     * Returns the shared instance
+     *
+     * @return the shared instance
+     */
+    public static Activator getDefault() {
+        return instance;
+    }
+
+    public static ImageDescriptor getImageDescriptor(String path) {
+        return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
+    }
+
+    public static URL getDefaultResource(String name) {
+        Activator plugin = getDefault();
+        if(plugin == null) throw new IllegalStateException("The plugin is not active.");
+        Bundle bundle = plugin.getBundle(); 
+        return bundle.getResource(name);
+    }
+
+}