|
1 /* |
|
2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 * Access point to the exported interfaces of Trace Builder engine |
|
17 * |
|
18 */ |
|
19 package com.nokia.tracebuilder.engine; |
|
20 |
|
21 import java.util.Iterator; |
|
22 import com.nokia.tracebuilder.engine.source.SourceEngine; |
|
23 import com.nokia.tracebuilder.model.TraceModel; |
|
24 import com.nokia.tracebuilder.plugin.TraceBuilderPlugin; |
|
25 import com.nokia.tracebuilder.project.GroupNameHandlerBase; |
|
26 |
|
27 /** |
|
28 * Access point to the exported interfaces of Trace Builder engine |
|
29 * |
|
30 */ |
|
31 public class TraceBuilderGlobals { |
|
32 |
|
33 /** |
|
34 * Max trace ID |
|
35 */ |
|
36 public static final int MAX_TRACE_ID = 65535; // CodForChk_Dis_Magic |
|
37 |
|
38 /** |
|
39 * Trace builder instance |
|
40 */ |
|
41 private static TraceBuilder instance; |
|
42 |
|
43 /** |
|
44 * Constructor is hidden |
|
45 */ |
|
46 private TraceBuilderGlobals() { |
|
47 } |
|
48 |
|
49 /** |
|
50 * Starts Trace Builder engine. |
|
51 */ |
|
52 public static void start() { |
|
53 if (instance == null) { |
|
54 instance = new TraceBuilder(); |
|
55 instance.start(); |
|
56 } |
|
57 } |
|
58 |
|
59 /** |
|
60 * Shuts down the TraceBuilder instance |
|
61 */ |
|
62 public static void shutdown() { |
|
63 if (instance != null) { |
|
64 instance.shutdown(); |
|
65 instance = null; |
|
66 } |
|
67 } |
|
68 |
|
69 /** |
|
70 * Gets the configuration interface. The configuration interface is not |
|
71 * available until view has been registered. |
|
72 * |
|
73 * @return the configuration |
|
74 */ |
|
75 public static TraceBuilderConfiguration getConfiguration() { |
|
76 return instance.getConfiguration(); |
|
77 } |
|
78 |
|
79 /** |
|
80 * Gets the trace model |
|
81 * |
|
82 * @return the model |
|
83 */ |
|
84 public static TraceModel getTraceModel() { |
|
85 return instance.getModel(); |
|
86 } |
|
87 |
|
88 /** |
|
89 * Gets the source engine |
|
90 * |
|
91 * @return the source engine |
|
92 */ |
|
93 public static SourceEngine getSourceEngine() { |
|
94 return instance.getSourceEngine(); |
|
95 } |
|
96 |
|
97 /** |
|
98 * Gets the trace builder interface |
|
99 * |
|
100 * @return trace builder |
|
101 */ |
|
102 public static TraceBuilderInterface getTraceBuilder() { |
|
103 return instance.getTraceBuilder(); |
|
104 } |
|
105 |
|
106 /** |
|
107 * Gets the dialogs interface |
|
108 * |
|
109 * @return the dialogs interface |
|
110 */ |
|
111 public static TraceBuilderDialogs getDialogs() { |
|
112 return instance.getDialogs(); |
|
113 } |
|
114 |
|
115 /** |
|
116 * Gets the events interface |
|
117 * |
|
118 * @return the events interface |
|
119 */ |
|
120 public static TraceBuilderEvents getEvents() { |
|
121 return instance.getEvents(); |
|
122 } |
|
123 |
|
124 /** |
|
125 * Called by a plug-in to register itself |
|
126 * |
|
127 * @param plugin |
|
128 * the plugin to be registered |
|
129 */ |
|
130 public static void registerPlugin(TraceBuilderPlugin plugin) { |
|
131 instance.registerPlugin(plugin); |
|
132 } |
|
133 |
|
134 /** |
|
135 * Called by a plug-in to unregister itself |
|
136 * |
|
137 * @param plugin |
|
138 * the plugin to be unregistered |
|
139 */ |
|
140 public static void unregisterPlugin(TraceBuilderPlugin plugin) { |
|
141 if (instance != null) { |
|
142 instance.unregisterPlugin(plugin); |
|
143 } |
|
144 } |
|
145 |
|
146 /** |
|
147 * Called by the view plug-in to register the view |
|
148 * |
|
149 * @param view |
|
150 * the view |
|
151 */ |
|
152 public static void setView(TraceBuilderView view) { |
|
153 instance.setView(view); |
|
154 } |
|
155 |
|
156 /** |
|
157 * Is view registered |
|
158 * |
|
159 * @return true if view is registered false if view is not registered |
|
160 */ |
|
161 public static boolean isViewRegistered() { |
|
162 return instance.isViewRegistered(); |
|
163 } |
|
164 |
|
165 /** |
|
166 * Runs an asynchronous operation. Asynchronous operations are not available |
|
167 * until view has been registered |
|
168 * |
|
169 * @param runner |
|
170 * the operation to run |
|
171 */ |
|
172 public static void runAsyncOperation(Runnable runner) { |
|
173 instance.runAsyncOperation(runner); |
|
174 } |
|
175 |
|
176 /** |
|
177 * Gets the source context manager |
|
178 * |
|
179 * @return the context manager |
|
180 */ |
|
181 public static SourceContextManager getSourceContextManager() { |
|
182 return instance.getSourceContextManager(); |
|
183 } |
|
184 |
|
185 /** |
|
186 * Returns the actions interface. The actions interface is not available |
|
187 * until view has been registered |
|
188 * |
|
189 * @return the factory |
|
190 */ |
|
191 public static TraceBuilderActions getActions() { |
|
192 return instance.getActions(); |
|
193 } |
|
194 |
|
195 /** |
|
196 * Returns the view |
|
197 * |
|
198 * @return the view |
|
199 */ |
|
200 public static TraceBuilderView getView() { |
|
201 return instance.getView(); |
|
202 } |
|
203 |
|
204 /** |
|
205 * Set current software component index |
|
206 * |
|
207 * @param currentSoftwareComponentIndex |
|
208 * Current component index |
|
209 */ |
|
210 public static void setCurrentSoftwareComponentIndex( |
|
211 int currentSoftwareComponentIndex) { |
|
212 instance |
|
213 .setCurrentSoftwareComponentIndex(currentSoftwareComponentIndex); |
|
214 } |
|
215 |
|
216 /** |
|
217 * Get current software component Id |
|
218 * |
|
219 * @return the software component Id as string |
|
220 */ |
|
221 public static String getCurrentSoftwareComponentId() { |
|
222 String softwareComponentId = instance.getCurrentSoftwareComponentId(); |
|
223 return softwareComponentId; |
|
224 } |
|
225 |
|
226 /** |
|
227 * Get current software component name |
|
228 * |
|
229 * @return the current software component name as string |
|
230 */ |
|
231 public static String getCurrentSoftwareComponentName() { |
|
232 String softwareComponentName = instance |
|
233 .getCurrentSoftwareComponentName(); |
|
234 return softwareComponentName; |
|
235 } |
|
236 |
|
237 /** |
|
238 * Add software component |
|
239 * |
|
240 * @param softwareComponentId |
|
241 * software component Id |
|
242 * @param softwareComponentName |
|
243 * software component name |
|
244 * @param mmpPath |
|
245 * software component's mmp path |
|
246 */ |
|
247 public static void addSoftwareComponent(String softwareComponentId, |
|
248 String softwareComponentName, String mmpPath) { |
|
249 instance.addSoftwareComponent(softwareComponentId, |
|
250 softwareComponentName, mmpPath); |
|
251 } |
|
252 |
|
253 /** |
|
254 * Clear software components |
|
255 */ |
|
256 public static void clearSoftwareComponents() { |
|
257 instance.clearSoftwareComponents(); |
|
258 } |
|
259 |
|
260 /** |
|
261 * Gets the software components |
|
262 * |
|
263 * @return the software components iterator |
|
264 */ |
|
265 public static Iterator<SoftwareComponent> getSoftwareComponents() { |
|
266 Iterator<SoftwareComponent> softwareComponentIterator = instance |
|
267 .getSoftwareComponents(); |
|
268 return softwareComponentIterator; |
|
269 } |
|
270 |
|
271 /** |
|
272 * Get current software component's MMP path |
|
273 * |
|
274 * @return the current software component's MMP path |
|
275 */ |
|
276 public static String getCurrentSoftwareComponentMMPPath() { |
|
277 String mmpPath = instance.getCurrentSoftwareComponentMMPPath(); |
|
278 return mmpPath; |
|
279 } |
|
280 |
|
281 /** |
|
282 * Get current software component index |
|
283 * |
|
284 * @return current software component index |
|
285 */ |
|
286 public static int getCurrentSoftwareComponentIndex() { |
|
287 int index = instance.getCurrentSoftwareComponentIndex(); |
|
288 return index; |
|
289 } |
|
290 |
|
291 /** |
|
292 * Get previous software component name |
|
293 * |
|
294 * @return previous software component name |
|
295 */ |
|
296 public static String getPreviousSoftwareComponentName() { |
|
297 String componentName = instance.getPreviousSoftwareComponentName(); |
|
298 return componentName; |
|
299 } |
|
300 |
|
301 /** |
|
302 * Get project path |
|
303 * |
|
304 * @return project path |
|
305 */ |
|
306 public static String getProjectPath() { |
|
307 String projetcPath = instance.getProjectPath(); |
|
308 return projetcPath; |
|
309 } |
|
310 |
|
311 /** |
|
312 * Set project path |
|
313 * |
|
314 * @param path |
|
315 * the path |
|
316 */ |
|
317 public static void setProjectPath(String path) { |
|
318 instance.setProjectPath(path); |
|
319 } |
|
320 |
|
321 /** |
|
322 * Gets the name for the trace header file based on given source |
|
323 * |
|
324 * @param sourceFile |
|
325 * the source file name |
|
326 * @return the header file name |
|
327 */ |
|
328 public static String getHeaderFileName(String sourceFile) { |
|
329 String retval = instance.getHeaderFileName(sourceFile); |
|
330 return retval; |
|
331 } |
|
332 |
|
333 /** |
|
334 * Set project monitor |
|
335 * |
|
336 * @param projectMonitor |
|
337 * the project monitor |
|
338 */ |
|
339 public static void setProjectMonitor(TraceProjectMonitorInterface projectMonitor) { |
|
340 instance.setProjectMonitor(projectMonitor); |
|
341 } |
|
342 |
|
343 /** |
|
344 * Get location converter |
|
345 * |
|
346 * @return the location converter |
|
347 */ |
|
348 public static TraceLocationConverter getLocationConverter() { |
|
349 return instance.getLocationConverter(); |
|
350 } |
|
351 |
|
352 /** |
|
353 * Get location map |
|
354 * |
|
355 * @return the location map |
|
356 */ |
|
357 public static TraceLocationMap getLocationMap() { |
|
358 return instance.getLocationMap(); |
|
359 } |
|
360 |
|
361 /** |
|
362 * Get group name handler |
|
363 * |
|
364 * @return the group name handler |
|
365 */ |
|
366 public static GroupNameHandlerBase getGroupNameHandler() { |
|
367 return instance.getGroupNameHandler(); |
|
368 } |
|
369 |
|
370 /** |
|
371 * Set group name handler |
|
372 * |
|
373 */ |
|
374 public static void setGroupNameHandler(GroupNameHandlerBase groupNameHandler) { |
|
375 instance.setGroupNameHandler(groupNameHandler); |
|
376 } |
|
377 } |