author | Eugene Ostroukhov <eugeneo@symbian.org> |
Tue, 31 Aug 2010 11:58:53 -0700 | |
changeset 479 | 518afa7c6d2f |
parent 477 | b616697678bf |
child 484 | f5df819c1852 |
permissions | -rw-r--r-- |
461
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
1 |
/** |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
2 |
* Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies). |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
3 |
* All rights reserved. |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
8 |
* |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
10 |
* Symbian Foundation - initial contribution. |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
11 |
* Contributors: |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
12 |
* Description: |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
13 |
* Overview: |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
14 |
* Details: |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
15 |
* Platforms/Drives/Compatibility: |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
16 |
* Assumptions/Requirement/Pre-requisites: |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
17 |
* Failures and causes: |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
18 |
*/ |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
19 |
package org.symbian.tools.tmw.core.internal.runtimes; |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
20 |
|
477
b616697678bf
Providers can now specify fixed facets on per-runtime basis. Those facets will not be shown to users in the project creation wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
471
diff
changeset
|
21 |
import java.util.Map; |
b616697678bf
Providers can now specify fixed facets on per-runtime basis. Those facets will not be shown to users in the project creation wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
471
diff
changeset
|
22 |
import java.util.TreeMap; |
b616697678bf
Providers can now specify fixed facets on per-runtime basis. Those facets will not be shown to users in the project creation wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
471
diff
changeset
|
23 |
|
461
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
24 |
import org.eclipse.core.runtime.IConfigurationElement; |
479
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
25 |
import org.eclipse.core.runtime.Platform; |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
26 |
import org.symbian.tools.tmw.core.TMWCore; |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
27 |
import org.symbian.tools.tmw.core.internal.runtimes.RuntimesManagerImpl.LazyProvider; |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
28 |
import org.symbian.tools.tmw.core.runtimes.IApplicationLayoutProvider; |
461
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
29 |
import org.symbian.tools.tmw.core.runtimes.IMobileWebRuntime; |
477
b616697678bf
Providers can now specify fixed facets on per-runtime basis. Those facets will not be shown to users in the project creation wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
471
diff
changeset
|
30 |
import org.symbian.tools.tmw.core.utilities.CoreUtil; |
461
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
31 |
|
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
32 |
public final class MobileWebRuntime implements IMobileWebRuntime { |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
33 |
private final IConfigurationElement element; |
479
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
34 |
private IApplicationLayoutProvider layout; |
461
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
35 |
|
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
36 |
public MobileWebRuntime(IConfigurationElement element) { |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
37 |
this.element = element; |
479
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
38 |
checkRegistry(); |
461
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
39 |
} |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
40 |
|
479
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
41 |
private synchronized void checkRegistry() { |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
42 |
if (layout == null) { |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
43 |
final IConfigurationElement[] configuration = Platform.getExtensionRegistry().getConfigurationElementsFor( |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
44 |
TMWCore.PLUGIN_ID, "runtimeAppLayout"); |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
45 |
for (IConfigurationElement element : configuration) { |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
46 |
final String runtimeId = element.getAttribute("runtime-id"); |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
47 |
final String version = element.getAttribute("runtime-version"); |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
48 |
if (getId().endsWith(runtimeId) && getVersion().endsWith(version)) { |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
49 |
layout = new LazyProvider(element); |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
50 |
break; |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
51 |
} |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
52 |
} |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
53 |
if (layout == null) { |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
54 |
TMWCore.log("No layout provider for runtime %s:%s (from plugin %s)", getId(), getVersion(), element |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
55 |
.getContributor().getName()); |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
56 |
} |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
57 |
} |
461
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
58 |
} |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
59 |
|
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
60 |
public IConfigurationElement[] getComponentElements() { |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
61 |
return element.getChildren("runtime-component"); |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
62 |
} |
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
63 |
|
477
b616697678bf
Providers can now specify fixed facets on per-runtime basis. Those facets will not be shown to users in the project creation wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
471
diff
changeset
|
64 |
public Map<String, String> getFixedFacets() { |
b616697678bf
Providers can now specify fixed facets on per-runtime basis. Those facets will not be shown to users in the project creation wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
471
diff
changeset
|
65 |
final Map<String, String> facets = new TreeMap<String, String>(); |
b616697678bf
Providers can now specify fixed facets on per-runtime basis. Those facets will not be shown to users in the project creation wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
471
diff
changeset
|
66 |
final IConfigurationElement[] children = element.getChildren("fixed-facet"); |
b616697678bf
Providers can now specify fixed facets on per-runtime basis. Those facets will not be shown to users in the project creation wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
471
diff
changeset
|
67 |
for (IConfigurationElement element : children) { |
b616697678bf
Providers can now specify fixed facets on per-runtime basis. Those facets will not be shown to users in the project creation wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
471
diff
changeset
|
68 |
facets.put(CoreUtil.notNull(element.getAttribute("id")), element.getAttribute("version")); |
b616697678bf
Providers can now specify fixed facets on per-runtime basis. Those facets will not be shown to users in the project creation wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
471
diff
changeset
|
69 |
} |
b616697678bf
Providers can now specify fixed facets on per-runtime basis. Those facets will not be shown to users in the project creation wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
471
diff
changeset
|
70 |
return facets; |
b616697678bf
Providers can now specify fixed facets on per-runtime basis. Those facets will not be shown to users in the project creation wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
471
diff
changeset
|
71 |
} |
b616697678bf
Providers can now specify fixed facets on per-runtime basis. Those facets will not be shown to users in the project creation wizard
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
471
diff
changeset
|
72 |
|
479
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
73 |
public String getId() { |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
74 |
return element.getAttribute("component-id"); |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
75 |
} |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
76 |
|
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
77 |
public IApplicationLayoutProvider getLayoutProvider() { |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
78 |
return layout; |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
79 |
} |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
80 |
|
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
81 |
public String getName() { |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
82 |
return element.getAttribute("name"); |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
83 |
} |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
84 |
|
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
85 |
public String getVersion() { |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
86 |
return element.getAttribute("component-version"); |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
87 |
} |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
88 |
|
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
89 |
@Override |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
90 |
public String toString() { |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
91 |
return getId() + ":" + getVersion(); |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
92 |
} |
518afa7c6d2f
Minor refactoring to make API more clear
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
477
diff
changeset
|
93 |
|
461
7a8f9fa8d278
Project model introduction and JSDT classpath support
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
94 |
} |