Пример #1
0
  public void unrelateAcrossR39From(DataTypePackage_c target, boolean notifyChanges) {
    if (target == null) return;

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

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

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

    if (IsContainedInDataTypePackage != null) {

      m_package_id = IsContainedInDataTypePackage.getPackage_id();
      if (IdAssigner.NULL_UUID.equals(m_package_id)) {
        m_package_id = IsContainedInDataTypePackage.getPackage_idCachedValue();
      }
      IsContainedInDataTypePackage = null;
      target.removeRef();
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_UNRELATED, this, target, "39", "");
        Ooaofooa.getDefaultInstance().fireModelElementRelationChanged(change);
      }
    }
  }
Пример #2
0
  public void relateAcrossR39To(DataTypePackage_c target, boolean notifyChanges) {
    if (target == null) return;

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

    if (IsContainedInDataTypePackage != target) {

      Object oldKey = getInstanceKey();

      if (IsContainedInDataTypePackage != null) {

        IsContainedInDataTypePackage.clearBackPointerR39To(this);

        if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == true) { // $NON-NLS-1$
          Ooaofooa.log.println(
              ILogger.CONSISTENCY,
              "DataTypeInPackage_c.relateAcrossR39To(DataTypePackage_c target)",
              "Relate performed across R39 from Data Type in Package to Data Type Package without unrelate of prior instance.");
        }
      }

      IsContainedInDataTypePackage = target;
      if (IdAssigner.NULL_UUID.equals(target.getPackage_id())) {
        // do not update cached value
      } else {
        // update cached value
        m_package_id = target.getPackage_idCachedValue();
      }
      updateInstanceKey(oldKey, getInstanceKey());
      target.setBackPointerR39To(this);
      target.addRef();
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_RELATED, this, target, "39", "");
        Ooaofooa.getDefaultInstance().fireModelElementRelationChanged(change);
      }
    }
  }