Bug 374017 - Enable refresh even when selection has closed projects
Summary: Enable refresh even when selection has closed projects
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 4.2   Edit
Hardware: All All
: P3 normal with 5 votes (vote)
Target Milestone: ---   Edit
Assignee: Brett Randall CLA
QA Contact:
URL:
Whiteboard: patch
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2012-03-12 19:05 EDT by Brett Randall CLA
Modified: 2019-09-17 04:11 EDT (History)
7 users (show)

See Also:
daniel_megert: review-


Attachments
patch to R3_8_maintenance (6.08 KB, patch)
2013-03-21 00:59 EDT, Brett Randall CLA
daniel_megert: review-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brett Randall CLA 2012-03-12 19:05:29 EDT
Build Identifier: Version: Indigo Release Build id: 20110615-0604

Based on its title, this looks like a reopen of https://bugs.eclipse.org/bugs/show_bug.cgi?id=232370 :: "Refresh including a closed project doesn't refresh".

When any closed project is selected, Refresh is disabled, F5 does nothing.  This is a request for the Refresh action to ignore closed projects and proceed to refresh all open projects.  There would seem to be no harm in ignoring closed projects during a refresh.

Other discussions on this topic:

http://stackoverflow.com/a/2518466/452210
http://stackoverflow.com/a/1212650/452210


Reproducible: Always

Steps to Reproduce:
1. Open org.eclipse.ui.navigator.resources.ProjectExplorer window.
2. Select any two project where one project is closed.
3. Observe that Refresh is no longer available from the context menu, and F5 does nothing.
Comment 1 Dennis Hendriks CLA 2012-05-07 03:39:10 EDT
I have the same problem. I often want to refresh my entire workspace. I use ctrl+a to select all projects, but then I can't use refresh, as the closed projects prevent this. I have to unselect the closed ones, and only then I can refresh. Since I often have about half my projects closed, refreshing the workspace becomes rather frustrating. Ignoring closed projects (and perhaps other items that disallow refresh) would be nice.
Comment 2 Dennis Hendriks CLA 2012-05-07 03:43:49 EDT
By the way, there is a way to refresh the entire workspace, even if you have closed projects. It is a bit of a hidden feature: see bug 58770, comment 2 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=58770#c2).
Comment 3 Dani Megert CLA 2012-05-07 05:07:50 EDT
See also bug 109966.
Comment 4 Brett Randall CLA 2012-09-10 11:14:32 EDT
Pull request https://github.com/eclipse/eclipse.platform.ui/pull/2

Proposal is to change RefreshAction.updateSelection() to no longer delegate to WorkspaceAction.updateSelection(), which rejects when there is a non-accessible (closed) resources.  Also ResourceMgmtActionProvider changes such that RefreshAction is added provided at least one project is open (was no projects closed).

One alternative to removing the delegation to WorkspaceAction.updateSelection() would be to copy-down its logic and add special processing for IProject so that non-project resources are not impacted.  It this necessary?
Comment 5 Dani Megert CLA 2012-09-13 09:39:32 EDT
(In reply to comment #0)
> Build Identifier: Version: Indigo Release Build id: 20110615-0604
> 
> Based on its title, this looks like a reopen of
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=232370 :: "Refresh including a
> closed project doesn't refresh".

That bug is not related. It is about working sets and the Package Explorer. What is requested in this bug never worked.


(In reply to comment #4)
> Pull request https://github.com/eclipse/eclipse.platform.ui/pull/2

The patch touches the right locations but it should only enable the RefreshAction if at least 1 project is open (like in the ResourceMgmtActionProvider). Also, can you please add your credentials to the copyright notice, e.g.
Dani Megert <dani@eclipse.org> - this is a bug - https://bugs.eclipse.org/nr

And, to make this bug self-contained, please attach a patch here. This also implicitly makes you accept the EPL.

Ah, and for the 'Package Explorer' see bug 109966.
Comment 6 Brett Randall CLA 2013-03-21 00:59:04 EDT
Created attachment 228807 [details]
patch to R3_8_maintenance

Here's an updated patch.

I've swapped !hasClosedProjects for hasOpenProjects, and instead of checking IResource.isAccessible() directly, a new method WorkspaceAction.updateSelected(IResource resource) is introduced, which defaults to IResource.isAccessible().  RefreshAction overrides this to allow any IProject instance to not block Refresh, even if it is closed.

This makes the behaviour consistent for Project Explorer and Navigator views: as long as an open project is selected, Refresh is available.  I checked your other bug-reference for Package Explorer (this is a view I don't use very often) - my current branch is based on R3_8_maintenance, so I didn't have relevant commits dcacd5c,8c1be65,9d94870, but when I pull those in Package Explorer then also behaves the same.

Brett
Comment 7 Dani Megert CLA 2013-04-05 05:35:19 EDT
Comment on attachment 228807 [details]
patch to R3_8_maintenance

The fix is not good. It has at least two problems:
- Refresh is no longer in the context menu of folders and files
- The Refresh action is still enabled even the selection only contains closed
  projects
Comment 8 Paul Webster CLA 2014-02-03 10:22:28 EST
We can review another patch updated with Dani's last comments.

PW
Comment 9 Justin Dolezy CLA 2018-12-09 16:09:37 EST
Would be nice to see this resolved along with https://bugs.eclipse.org/bugs/show_bug.cgi?id=515797 ..
Comment 10 Dani Megert CLA 2018-12-10 11:12:04 EST
(In reply to Justin Dolezy from comment #9)
> Would be nice to see this resolved along with
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=515797 ..

A high quality Gerrit change is welcome.
Comment 11 HÃ¥vard Heierli-Nesse CLA 2019-09-17 04:11:17 EDT
This is probably one of the MOST annoying bugs in the Eclipse IDE. I'd really like to se a fix for this issue.

Workaround so far has been to remove all closed bundles in my working sets. This will re-enable "Refresh" in the context menu. It's not ideal, but it sort of works.