author | Eugene Ostroukhov <eugeneo@symbian.org> |
Wed, 28 Jul 2010 15:43:33 -0700 | |
changeset 457 | f1087591ff71 |
parent 455 | 5da55957c779 |
permissions | -rw-r--r-- |
454
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
1 |
package org.symbian.tools.mtw.ui; |
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
2 |
|
455
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
3 |
import java.util.Map; |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
4 |
import java.util.WeakHashMap; |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
5 |
|
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
6 |
import org.eclipse.core.resources.IProject; |
454
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
7 |
import org.eclipse.core.runtime.IStatus; |
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
8 |
import org.eclipse.core.runtime.Status; |
455
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
9 |
import org.eclipse.jface.resource.ImageRegistry; |
454
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
10 |
import org.eclipse.ui.plugin.AbstractUIPlugin; |
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
11 |
import org.osgi.framework.BundleContext; |
455
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
12 |
import org.symbian.tools.mtw.core.projects.IMTWProject; |
457
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
455
diff
changeset
|
13 |
import org.symbian.tools.mtw.internal.deployment.DeploymentTargetPresentationsManager; |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
455
diff
changeset
|
14 |
import org.symbian.tools.mtw.internal.deployment.DeploymentTargetTypesRegistry; |
454
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
15 |
|
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
16 |
/** |
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
17 |
* The activator class controls the plug-in life cycle |
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
18 |
*/ |
455
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
19 |
public class MTWCoreUI extends AbstractUIPlugin { |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
20 |
private final Map<IProject, ProjectMemo> MEMOS = new WeakHashMap<IProject, ProjectMemo>(); |
457
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
455
diff
changeset
|
21 |
private final DeploymentTargetTypesRegistry typesRegistry = new DeploymentTargetTypesRegistry(); |
454
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
22 |
|
455
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
23 |
// The plug-in ID |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
24 |
public static final String PLUGIN_ID = "org.symbian.tools.mtw.ui"; //$NON-NLS-1$ |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
25 |
|
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
26 |
// The shared instance |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
27 |
private static MTWCoreUI plugin; |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
28 |
private Images images; |
457
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
455
diff
changeset
|
29 |
private final DeploymentTargetPresentationsManager presentations = new DeploymentTargetPresentationsManager(); |
454
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
30 |
|
455
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
31 |
/** |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
32 |
* The constructor |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
33 |
*/ |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
34 |
public MTWCoreUI() { |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
35 |
} |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
36 |
|
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
37 |
@Override |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
38 |
protected void initializeImageRegistry(ImageRegistry reg) { |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
39 |
super.initializeImageRegistry(reg); |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
40 |
} |
454
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
41 |
|
455
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
42 |
/* |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
43 |
* (non-Javadoc) |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
44 |
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
45 |
*/ |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
46 |
public void start(BundleContext context) throws Exception { |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
47 |
super.start(context); |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
48 |
plugin = this; |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
49 |
} |
454
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
50 |
|
455
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
51 |
/* |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
52 |
* (non-Javadoc) |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
53 |
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
54 |
*/ |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
55 |
public void stop(BundleContext context) throws Exception { |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
56 |
plugin = null; |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
57 |
super.stop(context); |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
58 |
} |
454
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
59 |
|
455
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
60 |
/** |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
61 |
* Returns the shared instance |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
62 |
* |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
63 |
* @return the shared instance |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
64 |
*/ |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
65 |
public static MTWCoreUI getDefault() { |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
66 |
return plugin; |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
67 |
} |
454
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
68 |
|
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
69 |
public static void log(String message, Exception e) { |
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
70 |
getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, e)); |
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
71 |
} |
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
72 |
|
457
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
455
diff
changeset
|
73 |
public static void log(String message, Object... args) { |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
455
diff
changeset
|
74 |
log(String.format(message, args), (Exception) null); |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
455
diff
changeset
|
75 |
} |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
455
diff
changeset
|
76 |
|
454
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
77 |
public static void log(Exception e) { |
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
78 |
log(null, e); |
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
79 |
} |
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
80 |
|
455
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
81 |
public static ProjectMemo getMemo(IMTWProject project) { |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
82 |
return getDefault().getMemoForProject(project); |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
83 |
} |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
84 |
|
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
85 |
private synchronized ProjectMemo getMemoForProject(IMTWProject project) { |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
86 |
ProjectMemo memo = MEMOS.get(project.getProject()); |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
87 |
if (memo == null) { |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
88 |
memo = new ProjectMemo(project); |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
89 |
MEMOS.put(project.getProject(), memo); |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
90 |
} |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
91 |
return memo; |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
92 |
} |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
93 |
|
457
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
455
diff
changeset
|
94 |
public DeploymentTargetTypesRegistry getDeploymentTypesRegistry() { |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
455
diff
changeset
|
95 |
return typesRegistry; |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
455
diff
changeset
|
96 |
} |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
455
diff
changeset
|
97 |
|
455
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
98 |
public static Images getImages() { |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
99 |
if (getDefault().images == null) { |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
100 |
getDefault().images = new Images(getDefault().getImageRegistry()); |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
101 |
} |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
102 |
return getDefault().images; |
5da55957c779
Bluetooth support was refactored on top of a new frameworks
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
454
diff
changeset
|
103 |
} |
457
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
455
diff
changeset
|
104 |
|
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
455
diff
changeset
|
105 |
public DeploymentTargetPresentationsManager getPresentations() { |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
455
diff
changeset
|
106 |
return presentations; |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
455
diff
changeset
|
107 |
} |
454
38d6944cff88
Bug 3352 - Replace our Navigator View with the JSDT one
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
108 |
} |