Modifying EditPart classes ro reflect priority

1 view
Skip to first unread message

Behnaz Changizi

unread,
Oct 4, 2011, 8:27:23 AM10/4/11
to reo...@googlegroups.com
Hi Christian,
I am adding two new properties to channels to deal with priority. The idea
is that to use properties instead of having different channels for
prioritized and the blocking priority. I have edited the ecore file and
generated the required code for editor and I can see the properties in the
editor.
Now I am changing the graphical representation to show the priority. So if
the "prioritized" property is set to true I would like to slightly change
the channel appearance. The closest example I could find is the FIFO channel
and its appropriate changes when the "Full" property is modified.
So I think I need to change createConnectionFigure method in each
channel"EditPart" class. Now the question is:
*These classes are extended from a ConnectionNodeEditPart class and
implementing ITreeBranchEditPart and there is no hierarchy among them, so it
seems I need to add my code to each of them separately. I am going to introduce
a new interface and add the code there and make all these classes implement that interface.
I was wondering if it is a safe decision to apply such changes to the ECT architecture.
Thank you,
Behnaz

Christian Krause

unread,
Oct 6, 2011, 5:01:11 AM10/6/11
to reo...@googlegroups.com
Hi Behnaz,

I don't have much time right now, so just a short answer:

Yes, you are right about the EditParts -- they do not inherit from a
common super class. Therefore, my suggesstion is that ypu create a
separate utility class for the priority extension of channel editparts.
I do not exactly remember how I implemented it for the FIFO channel, but
my suggestion for now would be that you averride in all relevant
editparts the mathod handleNotification() or something similar (just
look up the methods in the editparts). This method is called whenever a
property of the underlying model is changed. In this method you can call
a static method in your new utility class which updates the figure based
on the domain model. So this method needs access to the channel itself
and the figure. Besides the "handle.." method, you also need to override
a method for the figure creation, I guess something like
createConnectionFigure. This is necessary because in the beginning no
notification is triggered.

Anyway, my suggestion is that you put all new code in a separate class,
and override only the mentioned two methods in the editpart, which
should then invoke code from the new utility class. Please take the
overridden methods in the editparts with @generated NOT, and just write
one or two lines of comments in the utility class. If you have any
further questions, let me know.

Cheers,
Christian

Christian Krause

unread,
Oct 6, 2011, 5:05:32 AM10/6/11
to reo...@googlegroups.com
One more tip: try first to get the update functionality wrking, e.g.
just change the foreground color of the channels in the beginning. So if
you change a property, you should see an effect in the diagram. When
that works, you can add fancy channel decorations etc.

Am 04.10.2011 14:27, schrieb Behnaz Changizi:

Reply all
Reply to author
Forward
0 new messages