|
1 package org.symbian.tools.tmw.core; |
|
2 |
|
3 import org.eclipse.core.resources.IProject; |
|
4 import org.eclipse.core.runtime.IStatus; |
|
5 import org.eclipse.core.runtime.Plugin; |
|
6 import org.eclipse.core.runtime.Status; |
|
7 import org.osgi.framework.BundleContext; |
|
8 import org.symbian.tools.tmw.core.internal.projects.ProjectsSupportManager; |
|
9 import org.symbian.tools.tmw.core.internal.runtimes.RuntimeClasspathManager; |
|
10 import org.symbian.tools.tmw.core.internal.runtimes.RuntimesManagerImpl; |
|
11 import org.symbian.tools.tmw.core.projects.IMTWProject; |
|
12 import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntimeManager; |
|
13 |
|
14 /** |
|
15 * The activator class controls the plug-in life cycle |
|
16 */ |
|
17 public class TMWCore extends Plugin { |
|
18 |
|
19 // The plug-in ID |
|
20 public static final String PLUGIN_ID = "org.symbian.tools.tmw.core"; //$NON-NLS-1$ |
|
21 |
|
22 // The shared instance |
|
23 private static TMWCore plugin; |
|
24 |
|
25 private IMobileWebRuntimeManager runtimesManager; |
|
26 private ProjectsSupportManager projectsSupport; |
|
27 private RuntimeClasspathManager classpathManager; |
|
28 |
|
29 /** |
|
30 * The constructor |
|
31 */ |
|
32 public TMWCore() { |
|
33 } |
|
34 |
|
35 /* |
|
36 * (non-Javadoc) |
|
37 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) |
|
38 */ |
|
39 public void start(BundleContext context) throws Exception { |
|
40 super.start(context); |
|
41 plugin = this; |
|
42 runtimesManager = new RuntimesManagerImpl(); |
|
43 projectsSupport = new ProjectsSupportManager(); |
|
44 classpathManager = new RuntimeClasspathManager(); |
|
45 } |
|
46 |
|
47 /* |
|
48 * (non-Javadoc) |
|
49 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) |
|
50 */ |
|
51 public void stop(BundleContext context) throws Exception { |
|
52 plugin = null; |
|
53 super.stop(context); |
|
54 } |
|
55 |
|
56 public IMobileWebRuntimeManager getRuntimesManager() { |
|
57 return runtimesManager; |
|
58 } |
|
59 |
|
60 public RuntimeClasspathManager getClasspathManager() { |
|
61 return classpathManager; |
|
62 } |
|
63 |
|
64 public IMTWProject create(IProject project) { |
|
65 return projectsSupport.create(project); |
|
66 } |
|
67 |
|
68 /** |
|
69 * Returns the shared instance |
|
70 * |
|
71 * @return the shared instance |
|
72 */ |
|
73 public static TMWCore getDefault() { |
|
74 return plugin; |
|
75 } |
|
76 |
|
77 public static void log(String message, Exception exception) { |
|
78 getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception)); |
|
79 } |
|
80 |
|
81 public static void log(String message, Object... args) { |
|
82 log(String.format(message, args), (Exception) null); |
|
83 } |
|
84 } |