private void performDiagramTest(
      final NonRootModelElement element, int expectedGraphicalElementCount) {
    Model_c model =
        Model_c.ModelInstance(
            Ooaofgraphics.getInstance(element.getModelRoot().getId()),
            new ClassQueryInterface_c() {

              @Override
              public boolean evaluate(Object candidate) {
                return ((Model_c) candidate).getOoa_id().equals(element.Get_ooa_id());
              }
            });
    assertNotNull(
        "Could not locate diagram for element : " + element.getClass().getSimpleName(), model);
    // if the element is a package assert the Ooa type for the model
    if (element instanceof Package_c) {
      assertTrue(
          "Found a diagram representing a package with an improper ooa type.",
          model.getOoa_type() == Ooatype_c.Package);
    }
    GraphicalElement_c[] elements = GraphicalElement_c.getManyGD_GEsOnR1(model);
    assertEquals(
        "Did not find the expected graphical element count for : "
            + element.getClass().getSimpleName(),
        expectedGraphicalElementCount,
        elements.length);
    for (GraphicalElement_c ge : elements) {
      // if the represents value is a package assert the proper ooa type
      if (ge.getRepresents() instanceof Package_c) {
        assertTrue(
            "Found a graphical element representing a package with an improper ooa type.",
            ge.getOoa_type() == Ooatype_c.Package);
      }
    }
  }
예제 #2
0
 public void batchUnrelate(boolean notifyChanges) {
   NonRootModelElement inst = null;
   // R1013
   // MSG_A
   inst = IsSupertypeMessageArgument;
   unrelateAcrossR1013From(IsSupertypeMessageArgument, notifyChanges);
   if (inst != null) {
     inst.removeRef();
   }
 }
예제 #3
0
 public void batchUnrelate(boolean notifyChanges) {
   NonRootModelElement inst = null;
   // R301
   // DIM_GE
   inst = IsSupertypeGraphelement;
   unrelateAcrossR301From(IsSupertypeGraphelement, notifyChanges);
   if (inst != null) {
     inst.removeRef();
   }
 }
예제 #4
0
 public void batchUnrelate(boolean notifyChanges) {
   NonRootModelElement inst = null;
   // R4202
   // C_C
   inst = CanBeNestedInComponent;
   unrelateAcrossR4202From(CanBeNestedInComponent, notifyChanges);
   if (inst != null) {
     inst.removeRef();
   }
 }
 public void batchUnrelate(boolean notifyChanges) {
   NonRootModelElement inst = null;
   // R9600
   // SQU_Q
   inst = IsSupertypeQuery;
   unrelateAcrossR9600From(IsSupertypeQuery, notifyChanges);
   if (inst != null) {
     inst.removeRef();
   }
 }
 public void batchUnrelate(boolean notifyChanges) {
   NonRootModelElement inst = null;
   // R8007
   // C_C
   inst = HeldByComponent;
   unrelateAcrossR8007From(HeldByComponent, notifyChanges);
   if (inst != null) {
     inst.removeRef();
   }
 }
예제 #7
0
 public void batchUnrelate(boolean notifyChanges) {
   NonRootModelElement inst = null;
   // R39
   // S_DPK
   inst = IsContainedInDataTypePackage;
   unrelateAcrossR39From(IsContainedInDataTypePackage, notifyChanges);
   if (inst != null) {
     inst.removeRef();
   }
   // S_DT
   inst = ContainsDataType;
   unrelateAcrossR39From(ContainsDataType, notifyChanges);
   if (inst != null) {
     inst.removeRef();
   }
 }
예제 #8
0
 public void batchUnrelate(boolean notifyChanges) {
   NonRootModelElement inst = null;
   // R25
   // GD_MD
   inst = IsMovingInModel;
   unrelateAcrossR25From(IsMovingInModel, notifyChanges);
   if (inst != null) {
     inst.removeRef();
   }
   // GD_GE
   inst = IsMovingGraphicalElement;
   unrelateAcrossR25From(IsMovingGraphicalElement, notifyChanges);
   if (inst != null) {
     inst.removeRef();
   }
 }
 public void batchUnrelate(boolean notifyChanges) {
   NonRootModelElement inst = null;
   // R805
   // V_VAR
   inst = ReferencesVariable;
   unrelateAcrossR805From(ReferencesVariable, notifyChanges);
   if (inst != null) {
     inst.removeRef();
   }
   // R801
   // V_VAL
   inst = IsSupertypeValue;
   unrelateAcrossR801From(IsSupertypeValue, notifyChanges);
   if (inst != null) {
     inst.removeRef();
   }
 }
 public void batchUnrelate(boolean notifyChanges) {
   NonRootModelElement inst = null;
   // R518
   // O_OBJ
   inst = ModelClass;
   unrelateAcrossR518From(ModelClass, notifyChanges);
   if (inst != null) {
     inst.removeRef();
   }
   // R517
   // SM_SM
   inst = IsSupertypeStateMachine;
   unrelateAcrossR517From(IsSupertypeStateMachine, notifyChanges);
   if (inst != null) {
     inst.removeRef();
   }
 }
 public void batchUnrelate(boolean notifyChanges) {
   NonRootModelElement inst = null;
   // R603
   // ACT_SMT
   inst = IsSupertypeStatement;
   unrelateAcrossR603From(IsSupertypeStatement, notifyChanges);
   if (inst != null) {
     inst.removeRef();
   }
   // R674
   // S_BRG
   inst = IsAnInvocationOfBridge;
   unrelateAcrossR674From(IsAnInvocationOfBridge, notifyChanges);
   if (inst != null) {
     inst.removeRef();
   }
 }
예제 #12
0
 public void batchUnrelate(boolean notifyChanges) {
   NonRootModelElement inst = null;
   // R609
   // V_VAL
   inst = ReadsValue;
   unrelateAcrossR609From(ReadsValue, notifyChanges);
   if (inst != null) {
     inst.removeRef();
   }
   // R689
   // V_VAL
   inst = WritesValue;
   unrelateAcrossR689From(WritesValue, notifyChanges);
   if (inst != null) {
     inst.removeRef();
   }
   // R603
   // ACT_SMT
   inst = IsSupertypeStatement;
   unrelateAcrossR603From(IsSupertypeStatement, notifyChanges);
   if (inst != null) {
     inst.removeRef();
   }
 }
 public static boolean differenceElementIsGraphical(Object diffElement) {
   if (diffElement instanceof ObjectElementComparable) {
     ObjectElementComparable comparable = (ObjectElementComparable) diffElement;
     if (comparable.getRealElement() instanceof ObjectElement) {
       ObjectElement objEle = (ObjectElement) comparable.getRealElement();
       if (objEle.getParent() instanceof NonRootModelElement) {
         NonRootModelElement nrme = (NonRootModelElement) objEle.getParent();
         if (nrme.getModelRoot() instanceof Ooaofgraphics) {
           return true;
         }
       }
     }
   }
   if (diffElement instanceof NonRootModelElementComparable) {
     NonRootModelElementComparable comparable = (NonRootModelElementComparable) diffElement;
     if (comparable.getRealElement() instanceof NonRootModelElement) {
       NonRootModelElement nrme = (NonRootModelElement) comparable.getRealElement();
       if (nrme.getModelRoot() instanceof Ooaofgraphics) {
         return true;
       }
     }
   }
   return false;
 }
  private void CNST_CSP_NewConstant(IStructuredSelection selection) {
    // Assign the context selection variables with the action context
    // Assign the context selection variable with the action context
    Object context = selection.iterator().next();
    ConstantSpecification_c v_csp = (ConstantSpecification_c) context;
    PersistableModelComponent.ensureCoreDataTypesAvailable(v_csp.getModelRoot());

    TransactionUtil.TransactionGroup transactionGroup =
        TransactionUtil.startTransactionsOnSelectedModelRoots("New Constant");
    boolean abortTransaction = false;
    try {
      // Ensure that actions take place between Verifier Activity executions
      Ooaofooa.beginSaveOperation();
      if (v_csp != null) {
        v_csp.Newliteralsymbolicconstant();
      } else {
        Throwable t = new Throwable();
        t.fillInStackTrace();
        CorePlugin.logError("Attempted to call an operation on a null instance.", t);
      }

      NonRootModelElement[] children =
          LiteralSymbolicConstant_c.getManyCNST_LSCsOnR1503(
              LeafSymbolicConstant_c.getManyCNST_LFSCsOnR1502(
                  SymbolicConstant_c.getManyCNST_SYCsOnR1504(v_csp)));

      NonRootModelElement newElement = children[children.length - 1];
      IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore();
      boolean option = store.getBoolean(BridgePointPreferencesStore.USE_DEFAULT_NAME_FOR_CREATION);
      if (!option) {
        String oldName = RenameActionUtil.getElementName(newElement);
        boolean performRename =
            UIUtil.inputDialog(
                null,
                "Element Creation",
                "Enter the name:",
                oldName,
                UIUtil.newRenameValidator(newElement));
        if (performRename) {
          String proposedName = UIUtil.inputDialogResult;
          RenameActionUtil.setElementName(newElement, proposedName);
          newElement.setComponent(null);
        } else {
          abortTransaction = true;
        }
      }
      // end critical section
      Ooaofooa.endSaveOperation();
      // catch all exceptions and cancel the transactions
    } catch (Exception e) {
      Ooaofooa.endSaveOperation();
      TransactionUtil.cancelTransactions(transactionGroup, e);
      CorePlugin.logError("Transaction: New Constant failed", e); // $NON-NLS-1$
    }
    if ((!CorePlugin.getDefault()
            .getPreferenceStore()
            .getBoolean(BridgePointPreferencesStore.USE_DEFAULT_NAME_FOR_CREATION))
        && abortTransaction) {
      TransactionUtil.cancelTransactions(transactionGroup);
    } else {
      TransactionUtil.endTransactions(transactionGroup);
    }
  }