Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 114754 - [Markers] QuickFix needs API to update resolutions
Summary: [Markers] QuickFix needs API to update resolutions
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M4   Edit
Assignee: Tod Creasey CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 114570 (view as bug list)
Depends on:
Blocks: 23889 114570
  Show dependency tree
 
Reported: 2005-11-02 09:15 EST by Tod Creasey CLA
Modified: 2005-12-13 10:03 EST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tod Creasey CLA 2005-11-02 09:15:52 EST
We need some API to update the resolutions when multiple ones are selected.
Comment 1 Dirk Baeumer CLA 2005-11-02 09:30:12 EST
CCing Martin and Benno.

See also bug 114570.
Comment 2 Tod Creasey CLA 2005-11-02 09:46:08 EST
As we now have org.eclipse.ui.IMarkerResolution and
org.eclipse.ui.IMarkerResolution2 I am proposing adding an abstract superclass
WorkbenchMarkerResolution that implements IMarkerResolution2 and adds methods to
handle

1) Identifying that markers resolutions are equal. I can do this by making it
implement Comparable. Right now I have to use the strings to identify two equal
resolutions.

2) Refreshing resolutions. It needs a method
#getUpdatesResoution(WorkbenchMarkerResolution) that can take the previous one
selected by the user (the argument) and get a new one in return (right now I
have to compare by strings).

By default this will return null which will cancel the resolution. I will only
enable multi select on resolution sets that are all WorkbenchMarkerResolutions.
Comment 3 Dirk Baeumer CLA 2005-11-02 12:04:13 EST
Additional things we have to keep in mind:

- some quick fixes put the editor in linked mode. Don't know what happens here
  when we have a modal dialog in front

- some quick fixes pop up a modal dialog. 

May be we should restrict the quick fixes which can be applied in multi mode to
those that can be executed "head less".
Comment 4 Martin Aeschlimann CLA 2005-11-07 08:23:20 EST
Can you explain when getUpdatesResoution(WorkbenchMarkerResolution) is called.
Just before the proposal is applied?
What argument is passed? The last proposal that was just applied before? What
could I do with this argument?
Comment 5 Tod Creasey CLA 2005-11-07 08:40:45 EST
Imagine a scenario with 2 markers.

User selects a resolution for marker A and hits next. They send select a
resolution for marker B.

Then they press finish. I apply resolution A. Then I send
getUpdatesResoution(WorkbenchMarkerResolution) with resolution B. You return me
an upodate resolution or null if it is no longer valid.
Comment 6 Martin Aeschlimann CLA 2005-11-07 09:13:47 EST
You said that's on IMarkerResolution:
So is it newResolutionB= resolutionB.getUpdatesResoution(resolutionA)?
What if you have 3 resolutions?
newResolutionC= resolutionC.getUpdatesResoution(newResolutionB) or
resolutionB.getUpdatesResoution(resolutionB) or maybe
resolutionB.getUpdatesResoution(newResolutionA) ?

What could resolutionC do with the argument resolutionB? Maybe it doesn't know
resolutionB at all (from a different plugin)...

Why not having this on IMarkerResolutionGenerator?

The problem is still: If resolutionA knew that you also resolutionB is selected,
a easier fix could be provided.

So what I think is worth to have a look at is something like:

IMarkerResolutionGenerator.getResolutions(IMarker[] marker) : IMarkerResolution[]
Comment 7 Tod Creasey CLA 2005-11-07 09:46:19 EST
I see you point - the argument is redundant.

newResolutionB= resolutionB.getUpdatedResoution()

The user has already selected the resolution they want. If it can't be applied
we do nothing and let them try again afterwards - I don't want to try and be too
smart.

Asking for all of the resolutions again requires the user to reselect which I
want to avoid as the finish button should just complete the wizard and warn the
user about unapplied resolutions.
Comment 8 Tod Creasey CLA 2005-11-07 10:29:31 EST
*** Bug 114570 has been marked as a duplicate of this bug. ***
Comment 9 Tod Creasey CLA 2005-11-16 16:49:51 EST
WorkbenchMarkerResolution has been released to org.eclipse.ui.views markers for
build >20051116

Here is the specification

/**
 * WorkbenchMarkerResolution is the resolution that can be grouped
 * with others that are similar to allow multi selection.
 * @since 3.2
 * <strong>NOTE:</strong> This API is experimental and subject to
 * change in the 3.2 development cycle.
 *
 */
public abstract class WorkbenchMarkerResolution implements IMarkerResolution2 {

	/**
	 * Return whether or not the receiver can be grouped with
	 * resolution in the Quick Fix dialog.
	 * @param resolution
	 * @return boolean <code>true</code> if the receiver can
	 * be grouped with resolution
	 */
	public abstract boolean canBeGroupedWith(WorkbenchMarkerResolution resolution);
	
	/**
	 * Return an updated WorkbenchMarkerResolution for the receiver.
	 * This is called after another WorkbenchMarkerResolution has been
	 * applied in changes are required.
	 * @return WorkbenchMarkerResolution
	 */
	public abstract WorkbenchMarkerResolution getUpdatedResolution();
Comment 10 Tod Creasey CLA 2005-12-13 10:03:01 EST
verified in 20051113-0100