author | Eugene Ostroukhov <eugeneo@symbian.org> |
Thu, 29 Jul 2010 15:59:01 -0700 | |
changeset 460 | c0bff5ed874c |
parent 457 | f1087591ff71 |
permissions | -rw-r--r-- |
457
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
1 |
/** |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
2 |
* Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies). |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
3 |
* All rights reserved. |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
8 |
* |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
10 |
* Symbian Foundation - initial contribution. |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
11 |
* Contributors: |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
12 |
* Description: |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
13 |
* Overview: |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
14 |
* Details: |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
15 |
* Platforms/Drives/Compatibility: |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
16 |
* Assumptions/Requirement/Pre-requisites: |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
17 |
* Failures and causes: |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
18 |
*/ |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
19 |
package org.symbian.tools.mtw.internal.deployment; |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
20 |
|
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
21 |
import java.util.HashMap; |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
22 |
import java.util.Map; |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
23 |
|
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
24 |
import org.eclipse.core.runtime.CoreException; |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
25 |
import org.eclipse.core.runtime.IConfigurationElement; |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
26 |
import org.eclipse.core.runtime.Platform; |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
27 |
import org.symbian.tools.mtw.ui.MTWCoreUI; |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
28 |
import org.symbian.tools.mtw.ui.deployment.IDeploymentTargetType; |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
29 |
import org.symbian.tools.mtw.ui.deployment.ITargetDetailsPane; |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
30 |
|
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
31 |
public class DeploymentTargetPresentationsManager { |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
32 |
private Map<IDeploymentTargetType, IConfigurationElement> presentations; |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
33 |
|
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
34 |
public ITargetDetailsPane createDetailsPane(IDeploymentTargetType targetType) { |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
35 |
readRegistry(); |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
36 |
final IConfigurationElement element = presentations.get(targetType); |
460
c0bff5ed874c
Local filesystem deployment was added
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
457
diff
changeset
|
37 |
if (element != null && element.getAttribute("detailsPane") != null) { |
457
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
38 |
try { |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
39 |
return (ITargetDetailsPane) element.createExecutableExtension("detailsPane"); |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
40 |
} catch (CoreException e) { |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
41 |
MTWCoreUI.log(e); |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
42 |
} |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
43 |
} |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
44 |
return new DefaultDeploymentTypePresentation(); |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
45 |
} |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
46 |
|
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
47 |
private synchronized void readRegistry() { |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
48 |
if (presentations == null) { |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
49 |
presentations = new HashMap<IDeploymentTargetType, IConfigurationElement>(); |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
50 |
final IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor( |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
51 |
MTWCoreUI.PLUGIN_ID, "targetPresentation"); |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
52 |
for (IConfigurationElement element : elements) { |
460
c0bff5ed874c
Local filesystem deployment was added
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
457
diff
changeset
|
53 |
final String runtimeId = element.getAttribute("targetTypeId"); |
457
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
54 |
final IDeploymentTargetType targetType = MTWCoreUI.getDefault().getDeploymentTypesRegistry() |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
55 |
.getType(runtimeId); |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
56 |
if (targetType == null) { |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
57 |
MTWCoreUI.log("Runtime %s was not found. It is referenced from plugin %s", runtimeId, element |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
58 |
.getContributor().getName()); |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
59 |
continue; |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
60 |
} else { |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
61 |
presentations.put(targetType, element); |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
62 |
} |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
63 |
} |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
64 |
} |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
65 |
} |
f1087591ff71
Targets presentation can be customized
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff
changeset
|
66 |
} |