Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Finer grained quickfixes possible?
Finer grained quickfixes possible? [message #881305] Mon, 04 June 2012 10:07 Go to next message
Hendrik Eeckhaut is currently offline Hendrik EeckhautFriend
Messages: 26
Registered: July 2009
Junior Member
Hi,

I want to implement a quickfix that only applies (for a certain issueCode) depending on extra data. For example: "library ieee;" should be quickfixable, but "library myLib;" not.

I can not find a way to do this in Xtext, except for giving a different issueCode for the libraries that can be fixed. I do not like this approach. It is not the responsability of the validator to know what can be fixed and what not (yet).

In Eclipse the method to check for quickfixes is hasResolution(IMarker...) but in Xtext it is hasResolutionFor(String issueCode). Why is this method not simply hasResolutionFor(Issue issue), so you check some extra data of the issue?

Thanks,
Hendrik.
Re: Finer grained quickfixes possible? [message #881410 is a reply to message #881305] Mon, 04 June 2012 13:53 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3108
Registered: July 2009
Senior Member
Hi Hendrik,

a workaround would be the following:

Override
org.eclipse.xtext.ui.editor.quickfix.XtextQuickAssistProcessor.canFix(Annotation)
and
org.eclipse.xtext.ui.editor.quickfix.MarkerResolutionGenerator.hasResolutions(IMarker)

which could both delegate to a custom IssueResolutionProvider that
accepts the Issue.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 04.06.12 12:07, schrieb Hendrik Eeckhaut:
> Hi,
>
> I want to implement a quickfix that only applies (for a certain
> issueCode) depending on extra data. For example: "library ieee;" should
> be quickfixable, but "library myLib;" not.
>
> I can not find a way to do this in Xtext, except for giving a different
> issueCode for the libraries that can be fixed. I do not like this
> approach. It is not the responsability of the validator to know what can
> be fixed and what not (yet).
>
> In Eclipse the method to check for quickfixes is
> hasResolution(IMarker...) but in Xtext it is hasResolutionFor(String
> issueCode). Why is this method not simply hasResolutionFor(Issue issue),
> so you check some extra data of the issue?
>
> Thanks,
> Hendrik.
Re: Finer grained quickfixes possible? [message #881721 is a reply to message #881410] Tue, 05 June 2012 06:46 Go to previous messageGo to next message
Hendrik Eeckhaut is currently offline Hendrik EeckhautFriend
Messages: 26
Registered: July 2009
Junior Member
I could not get this to work with our current Xtext snapshot target (February). I saw that there were multiple changes in this area in the commit logs. So I will try again later this week with Xtext head.

Thanks for helping me out,
Hendrik.
Re: Finer grained quickfixes possible? [message #885094 is a reply to message #881721] Tue, 12 June 2012 13:09 Go to previous messageGo to next message
Hendrik Eeckhaut is currently offline Hendrik EeckhautFriend
Messages: 26
Registered: July 2009
Junior Member
Hi Sebastian,

this only partially works. This allows quickfixes in the problems view, but not in the editor. As far as I can see the quickfix-abiliy is determined in the
getAnnotationsToAdd
method in
AnnotationIssueProcessor
. It does not look like I can easily modify that.

Any suggestions?

Thanks,
Hendrik.
Re: Finer grained quickfixes possible? [message #885131 is a reply to message #885094] Tue, 12 June 2012 14:05 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3108
Registered: July 2009
Senior Member
You are right, I missed that.

You'd have to override
AnnotationIssueProcessor.getAnnotationsToAdd(Multimap<Position,
Annotation>, List<Issue>, IProgressMonitor) and use the issue data
there. That's unfortunate. Could you please file a ticket?

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 12.06.12 15:09, schrieb Hendrik Eeckhaut:
> Hi Sebastian,
>
> this only partially works. This allows quickfixes in the problems view,
> but not in the editor. As far as I can see the quickfix-abiliy is
> determined in the getAnnotationsToAdd method in
> AnnotationIssueProcessor. It does not look like I can easily modify that.
>
> Any suggestions?
>
> Thanks,
> Hendrik.
Re: Finer grained quickfixes possible? [message #885539 is a reply to message #885131] Wed, 13 June 2012 07:56 Go to previous message
Hendrik Eeckhaut is currently offline Hendrik EeckhautFriend
Messages: 26
Registered: July 2009
Junior Member
OK. Filed id=382461

Thanks,
Hendrik.
Previous Topic:XtextResource loading with JvmTypes and importURI
Next Topic:XTend 2.2.1 installation broken? (NPE at BuilderParticipant.java:184)
Goto Forum:
  


Current Time: Fri Oct 30 05:49:17 GMT 2020

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

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

Back to the top