Home » Modeling » EMF » ChangeCommand.getAffectedObjects()
|
Re: ChangeCommand.getAffectedObjects() [message #1706976 is a reply to message #1706808] |
Tue, 01 September 2015 05:18   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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?
|
|
|
Goto Forum:
Current Time: Wed Jul 23 02:28:39 EDT 2025
Powered by FUDForum. Page generated in 0.08379 seconds
|