コード例 #1
0
  private IStatus validateLocation() {
    String location = projectLocationField.getText();

    if (!new Path(location).isValidPath(getProjectName())) {
      return new Status(
          IStatus.ERROR,
          DartToolsPlugin.PLUGIN_ID,
          ProjectMessages.NewProjectCreationPage_invalid_loc);
    }

    if (doesProjectExist()) {
      return new Status(
          IStatus.ERROR,
          DartToolsPlugin.PLUGIN_ID,
          NLS.bind(ProjectMessages.NewApplicationWizardPage_error_existing, getProjectName()));
    }

    IStatus status = DirectoryVerification.getOpenDirectoryLocationStatus(new File(location));

    if (!status.isOK()) {
      return status;
    }

    return Status.OK_STATUS;
  }
コード例 #2
0
  private IStatus validateLocation() {
    String location = projectLocationField.getText();
    IPath locationPath = new Path(location);

    if (!locationPath.isValidPath(getProjectName())) {
      return new Status(
          IStatus.ERROR,
          DartToolsPlugin.PLUGIN_ID,
          ProjectMessages.NewProjectCreationPage_invalid_loc);
    }

    // TODO(scheglov) check after Pub issue fixed
    // https://code.google.com/p/dart/issues/detail?id=10439
    if (locationPath.isUNC()) {
      return new Status(
          IStatus.ERROR,
          DartToolsPlugin.PLUGIN_ID,
          ProjectMessages.NewProjectCreationPage_invalid_loc_unc);
    }

    if (doesProjectExist()) {
      return new Status(
          IStatus.ERROR,
          DartToolsPlugin.PLUGIN_ID,
          NLS.bind(ProjectMessages.NewApplicationWizardPage_error_existing, getProjectName()));
    }

    IStatus status = DirectoryVerification.getOpenDirectoryLocationStatus(new File(location));

    if (!status.isOK()) {
      return status;
    }

    return Status.OK_STATUS;
  }