Exemplo n.º 1
0
  protected void checkIfPathValid() {
    fFolder = null;
    IContainer folder = null;
    if (fUseFolderButton.isSelected()) {
      String pathStr = fContainerDialogField.getText();
      if (pathStr.length() == 0) {
        fContainerFieldStatus.setError(NewWizardMessages.NewSourceFolderDialog_error_enterpath);
        return;
      }
      IPath path = fCurrProject.getFullPath().append(pathStr);
      IWorkspace workspace = fCurrProject.getWorkspace();

      IStatus pathValidation = workspace.validatePath(path.toString(), IResource.FOLDER);
      if (!pathValidation.isOK()) {
        fContainerFieldStatus.setError(
            Messages.format(
                NewWizardMessages.NewSourceFolderDialog_error_invalidpath,
                pathValidation.getMessage()));
        return;
      }
      folder = fCurrProject.getFolder(pathStr);
    } else {
      folder = fCurrProject;
    }
    if (isExisting(folder)) {
      fContainerFieldStatus.setError(NewWizardMessages.NewSourceFolderDialog_error_pathexists);
      return;
    }
    fContainerFieldStatus.setOK();
    fFolder = folder;
  }
Exemplo n.º 2
0
 private void doSelectionChanged() {
   StatusInfo status = new StatusInfo();
   List selected = fHistoryList.getSelectedElements();
   if (selected.size() != 1) {
     status.setError(""); // $NON-NLS-1$
     fResult = null;
   } else {
     fResult = (IModelElement) selected.get(0);
   }
   fHistoryList.enableButton(
       0, fHistoryList.getSize() > selected.size() && selected.size() != 0);
   fHistoryStatus = status;
   updateStatus(status);
 }