Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Call quickfix validation from Problems View
Call quickfix validation from Problems View [message #1807321] Tue, 28 May 2019 07:25 Go to next message
Martin Jedlicka is currently offline Martin JedlickaFriend
Messages: 121
Registered: January 2016
Senior Member
Hi,

I have a question on xtext, validace and quickfixes.

We have defined validations in xtext. I have defined quickfix (Ctrl + 1) for the validation. This works fine.

validation:
warning("Component version is deprecated", ProcessDesignerPackage.eINSTANCE.componentVersionElement_Version, DEPRECATED_VERSION)


quickfix:
@Fix(ProcessDesignerValidator.DEPRECATED_VERSION)
	public void removeDeprecatedVersion(final Issue issue, IssueResolutionAcceptor acceptor) {
		acceptor.accept(issue, REMOVE_COMPONENT_VERSION, REMOVE_COMPONENT_VERSION, null, new ISemanticModification() {
			@Override
			public void apply(EObject element, IModificationContext context) throws Exception {
				...
			}
		});
	}


The validation result defined in xtext is also displayed in Problems View. However, if I want to call quickfix from Problems View (via the right button),
this is not possible because the menu item is disabled.

How to call (enable) quickfix validation from Problems View?

Thanks for every advice.

Martin
Re: Call quickfix validation from Problems View [message #1807322 is a reply to message #1807321] Tue, 28 May 2019 07:27 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13062
Registered: July 2009
Senior Member
hi, which menu item do you refer to?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Call quickfix validation from Problems View [message #1807324 is a reply to message #1807322] Tue, 28 May 2019 07:37 Go to previous messageGo to next message
Martin Jedlicka is currently offline Martin JedlickaFriend
Messages: 121
Registered: January 2016
Senior Member
I mean the item Quick Fix (Ctrl + 1) in menu using the right mouse button to validate, which is disabled. You may still need to refer to the quickfix from Problmes View, I don't know.
Re: Call quickfix validation from Problems View [message #1807326 is a reply to message #1807324] Tue, 28 May 2019 07:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13062
Registered: July 2009
Senior Member
hmmm i cannot follow you. from the snippet you posted that should work.
are you sure you rebuilt the project after implementing the quickfix?
does the quickfix work in the editor?


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Call quickfix validation from Problems View [message #1807348 is a reply to message #1807326] Tue, 28 May 2019 11:24 Go to previous messageGo to next message
Martin Jedlicka is currently offline Martin JedlickaFriend
Messages: 121
Registered: January 2016
Senior Member
In xtext editor work but in Problems is disabled (see image)

https://firsoft.cz/images/xtext.png
Re: Call quickfix validation from Problems View [message #1807356 is a reply to message #1807348] Tue, 28 May 2019 12:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13062
Registered: July 2009
Senior Member
i cannot reproduced that.
you might want to debug
org.eclipse.ui.internal.views.markers.QuickFixPropertyTester
respectively org.eclipse.xtext.ui.editor.quickfix.MarkerResolutionGenerator.hasResolutions(IMarker)

=> can you provide a hello world example reproducing the problem
=> can you also provide details about your system (Help -> About -> Installation Details -> Configuration
=> can you also have a look into the error log if there are any issues.


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Call quickfix validation from Problems View [message #1807391 is a reply to message #1807356] Wed, 29 May 2019 07:45 Go to previous messageGo to next message
Martin Jedlicka is currently offline Martin JedlickaFriend
Messages: 121
Registered: January 2016
Senior Member
Perhaps important information is that xText is linked to Sirius (https://github.com/ObeoNetwork/Xtext-Sirius-integration).
The validations defined in Sirius can be corrected from Problems (using quickfix).

I tried to make a debug. In the MarkerHelpRegistry class, the hasResolutions method returns everywhere
on MarkerQueryResult result = query.performQuery(marker) null, so the marker will not find it in resolutionQueries.
Therefore, it returns hasResolutions false.

Unfortunately I cannot provide the project, it is quite extensive. There are no log errors.
Re: Call quickfix validation from Problems View [message #1807393 is a reply to message #1807391] Wed, 29 May 2019 07:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13062
Registered: July 2009
Senior Member
=> debug into the internals of MarkerHelpRegistry

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Call quickfix validation from Problems View [message #1807396 is a reply to message #1807393] Wed, 29 May 2019 08:21 Go to previous messageGo to next message
Martin Jedlicka is currently offline Martin JedlickaFriend
Messages: 121
Registered: January 2016
Senior Member
Sorry, but I don't get it now. I did the Debug in MarkerHelpRegistry. See previous message.
Re: Call quickfix validation from Problems View [message #1807397 is a reply to message #1807396] Wed, 29 May 2019 08:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13062
Registered: July 2009
Senior Member
yes but in my case MarkerHelpRegistry asks org.eclipse.xtext.ui.editor.quickfix.MarkerResolutionGenerator.hasResolutions(IMarker)
and it says yes.
you have to find out why it does not in your case


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Call quickfix validation from Problems View [message #1807398 is a reply to message #1807397] Wed, 29 May 2019 08:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13062
Registered: July 2009
Senior Member
here is the stack

MarkerResolutionGenerator.hasResolutions(IMarker) line: 84
MarkerHelpRegistry.hasResolution(IMarker, IConfigurationElement) line: 202
MarkerHelpRegistry.hasResolutions(IMarker) line: 171
QuickFixPropertyTester.test(Object, String, Object[], Object) line: 40
Property.test(Object, Object[], Object) line: 65


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Call quickfix validation from Problems View [message #1807401 is a reply to message #1807398] Wed, 29 May 2019 08:46 Go to previous message
Martin Jedlicka is currently offline Martin JedlickaFriend
Messages: 121
Registered: January 2016
Senior Member
I figured it out. The error was in the definition of extension markerResolutionGenerator, where there was a bad (unknown) markerType.

Thanks a lot for your help!
Previous Topic:How to open model file in text editor programmatically
Next Topic:Inferring a class with generics in JvmModelInferrer
Goto Forum:
  


Current Time: Mon Aug 19 14:21:09 GMT 2019

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

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

Back to the top