Community
Participate
Working Groups
When I double click a class in the package explorer it is opened as a new tab in the editor part. But the focus remains on the package explorer entry. This behavior changed with one of the older Eclipse releases. I think, it was the one before Juno. Yesterday I reinstalled my system with Opensuse 12.2, KDE 4 and installed the latest Eclipse Juno, but the behavior is still the same. It works as it should on Windows (with either Eclipse release).
Wow, that's horrible. Works fine on Windows, but I can reproduce on Ubuntu 12.04. Happens in master as well as in releases back to at least 3.6.2. Here's how the focus gets set back to the Package Explorer in master: Thread [main] (Suspended (breakpoint at line 779 in PackageExplorerPart)) PackageExplorerPart.setFocus() line: 779 CompatibilityView(CompatibilityPart).delegateSetFocus() line: 185 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43 Method.invoke(Object, Object...) line: 601 MethodRequestor.execute() line: 56 InjectorImpl.invokeUsingClass(Object, Class<?>, Class<Annotation>, Object, PrimaryObjectSupplier, PrimaryObjectSupplier, boolean) line: 231 InjectorImpl.invokeUsingClass(Object, Class<?>, Class<Annotation>, Object, PrimaryObjectSupplier, PrimaryObjectSupplier, boolean) line: 237 InjectorImpl.invoke(Object, Class<Annotation>, Object, PrimaryObjectSupplier) line: 208 ContextInjectionFactory.invoke(Object, Class<Annotation>, IEclipseContext, Object) line: 106 PartServiceImpl.activate(MPart, boolean, boolean) line: 562 PartServiceImpl.activate(MPart, boolean) line: 528 ContributedPartRenderer(AbstractPartRenderer).activate(MPart) line: 105 ContributedPartRenderer$1.handleEvent(Event) line: 61 EventTable.sendEvent(Event) line: 84 ContributedPartRenderer$2(Widget).sendEvent(Event) line: 1388 ContributedPartRenderer$2(Widget).sendEvent(int, Event, boolean) line: 1412 ContributedPartRenderer$2(Widget).sendEvent(int) line: 1393 Shell.setActiveControl(Control) line: 1669 Tree(Control).gtk_button_press_event(int, int, boolean) line: 2936 Tree(Control).gtk_button_press_event(int, int) line: 2872 Tree(Composite).gtk_button_press_event(int, int) line: 706 Tree.gtk_button_press_event(int, int) line: 1833 Tree(Widget).windowProc(int, int, int) line: 2070 Tree(Control).windowProc(int, int, int) line: 5322 Tree.windowProc(int, int, int) line: 3535 Display.windowProc(int, int, int) line: 4504 OS._gtk_main_do_event(int) line: not available [native method] OS.gtk_main_do_event(int) line: 8497 Display.eventProc(int, int) line: 1225 OS._g_main_context_iteration(int, boolean) line: not available [native method] OS.g_main_context_iteration(int, boolean) line: 2269 Display.readAndDispatch() line: 3296 PartRenderingEngine$9.run() line: 1023 Realm.runWithDefault(Realm, Runnable) line: 332 PartRenderingEngine.run(MApplicationElement, IEclipseContext) line: 917 E4Workbench.createAndRunUI(MApplicationElement) line: 86 Workbench$5.run() line: 587 Realm.runWithDefault(Realm, Runnable) line: 332 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 542 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149 IDEApplication.start(IApplicationContext) line: 124 EclipseAppHandle.run(Object) line: 196 EclipseAppLauncher.runApplication(Object) line: 110 EclipseAppLauncher.start(Object) line: 79 EclipseStarter.run(Object) line: 353 EclipseStarter.run(String[], Runnable) line: 180 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43 Method.invoke(Object, Object...) line: 601 Main.invokeFramework(String[], URL[]) line: 629 Main.basicRun(String[]) line: 584 Main.run(String[]) line: 1438 Main.main(String[]) line: 1414 => Analysis of the events: When I double-click a file in the Package Explorer, then Tree.gtk_row_activated(int, int, int) line: 2008 posts a DefaultSelection event. This is handled by org.eclipse.jface.util.OpenStrategy, which opens the editor and sets focus to the StyledText. But in the end, Control.gtk_button_press_event(int, int, boolean) line 2936 activates the Tree widget again: if (!shell.isDisposed ()) shell.setActiveControl (this); This line is wrong. If the control really needs to be activated again on double-click, then this needs to happen before any listeners are notified.
*** This bug has been marked as a duplicate of bug 312568 ***