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

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

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

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

    if (CanBeNestedInComponent != null) {

      m_parent_id = CanBeNestedInComponent.getId();
      if (IdAssigner.NULL_UUID.equals(m_parent_id)) {
        m_parent_id = CanBeNestedInComponent.getIdCachedValue();
      }
      CanBeNestedInComponent = null;
      target.removeRef();
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_UNRELATED, this, target, "4202", "");
        Ooaofooa.getDefaultInstance().fireModelElementRelationChanged(change);
      }
    }
  }
コード例 #2
0
  public void relateAcrossR4202To(Component_c target, boolean notifyChanges) {
    if (target == null) return;

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

    if (CanBeNestedInComponent != target) {

      Object oldKey = getInstanceKey();

      if (CanBeNestedInComponent != null) {

        CanBeNestedInComponent.clearBackPointerR4202To(this);

        if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == true) { // $NON-NLS-1$
          Ooaofooa.log.println(
              ILogger.CONSISTENCY,
              "ComponentInComponent_c.relateAcrossR4202To(Component_c target)",
              "Relate performed across R4202 from Component in Component to Component without unrelate of prior instance.");
        }
      }

      CanBeNestedInComponent = target;
      if (IdAssigner.NULL_UUID.equals(target.getId())) {
        // do not update cached value
      } else {
        // update cached value
        m_parent_id = target.getIdCachedValue();
      }
      updateInstanceKey(oldKey, getInstanceKey());
      target.setBackPointerR4202To(this);
      target.addRef();
      if (notifyChanges) {
        RelationshipChangeModelDelta change =
            new RelationshipChangeModelDelta(
                Modeleventnotification_c.DELTA_ELEMENT_RELATED, this, target, "4202", "");
        Ooaofooa.getDefaultInstance().fireModelElementRelationChanged(change);
      }
    }
  }