summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Kriese2011-04-06 09:19:49 (EDT)
committerSteffen Kriese2011-04-06 09:19:49 (EDT)
commit9a566cc6c8278f731c2181b4885a0d04e788f878 (patch)
tree41db6253d363f0cc62eb738be9b920a0e8cf4929
parent0d06baeffaf8d30c0cff4327cef420c10008614f (diff)
downloadorg.eclipse.riena-9a566cc6c8278f731c2181b4885a0d04e788f878.zip
org.eclipse.riena-9a566cc6c8278f731c2181b4885a0d04e788f878.tar.gz
org.eclipse.riena-9a566cc6c8278f731c2181b4885a0d04e788f878.tar.bz2
when a ModuleNode gets disposed, the SubModule/module listener have to be unregistered
-rw-r--r--org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/views/ModuleView.java20
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java38
2 files changed, 36 insertions, 22 deletions
diff --git a/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/views/ModuleView.java b/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/views/ModuleView.java
index 276d2c2..691ce65 100644
--- a/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/views/ModuleView.java
+++ b/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/views/ModuleView.java
@@ -91,6 +91,8 @@ public class ModuleView implements INavigationNodeView<ModuleNode> {
private ModuleGroupNode moduleGroupNode;
private Map<ISubModuleNode, Set<IMarker>> subModuleMarkerCache;
private Listener disabledSubModuleTreeBgPainter;
+ private SubModuleListener subModuleListener;
+ private ModuleListener moduleListener;
public ModuleView(final Composite parent) {
this.parent = parent;
@@ -120,12 +122,12 @@ public class ModuleView implements INavigationNodeView<ModuleNode> {
}
public void bind(final ModuleNode node) {
-
moduleNode = node;
-
navigationTreeObserver = new NavigationTreeObserver();
- navigationTreeObserver.addListener(new SubModuleListener());
- navigationTreeObserver.addListener(new ModuleListener());
+ subModuleListener = new SubModuleListener();
+ navigationTreeObserver.addListener(subModuleListener);
+ moduleListener = new ModuleListener();
+ navigationTreeObserver.addListener(moduleListener);
navigationTreeObserver.addListenerTo(moduleNode);
if (getNavigationNode().getNavigationNodeController() instanceof IController) {
@@ -134,13 +136,20 @@ public class ModuleView implements INavigationNodeView<ModuleNode> {
binding.bind(controller);
controller.afterBind();
}
-
}
/**
* Disposes this module item.
*/
public void dispose() {
+ if (null != subModuleListener) {
+ navigationTreeObserver.removeListener(subModuleListener);
+ }
+
+ if (null != moduleListener) {
+ navigationTreeObserver.removeListener(moduleListener);
+ }
+
subModuleMarkerCache.clear();
unbind();
SwtUtilities.dispose(title);
@@ -849,6 +858,7 @@ public class ModuleView implements INavigationNodeView<ModuleNode> {
updateExpanded(source); // fix for bug 269221
doNotResize = false;
resize();
+
final TreeItem currentItem = findItem(getTree().getItems(), source);
if (null != currentItem) {
getTree().select(currentItem);
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java
index f877692..1516b24 100644
--- a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java
@@ -363,30 +363,34 @@ public class NavigationProcessor implements INavigationProcessor, INavigationHis
*/
public void move(final INavigationNode<?> sourceNode, final NavigationNodeId targetId) {
Assert.isTrue(ModuleNode.class.isAssignableFrom(sourceNode.getClass()));
- final ModuleNode moduleNode = ModuleNode.class.cast(sourceNode);
+ final ModuleNode sourceModuleNode = ModuleNode.class.cast(sourceNode);
final INavigationNode<?> targetNode = create(sourceNode, targetId);
Assert.isTrue(ModuleGroupNode.class.isAssignableFrom(targetNode.getClass()));
final ModuleGroupNode targetModuleGroup = ModuleGroupNode.class.cast(targetNode);
- final ModuleGroupNode oldParentModuleGroup = ModuleGroupNode.class.cast(moduleNode.getParent());
+ final ModuleGroupNode oldParentModuleGroup = ModuleGroupNode.class.cast(sourceModuleNode.getParent());
if (targetModuleGroup.equals(oldParentModuleGroup)) {
return;
}
- final boolean isActivated = moduleNode.isActivated();
- final boolean isBlocked = moduleNode.isBlocked();
- final boolean isEnabled = moduleNode.isEnabled();
- final boolean isVisible = moduleNode.isVisible();
+ final boolean isActivated = sourceModuleNode.isActivated();
+ final boolean isBlocked = sourceModuleNode.isBlocked();
+ final boolean isEnabled = sourceModuleNode.isEnabled();
+ final boolean isVisible = sourceModuleNode.isVisible();
- moduleNode.dispose(null);
- moduleNode.deactivate(null);
- oldParentModuleGroup.removeChild(moduleNode);
- targetModuleGroup.addChild(moduleNode);
+ sourceModuleNode.dispose(null);
+ sourceModuleNode.deactivate(null);
+ oldParentModuleGroup.removeChild(sourceModuleNode);
+ targetModuleGroup.addChild(sourceModuleNode);
- moduleNode.setBlocked(isBlocked || targetModuleGroup.isBlocked());
- moduleNode.setEnabled(isEnabled && targetModuleGroup.isEnabled());
- moduleNode.setVisible(isVisible && targetModuleGroup.isVisible());
+ for (final ISubModuleNode child : sourceModuleNode.getChildren()) {
+ child.setParent(sourceModuleNode);
+ }
+
+ sourceModuleNode.setBlocked(isBlocked || targetModuleGroup.isBlocked());
+ sourceModuleNode.setEnabled(isEnabled && targetModuleGroup.isEnabled());
+ sourceModuleNode.setVisible(isVisible && targetModuleGroup.isVisible());
if (isActivated) {
- moduleNode.activate();
+ sourceModuleNode.activate();
}
if (oldParentModuleGroup.getChildren().size() == 0) {
@@ -745,7 +749,7 @@ public class NavigationProcessor implements INavigationProcessor, INavigationHis
}
// /**
- // *
+ // *
// * @see org.eclipse.riena.navigation.INavigationProcessor#navigate(org.eclipse.riena.navigation.INavigationNode,
// * org.eclipse.riena.navigation.NavigationNodeId,
// * org.eclipse.riena.navigation.NavigationArgument)
@@ -767,7 +771,7 @@ public class NavigationProcessor implements INavigationProcessor, INavigationHis
//
// /*
// * (non-Javadoc)
- // *
+ // *
// * @see
// * org.eclipse.riena.ui.core.uiprocess.UIProcess#runJob(org.eclipse
// * .core.runtime.IProgressMonitor)
@@ -814,7 +818,7 @@ public class NavigationProcessor implements INavigationProcessor, INavigationHis
// };
//
// // TODO must be set?
- // p.setNote("sample uiProcess note"); //$NON-NLS-1$
+ // p.setNote("sample uiProcess note"); //$NON-NLS-1$
// p.setTitle("sample uiProcess title"); //$NON-NLS-1$
// p.start();
// }