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


Home » Capella » Capella Studio » Modifing an model element
Modifing an model element [message #3520] Tue, 10 September 2019 10:37
jmorane is currently offline  jmorane
Messages: 63
Registered: May 2019
Member
Hello everyone,

Following this tutorial, https://wiki.polarsys.org/Capella/Tutorials/Extensibility/Ed it, I tried to make a very simple service that can edit a property value of an Physical component.


Based on the example, I wrote this code as a buisiness rule :

/////////////////////

public void run(ModelAccessor properties, Object[] selection) {
for (final Object object : selection){

ExecutionManager manager = TransactionHelper.getExecutionManager(object).execute(new AbstractReadWriteCommand() {

@Override
public void run() {

if (object instanceof PhysicalComponent) {

// traitement du PVMT
PhysicalComponent PC = (PhysicalComponent) object;
PropertyValueGroup PV = PC.getAppliedPropertyValueGroups().get(0);
IntegerPropertyValue IntPV = (IntegerPropertyValue) PV.getOwnedPropertyValues().get(0);
IntegerPropertyValue IntPVModifie = (IntegerPropertyValue) PV.getOwnedPropertyValues().get(0);
IntPVModifie.setValue(2);
........

//////////////////////////////////////

However, the reference to 'TransactionHelper' cannot be treated by Capella Studio.

Is this tutorial still correct ? I don't know whether they are updated or not, and maybe the way to edit element is not the same from the version 1.

Regards,
Previous Topic: Get Logical Component name from Logical Component Port
Next Topic: recover the list of name of element
Goto Forum:
  


Current Time: Mon Mar 30 17:29:22 EST 2020

Total time taken to generate the page: 0.01388 seconds