This service is archived, please use www.eclipse.org/forums


Home » Archived Projects » Kitalpha » Questions about viewpoints
Questions about viewpoints [message #715] Mon, 22 February 2016 11:12 Go to next message
Matthieu Durot is currently offline  Matthieu Durot
Messages: 35
Registered: December 2015
Member
Hello,

I created a viewpoint that extend a system function to be able to define different types of system functions.
My viewpoint is called IC Function.

I have some questions about viewpoints :

1) How can I use data from a System Function (for example: Id) to display it in a field of my viewpoint ? ( see capture0.png )

2) When I add 2 IC Function attributes to a system function, the IC Function tab of the System Function in question no longer appears in the properties view. How can I allow only a single IC Function attribute per System Function ? ( see multipleICFunction(1).png )

3) I heard about using "superClass external ctx.SystemFunction" instead of "extends ctx.SystemFunction" in the statement of my ICFunction class.
What are the differences between these 2 terms ?

If you have trouble understanding, I can show you the viewpoint's source code.

Regards,

Matthieu

[Updated on: Mon, 22 February 2016 11:27]

Report message to a moderator

Re: Questions about viewpoints [message #716 is a reply to message #715] Tue, 23 February 2016 11:04 Go to previous messageGo to next message
boubekeur.zendagui@thales is currently offline  boubekeur.zendagui@thales
Messages: 54
Registered: April 2015
Member
Hi Matthieu,

I will start by the third question because it is very important to know the meaning of extends and superClass. I will answer the other questions after.

3) extends vs. superClass
  1. extends means that the Viewpoint class is defined as a new child of the extended class. It is like a containment reference from the extended EClass to the viewpoint EClass.
  2. superClass means that the Viewpoint class inherits from the referenced class.

Using extends or superClass depends on your need. For example, if you want to create a new concept derived from SystemFunction (with new attributes/references) you could use superClass, but if you want to create a new child of the concept SystemFunction you could use extends.

1) Displaying an attribute of the parent element
If I well understand your case, IC_Functions are extensions of SystemFunctions. This means that an IC_Function is a child of a given SystemFunction.

In the *.ui plugin, there is a Java class generated for each section. A Section is a piece of the UI displayed when one clicks on a Tab. You should locate the Java class of the section wherein you want to add the parent attribute and to modify its code (creating the UI component, modifying createControls(...), loadData(...) and getSemanticFields(...) methods).

The attached Java class shows how to display in the section of an ICFunction the ID of the System Function containing it (Pay attention to parentIDField).
The result is shown bellow
index.php/fa/186/0/

2) We will analyze this point and give you an answer soon.

Best regards,
Boubekeur Zendagui.

[Updated on: Tue, 23 February 2016 11:08]

Report message to a moderator

Re: Questions about viewpoints [message #717 is a reply to message #716] Wed, 24 February 2016 07:32 Go to previous messageGo to next message
Matthieu Durot is currently offline  Matthieu Durot
Messages: 35
Registered: December 2015
Member
Thank you for your answer Boubekeur, now I understand better superClass.

Regarding the display of a parent element's attribute, how can I generate the package if I modify the code in the *.ui plugin ?
In fact, I tried to modify the code but when I generate the viewpoint's package the code changes disappear.

Should I create the field "parentIDField" in the ic_function.ui file too ?

Matthieu
Re: Questions about viewpoints [message #718 is a reply to message #717] Wed, 24 February 2016 12:35 Go to previous messageGo to next message
boubekeur.zendagui@thales is currently offline  boubekeur.zendagui@thales
Messages: 54
Registered: April 2015
Member
Hi Matthieu,

If you modify a generated Java code, you should add NOT to @generated. In that way, the code merger will not replace the modified code.

Examples:
  1. Class field
    /**
    * <!-- begin-model-doc -->
    * <!-- end-model-doc -->
    * <!-- begin-user-doc -->
    * This UIField displays the ID of the parent element
    * <!-- end-user-doc -->
    * @generated NOT
    */
    private TextValueGroup parentIDField;

  2. Class method
    /**
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @param capellaElement_p
    * @generated NOT
    */
    public void loadData(CapellaElement capellaElement_p) {
    ...
    }

Regards,
Boubekeur Zendagui
Re: Questions about viewpoints [message #719 is a reply to message #718] Thu, 25 February 2016 04:02 Go to previous message
Matthieu Durot is currently offline  Matthieu Durot
Messages: 35
Registered: December 2015
Member
Thank you it works well !

Regards,
Matthieu
Previous Topic: [vpdsl] .ecore/.genmodel in one project
Next Topic: Problems with Diagram generation
Goto Forum:
  


Current Time: Sat Jun 06 09:28:33 EST 2020

Total time taken to generate the page: 0.01504 seconds