Cameo GUI freezes during Macro execution

General discussions about code engineering

Moderator: Moderators

Cameo GUI freezes during Macro execution

Postby andreas.hemmert@airbus.com » Thu Sep 26, 2019 4:51 am

Hello,

when I execute my macro to get all objectflows and create ports and interfaceBlocks out of it, the GUI freezes.
Is there a way to avoid that behavior?

Furthermore, why can't I get all objectflows via StereotypesHelper. It return null with the StereotypesHelper.getStereotype():

Code: Select all
var project = Application.getInstance().getProject();
var profile_UML =       StereotypesHelper.getProfile(project, "UML Standard Profile");
var path_ObjectFlow_Stereotype =   model._getChild('UML Standard Profile')._getChild('UML2 Metamodel')._getChild('ObjectFlow');
var ArrayList = Java.type('java.util.ArrayList');

function get_All_Objectflows()
   {
      var found_Objectflow_List = new ArrayList();
      var current_Stereotype;
      var current_ObjectFlow_List;

      if((StereotypesHelper.getStereotype(project, path_ObjectFlow_Stereotype.name, profile_UML))!= undefined)
      {
         Application.getInstance().getGUILog().log("current_ObjectFlow_List: " + current_ObjectFlow_List);
         current_Stereotype = StereotypesHelper.getStereotype(project, path_ObjectFlow_Stereotype.name, profile_UML);
         current_ObjectFlow_List = StereotypesHelper.getExtendedElements(current_Stereotype);
         for(var y=0; y<current_ObjectFlow_List.length; y++)
         {
            found_Objectflow_List.add(current_ObjectFlow_List[y]);
            Application.getInstance().getGUILog().log("current_ObjectFlow_List: " + current_ObjectFlow_List[y].name);
         }
      }
      return found_Objectflow_List;
   }

Further information:
Cameo Systems Model 19.0 SP2
Language used for Macro scripting: Javascript

Best regards,
Andreas
andreas.hemmert@airbus.com
Forum Newbie
Forum Newbie
 
Posts: 1
Posts Rating:0
Joined: Thu Sep 26, 2019 4:36 am

Return to Code engineering

Who is online

Users browsing this forum: No registered users and 1 guest