Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Graphiti . EMF Validation
Graphiti . EMF Validation [message #992326] Fri, 21 December 2012 06:08 Go to next message
Rui Domingues is currently offline Rui Domingues
Messages: 162
Registered: October 2010
Senior Member
Hi. I want to validate my diagram underlying model, create markers, and through those create decorations.

As far as I can see there is some ways of doing validation :ocl in plugin.xml and with JAVA.

I really need some help to understand what I need to do, because from what I've read we need also to install project natures.

Can anyone explain with minor samples what it is necessary to implement validation, then create markers and then use Graphiti to render decorators.

It's something confuse for me right now.

Thanks in advance.
Rui
Re: Graphiti . EMF Validation [message #992390 is a reply to message #992326] Fri, 21 December 2012 09:26 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1267
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Rui,

I don't have samples at hand, but maybe the basic steps needed for this
already help:

1) You need to start the validation of your model according to the
technology you use, e.g. EMF Validation. This might happen on saving a
diagram, saving other model content or simply on file change using an
Eclipse project builder
2) Within that validation job you would create markers for those files that
contain the erroneous object. You should define your own marker type for
this (AFAIK there's also an Eclipse extension point to define markers) and
provide some means within these markers that allo you to identify which
objects are erroneous (this is done using serializable properties in the
markers)
3) When the editor opens, Graphiti queries for markers for all shape by
calling the getDecorators method in the tool behavior provider. There you
would check for each passed shape which domain object it represents and
check if there is a marker for that object.

HTH,
Michael
Re: Graphiti . EMF Validation [message #997062 is a reply to message #992390] Thu, 03 January 2013 09:12 Go to previous messageGo to next message
Rui Domingues is currently offline Rui Domingues
Messages: 162
Registered: October 2010
Senior Member


Hi Michael. Thank you very much for answering, but I need some clarification, if you can.

I've already defined a IValidationListener implementation, an IClientSelector, and in plugin.xml, I defined the extension points below:
point="org.eclipse.core.resources.markers"
point="org.eclipse.emf.validation.constraintBindings">
point="org.eclipse.emf.validation.validationListeners">
<listener class="validation.ProblemsReporter">
</listener>

and some live constraints which implementation also takes care of batch validation.

I checked through ValidationListener that it is validating, and I'm writing the message in the status bar. At the same place I'm trying to create my marker. is here the proper place? How do I add extra attributes? I 'm using MarkerUtil.

Other thing: I also want that when I click in the marker, the editpart is selected, however, it opens the model file in text mode. I also extended my editor from IGotoMarker, but the method is not invoked. Can anyone help me?

Thanks in advance



Re: Graphiti . EMF Validation [message #997256 is a reply to message #997062] Fri, 04 January 2013 13:18 Go to previous messageGo to next message
Rui Domingues is currently offline Rui Domingues
Messages: 162
Registered: October 2010
Senior Member
Ok. My Problem now is to do something like this.
On marker click (got to), I want to select shape in diagram? How can I do that.
My editor implements Igotomarker, but it is not reaching this method.

Thanks
Re: Graphiti . EMF Validation [message #1003927 is a reply to message #997256] Tue, 22 January 2013 04:01 Go to previous message
Felix Velasco is currently offline Felix Velasco
Messages: 25
Registered: July 2009
Junior Member
Besides implementing IGotoMoarker, you have to add a property to the marker, to identify the editor, something like:
marker.setAttribute(IDE.EDITOR_ID_ATTR, DiagramEditor.DIAGRAM_EDITOR_ID);

Make sure to use your own editor id if you've subclassed graphiti's.
Previous Topic:Custom Save
Next Topic:Adding Root Domain Object on Diagram Creation
Goto Forum:
  


Current Time: Sun May 19 13:46:54 EDT 2013

Powered by FUDForum. Page generated in 0.01604 seconds