示例#1
0
 protected boolean createResults(
     @NonNull List<Result> results,
     @NonNull Iterable<? extends ValidatableNode> validatableNodes,
     @Nullable IProgressMonitor monitor) {
   for (ValidatableNode validatable : validatableNodes) {
     if (validatable.isEnabled()) {
       if (validatable instanceof ResultValidatableNode) {
         ResultValidatableNode resultValidatableNode = (ResultValidatableNode) validatable;
         LeafConstrainingNode constraint =
             (LeafConstrainingNode) resultValidatableNode.getResultConstrainingNode().getParent();
         if (constraint.isEnabled()) {
           Result result = createResult(monitor);
           if (result == null) {
             return false;
           }
           result.setResultValidatableNode(resultValidatableNode);
           results.add(result);
         }
       }
     }
     if (!createResults(results, validatable.getChildren(), monitor)) {
       return false;
     }
   }
   return true;
 }
示例#2
0
 /**
  * Create the ResultValidatableNode,ResultConstrainingNode cross-linkage between constrainedObject
  * and each child constraint of constrainingType.
  */
 protected void createResultNodes(
     @NonNull EObject constrainedObject, @NonNull URI constrainingType) {
   ConstrainingNode constrainingNode = allConstrainingNodes.get(constrainingType);
   if (constrainingNode != null) {
     List<ConstrainingNode> children = constrainingNode.getChildren();
     if (children.size() > 0) {
       ValidatableNode validatable = getValidatableNode(constrainedObject);
       for (@SuppressWarnings("null") @NonNull ConstrainingNode leafConstrainingNode : children) {
         ResultConstrainingNode resultConstrainingNode = createResultConstrainingNode();
         ResultValidatableNode resultValidatableNode = createResultValidatableNode();
         resultConstrainingNode.setResultValidatableNode(resultValidatableNode);
         resultConstrainingNode.setLabel(validatable.getLabel());
         resultValidatableNode.setLabel(leafConstrainingNode.getLabel());
         leafConstrainingNode.getChildren().add(resultConstrainingNode);
         validatable.getChildren().add(resultValidatableNode);
       }
     }
   }
 }