コード例 #1
0
  public void unrelateAcrossR25From(Model_c target, boolean notifyChanges) {
    if (target == null) return;

    if (IsMovingInModel == null) return; // already unrelated

    if (target != IsMovingInModel) {
      Exception e = new Exception();
      e.fillInStackTrace();
      CanvasPlugin.logError("Tried to unrelate from non-related instance across R25", e);
      return;
    }

    if (target != null) {
      target.clearBackPointerR25To(this);
    }

    if (IsMovingInModel != null) {

      m_diagramid = IsMovingInModel.getDiagramid();
      if (IdAssigner.NULL_UUID.equals(m_diagramid)) {
        m_diagramid = IsMovingInModel.getDiagramidCachedValue();
      }
      IsMovingInModel = null;
      target.removeRef();
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_UNRELATED, this, target, "25", "");
        Ooaofgraphics.getDefaultInstance().fireModelElementRelationChanged(change);
      }
    }
  }
コード例 #2
0
  public void relateAcrossR25To(Model_c target, boolean notifyChanges) {
    if (target == null) return;

    if (target == IsMovingInModel) return; // already related

    if (IsMovingInModel != target) {

      Object oldKey = getInstanceKey();

      if (IsMovingInModel != null) {

        IsMovingInModel.clearBackPointerR25To(this);

        if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == true) { // $NON-NLS-1$
          Ooaofgraphics.log.println(
              ILogger.CONSISTENCY,
              "ElementInMove_c.relateAcrossR25To(Model_c target)",
              "Relate performed across R25 from Element In Move to Model without unrelate of prior instance.");
        }
      }

      IsMovingInModel = target;
      if (IdAssigner.NULL_UUID.equals(target.getDiagramid())) {
        // do not update cached value
      } else {
        // update cached value
        m_diagramid = target.getDiagramidCachedValue();
      }
      updateInstanceKey(oldKey, getInstanceKey());
      target.setBackPointerR25To(this);
      target.addRef();
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_RELATED, this, target, "25", "");
        Ooaofgraphics.getDefaultInstance().fireModelElementRelationChanged(change);
      }
    }
  }