]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.event/src/org/simantics/event/Activator.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.event / src / org / simantics / event / Activator.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2011 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.event;
13
14 import org.eclipse.jface.resource.ImageDescriptor;
15 import org.eclipse.ui.plugin.AbstractUIPlugin;
16 import org.osgi.framework.Bundle;
17 import org.osgi.framework.BundleContext;
18 import org.simantics.utils.ui.gfx.AlphaAdjustmentImageDescriptor;
19 import org.simantics.utils.ui.gfx.HSVAdjustmentImageDescriptor;
20
21 /**
22  * @author Tuukka Lehtonen
23  */
24 public class Activator extends AbstractUIPlugin {
25
26     public static final String   BUNDLE_ID = "org.simantics.event";
27
28     private static BundleContext context;
29
30     public static ImageDescriptor HIDE_ICON;
31     public static ImageDescriptor UNHIDE_ICON;
32     public static ImageDescriptor MILESTONE_ICON;
33     public static ImageDescriptor DIAMOND_ICON, DIAMOND2_ICON;
34     public static ImageDescriptor MARK_MILESTONE_ICON;
35     public static ImageDescriptor UNMARK_MILESTONE_ICON;
36     public static ImageDescriptor SET_BASELINE_ICON;
37     public static ImageDescriptor REMOVE_BASELINE_ICON;
38     public static ImageDescriptor CLIPBOARD_ICON;
39
40     static BundleContext getContext() {
41         return context;
42     }
43
44     @Override
45     public void start(BundleContext bundleContext) throws Exception {
46         Activator.context = bundleContext;
47
48         Bundle bundle = bundleContext.getBundle();
49
50         HIDE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/hide.png"));
51         UNHIDE_ICON = AlphaAdjustmentImageDescriptor.adjustAlpha(HSVAdjustmentImageDescriptor.adjust(ImageDescriptor.createFromURL(bundle.getResource("icons/hide.png")), 0f, 0f, 1f), 96);
52         MILESTONE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/milestone.png"));
53         DIAMOND_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/diamond.png"));
54         DIAMOND2_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/diamond2.png"));
55         MARK_MILESTONE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/milestone.png"));
56         UNMARK_MILESTONE_ICON = AlphaAdjustmentImageDescriptor.adjustAlpha(HSVAdjustmentImageDescriptor.adjust(ImageDescriptor.createFromURL(bundle.getResource("icons/milestone.png")), 0f, 0f, 1f), 96);
57         SET_BASELINE_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/baseline.png"));
58         REMOVE_BASELINE_ICON = AlphaAdjustmentImageDescriptor.adjustAlpha(HSVAdjustmentImageDescriptor.adjust(ImageDescriptor.createFromURL(bundle.getResource("icons/baseline.png")), 0f, 0f, 1f), 96);
59         CLIPBOARD_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/clipboard.png"));
60     }
61
62     @Override
63     public void stop(BundleContext bundleContext) throws Exception {
64         Activator.context = null;
65     }
66
67 }