Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 32255

Summary: user cannot use their proposals in their quickfixs
Product: [Eclipse Project] JDT Reporter: Kelvin <kelvin>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: major    
Priority: P3 CC: martinae
Version: 2.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Kelvin CLA 2003-02-19 11:40:35 EST
I have a project required that all of my markers should have their own proposals
to tell what the quickfix will do.

e.g  a marker requires a method to be "static", so the proposal should look like
     ...
     public <b>static</b> void method() {
     ...

But currencly Eclipse cannot allow user to create our own proposal for our 
markers. Instead it will display the marker description in the quickfix dialog 
when you click on the lightblub icon.

Code is in org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor: 

 if (marker.isSubtypeOf(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER)) {
     int problemId= marker.getAttribute(IJavaModelMarker.ID, -1);
     return problemId != -1 && hasCorrections(problemId);
 } else {
    IMarkerHelpRegistry registry
          = PlatformUI.getWorkbench().getMarkerHelpRegistry();
    return registry != null && registry.hasResolutions(marker);
 }

  only JAVA_MODEL_PROBLEM_MARKER can have its proposal, other markers will use 
the default proposal which is displaying the marker description 

org.eclipse.jdt.internal.ui.text.correction.MarkerResolutionProposal :
 public String getAdditionalProposalInfo() {
    try {
        String problemDesc= (String) fMarker.getAttribute(IMarker.MESSAGE);
        return CorrectionMessages.getFormattedString
("MarkerResolutionProposal.additionaldesc", problemDesc); //$NON-NLS-1$
    } catch (CoreException e) {
	 JavaPlugin.log(e);
    }
    return null;
 }

current IMarkerResolution only have a getLabel() method definition. I think it 
should also have a method to get the proposal and a method to get the image out.
Or another way to allow user to use their own proposal in their markers.

I did file a feature request (http://bugs.eclipse.org/bugs/show_bug.cgi?
id=32175); however, Martin Aeschlimann tell me should file a bug report for 
this.
Comment 1 Dirk Baeumer CLA 2003-02-19 11:48:14 EST
Martin, any comments
Comment 2 Martin Aeschlimann CLA 2003-02-19 12:02:33 EST
I'm confused. So do you have it running? Do you have your own marker (markers
created by you), and you contributed a marker resolution generator?

If you have this, you get a lightbulb next to your error marker, when you click
on it you get all the proposals that your IMarkerResolutionGenerator
(generator.getResolutions()) returns. Can you confirm this?
The label of the proposals is the one your IMarkerResolutions return, right.

The only problem we have is that you can't define an own image (a default image
is used) and you can't provide a own hover of the proposal. For this you could
file bug report against platform/ui. 
But this is just a minor problem and should not lead to 
'user cannot use their proposals in their quickfixs'
as the title of this bug report says.

Please elaborate.

Comment 3 Kelvin CLA 2003-02-19 12:09:08 EST
i can get a list of quickfix proposal, but each quickfix proposal cannot have 
its hover of the proposal.
Comment 4 Martin Aeschlimann CLA 2003-02-19 12:33:23 EST
ah, ok. The title of this bug report was confusing me.

filed bug 32262 

*** This bug has been marked as a duplicate of 32262 ***