Пример #1
0
  // TODO: clean the threading/scheduling functionality here (may need UNDO support)
  private void autoBrowse(List<ArtifactEditPart> selEP, IProgressMonitor monitor) {
    for (ArtifactEditPart endEP : selEP) {
      for (ArtifactEditPart startEP : selEP) {
        // check start and end so that we call auto-browse only once
        if (endEP == startEP) break;

        autoBrowse(startEP.getArtifact().getArt(), endEP.getArtifact().getArt(), 5, monitor);
      }
    }
  }
Пример #2
0
  /**
   * Ensures that all elements on a valid path (given by rel) are shown Note: src.rel.tgt &&
   * src!=tgt has to be true
   *
   * @param rel - join defining valid paths
   */
  public void showPathElements(JoinedRelType rel) {
    Artifact curArt = getArtifact().getArt();

    if (!isActive()) {
      log("not active");
      return;
    }

    logBeg("showPathElements");

    ReloController rc = getRootController();
    for (ArtifactEditPart visEP : rc.getVisibleNonDerivedArtifactEditParts()) {
      Artifact visArt = visEP.getArtifact().getArt();
      if (curArt.equals(visArt)) continue;
      // ObjectPair examiningPair = new ObjectPair(this, visEP);

      for (List<Artifact> resultSetVar : rel.getPaths(getRepo(), curArt, visArt)) {
        for (Artifact resultArt : resultSetVar) {
          rc.createOrFindArtifactEditPart(resultArt);
        }
      }

      // flip order of pair (everything else is identical
      for (List<Artifact> resultSetVar : rel.getPaths(getRepo(), visArt, curArt)) {
        for (Artifact resultArt : resultSetVar) {
          rc.createOrFindArtifactEditPart(resultArt);
        }
      }
    }
    logEnd();
  }
Пример #3
0
  /** Asserts parenthood for this AEP */
  public void assertParenthood(CompoundCommand tgtCmd) {
    final ArtifactEditPart thisAEP = this;
    Artifact thisArt = thisAEP.getArtifact().getArt();
    ReloController rc = getRootController();

    // logger.info("assertParenthood: " + thisAEP);

    for (Artifact child : thisArt.queryChildrenArtifacts(thisAEP.getRepo())) {
      final ArtifactEditPart childEP = rc.findArtifactEditPart(child);
      if (childEP == null) continue;

      final ArtifactEditPart oldParentEP = (ArtifactEditPart) childEP.getParent();

      Command reparentCmd = new ReparentCommand(childEP, thisAEP, oldParentEP);

      if (oldParentEP instanceof ReloController) {
        // was at the top level before
        tgtCmd.add(reparentCmd);
        continue;
      }

      ArtifactEditPart oldParentAEP = (ArtifactEditPart) oldParentEP;

      // want to do: if (oldParentAEP == thisAEP) continue;
      //      need to do this otherwise we will have infinite loops
      // we also need to take into account derived code units as well

      // @tag post-rearch-verify
      if (oldParentAEP
          .getArtifact()
          .getNonDerivedBaseArtifact()
          .equals(thisAEP.getArtifact().getNonDerivedBaseArtifact())) {
        continue;
      }

      tgtCmd.add(reparentCmd);
    }
  }
Пример #4
0
 public void addModelAndChild(ArtifactEditPart child) {
   addChild(child);
   appendModelChild(child.getArtifact());
 }