Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » many editpolicies with the same role for the same editpart
many editpolicies with the same role for the same editpart [message #529027] Thu, 22 April 2010 12:37 Go to next message
Alain is currently offline Alain
Messages: 20
Registered: March 2010
Junior Member
during the execution of my GEF application, I can change the layoutmanager of some figures, knowing that I installed 2 editpolicies that inheret from FlowLayoutEditPolicy & XYLayoutEditPolicy in the same editpart.
my question is how to manage these editpolicies with the same role inside the same editpart so that I can move the figures according to its layoutmanager ??
thanks in advance.
Re: many editpolicies with the same role for the same editpart [message #529656 is a reply to message #529027] Mon, 26 April 2010 12:27 Go to previous messageGo to next message
Alain is currently offline Alain
Messages: 20
Registered: March 2010
Junior Member
finally I found that it's not possible :s
because in GEF philosophy, EditParts are limited to have only one EditPolicy per role.
Re: many editpolicies with the same role for the same editpart [message #529673 is a reply to message #529656] Mon, 26 April 2010 13:06 Go to previous messageGo to next message
Mariot Chauvin is currently offline Mariot Chauvin
Messages: 174
Registered: July 2009
Senior Member
Did you have a look to CompoundEditPolicy ?

nd786mar1 a écrit :
> finally I found that it's not possible :s
> because in GEF philosophy, EditParts are limited to have only one
> EditPolicy per role.
Re: many editpolicies with the same role for the same editpart [message #530310 is a reply to message #529673] Thu, 29 April 2010 06:09 Go to previous messageGo to next message
Alain is currently offline Alain
Messages: 20
Registered: March 2010
Junior Member
Do you mean ComponentEditPolicy because I can't find an editpolicy with such name. this policy provide elementary mothods for managing commands.
my simple idea for using many editpolicies with the same editpart:
is to decide when to remove the current editpolicy (for example, according to the change of a model attribute )
removeEditPolicy(EditPolicy.LAYOUT_ROLE)
then install the new editpolicy.
Re: many editpolicies with the same role for the same editpart [message #530359 is a reply to message #530310] Thu, 29 April 2010 09:47 Go to previous message
Mariot Chauvin is currently offline Mariot Chauvin
Messages: 174
Registered: July 2009
Senior Member
Hi,

Comments below.

Marwane a écrit :
> Do you mean ComponentEditPolicy because I can't find an editpolicy with
> such name. this policy provide elementary mothods for managing commands.
> my simple idea for using many editpolicies with the same editpart:
> is to decide when to remove the current editpolicy (for example,
> according to the change of a model attribute )
> removeEditPolicy(EditPolicy.LAYOUT_ROLE)
> then install the new editpolicy.

Sorry this class is not in GEF. I have used it so many times, I forget it.
You could write your own CompoundEditPolicy quite easily, simply create a class which implements EditPolicy which wraps an edit policy list and
for each method iterate on your list, for instance :

public void activate() {
for (EditPolicy editPolicy : editPolicies) {
editPolicy.activate();
}
}


For the getCommand method, simply create a CompoundCommand, and add to it each command result.
Hope this help,

Regards,

Mariot
Previous Topic:[Zest] Create a Nested-Node Link Graph
Next Topic:[zest] Arrows/edges between nested nodes
Goto Forum:
  


Current Time: Sat Aug 02 04:45:03 EDT 2014

Powered by FUDForum. Page generated in 0.01748 seconds