Bug 481336: [SysML 1.4][PAR] create parameter inside ConstraintBlock
https://bugs.eclipse.org/bugs/show_bug.cgi?id=481336
Change-Id: Id1fd553a088e952eac3c5b09fc377a26061132b1
Signed-off-by: Patrick Tessier <Patrick.Tessier@cea.fr>
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.common/META-INF/MANIFEST.MF b/diagram/org.eclipse.papyrus.sysml14.diagram.common/META-INF/MANIFEST.MF
index b980491..a703397 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.common/META-INF/MANIFEST.MF
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.common/META-INF/MANIFEST.MF
@@ -40,7 +40,9 @@
org.eclipse.papyrus.sysml14.diagram.common.figure,
org.eclipse.papyrus.sysml14.diagram.common.internal.factory;x-internal:=true,
org.eclipse.papyrus.sysml14.diagram.common.internal.factory.util;x-internal:=true,
- org.eclipse.papyrus.sysml14.diagram.common.locator
+ org.eclipse.papyrus.sysml14.diagram.common.locator,
+ org.eclipse.papyrus.sysml14.diagram.common.provider,
+ org.eclipse.papyrus.sysml14.diagram.common.util
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Bundle-Description: %pluginDescription
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.common/resources/SysML14CompositeDiagram-extension.elementtypesconfigurations b/diagram/org.eclipse.papyrus.sysml14.diagram.common/resources/SysML14CompositeDiagram-extension.elementtypesconfigurations
index 631b777..9fe02a7 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.common/resources/SysML14CompositeDiagram-extension.elementtypesconfigurations
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.common/resources/SysML14CompositeDiagram-extension.elementtypesconfigurations
@@ -215,4 +215,30 @@
<specializedTypesID>org.eclipse.papyrus.SysML14.PropertySpecificType</specializedTypesID>
<specializedTypesID>org.eclipse.papyrus.uml.diagram.composite.Class_3085</specializedTypesID>
</elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_nOKtsIMDEeW6xruev4cRfQ"
+ name="ConstraintPropertyComposite"
+ identifier="org.eclipse.papyrus.SysML14.ConstraintPropertyComposite"
+ hint="ConstraintPropertyComposite">
+ <iconEntry
+ xmi:id="_nOKtsYMDEeW6xruev4cRfQ"
+ iconPath="/icons/full/obj16/Property.gif"
+ bundleId="org.eclipse.uml2.uml.edit"/>
+ <specializedTypesID>org.eclipse.papyrus.SysML14.ConstraintProperty</specializedTypesID>
+ <editHelperAdviceConfiguration
+ xmi:id="_nOKtsoMDEeW6xruev4cRfQ"
+ name="org.eclipse.papyrus.sysml14.diagram.common.advices.ConstraintPropertyGraphicalEditHelperAdvice"
+ identifier="org.eclipse.papyrus.sysml14.diagram.common.advices.ConstraintPropertyGraphicalEditHelperAdvice"
+ editHelperAdviceClassName="org.eclipse.papyrus.sysml14.diagram.common.advices.ConstraintPropertyGraphicalEditHelperAdvice"/>
+ </elementTypeConfigurations>
+ <elementTypeConfigurations
+ xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration"
+ xmi:id="_wAxS4IOfEeWhLaOZG6fRyw"
+ name="Parameter_BorderItem"
+ description="Property value hat must displayed in constraint property"
+ identifier="org.eclipse.papyrus.SysML14.Parameter_BorderItem"
+ hint="Parameter_BorderItem">
+ <specializedTypesID>org.eclipse.papyrus.uml.Property</specializedTypesID>
+ </elementTypeConfigurations>
</elementtypesconfigurations:ElementTypeSetConfiguration>
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/provider/AbstractParserProvider.java b/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/provider/AbstractParserProvider.java
new file mode 100644
index 0000000..6d3dc8c
--- /dev/null
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/provider/AbstractParserProvider.java
@@ -0,0 +1,74 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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.sysml14.diagram.common.provider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserProvider;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * Parser provider for labels used by diagrams.
+ */
+public abstract class AbstractParserProvider extends AbstractProvider implements IParserProvider {
+
+ /** map from graphical hint to parsers */
+ protected Map<String, IParser> graphicalHintToParser = new HashMap<String, IParser>();
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean provides(IOperation operation) {
+ if (operation instanceof GetParserOperation) {
+ IAdaptable hint = ((GetParserOperation) operation).getHint();
+
+
+ return getParser(hint) != null;
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IParser getParser(IAdaptable hint) {
+ String parserHint = hint.getAdapter(String.class);
+ if (parserHint != null) {
+ IParser parser = graphicalHintToParser.get(parserHint);
+ if (parser != null) {
+ return parser;
+ }
+ }
+
+ View view = hint.getAdapter(View.class);
+ if (view != null) {
+ IParser parser = graphicalHintToParser.get(view.getType());
+ if (parser != null) {
+ return parser;
+ }
+ }
+
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/util/GraphicalSysMLServiceTypeUtil.java b/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/util/GraphicalSysMLServiceTypeUtil.java
new file mode 100644
index 0000000..1646955
--- /dev/null
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.common/src/org/eclipse/papyrus/sysml14/diagram/common/util/GraphicalSysMLServiceTypeUtil.java
@@ -0,0 +1,29 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * 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.sysml14.diagram.common.util;
+
+/**
+ * List SysML 1.4 graphical element type ids
+ *
+ */
+public final class GraphicalSysMLServiceTypeUtil {
+
+ private GraphicalSysMLServiceTypeUtil() {
+ }
+
+ public static final String ORG_ECLIPSE_PAPYRUS_SYSML14_PARAMETER_BORDER_ITEM = "org.eclipse.papyrus.SysML14.Parameter_BorderItem"; //$NON-NLS-1$
+
+
+
+}
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/META-INF/MANIFEST.MF b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/META-INF/MANIFEST.MF
index eebdfae..4c9ba92 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/META-INF/MANIFEST.MF
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/META-INF/MANIFEST.MF
@@ -9,12 +9,21 @@
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.uml2.uml,
- org.eclipse.gmf.runtime.diagram.core,
- com.google.guava;bundle-version="11.0.0",
+ org.eclipse.gmf.runtime.diagram.core,
+ com.google.guava;bundle-version="11.0.0",
org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.1.0",
org.eclipse.papyrus.infra.emf;bundle-version="1.1.0",
org.eclipse.papyrus.uml.diagram.common;bundle-version="1.1.0",
org.eclipse.papyrus.uml.diagram.composite;bundle-version="1.1.0",
- org.eclipse.papyrus.sysml14.diagram.common;bundle-version="0.8.0"
+ org.eclipse.papyrus.sysml14.diagram.common;bundle-version="0.8.0",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.1.0",
+ org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="1.1.0",
+ org.eclipse.papyrus.sysml14.service.types;bundle-version="0.8.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.papyrus.sysml14.diagram.parametric,
+ org.eclipse.papyrus.sysml14.diagram.parametric.dnd,
+ org.eclipse.papyrus.sysml14.diagram.parametric.edit.part,
+ org.eclipse.papyrus.sysml14.diagram.parametric.internal.factory,
+ org.eclipse.papyrus.sysml14.diagram.parametric.locator,
+ org.eclipse.papyrus.sysml14.diagram.parametric.provider
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/plugin.xml b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/plugin.xml
index 21283cb..886d933 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/plugin.xml
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/plugin.xml
@@ -30,4 +30,24 @@
</stylesheet>
</themeContribution>
</extension>
+ <!-- Expansion -->
+ <extension
+ point="org.eclipse.papyrus.infra.gmfdiag.common.diagramExpansion">
+ <diagramexpansion
+ model="resources/configuration/ParametricDiagramConfig.expansionmodel">
+ </diagramexpansion>
+ </extension>
+ <!-- Parser provider declaration -->
+<extension point="org.eclipse.gmf.runtime.common.ui.services.parserProviders">
+ <ParserProvider class="org.eclipse.papyrus.sysml14.diagram.parametric.provider.ParserProvider">
+ <Priority name="Low"/>
+ </ParserProvider>
+</extension>
+<extension
+ point="org.eclipse.papyrus.infra.gmfdiag.dnd.dropStrategy">
+ <strategy
+ strategy="org.eclipse.papyrus.sysml14.diagram.parametric.dnd.ParameterDropStrategy">
+ </strategy>
+</extension>
+
</plugin>
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/resources/configuration/ParametricDiagramConfig.expansionmodel b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/resources/configuration/ParametricDiagramConfig.expansionmodel
new file mode 100644
index 0000000..6c32f82
--- /dev/null
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/resources/configuration/ParametricDiagramConfig.expansionmodel
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<expansionmodel:DiagramExpansion xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:expansionmodel="http:///expansionmodel.ecore" xmi:id="_BOX98NnkEeSFtu511b-yaw" ID="SysML 1.4 Parametric">
+ <usages xmi:id="_rC19oNnoEeSqwOe5_frWm1" diagramType="SysML 1.4 Parametric" representations="_mUSiYILiEeW6xruev4cRfQ" name="SysML 1.4 Parametric Context">
+ <gmftRepresentations xmi:id="_mUSiYILiEeW6xruev4cRfQ" editPartQualifiedName="org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeEditPart" name="Block based on Class representation of composite diagram" viewFactory="org.eclipse.papyrus.sysml14.diagram.parametric.internal.factory.BlockCompositeViewFactory" inducedRepresentations="_U9-hYILjEeW6xruev4cRfQ" reusedID="2073"/>
+ </usages>
+ <libraries xmi:id="_T4rGMILjEeW6xruev4cRfQ" name="Overload existing compartment of the composite diagram">
+ <representations xsi:type="expansionmodel:InducedRepresentation" xmi:id="_U9-hYILjEeW6xruev4cRfQ" name="Reuse compartment of internal structrure of the Composite class" hint="7073" children="_CKVjwIMFEeW6xruev4cRfQ">
+ <kind href="platform:/plugin/org.eclipse.papyrus.uml.diagram.common/model/UMLRepresentationKind.xmi#_1uXq8N0DEeS-X4lB2Ut-YA"/>
+ </representations>
+ </libraries>
+ <libraries xmi:id="_9nQaIIMEEeW6xruev4cRfQ" name="Sub representations">
+ <representations xsi:type="expansionmodel:Representation" xmi:id="_CKVjwIMFEeW6xruev4cRfQ" editPartQualifiedName="org.eclipse.papyrus.uml.diagram.composite.edit.parts.PropertyPartEditPartCN" name="ConstraintBlockProperty" viewFactory="org.eclipse.papyrus.sysml14.diagram.parametric.internal.factory.ConstraintPropertyViewFactory" graphicalElementType="org.eclipse.papyrus.SysML14.ConstraintPropertyComposite" subRepresentations="_meiusIOfEeWhLaOZG6fRyw"/>
+ <representations xsi:type="expansionmodel:Representation" xmi:id="_meiusIOfEeWhLaOZG6fRyw" editPartQualifiedName="org.eclipse.papyrus.sysml14.diagram.parametric.edit.part.ParameterBorderItermEditPart" name="Border item that represents PropertyValue of Constraint Property" viewFactory="org.eclipse.papyrus.sysml14.diagram.parametric.internal.factory.BorderItemViewFactory" graphicalElementType="org.eclipse.papyrus.SysML14.Parameter_BorderItem" inducedRepresentations="_uamt4IPBEeWhLaOZG6fRyw">
+ <kind href="platform:/plugin/org.eclipse.papyrus.uml.diagram.common/model/UMLRepresentationKind.xmi#_EoAOIN0DEeSiOexlyH3Ifw"/>
+ </representations>
+ </libraries>
+ <libraries xmi:id="_sYz1QIPBEeWhLaOZG6fRyw" name="inducedRepresentation">
+ <representations xsi:type="expansionmodel:InducedRepresentation" xmi:id="_uamt4IPBEeWhLaOZG6fRyw" editPartQualifiedName="org.eclipse.papyrus.sysml14.diagram.parametric.edit.part.ParameterBorderItemNameEditPart" name="a parameterLabel" hint="ParameterLabel">
+ <kind href="platform:/plugin/org.eclipse.papyrus.uml.diagram.common/model/UMLRepresentationKind.xmi#_dG-hoN0HEeSfTfTnKh2G1Q"/>
+ </representations>
+ </libraries>
+</expansionmodel:DiagramExpansion>
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/resources/palette/parametricDiagramPalette.paletteconfiguration b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/resources/palette/parametricDiagramPalette.paletteconfiguration
index faa6013..7874966 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/resources/palette/parametricDiagramPalette.paletteconfiguration
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/resources/palette/parametricDiagramPalette.paletteconfiguration
@@ -143,9 +143,7 @@
pluginID="org.eclipse.uml2.uml.edit"
iconPath="icons/full/obj16/Property.gif"/>
<elementDescriptors
- elementTypeId="org.eclipse.papyrus.SysML14.ConstraintProperty_3070"/>
- <elementDescriptors
- elementTypeId="org.eclipse.papyrus.SysML14.ConstraintProperty_3101"/>
+ elementTypeId="org.eclipse.papyrus.SysML14.ConstraintPropertyComposite"/>
</ownedConfigurations>
<ownedConfigurations
xsi:type="paletteconfiguration:ToolConfiguration"
@@ -295,6 +293,17 @@
</ownedConfigurations>
<ownedConfigurations
xsi:type="paletteconfiguration:ToolConfiguration"
+ id="org.eclipse.papyrus.sysML.par.palette.node.Parameter_BorderItem"
+ label="Parameter"
+ description="Add a parameter inside a ConstraintBlock">
+ <icon
+ pluginID="org.eclipse.uml2.uml.edit"
+ iconPath="icons/full/obj16/Property.gif"/>
+ <elementDescriptors
+ elementTypeId="org.eclipse.papyrus.SysML14.Parameter_BorderItem"/>
+ </ownedConfigurations>
+ <ownedConfigurations
+ xsi:type="paletteconfiguration:ToolConfiguration"
id="org.eclipse.papyrus.sysML.par.palette.node.Part"
label="Part"
description="Create a Part">
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/dnd/ParameterDropStrategy.java b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/dnd/ParameterDropStrategy.java
new file mode 100644
index 0000000..47452fd
--- /dev/null
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/dnd/ParameterDropStrategy.java
@@ -0,0 +1,97 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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.sysml14.diagram.parametric.dnd;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType;
+import org.eclipse.papyrus.infra.gmfdiag.dnd.strategy.ExpansionElementDropStrategy;
+import org.eclipse.papyrus.sysml14.diagram.common.util.GraphicalSysMLServiceTypeUtil;
+import org.eclipse.papyrus.sysml14.service.types.util.SysMLServiceTypeUtil;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Type;
+
+/**
+ * This strategy is a specialization in order to be able to drop Parameter inside Parameter Property
+ * this code is link to the parametric because the parameter as border item is only display in the parametric Diagram
+ */
+public class ParameterDropStrategy extends ExpansionElementDropStrategy {
+
+ @Override
+ public String getCategoryID() {
+ return "org.eclipse.papyrus.sysml14.diagram.parametric";
+ }
+
+ @Override
+ public String getCategoryLabel() {
+ return "Parameter drag and drop";
+ }
+
+ @Override
+ public String getLabel() {
+ return "Parameter drag and drop inside Parameter Property";
+ }
+
+ @Override
+ public String getID() {
+ return "org.eclipse.papyrus.sysml14.diagram.parametric.dnd.ParameterDropStrategy";
+ }
+
+ @Override
+ public String getDescription() {
+ return "This strategy is is a specialization in order to be able to drop a Parameter inside Parameter Property.";
+ }
+
+
+ @Override
+ public Command doGetCommand(Request request, final EditPart targetEditPart) {
+
+ CompositeCommand cc = new CompositeCommand(getLabel());
+ if (targetEditPart instanceof GraphicalEditPart) {
+ IGraphicalEditPart graphicalEditPart = (IGraphicalEditPart) targetEditPart;
+ List<EObject> sourceElements = getSourceEObjects(request);
+ if (sourceElements.size() == 0) {
+ return null;
+ }
+
+ final List<EObject> valuesToAdd = new ArrayList<EObject>(sourceElements.size());
+ final ISpecializationType ParameterPropertyElementType = (ISpecializationType) ElementTypeRegistry.getInstance().getType(SysMLServiceTypeUtil.ORG_ECLIPSE_PAPYRUS_SYSML14_CONSTRAINTPROPERTY);
+ // the target must me a Parameter property
+ Element target = (Element) graphicalEditPart.resolveSemanticElement();
+ if (ParameterPropertyElementType.getMatcher().matches(target)) {
+ if (target instanceof Property && ((Property) target).getType() != null) {
+ Type targetType = ((Property) target).getType();
+
+ for (EObject sourceElement : sourceElements) {
+ if ((sourceElement instanceof Property) && sourceElement.eContainer().equals(targetType)) {
+ addCommandDrop(targetEditPart, cc, valuesToAdd, sourceElement, (ISpecializationType) ElementTypeRegistry.getInstance().getType(GraphicalSysMLServiceTypeUtil.ORG_ECLIPSE_PAPYRUS_SYSML14_PARAMETER_BORDER_ITEM));
+ }
+
+ }
+ }
+ }
+ }
+ return cc.canExecute() ? new ICommandProxy(cc.reduce()) : null;
+ }
+
+}
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/edit/part/ParameterBorderItemNameEditPart.java b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/edit/part/ParameterBorderItemNameEditPart.java
new file mode 100644
index 0000000..66801b8
--- /dev/null
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/edit/part/ParameterBorderItemNameEditPart.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.sysml14.diagram.parametric.edit.part;
+
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
+import org.eclipse.papyrus.uml.diagram.common.editparts.BorderItemNameEditPart;
+
+/**
+ * This class is fix in order to let the xtext parser to change the parser of the editpart.
+ *
+ */
+public class ParameterBorderItemNameEditPart extends BorderItemNameEditPart implements IControlParserForDirectEdit {
+
+ /**
+ * Constructor.
+ *
+ * @param view
+ */
+ public ParameterBorderItemNameEditPart(View view) {
+ super(view);
+ }
+}
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/edit/part/ParameterBorderItermEditPart.java b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/edit/part/ParameterBorderItermEditPart.java
new file mode 100644
index 0000000..681a6c3
--- /dev/null
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/edit/part/ParameterBorderItermEditPart.java
@@ -0,0 +1,46 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.sysml14.diagram.parametric.edit.part;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml14.diagram.parametric.locator.ParameterPositionLocator;
+import org.eclipse.papyrus.uml.diagram.common.editparts.AroundBorderItemEditPart;
+
+
+/**
+ * this a the editpart for Parameter that constraints the path of the border item to be internal.
+ */
+public class ParameterBorderItermEditPart extends AroundBorderItemEditPart {
+
+ /**
+ * Constructor.
+ *
+ * @param view
+ */
+ public ParameterBorderItermEditPart(View view) {
+ super(view);
+ }
+
+
+ @Override
+ public IBorderItemLocator getNewBorderItemLocator(IFigure mainFigure) {
+ return new ParameterPositionLocator(mainFigure, PositionConstants.NONE);
+ }
+
+
+
+}
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/internal/factory/BlockCompositeViewFactory.java b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/internal/factory/BlockCompositeViewFactory.java
new file mode 100644
index 0000000..13d94a4
--- /dev/null
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/internal/factory/BlockCompositeViewFactory.java
@@ -0,0 +1,60 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml14.diagram.parametric.internal.factory;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.sysml14.diagram.common.internal.factory.AbstractBasicViewFactory;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeEditPart;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeFloatingLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ClassCompositeNameEditPart;
+import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry;
+
+/**
+ *
+ * extraction from Composite UML view Provider
+ *
+ */
+public class BlockCompositeViewFactory extends AbstractBasicViewFactory {
+
+ @Override
+ public View createElementView(EObject domainElement, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(UMLVisualIDRegistry.getType(ClassCompositeEditPart.VISUAL_ID));
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // stampShortcut(containerView, node);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Class");
+ createLabel(node, UMLVisualIDRegistry.getType(ClassCompositeNameEditPart.VISUAL_ID));
+ Node floatinglLabel = createLabel(node, UMLVisualIDRegistry.getType(ClassCompositeFloatingLabelEditPart.VISUAL_ID));
+ floatinglLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ Location location6089 = (Location) floatinglLabel.getLayoutConstraint();
+ location6089.setX(0);
+ location6089.setY(5);
+ // createCompartment(node, UMLVisualIDRegistry.getType(ClassCompositeCompartmentEditPart.VISUAL_ID), true, true, false, false);
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Class");
+ return node;
+ }
+
+}
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/internal/factory/BorderItemViewFactory.java b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/internal/factory/BorderItemViewFactory.java
new file mode 100644
index 0000000..a4abc96
--- /dev/null
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/internal/factory/BorderItemViewFactory.java
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.sysml14.diagram.parametric.internal.factory;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml14.diagram.common.internal.factory.AbstractBasicViewFactory;
+
+/**
+ * this specific view factory for parameter element of the constraint block
+ *
+ */
+public class BorderItemViewFactory extends AbstractBasicViewFactory {
+
+ /**
+ * @see org.eclipse.papyrus.sysml14.diagram.common.internal.factory.IBasicViewFactory#createElementView(org.eclipse.emf.ecore.EObject, org.eclipse.gmf.runtime.notation.View, java.lang.String, int, boolean, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint)
+ *
+ * @param domainElement
+ * @param containerView
+ * @param semanticHint
+ * @param index
+ * @param persisted
+ * @param preferencesHint
+ * @return
+ */
+ @Override
+ public View createElementView(EObject domainElement, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(semanticHint);
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ return node;
+ }
+}
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/internal/factory/ConstraintPropertyViewFactory.java b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/internal/factory/ConstraintPropertyViewFactory.java
new file mode 100644
index 0000000..773cae9
--- /dev/null
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/internal/factory/ConstraintPropertyViewFactory.java
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.sysml14.diagram.parametric.internal.factory;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.sysml14.diagram.common.internal.factory.AbstractBasicViewFactory;
+import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PropertyPartCompartmentEditPartCN;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PropertyPartFloatingLabelEditPartCN;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PropertyPartNameEditPartCN;
+import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry;
+
+/**
+ * extraction from Composite View Provider UML view Provider
+ *
+ */
+public class ConstraintPropertyViewFactory extends AbstractBasicViewFactory {
+
+ @Override
+ public View createElementView(EObject domainElement, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Shape node = NotationFactory.eINSTANCE.createShape();
+ node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
+ node.setType(semanticHint);
+ ViewUtil.insertChildView(containerView, node, index, persisted);
+ node.setElement(domainElement);
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "Property");
+ createLabel(node, UMLVisualIDRegistry.getType(PropertyPartNameEditPartCN.VISUAL_ID));
+ Node floatingLabel = createLabel(node, UMLVisualIDRegistry.getType(PropertyPartFloatingLabelEditPartCN.VISUAL_ID));
+ floatingLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
+ Location location6054 = (Location) floatingLabel.getLayoutConstraint();
+ location6054.setX(0);
+ location6054.setY(5);
+ createCompartment(node, UMLVisualIDRegistry.getType(PropertyPartCompartmentEditPartCN.VISUAL_ID), true, true, false, false);
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "Property");
+ return node;
+ }
+
+}
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/locator/ParameterPositionLocator.java b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/locator/ParameterPositionLocator.java
new file mode 100644
index 0000000..d37f6de
--- /dev/null
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/locator/ParameterPositionLocator.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.sysml14.diagram.parametric.locator;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.PortPositionEnum;
+import org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator;
+
+
+/**
+ * This border locator do not take in account CSS, its always internal.
+ * So For this reason SertPortPosition() has been overloaded.
+ *
+ */
+public class ParameterPositionLocator extends PortPositionLocator {
+
+ /**
+ * Constructor.
+ *
+ * @param parentFigure
+ * @param preferredSide
+ */
+ public ParameterPositionLocator(IFigure parentFigure, int preferredSide) {
+ super(parentFigure, preferredSide);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator#setPortPosition(java.lang.String)
+ *
+ * @param position
+ */
+ @Override
+ public void setPortPosition(String position) {
+ // Always internal
+ super.setPortPosition(PortPositionEnum.INSIDE.toString());
+ }
+}
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/provider/ParserProvider.java b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/provider/ParserProvider.java
new file mode 100644
index 0000000..8d24780
--- /dev/null
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.parametric/src/org/eclipse/papyrus/sysml14/diagram/parametric/provider/ParserProvider.java
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * Copyright (c) 2015 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.sysml14.diagram.parametric.provider;
+
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserProvider;
+import org.eclipse.papyrus.sysml14.diagram.common.provider.AbstractParserProvider;
+import org.eclipse.papyrus.uml.diagram.common.parser.PropertyLabelParser;
+
+/**
+ * Parser provider for labels used by the parametric diagram.
+ */
+public class ParserProvider extends AbstractParserProvider implements IParserProvider {
+
+ /**
+ * Constructor.
+ *
+ */
+ public ParserProvider() {
+ graphicalHintToParser.put("ParameterLabel", new PropertyLabelParser());
+ }
+
+}
\ No newline at end of file