Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2013-05-14 08:00:20 -0400
committercletavernie2013-05-14 08:00:20 -0400
commitf4b7794ba13f2d82583b78175f26f669270081c1 (patch)
treeebf2c3c9762bd9965bcf49be9f63bc6dd27d6eb0 /sandbox
parent3222d68a95ad1416c93bbce4c82144ac5101b539 (diff)
downloadorg.eclipse.papyrus-f4b7794ba13f2d82583b78175f26f669270081c1.tar.gz
org.eclipse.papyrus-f4b7794ba13f2d82583b78175f26f669270081c1.tar.xz
org.eclipse.papyrus-f4b7794ba13f2d82583b78175f26f669270081c1.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
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/resources/property.nattableconfiguration14
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/axis/DerivedUMLPropertiesAxisManager.java35
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/axis/SynchronizedFeatureValueAxisManager.java13
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/cell/DerivedUMLPropertiesCellEditorConfiguration.java3
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/cell/DerivedUMLPropertiesCellManager.java16
-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.java18
-rw-r--r--sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/widgets/NattablePropertyEditor.java2
8 files changed, 47 insertions, 83 deletions
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 b97523aadfc..f88b8e8aaf3 100644
--- a/sandbox/org.eclipse.papyrus.views.properties.table/resources/property.nattableconfiguration
+++ b/sandbox/org.eclipse.papyrus.views.properties.table/resources/property.nattableconfiguration
@@ -2,16 +2,16 @@
<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">
+ <ownedLabelConfigurations xsi:type="nattablelabelprovider:ObjectLabelProviderConfiguration"/>
+ <ownedAxisConfigurations 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" specificAxisConfigurations="//@rowHeaderAxisConfiguration/@ownedAxisConfiguration.0"/>
+ </ownedAxisConfigurations>
+ <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/@ownedLabelConfigurations.0" specificAxisConfigurations="//@rowHeaderAxisConfiguration/@ownedAxisConfigurations.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.derived.features.axis.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.feature.labelprovider" headerLabelConfiguration="//@rowHeaderAxisConfiguration/@ownedLabelConfiguration.0"/>
+ <ownedLabelConfigurations 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/@ownedLabelConfigurations.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/@ownedLabelConfigurations.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">
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
index 6e801aa0054..f0d4baf434f 100644
--- 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
@@ -13,12 +13,7 @@
*****************************************************************************/
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)
@@ -34,30 +29,12 @@ public class DerivedUMLPropertiesAxisManager extends AbstractAxisManager {
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);
- }
- }
- }
- }
- }
+ public boolean isSlave() {
+ return false;
+ }
+
+ public boolean isDynamic() {
+ return false;
}
}
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 bf373f61d12..85504120212 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
@@ -13,6 +13,8 @@
*****************************************************************************/
package org.eclipse.papyrus.views.properties.table.axis;
+import java.util.Collection;
+import java.util.LinkedList;
import java.util.List;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -30,10 +32,11 @@ public class SynchronizedFeatureValueAxisManager extends AbstractSynchronizedOnF
public static final String AXIS_MANAGER_ID = "org.eclipse.papyrus.emf.nattable.synchronized.featurevalue.axis.manager"; //$NON-NLS-1$
@Override
- public synchronized void updateAxisContents() {
+ public Collection<Object> getAllManagedAxis() {
+ Collection<Object> result = new LinkedList<Object>();
EStructuralFeatureValueFillingConfiguration config = null;
- for(final IAxisConfiguration current : this.rep.getSpecificAxisConfigurations()) {
+ for(final IAxisConfiguration current : this.representedAxisManager.getSpecificAxisConfigurations()) {
if(current instanceof EStructuralFeatureValueFillingConfiguration) {
config = (EStructuralFeatureValueFillingConfiguration)current;
break;
@@ -42,9 +45,9 @@ public class SynchronizedFeatureValueAxisManager extends AbstractSynchronizedOnF
EStructuralFeature synchronizedFeature = config.getListenFeature();
- List<Object> theList = getTableManager().getElementsList(getRepresentedContentProvider());
- theList.clear();
- theList.addAll((List<?>)this.getTable().getContext().eGet(synchronizedFeature));
+ result.addAll((List<?>)this.getTableManager().getTable().getContext().eGet(synchronizedFeature));
+
+ return result;
}
}
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
index 35eddb66338..f18ac497bdf 100644
--- 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
@@ -28,7 +28,6 @@ import org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvide
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)
@@ -76,7 +75,7 @@ public class DerivedUMLPropertiesCellEditorConfiguration extends AbstractCellEdi
}
public boolean handles(Table table, Object object) {
- return object == MultiplicityHandler.getInstance();
+ return DerivedUMLPropertiesAxisManager.MULTIPLICITY.equals(object);
}
@Override
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
index c9193e31930..6d47f1b700f 100644
--- 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
@@ -19,7 +19,7 @@ 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.papyrus.views.properties.table.axis.DerivedUMLPropertiesAxisManager;
import org.eclipse.uml2.uml.MultiplicityElement;
@@ -37,8 +37,8 @@ public class DerivedUMLPropertiesCellManager extends AbstractCellManager impleme
/**
* {@inheritDoc}
*/
- public boolean handlersAxisElement(Object obj) {
- return obj == MultiplicityHandler.getInstance();
+ public boolean handlesAxisElement(Object obj) {
+ return DerivedUMLPropertiesAxisManager.MULTIPLICITY.equals(obj);
}
/**
@@ -94,12 +94,12 @@ public class DerivedUMLPropertiesCellManager extends AbstractCellManager impleme
return null;
}
- private MultiplicityHandler getMultiplicityHandler(Object obj1, Object obj2) {
- if(obj1 == MultiplicityHandler.getInstance()) {
- return (MultiplicityHandler)obj1;
+ private String getMultiplicityHandler(Object obj1, Object obj2) {
+ if(DerivedUMLPropertiesAxisManager.MULTIPLICITY.equals(obj1)) {
+ return (String)obj1;
}
- if(obj2 == MultiplicityHandler.getInstance()) {
- return (MultiplicityHandler)obj2;
+ if(DerivedUMLPropertiesAxisManager.MULTIPLICITY.equals(obj2)) {
+ return (String)obj2;
}
return null;
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
deleted file mode 100644
index e84920bcd73..00000000000
--- a/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/custom/MultiplicityHandler.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*****************************************************************************
- * 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
index cd16a93a9e8..792759c795a 100644
--- 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
@@ -14,16 +14,23 @@
package org.eclipse.papyrus.views.properties.table.providers;
import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IdAxis;
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;
+import org.eclipse.papyrus.views.properties.table.axis.DerivedUMLPropertiesAxisManager;
+import org.eclipse.swt.graphics.Image;
public class DerivedUMLPropertiesLabelProvider extends LabelProvider implements IFilteredLabelProvider {
public boolean accept(Object element) {
if(element instanceof LabelProviderCellContextElement) {
- return ((LabelProviderCellContextElement)element).getObject() == MultiplicityHandler.getInstance();
+ Object object = ((LabelProviderCellContextElement)element).getObject();
+ if(object instanceof IdAxis) {
+ String id = ((IdAxis)object).getElement();
+ return DerivedUMLPropertiesAxisManager.MULTIPLICITY.equals(id);
+ }
+
}
return false;
}
@@ -33,4 +40,11 @@ public class DerivedUMLPropertiesLabelProvider extends LabelProvider implements
return "multiplicity : String [0..1]";
}
+ @Override
+ public Image getImage(Object element) {
+ org.eclipse.papyrus.infra.widgets.Activator widgetActivator = org.eclipse.papyrus.infra.widgets.Activator.getDefault();
+ String emtNattablePluginID = org.eclipse.papyrus.infra.emf.nattable.Activator.PLUGIN_ID;
+ return widgetActivator.getImage(emtNattablePluginID, "icons/attributes.gif");
+ }
+
}
diff --git a/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/widgets/NattablePropertyEditor.java b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/widgets/NattablePropertyEditor.java
index 353ac387570..160975e9169 100644
--- a/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/widgets/NattablePropertyEditor.java
+++ b/sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse/papyrus/views/properties/table/widgets/NattablePropertyEditor.java
@@ -172,7 +172,7 @@ public class NattablePropertyEditor extends AbstractPropertyEditor {
TableHeaderAxisConfiguration rowHeaderAxisconfig = tableConfiguration.getRowHeaderAxisConfiguration();
- for(IAxisConfiguration axisConfig : rowHeaderAxisconfig.getOwnedAxisConfiguration()) {
+ for(IAxisConfiguration axisConfig : rowHeaderAxisconfig.getOwnedAxisConfigurations()) {
if(axisConfig instanceof EStructuralFeatureValueFillingConfiguration) {
((EStructuralFeatureValueFillingConfiguration)axisConfig).setListenFeature(synchronizedFeature);
}

Back to the top