Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Maintaining shape properties after closing the diagram
Maintaining shape properties after closing the diagram [message #1117308] Thu, 26 September 2013 09:51 Go to next message
Fabio Messina is currently offline Fabio MessinaFriend
Messages: 9
Registered: July 2013
Junior Member
Hello.

In my Graphiti project I use shape properties to trace some elements which have no business objects linked to them.
In my add feature I have the following code.

AddActivationRectangleFeature.java
Property property = MmFactory.eINSTANCE.createProperty();
property.setKey("type");
property.setValue("activationrectangle");
containerShape.getProperties().add(0, property);


...and in my feature provider I do the selection in order to return some customized features.

if (!pictogramElement.getProperties().isEmpty() && pictogramElement.getProperties().get(0).getValue() == "activationrectangle") {
	return new LayoutActivationRectangleFeature(this);
	}


This seemed to work well: when i try to resize my activation rectangle the right LayoutFeature is returned and I have my custom behaviour.

But (the problem) I noticed that this does not work when I open my diagram for later edits. It looks like shape properties are lost after I close the diagram file.
Why? How can I manage to return the right features if I cant count on properties?

Thank you.
Re: Maintaining shape properties after closing the diagram [message #1121120 is a reply to message #1117308] Mon, 30 September 2013 09:37 Go to previous messageGo to next message
Albert Hofkamp is currently offline Albert HofkampFriend
Messages: 41
Registered: August 2009
Member
Testing string equality with object identity seems a bit dangerous to me, does changing == to .equals solve your problem?

A check you also may want to do is whether your properties get stored in the file, that is, is there an xml node with "activationrectangle" in it?
Re: Maintaining shape properties after closing the diagram [message #1122066 is a reply to message #1121120] Tue, 01 October 2013 07:42 Go to previous message
Fabio Messina is currently offline Fabio MessinaFriend
Messages: 9
Registered: July 2013
Junior Member
Albert Hofkamp wrote on Mon, 30 September 2013 05:37
Testing string equality with object identity seems a bit dangerous to me, does changing == to .equals solve your problem?


You're absolutely right. My fault, I was sure that there was an overloading of the == operator for String objects but it isn't so. That's why it worked only inside a session... i was checking for equality of the references.

Thank you very much. Solved.
Previous Topic:Delete of pictogram element using keyboard is not working
Next Topic:Faster way of removing graphiti elements
Goto Forum:
  


Current Time: Thu Apr 25 18:03:36 GMT 2024

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

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

Back to the top