1 /* |
|
2 * Copyright (c) 2007 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 * TraceCompilerExport implementation for Symbian dictionary files |
|
17 * |
|
18 */ |
|
19 package com.nokia.tracecompiler.decodeplugins.dictionary; |
|
20 |
|
21 import com.nokia.tracecompiler.model.TraceCompilerException; |
|
22 import com.nokia.tracecompiler.model.TraceModel; |
|
23 import com.nokia.tracecompiler.plugin.TraceCompilerExport; |
|
24 |
|
25 /** |
|
26 * TraceCompilerExport implementation for Symbian dictionary files |
|
27 * |
|
28 */ |
|
29 public final class DictionaryEngine implements TraceCompilerExport { |
|
30 |
|
31 /** |
|
32 * The trace model |
|
33 */ |
|
34 private TraceModel model; |
|
35 |
|
36 /** |
|
37 * Dictionary instance |
|
38 */ |
|
39 private static DictionaryEngine instance; |
|
40 |
|
41 /** |
|
42 * Gets the shared instance |
|
43 * |
|
44 * @return the instance |
|
45 */ |
|
46 static DictionaryEngine getInstance() { |
|
47 return instance; |
|
48 } |
|
49 |
|
50 /** |
|
51 * Constructor |
|
52 */ |
|
53 public DictionaryEngine() { |
|
54 instance = this; |
|
55 } |
|
56 |
|
57 /* |
|
58 * (non-Javadoc) |
|
59 * |
|
60 * @see com.nokia.tracecompiler.engine.TraceCompilerPlugin# |
|
61 * traceProjectOpened(com.nokia.tracecompiler.model.TraceModel) |
|
62 */ |
|
63 public void traceProjectOpened(TraceModel model) { |
|
64 this.model = model; |
|
65 DictionaryFile file = model.getExtension(DictionaryFile.class); |
|
66 if (file == null) { |
|
67 file = new DictionaryFile(DictionaryFileExport |
|
68 .getPathForDictionary(model)); |
|
69 model.addExtension(file); |
|
70 } |
|
71 } |
|
72 |
|
73 /* |
|
74 * (non-Javadoc) |
|
75 * |
|
76 * @see com.nokia.tracecompiler.engine.TraceCompilerPlugin#traceProjectClosed() |
|
77 */ |
|
78 public void traceProjectClosed() { |
|
79 if (model != null && model.isValid()) { |
|
80 model.removeExtensions(DictionaryFile.class); |
|
81 } |
|
82 model = null; |
|
83 } |
|
84 |
|
85 /* |
|
86 * (non-Javadoc) |
|
87 * |
|
88 * @see com.nokia.tracecompiler.engine.TraceCompilerExport#exportTraceProject() |
|
89 */ |
|
90 public void exportTraceProject() throws TraceCompilerException { |
|
91 if (model != null && model.isValid()) { |
|
92 DictionaryFile df = model.getExtension(DictionaryFile.class); |
|
93 if (df != null) { |
|
94 DictionaryFileExport export = new DictionaryFileExport(df); |
|
95 export.exportDictionary(); |
|
96 } |
|
97 } |
|
98 } |
|
99 |
|
100 } |
|