public void realizeParent(CompoundCommand tgtCmd) { // logger.info("realizeParent: " + this); // logger.info(this.getClass().getName() + " .realizeParent() - parent: " + parent // + " / findEditPart(parent): " + findEditPart(parent)); if (getModel() instanceof DerivedArtifact) return; final Artifact parentArt = getArtifact().getArt().queryParentArtifact(getBrowseModel().getRepo()); if (parentArt == null) return; final ReloController rc = getRootController(); ArtifactEditPart parentEP = (ArtifactEditPart) findEditPart(parentArt); if (parentEP != null) { parentEP.assertParenthood(tgtCmd); return; } if (!rc.artCreatable(parentArt)) return; // check if browse model will allow // parentEP = null and it is creatable tgtCmd.add(new CreateParentCommand(this, "create parent and assert parenthood", parentArt, rc)); return; }
/** 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); } }
public void showAllDirectRelation( CompoundCommand tgtCmd, final DirectedRel rel, Predicate filter) { try { ReloController rc = getRootController(); Map<Artifact, ArtifactFragment> addedArtToAF = new HashMap<Artifact, ArtifactFragment>(); for (final Artifact relCU : getArtifact().getArt().queryArtList(getRepo(), rel, filter)) { if (rc.canAddRel(getArtifact(), rel, relCU)) { AddNodeAndRelCmd addCmd = new AddNodeAndRelCmd( rc, ArtifactEditPart.this.getArtFrag(), rel, relCU, addedArtToAF); tgtCmd.add(addCmd); ((ReloDoc) rc.getRootArtifact()) .showIncludedRelationships(tgtCmd, addCmd.getNewArtFrag()); } } } catch (Throwable t) { logger.error("Unexpected exception", t); } }
/** Asserts parenthood for this AEP */ public void assertParenthood() { CompoundCommand cc = new CompoundCommand(); assertParenthood(cc); cc.execute(); }
public void update() { for (CollapseExpandButton button : buttonList) collapse(button); super.execute(); }