Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2013-04-30 12:30:51 +0000
committercletavernie2013-04-30 12:30:51 +0000
commit93e55c3a4b3d23683f8b48d1361d0a9d813d388b (patch)
tree232ce46229e78ab42caaafdd05ca876f1a21d7d9
parentf7380e7301fcd7d2c48b8d013c62214ec82b0ef3 (diff)
downloadorg.eclipse.papyrus-93e55c3a4b3d23683f8b48d1361d0a9d813d388b.tar.gz
org.eclipse.papyrus-93e55c3a4b3d23683f8b48d1361d0a9d813d388b.tar.xz
org.eclipse.papyrus-93e55c3a4b3d23683f8b48d1361d0a9d813d388b.zip
406896: [Properties View - Table] The new Table widget shall be integrated in the properties view as a Property Editor
https://bugs.eclipse.org/bugs/show_bug.cgi?id=406896
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/META-INF/MANIFEST.MF4
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/plugin.xml26
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/resources/property.nattableconfiguration8
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/axis/DerivedUMLPropertiesAxisManager.java63
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/axis/SynchronizedFeatureValueAxisManager.java2
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/cell/DerivedUMLPropertiesCellEditorConfiguration.java87
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/cell/DerivedUMLPropertiesCellManager.java112
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/custom/MultiplicityHandler.java29
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/providers/DerivedUMLPropertiesLabelProvider.java36
9 files changed, 361 insertions, 6 deletions
diff --git a/sandbox/org.eclipse.papyrus.views.properties.table/META-INF/MANIFEST.MF b/sandbox/org.eclipse.papyrus.views.properties.table/META-INF/MANIFEST.MF
index f1ec93dc44e..ce6a76f0a1c 100644
--- a/sandbox/org.eclipse.papyrus.views.properties.table/META-INF/MANIFEST.MF
+++ b/sandbox/org.eclipse.papyrus.views.properties.table/META-INF/MANIFEST.MF
@@ -21,6 +21,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0",
org.eclipse.emf.edit;bundle-version="2.9.0",
- org.eclipse.uml2.uml;bundle-version="4.1.0"
+ org.eclipse.uml2.uml;bundle-version="4.1.0",
+ org.eclipse.papyrus.uml.tools;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
diff --git a/sandbox/org.eclipse.papyrus.views.properties.table/plugin.xml b/sandbox/org.eclipse.papyrus.views.properties.table/plugin.xml
index 487cf89d81a..822c84b3efe 100644
--- a/sandbox/org.eclipse.papyrus.views.properties.table/plugin.xml
+++ b/sandbox/org.eclipse.papyrus.views.properties.table/plugin.xml
@@ -7,6 +7,10 @@
id="org.eclipse.papyrus.emf.nattable.synchronized.featurevalue.axis.manager"
manager="org.eclipse.papyrus.views.properties.table.axis.SynchronizedFeatureValueAxisManager">
</axisManager>
+ <axisManager
+ id="org.eclipse.papyrus.uml.nattable.derived.features.axis.manager"
+ manager="org.eclipse.papyrus.views.properties.table.axis.DerivedUMLPropertiesAxisManager">
+ </axisManager>
</extension>
<extension
point="org.eclipse.papyrus.views.properties.environment">
@@ -14,5 +18,27 @@
environmentModel="resources/Environment.xmi">
</environment>
</extension>
+ <extension
+ point="org.eclipse.papyrus.infra.services.labelprovider.labelProvider">
+ <labelProvider
+ priority="10"
+ provider="org.eclipse.papyrus.views.properties.table.providers.DerivedUMLPropertiesLabelProvider">
+ </labelProvider>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.nattable.celleditor.configuration">
+ <configuration
+ class="org.eclipse.papyrus.views.properties.table.cell.DerivedUMLPropertiesCellEditorConfiguration"
+ order="1">
+ </configuration>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.nattable.cellmanager">
+ <cellManager
+ id="org.eclipse.papyrus.uml.nattable.derived.features.cell.manager"
+ manager="org.eclipse.papyrus.views.properties.table.cell.DerivedUMLPropertiesCellManager"
+ order="1">
+ </cellManager>
+ </extension>
</plugin>
diff --git a/sandbox/org.eclipse.papyrus.views.properties.table/resources/property.nattableconfiguration b/sandbox/org.eclipse.papyrus.views.properties.table/resources/property.nattableconfiguration
index 1b32af8a56b..b97523aadfc 100644
--- a/sandbox/org.eclipse.papyrus.views.properties.table/resources/property.nattableconfiguration
+++ b/sandbox/org.eclipse.papyrus.views.properties.table/resources/property.nattableconfiguration
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
-<nattableconfiguration:TableConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:nattableaxis="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxis" xmlns:nattableaxisconfiguration="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisconfiguration" xmlns:nattableaxisprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider" xmlns:nattableconfiguration="http://www.eclipse.org/papyrus/nattable/model/nattableconfiguration" xmlns:nattablelabelprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattablecontentprovider" xmlns:nattabletester="http://www.eclipse.org/papyrus/nattable/model/table/nattabletester" description="This table references all the owned attributes of the context element" name="OwnedAttributeTable" type="PapyrusOwnedAttributeTable" iconPath="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/icons/uml_generic_table.gif" defaultRowAxisProvider="//@rowAxisProviders.0" defaultColumnAxisProvider="//@columnAxisProviders.0">
+<nattableconfiguration:TableConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:nattableaxis="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxis" xmlns:nattableaxisconfiguration="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisconfiguration" xmlns:nattableaxisprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider" xmlns:nattableconfiguration="http://www.eclipse.org/papyrus/nattable/model/nattableconfiguration" xmlns:nattablelabelprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattablecontentprovider" xmlns:nattabletester="http://www.eclipse.org/papyrus/nattable/model/table/nattabletester" description="This table references all the owned attributes of the context element" name="OwnedAttributeTable" type="PapyrusOwnedAttributeTable" iconPath="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/icons/uml_generic_table.gif" defaultColumnAxisProvider="//@columnAxisProviders.0">
<creationTester xsi:type="nattabletester:JavaTableTester" tester="org.eclipse.papyrus.uml.nattable.tester.isumlelement"/>
<rowHeaderAxisConfiguration xsi:type="nattableaxisconfiguration:TableHeaderAxisConfiguration" indexStyle="NUMERIC" displayIndex="false">
<ownedLabelConfiguration xsi:type="nattablelabelprovider:ObjectLabelProviderConfiguration"/>
<ownedAxisConfiguration xsi:type="nattableaxisconfiguration:EStructuralFeatureValueFillingConfiguration">
<listenFeature xsi:type="ecore:EReference" href="http://www.eclipse.org/uml2/4.0.0/UML#//StructuredClassifier/ownedAttribute"/>
</ownedAxisConfiguration>
- <axisManagers xsi:type="nattableaxisconfiguration:AxisManagerRepresentation" axisManagerId="org.eclipse.papyrus.emf.nattable.synchronized.featurevalue.axis.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.labelprovider" headerLabelConfiguration="//@rowHeaderAxisConfiguration/@ownedLabelConfiguration.0" specificAxisConfiguration="//@rowHeaderAxisConfiguration/@ownedAxisConfiguration.0"/>
+ <axisManagers xsi:type="nattableaxisconfiguration:AxisManagerRepresentation" axisManagerId="org.eclipse.papyrus.emf.nattable.synchronized.featurevalue.axis.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.labelprovider" headerLabelConfiguration="//@rowHeaderAxisConfiguration/@ownedLabelConfiguration.0" specificAxisConfigurations="//@rowHeaderAxisConfiguration/@ownedAxisConfiguration.0"/>
</rowHeaderAxisConfiguration>
<columnHeaderAxisConfiguration xsi:type="nattableaxisconfiguration:TableHeaderAxisConfiguration" displayIndex="false">
<ownedLabelConfiguration xsi:type="nattablelabelprovider:FeatureLabelProviderConfiguration"/>
<axisManagers xsi:type="nattableaxisconfiguration:AxisManagerRepresentation" axisManagerId="org.eclipse.papyrus.uml.nattable.feature.axis.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.feature.labelprovider" headerLabelConfiguration="//@columnHeaderAxisConfiguration/@ownedLabelConfiguration.0"/>
- <axisManagers xsi:type="nattableaxisconfiguration:AxisManagerRepresentation" axisManagerId="org.eclipse.papyrus.uml.nattable.stereotype.property.axis.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.feature.labelprovider" headerLabelConfiguration="//@columnHeaderAxisConfiguration/@ownedLabelConfiguration.0"/>
+ <axisManagers xsi:type="nattableaxisconfiguration:AxisManagerRepresentation" axisManagerId="org.eclipse.papyrus.uml.nattable.derived.features.axis.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.feature.labelprovider" headerLabelConfiguration="//@rowHeaderAxisConfiguration/@ownedLabelConfiguration.0"/>
</columnHeaderAxisConfiguration>
<columnAxisProviders xsi:type="nattableaxisprovider:SlaveObjectAxisProvider" description="This axis provider provides available columns according to the rows of the table (features of the object displayed on the other axis)" name="UML Feature axis provider">
<axis xsi:type="nattableaxis:EStructuralFeatureAxis" manager="//@rowHeaderAxisConfiguration/@axisManagers.0">
@@ -29,6 +29,6 @@
<axis xsi:type="nattableaxis:EStructuralFeatureAxis" manager="//@rowHeaderAxisConfiguration/@axisManagers.0">
<element xsi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/4.0.0/UML#//Property/isDerived"/>
</axis>
+ <axis xsi:type="nattableaxis:FeatureIdAxis" manager="//@columnHeaderAxisConfiguration/@axisManagers.1" element="uml_derived_features:/multiplicity"/>
</columnAxisProviders>
- <rowAxisProviders xsi:type="nattableaxisprovider:MasterObjectAxisProvider" description="This axis provider contains the object dropped by the user into the table" name="DroppedElementAxisProvider"/>
</nattableconfiguration:TableConfiguration>
diff --git a/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/axis/DerivedUMLPropertiesAxisManager.java b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/axis/DerivedUMLPropertiesAxisManager.java
new file mode 100644
index 00000000000..6e801aa0054
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/axis/DerivedUMLPropertiesAxisManager.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.views.properties.table.axis;
+
+import java.util.List;
+
+import org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.FeatureIdAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.views.properties.table.custom.MultiplicityHandler;
+
+/**
+ * An AxisManager for custom/derived UML features (Such as Multiplicity)
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class DerivedUMLPropertiesAxisManager extends AbstractAxisManager {
+
+ public static final String AXIS_MANAGER_ID = "org.eclipse.papyrus.uml.nattable.derived.features.axis.manager"; //$NON-NLS-1$
+
+ public static final String PROPERTIES_PREFIX = "uml_derived_features:/";
+
+ public static final String MULTIPLICITY = PROPERTIES_PREFIX + "multiplicity";
+
+ @Override
+ public synchronized void updateAxisContents() {
+
+ final List<IAxis> axis = getRepresentedContentProvider().getAxis();
+ final List<Object> axisElements = getTableManager().getElementsList(getRepresentedContentProvider());
+ for(int i = 0; i < axis.size(); i++) {
+ IAxis current = axis.get(i);
+ if(current instanceof FeatureIdAxis) {
+ FeatureIdAxis featureIDAxis = (FeatureIdAxis)current;
+ String featureID = featureIDAxis.getElement();
+ if(featureID != null && featureID.startsWith(PROPERTIES_PREFIX)) {
+ if(MULTIPLICITY.equals(featureID)) {
+ Object element = MultiplicityHandler.getInstance();
+ int position = axisElements.indexOf(element);
+ if(position == -1) { //New element
+ axisElements.add(MultiplicityHandler.getInstance());
+ } else if(position != i) { //Change position
+ axisElements.remove(position);
+ axisElements.add(i, element);
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/axis/SynchronizedFeatureValueAxisManager.java b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/axis/SynchronizedFeatureValueAxisManager.java
index b934f486b45..bf373f61d12 100644
--- a/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/axis/SynchronizedFeatureValueAxisManager.java
+++ b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/axis/SynchronizedFeatureValueAxisManager.java
@@ -33,7 +33,7 @@ public class SynchronizedFeatureValueAxisManager extends AbstractSynchronizedOnF
public synchronized void updateAxisContents() {
EStructuralFeatureValueFillingConfiguration config = null;
- for(final IAxisConfiguration current : this.rep.getSpecificAxisConfiguration()) {
+ for(final IAxisConfiguration current : this.rep.getSpecificAxisConfigurations()) {
if(current instanceof EStructuralFeatureValueFillingConfiguration) {
config = (EStructuralFeatureValueFillingConfiguration)current;
break;
diff --git a/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/cell/DerivedUMLPropertiesCellEditorConfiguration.java b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/cell/DerivedUMLPropertiesCellEditorConfiguration.java
new file mode 100644
index 00000000000..35eddb66338
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/cell/DerivedUMLPropertiesCellEditorConfiguration.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.views.properties.table.cell;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.data.validate.DataValidator;
+import org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator;
+import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
+import org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor;
+import org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter;
+import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
+import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
+import org.eclipse.papyrus.infra.nattable.celleditor.config.AbstractCellEditorConfiguration;
+import org.eclipse.papyrus.infra.nattable.celleditor.config.IAxisCellEditorConfiguration;
+import org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.uml.tools.util.MultiplicityParser;
+import org.eclipse.papyrus.views.properties.table.axis.DerivedUMLPropertiesAxisManager;
+import org.eclipse.papyrus.views.properties.table.custom.MultiplicityHandler;
+
+/**
+ * Specific CellEditorConfiguration for UML Multiplicities (And derived UML properties in general)
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class DerivedUMLPropertiesCellEditorConfiguration extends AbstractCellEditorConfiguration implements IAxisCellEditorConfiguration {
+
+ public IDisplayConverter getDisplayConvert(Object axisElement, Table table, ILabelProvider provider) {
+ return null;
+ }
+
+ public ICellPainter getCellPainter(Table table, Object axisElement) {
+ return new TextPainter();
+ }
+
+ public ICellEditor getICellEditor(Table table, Object axisElement, ITableAxisElementProvider elementProvider) {
+ return new TextCellEditor();
+ }
+
+ public String getDisplayMode(Table table, Object axisElement) {
+ return DisplayMode.NORMAL;
+ }
+
+ @Override
+ public IDataValidator getDataValidator(Table table, Object axisElement) {
+ return new DataValidator() {
+
+ @Override
+ public boolean validate(int columnIndex, int rowIndex, Object newValue) {
+
+ if(!(newValue instanceof String)) {
+ return false;
+ }
+
+ String multiplicityValue = (String)newValue;
+ return MultiplicityParser.isValidMultiplicity(multiplicityValue);
+ }
+ };
+ }
+
+ public String getEditorId() {
+ return DerivedUMLPropertiesAxisManager.MULTIPLICITY;
+ }
+
+ public boolean handles(Table table, Object object) {
+ return object == MultiplicityHandler.getInstance();
+ }
+
+ @Override
+ public String getEditorDescription() {
+ return "Specific editor for Multiplicities";
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/cell/DerivedUMLPropertiesCellManager.java b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/cell/DerivedUMLPropertiesCellManager.java
new file mode 100644
index 00000000000..c9193e31930
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/cell/DerivedUMLPropertiesCellManager.java
@@ -0,0 +1,112 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.views.properties.table.cell;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager;
+import org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager;
+import org.eclipse.papyrus.uml.tools.commands.SetMultiplicityCommand;
+import org.eclipse.papyrus.uml.tools.util.MultiplicityParser;
+import org.eclipse.papyrus.views.properties.table.custom.MultiplicityHandler;
+import org.eclipse.uml2.uml.MultiplicityElement;
+
+
+public class DerivedUMLPropertiesCellManager extends AbstractCellManager implements ICellManager {
+
+ public final static String CELL_MANAGER_ID = "org.eclipse.papyrus.uml.nattable.derived.features.cell.manager"; //$NON-NLS-1$
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean handles(Object obj1, Object obj2) {
+ return getMultiplicityElement(obj1, obj2) != null && getMultiplicityHandler(obj1, obj2) != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean handlersAxisElement(Object obj) {
+ return obj == MultiplicityHandler.getInstance();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object getValue(Object axisElement1, Object axisElement2) {
+ MultiplicityElement element = getMultiplicityElement(axisElement1, axisElement2);
+ if(element == null) {
+ return null;
+ }
+
+ return getValue(element);
+ }
+
+ protected Object getValue(MultiplicityElement multiplicityElement) {
+ int lower = multiplicityElement.getLower(), upper = multiplicityElement.getUpper();
+ return MultiplicityParser.getMultiplicity(lower, upper);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isCellEditable(Object obj1, Object obj2) {
+ return getMultiplicityElement(obj1, obj2) != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Command getSetValueCommand(EditingDomain domain, Object obj1, Object obj2, Object newValue) {
+
+ MultiplicityElement element = getMultiplicityElement(obj1, obj2);
+
+ if(element == null) {
+ return null;
+ }
+
+ if(newValue == null || newValue instanceof String) {
+ return getSetValueCommand(element, (String)newValue);
+ }
+
+ return null;
+ }
+
+ protected MultiplicityElement getMultiplicityElement(Object obj1, Object obj2) {
+ if(obj1 instanceof MultiplicityElement) {
+ return (MultiplicityElement)obj1;
+ }
+ if(obj2 instanceof MultiplicityElement) {
+ return (MultiplicityElement)obj2;
+ }
+
+ return null;
+ }
+
+ private MultiplicityHandler getMultiplicityHandler(Object obj1, Object obj2) {
+ if(obj1 == MultiplicityHandler.getInstance()) {
+ return (MultiplicityHandler)obj1;
+ }
+ if(obj2 == MultiplicityHandler.getInstance()) {
+ return (MultiplicityHandler)obj2;
+ }
+
+ return null;
+ }
+
+ protected Command getSetValueCommand(MultiplicityElement element, String newValue) {
+ return new SetMultiplicityCommand(element, newValue);
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/custom/MultiplicityHandler.java b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/custom/MultiplicityHandler.java
new file mode 100644
index 00000000000..e84920bcd73
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/custom/MultiplicityHandler.java
@@ -0,0 +1,29 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.views.properties.table.custom;
+
+
+public class MultiplicityHandler {
+
+ private static final MultiplicityHandler instance = new MultiplicityHandler();
+
+ public static MultiplicityHandler getInstance() {
+ return instance;
+ }
+
+ private MultiplicityHandler() {
+
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/providers/DerivedUMLPropertiesLabelProvider.java b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/providers/DerivedUMLPropertiesLabelProvider.java
new file mode 100644
index 00000000000..cd16a93a9e8
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/providers/DerivedUMLPropertiesLabelProvider.java
@@ -0,0 +1,36 @@
+/*****************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.views.properties.table.providers;
+
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.papyrus.infra.nattable.utils.LabelProviderCellContextElement;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
+import org.eclipse.papyrus.views.properties.table.custom.MultiplicityHandler;
+
+
+public class DerivedUMLPropertiesLabelProvider extends LabelProvider implements IFilteredLabelProvider {
+
+ public boolean accept(Object element) {
+ if(element instanceof LabelProviderCellContextElement) {
+ return ((LabelProviderCellContextElement)element).getObject() == MultiplicityHandler.getInstance();
+ }
+ return false;
+ }
+
+ @Override
+ public String getText(Object element) {
+ return "multiplicity : String [0..1]";
+ }
+
+}

Back to the top