Parsing InstanceSpecification Classifier [message #476335] |
Tue, 10 March 2009 14:21  |
Eclipse User |
|
|
|
Hi,
I have a little Problem and hope someone can help me.
I want to set the Slots with the definingFeatures of the corresponding
classifier Class when the Classifier is set. I added a little method to
the lookupResolve in the InstanceSpecificationParser of the common
plugin. This works fine. The problem is that when i change the Name with
the parser the Methode overwrite all Slots and their values. I tried
to check if the slotList is empty but the parser gets the element
without the corresponding slots. Any better Point to insert this method?
|
|
|
|
|
|
|
Re: Parsing InstanceSpecification Classifier [message #476369 is a reply to message #476368] |
Fri, 03 April 2009 09:21  |
Eclipse User |
|
|
|
Thank you Tanya!
> Hello Peter,
>
> Adding such method to ConstraintEditPart should help:
>
> /**
> * @NOT generated
> */
> protected void addSemanticListeners() {
> super.addSemanticListeners();
> Constraint constraint = (Constraint) resolveSemanticElement();
> ValueSpecification s = constraint.getSpecification();
> if (s != null && s instanceof OpaqueExpression) {
> addListenerFilter("SemanticModel_BodyListener", this, s,
> UMLPackage.eINSTANCE.getOpaqueExpression_Body());
> }
> }
>
> Tanya.
>
>> Hi,
>> I also want to set a NotificationListener to the Body of the
>> OpaqueExpression nested in the Constraint Elements.
>> Can someone tell me the right way to do this?
>> Thanks
>> Peter
>
>
|
|
|
Re: Parsing InstanceSpecification Classifier [message #623621 is a reply to message #476335] |
Wed, 11 March 2009 11:10  |
Eclipse User |
|
|
|
Hello Peter,
Your task is very natural. There are several ways to implement it:
1) Initialize Slots on demand:
Add custom action to the context menu of Instance Specification.
How to create custom action to UML2 Tools is described here - http://wiki.eclipse.org/MDT-UML2Tools_FAQ#I_want_to_add_my_c ustom_actions_to_the_UML2Tools_class_diagram._How_can_I_do_i t.3F
2) Listen to InstanceSpecification#classifiers property:
Create a proper NotificationListener and add it to InstanceSpecificationEditPart#addSemanticListeners()
method.
Best wishes,
Tanya.
> Hi,
> I have a little Problem and hope someone can help me.
> I want to set the Slots with the definingFeatures of the corresponding
> classifier Class when the Classifier is set. I added a little method
> to
> the lookupResolve in the InstanceSpecificationParser of the common
> plugin. This works fine. The problem is that when i change the Name
> with
> the parser the Methode overwrite all Slots and their values. I tried
> to check if the slotList is empty but the parser gets the element
> without the corresponding slots. Any better Point to insert this
> method?
>
|
|
|
Re: Parsing InstanceSpecification Classifier [message #623624 is a reply to message #476336] |
Thu, 12 March 2009 08:52  |
Eclipse User |
|
|
|
Hi Tanya,
thank you! Now everything works as expected.
Hava a nice day.
Peter
> Hello Peter,
>
> Your task is very natural. There are several ways to implement it:
>
> 1) Initialize Slots on demand:
> Add custom action to the context menu of Instance Specification. How to
> create custom action to UML2 Tools is described here -
> http://wiki.eclipse.org/MDT-UML2Tools_FAQ#I_want_to_add_my_c ustom_actions_to_the_UML2Tools_class_diagram._How_can_I_do_i t.3F
>
>
> 2) Listen to InstanceSpecification#classifiers property:
> Create a proper NotificationListener and add it to
> InstanceSpecificationEditPart#addSemanticListeners() method.
> Best wishes,
> Tanya.
>
>> Hi,
>> I have a little Problem and hope someone can help me.
>> I want to set the Slots with the definingFeatures of the corresponding
>> classifier Class when the Classifier is set. I added a little method
>> to
>> the lookupResolve in the InstanceSpecificationParser of the common
>> plugin. This works fine. The problem is that when i change the Name
>> with
>> the parser the Methode overwrite all Slots and their values. I tried
>> to check if the slotList is empty but the parser gets the element
>> without the corresponding slots. Any better Point to insert this
>> method?
>>
>
>
|
|
|
|
Re: Parsing InstanceSpecification Classifier [message #623632 is a reply to message #476366] |
Fri, 03 April 2009 08:10  |
Eclipse User |
|
|
|
Hello Peter,
Adding such method to ConstraintEditPart should help:
/**
* @NOT generated
*/
protected void addSemanticListeners() {
super.addSemanticListeners();
Constraint constraint = (Constraint) resolveSemanticElement();
ValueSpecification s = constraint.getSpecification();
if (s != null && s instanceof OpaqueExpression) {
addListenerFilter("SemanticModel_BodyListener", this, s, UMLPackage.eINSTANCE.getOpaqueExpression_Body());
}
}
Tanya.
> Hi,
> I also want to set a NotificationListener to the Body of the
> OpaqueExpression nested in the Constraint Elements.
> Can someone tell me the right way to do this?
> Thanks
> Peter
|
|
|
Re: Parsing InstanceSpecification Classifier [message #623633 is a reply to message #476368] |
Fri, 03 April 2009 09:21  |
Eclipse User |
|
|
|
Thank you Tanya!
> Hello Peter,
>
> Adding such method to ConstraintEditPart should help:
>
> /**
> * @NOT generated
> */
> protected void addSemanticListeners() {
> super.addSemanticListeners();
> Constraint constraint = (Constraint) resolveSemanticElement();
> ValueSpecification s = constraint.getSpecification();
> if (s != null && s instanceof OpaqueExpression) {
> addListenerFilter("SemanticModel_BodyListener", this, s,
> UMLPackage.eINSTANCE.getOpaqueExpression_Body());
> }
> }
>
> Tanya.
>
>> Hi,
>> I also want to set a NotificationListener to the Body of the
>> OpaqueExpression nested in the Constraint Elements.
>> Can someone tell me the right way to do this?
>> Thanks
>> Peter
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.07459 seconds