Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Quick Fix behaviour problem(Different behaviour when invoked from Java editors or other ones)
icon5.gif  Quick Fix behaviour problem [message #546116] Sun, 11 July 2010 09:10 Go to next message
Angelo Tata is currently offline Angelo TataFriend
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 Rolling Eyes ) are much appreciated.

Angelo
Re: Quick Fix behaviour problem [message #546145 is a reply to message #546116] Sun, 11 July 2010 16:51 Go to previous messageGo to next message
Angelo Tata is currently offline Angelo TataFriend
Messages: 3
Registered: July 2009
Location: Milan, Italy
Junior Member
Just an update: the "No suggestions available" popup which was triggered by Ctrl-1 on my marker when in a Properties editor was only the Spell Checking one: I disabled spell checking, and now Ctrl-1 does exactly nothing.

Right clicking on the word in the editor does not show a "Quick fix" item in the context menu.
My marker is present in both the Problems and Markers view, though, and right clicking on it there shows a "Quick fix" item in that context menu.

I tried also implementing a Quick Fix processor, through the org.eclipse.jdt.ui.quickFixProcessors extension point. Again, it does work in a Java editor, but does not get triggered in the Properties editor.

Running out of ideas...
Re: Quick Fix behaviour problem [message #546868 is a reply to message #546116] Wed, 14 July 2010 12:39 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
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 Go to previous messageGo to next message
Angelo Tata is currently offline Angelo TataFriend
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 Go to previous message
Dani Megert is currently offline Dani MegertFriend
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
Previous Topic:Problem with building referenced projects on Helios
Next Topic:Preventing modify -> rename-the-file -> save exception
Goto Forum:
  


Current Time: Thu Apr 18 23:16:09 GMT 2024

Powered by FUDForum. Page generated in 0.03531 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top