Disabling EMF notification in a compound command [message #419724] |
Wed, 04 June 2008 06:07 |
Charles H Martin Messages: 79 Registered: July 2009 |
Member |
|
|
I would like to disable EMF notifications as part of a compound set command. I have a compound command, where I set a member of a list as "selected" (and the previous member unselected)
I would like to turn off the EMF notifications when I set the member "unselected"
For example, I have an abstract command with the construcor:
public SetMemberSelectedCmd(App app, Member member) {
EList<MyList> myList = app.getChain();
for (Member member: myList) {
if (member.getSelected())
append (new SetCommand(domain, member, Package.eINSTANCE.getMember_Selected, new Boolean(false));
}
append (new SetCommand(domain, member, Package.eINSTANCE.getMember_Selected, new Boolean(true));
}
|
|
|
Re: Disabling EMF notification in a compound command [message #419731 is a reply to message #419724] |
Wed, 04 June 2008 12:04 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
Charles,
Comments below.
Charles Martin wrote:
> I would like to disable EMF notifications as part of a compound set command. I have a compound command, where I set a member of a list as "selected" (and the previous member unselected)
>
> I would like to turn off the EMF notifications when I set the member "unselected"
>
> For example, I have an abstract command with the construcor:
>
> public SetMemberSelectedCmd(App app, Member member) {
> EList<MyList> myList = app.getChain();
> for (Member member: myList) {
> if (member.getSelected())
> append (new SetCommand(domain, member, Package.eINSTANCE.getMember_Selected, new Boolean(false));
>
Package.Literals.MEMBER_SELECTED would work well. Boolean.FALSE is
better too. You could create an inner class for SetCommand, and
override doExecute, doUndo, and doRedo so that you do
member.eSetDeliver(false)/member.eSetDeliver(true) around the call to
super (probably using a try finally to ensure that it can't get
permanently messed up).
> }
>
> append (new SetCommand(domain, member, Package.eINSTANCE.getMember_Selected, new Boolean(true));
>
> }
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03151 seconds