private void initialize() {
    if (this.preferences != null && this.preferences.getSource() != null) {
      this.txtSource.setText(getQualifiedName(preferences.getSource()));
      //			this.txtTarget.setText(preferences.getTarget().getName());

      //			this.lstIntermediary.setItems(preferences.getLstIntermediary());

      switch (preferences.getPathOptions()) {
        case ALL_PATH:
          this.chkAllPath.setSelection(true);
          this.chkOnlyObject.setSelection(false);
          this.chkOnlyAspect.setSelection(false);
          break;
        case ONLY_ASPECT:
          this.chkAllPath.setSelection(false);
          this.chkOnlyObject.setSelection(false);
          this.chkOnlyAspect.setSelection(true);
          break;
        case ONLY_OBJECT:
          this.chkAllPath.setSelection(false);
          this.chkOnlyObject.setSelection(true);
          this.chkOnlyAspect.setSelection(false);
          break;
      }

      //			this.chkOrderValid.setSelection(preferences.isOrdered());
    }
  }
 /**
  * Constructor for WizardPage.
  *
  * @param pageName
  */
 public WizardPage2(Criteria preferences) {
   super("wizardPage");
   setTitle("CallGraph Analyzer");
   setDescription(
       "Indicando, oltre al nodo di origine, anche il nodo finale e quelli intermedi, E' possibile aumentare la precisione del grafo visualizzato.");
   this.preferences = preferences;
   this.sourceNode = preferences.getSource();
 }
  /** Ensures that both text fields are set. */
  private void dialogChanged() {
    // String source = this.txtSource.getText();
    // String target = this.txtTarget.getText();
    // String[] lstIntermediary = this.lstIntermediary.getItems();
    Node[] lstIntermediary = this.lstIntermediary.getItems();

    if (sourceNode != null && sourceNode.getId() > -1) {
      if (sourceNode instanceof Advice) {

        if (((Advice) sourceNode).getPointcutExpression() == null
            || ((Advice) sourceNode).getPointcutExpression().trim().length() == 0) {
          updateStatus("Nodo sorgente non indicato o non valido");
          return;
        }
      } else if (sourceNode.getName() == null) {
        updateStatus("Nodo sorgente non indicato o non valido");
        return;
      }
    } else {
      updateStatus("Indicare un nodo sorgente valido");
      return;
    }

    if (targetNode != null && targetNode.getId() > -1) {
      if (targetNode instanceof Advice) {
        if (((Advice) targetNode).getPointcutExpression() == null
            || ((Advice) targetNode).getPointcutExpression().trim().length() == 0) {
          updateStatus("Nodo destinazione non indicato o non valido");
          return;
        }
      } else if (sourceNode.getName() == null) {
        updateStatus("Nodo destinazione non indicato o non valido");
        return;
      }
    }
    if (targetNode instanceof Field) {
      updateStatus("Il nodo destinazione non puo' essere un campo");
      return;
    }

    if (lstIntermediary != null && lstIntermediary.length > 0) {
      for (int i = 0; i < lstIntermediary.length; i++) {
        if (!isValidElement(lstIntermediary[i])) {
          updateStatus(
              "Il nodo intermedio indicato come: "
                  + lstIntermediary[i].getName()
                  + " non e' un elemento valido, occorre rimuoverlo.");
          return;
        } else if (lstIntermediary[i] instanceof Field) {
          updateStatus(
              ""
                  + lstIntermediary[i].getName()
                  + ": non e' possibile indicare un campo come nodo intermedio");
          return;
        } else if (lstIntermediary[i].equals(sourceNode)) {
          updateStatus(
              "Il nodo intermedio indicato come: "
                  + lstIntermediary[i].getName()
                  + " coincide con il nodo sorgente.");
          return;
        } else if (lstIntermediary[i].equals(targetNode)) {
          updateStatus(
              "Il nodo intermedio indicato come: "
                  + lstIntermediary[i].getName()
                  + " coincide con il nodo destinazione.");
          return;
        }
        Node interI = lstIntermediary[i];
        for (int j = 0; j < lstIntermediary.length; j++) {
          if (i != j) {
            Node interJ = lstIntermediary[j];
            if (interI instanceof NodeContainer) {
              if (interJ instanceof NodeContainer) {
                if (containsContainer((NodeContainer) interI, (NodeContainer) interJ)) {
                  updateStatus(
                      "Il nodo intermedio : \""
                          + getQualifiedName(interI)
                          + "\" contiene il nodo \""
                          + getQualifiedName(interJ)
                          + "\"");
                  return;
                }
              } else if (interJ instanceof NodeLeaf) {
                if (containsContainer((NodeContainer) interI, interJ.getNodeContainer())) {
                  updateStatus(
                      "Il nodo intermedio : \""
                          + getQualifiedName(interI)
                          + "\" contiene il nodo \""
                          + getQualifiedName(interJ)
                          + "\"");
                  return;
                }
              }
            } else if (interI instanceof Interface && interJ instanceof NodeLeaf) {
              if (interI instanceof Aspect
                  && interJ instanceof Advice
                  && containsAdvice(
                      ((Aspect) interI),
                      ((Advice)
                          interJ))) { // ((Aspect)interI).getAdvicesList().contains((Advice)interJ)){
                updateStatus(
                    "Il nodo intermedio : \""
                        + getQualifiedName(interI)
                        + "\" contiene il nodo \""
                        + getQualifiedName(interJ)
                        + "\"");
                return;
              }
              if (interJ instanceof Method
                  && containsMethod(
                      ((Interface) interI),
                      ((Method)
                          interJ))) { // (((Interface)interI).getMethodsList().contains((Method)interJ))){
                updateStatus(
                    "Il nodo intermedio : \""
                        + getQualifiedName(interI)
                        + "\" contiene il nodo \""
                        + getQualifiedName(interJ)
                        + "\"");
                return;
              }
            }
          }
        }
      }
    }

    preferences.setLstIntermediary(lstIntermediary);
    preferences.setSource(this.sourceNode);
    preferences.setTarget(this.targetNode);

    preferences.setOrdered(this.chkOrderValid.getSelection());

    if (this.chkAllPath.getSelection()) {
      preferences.setPathOptions(Criteria.PathOptions.ALL_PATH);
      // this.chkAllPath.setEnabled(true);
    } else if (this.chkOnlyObject.getSelection() && this.chkOnlyAspect.getSelection()) {
      preferences.setPathOptions(Criteria.PathOptions.ALL_PATH);
    } else {
      if (this.chkOnlyObject.getSelection() && !this.chkOnlyAspect.getSelection())
        preferences.setPathOptions(Criteria.PathOptions.ONLY_OBJECT);
      else if (!this.chkOnlyObject.getSelection() && !this.chkOnlyAspect.getSelection()) {
        updateStatus("Indicare i percorsi da visualizzare");
        return;
      } else if (!this.chkOnlyObject.getSelection() && this.chkOnlyAspect.getSelection())
        preferences.setPathOptions(Criteria.PathOptions.ONLY_ASPECT);
    }
    updateStatus(null);
  }