Bug 104065 - [quick fix] No Quick Fixes for marker with IMarker.LINE_NUMBER and no IMarker.CHAR_START and IMarker.CHAR_END
Summary: [quick fix] No Quick Fixes for marker with IMarker.LINE_NUMBER and no IMarker...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1.1   Edit
Assignee: Martin Aeschlimann CLA Friend
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-15 14:30 EDT by Dan Yocum CLA Friend
Modified: 2005-08-09 05:43 EDT (History)
2 users (show)

See Also:


Attachments
patch for JavaCorrectionAssistant (684 bytes, patch)
2005-07-25 09:08 EDT, Martin Aeschlimann CLA Friend
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Yocum CLA Friend 2005-07-15 14:30:01 EDT
I'm creating (problem) markers for a java file and I only have a line number
available when I create the marker. I add the IMarker.LINE_NUMBER attribute to
the marker attributes, but do not specify a CHAR_START or CHAR_END. The marker
shows up in the file, but there are no Quick Fixes available for it (using
Ctrl+1 or right click on the marker). When I click on the marker in the problems
view, however, I get the quick fixes that are possible. (This used to work in
3.0, doesnt now in 3.1)

I traced through the code and found that the markers with a line number get
their end and start range set to be the same in:
AbstractMarkerAnnotationModel.createPositionFromMarker(IMarker marker).  Because
the start and end are both -1 coming into the method, end = start. 

In JavaCorrectionAssistant.collectQuickFixableAnnotations(), there is a check to
see if the Position for the offset is within the range -- its a call to
JavaCorrectionAssistant.isInside(). isInside has the following body:
	private static boolean isInside(int offset, int start, int end) {
		return offset >= start && offset < end;
	}

BUT, because the start and end are set to be the same, its NEVER inside. The net
effect: any markers with a position set via LINE_NUMBER will not get a quick fix.
Comment 1 Markus Keller CLA Friend 2005-07-18 12:56:04 EDT
Martin, this is probably something that should be fixed for 3.1.1.
Comment 2 Martin Aeschlimann CLA Friend 2005-07-25 09:08:09 EDT
Created attachment 25234 [details]
patch for JavaCorrectionAssistant
Comment 3 Martin Aeschlimann CLA Friend 2005-07-25 09:09:56 EDT
Dirk, I also support this as a 3.1.1 candidate. The fix is trivial and makes
sure that also 0-length markers get quick assist support.
Comment 4 Martin Aeschlimann CLA Friend 2005-07-25 11:24:27 EDT
fix released in 3.2 HEAD stream
Comment 5 Dirk Baeumer CLA Friend 2005-07-26 05:34:28 EDT
+1 for 3.1.1
Comment 6 Dirk Baeumer CLA Friend 2005-07-26 13:22:39 EDT
Patched reviewed.
Comment 7 Martin Aeschlimann CLA Friend 2005-07-27 09:05:49 EDT
Reviewed by Tom, patch released in 3.1.1
Comment 8 Dani Megert CLA Friend 2005-08-09 04:33:25 EDT
Verifying...
Comment 9 Dani Megert CLA Friend 2005-08-09 05:39:59 EDT
Verified in M20050804-1200.
Comment 10 Dani Megert CLA Friend 2005-08-09 05:43:08 EDT
.