Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 317551

Summary: AssertionFailedException if NavigationNodeController.allowsActivate() == false
Product: [RT] Riena Reporter: Sabine Achilles <achilles.sabine>
Component: navigationAssignee: Sabine Achilles <achilles.sabine>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: christian.campo, elias
Version: unspecified   
Target Milestone: 3.0.0.M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Sabine Achilles CLA 2010-06-22 04:47:45 EDT
When a SubModuleController overrides the method alloswActivate() to return false, the exception below is thrown if the node is selected in the navigation tree. This only happens if the previously selected SubModuleController has at least one DefaultAction set.

Exception in thread "Thread-14" org.eclipse.swt.SWTException: Failed to execute runnable (org.eclipse.core.runtime.AssertionFailedException: assertion failed: )
	at org.eclipse.swt.SWT.error(SWT.java:4083)
	at org.eclipse.swt.SWT.error(SWT.java:3998)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:195)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4584)
	at org.eclipse.riena.navigation.ui.swt.views.ModuleNavigationListener$NodeSwitcher.run(ModuleNavigationListener.java:292)
Caused by: org.eclipse.core.runtime.AssertionFailedException: assertion failed: 
	at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110)
	at org.eclipse.core.runtime.Assert.isTrue(Assert.java:96)
	at org.eclipse.riena.internal.ui.ridgets.swt.DefaultActionManager.activate(DefaultActionManager.java:84)
	at org.eclipse.riena.navigation.ui.controllers.SubModuleController$2.afterActivated(SubModuleController.java:201)
	at org.eclipse.riena.navigation.ui.controllers.SubModuleController$2.afterActivated(SubModuleController.java:1)
	at org.eclipse.riena.navigation.model.NavigationNode.notifyAfterActivated(NavigationNode.java:215)
	at org.eclipse.riena.navigation.model.NavigationNode.onAfterActivate(NavigationNode.java:892)
	at org.eclipse.riena.navigation.model.NavigationProcessor.activate(NavigationProcessor.java:920)
	at org.eclipse.riena.navigation.model.NavigationProcessor.activate(NavigationProcessor.java:118)
	at org.eclipse.riena.navigation.model.NavigationNode.activate(NavigationNode.java:418)
	at org.eclipse.riena.navigation.ui.swt.views.ModuleNavigationListener$NodeSwitcher$1.run(ModuleNavigationListener.java:294)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4041)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.riena.navigation.ui.swt.application.SwtApplication.createView(SwtApplication.java:62)
	at org.eclipse.riena.navigation.ui.application.AbstractApplication.start(AbstractApplication.java:64)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Comment 1 Sabine Achilles CLA 2010-06-22 05:12:24 EDT
The root of all evil is this line in DefaultActionManager#activate():
Assert.isTrue(control2button == null);
The Map control2button can only be null on the first activate or if deactivate was called before. But in the case of a non activatable node, deactivate is never called. The scenario is as follows:
- nodeA has default actions set and is activatable
- nodeB is not activatable
- nodeA is activated at the moment
Clicking on nodeB in the navigation now only triggers an activate of nodeA, because nodeB doesn't allow activation. Since nodeA has default actions set, the method DefaultActionManager#activate() is called, but the Map control2button is still filled with information (DefaultActionManager#deactivate() was never called) -> the assert fails.

Since I don't see the usefulness of this assert, I deleted the line which solves the bug.
Comment 2 Sabine Achilles CLA 2010-06-23 04:27:16 EDT
fixed, see comment 1