Bug 525387 - Cannot hide inactive view with call to IWorkbenchPage.hideView(IViewReference)
Summary: Cannot hide inactive view with call to IWorkbenchPage.hideView(IViewReference)
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.7   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-29 09:55 EDT by Simeon Andreev CLA
Modified: 2022-03-30 13:45 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simeon Andreev CLA 2017-09-29 09:55:02 EDT
After migrating from 3.8.2 to 4.7, one of our UI tests ran into this. It was no longer able to close the Debug View, after closing the Debug View (if open) in the current perspective, and switching to the Debug Perspective.

The test uses an IViewReference to close the view, which fails. Using an IViewPart instead seems to work as expected.

Steps to reproduce:

1. Open a perspective with one folder, the folder contains two views.
2. Retrieve an IViewReference to the inactive view of the perspective.
3. Call IWorkbenchPage.hideView(IViewReference) to close the view.
4. Observe that the view is not closed. Its reference can also still be retrieved via IWorkbenchPage.findViewReference(String).
Comment 1 Eclipse Genie CLA 2017-09-29 10:00:55 EDT
New Gerrit change created: https://git.eclipse.org/r/106007
Comment 2 Simeon Andreev CLA 2017-09-29 10:01:18 EDT
Opened a gerrit review with a test case that reproduces the problem.
Comment 3 Karsten Thoms CLA 2017-11-22 17:07:21 EST
In PartServiceImpl#hidePart, is it really an else to set the Part toRendered to false?

		if (toBeRemoved != null) {
			toBeRemoved.setToBeRendered(false);
		} else {
			part.setToBeRendered(false);
		}
Comment 4 Simeon Andreev CLA 2017-12-05 03:45:46 EST
Hi Karsten,

sorry for the late reply.

About the bug, we observed the problem while closing the Debug View programmatically. If I change my test to add a part listener, I only see the following callbacks:

partOpened org.eclipse.ui.internal.ViewReference@7343d843
partVisible org.eclipse.ui.internal.ViewReference@7343d843
partBroughtToTop org.eclipse.ui.internal.ViewReference@7343d843
partActivated org.eclipse.ui.internal.ViewReference@7343d843
partVisible org.eclipse.ui.internal.ViewReference@7343d843


There is nothing about hiding the view. Only its placeholder is actually hidden after calling the hide view reference API.

In our test, we want to check whether a feature works despite closing the Debug View. As it stands, we show the Debug View before hiding it in the test, to ensure its actually closed. In the test from the gerrit review, this amounts to adding activePage.showView(INACTIVE_VIEW_ID) before the activatePage.hideView call.

Showing the view before hiding it results in the following callbacks:

partOpened org.eclipse.ui.internal.ViewReference@6e349258
partVisible org.eclipse.ui.internal.ViewReference@6e349258
partBroughtToTop org.eclipse.ui.internal.ViewReference@6e349258
partActivated org.eclipse.ui.internal.ViewReference@6e349258
partVisible org.eclipse.ui.internal.ViewReference@6e349258
partDeactivated org.eclipse.ui.internal.ViewReference@6e349258
partHidden org.eclipse.ui.internal.ViewReference@6e349258
partOpened org.eclipse.ui.internal.ViewReference@58b30e3e
partVisible org.eclipse.ui.internal.ViewReference@58b30e3e
partBroughtToTop org.eclipse.ui.internal.ViewReference@58b30e3e
partActivated org.eclipse.ui.internal.ViewReference@58b30e3e
partHidden org.eclipse.ui.internal.ViewReference@58b30e3e
partVisible org.eclipse.ui.internal.ViewReference@6e349258
partBroughtToTop org.eclipse.ui.internal.ViewReference@6e349258
partDeactivated org.eclipse.ui.internal.ViewReference@58b30e3e
partActivated org.eclipse.ui.internal.ViewReference@6e349258
partHidden org.eclipse.ui.internal.ViewReference@58b30e3e
partClosed org.eclipse.ui.internal.ViewReference@58b30e3e


With the change you propose, the test does pass, however the call backs are still:

partOpened org.eclipse.ui.internal.ViewReference@7343d843
partVisible org.eclipse.ui.internal.ViewReference@7343d843
partBroughtToTop org.eclipse.ui.internal.ViewReference@7343d843
partActivated org.eclipse.ui.internal.ViewReference@7343d843
partVisible org.eclipse.ui.internal.ViewReference@7343d843


I'm guessing our test is too naive in its validation that the view is actually closed. I'll adapt the gerrit change to include an actual part listener in the test. I'll try to do so this week, but I may take longer to get to it.

Best regards,
Simeon
Comment 5 Karsten Thoms CLA 2017-12-05 03:56:06 EST
Thanks Simeon for taking care of it. I'll have another look when you are ready.
Comment 6 Simeon Andreev CLA 2017-12-05 05:35:17 EST
Alright, I updated the patch to use a part listener. Thanks for the help!
Comment 7 Eclipse Genie CLA 2020-06-15 00:43:40 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. 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.
Comment 8 Andrey Loskutov CLA 2022-03-30 13:45:24 EDT
Still there