コード例 #1
0
  /** @see org.eclipse.gef.commands.Command#execute() */
  public void execute() {
    // super.execute();
    newObject.setIdentifier(identifier);
    newObject.setVersion(version);
    /* modified by tri */
    newObject.setAbsoluteName(container.getAbsoluteName() + ":" + identifier);

    /*
    if(container.getAbsoluteName().trim().length()!=0)
        newObject.setAbsoluteName(container.getAbsoluteName() + ":" + container.getIdentifier());
    else
        newObject.setAbsoluteName(container.getIdentifier());

    */

    // TODO
    newObject.setRepositoryId(
        CCMConstants.getRepositoryIdString(newObject.getAbsoluteName(), identifier, version));
    container.getContents().add(newObject);

    ((ProcessCollocation) container).getHomeInstances().add(newObject);
    List parentNodes = container.getNode();
    for (Iterator it = parentNodes.iterator(); it.hasNext(); ) {
      Node parentNode = (Node) it.next();
      node = factory.createNode();
      newObject.getNode().add(node);
      node.setContained(newObject);
      view.getNode().add(node);
      node.setX(rectangle.x);
      node.setY(rectangle.y);
      node.setWidth(rectangle.width);
      node.setHeight(rectangle.height);
      parentNode.getContents().add(node);
    }
    ((HomeInstantiation) newObject).setCardinality(cardinality);
    ((HomeInstantiation) newObject).setRegName(regName);
    ((HomeInstantiation) newObject).setService(service);
    ((HomeInstantiation) newObject).setType(homeImpl);
    ((HomeInstantiation) newObject).setDeploymentUnit(impl);
    // ((InterfaceDef)newObject).setIsLocal(isLocal);
    node.eNotify(
        new CCMNotificationImpl(
            node, Notification.SET, CCMNotificationImpl.HOMEIINSTANCE, null, null, 0));
  }
コード例 #2
0
  /** @see org.eclipse.gef.commands.Command#execute() */
  public void execute() {

    // setNewObject(factory.createImplementation());

    // super.execute();
    newObject.setIdentifier(identifier);
    newObject.setVersion(version);

    /* modified by tri */
    newObject.setAbsoluteName(container.getAbsoluteName() + ":" + identifier);

    /*
    if(container.getAbsoluteName().trim().length()!=0)
        newObject.setAbsoluteName(container.getAbsoluteName() + ":" + container.getIdentifier());
    else
        newObject.setAbsoluteName(container.getIdentifier());

    */

    // TODO
    newObject.setRepositoryId(
        CCMConstants.getRepositoryIdString(newObject.getAbsoluteName(), identifier, version));

    container.getContents().add(newObject);
    ((SoftwarePackage) container).getImpl().add(newObject);

    // ((Implementation)newObject).setLicenseKey(licenseKey);
    // ((Implementation)newObject).setLicenseTexRef(licenseTextRef);
    ((Implementation) newObject).setUuid(uuid);
    ((Implementation) newObject).setComposition(composition);

    Iterator it = container.getNode().iterator();
    while (it.hasNext()) {
      parentNode = (Node) it.next();
      opNode = factory.createNode();
      ((Implementation) newObject).getNode().add(opNode);
      opNode.setX(5);
      opNode.setY(8);
      opNode.setWidth(60);
      opNode.setHeight(40);
      parentNode.getContents().add(opNode);

      View view = parentNode.getView();
      Unit_CompositionConnectCommand command = new Unit_CompositionConnectCommand();
      List nodeList = view.getNode();
      command.setSource(opNode);
      command.setView(view);
      for (Iterator nit = nodeList.iterator(); nit.hasNext(); ) {
        Node vn = (Node) nit.next();
        if (composition.equals(vn.getContained())) {
          // command.setLabel("");
          command.setTarget(vn);
          command.execute();
          return;
        }
      }
      Node vn = factory.createNode();
      vn.setContained(composition);
      vn.setX(parentNode.getX() + 180);
      vn.setY(parentNode.getY() + 160);
      vn.setWidth(100);
      vn.setHeight(60);
      vn.setView(view);
      composition.getNode().add(vn);
      view.getNode().add(vn);
      command.setTarget(vn);
      command.execute();
    }
  }