Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Quick fixes for CompleteOCLEObjectValidator?(How to access OCL validation issues from within the quick fix provider?)
Quick fixes for CompleteOCLEObjectValidator? [message #725268] Wed, 14 September 2011 11:47 Go to next message
Jonatan Antoni is currently offline Jonatan AntoniFriend
Messages: 18
Registered: December 2010
Location: Frankfurt/Main
Junior Member
Hello,

I am evaluating OCL for model validation.

Thus far I have enriched the FowlerDSL example with a simple OCL check in Statemachine.ocl

import '../../../../../../src-gen/org/eclipse/xtext/example/fowlerdsl/Statemachine.ecore'

package statemachine 

	context State
	inv UniqueEvents : transitions->isUnique(event)

endpackage 


loaded by the StatemachineJavaValidator during registration

@Override
public void register(EValidatorRegistrar registrar) {
	super.register(registrar);
	StatemachinePackage ePackage = StatemachinePackage.eINSTANCE;
	URI oclURI = URI.createPlatformResourceURI("/org.eclipse.xtext.example.fowlerdsl/src/org/eclipse/xtext/example/fowlerdsl/Statemachine.ocl", true);
	registrar.register(ePackage, new CompleteOCLEObjectValidator(ePackage, oclURI));
}


This successfully leads to a warning when a state has multiple transitions with the same event.

Now I want to implement some quick fixes for that issue but failed, yet.

All the examples for *QuickfixProvider make use of the @Fix annotation. The annotation requires the issue string to match for. For the OCL validation rules I have no issue strings found, yet.

How can I implement quick fixes for OCL validation rules?

Thanks,
Jonatan
Re: Quick fixes for CompleteOCLEObjectValidator? [message #725407 is a reply to message #725268] Wed, 14 September 2011 17:23 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

guess this is not possible since the ocl stuff does not provide somthing that extends AbstractValidationDiagnostic. maybe you can fix the ocl code or provide a own
IDiagnosticConverter that sets a code to the issues for BasicDiagnostics as
Xtext does it for AbstractValidationDiagnostics

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Override Xtext editor's doSetInput() method
Next Topic:How can I define constructors in xtend class files?
Goto Forum:
  


Current Time: Fri Apr 26 09:07:46 GMT 2024

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

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

Back to the top