Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2016-05-26 10:49:45 +0000
committerGerrit Code Review @ Eclipse.org2016-05-26 11:40:54 +0000
commite1ce318ec974fbbe26c866cf0607442459b20420 (patch)
tree1d69230fc0f4724a269c9e1b4140d8b96745be4a /plugins/uml
parentc55fe91078921bc5fc44ba84481d3a140d99277b (diff)
downloadorg.eclipse.papyrus-e1ce318ec974fbbe26c866cf0607442459b20420.tar.gz
org.eclipse.papyrus-e1ce318ec974fbbe26c866cf0607442459b20420.tar.xz
org.eclipse.papyrus-e1ce318ec974fbbe26c866cf0607442459b20420.zip
bug 494537 - [Property][Table] Contents of the table is not properly cleaned when the user change the selection in the diagram
Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins/uml')
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/NattablePropertyEditor.java39
1 files changed, 18 insertions, 21 deletions
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/NattablePropertyEditor.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/NattablePropertyEditor.java
index 0a4de44dec3..ea261e38433 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/NattablePropertyEditor.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/NattablePropertyEditor.java
@@ -9,7 +9,7 @@
* Contributors:
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
* Christian W. Damus - bugs 493858, 493853
- *
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - bug 494537
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.widgets;
@@ -627,7 +627,7 @@ public class NattablePropertyEditor extends AbstractPropertyEditor {
* the synchronized feature
* @param rows
* @return
- * the existing table of the new created one
+ * the existing table or the new created one
* @since 2.0
*/
protected Table getOrCreateTable(final EObject sourceElement, final EStructuralFeature synchronizedFeature, final Collection<?> rows) {
@@ -961,13 +961,17 @@ public class NattablePropertyEditor extends AbstractPropertyEditor {
protected void disposeListener() {
if (NattablePropertyEditor.this.serviceRegistry != null) {
// we dispose it to avoid unecessary refresh
- NattablePropertyEditor.this.nattableManager.dispose();
- NattablePropertyEditor.this.natTableWidget.dispose();
-
+ if (null != this.nattableManager) {
+ this.nattableManager.dispose();
+ }
+ if (null != this.natTableWidget) {
+ this.natTableWidget.dispose();
+ }
TransactionalEditingDomain domain = getTableEditingDomain();
- Command cmd = getDisposeCommand(domain, table);
- domain.getCommandStack().execute(cmd);
-
+ if (domain != null && this.table != null) {
+ Command cmd = getDisposeTableCommand(domain, this.table);
+ domain.getCommandStack().execute(cmd);
+ }
if (NattablePropertyEditor.this.resource != null) {
try {
NattablePropertyEditor.this.resource.save(saveOptions);
@@ -996,7 +1000,7 @@ public class NattablePropertyEditor extends AbstractPropertyEditor {
* the command to use to clean the table before disposing it
* @since 2.0
*/
- protected CompoundCommand getDisposeCommand(final TransactionalEditingDomain domain, final Table table) {
+ protected CompoundCommand getDisposeTableCommand(final TransactionalEditingDomain domain, final Table table) {
CompoundCommand disposeCommand = new CompoundCommand("Command used to clean the table before disposing it"); //$NON-NLS-1$
disposeCommand.append(SetCommand.create(domain, table, NattablePackage.eINSTANCE.getTable_Context(), null));
disposeCommand.append(SetCommand.create(domain, table, NattablePackage.eINSTANCE.getTable_Owner(), null));
@@ -1036,19 +1040,12 @@ public class NattablePropertyEditor extends AbstractPropertyEditor {
dataSourceListener = new IDataSourceListener() {
public void dataSourceChanged(final DataSourceChangedEvent event) {
- if (null != nattableManager) {
- nattableManager.dispose();
- nattableManager = null;
- }
- // Dispose the previous nattablewidget if necessary
- if (null != natTableWidget) {
- natTableWidget.dispose();
- natTableWidget = null;
- }
+ // bug 494537 - The diagram selection changed, but the property view has not been disposed
+ disposeListener();
// Bug 492560: The self children control was not all disposed correclty
- if(null != self){
- if(self.getChildren().length > 0){
- for(Control control: self.getChildren()){
+ if (null != self) {
+ if (self.getChildren().length > 0) {
+ for (Control control : self.getChildren()) {
control.dispose();
}
}

Back to the top