| Summary: | [RCP] IPartListener2 is not notified when editor's are opened during restore | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Ian Leslie <ian.leslie> |
| Component: | UI | Assignee: | Platform UI Triaged <platform-ui-triaged> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 3.1.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | stalebug | ||
Boris, This may not be RCP specific (i.e. I don't know if clients can hook into the 'preWidnowOpen' for the Workbench). If you think its a workbench issue mark it up and reassign. Hi Ian! Prakash is now responsible for watching bugs in the [RCP] component area. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
If you setSaveAndRestore to true on your RCP application's IWorkbenchConfigurer and provide your application editor's with the ability to be saved and restored; the part listeners on IWorkbenchPage are not notified when those editors are opened by restore. To reproduce create / modify an RCP application which has persistable editors that are restored when you restart the RCP application. Add the preWindowOpen method shown below to your WorkbenchWindowAdvisor derived class. When you run the application you will notice that opening an editor is noticed by the listener, closing that editor is also noticed by the listener. If you close your application with at least one editor open and restart it; you will notice that the listener does not notice that the active editor was re-opened during start up. However non-active editors are noticed by the listener when they are first opened. The method WorkbenchAdvisor.openWindows is called before WorkbenchWindowAdvisor.preWindowOpen. In fact the act of restoring the workbench in openWindows triggers the call to preWindowOpen. The call to preWindowOpen happens before any views or editors are created so add in part listeners during the preWindowOpen method should still be called when those views and editors are restored. ---8<--- public void preWindowOpen () { configurer.getWindow().addPageListener(new IPageListener (){ public void pageActivated (IWorkbenchPage page) { // System.out.println("pageActivated: " + page.getLabel()); } public void pageClosed (IWorkbenchPage page) { // System.out.println("pageClosed: " + page.getLabel()); } public void pageOpened (IWorkbenchPage page) { System.out.println ("pageOpened: " + page.getLabel()); page.addPartListener(new IPartListener2 () { public void partActivated (IWorkbenchPartReference partRef) { // System.out.println ("partActivated: " + partRef.getPartName()); } public void partBroughtToTop (IWorkbenchPartReference partRef) { // System.out.println ("partBroughtToTop: " + partRef.getPartName()); } public void partClosed (IWorkbenchPartReference partRef) { if (partRef instanceof IEditorReference) { System.out.println ("editorClosed: " + partRef.getPartName()); } } public void partDeactivated (IWorkbenchPartReference partRef) { // System.out.println ("partDeactivated: " + partRef.getPartName()); } public void partOpened (IWorkbenchPartReference partRef) { if (partRef instanceof IEditorReference) { System.out.println ("editorOpened: " + partRef.getPartName()); } } public void partHidden (IWorkbenchPartReference partRef) { // System.out.println ("partHidden: " + partRef.getPartName()); } public void partVisible (IWorkbenchPartReference partRef) { // System.out.println ("partVisible: " + partRef.getPartName()); } public void partInputChanged (IWorkbenchPartReference partRef) { // System.out.println ("partInputChanged: " + partRef.getPartName()); } }); } }); }