public SWTBotGefEditPart getEditPart(SWTBotGefEditPart fromPart, String label) { Object model = fromPart.part().getModel(); // System.out.println("PART: " + fromPart.part()); if (model instanceof ActivityImpl) { ActivityImpl activity = (ActivityImpl) model; // System.out.println("ACTIVITY NAME: " + activity.getName() + ", " + activity); if (fromPart.children().isEmpty() && label.equals(activity.getName())) { return fromPart; } } List<SWTBotGefEditPart> allEditParts = fromPart.children(); allEditParts.addAll(fromPart.sourceConnections()); // ElseIf and Else must use element name !!! // ElseIf must use also coordinates to verify that it's the last one. return getEditPart(allEditParts, label); }
protected SWTBotGefEditPart getEditPart(List<SWTBotGefEditPart> allEditParts, String label) { for (SWTBotGefEditPart child : allEditParts) { Object model = child.part().getModel(); if (model instanceof ActivityImpl) { // System.out.println("PART: " + child.part()); ActivityImpl activity = (ActivityImpl) child.part().getModel(); // System.out.println("ACTIVITY NAME: " + activity.getName() + ", " + activity); if (label.equals(activity.getName())) { return child; } SWTBotGefEditPart childEditPart = getEditPart(child, label); if (childEditPart != null) { return childEditPart; } } } return null; }