author | Matti Laitinen <matti.t.laitinen@nokia.com> |
Tue, 24 Aug 2010 12:16:27 +0300 | |
changeset 15 | 0367d2db2c06 |
parent 6 | f65f740e69f9 |
permissions | -rw-r--r-- |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
1 |
/* |
6
f65f740e69f9
AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
1
diff
changeset
|
2 |
* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
8 |
* |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
11 |
* |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
13 |
* |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
14 |
* Description: Definitions for the class Activator |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
15 |
* |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
17 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
18 |
package com.nokia.s60tools.analyzetool; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
19 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
20 |
import java.io.File; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
21 |
import java.io.IOException; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
22 |
import java.net.URL; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
23 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
24 |
import org.eclipse.core.runtime.FileLocator; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
25 |
import org.eclipse.core.runtime.IPath; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
26 |
import org.eclipse.core.runtime.IStatus; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
27 |
import org.eclipse.core.runtime.Path; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
28 |
import org.eclipse.core.runtime.Status; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
29 |
import org.eclipse.jface.preference.IPreferenceStore; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
30 |
import org.eclipse.jface.resource.ImageDescriptor; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
31 |
import org.eclipse.swt.graphics.Image; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
32 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
33 |
import org.osgi.framework.Bundle; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
34 |
import org.osgi.framework.BundleContext; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
35 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
36 |
import com.nokia.s60tools.analyzetool.global.Constants; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
37 |
import com.nokia.s60tools.analyzetool.ui.IActionListener; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
38 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
39 |
/** |
6
f65f740e69f9
AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
1
diff
changeset
|
40 |
* The activator class controls the plug-in life cycle |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
41 |
* |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
42 |
* @author kihe |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
43 |
*/ |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
44 |
public class Activator extends AbstractUIPlugin { |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
45 |
|
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
46 |
/** The plug-in ID. */ |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
47 |
public static final String PLUGIN_ID = Constants.PLUGINID; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
48 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
49 |
/** The shared instance. */ |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
50 |
private static Activator plugin; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
51 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
52 |
/** Preference store. */ |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
53 |
private static IPreferenceStore preferenceStore; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
54 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
55 |
/** Action listener. */ |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
56 |
private static IActionListener actionListener = null; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
57 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
58 |
/** |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
59 |
* The constructor. |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
60 |
*/ |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
61 |
public Activator() { |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
62 |
plugin = this; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
63 |
} |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
64 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
65 |
/* |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
66 |
* (non-Javadoc) |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
67 |
* |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
68 |
* @see |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
69 |
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
70 |
* ) |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
71 |
*/ |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
72 |
@Override |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
73 |
public final void start(final BundleContext context) { |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
74 |
try { |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
75 |
super.start(context); |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
76 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
77 |
} catch (Exception e) { |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
78 |
e.printStackTrace(); |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
79 |
} |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
80 |
} |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
81 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
82 |
/* |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
83 |
* (non-Javadoc) |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
84 |
* |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
85 |
* @see |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
86 |
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
87 |
* ) |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
88 |
*/ |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
89 |
@Override |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
90 |
public final void stop(final BundleContext context) { |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
91 |
try { |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
92 |
plugin = null; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
93 |
super.stop(context); |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
94 |
} catch (Exception e) { |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
95 |
e.printStackTrace(); |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
96 |
} |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
97 |
} |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
98 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
99 |
/** |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
100 |
* Returns the shared instance. |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
101 |
* |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
102 |
* @return the shared instance |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
103 |
*/ |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
104 |
public static Activator getDefault() { |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
105 |
return plugin; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
106 |
} |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
107 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
108 |
/** |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
109 |
* Returns an image descriptor for the image file at the given plug-in |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
110 |
* relative path. |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
111 |
* |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
112 |
* @param path |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
113 |
* the path |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
114 |
* @return the image descriptor |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
115 |
*/ |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
116 |
public static ImageDescriptor getImageDescriptor(final String path) { |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
117 |
return imageDescriptorFromPlugin(PLUGIN_ID, path); |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
118 |
} |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
119 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
120 |
/** |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
121 |
* Returns AnalyzeTool used preference store. |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
122 |
* |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
123 |
* @return Preference store |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
124 |
*/ |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
125 |
public static IPreferenceStore getPreferences() { |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
126 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
127 |
// if preference store not yet created => create it |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
128 |
if (preferenceStore == null) { |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
129 |
preferenceStore = getDefault().getPreferenceStore(); |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
130 |
} |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
131 |
return preferenceStore; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
132 |
} |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
133 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
134 |
/** |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
135 |
* Add action listener class. |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
136 |
* |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
137 |
* @param listener |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
138 |
* Action listener |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
139 |
*/ |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
140 |
public static void setActionListener(final IActionListener listener) { |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
141 |
actionListener = listener; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
142 |
} |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
143 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
144 |
/** |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
145 |
* Gets action listener. |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
146 |
* |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
147 |
* @return ActionListener Action listener |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
148 |
*/ |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
149 |
public static IActionListener getActionListener() { |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
150 |
return actionListener; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
151 |
} |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
152 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
153 |
/** |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
154 |
* Returns a File corresponding to the given bundle relative path. |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
155 |
* |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
156 |
* @param path |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
157 |
* the bundle relative path to resource to locate |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
158 |
* @return the File corresponding to the given bundle relative path, or null |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
159 |
* @throws IOException |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
160 |
*/ |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
161 |
public File locateFileInBundle(final String path) throws IOException { |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
162 |
Bundle myBundle = getDefault().getBundle(); |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
163 |
IPath ppath = new Path(path); |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
164 |
ppath = ppath.makeRelative(); |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
165 |
URL[] urls = FileLocator.findEntries(myBundle, ppath); |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
166 |
if (urls.length != 1) { |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
167 |
return null; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
168 |
} |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
169 |
return new File(FileLocator.toFileURL(urls[0]).getFile()); |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
170 |
} |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
171 |
|
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
172 |
/** |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
173 |
* Logs information to the eclipse .log file |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
174 |
* |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
175 |
* @param severity |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
176 |
* Message severity |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
177 |
* @param code |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
178 |
* Message code |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
179 |
* @param message |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
180 |
* Message content |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
181 |
*/ |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
182 |
public void logInfo(int severity, int code, String message) { |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
183 |
IStatus status = new Status(severity, PLUGIN_ID, code, message, |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
184 |
(Throwable) null); |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
185 |
getDefault().getLog().log(status); |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
186 |
} |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
187 |
|
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
188 |
/** |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
189 |
* Logs the given message with the given severity and the given exception to |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
190 |
* this plug-in's log. |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
191 |
* |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
192 |
* @param aSeverity |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
193 |
* the severity; one of the <strong>IStatus</strong> severity |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
194 |
* constants: OK, ERROR, INFO, WARNING, or CANCEL |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
195 |
* @param aMessage |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
196 |
* a human-readable message, localized to the current locale |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
197 |
* @param aException |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
198 |
* a low-level exception, or null if not applicable |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
199 |
*/ |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
200 |
public void log(final int aSeverity, final String aMessage, |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
201 |
final Exception aException) { |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
202 |
getLog().log( |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
203 |
new Status(aSeverity, PLUGIN_ID, IStatus.OK, aMessage, |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
204 |
aException)); |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
205 |
} |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
206 |
|
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
207 |
/** |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
208 |
* Creates and returns an Image for the file at the given plug-in relative |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
209 |
* path. The Image is cached in the #ImageRegistry. |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
210 |
* |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
211 |
* @param aPath |
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
212 |
* the plug-in relative path to the image file |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
213 |
* @return the requested Image |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
214 |
*/ |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
215 |
public Image getImage(final String aPath) { |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
216 |
Image cachedImage = getImageRegistry().get(aPath); |
15
0367d2db2c06
AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
6
diff
changeset
|
217 |
if (null == cachedImage) { |
1
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
218 |
cachedImage = getImageDescriptor(aPath).createImage(); |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
219 |
getImageRegistry().put(aPath, cachedImage); |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
220 |
} |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
221 |
return cachedImage; |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
222 |
} |
1050670c6980
Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff
changeset
|
223 |
} |