| 1 | /* |
| 2 | * Copyright 2007, SDQ, IPD, U KA |
| 3 | */ |
| 4 | package de.uka.ipd.sdq.pcm.gmf.allocation.part; |
| 5 | |
| 6 | import java.util.ArrayList; |
| 7 | import java.util.List; |
| 8 | |
| 9 | import org.eclipse.gef.Tool; |
| 10 | import org.eclipse.gef.palette.PaletteContainer; |
| 11 | import org.eclipse.gef.palette.PaletteGroup; |
| 12 | import org.eclipse.gef.palette.PaletteRoot; |
| 13 | import org.eclipse.gef.palette.ToolEntry; |
| 14 | import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool; |
| 15 | |
| 16 | import de.uka.ipd.sdq.pcm.gmf.allocation.providers.PalladioComponentModelElementTypes; |
| 17 | |
| 18 | /** |
| 19 | * @generated |
| 20 | */ |
| 21 | public class PalladioComponentModelPaletteFactory { |
| 22 | |
| 23 | /** |
| 24 | * @generated |
| 25 | */ |
| 26 | public void fillPalette(PaletteRoot paletteRoot) { |
| 27 | paletteRoot.add(createPcm1Group()); |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Creates "pcm" palette tool group |
| 32 | * @generated |
| 33 | */ |
| 34 | private PaletteContainer createPcm1Group() { |
| 35 | PaletteGroup paletteContainer = new PaletteGroup( |
| 36 | Messages.Pcm1Group_title); |
| 37 | paletteContainer.add(createAllocationContext1CreationTool()); |
| 38 | return paletteContainer; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * @generated |
| 43 | */ |
| 44 | private ToolEntry createAllocationContext1CreationTool() { |
| 45 | List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1); |
| 46 | types.add(PalladioComponentModelElementTypes.AllocationContext_3001); |
| 47 | NodeToolEntry entry = new NodeToolEntry( |
| 48 | Messages.AllocationContext1CreationTool_title, |
| 49 | Messages.AllocationContext1CreationTool_desc, types); |
| 50 | entry |
| 51 | .setSmallIcon(PalladioComponentModelElementTypes |
| 52 | .getImageDescriptor(PalladioComponentModelElementTypes.AllocationContext_3001)); |
| 53 | entry.setLargeIcon(entry.getSmallIcon()); |
| 54 | return entry; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * @generated |
| 59 | */ |
| 60 | private static class NodeToolEntry extends ToolEntry { |
| 61 | |
| 62 | /** |
| 63 | * @generated |
| 64 | */ |
| 65 | private final List elementTypes; |
| 66 | |
| 67 | /** |
| 68 | * @generated |
| 69 | */ |
| 70 | private NodeToolEntry(String title, String description, |
| 71 | List elementTypes) { |
| 72 | super(title, description, null, null); |
| 73 | this.elementTypes = elementTypes; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * @generated |
| 78 | */ |
| 79 | public Tool createTool() { |
| 80 | Tool tool = new UnspecifiedTypeCreationTool(elementTypes); |
| 81 | tool.setProperties(getToolProperties()); |
| 82 | return tool; |
| 83 | } |
| 84 | } |
| 85 | } |