Home » Modeling » EMF » Set field value problem
| | | | | |
Re: Set field value problem [message #1702033 is a reply to message #1702009] |
Fri, 17 July 2015 17:19 |
Shin-Yi Lin Messages: 34 Registered: June 2015 |
Member |
|
|
Ed Merks wrote on Fri, 17 July 2015 12:28Comments below.
On 17/07/2015 4:40 AM, Shin-Yi Lin wrote:
> (1) My model structure (I want to change label attribute.):
So the label feature is on a class that's the root of a several other
classes...
----> Yes.
>
>
> (2.1) Before (Child and parent clouds are undecided. Cloud represents NFRSoftgoal class.):
This undecided thing is the default state...
-----> That's right.
>
>
> (2.2) After (After child cloud changes to satisfy through command, parent cloud changes to satisfy automatically.)
Is this via a command that directly modifies the label feature of the
"child"? If so, that's the place to modify the state of the parents,
e.g., using a compound command that modifies the child as normal, and
walks up the parents to modify the parent label also using commands.
What, if anything, prevents the "parent" label from being directly
changed back to undecided (which is perhaps an inconsistent state for
the model)?
-----> I change the label feature of "child" through the red frame in the following pictures (This is under run-time application and Sirius environment.):
-----> But I don't want to change the label feature of "parent" through the same way, because it should be automatically changed, not manually.
That's why I modified the code of getText( Object object) function in NFRSoftgoalItemProvide.java under bpmn.edit.
-----> What do you mean "via a command" ? I don't know how to change via a command. Could you explain or give any reference for it?
Thanks & Regards,
>
-
Attachment: t1.jpg
(Size: 63.19KB, Downloaded 327 times) -
Attachment: t2.jpg
(Size: 75.19KB, Downloaded 319 times)
|
|
|
Re: Set field value problem [message #1702051 is a reply to message #1702033] |
Fri, 17 July 2015 23:54 |
Ed Merks Messages: 33113 Registered: July 2009 |
Senior Member |
|
|
Comments below.
On 17/07/2015 7:19 PM, Shin-Yi Lin wrote:
> Ed Merks wrote on Fri, 17 July 2015 12:28
>> Comments below.
>>
>> On 17/07/2015 4:40 AM, Shin-Yi Lin wrote:
>>> (1) My model structure (I want to change label attribute.):
>> So the label feature is on a class that's the root of a several other
>> classes...
>> ----> Yes.
>>>
>>> (2.1) Before (Child and parent clouds are undecided. Cloud represents NFRSoftgoal class.):
>> This undecided thing is the default state...
>> -----> That's right.
>>>
>>> (2.2) After (After child cloud changes to satisfy through command, parent cloud changes to satisfy automatically.)
>> Is this via a command that directly modifies the label feature of the
>> "child"? If so, that's the place to modify the state of the parents,
>> e.g., using a compound command that modifies the child as normal, and
>> walks up the parents to modify the parent label also using commands.
>> What, if anything, prevents the "parent" label from being directly
>> changed back to undecided (which is perhaps an inconsistent state for
>> the model)?
>> -----> I change the label feature of "child" through the red frame in the following pictures (This is under run-time application and Sirius environment.):
>>
>>
>> -----> But I don't want to change the label feature of "parent" through the same way, because it should be automatically changed, not manually.
I'm asking what's preventing that from happening? I suppose it doesn't
matter if you've done something so that only a leaf/child can be
directly modified.
>> That's why I modified the code of getText( Object object) function in NFRSoftgoalItemProvide.java under bpmn.edit.
That's not a good idea.
>>
>>
>>
>> -----> What do you mean "via a command" ? I don't know how to change via a command. Could you explain or give any reference for it?
On the child, the set command is created by
org.eclipse.emf.edit.provider.ItemProviderAdapter.createSetCommand(EditingDomain,
EObject, EStructuralFeature, Object) so you can specialize this method
of the child's item provider so that it modifies not only the child's
label feature, but modifies also the parents. All that could be done
with a CompoundCommand that composes all the SetCommands.
>>
>> Thanks & Regards,
>>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| | | |
Re: Set field value problem [message #1702360 is a reply to message #1702343] |
Tue, 21 July 2015 18:50 |
Ed Merks Messages: 33113 Registered: July 2009 |
Senior Member |
|
|
Comments below.
On 21/07/2015 6:00 PM, Shin-Yi Lin wrote:
> Thanks for your suggestion.
>
> I've set the breakpoint at setLabel method before you mentioned. It's
> not in the SetCommand; rather, it is in the PhenomenonTypeImp.java.
Yes, the set methods are in the implementation classes. The point is to
set a breakpoint and look at the call stack to see who is calling it.
> In addition, SetCommand is actually in
> org.eclipse.emf.edit.command.SetCommand.
Indeed. Do you know that Ctrl-Shift-T will let you find any class easily.
> From the EMF book, setPrice and setQuantity which extend SetCommand
> are classes, which means I should create a class java file for them.
> This really confused me. ------> From your suggestion. I guess I
> should specialize the setLabel method and extends from SetCommand in
> PhenomenonTypeImp.java.
No, I was quite specific about specializing your generated item provider.
>
> By the way, during debugging, it showed some errors of "the source
> attachment does not contain the source for the file
> SessionLabelProvider and SiriusCommonLabelProvider". They're under
> org.eclipse.sirius.ui.tools.internal.views.common and compiler can't
> not find the lines of code it needs.
That's a Sirius question; perhaps their build is not configured properly.
In the end, you need to learn to help yourself, because I won't be
answering every question of yours down to the last minute detail. This
thread will just continue forever.
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Goto Forum:
Current Time: Fri Mar 29 09:47:51 GMT 2024
Powered by FUDForum. Page generated in 0.03313 seconds
|