Skip to main content



      Home
Home » Modeling » EMF » newcomer question: automatic live validation
newcomer question: automatic live validation [message #1775800] Mon, 06 November 2017 10:41 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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.
Previous Topic:Deleting Model Elements of an Dynamic Xcore Instance with Sample Reflective Ecore Model Editor
Next Topic:eStructuralFeatureList not returning new added feature
Goto Forum:
  


Current Time: Wed Jul 16 05:09:27 EDT 2025

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

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

Back to the top