Package no.hal.jex

Examples of no.hal.jex.AbstractRequirement


public class CreateRequirementsFromJavaModelCommandHandler extends AbstractCommandHandler {

  @Override
  protected Command createEmfCommand(ExecutionEvent event) {
    List<JavaElement> javaElements = new ArrayList<JavaElement>();
    AbstractRequirement reqParent = null;
    ISelection selection = getSelection(event);
    if (selection instanceof IStructuredSelection) {
      for (Iterator<?> it = ((IStructuredSelection)selection).iterator(); it.hasNext();) {
        Object selected = it.next();
        if (selected instanceof AbstractRequirement) {
View Full Code Here


      }
      // MessageFormat.format(req.getWhat(), new Object[]{<java_element>.getName()});
    }
    if (obj instanceof AbstractRequirement) {
      text += "<p>";
      AbstractRequirement req = (AbstractRequirement)obj;
      for (AbstractRequirement subReq: req.getRequirements()) {
        String uri = getResourceURI(subReq.eResource(), subReq);
        if (uri != null) {
          text += "<li><a href='" + uri + "'>" + subReq.getText() + "</a></li>";
        }
      }
View Full Code Here

    }
    return (text != null ? text : "");
  }

  private void updateBrowser() {
    AbstractRequirement req = getSelectedRequirement();
    browser.setText(req != null ? getBrowserText(req) : "");
  }
View Full Code Here

//    System.out.println("Changing to " + location);
    if (location == null || (! location.startsWith(RESOURCE_URI_PROTOCOL_PREFIX))) {
      return;
    }
    location = location.substring(RESOURCE_URI_PROTOCOL_PREFIX.length());
    AbstractRequirement req = getSelectedRequirement();
    if (req == null) {
      return;
    }
    boolean validate = false;
    if (location.endsWith(REQUIREMENT_VALIDATION_SUFFIX)) {
      location = location.substring(0, location.length() - REQUIREMENT_VALIDATION_SUFFIX.length());
      validate = true;
    }
    Resource res = req.eResource();
    EObject eo = res.getEObject(location);
    if (eo instanceof AbstractRequirement) {
      setSelectedRequirement((AbstractRequirement)eo);
      fireRequirementSelected(req);
      if (validate && req instanceof JavaRequirement) {
View Full Code Here

      partLabel = partLabel + ": " + label;
    }
    return partLabel;
  }
  private String getPartNumber(ExercisePart part) {
    AbstractRequirement parent = part.getParent();
    // parent can be null after deletion of node
    int pos = (parent != null ? parent.getRequirements().indexOf(part) : -1);
    String partNumber = (pos < 0 ? "?" : Integer.toString(pos + 1));
    if (parent instanceof ExercisePart) {
      partNumber = getPartNumber((ExercisePart)parent) + "." + partNumber;
    }
    return partNumber;
View Full Code Here

      } else {
        setRightControl(startupMessage);
      }
    } else {
      String location = null;
      AbstractRequirement descriptionReq = AbstractRequirementImpl.findNearestPreviousRequirementWithDescription(req);
      if (descriptionReq != null) {
        URI uri = descriptionReq.eResource().getURI().appendFragment(JexXmlHelper.getID(descriptionReq, "description")); // .getDescriptionURI();
        location = createLocation(uri);
        if (location != null && (! descriptionReq.eResource().getResourceSet().getURIConverter().exists(URI.createURI(location), Collections.EMPTY_MAP))) {
          location = null;
        }
      }
      setRightControl(exerciseDetailsView);
      if (location != null) {
        exerciseDetailsView.setUrl(location);
      } else {
        String description = (descriptionReq != null ? descriptionReq.getDescription() : null);
        if (description != null) {
          exerciseDetailsView.setText(description);
        }
      }
    }
View Full Code Here

  }
 
  @Override
  protected Command createActionCommand(EditingDomain editingDomain, Collection selection) {
    List javaElements = new ArrayList();
    AbstractRequirement reqParent = null;
    for (Iterator it = selection.iterator(); it.hasNext();) {
      Object selected = it.next();
      if (selected instanceof AbstractRequirement) {
        if (reqParent != null) {
          return UnexecutableCommand.INSTANCE;
View Full Code Here

      satisfied = Boolean.FALSE;
    }
    req.setSatisfied(satisfied);
    List<AbstractRequirement> changes = new ArrayList<AbstractRequirement>();
    validateRequirements((JexResource) req.eResource(), changes);
    AbstractRequirement childReq = req;
    while (childReq != null) {
      if (changes.indexOf(childReq) < 0) {
        changes.add(childReq);
      }
      childReq = childReq.getParent();
    }
    exerciseView.updateViewer(changes, true);
    jexLog(req, TEST_RUN_STATUS, satisfied, logValidateTestRunSeverity);
  }
View Full Code Here

    createPartControl(parent);
    editor.addSelectionChangedListener(this);
  }
 
  public void selectionChanged(SelectionChangedEvent event) {
    AbstractRequirement selection = null;
    if (event.getSelection() instanceof IStructuredSelection) {
      Object o = ((IStructuredSelection)event.getSelection()).getFirstElement();
      if (o instanceof AbstractRequirement) {
        selection = (AbstractRequirement)o;
      }
View Full Code Here

  }
 
  private static int AUTO_EXPAND_TO = 2; // ALL_LEVELS
 
  public void setExerciseResource(JexResource res) {
    AbstractRequirement oldSelection = null;
    if (res != null && res == getInput()) {
      oldSelection = getSelectedRequirement();
    }
    setInput(res); // res != null ? (Object)res : JexPlugin.getDefault().getExerciseManager());
    if (oldSelection != null) {
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.