Add a created component to the diagram editor programatically

Hi,
I am working on the synthesis of my customized Physical Architecture Blank diagram programmatically by creating a view point using Capella studio.
Until now, I can create components and add them to the physical system and I can see them by expanding the .aird file using the project explorer. (see screen capture)
What I want to do now is to add them to the diagram editor view automatically without dragging and dropping them there.
I think to do so, we use the Diagramservices class as follows:
After the creation of the command that allow us to add the component to the diagram, We should execute it by giving the right parameters as follows:
Here I am bit confused because I need the right mappingName because this argument is used inside the method .getContainerMapping(diagram, mappingName) of the diagramservices class as follows:
which means that the mapping names are well known and must be respected in order to get the mapping.
So my question is : how can I get every component the exact name like “PAB_Actor” and where can I find them. For example the names of the component like Node PC, Physical Actor, Physical Function and exchanges between different component.
And for the “PAB_actor” actor component doesn’t exist any more in the capella new meta-model? What is the substitution?

diagramEditor.PNG
diagramEditor.PNG

Hello,
This kind of name “PAB_Actor” can be find in the definition of the PAB diagram itself.
You can find it in the odesign files of the org.polarsys.capella.core.sirius.analysis plugins of Capella.
Please also know that Sirius supports different kind of diagrams:

  • diagrams filled automatically with the content of the model: this is the case in Capella for breakdown diagrams for example
  • diagrams to be filled manually by the user: this is the case of PAB diagrams in Capella
    The kind of diagram is defined by an attribute in the odesign file: “Synchronization” (actually this attribute is on each definition of content for the diagram)
    By simply changing this attribute in the odesign file, you can modify the behavior of the diagram

Hi,
The mapping is the ‘style description’ of a shape in a diagram.
By opening odesign files located in org.polarsys.capella.core.sirius.analysis plugin, you will find how all diagrams of capella are made.
(File / Import / Plugin and fragment, check ‘Project with source folder’ / Next / Lookup for org.polarsys.capella.core.sirius.analysis)
You can use “Windows > Show View > Interpreter”
write in the expression section : “aql:self.actualMapping”
then, when you will click on an element in the diagram, then the mapping will appear below.
PAB_Actor has indeed being merged into PAB_PC in 1.4.0.
Its a bit technical, but you can look at substitution here.
https://github.com/eclipse/capella/blob/b05bc20ce8fc38b98ac7789c16c0f347d10d050b/core/plugins/org.polarsys.capella.core.data.migration/src/org/polarsys/capella/core/data/migration/capella/ActorRefactoringMigrationContribution.java#L308
Constants are defined here:
https://github.com/eclipse/capella/blob/master/core/plugins/org.polarsys.capella.core.sirius.analysis/src/org/polarsys/capella/core/sirius/analysis/IMappingNameConstants.java
Regards
Philippe

Hi,
Thank you guys for your answers, that what I was looking for.
However I do have another problem. When I map a function which is allocated to a physcial actor. They are displayed separetly instead of the encapsulation of the physical actor to the physical function.
command to create the function
command to create the physical actor
execute the two commands

mapping.PNG
mapping.PNG

Copyright © Eclipse Capella, the Eclipse Capella logo, Eclipse and the Eclipse logo are Trademarks of The Eclipse Foundation.