Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 252587 - [Markers] Problems view should enable 'Quick Fix' for multiple selection
Summary: [Markers] Problems view should enable 'Quick Fix' for multiple selection
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.7 M3   Edit
Assignee: Dani Megert CLA
QA Contact: Hitesh CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 326000
  Show dependency tree
 
Reported: 2008-10-29 10:05 EDT by Noel Grandin CLA
Modified: 2011-10-21 01:29 EDT (History)
5 users (show)

See Also:


Attachments
Fix (8.19 KB, patch)
2010-10-13 11:21 EDT, Dani Megert CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Noel Grandin CLA 2008-10-29 10:05:13 EDT
Build ID: I20080617-2000

Steps To Reproduce:
1. Create a .java file with 2 methods that both have unused parameters
2. select both rows in the table in the Problems view.
3. Type CTRL-1,
4. Notice that nothing happens.

What I would like to happen is:

4. In the Quick Fix Dialog, select "Add @SuppressWarnings('unused') to '???'"
5. Click the Finish button.

Thanks. 

More information:
Comment 1 Dani Megert CLA 2008-10-31 05:17:57 EDT
You can select one of them and then you'll get a dialog that allows to fix both problems.

The Problems view should enable the Quick Fix action if all selected markers have a quick fix. For performance reasons it could do the check whether they all have the same set of fixes later and inform the user if that's not the case.
Comment 2 Noel Grandin CLA 2008-10-31 05:21:50 EDT
Are you saying that this is fixed in a newer version?

Because the situation is as I describe in version 3.4.0.
i.e. it is not possible to apply the "Add @SuppressWarnings" quick-fix to more than than one line at a time.

Thanks.
Comment 3 Dani Megert CLA 2008-10-31 05:48:04 EDT
There are two issues reported here: the multi-selection issue (this bug) and a feature request that the "Add @SuppressWarnings 'unused' to ..." quick fix becomes a multi-fix (see bug 252939).
Comment 4 Noel Grandin CLA 2008-10-31 05:52:49 EDT
Ah, my apologies. Don't know why I did not find that bug report. 
I only intended to report the feature-request, so this can get marked as a duplicate if you see fit.
Comment 5 Dani Megert CLA 2008-10-31 05:57:01 EDT
>Ah, my apologies. Don't know why I did not find that bug report. 
Well, I just filed it a few minutes ago ;-)

>I only intended to report the feature-request, so this can get marked as a
>duplicate if you see fit.
It is not a duplicate: even if bug 252939 gets fixed quick fix won't be enabled on multi-selection in the Problems view.
Comment 6 Hitesh CLA 2008-11-10 03:15:05 EST
As indicated by Daniel, the feature you look for depends on the particular quick-fix (Marker Resolution) being a multi-fix .For example, observe the quick fix "Remove 'unused', keep side-effect assignments" for the warning "The local variable 'unused' is never read" .This works over multiple markers. 
Comment 7 Dani Megert CLA 2008-11-11 08:15:44 EST
This bug is not fixed as multi-selection is not supported yet.
Comment 8 Hitesh CLA 2008-11-13 06:56:21 EST
(In reply to comment #1)
> You can select one of them and then you'll get a dialog that allows to fix both
> problems.
> 
> The Problems view should enable the Quick Fix action if all selected markers
> have a quick fix. For performance reasons it could do the check whether they
> all have the same set of fixes later and inform the user if that's not the
> case.
> 

Enabling multi-selection for quick fix would unnecessarily complicate  things. If the selected markers have different sets of quick fixes , agreed, we may inform the user, but this is not very intuitive; also, which quick fix would we choose to work with , the first selected marker's ? Also, enabling for multi-selection may seem to suggest that multiple ( different ) quick-fixes are handled at same time (and may be subsequently requested).

How do we test if the two quick fixes are the same - rely on 'Object.equals' ? This behaviour would depend on the contributed Marker Resolutions. If the sets of quick fixes happen to be the same (their labels may still differ), then  we'd have to show them separately in the UI. All this would, however, not change the behaviour if they were multi-fixes already. 

I may not have highlighted all the points, but IMO, it is best to work on a per-problem basis and let the multi-fix take care of multiple markers. 
Comment 9 Hitesh CLA 2010-04-06 06:19:54 EDT
This would be giving too much to the user and can lead to problems. Multi-fixes address this elegantly. Marking as WONTFIX.
Comment 10 Dani Megert CLA 2010-10-13 04:33:40 EDT
We need to do something here in light of bug 326000.
Comment 11 Dani Megert CLA 2010-10-13 08:44:53 EDT
OK, here's the plan:

1. Enable Quick Fix on a multi-selection if at least one element has 
   resolutions.

2. When Quick Fix is invoked we look for resolutions that cover all selected
   markers. This is not expensive as we only need to check the other resolutions
   of the first selected marker against the rest of the selection.

3a.If step 2. gives no resolutions, we show a dialog (this can already happen
   now with single-selection) which gives the users some hints in the multi-
   selection case:
   - suggest to only select one marker
   - suggest to use Clean Up

3b.If step 2. returned common resolutions we show them in the Quick Fix
   dialog.
Comment 12 Dani Megert CLA 2010-10-13 11:18:47 EDT
Fixed in HEAD.
Available in builds >= N20101013-2000.
Comment 13 Dani Megert CLA 2010-10-13 11:21:34 EDT
Created attachment 180779 [details]
Fix
Comment 14 Deepak Azad CLA 2010-10-26 05:57:21 EDT
Verified for 3.7M3 on Linux-GTK with I20101025-1800.
Comment 15 Sergey CLA 2011-10-20 13:56:05 EDT
(In reply to comment #14)
> Verified for 3.7M3 on Linux-GTK with I20101025-1800.

Quick fix still can not be applied to several similar "XXX can not be resolved to a type" error rows in 'Problems' View - for ambiguous Organize Imports problems.
Comment 16 Dani Megert CLA 2011-10-21 01:29:40 EDT
> Quick fix still can not be applied to several similar "XXX can not be resolved
> to a type" error rows in 'Problems' View - for ambiguous Organize Imports
> problems.
It only works if the Quick Fix is implemented as multi-fix. You need to file a bug report against the concrete Quick Fix(es).