Home » Modeling » EMF » ChangeCommand.getAffectedObjects()
|
Re: ChangeCommand.getAffectedObjects() [message #1706976 is a reply to message #1706808] |
Tue, 01 September 2015 09:18 |
Ed Merks Messages: 33113 Registered: July 2009 |
Senior Member |
|
|
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
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: ChangeCommand.getAffectedObjects() [message #1707015 is a reply to message #1706976] |
Tue, 01 September 2015 13:58 |
|
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
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
|
Re: ChangeCommand.getAffectedObjects() [message #1707069 is a reply to message #1707015] |
Wed, 02 September 2015 04:59 |
Ed Merks Messages: 33113 Registered: July 2009 |
Senior Member |
|
|
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?
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Goto Forum:
Current Time: Thu Mar 28 18:50:02 GMT 2024
Powered by FUDForum. Page generated in 0.02435 seconds
|