1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
*****************************************************************************/
package org.eclipse.papyrus.customization.factory;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.papyrus.customization.model.customization.CustomizableElement;
import org.eclipse.papyrus.customization.model.customization.CustomizationPackage;
import org.eclipse.papyrus.customization.plugin.PluginEditor;
public interface ExtensionFactory {
public static Registry registry = Registry.instance;
public static class Registry {
private static Registry instance = new Registry();
private final Map<EClass, ExtensionFactory> factories;
private Registry() {
factories = new HashMap<EClass, ExtensionFactory>();
factories.put(CustomizationPackage.eINSTANCE.getPropertyView(), new PropertyViewExtensionFactory());
factories.put(CustomizationPackage.eINSTANCE.getModelTemplate(), new ModelTemplateExtensionFactory());
factories.put(CustomizationPackage.eINSTANCE.getUICustom(), new UICustomExtensionFactory());
//factoryMap.put("Palette", new Factory("oep.p", "file", "test", true));
//factoryMap.put("PropertyView", ...);
factories.put(CustomizationPackage.eINSTANCE.getProfile(), new ProfileExtensionFactory());
factories.put(CustomizationPackage.eINSTANCE.getUMLModel(), new UMLModelExtensionFactory());
}
public ExtensionFactory getFactory(EClass type) {
return factories.get(type);
}
public void registerFactory(EClass forType, ExtensionFactory factory) {
factories.put(forType, factory);
}
public Collection<? extends ExtensionFactory> getFactories() {
return factories.values();
}
}
public void addElement(CustomizableElement element, PluginEditor editor);
public String getName();
}
|