Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Gabel2016-07-12 10:18:16 +0000
committervincent lorenzo2016-07-27 12:22:22 +0000
commit7a6013c69d563217cf59525207e4c97e668b92a6 (patch)
tree4cc3c651a82e5f0889eb6c51800991a2fb387619 /plugins/infra/nattable
parentbcf7c9409639094e1d400e3732659785a7c1f768 (diff)
downloadorg.eclipse.papyrus-7a6013c69d563217cf59525207e4c97e668b92a6.tar.gz
org.eclipse.papyrus-7a6013c69d563217cf59525207e4c97e668b92a6.tar.xz
org.eclipse.papyrus-7a6013c69d563217cf59525207e4c97e668b92a6.zip
Bug 497738: [Table] Improvement proposal for dispose() of
NattableModelManager and CompositeAxisManagerForEventList 1) NattableModelManager#dispose() - Test nullity of column and row manager before disposing them - set decoration service to null - check that the table is not already disposed before removing various listeners. 2) CompositeAxisManagerForEventList#dispose() - check nullity of the resource set listener before removing it from the listener list - do not call explicitly removeListener() but let the super.dispose() do the job. - add a call to super.removeListeners() Signed-off-by: Sebastien Gabel <sebastien.gabel@esterel-technologies.com>
Diffstat (limited to 'plugins/infra/nattable')
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManagerForEventList.java7
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java21
2 files changed, 19 insertions, 9 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManagerForEventList.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManagerForEventList.java
index 75239fddc61..5ccf1edb95b 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManagerForEventList.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/CompositeAxisManagerForEventList.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
+ * Copyright (c) 2014, 2016 CEA LIST, Esterel Technologies SAS and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Sebastien Bordes (Esterel Technologies SAS) - Bug 497738
*
*****************************************************************************/
@@ -152,7 +153,6 @@ public class CompositeAxisManagerForEventList extends AbstractAxisManagerForEven
*/
@Override
public void dispose() {
- removeListeners();
for (final IAxisManager current : this.subManagers) {
current.dispose();
}
@@ -168,10 +168,11 @@ public class CompositeAxisManagerForEventList extends AbstractAxisManagerForEven
*/
@Override
protected void removeListeners() {
- if (null != getTableEditingDomain()) {
+ if (null != getTableEditingDomain() && null != resourceSetListener) {
getTableEditingDomain().removeResourceSetListener(this.resourceSetListener);
}
this.resourceSetListener = null;
+ super.removeListeners();
}
/**
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
index 119762afff1..df4f5cdb467 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
@@ -10,7 +10,8 @@
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 476618
- * Nicolas Boulay (Esterel Technologies SAS) - Bug 497467
+ * Nicolas Boulay (Esterel Technologies SAS) - Bug 497467
+ * Sebastien Bordes (Esterel Technologies SAS) - Bug 497738
*
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.manager.table;
@@ -819,6 +820,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
// Bug 490067: Check if the decoration service is available to avoid null pointer
if (null != this.decorationService) {
this.decorationService.deleteListener(this.decoractionServiceObserver);
+ this.decorationService = null;
}
this.decoractionServiceObserver = null;
}
@@ -840,10 +842,17 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
this.contextEditingDomain.removeResourceSetListener(resourceSetListener);
}
}
- this.columnManager.dispose();
- this.columnManager = null;
- this.rowManager.dispose();
- this.rowManager = null;
+
+ if (this.columnManager != null) {
+ this.columnManager.dispose();
+ this.columnManager = null;
+ }
+
+ if (this.rowManager != null) {
+ this.rowManager.dispose();
+ this.rowManager = null;
+ }
+
final Table table = getTable();
if (table != null) {
@@ -861,7 +870,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
if (this.cellsMap != null) {
this.cellsMap.clear();
}
- if (this.natTable != null) {
+ if (this.natTable != null && !this.natTable.isDisposed()) {
if (this.layerListener != null) {
natTable.removeLayerListener(this.layerListener);
}

Back to the top