Finding the ends of a Connector?

General discussions about code engineering

Moderator: Moderators

Finding the ends of a Connector?

Postby » Fri Apr 02, 2021 12:41 pm

Hello. Attempting to make a plugin that can analyze a model for various traits-but currently hitting a rather major stumbling block: not being able to figure out the connections between various objects. While I can get the connectors themselves, I can't seem to have any functions produce what's on either end-the connectors appear to be largely blank objects. Here's the currently-used code for it, anybody able to offer a suggestion?

Code: Select all
public String connectends() {
String restate="";
      Tree tree = getTree();
      if (tree != null)
         final Element element = getSelectedElement(tree);
         if (element != null)
            try {element.accept(visitor);} catch (Exception e) {e.printStackTrace();}
         ArrayList<Element> all=new ArrayList<>();
         for (int i = 0; i < all.size(); i++) {Element current = all.get(i);try{current.accept(visitor);}catch (Exception e){e.printStackTrace();}all.addAll(current.getOwnedElement());}
         ArrayList<String> list=new ArrayList<String>();
         Element tests=all.get(0);
         int flag=0;
           for (int index=0;index < all.size(); index++) {
              String teststring=tests.getHumanName();
              String tester="";
              if (teststring.startsWith("Connector")&&flag==0){
                 list.add(teststring+": "+tester+"\n ");
           for (String strad:list) {
    return restate;

Currently, just for reasons of making the trial runs more readable, only tries for the first connector (thus, the flag). Ideally, would be an element function on the connector itself, so it would just be swapping out the "tester=String.valueOf(tests.getOwner().getHumanName());" for something else, but not holding my breath on that.
Forum Newbie
Forum Newbie
Posts: 1
Posts Rating:1
Joined: Thu Feb 04, 2021 9:44 am

Return to Code engineering

Who is online

Users browsing this forum: No registered users and 0 guests