modifying models from inside transformation actions

 Dear all,

I need to modify a model from inside the "variables" part of a transformation action. However, because the thread that calculates the values for the variables is launched in read mode, I get an exception when I try to modify any model from there. I have tried using ModelAccess but there is always an exception thrown that I cannot write from a thread that is launched as read-only. 

I understand this is meant to be a feature, because calculating the values for variables should not change models. However, for my specific purpose I really need to do this.

Is there maybe a way to change the settings of the thread that is launched to not be read-only? As far as I can see there are no modifiers in the transformation action itself.

Thanks for any help you can provide.

Cheers,

Levi.

0
2 comments
Avatar
Permanently deleted user

Dear Levi,

You can schedule executing the changing of the model via editorContext.getRepository().getModelAccess().executeCommandInEDT(...);

But as you mentioned correctly, calculating the values for variables should not change models, so you do it at your own risk.

 

0
Avatar
Permanently deleted user

Thank you for the help Semen, works like a charm :-)

0

Please sign in to leave a comment.