Beispiel #1
0
 protected String printConstraints(
     @NonNull Map<EModelElement, Set<LeafConstrainingNode>> allConstraints) {
   StringBuilder s = new StringBuilder();
   ArrayList<EModelElement> sortedList = new ArrayList<EModelElement>(allConstraints.keySet());
   //		Collections.sort(sortedList, new Comparator<EClassifier>()
   //		{
   //			public int compare(EClassifier o1, EClassifier o2) {
   //				return o1.getName().compareTo(o2.getName());
   //			}
   //		});
   for (@SuppressWarnings("null") @NonNull EModelElement eObject : sortedList) {
     Set<LeafConstrainingNode> constraints = allConstraints.get(eObject);
     if ((constraints != null) && (constraints.size() > 0)) {
       LeafConstrainingNode firstConstraint = constraints.iterator().next();
       ConstraintLocator constraintLocator = firstConstraint.getConstraintLocator();
       s.append("\t");
       s.append(constraintLocator.getLabel(eObject));
       s.append(":");
       for (ConstrainingNode constraint : constraints) {
         s.append(" \'" + constraint.getLabel() + "'");
       }
     }
     s.append("\n");
   }
   return s.toString();
 }
Beispiel #2
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;
 }