Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » org.eclipse.graphiti.features.impl.AbstractFeatureProvider.getPictogramElementForBusinessObject(Obje
org.eclipse.graphiti.features.impl.AbstractFeatureProvider.getPictogramElementForBusinessObject(Obje [message #1256609] Tue, 25 February 2014 16:03 Go to next message
Andreas Graf is currently offline Andreas GrafFriend
Messages: 211
Registered: July 2009
Senior Member
Hi all,

I am having a little conceptual problem with the above method (Graphit 0.9).
Its body is

if (businessObject instanceof EObject) {
			Diagram diagram = getDiagramTypeProvider().getDiagram();
			if (diagram != null) {
				Collection<PictogramLink> pictogramLinks = diagram.getPictogramLinks();
				for (PictogramLink pictogramLink : pictogramLinks) {
					List<EObject> businessObjects = pictogramLink.getBusinessObjects();
					for (EObject obj : businessObjects) {
						if (getDiagramTypeProvider().getCurrentToolBehaviorProvider().equalsBusinessObjects(businessObject, obj)) {
							PictogramElement pe = pictogramLink.getPictogramElement();
							if (pe != null) {
								result = pe;
							}
							break;
						}
					}
					if (result != null) {
						break;
					}
				}
			}
		} 

Doesn't tha mean that it will find only Business Objects linked to the diagram? Is that intended?
Re: org.eclipse.graphiti.features.impl.AbstractFeatureProvider.getPictogramElementForBusinessObject( [message #1258654 is a reply to message #1256609] Thu, 27 February 2014 15:59 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Andreas,

no, it does not mean that.

I guess what you are concerned about is the line Collection<PictogramLink>
pictogramLinks = diagram.getPictogramLinks();. The links are stored in a
special diagram links association directly on diagram level not on the
individual shapes. It's designed as one list containing all links for a
diagram, one link again has references to a shape and a domain object.

Michael
Re: org.eclipse.graphiti.features.impl.AbstractFeatureProvider.getPictogramElementForBusinessObject( [message #1258843 is a reply to message #1258654] Thu, 27 February 2014 20:32 Go to previous messageGo to next message
Andreas Graf is currently offline Andreas GrafFriend
Messages: 211
Registered: July 2009
Senior Member
Hi Michael,

in our diagrams, this section is quite empty (1 entry), though we do have a lot of links. They are directly stored at the pictogram elements.

e.g. org.eclipse.graphiti.internal.services.impl.LinkServiceImpl.getLinkForPictogramElement(PictogramElement) does access the getLink() of the PictogramElement and not of the link section? I am not quite understanding how they are related?

Best Regards,

Andreas
Re: org.eclipse.graphiti.features.impl.AbstractFeatureProvider.getPictogramElementForBusinessObject( [message #1410371 is a reply to message #1258843] Wed, 20 August 2014 15:17 Go to previous messageGo to next message
Al B is currently offline Al BFriend
Messages: 47
Registered: June 2012
Member
I'm having a problem with this method as well.

One of our business object <A> includes a containment reference to an EMF object <B>; which contributes 2 attributes to its container <A>. When any of those 2 attributes are changed, the getAllPictogramElementsForBusinessObject() method is called with object <B> as a parameter. However, since <B> is contained by <A> so pictogramLink.getBusinessObjects() only returns <A> and hence getDiagramTypeProvider().getCurrentToolBehaviorProvider().equalsBusinessObjects(businessObject, obj) is never equal.

Is there workaround to handle containment reference as business object with Graphiti?

Or, do I need to override the getAllPictogramElementsForBusinessObject() method and handle this case scenario myself?
Re: org.eclipse.graphiti.features.impl.AbstractFeatureProvider.getPictogramElementForBusinessObject( [message #1412941 is a reply to message #1410371] Wed, 27 August 2014 11:56 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Overriding getAllPictogramElementsForBusinessObject() would be an option,
but maybe also implementing your own logic for that object comparision in
equalsBusinessObjects() in your tool behavior provider would b e sufficient
as well.

Michael
Previous Topic:Creating Graphiti based plugin project
Next Topic:Connection Decorator with Text
Goto Forum:
  


Current Time: Tue Mar 19 03:26:55 GMT 2024

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

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

Back to the top