| 1 | /* |
| 2 | *Copyright 2007, SDQ, IPD, Uni Karlsruhe (TH) |
| 3 | */ |
| 4 | package de.uka.ipd.sdq.pcm.gmf.composite.view.factories; |
| 5 | |
| 6 | import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.ComposedProvidingRequiringEntity2EditPart; |
| 7 | import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.ComposedProvidingRequiringEntityCompositeStructureInnerCompartmentEditPart; |
| 8 | import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.ComposedProvidingRequiringEntityEditPart; |
| 9 | import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.ComposedProvidingRequiringEntityEntityNameEditPart; |
| 10 | |
| 11 | import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelVisualIDRegistry; |
| 12 | |
| 13 | import java.util.ArrayList; |
| 14 | import java.util.List; |
| 15 | |
| 16 | import org.eclipse.core.runtime.IAdaptable; |
| 17 | |
| 18 | import org.eclipse.emf.ecore.EAnnotation; |
| 19 | import org.eclipse.emf.ecore.EcoreFactory; |
| 20 | |
| 21 | import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; |
| 22 | |
| 23 | import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory; |
| 24 | |
| 25 | import org.eclipse.gmf.runtime.notation.NotationFactory; |
| 26 | import org.eclipse.gmf.runtime.notation.View; |
| 27 | |
| 28 | /** |
| 29 | * @generated |
| 30 | */ |
| 31 | public class ComposedProvidingRequiringEntity2ViewFactory extends |
| 32 | AbstractShapeViewFactory { |
| 33 | |
| 34 | /** |
| 35 | * @generated |
| 36 | */ |
| 37 | protected List createStyles(View view) { |
| 38 | List styles = new ArrayList(); |
| 39 | styles.add(NotationFactory.eINSTANCE.createFontStyle()); |
| 40 | styles.add(NotationFactory.eINSTANCE.createDescriptionStyle()); |
| 41 | styles.add(NotationFactory.eINSTANCE.createFillStyle()); |
| 42 | styles.add(NotationFactory.eINSTANCE.createLineStyle()); |
| 43 | return styles; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * @generated |
| 48 | */ |
| 49 | protected void decorateView(View containerView, View view, |
| 50 | IAdaptable semanticAdapter, String semanticHint, int index, |
| 51 | boolean persisted) { |
| 52 | if (semanticHint == null) { |
| 53 | semanticHint = PalladioComponentModelVisualIDRegistry |
| 54 | .getType(ComposedProvidingRequiringEntity2EditPart.VISUAL_ID); |
| 55 | view.setType(semanticHint); |
| 56 | } |
| 57 | super.decorateView(containerView, view, semanticAdapter, semanticHint, |
| 58 | index, persisted); |
| 59 | if (!ComposedProvidingRequiringEntityEditPart.MODEL_ID |
| 60 | .equals(PalladioComponentModelVisualIDRegistry |
| 61 | .getModelID(containerView))) { |
| 62 | EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE |
| 63 | .createEAnnotation(); |
| 64 | shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ |
| 65 | shortcutAnnotation |
| 66 | .getDetails() |
| 67 | .put( |
| 68 | "modelID", ComposedProvidingRequiringEntityEditPart.MODEL_ID); //$NON-NLS-1$ |
| 69 | view.getEAnnotations().add(shortcutAnnotation); |
| 70 | } |
| 71 | getViewService() |
| 72 | .createNode( |
| 73 | semanticAdapter, |
| 74 | view, |
| 75 | PalladioComponentModelVisualIDRegistry |
| 76 | .getType(ComposedProvidingRequiringEntityEntityNameEditPart.VISUAL_ID), |
| 77 | ViewUtil.APPEND, true, getPreferencesHint()); |
| 78 | getViewService() |
| 79 | .createNode( |
| 80 | semanticAdapter, |
| 81 | view, |
| 82 | PalladioComponentModelVisualIDRegistry |
| 83 | .getType(ComposedProvidingRequiringEntityCompositeStructureInnerCompartmentEditPart.VISUAL_ID), |
| 84 | ViewUtil.APPEND, true, getPreferencesHint()); |
| 85 | } |
| 86 | |
| 87 | } |