Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassViewFactory.java')
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassViewFactory.java84
1 files changed, 84 insertions, 0 deletions
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassViewFactory.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassViewFactory.java
new file mode 100644
index 00000000000..869f3663687
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/view/factories/ClassViewFactory.java
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassAttributeCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassName2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassNestedClassifierCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassOperationCompartment2EditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ClassQualifiedNameEditPart;
+import org.eclipse.papyrus.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.papyrus.diagram.clazz.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class ClassViewFactory extends AbstractShapeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = UMLVisualIDRegistry.getType(ClassEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!ModelEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", ModelEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ClassNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ClassName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ClassQualifiedNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ClassAttributeCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ClassOperationCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, UMLVisualIDRegistry.getType(ClassNestedClassifierCompartment2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}

Back to the top