コード例 #1
0
 /**
  * Set correctly the invoked object, by creating it if needed. Then, notifies that the ok button
  * of this dialog has been pressed.
  *
  * @see org.eclipse.jface.dialogs.Dialog#okPressed()
  */
 @Override
 protected void okPressed() {
   // create element
   createdParameter = UMLFactory.eINSTANCE.createParameter();
   createdParameter.setName(selectedName);
   createdParameter.setType((Type) selectedType);
   createdParameter.setDirection(selectedDirection);
   addParameter(createdParameter);
   super.okPressed();
 }
コード例 #2
0
 protected static void addOcl() {
   Operation find =
       example
           .getConstructionCase()
           .createOwnedOperation(
               "findRoomPlan", list("nameToFind"), list((Type) example.getType("String")));
   Parameter result = find.createOwnedParameter("result", example.getRoomPlans());
   result.setDirection(ParameterDirectionKind.RETURN_LITERAL);
   result.setUpper(-1);
   result.setIsUnique(false);
   OpaqueExpression ocl =
       (OpaqueExpression)
           find.createBodyCondition("body")
               .createSpecification(
                   "spec", example.getRoomPlans(), UMLPackage.eINSTANCE.getOpaqueExpression());
   ocl.getLanguages().add("ocl");
   ocl.getBodies().add("housePlan.wallPlans->collect(roomPlans->any(rp|rp.name=nameToFind))");
 }