Skip to main content



      Home
Home » Modeling » EMF » ChangeCommand.getAffectedObjects()
ChangeCommand.getAffectedObjects() [message #1706808] Mon, 31 August 2015 06:21 Go to next message
Eclipse UserFriend
Hi

I've just noted that ChangeCommand does not implement
getAffectedObjects, so it will always return an empty list (the default
implementation).

I would have expected an implementation like, e.g.,

@Override
public Collection<?> getAffectedObjects() {
Set<EObject> changeDescriptionObjects =
changeDescription.getObjectChanges().keySet();

return changeDescriptionObjects;
}

so I was wondering why it is not implemented at all...

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
Re: ChangeCommand.getAffectedObjects() [message #1706976 is a reply to message #1706808] Tue, 01 September 2015 05:18 Go to previous messageGo to next message
Eclipse UserFriend
Lorenzo,

It's not so clear that this would produce the desired selection
behavior. I.e., when you add an object via an AddCommand, the added
object is the affected object, and after your undo, it's the parent.
When doing this with a change recorder, the changed object is likely
always the parent. It's probably better the client spend some time
thinking about what selection behavior they'd like to see...


On 31/08/2015 12:21 PM, Lorenzo Bettini wrote:
> Hi
>
> I've just noted that ChangeCommand does not implement
> getAffectedObjects, so it will always return an empty list (the default
> implementation).
>
> I would have expected an implementation like, e.g.,
>
> @Override
> public Collection<?> getAffectedObjects() {
> Set<EObject> changeDescriptionObjects =
> changeDescription.getObjectChanges().keySet();
>
> return changeDescriptionObjects;
> }
>
> so I was wondering why it is not implemented at all...
>
> cheers
> Lorenzo
>
Re: ChangeCommand.getAffectedObjects() [message #1707015 is a reply to message #1706976] Tue, 01 September 2015 09:58 Go to previous messageGo to next message
Eclipse UserFriend
On 01/09/2015 11:18, Ed Merks wrote:
> Lorenzo,
>
> It's not so clear that this would produce the desired selection
> behavior. I.e., when you add an object via an AddCommand, the added
> object is the affected object, and after your undo, it's the parent.
> When doing this with a change recorder, the changed object is likely
> always the parent. It's probably better the client spend some time
> thinking about what selection behavior they'd like to see...

OK, I see.

But in a ChangeCommand, by parent you mean the object you pass to the
ChangeCommand constructor, for instance?

Thank you Ed.

cheers
Lorenzo

>
>
> On 31/08/2015 12:21 PM, Lorenzo Bettini wrote:
>> Hi
>>
>> I've just noted that ChangeCommand does not implement
>> getAffectedObjects, so it will always return an empty list (the default
>> implementation).
>>
>> I would have expected an implementation like, e.g.,
>>
>> @Override
>> public Collection<?> getAffectedObjects() {
>> Set<EObject> changeDescriptionObjects =
>> changeDescription.getObjectChanges().keySet();
>>
>> return changeDescriptionObjects;
>> }
>>
>> so I was wondering why it is not implemented at all...
>>
>> cheers
>> Lorenzo
>>
>


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
Re: ChangeCommand.getAffectedObjects() [message #1707069 is a reply to message #1707015] Wed, 02 September 2015 00:59 Go to previous message
Eclipse UserFriend
I mean the changed object is the object that was added to not the object
that was added. The object passed in the constructor might not even be
objects that are changed, but rather some deeply nested descendant,
i.e., you could pass in the whole resource set on the constructor and
change anything.

On 01/09/2015 3:58 PM, Lorenzo Bettini wrote:
> OK, I see.
>
> But in a ChangeCommand, by parent you mean the object you pass to the
> ChangeCommand constructor, for instance?
Previous Topic:<appinfo> tag not generated during model export to XSD
Next Topic:Metamodel registration
Goto Forum:
  


Current Time: Wed Jul 23 14:13:26 EDT 2025

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

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

Back to the top