Project: Eclipse_Platform_UI
Bug 140697 [Viewers] selection not preserved when setting has children
Reported: 2006-05-08 17:25:51 | Status: resolved fixed

1. Debug testcase without stopping in main or breakpoint 2. Select thread, and terminate The suspend action sometimes remain enabled after the debug session is terminated. I added some tracing to the code. When the debug session is terminated, if AbstractDebugContextAction#updateEnablementStateForContext is run after SuspendResumeAdapter's "canSuspend" job, then the suspend action would be disabled properly. However, in some cases, the updateEnablementStateForContext method is run before the "canSuspend" job from SuspendResumeAdapter, and because JDTThread returns true for #canSuspend even if it's terminated, the action got enabled incorrectly. (I am wondering if JDIThread is doing the right thing here. It should return false for #canSuspend if it's teminated?) I also tried making async viewer not preserve selection during setData with this bug. If I turned off preserve selection in this case, the action is always disabled properly. This is because the action would never try to update its enablement state for a terminated java thread. Testcase: public class TestConsole { /** * @param args */ public static void main(String[] args) { try { int count = 0; while (System.in.read() != -1); } catch (IOException e) { e.printStackTrace(); } }

Files changed in fix:
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeViewer.java