Project: Eclipse_Platform_UI
Bug 91781 [WorkbenchParts] Adding a selection listener to a view causes view to be opened
Reported: 2005-04-18 15:41:15 | Status: resolved fixed

Build: I20050413 AbstractDebugActionDelegate in org.eclipse.debug.ui adds a selection listener on startup to a particular view, like so: window.getSelectionService().addSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this); This causes the corresponding view (the debug view in this case) to be eagerly created. The view shouldn't need to be created at the time this listener is installed. Here is the complete activation stack trace: Thread [main] (Suspended (breakpoint at line 123 in PartListenerList2)) PartListenerList2.firePartOpened(IWorkbenchPartReference) line: 123 WorkbenchPage.firePartOpened(IWorkbenchPart) line: 1547 ViewFactory.busyRestoreViewHelper(ViewFactory$ViewReference) line: 480 ViewFactory.busyRestoreView(IViewReference) line: 299 ViewFactory$1.run() line: 697 BusyIndicator.showWhile(Display, Runnable) line: 69 ViewFactory.restoreView(IViewReference) line: 694 ViewFactory$ViewReference.getPart(boolean) line: 119 ViewFactory$ViewReference.getView(boolean) line: 172 WorkbenchPage.findView(String) line: 1459 PagePartSelectionTracker.<init>(IWorkbenchPage, String) line: 59 PageSelectionService.createPartTracker(String) line: 48 PageSelectionService(AbstractSelectionService).getPerPartTracker(String) line: 202 PageSelectionService(AbstractSelectionService).addSelectionListener(String, ISelectionListener) line: 96 WorkbenchPage.addSelectionListener(String, ISelectionListener) line: 652 WindowPartSelectionTracker.pageOpened(IWorkbenchPage) line: 85 WindowPartSelectionTracker.<init>(IWorkbenchWindow, String) line: 63 WindowSelectionService.createPartTracker(String) line: 51 WindowSelectionService(AbstractSelectionService).getPerPartTracker(String) line: 202 WindowSelectionService(AbstractSelectionService).addSelectionListener(String, ISelectionListener) line: 96 RemoveAllBreakpointsAction(AbstractDebugActionDelegate).init(IWorkbenchWindow) line: 141 RemoveAllBreakpointsAction(AbstractListenerActionDelegate).init(IWorkbenchWindow) line: 101 RemoveAllBreakpointsAction.init(IWorkbenchWindow) line: 117 WWinPluginAction.initDelegate() line: 183 WWinPluginAction(PluginAction).createDelegate() line: 121 WWinPluginAction.refreshActionList() line: 160 AbstractUIPlugin$1.run() line: 480 RunnableLock.run() line: 35 UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 118 Display.runAsyncMessages(boolean) line: 2874 Display.readAndDispatch() line: 2533 Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 1570 Workbench.runUI() line: 1534 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 306 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 143 IDEApplication.run(Object) line: 103 PlatformActivator$1.run(Object) line: 228 EclipseStarter.run(Object) line: 344 EclipseStarter.run(String[], Runnable) line: 156 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 85 NativeMethodAccessorImpl.invoke(Method, Object, Object[]) line: 58 DelegatingMethodAccessorImpl.invoke(Method, Object, Object[]) line: 60 Method.invoke(Object, Object[]) line: 391 Main.invokeFramework(String[], URL[]) line: 319 Main.basicRun(String[]) line: 272 Main.run(String[]) line: 951 Main.main(String[]) line: 935

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewReference.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewDescriptor.java