Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 3724cf0320f24657f5ee6865aa6da21a9f6317c0 (plain) (blame)
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
62
63
64
65
66
67
68
/*****************************************************************************
 * Copyright (c) 2010 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:
 *  Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.uml.diagram.paletteconfiguration.provider;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.gmf.runtime.diagram.ui.internal.services.palette.PaletteToolEntry;
import org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.papyrus.infra.extendedtypes.ExtendedTypesRegistry;
import org.eclipse.papyrus.uml.diagram.paletteconfiguration.ElementDescriptor;


/**
 * Extended version of the {@link CombinedTemplateCreationEntry}.
 */
public class ExtendedCreationToolEntry extends PaletteToolEntry implements IElementTypesBasedTool {

	/** list of element types created by this tool */
	final private List<IElementType> elementTypes = new ArrayList<IElementType>(); 
	
	/** List of Element Descriptors for this tool */
	private final List<ElementDescriptor> elementDescriptors; 
	
	/**
	 * Creates a new CreationToolEx.
	 *
	 * @param label the label of the tool
	 * @param factory the factory that creates the tool from this entry
	 * @param id  the unique identifier of the tool
	* @param elementDescriptors list of element descriptors created by the tool
	 */
	public ExtendedCreationToolEntry(String id, String label, PaletteFactory factory, List<ElementDescriptor> elementDescriptors) {
		super(id, label, factory);
		this.elementDescriptors = elementDescriptors;
		
		for(ElementDescriptor elementDescriptor : elementDescriptors) {
			elementTypes.add(ExtendedTypesRegistry.getInstance().getType(elementDescriptor.getElementTypeId()));
		}
	}

	/**
	 * {@inheritDoc}
	 */
	public List<IElementType> getElementTypes() {
		return elementTypes;
	}
	
	/**
	 * {@inheritDoc}
	 */
	public List<ElementDescriptor> getElementDescriptors() {
		return elementDescriptors;
	}
	
}

Back to the top