Skip to main content


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 11:08 Go to next message
Rui Domingues is currently offline Rui DominguesFriend
Messages: 194
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 14:26 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
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 14:12 Go to previous messageGo to next message
Rui Domingues is currently offline Rui DominguesFriend
Messages: 194
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 18:18 Go to previous messageGo to next message
Rui Domingues is currently offline Rui DominguesFriend
Messages: 194
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 09:01 Go to previous messageGo to next message
Felix Velasco is currently offline Felix VelascoFriend
Messages: 43
Registered: July 2009
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.
Re: Graphiti . EMF Validation [message #1287387 is a reply to message #992390] Mon, 07 April 2014 18:42 Go to previous messageGo to next message
Simone Di Cola is currently offline Simone Di ColaFriend
Messages: 60
Registered: February 2014
Member
Hi Michael,
could you please explain me this:

"provide some means within these markers that allows you to identify which
objects are erroneous (this is done using serializable properties in the
markers)"

A simple example would be really appreciated Smile

Thanks
Simone

[Updated on: Mon, 07 April 2014 18:50]

Report message to a moderator

Re: Graphiti . EMF Validation [message #1288181 is a reply to message #1287387] Tue, 08 April 2014 10:42 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Simone,

basically, you will need a string serialized into a marker (in the end the
marker is something that is persisted as a file by Eclipse) that you can use
to identify the causing EMF object. This can e.g. be the URI of the EObject.

I hope this helps.

Michael
Re: Graphiti . EMF Validation [message #1288273 is a reply to message #1288181] Tue, 08 April 2014 12:21 Go to previous messageGo to next message
Simone Di Cola is currently offline Simone Di ColaFriend
Messages: 60
Registered: February 2014
Member
Thanks Smile I've used EcoreUtil.getIdentification((EObject) bo) and it works like a charm.

I've another question: where is the best place to remove all the markers associated to a pictogram element that is removed? Since this is a general behaviour, I do not thinks that is correct to repeat to code for every delete feature.

Any suggestion?

Thanks again
Simone
Re: Graphiti . EMF Validation [message #1288437 is a reply to message #1288273] Tue, 08 April 2014 15:02 Go to previous message
Simone Di Cola is currently offline Simone Di ColaFriend
Messages: 60
Registered: February 2014
Member
I've fixed it.
Previous Topic:Create marker and use problem view
Next Topic:Image Decorator problem when adding shapes
Goto Forum:
  


Current Time: Fri Mar 29 02:08:24 GMT 2024

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

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

Back to the top