Package no.hal.jex

Examples of no.hal.jex.AbstractRequirement


      listener.requirementValidationRequested(req);
    }
  }

  public void selectionChanged(SelectionChangedEvent event) {
    AbstractRequirement req = (AbstractRequirement)getSelection(event.getSelection(), AbstractRequirement.class);
    if (req != null) {
      fireRequirementSelected(req);
    }
  }
View Full Code Here


  public Object getParent(Object child) {
    if (child instanceof Resource) {
      return ((Resource) child).getResourceSet();
    } else if (child instanceof AbstractRequirement) {
      AbstractRequirement req = (AbstractRequirement) child, parent = req.getParent();
      return (parent == null || parent instanceof Exercise ? req.eResource() : parent);
    }
    return null;
  }
View Full Code Here

    jexSelectionText.setText(selection instanceof AbstractRequirement ? getRequirementText((AbstractRequirement) selection) : "");
  }

  protected String getRequirementText(AbstractRequirement req) {
    StringBuilder builder = new StringBuilder();
    AbstractRequirement descriptionReq = AbstractRequirementImpl.findNearestPreviousRequirementWithDescription(req);
    if (descriptionReq != null) {
      appendText(builder, descriptionReq.getDescription(), null);
    }
    appendText(builder, req.getComment(), "<p>%s");
    StringBuilder message = new StringBuilder();
    if (req instanceof Requirement) {
      for (String s : ((Requirement) req).getMessages()) {
View Full Code Here

  }

  protected static void simplifyRequirements(Exercise ex) {
    EList<AbstractRequirement> requirements = ex.getRequirements();
    if (requirements.size() == 1) {
      AbstractRequirement req = requirements.get(0);
      requirements.clear();
      requirements.addAll(req.getRequirements());
    }
  }
View Full Code Here

    return null;
  }
 
  public URI getDescriptionURI() {
    URI uri = null;
    AbstractRequirement req = getParent();
    if (req != null) {
      uri = ((AbstractRequirementImpl)req).getDescriptionURI();
    } else {
      uri = eResource().getURI();
    }
View Full Code Here

 
  //
 
  public static AbstractRequirement findNearestPreviousRequirementWithDescription(AbstractRequirement req) {
    int pos = -1;
    AbstractRequirement parent = req.getParent();
    do {
      String description = req.getDescription();
      if (description != null && description.length() > 0) {
        return req;
      }
      if (parent == null) {
        return null;
      } else if (pos < 0) {
        pos = parent.getRequirements().indexOf(req);
      }
      pos--;
      if (pos < 0) {
        req = parent;
        parent = req.getParent();
      } else {
        req = (AbstractRequirement) parent.getRequirements().get(pos);
      }
    } while (req != null);
    return null;
  }
View Full Code Here

  protected EClass eStaticClass() {
    return JexPackage.Literals.EXERCISE_PART;
  }

  public static String getPartNumber(ExercisePart part) {
    AbstractRequirement parent = part.getParent();
    String partNumber = Integer.toString(parent.getRequirements().indexOf(part) + 1);
    if (parent instanceof ExercisePart) {
      partNumber = getPartNumber((ExercisePart)parent) + "." + partNumber;
    }
    return partNumber;
  }
View Full Code Here

TOP

Related Classes of no.hal.jex.AbstractRequirement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.