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