newcomer question: automatic live validation [message #1775800] |
Mon, 06 November 2017 10:41  |
Eclipse User |
|
|
|
Hello,
I'm a newcomer to EMF validation.
I would like to create a live validation of the EMF model and have worked on the tutorial.
Resource r = (Resource)i.next();
if (!resourceHasAdapter(r)) {
EContentAdapter liveValidationContentAdapter = new LiveValidationContentAdapter();
r.eAdapters().add(liveValidationContentAdapter);
}
I know I need to register the LiveValidationContentAdapter. Unfortunately, I don't know how to get the EMF resource object. Anybody have any idea how to do that? At Google or Stackoverflow I hadn't found any suitable answers yet.
At the end, an editor should be created in which live validation is always activated. This is not like in the example, where it has to be activated via the context menu.
Thank you so much for your help.
Greeting Stephan
|
|
|
Re: newcomer question: automatic live validation [message #1775935 is a reply to message #1775800] |
Wed, 08 November 2017 07:13  |
Eclipse User |
|
|
|
Maybe you should also read the EMF Introduction or the EMF Book? Usually, you enter a model via a ResourceSet, which itself has Resources which contains your EObjects. On top/around the ResourceSet there is another facility, the EditingDomain. If you have an EditingDomain, you can get its associated ResourceSet. You can see all this in the generated editor code.
|
|
|
Powered by
FUDForum. Page generated in 0.07464 seconds