Bug 109806

Summary: [WorkbenchParts] (regression) View not found during partOpened notification
Product: [Eclipse Project] Platform Reporter: Nick Edgar <n.a.edgar>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: ASSIGNED --- QA Contact:
Severity: major    
Priority: P5 CC: michaelvanmeekeren, sxenos
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Nick Edgar CLA 2005-09-16 20:00:20 EDT
3.1

I have an ShowViewAction class that tracks whether the view it shows is already
showing (it's a toggle action).
It has a listener like:

	private IPartListener partListener = new IPartListener() {
		public void partOpened(IWorkbenchPart part) {
			if (part instanceof IViewPart) {
				updateSelection();
			}
		}
		public void partDeactivated(IWorkbenchPart part) {
		}
		public void partClosed(IWorkbenchPart part) {
			if (part instanceof IViewPart) {
				updateSelection();
			}
		}
		public void partBroughtToTop(IWorkbenchPart part) {
		}
		public void partActivated(IWorkbenchPart part) {
		}
	};

where updateSelection() is:

	private void updateSelection() {
		boolean viewFound = false;
		IWorkbenchPage page = window.getActivePage();
		if (page != null) {
			IViewReference ref = page.findViewReference(desc.getId());
			if (ref != null) {
				viewFound = true;
			}
		}
		setChecked(viewFound);
	}

This is not working correctly because when partOpened is fired, the view is not
found by findViewReference.

It should be the case that by the time partOpened is sent, the part can be found
in the list (the notification is past tense).

Should investigate whether this is a regression from previous releases.
Comment 1 Nick Edgar CLA 2005-09-16 20:04:03 EDT
This was during start up, when opening the first window.
The lifecycle may be different once the workbench is fully up, but it shouldn't be.
Comment 2 Nick Edgar CLA 2005-09-19 10:41:32 EDT
I think this should be given higher priority since it's likely a regression.
Comment 3 Paul Webster CLA 2006-09-28 15:15:25 EDT
Is this still a problem in 3.3?

PW
Comment 4 Denis Roy CLA 2007-06-22 09:33:04 EDT
Changes requested on bug 193523
Comment 5 Eclipse Webmaster CLA 2019-09-06 16:06:36 EDT
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.