Home » Eclipse Projects » Eclipse Platform » Quick Fix behaviour problem(Different behaviour when invoked from Java editors or other ones)
Quick Fix behaviour problem [message #546116] |
Sun, 11 July 2010 09:10 |
Angelo Tata Messages: 3 Registered: July 2009 Location: Milan, Italy |
Junior Member |
|
|
Ok, here's the situation.
I'm writing a plugin, targeting Eclipse 3.6, though I don't think the extension points I'm using did change recently.
I add markers to certain words in two types of resources (Java source files and Properties files).
Said markers are linked with annotationTypes, so I have:
<extension id="mypkg.markers.BundleIssue" name="BundleIssue"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.core.resources.textmarker"></super>
</extension>
<extension point="org.eclipse.ui.editors.annotationTypes">
<type
markerSeverity="2"
markerType="mypkg.markers.BundleIssue"
name="mypkg.BundleIssueAnnotation">
</type>
</extension>
I'm leaving out the markerAnnotationSpecification; just rest assured it's there.
Annotations show up, and markers appear in the markers view. So far, so good.
I implemented quick fixes, through the markerResolution extension point.
For markers in the Java editor, Ctrl-1 correctly shows the popup with my resolutions.
For markers in the Properties editor, the popup says "No suggestions available" (getResolutions doesn't get called).
Note that my resolution generator implements IMarkerResolutionGenerator2, and I know that its hasResolutions method gets called when I click on the marker in the Markers view (the one created on the Properties resource), and returns true.
If I add another super type to the marker, like this:
<super type="org.eclipse.core.resources.problemmarker"></super>
..I see that the context menu for my marker in the Markers view now has a "Quick Fix" item, apparently bound to Ctrl-1, too.
But this one works, showing a QuickFixWizardDialog with my resolutions.
It appears that quick fixes are managed in different ways. What I'm not sure of, is:
- Ctrl-1 triggering getResolutions in Java editors but NOT in Properties editors: is this intended behaviour, or a bug?
- Is there any way to have the quick fix popup show up in a Properties editor? After all, the spell checking engine does it.
Any suggestions (no pun intended ) are much appreciated.
Angelo
|
|
| |
Re: Quick Fix behaviour problem [message #546868 is a reply to message #546116] |
Wed, 14 July 2010 12:39 |
Dani Megert Messages: 3802 Registered: July 2009 |
Senior Member |
|
|
Angelo Tata wrote:
> Ok, here's the situation.
> I'm writing a plugin, targeting Eclipse 3.6, though I don't think the
> extension points I'm using did change recently.
>
> I add markers to certain words in two types of resources (Java source
> files and Properties files).
> Said markers are linked with annotationTypes, so I have:
>
>
> <extension id="mypkg.markers.BundleIssue" name="BundleIssue"
> point="org.eclipse.core.resources.markers">
> <super type="org.eclipse.core.resources.textmarker"></super>
> </extension>
>
> <extension point="org.eclipse.ui.editors.annotationTypes">
> <type
> markerSeverity="2"
> markerType="mypkg.markers.BundleIssue"
> name="mypkg.BundleIssueAnnotation">
> </type>
> </extension>
>
>
> I'm leaving out the markerAnnotationSpecification; just rest assured
> it's there.
>
> Annotations show up, and markers appear in the markers view. So far,
> so good.
>
> I implemented quick fixes, through the markerResolution extension point.
> For markers in the Java editor, Ctrl-1 correctly shows the popup with
> my resolutions.
> For markers in the Properties editor, the popup says "No suggestions
> available" (getResolutions doesn't get called).
Only the Java editor supports Quick Fix and Quick Assist out of the box.
The other textual editors only support spelling problems unless they
provide their own quick fix processor.
Dani
>
> Note that my resolution generator implements
> IMarkerResolutionGenerator2, and I know that its hasResolutions method
> gets called when I click on the marker in the Markers view (the one
> created on the Properties resource), and returns true.
>
> If I add another super type to the marker, like this:
>
> <super type="org.eclipse.core.resources.problemmarker"></super>
>
>
> .I see that the context menu for my marker in the Markers view now has
> a "Quick Fix" item, apparently bound to Ctrl-1, too.
> But this one works, showing a QuickFixWizardDialog with my resolutions.
>
> It appears that quick fixes are managed in different ways. What I'm
> not sure of, is:
>
> - Ctrl-1 triggering getResolutions in Java editors but NOT in
> Properties editors: is this intended behaviour, or a bug?
> - Is there any way to have the quick fix popup show up in a Properties
> editor? After all, the spell checking engine does it.
>
> Any suggestions (no pun intended :roll: ) are much appreciated.
>
> Angelo
|
|
|
Re: Quick Fix behaviour problem [message #546891 is a reply to message #546868] |
Wed, 14 July 2010 13:52 |
Angelo Tata Messages: 3 Registered: July 2009 Location: Milan, Italy |
Junior Member |
|
|
Hi, Dani, thanks for the answer.
Dani Megert wrote on Wed, 14 July 2010 14:39 | Angelo Tata wrote:
> I implemented quick fixes, through the markerResolution extension point.
> For markers in the Java editor, Ctrl-1 correctly shows the popup with
> my resolutions.
> For markers in the Properties editor, the popup says "No suggestions
> available" (getResolutions doesn't get called).
Only the Java editor supports Quick Fix and Quick Assist out of the box.
The other textual editors only support spelling problems unless they
provide their own quick fix processor.
Dani
|
I thought as much (the extension point I was using had, after all, "jdt" in its name).
In fact, I saw that the spelling processor does not use JDT classes (obviously) but JFace's (implements org.eclipse.jface.text.quickassist.IQuickAssistProcessor).
Could you give me a pointer on how to add a Quick Fix Processor to an existing editor (if at all possible)? I found no available extension point for this purpose.
Or should I write my own editor, maybe extending some existing one, only to plug in it my own Quick Fix processor?
Angelo
|
|
|
Re: Quick Fix behaviour problem [message #546903 is a reply to message #546891] |
Wed, 14 July 2010 14:31 |
Dani Megert Messages: 3802 Registered: July 2009 |
Senior Member |
|
|
Angelo Tata wrote:
> Hi, Dani, thanks for the answer.
>
> Dani Megert wrote on Wed, 14 July 2010 14:39
>> Angelo Tata wrote:
>> > I implemented quick fixes, through the markerResolution extension
>> point.
>> > For markers in the Java editor, Ctrl-1 correctly shows the popup
>> with > my resolutions.
>> > For markers in the Properties editor, the popup says "No
>> suggestions > available" (getResolutions doesn't get called).
>>
>> Only the Java editor supports Quick Fix and Quick Assist out of the
>> box. The other textual editors only support spelling problems unless
>> they provide their own quick fix processor.
>>
>> Dani
>
>
>
> I thought as much (the extension point I was using had, after all,
> "jdt" in its name).
> In fact, I saw that the spelling processor does not use JDT classes
> (obviously) but JFace's (implements
> org.eclipse.jface.text.quickassist.IQuickAssistProcessor).
>
> Could you give me a pointer on how to add a Quick Fix Processor to an
> existing editor (if at all possible)?
This is not possible.
> I found no available extension point for this purpose.
> Or should I write my own editor, maybe extending some existing one,
> only to plug in it my own Quick Fix processor?
Take a look at
org.eclipse.ui.editors.text.TextSourceViewerConfiguration.ge tQuickAssistAssistant(ISourceViewer)
and how it's implemented. From there you need to figure out how to write
your own processor that knows about your annotations.
Dani
>
>
> Angelo
|
|
|
Goto Forum:
Current Time: Thu Apr 18 23:16:09 GMT 2024
Powered by FUDForum. Page generated in 0.03531 seconds
|