|
1 /* |
|
2 * Copyright (c) 2008 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 * Console view implementation |
|
17 * |
|
18 */ |
|
19 package com.nokia.tracecompiler; |
|
20 |
|
21 import java.io.File; |
|
22 |
|
23 import com.nokia.tracecompiler.engine.TraceCompilerEngineConfiguration; |
|
24 import com.nokia.tracecompiler.engine.ViewAdapter; |
|
25 |
|
26 /** |
|
27 * TraceCompiler view implementation |
|
28 * |
|
29 */ |
|
30 class TraceCompilerView extends ViewAdapter { |
|
31 |
|
32 /** |
|
33 * Epoc root name in environment variables |
|
34 */ |
|
35 private static final String EPOCROOT = "EPOCROOT"; //$NON-NLS-1$ |
|
36 |
|
37 /** |
|
38 * Export path |
|
39 */ |
|
40 private String exportPath; |
|
41 |
|
42 /** |
|
43 * Configuration |
|
44 */ |
|
45 private TraceCompilerConfiguration configuration; |
|
46 |
|
47 /** |
|
48 * Constructor |
|
49 * |
|
50 * @param projectPath |
|
51 * the project path |
|
52 */ |
|
53 TraceCompilerView(String projectPath) { |
|
54 // First try to get EPOCROOT from environment |
|
55 exportPath = System.getenv(EPOCROOT); |
|
56 |
|
57 // Windows substed drive |
|
58 if (exportPath == null) { |
|
59 int index = projectPath.indexOf(':'); |
|
60 if (index >= 0) { |
|
61 exportPath = projectPath.substring(0, index + 2); // CodForChk_Dis_Magic |
|
62 } else { |
|
63 exportPath = File.separator; |
|
64 } |
|
65 |
|
66 // Check if it ends with a file separator, if not add one at the end |
|
67 } else if (!exportPath.endsWith(File.separator)) { |
|
68 exportPath = exportPath + File.separator; |
|
69 } |
|
70 } |
|
71 |
|
72 /* |
|
73 * (non-Javadoc) |
|
74 * |
|
75 * @see com.nokia.tracecompiler.engine.ViewAdapter#getConfiguration() |
|
76 */ |
|
77 @Override |
|
78 public TraceCompilerEngineConfiguration getConfiguration() { |
|
79 if (configuration == null) { |
|
80 configuration = new TraceCompilerConfiguration(exportPath); |
|
81 } |
|
82 return configuration; |
|
83 } |
|
84 } |