aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Ladenberger2012-03-28 07:58:21 (EDT)
committerMichael Jastram2012-04-05 06:44:46 (EDT)
commit3a3dcb0f885a097fc8075ddab618e6f780e38ee7 (patch)
treecbe39457ff69e6462871f76424bff40542b9e2c9
parent91f42e7b9cd502e4027cc3b187fa944fa711e049 (diff)
downloadorg.eclipse.rmf-3a3dcb0f885a097fc8075ddab618e6f780e38ee7.zip
org.eclipse.rmf-3a3dcb0f885a097fc8075ddab618e6f780e38ee7.tar.gz
org.eclipse.rmf-3a3dcb0f885a097fc8075ddab618e6f780e38ee7.tar.bz2
column width is now refreshed after configured in column configuration
wizard + added test
-rw-r--r--org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/configuration/provider/ColumnItemProvider.java9
-rw-r--r--org.eclipse.rmf.pror.reqif10.tests/tests/org/eclipse/rmf/reqif10/configuration/tests/ProrSpecViewConfigurationTest.java15
2 files changed, 17 insertions, 7 deletions
diff --git a/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/configuration/provider/ColumnItemProvider.java b/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/configuration/provider/ColumnItemProvider.java
index e24ec71..6d2d877 100644
--- a/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/configuration/provider/ColumnItemProvider.java
+++ b/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/configuration/provider/ColumnItemProvider.java
@@ -30,7 +30,6 @@ import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.rmf.pror.reqif10.configuration.Column;
import org.eclipse.rmf.pror.reqif10.configuration.ConfigPackage;
import org.eclipse.rmf.pror.reqif10.configuration.ProrSpecViewConfiguration;
@@ -162,8 +161,9 @@ public class ColumnItemProvider
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
- switch (notification.getFeatureID(Column.class)) {
- case ConfigPackage.COLUMN__LABEL:
+ int featureID = notification.getFeatureID(Column.class);
+ if (featureID == ConfigPackage.COLUMN__LABEL
+ || featureID == ConfigPackage.COLUMN__WIDTH) {
// inform the parent
InternalEObject parent = (InternalEObject) ((EObject) notification
.getNotifier()).eContainer();
@@ -174,9 +174,6 @@ public class ColumnItemProvider
ConfigPackage.Literals.PROR_SPEC_VIEW_CONFIGURATION__COLUMNS,
notification.getNotifier(), notification.getNotifier()));
}
- case ConfigPackage.COLUMN__WIDTH:
- fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
- return;
}
super.notifyChanged(notification);
}
diff --git a/org.eclipse.rmf.pror.reqif10.tests/tests/org/eclipse/rmf/reqif10/configuration/tests/ProrSpecViewConfigurationTest.java b/org.eclipse.rmf.pror.reqif10.tests/tests/org/eclipse/rmf/reqif10/configuration/tests/ProrSpecViewConfigurationTest.java
index b4b933b..deaa1a0 100644
--- a/org.eclipse.rmf.pror.reqif10.tests/tests/org/eclipse/rmf/reqif10/configuration/tests/ProrSpecViewConfigurationTest.java
+++ b/org.eclipse.rmf.pror.reqif10.tests/tests/org/eclipse/rmf/reqif10/configuration/tests/ProrSpecViewConfigurationTest.java
@@ -11,7 +11,7 @@
package org.eclipse.rmf.reqif10.configuration.tests;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
import org.eclipse.rmf.pror.reqif10.configuration.Column;
import org.eclipse.rmf.pror.reqif10.configuration.ConfigFactory;
@@ -70,6 +70,19 @@ public class ProrSpecViewConfigurationTest extends AbstractItemProviderTest {
getItemProvider(getFixture()).addListener(listener);
setViaCommand(column, ConfigPackage.Literals.COLUMN__LABEL, "Bar");
assertEquals(1, notifications.size());
+ assertEquals("Bar", column.getLabel());
+ }
+
+ @Test
+ public void testResizeColumn() {
+ Column column = ConfigFactory.eINSTANCE.createColumn();
+ column.setLabel("Foo");
+ column.setWidth(50);
+ getFixture().getColumns().add(column);
+ getItemProvider(getFixture()).addListener(listener);
+ setViaCommand(column, ConfigPackage.Literals.COLUMN__WIDTH, 100);
+ assertEquals(1, notifications.size());
+ assertEquals(100, column.getWidth());
}
} //ProrSpecViewConfigurationTest