Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forumsmany editpolicies with the same role for the same editpart
https://www.eclipse.org/forums/index.php/mv/msg/166873/529027/#msg_529027
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.]]>Alain2010-04-22T16:37:02-00:00Re: many editpolicies with the same role for the same editpart
https://www.eclipse.org/forums/index.php/mv/msg/166873/529656/#msg_529656
because in GEF philosophy, EditParts are limited to have only one EditPolicy per role.]]>Alain2010-04-26T16:27:26-00:00Re: many editpolicies with the same role for the same editpart
https://www.eclipse.org/forums/index.php/mv/msg/166873/529673/#msg_529673
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.]]>Mariot Chauvin2010-04-26T17:06:21-00:00Re: many editpolicies with the same role for the same editpart
https://www.eclipse.org/forums/index.php/mv/msg/166873/530310/#msg_530310
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.]]>Alain2010-04-29T10:09:32-00:00Re: many editpolicies with the same role for the same editpart
https://www.eclipse.org/forums/index.php/mv/msg/166873/530359/#msg_530359
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,