|
1 /** |
|
2 * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "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 * Symbian Foundation - initial contribution. |
|
11 * Contributors: |
|
12 * Description: |
|
13 * Overview: |
|
14 * Details: |
|
15 * Platforms/Drives/Compatibility: |
|
16 * Assumptions/Requirement/Pre-requisites: |
|
17 * Failures and causes: |
|
18 */ |
|
19 package org.symbian.tools.tmw.internal.deployment; |
|
20 |
|
21 import org.eclipse.core.runtime.IConfigurationElement; |
|
22 import org.eclipse.core.runtime.Platform; |
|
23 import org.symbian.tools.tmw.ui.TMWCoreUI; |
|
24 import org.symbian.tools.tmw.ui.deployment.IDeploymentTargetType; |
|
25 |
|
26 public class DeploymentTargetTypesRegistry { |
|
27 private DeploymentTargetTypeDescriptor[] descriptors; |
|
28 |
|
29 public DeploymentTargetTypesRegistry() { |
|
30 readExtensions(); |
|
31 } |
|
32 |
|
33 private void readExtensions() { |
|
34 final IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor( |
|
35 TMWCoreUI.PLUGIN_ID, "deploymentTargetType"); |
|
36 descriptors = new DeploymentTargetTypeDescriptor[elements.length]; |
|
37 for (int i = 0; i < elements.length; i++) { |
|
38 descriptors[i] = new DeploymentTargetTypeDescriptor(elements[i]); |
|
39 } |
|
40 } |
|
41 |
|
42 public DeploymentTargetTypeDescriptor[] getProviders() { |
|
43 return descriptors; |
|
44 } |
|
45 |
|
46 public IDeploymentTargetType getType(String id) { |
|
47 DeploymentTargetTypeDescriptor[] providers = getProviders(); |
|
48 for (DeploymentTargetTypeDescriptor descriptor : providers) { |
|
49 if (descriptor.getId().equals(id)) { |
|
50 return descriptor; |
|
51 } |
|
52 } |
|
53 return null; |
|
54 } |
|
55 } |