Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-01-29 16:40:19 +0000
committerCamille Letavernier2014-01-29 16:40:19 +0000
commita4609aa0fd9800739c5111f15e33d6fe034ff8de (patch)
tree0542a81d65f7e42c8a84e6fbbdad1d96a434babb
parenta1b65af5d164849e427c8664cf06d513547f8cd3 (diff)
downloadorg.eclipse.papyrus-a4609aa0fd9800739c5111f15e33d6fe034ff8de.tar.gz
org.eclipse.papyrus-a4609aa0fd9800739c5111f15e33d6fe034ff8de.tar.xz
org.eclipse.papyrus-a4609aa0fd9800739c5111f15e33d6fe034ff8de.zip
417396: [CSS] The CSS Engine shall support label visibility & mask
https://bugs.eclipse.org/bugs/show_bug.cgi?id=417396 - Refactor the NotationTypeMapping extension point, to support diagram-specific mappings (Avoid conflicts)
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSNodeImpl.java149
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/factory/CSSNotationFactory.java7
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java19
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml36
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/notationTypesMapping.exsd28
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/ViewLabelMaskManagerAdapterFactory.java18
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/types/NotationTypesMap.java170
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementChildLabelEditPart.java39
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/MaskManagedLabelEditPolicy.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/AssociationLabelMaskProviderAdapterFactory.java76
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/PropertyLabelMaskProviderAdapterFactory.java11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/plugin.xml154
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementAdapter.java26
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementProvider.java12
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/ElementCustomizationObservableValue.java2
16 files changed, 610 insertions, 148 deletions
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSNodeImpl.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSNodeImpl.java
new file mode 100644
index 00000000000..d51e8906195
--- /dev/null
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSNodeImpl.java
@@ -0,0 +1,149 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gmf.runtime.notation.NamedStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.impl.NodeImpl;
+import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine;
+import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagramImpl;
+import org.eclipse.papyrus.infra.gmfdiag.css.notation.ForceValueHelper;
+import org.eclipse.papyrus.infra.gmfdiag.css.provider.CSSCustomStyleDelegate;
+import org.eclipse.papyrus.infra.gmfdiag.css.provider.CustomStyle;
+import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSView;
+import org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSViewDelegate;
+
+public class CSSNodeImpl extends NodeImpl implements CSSView, CustomStyle {
+
+ protected ExtendedCSSEngine engine;
+
+ private CSSView cssView;
+
+ private CustomStyle customStyle;
+
+ protected ExtendedCSSEngine getEngine() {
+ if(engine == null) {
+ engine = ((CSSDiagramImpl)getDiagram()).getEngine();
+ }
+ return engine;
+ }
+
+ protected CSSView getCSSView() {
+ if(cssView == null) {
+ cssView = new CSSViewDelegate(this, getEngine());
+ }
+ return cssView;
+ }
+
+ protected CustomStyle getCustomStyle() {
+ if(customStyle == null) {
+ customStyle = new CSSCustomStyleDelegate(this, getEngine());
+ }
+ return customStyle;
+ }
+
+ @Override
+ public boolean isVisible() {
+ return isCSSVisible();
+ }
+
+ public boolean isCSSVisible() {
+ boolean value = super.isVisible();
+
+ if(ForceValueHelper.isSet(this, NotationPackage.eINSTANCE.getView_Visible(), value)) {
+ return value;
+ } else {
+ return getCSSView().isCSSVisible();
+ }
+ }
+
+ ////////////////////////////////////////////////
+ // Implements a setter for each CSS property //
+ ////////////////////////////////////////////////
+
+ @Override
+ public void setVisible(boolean value) {
+ super.setVisible(value);
+
+ EStructuralFeature feature = NotationPackage.eINSTANCE.getView_Visible();
+ ForceValueHelper.setValue(this, feature, value);
+ }
+
+ @Override
+ public void setType(java.lang.String value) {
+ super.setType(value);
+
+ EStructuralFeature feature = NotationPackage.eINSTANCE.getView_Type();
+ ForceValueHelper.setValue(this, feature, value);
+ }
+
+ @Override
+ public void setMutable(boolean value) {
+ super.setMutable(value);
+
+ EStructuralFeature feature = NotationPackage.eINSTANCE.getView_Mutable();
+ ForceValueHelper.setValue(this, feature, value);
+ }
+
+ //////////////////////////////////
+ // Implements the unset method //
+ //////////////////////////////////
+
+ @Override
+ public void eUnset(int featureId) {
+ super.eUnset(featureId);
+
+ EStructuralFeature feature = eClass().getEStructuralFeature(featureId);
+ ForceValueHelper.unsetValue(this, feature);
+ }
+
+ //////////////////////////////////
+ // Implements the getNamedStyle //
+ //////////////////////////////////
+
+ @Override
+ public NamedStyle getNamedStyle(EClass eClass, String name) {
+ return getCSSNamedStyle(eClass, name);
+ }
+
+ public NamedStyle getCSSNamedStyle(EClass eClass, String name) {
+ NamedStyle userStyle = super.getNamedStyle(eClass, name);
+ if(userStyle != null) {
+ return userStyle;
+ }
+
+ return getCSSView().getCSSNamedStyle(eClass, name);
+ }
+
+ ///////////////////////////////////
+ // Implements the custom styles //
+ ///////////////////////////////////
+
+ public boolean showElementIcon() {
+ return getCustomStyle().showElementIcon();
+ }
+
+ public int getQualifiedNameDepth() {
+ return getCustomStyle().getQualifiedNameDepth();
+ }
+
+ public boolean showShadow() {
+ return getCustomStyle().showShadow();
+ }
+
+ public int getLabelDisplay() {
+ return getCustomStyle().getLabelDisplay();
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/factory/CSSNotationFactory.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/factory/CSSNotationFactory.java
index 7438fe50d65..01d1c1eaf8a 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/factory/CSSNotationFactory.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/factory/CSSNotationFactory.java
@@ -38,6 +38,7 @@ import org.eclipse.gmf.runtime.notation.LineTypeStyle;
import org.eclipse.gmf.runtime.notation.ListCompartment;
import org.eclipse.gmf.runtime.notation.MultiDiagramLinkStyle;
import org.eclipse.gmf.runtime.notation.NamedStyle;
+import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.PageStyle;
import org.eclipse.gmf.runtime.notation.PropertiesSetStyle;
import org.eclipse.gmf.runtime.notation.RoundedCornersStyle;
@@ -76,6 +77,7 @@ import org.eclipse.papyrus.infra.gmfdiag.css.CSSLineTypeStyleImpl;
import org.eclipse.papyrus.infra.gmfdiag.css.CSSListCompartmentImpl;
import org.eclipse.papyrus.infra.gmfdiag.css.CSSMultiDiagramLinkStyleImpl;
import org.eclipse.papyrus.infra.gmfdiag.css.CSSNamedStyleImpl;
+import org.eclipse.papyrus.infra.gmfdiag.css.CSSNodeImpl;
import org.eclipse.papyrus.infra.gmfdiag.css.CSSPageStyleImpl;
import org.eclipse.papyrus.infra.gmfdiag.css.CSSPropertiesSetStyleImpl;
import org.eclipse.papyrus.infra.gmfdiag.css.CSSRoundedCornersStyleImpl;
@@ -300,4 +302,9 @@ public class CSSNotationFactory extends NotationFactoryImpl {
return new CSSEdgeImpl();
}
+ @Override
+ public Node createNode() {
+ return new CSSNodeImpl();
+ }
+
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java
index 87d7652461a..438c74a2882 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java
@@ -22,7 +22,6 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import org.eclipse.core.databinding.observable.ChangeEvent;
@@ -65,14 +64,6 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
public static final String CSS_VALUES_SEPARATOR = " "; //$NON-NLS-1$
/**
- * The map of Papyrus Diagram ids to human-readable and consistent diagram IDs
- * The later can be used as valid CSS Selectors
- */
- //TODO : Use an extension point for this map, or find another way to map Diagram ID to CSS Element name
- @Deprecated
- public static final Map<String, String> diagramNameMappings = NotationTypesMap.instance.getComputerToHumanTypeMapping();
-
- /**
* The Semantic Model Element associated to the current styled element
* Might also be a GMF Diagram
*/
@@ -225,7 +216,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
private void computePseudoInstances() {
if(CSSDOMSemanticElementHelper.isFloatingLabel(notationElement)) {
- String humanType = NotationTypesMap.instance.getHumanReadableType(notationElement.getType());
+ String humanType = NotationTypesMap.instance.getHumanReadableType(notationElement);
if(humanType == null) {
humanType = notationElement.getType();
}
@@ -345,8 +336,10 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
if(getSemanticElement() instanceof Diagram) {
Diagram diagram = (Diagram)getSemanticElement();
String type = diagram.getType();
- if(diagramNameMappings.containsKey(type)) {
- localName = diagramNameMappings.get(type);
+
+ String humanType = NotationTypesMap.instance.getHumanReadableType(diagram);
+ if(humanType != null) {
+ localName = humanType;
} else {
localName = type;
}
@@ -391,7 +384,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
if("kind".equals(attr)) {
BasicCompartment compartment = (BasicCompartment)notationElement;
- String humanType = NotationTypesMap.instance.getHumanReadableType(compartment.getType());
+ String humanType = NotationTypesMap.instance.getHumanReadableType(compartment);
if(humanType == null) {
return compartment.getType();
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
index 1e90d172164..343f2d1d9a5 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml
@@ -7,14 +7,7 @@
<extension-point id="shapeProvider" name="ShapeProvider" schema="schema/shapeProvider.exsd"/>
<extension-point id="notationTypesMapping" name="notationTypesMapping" schema="schema/notationTypesMapping.exsd"/>
<extension-point id="svgPostProcessors" name="svgPostProcessors" schema="schema/svgPostProcessors.exsd"/>
-
-<extension
- point="org.eclipse.papyrus.infra.core.papyrusDiagram">
- <editorContext
- contextClass="org.eclipse.papyrus.infra.gmfdiag.common.GmfEditorContext"
- id="com.cea.papyrus.gmf.editor.context">
- </editorContext>
- </extension>
+
<extension
point="org.eclipse.ui.handlers">
<handler
@@ -182,7 +175,9 @@
</extension>
<extension
point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
- <mapping
+ <diagramMappings
+ diagramID="PapyrusUMLClassDiagram">
+ <mapping
humanReadableType="Name"
type="6002">
</mapping>
@@ -202,15 +197,18 @@
humanReadableType="Target multiplicity"
type="6034">
</mapping>
-</extension>
-<extension
- point="org.eclipse.core.runtime.adapters">
- <factory
- adaptableType="org.eclipse.gmf.runtime.notation.View"
- class="org.eclipse.papyrus.infra.gmfdiag.common.providers.ViewLabelMaskManagerAdapterFactory">
- <adapter
- type="org.eclipse.papyrus.infra.emf.appearance.style.ILabelMaskProvider">
- </adapter>
- </factory>
+ <mapping
+ humanReadableType="role"
+ type="6035">
+ </mapping>
+ <mapping
+ humanReadableType="multiplicity"
+ type="6024">
+ </mapping>
+ </diagramMappings>
+ <mapping
+ humanReadableType="symbol"
+ type="compartment_shape_display">
+ </mapping>
</extension>
</plugin>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/notationTypesMapping.exsd b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/notationTypesMapping.exsd
index 6c530f64879..6486225b758 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/notationTypesMapping.exsd
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/notationTypesMapping.exsd
@@ -24,7 +24,10 @@ This can be used, e.g., in the following cases:
</annotation>
<complexType>
<sequence minOccurs="1" maxOccurs="unbounded">
- <element ref="mapping" minOccurs="1" maxOccurs="unbounded"/>
+ <choice>
+ <element ref="diagramMappings"/>
+ <element ref="mapping"/>
+ </choice>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
@@ -82,6 +85,29 @@ Class Diagram (Will be converted to ClassDiagram in CSS Stylesheets)
</complexType>
</element>
+ <element name="diagramMappings">
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="mapping"/>
+ </sequence>
+ <attribute name="diagramID" type="string" use="required">
+ <annotation>
+ <documentation>
+ The Diagram ID (Type) to which the mappings apply
+
+Example:
+
+PapyrusUMLClassDiagram
+ 3008 -&gt; Class
+ 2008 -&gt; Class
+PapyrusUMLCompositeDiagram
+ ...
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
<annotation>
<appInfo>
<meta.section type="since"/>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/ViewLabelMaskManagerAdapterFactory.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/ViewLabelMaskManagerAdapterFactory.java
index fc86b958b18..a3b40d16888 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/ViewLabelMaskManagerAdapterFactory.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/providers/ViewLabelMaskManagerAdapterFactory.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -18,23 +18,24 @@ import org.eclipse.papyrus.infra.emf.appearance.style.ILabelMaskProvider;
/**
* An AdapterFactory to retrieve a {@link ILabelMaskProvider} from a GMF {@link View}
- *
+ *
* It delegates the adapter resolution to the view's element (if not null)
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public class ViewLabelMaskManagerAdapterFactory implements IAdapterFactory {
/**
* {@inheritDoc}
*/
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ @Override
+ public ILabelMaskProvider getAdapter(Object adaptableObject, Class adapterType) {
if(adapterType == ILabelMaskProvider.class && adaptableObject instanceof View) {
//Forwards the resolution of the adapter to the view's semantic element
View view = (View)adaptableObject;
if(view.getElement() != null && view.getElement() != view) {
- return Platform.getAdapterManager().getAdapter(view.getElement(), adapterType);
+ return (ILabelMaskProvider)Platform.getAdapterManager().getAdapter(view.getElement(), adapterType);
}
}
@@ -44,8 +45,9 @@ public class ViewLabelMaskManagerAdapterFactory implements IAdapterFactory {
/**
* {@inheritDoc}
*/
- public Class[] getAdapterList() {
+ @Override
+ public Class<?>[] getAdapterList() {
return new Class[]{ ILabelMaskProvider.class };
}
-} \ No newline at end of file
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/types/NotationTypesMap.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/types/NotationTypesMap.java
index bf9fbdab2fd..9997e9f82b1 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/types/NotationTypesMap.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/types/NotationTypesMap.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 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
@@ -16,6 +16,8 @@ import java.util.Map;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
import org.eclipse.papyrus.infra.tools.util.StringHelper;
@@ -32,9 +34,13 @@ public class NotationTypesMap {
public static final String EXTENSION_ID = Activator.ID + ".notationTypesMapping"; //$NON-NLS-1$
- private final Map<String, String> computerToHumanTypeMapping = new HashMap<String, String>();
+ public static final String DIAGRAM_CATEGORY = "diagramMappings"; //$NON-NLS-1$
+
+ public static final String ALL_DIAGRAMS = "Papyrus.AllDiagrams"; //$NON-NLS-1$
+
+ public static final String MAPPING = "mapping";
- private final Map<String, String> humanToComputerTypeMapping = new HashMap<String, String>();
+ private final Map<String, TypeMap> typeMaps = new HashMap<String, TypeMap>(); //DiagramID -> TypeMap
private NotationTypesMap() {
readExtensionPoint();
@@ -42,34 +48,160 @@ public class NotationTypesMap {
private void readExtensionPoint() {
IConfigurationElement[] configurationElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
- for(IConfigurationElement mappingDefinition : configurationElements) {
+ for(IConfigurationElement diagramMappingsDefinition : configurationElements) {
+
+ if(DIAGRAM_CATEGORY.equals(diagramMappingsDefinition.getName())) {
+ String diagramID = diagramMappingsDefinition.getAttribute("diagramID");
+
+ TypeMap typeMap = getOrCreateTypeMap(diagramID);
+
+ for(IConfigurationElement mappingDefinition : diagramMappingsDefinition.getChildren()) {
+
+ final String notationType = mappingDefinition.getAttribute("type");
+ final String humanReadableType = StringHelper.toJavaIdentifier(mappingDefinition.getAttribute("humanReadableType"));
- final String notationType = mappingDefinition.getAttribute("type");
- final String humanReadableType = StringHelper.toJavaIdentifier(mappingDefinition.getAttribute("humanReadableType"));
+ if(notationType == null || humanReadableType == null) {
+ Activator.log.warn(String.format("Plug-in %s contributed an invalid extension for Notation Type Mappings", mappingDefinition.getContributor().getName()));
+ continue;
+ }
- if(notationType == null || humanReadableType == null) {
- Activator.log.warn(String.format("Plug-in %s contributed an invalid extension for Notation Type Mappings", mappingDefinition.getContributor().getName()));
- continue;
+
+ typeMap.getComputerToHumanTypeMapping().put(notationType, humanReadableType);
+ typeMap.getHumanToComputerTypeMapping().put(humanReadableType, notationType);
+ }
+ } else if(MAPPING.equals(diagramMappingsDefinition.getName())) {
+
+ TypeMap typeMap = TypeMap.defaultMap;
+
+ final String notationType = diagramMappingsDefinition.getAttribute("type");
+ final String humanReadableType = StringHelper.toJavaIdentifier(diagramMappingsDefinition.getAttribute("humanReadableType"));
+
+ if(notationType == null || humanReadableType == null) {
+ Activator.log.warn(String.format("Plug-in %s contributed an invalid extension for Notation Type Mappings", diagramMappingsDefinition.getContributor().getName()));
+ continue;
+ }
+
+
+ typeMap.getComputerToHumanTypeMapping().put(notationType, humanReadableType);
+ typeMap.getHumanToComputerTypeMapping().put(humanReadableType, notationType);
}
+ }
+ }
+
+ //Never null.
+ //Used at runtime. Do not fill the map if the diagramID doesn't exist.
+ private TypeMap getTypeMap(String diagramID) {
+ if(typeMaps.containsKey(diagramID)) {
+ return typeMaps.get(diagramID);
+ }
+
+ return TypeMap.defaultMap;
+ }
+
+ private TypeMap getTypeMap(View view) {
+ if(view.getDiagram() == null) {
+ return TypeMap.defaultMap;
+ }
+
+ return getTypeMap(view.getDiagram().getType());
+ }
+
+ //Never null.
+ //Used during parsing of extension point. Fills the map if the diagramID doesn't exist
+ private TypeMap getOrCreateTypeMap(String diagramID) {
+ if(!typeMaps.containsKey(diagramID)) {
+ TypeMap typeMap = new TypeMap();
+ typeMaps.put(diagramID, typeMap);
+ }
+
+ return typeMaps.get(diagramID);
+ }
+
+ //////////////////////
+
+ public String getNotationType(String humanReadableType, String diagramID) {
+ return getTypeMap(diagramID).getNotationType(humanReadableType);
+ }
- computerToHumanTypeMapping.put(notationType, humanReadableType);
- humanToComputerTypeMapping.put(humanReadableType, notationType);
+ public String getHumanReadableType(String notationType, String diagramID) {
+ return getTypeMap(diagramID).getHumanReadableType(notationType);
+ }
+
+ public Map<String, String> getComputerToHumanTypeMapping(String diagramID) {
+ return getTypeMap(diagramID).getComputerToHumanTypeMapping();
+ }
+
+ public Map<String, String> getHumanToComputerTypeMapping(String diagramID) {
+ return getTypeMap(diagramID).getHumanToComputerTypeMapping();
+ }
+
+ //////////////////////
+
+ public String getNotationType(View view) {
+ if(view == null) {
+ return null;
}
+
+ return getTypeMap(view).getNotationType(view.getType());
}
- public String getNotationType(String humanReadableType) {
- return humanToComputerTypeMapping.get(humanReadableType);
+ public String getHumanReadableType(View view) {
+ if(view == null) {
+ return null;
+ }
+
+ return getTypeMap(view).getHumanReadableType(view.getType());
}
- public String getHumanReadableType(String notationType) {
- return computerToHumanTypeMapping.get(notationType);
+
+ public Map<String, String> getComputerToHumanTypeMapping(Diagram diagram) {
+ if(diagram == null) {
+ return TypeMap.defaultMap.getComputerToHumanTypeMapping();
+ }
+
+ return getComputerToHumanTypeMapping(diagram.getType());
}
- public Map<String, String> getComputerToHumanTypeMapping() {
- return computerToHumanTypeMapping;
+ public Map<String, String> getHumanToComputerTypeMapping(Diagram diagram) {
+ if(diagram == null) {
+ return TypeMap.defaultMap.getHumanToComputerTypeMapping();
+ }
+
+ return getHumanToComputerTypeMapping(diagram.getType());
}
- public Map<String, String> getHumanToComputerTypeMapping() {
- return humanToComputerTypeMapping;
+ //////////////////////
+
+ private static class TypeMap {
+
+ public static final TypeMap defaultMap = new TypeMap();
+
+ private final Map<String, String> computerToHumanTypeMapping = new HashMap<String, String>(); //GMF Type -> Human-readable Type
+
+ private final Map<String, String> humanToComputerTypeMapping = new HashMap<String, String>(); //Human-readable Type -> GMF Type
+
+ public String getNotationType(String humanReadableType) {
+ if(humanToComputerTypeMapping.containsKey(humanReadableType) || defaultMap == this) {
+ return humanToComputerTypeMapping.get(humanReadableType);
+ }
+
+ return defaultMap.getNotationType(humanReadableType);
+ }
+
+ public String getHumanReadableType(String notationType) {
+ if(computerToHumanTypeMapping.containsKey(notationType) || defaultMap == this) {
+ return computerToHumanTypeMapping.get(notationType);
+ }
+
+ return defaultMap.getHumanReadableType(notationType);
+ }
+
+ public Map<String, String> getComputerToHumanTypeMapping() {
+ return computerToHumanTypeMapping;
+ }
+
+ public Map<String, String> getHumanToComputerTypeMapping() {
+ return humanToComputerTypeMapping;
+ }
}
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementChildLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementChildLabelEditPart.java
index ffa1143c800..16332dd183f 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementChildLabelEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementChildLabelEditPart.java
@@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
* Arthur Daussy - arthur.daussy@atos.net - 395920: [Block Diagram Definition] All element contained by a block should be able to be linked to constraint or comment
*
@@ -300,11 +300,12 @@ public class AbstractElementChildLabelEditPart extends GraphicalEditPart impleme
}
public ParserOptions getParserOptions() {
-
if(getNotationView() == null || getNotationView().getDiagram() == null) {
return ParserOptions.NONE;
}
+ // int displayOptions = AppearanceHelper.getLabelDisplay(getNotationView());
+
EAnnotation display = getNotationView().getEAnnotation(VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION);
if(display == null) {
return getDefaultParserOptions();
@@ -695,9 +696,10 @@ public class AbstractElementChildLabelEditPart extends GraphicalEditPart impleme
/*
* (non-Javadoc)
* Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getModelSourceConnections()
- *
+ *
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getModelSourceConnections()
*/
+ @Override
protected List getModelSourceConnections() {
return ViewUtil.getSourceConnectionsConnectingVisibleViews((View)getModel());
}
@@ -705,9 +707,10 @@ public class AbstractElementChildLabelEditPart extends GraphicalEditPart impleme
/*
* (non-Javadoc)
* Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getModelTargetConnections()
- *
+ *
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getModelTargetConnections()
*/
+ @Override
protected List getModelTargetConnections() {
return ViewUtil.getTargetConnectionsConnectingVisibleViews((View)getModel());
}
@@ -716,7 +719,7 @@ public class AbstractElementChildLabelEditPart extends GraphicalEditPart impleme
/*
* (non-Javadoc)
* Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getSourceConnectionAnchor()
- *
+ *
* @see org.eclipse.gef.NodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart)
*/
public ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart connEditPart) {
@@ -727,10 +730,11 @@ public class AbstractElementChildLabelEditPart extends GraphicalEditPart impleme
public void run() {
Anchor a = ((Edge)connection.getModel()).getSourceAnchor();
- if(a instanceof IdentityAnchor)
+ if(a instanceof IdentityAnchor) {
setResult(((IdentityAnchor)a).getId());
- else
+ } else {
setResult(""); //$NON-NLS-1$
+ }
}
});
} catch (InterruptedException e) {
@@ -743,7 +747,7 @@ public class AbstractElementChildLabelEditPart extends GraphicalEditPart impleme
/*
* (non-Javadoc)
* Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getAnchorableFigure()
- *
+ *
* @see org.eclipse.gef.NodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.Request)
*/
protected IAnchorableFigure getAnchorableFigure() {
@@ -751,14 +755,14 @@ public class AbstractElementChildLabelEditPart extends GraphicalEditPart impleme
if(myFigure instanceof IAnchorableFigure) {
return (IAnchorableFigure)myFigure;
}
- throw new RuntimeException("The figure of this element should be an IAnchorable Figure");////$NON-NLS-0$
+ throw new RuntimeException("The figure of this element should be an IAnchorable Figure");//
}
/*
* (non-Javadoc)
* Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getSourceConnectionAnchor()
- *
+ *
* @see org.eclipse.gef.NodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.Request)
*/
public ConnectionAnchor getSourceConnectionAnchor(Request request) {
@@ -778,7 +782,7 @@ public class AbstractElementChildLabelEditPart extends GraphicalEditPart impleme
/*
* (non-Javadoc)
* Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getTargetConnectionAnchor()
- *
+ *
* @see org.eclipse.gef.NodeEditPart#getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart)
*/
public ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart connEditPart) {
@@ -790,10 +794,11 @@ public class AbstractElementChildLabelEditPart extends GraphicalEditPart impleme
public void run() {
Anchor a = ((Edge)connection.getModel()).getTargetAnchor();
- if(a instanceof IdentityAnchor)
+ if(a instanceof IdentityAnchor) {
setResult(((IdentityAnchor)a).getId());
- else
+ } else {
setResult(""); //$NON-NLS-1$
+ }
}
});
} catch (InterruptedException e) {
@@ -810,7 +815,7 @@ public class AbstractElementChildLabelEditPart extends GraphicalEditPart impleme
/*
* (non-Javadoc)
* Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getTargetConnectionAnchor()
- *
+ *
* @see org.eclipse.gef.NodeEditPart#getTargetConnectionAnchor(org.eclipse.gef.Request)
*/
public ConnectionAnchor getTargetConnectionAnchor(Request request) {
@@ -830,7 +835,7 @@ public class AbstractElementChildLabelEditPart extends GraphicalEditPart impleme
/*
* (non-Javadoc)
* Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#mapConnectionAnchorToTerminal()
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.editparts.INodeEditPart#mapConnectionAnchorToTerminal(org.eclipse.draw2d.ConnectionAnchor)
*/
final public String mapConnectionAnchorToTerminal(ConnectionAnchor c) {
@@ -840,7 +845,7 @@ public class AbstractElementChildLabelEditPart extends GraphicalEditPart impleme
/*
* (non-Javadoc)
* Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#mapTerminalToConnectionAnchor()
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.editparts.INodeEditPart#mapTerminalToConnectionAnchor(java.lang.String)
*/
final public ConnectionAnchor mapTerminalToConnectionAnchor(String terminal) {
@@ -850,7 +855,7 @@ public class AbstractElementChildLabelEditPart extends GraphicalEditPart impleme
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.editparts.INotableEditPart#canAttachNote()
* Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#canAttachNote()
*/
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/MaskManagedLabelEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/MaskManagedLabelEditPolicy.java
index 016d9c0ced1..be27e485713 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/MaskManagedLabelEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/MaskManagedLabelEditPolicy.java
@@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
@@ -117,7 +117,7 @@ public class MaskManagedLabelEditPolicy extends GraphicalEditPolicy implements I
/**
* Get the host label edit part (has to implement {@link ITextAwareEditPart}).
- *
+ *
* @return the host label edit part.
*/
private ITextAwareEditPart getHostLabelEditPart() {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/AssociationLabelMaskProviderAdapterFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/AssociationLabelMaskProviderAdapterFactory.java
new file mode 100644
index 00000000000..9491a8311d5
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/AssociationLabelMaskProviderAdapterFactory.java
@@ -0,0 +1,76 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.clazz.custom.providers;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.emf.appearance.style.ILabelMaskProvider;
+import org.eclipse.papyrus.uml.diagram.clazz.custom.helper.AssociationEndSourceLabelHelper;
+import org.eclipse.papyrus.uml.diagram.clazz.custom.helper.AssociationEndTargetLabelHelper;
+import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelEditPart;
+import org.eclipse.uml2.uml.Association;
+
+/**
+ * An IAdapterFactory for retrieving the {@link ILabelMaskProvider} from a UML
+ * Property
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class AssociationLabelMaskProviderAdapterFactory implements IAdapterFactory {
+
+ @Override
+ public ILabelMaskProvider getAdapter(Object adaptableObject, Class adapterType) {
+ if(adapterType == ILabelMaskProvider.class && adaptableObject instanceof View) {
+ View view = (View)adaptableObject;
+ if(view.getDiagram() == null || !ModelEditPart.MODEL_ID.equals(view.getDiagram().getType())) {
+ return null;
+ }
+
+ if(view.getElement() instanceof Association) {
+ String type = view.getType();
+
+ if("6003".equals(type)) {
+ return AssociationEndSourceLabelHelper.getInstance();
+ }
+
+ if("6005".equals(type)) {
+ return AssociationEndTargetLabelHelper.getInstance();
+ }
+
+ if("6033".equals(type)) {
+ return AssociationEndSourceLabelHelper.getInstance();
+ }
+
+ if("6034".equals(type)) {
+ return AssociationEndTargetLabelHelper.getInstance();
+ }
+
+ if("6024".equals(type)) {
+ return AssociationEndTargetLabelHelper.getInstance();
+ }
+
+ if("6035".equals(type)) {
+ return AssociationEndTargetLabelHelper.getInstance();
+ }
+
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Class<?>[] getAdapterList() {
+ return new Class[]{ ILabelMaskProvider.class };
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml
index 1054d8e34bb..a01ece06557 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml
@@ -3051,6 +3051,13 @@
type="org.eclipse.papyrus.infra.emf.appearance.style.ILabelMaskProvider">
</adapter>
</factory>
+ <factory
+ adaptableType="org.eclipse.gmf.runtime.notation.View"
+ class="org.eclipse.papyrus.uml.diagram.clazz.custom.providers.AssociationLabelMaskProviderAdapterFactory">
+ <adapter
+ type="org.eclipse.papyrus.infra.emf.appearance.style.ILabelMaskProvider">
+ </adapter>
+ </factory>
</extension>
</plugin>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/PropertyLabelMaskProviderAdapterFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/PropertyLabelMaskProviderAdapterFactory.java
index 9bfe3b3c6c9..b4e06bbf45f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/PropertyLabelMaskProviderAdapterFactory.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/PropertyLabelMaskProviderAdapterFactory.java
@@ -32,6 +32,17 @@ public class PropertyLabelMaskProviderAdapterFactory implements IAdapterFactory
if(adaptableObject instanceof Port) {
return PortLabelHelper.getInstance();
} else if(adaptableObject instanceof Property) {
+ Property property = (Property)adaptableObject;
+ if(property.getAssociation() != null) {
+ // Association association = property.getAssociation();
+ // int index = association.getMemberEnds().indexOf(property);
+ // if (index == 0){
+ // return AssociationEndSourceLabelHelper.getInstance();
+ // } else {
+ // return AssociationEndTargetLabelHelper.getInstance();
+ // }
+ }
+
return PropertyLabelHelper.getInstance();
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/plugin.xml
index a77c7b2d29c..6f317d68655 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/plugin.xml
@@ -9,63 +9,11 @@
</factory>
</extension>
<extension
- point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
- <mapping
- humanReadableType="Composite Diagram"
- type="CompositeStructure">
- </mapping>
- <mapping
- humanReadableType="Package Diagram"
- type="Package">
- </mapping>
- <mapping
- humanReadableType="Activity Diagram"
- type="PapyrusUMLActivityDiagram">
- </mapping>
- <mapping
- humanReadableType="Class Diagram"
- type="PapyrusUMLClassDiagram">
- </mapping>
- <mapping
- humanReadableType="Communication Diagram"
- type="PapyrusUMLCommunicationDiagram">
- </mapping>
- <mapping
- humanReadableType="Component Diagram"
- type="PapyrusUMLComponentDiagram">
- </mapping>
- <mapping
- humanReadableType="Deployment Diagram"
- type="PapyrusUMLDeploymentDiagram">
- </mapping>
- <mapping
- humanReadableType="Profile Diagram"
- type="PapyrusUMLProfileDiagram">
- </mapping>
- <mapping
- humanReadableType="Sequence Diagram"
- type="PapyrusUMLSequenceDiagram">
- </mapping>
- <mapping
- humanReadableType="State Machine Diagram"
- type="PapyrusUMLStateMachineDiagram">
- </mapping>
- <mapping
- humanReadableType="Use Case Diagram"
- type="UseCase">
- </mapping>
- <mapping
- humanReadableType="Timing Diagram"
- type="PapyrusUMLTimingDiagram">
- </mapping>
- <mapping
- humanReadableType="Interaction Overview Diagram"
- type="PapyrusUMLInteractionOverviewDiagram">
- </mapping>
- </extension>
- <extension
point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
- <mapping
+
+ <diagramMappings
+ diagramID="PapyrusUMLClassDiagram">
+ <mapping
humanReadableType="attribute"
type="7017">
</mapping>
@@ -77,5 +25,99 @@
humanReadableType="nestedClassifier"
type="7019">
</mapping>
+ <mapping
+ humanReadableType="Class Diagram"
+ type="PapyrusUMLClassDiagram">
+ </mapping>
+ </diagramMappings>
+ <diagramMappings
+ diagramID="CompositeStructure">
+ <mapping
+ humanReadableType="Composite Diagram"
+ type="CompositeStructure">
+ </mapping>
+ <mapping
+ humanReadableType="structure"
+ type="7077">
+ </mapping>
+ </diagramMappings>
+ <diagramMappings
+ diagramID="Package">
+ <mapping
+ humanReadableType="Package Diagram"
+ type="Package">
+ </mapping>
+
+ </diagramMappings>
+ <diagramMappings
+ diagramID="PapyrusUMLActivityDiagram">
+ <mapping
+ humanReadableType="Activity Diagram"
+ type="PapyrusUMLActivityDiagram">
+ </mapping>
+ </diagramMappings>
+ <diagramMappings
+ diagramID="PapyrusUMLCommunicationDiagram">
+ <mapping
+ humanReadableType="Communication Diagram"
+ type="PapyrusUMLCommunicationDiagram">
+ </mapping>
+ </diagramMappings>
+ <diagramMappings
+ diagramID="PapyrusUMLComponentDiagram">
+ <mapping
+ humanReadableType="Component Diagram"
+ type="PapyrusUMLComponentDiagram">
+ </mapping>
+ </diagramMappings>
+ <diagramMappings
+ diagramID="PapyrusUMLDeploymentDiagram">
+ <mapping
+ humanReadableType="Deployment Diagram"
+ type="PapyrusUMLDeploymentDiagram">
+ </mapping>
+ </diagramMappings>
+ <diagramMappings
+ diagramID="PapyrusUMLProfileDiagram">
+ <mapping
+ humanReadableType="Profile Diagram"
+ type="PapyrusUMLProfileDiagram">
+ </mapping>
+ </diagramMappings>
+ <diagramMappings
+ diagramID="PapyrusUMLSequenceDiagram">
+ <mapping
+ humanReadableType="Sequence Diagram"
+ type="PapyrusUMLSequenceDiagram">
+ </mapping>
+ </diagramMappings>
+ <diagramMappings
+ diagramID="PapyrusUMLStateMachineDiagram">
+ <mapping
+ humanReadableType="State Machine Diagram"
+ type="PapyrusUMLStateMachineDiagram">
+ </mapping>
+ </diagramMappings>
+ <diagramMappings
+ diagramID="UseCase">
+ <mapping
+ humanReadableType="Use Case Diagram"
+ type="UseCase">
+ </mapping>
+ </diagramMappings>
+ <diagramMappings
+ diagramID="PapyrusUMLTimingDiagram">
+ <mapping
+ humanReadableType="Timing Diagram"
+ type="PapyrusUMLTimingDiagram">
+ </mapping>
+ </diagramMappings>
+ <diagramMappings
+ diagramID="PapyrusUMLInteractionOverviewDiagram">
+ <mapping
+ humanReadableType="Interaction Overview Diagram"
+ type="PapyrusUMLInteractionOverviewDiagram">
+ </mapping>
+ </diagramMappings>
</extension>
</plugin>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementAdapter.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementAdapter.java
index acad2ea2c28..d8246cf2fae 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementAdapter.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementAdapter.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 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
@@ -18,16 +18,13 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.types.NotationTypesMap;
import org.eclipse.papyrus.infra.gmfdiag.css.dom.GMFElementAdapter;
import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine;
import org.eclipse.papyrus.infra.tools.util.ListHelper;
-import org.eclipse.uml2.common.util.UML2Util;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Stereotype;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.util.UMLUtil;
/**
* DOM Element Adapter for UML Elements
@@ -51,10 +48,19 @@ public class GMFUMLElementAdapter extends GMFElementAdapter {
static {
//SysML
- diagramNameMappings.put("BlockDefinition", "BlockDiagram");
- diagramNameMappings.put("InternalBlock", "InternalBlockDiagram");
- diagramNameMappings.put("PapyrusSysMLRequirement", "RequirementDiagram");
- diagramNameMappings.put("Parametric", "ParametricDiagram");
+ mapDiagram("BlockDefinition", "BlockDiagram");
+ mapDiagram("InternalBlock", "InternalBlockDiagram");
+ mapDiagram("PapyrusSysMLRequirement", "RequirementDiagram");
+ mapDiagram("Parametric", "ParametricDiagram");
+ }
+
+ /**
+ * @Deprecated Use the notationTypesMapping extension point
+ * FIXME Use the notationTypesMapping extension point
+ */
+ @Deprecated
+ private static void mapDiagram(String diagramID, String cssID) {
+ NotationTypesMap.instance.getComputerToHumanTypeMapping(diagramID).put(diagramID, cssID);
}
public GMFUMLElementAdapter(View view, ExtendedCSSEngine engine) {
@@ -83,7 +89,7 @@ public class GMFUMLElementAdapter extends GMFElementAdapter {
appliedStereotypes.add(stereotype.getName());
appliedStereotypes.add(stereotype.getQualifiedName());
}
-
+
if(!appliedStereotypes.isEmpty()) {
return ListHelper.deepToString(appliedStereotypes, CSS_VALUES_SEPARATOR);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementProvider.java
index 39d81f0bdeb..ea985c2e843 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.css/src/org/eclipse/papyrus/uml/diagram/css/dom/GMFUMLElementProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 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
@@ -17,9 +17,17 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine;
import org.w3c.dom.Element;
-
+/**
+ * An IElementProvider for UML-specific CSS concepts
+ *
+ * Provides a specialization of GMFElementAdapter for UML Elements
+ *
+ * @author Camille Letavernier
+ */
+@SuppressWarnings("restriction") //e4 CSS
public class GMFUMLElementProvider implements IElementProvider {
+ @Override
public Element getElement(Object element, CSSEngine engine) {
if(!(element instanceof View)) {
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/ElementCustomizationObservableValue.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/ElementCustomizationObservableValue.java
index 31007078358..3526631230b 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/ElementCustomizationObservableValue.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/ElementCustomizationObservableValue.java
@@ -90,7 +90,7 @@ public class ElementCustomizationObservableValue extends AbstractUMLAggregatedOb
protected Object doGetValue() {
switch(property) {
case LABEL_CUSTOMIZATION:
- return AppearanceHelper.getLabelDisplay(notationElement);
+ return getEditPolicy().getCurrentDisplayValue();
case ELEMENT_ICON:
return AppearanceHelper.showElementIcon(notationElement);
case SHADOW:

Back to the top