Example #1
0
  private File getSelectedDirectory() {
    File directory = getSelectedFile();

    if (directory != null && !directory.isDirectory()) directory = directory.getParentFile();

    return directory;
  }
Example #2
0
  @FXML
  private void createDirButtonClicked(final ActionEvent event) {
    final File parent = assertNotNull("getSelectedDirectory()", getSelectedDirectory());

    final String dirName =
        showCreateOrRenameDialog(
            "Create folder",
            "What should be the new folder's name?",
            parent,
            null,
            (name) -> !createFile(parent, name).exists());

    if (dirName != null) {
      final File directory = createFile(parent, dirName);
      directory.mkdirs();
      if (!directory.isDirectory())
        showErrorDialog(
            "Failed to create directory!",
            "The directory could not be created! Maybe you're missing the required permissions?!");
      else {
        refresh();
        getSelectedFiles().clear();
        getSelectedFiles().add(directory);
      }
    }
  }
  public JdbcConnectionFactory(final File localRoot) {
    this.localRoot = assertNotNull("localRoot", localRoot);
    if (!localRoot.isDirectory())
      throw new IllegalArgumentException(
          "The given localRoot is not an existing directory: " + localRoot.getAbsolutePath());

    initProperties();
    initDriverClass();
  }