Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Disabling EMF notification in a compound command
Disabling EMF notification in a compound command [message #419724] Wed, 04 June 2008 06:07 Go to next message
Charles H Martin is currently offline Charles H MartinFriend
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 Go to previous message
Ed Merks is currently offline Ed MerksFriend
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/
Previous Topic:Customizing CopyCommand to avoid controlled sub-models
Next Topic:Escaping special chars in eAnnotations via Rose
Goto Forum:
  


Current Time: Thu Apr 25 15:42:07 GMT 2024

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

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

Back to the top