Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Validation on save(Triggering a batch validation on save)
Validation on save [message #1748876] Tue, 29 November 2016 16:18 Go to next message
Philipp Faller is currently offline Philipp FallerFriend
Messages: 3
Registered: November 2016
Junior Member
Hello,
I wanted to use the EMF Validation in my plug-in to force the users to fulfill some requirements the model must meet. These constraints are mandatory for the way my plug-in saves informations about the model.

It would be sufficient if my constraints were only checked once before the users tries to save the model. But I couldn't figure out how to trigger a batch validation from the project builder nor from a resource changed listener.

Thanks for you suggestions.

Regards
Philipp
Re: Validation on save [message #1748925 is a reply to message #1748876] Wed, 30 November 2016 08:53 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 392
Registered: December 2015
Senior Member
Think twice before really doing this. It could be useful to save the model in an invalid state, for example people who gtfh might want to fix problems the next day. Now that you're sure you really want this, do you not know where to place the validation trigger, or do you not know how the trigger code itself should look like?
Re: Validation on save [message #1749058 is a reply to message #1748925] Thu, 01 December 2016 14:11 Go to previous message
Philipp Faller is currently offline Philipp FallerFriend
Messages: 3
Registered: November 2016
Junior Member
Thank you for your answer.

Yes it is necessary that there are no invalid states in the saved model.

Actually both. I'm not absolutely shure where to place the trigger and I don't know how to trigger it.

Concerning the place, I thought about the project builder or a resource listener.

To trigger the validation, I tried the diagnostician. But it's validate() method expects the root of the validated model and I don't know how to access the root from both, the project builder and the resource listener.
I also tried executing the org.eclipse.papyrus.validation.ValidateModelCommand (I use Papyrus and have the dependencies included). But the command wouldn't execute because it was disabled.
Previous Topic:Control Flow Graph Meta-model
Next Topic:Creating OrderBy annotation for OneToMany
Goto Forum:
  


Current Time: Thu Apr 25 00:51:06 GMT 2024

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

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

Back to the top