summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Kriese2010-10-06 08:28:05 (EDT)
committerSteffen Kriese2010-10-06 08:28:05 (EDT)
commit540092fc1de8ac307b550439b9a65657d414ab52 (patch)
tree102fab98c7b26f1f6cfca3f6151bd8c12fb3ce6d
parent0ddac86112193e31aa414eebd054206d0bc2ace5 (diff)
downloadorg.eclipse.riena-540092fc1de8ac307b550439b9a65657d414ab52.zip
org.eclipse.riena-540092fc1de8ac307b550439b9a65657d414ab52.tar.gz
org.eclipse.riena-540092fc1de8ac307b550439b9a65657d414ab52.tar.bz2
Fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=327095 (Module move does not copy properties blocked, enabled etc. ...)
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java11
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorTest.java57
2 files changed, 61 insertions, 7 deletions
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 8d13bc4..4e83d2d 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
@@ -371,13 +371,24 @@ public class NavigationProcessor implements INavigationProcessor, INavigationHis
return;
}
final boolean isActivated = moduleNode.isActivated();
+ final boolean isBlocked = moduleNode.isBlocked();
+ final boolean isEnabled = moduleNode.isEnabled();
+ final boolean isVisible = moduleNode.isVisible();
+
moduleNode.dispose(null);
moduleNode.deactivate(null);
oldParentModuleGroup.removeChild(moduleNode);
targetModuleGroup.addChild(moduleNode);
+ targetModuleGroup.setBlocked(moduleNode.isBlocked());
+
+ moduleNode.setBlocked(isBlocked);
+ moduleNode.setEnabled(isEnabled);
+ moduleNode.setVisible(isVisible);
+
if (isActivated) {
moduleNode.activate();
}
+
if (oldParentModuleGroup.getChildren().size() == 0) {
oldParentModuleGroup.dispose();
} else {
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorTest.java
index 3605307..279e7de 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/model/NavigationProcessorTest.java
@@ -43,6 +43,10 @@ import org.eclipse.riena.ui.ridgets.IRidget;
@ManualTestCase
public class NavigationProcessorTest extends RienaTestCase {
+ /**
+ *
+ */
+ private static final String TARGET_MODULE_GROUP = "org.eclipse.riena.navigation.model.test.moduleGroup.2";
private NavigationProcessor navigationProcessor;
private IApplicationNode applicationNode;
private ISubApplicationNode subApplication;
@@ -73,8 +77,7 @@ public class NavigationProcessorTest extends RienaTestCase {
applicationNode.addChild(subApplication);
moduleGroup = new ModuleGroupNode(new NavigationNodeId("org.eclipse.riena.navigation.model.test.moduleGroup"));
subApplication.addChild(moduleGroup);
- moduleGroup2 = new ModuleGroupNode(
- new NavigationNodeId("org.eclipse.riena.navigation.model.test.moduleGroup.2"));
+ moduleGroup2 = new ModuleGroupNode(new NavigationNodeId(TARGET_MODULE_GROUP));
subApplication.addChild(moduleGroup2);
module = new ModuleNode(new NavigationNodeId("org.eclipse.riena.navigation.model.test.module"));
@@ -737,16 +740,14 @@ public class NavigationProcessorTest extends RienaTestCase {
}
/**
- * Tests the method {@code create}.
+ * Tests the method {@code move}.
*/
public void testMove() throws Exception {
-
- final INavigationNode<?> targetModuleGroup = navigationProcessor.create(subApplication, new NavigationNodeId(
- "org.eclipse.riena.navigation.model.test.moduleGroup.2"), null);
+ final INavigationNode<?> targetModuleGroup = createTargetModuleGroup();
assertEquals(module2, moduleGroup.getChild(1));
assertEquals(2, moduleGroup.getChildren().size());
assertEquals(0, moduleGroup2.getChildren().size());
- module2.moveTo(new NavigationNodeId("org.eclipse.riena.navigation.model.test.moduleGroup.2"));
+ module2.moveTo(new NavigationNodeId(TARGET_MODULE_GROUP));
assertEquals(1, moduleGroup.getChildren().size());
assertEquals(1, moduleGroup2.getChildren().size());
assertEquals(module2, targetModuleGroup.getChild(0));
@@ -754,6 +755,39 @@ public class NavigationProcessorTest extends RienaTestCase {
}
/**
+ * Tests the method {@code move} with the attribute blocked set.
+ */
+ public void testMoveBlocked() throws Exception {
+ final INavigationNode<?> targetModuleGroup = createTargetModuleGroup();
+ module2.setBlocked(true);
+ module2.moveTo(new NavigationNodeId(TARGET_MODULE_GROUP));
+ assertEquals(module2, targetModuleGroup.getChild(0));
+ assertTrue(module2.isBlocked());
+ }
+
+ /**
+ * Tests the method {@code move} with the attribute enabled set.
+ */
+ public void testMoveEnabled() throws Exception {
+ final INavigationNode<?> targetModuleGroup = createTargetModuleGroup();
+ module2.setEnabled(true);
+ module2.moveTo(new NavigationNodeId(TARGET_MODULE_GROUP));
+ assertEquals(module2, targetModuleGroup.getChild(0));
+ assertTrue(module2.isEnabled());
+ }
+
+ /**
+ * Tests the method {@code move} with the attribute visible set.
+ */
+ public void testMoveVisible() throws Exception {
+ final INavigationNode<?> targetModuleGroup = createTargetModuleGroup();
+ module2.setVisible(true);
+ module2.moveTo(new NavigationNodeId(TARGET_MODULE_GROUP));
+ assertEquals(module2, targetModuleGroup.getChild(0));
+ assertTrue(module2.isVisible());
+ }
+
+ /**
* Tests the method {@code prepare(INavigationNode<?>)}.
*/
public void testPrepare() {
@@ -887,6 +921,15 @@ public class NavigationProcessorTest extends RienaTestCase {
}
+ /**
+ * @return
+ */
+ private INavigationNode<?> createTargetModuleGroup() {
+ final INavigationNode<?> targetModuleGroup = navigationProcessor.create(subApplication, new NavigationNodeId(
+ TARGET_MODULE_GROUP), null);
+ return targetModuleGroup;
+ }
+
private static class TestSubModuleNode extends SubModuleNode {
private boolean allowsActivate;