Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/org.eclipse.papyrus.views.properties.table/src/org/eclipse')
-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
7 files changed, 40 insertions, 76 deletions
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