@FXML
 public void saveDirectory() {
   directory = null;
   DirectoryChooser directoryChooser = new DirectoryChooser();
   File file = directoryChooser.showDialog(null);
   directory = file;
 }
Exemple #2
0
  /**
   * Prompts the user to select a directory
   *
   * @param pTitle - Title to be displayed on the prompt window
   * @return Users selected directory
   * @throws Exception if the user clicks cancel or enter without choosing a directory
   */
  public static File getDir(String pTitle) throws Exception {
    dChooser.setTitle(pTitle);
    File dir = dChooser.showDialog(null);

    if (null == dir) {
      throw new Exception("No Directory Chosen");
    }
    return dir;
  }
  @Override
  public SelectorDialog show(String title) {
    setTitle(title);
    selectedDirectory = directoryChooser.showDialog(ownerWindow);

    if (selectedDirectory != null) {
      SelectorDialogService.setLastDirectory(selectedDirectory);
    }

    return this;
  }
 @FXML
 private void onBrowseButtonClick(ActionEvent event) {
   Stage stage = null;
   stage = (Stage) browseButton.getScene().getWindow();
   DirectoryChooser dirChoose = new DirectoryChooser();
   dirChoose.setTitle("Choose JDK Location");
   File selectedDir = dirChoose.showDialog(stage);
   if (selectedDir != null) {
     jdkLocationTextBox.setText(selectedDir.getPath());
   }
 }
 private void setupDirectorySelectMenuItem() {
   gitoliteDirectorySelectMenuItem.setOnAction(
       event -> {
         ApplicationModel model = ApplicationModel.getInstance();
         DirectoryChooser chooser = new DirectoryChooser();
         if (model.isRepoDirectoryDefined()) {
           chooser.setInitialDirectory(model.getRepoDirectory());
         }
         File selectedDirectory = chooser.showDialog(null);
         if (selectedDirectory != null) {
           model.setRepoDirectory(selectedDirectory);
           checkForDefinedGitRepoDirectory();
         }
       });
 }
  @FXML
  void browseDir() {

    DirectoryChooser directoryChooser = new DirectoryChooser();

    directoryChooser.setTitle("Select Archive Directory");
    // Show open file dialog

    File file = directoryChooser.showDialog(null);

    if (file != null) {

      txtDir.setText(txtDir.getText() + ";" + file.getPath());
      constants.addValue("s_dumpDir", txtDir.getText());
      generateBackupPaths();
    }
  }
  public void selectFolder(final JSObject callback) {
    DirectoryChooser dirChooser = new DirectoryChooser();
    File selectedFile = dirChooser.showDialog(stage);
    if (selectedFile != null) {
      System.out.println(selectedFile);
      final Object f[] = new Object[2];
      f[0] = null;
      f[1] = selectedFile.toString();

      Platform.runLater(
          new Runnable() {
            @Override
            public void run() {
              callback.call("call", f);
            }
          });
    }
  }
Exemple #8
0
 public void exportSFRQSetting(ActionEvent actionEvent) {
   log.info("Click 导出SFRQ设置");
   final UINode uiProject = plus.getService(TreeViewService.class).getCurrentUIProject();
   directoryChooser.setInitialDirectory(plus.getLastDir());
   final File outputDir = directoryChooser.showDialog(plus.getStage());
   if (outputDir == null || outputDir.isFile()) {
     return;
   }
   if (!outputDir.exists()) {
     outputDir.mkdirs();
   }
   plus.setLastDir(outputDir);
   final UINode sfrqSetting = UINode.findFromChildren(uiProject, UISFRQSetting_NAME);
   plus.getService(XMLService.class)
       .outputBusinessNodeToXML(
           sfrqSetting.getFirstBusinessNodeChild(),
           new File(outputDir, PlusFileUtil.newFileNameWithTimestamp(SFRQ_Collection_XML_NAME)));
 }
  @FXML
  protected void addAlbumButton() {
    // wybieranie folderu z albumem
    DirectoryChooser directoryChooser = new DirectoryChooser();
    directoryChooser.setTitle("Choose album folder");
    File selectedDirectory = directoryChooser.showDialog(root.getScene().getWindow());

    // kopiowanie albumu do folderu biblioteki
    File destinationDirectory = new File("C:/Users/Public/Music/" + selectedDirectory.getName());
    try {
      FileUtils.copyDirectory(selectedDirectory, destinationDirectory);
      flowPane.getChildren().clear();
      clearData();
      loadAlbums();
      drawAlbums();
    } catch (IOException e) {
      e.printStackTrace();
    }

    SystemTrayIcon.trayMessage("Succes", "Added new album");
  }
  @FXML
  private void selectFile() {
    if (!isChooserShown) {

      isChooserShown = true;
      File selectedFile;
      if (isFileToConvert) {
        selectedFile = fileChooser.showOpenDialog(new Stage());
      } else {
        selectedFile = directoryChooser.showDialog(new Stage());
      }
      isChooserShown = false;
      if (selectedFile != null) {
        buttonRemoveSubs.setDisable(false);
        file = selectedFile;
      }
    } else {
      alertInfo.showDialog(
          "FileChooser already in use",
          "Sorry, it's not possible to use multiple FileChoosers at the same time .");
    }
  }
 public void chooseFolder(ActionEvent event) {
   DirectoryChooser dc = new DirectoryChooser();
   dc.setTitle("选择路径");
   File file = dc.showDialog(toolTable.getScene().getWindow());
   pathField.setText(file.getPath());
 }
Exemple #12
0
 public static File creSaveToFoldDialog(Window parent, String initFileName) {
   DirectoryChooser dir = new DirectoryChooser();
   return dir.showDialog(parent);
 }
  void setupTracksContextMenu() {
    ContextMenu cm = tracksContextMenu;
    List<MenuItem> items = cm.getItems();
    items.clear();

    Playlist pl = getSelectedPlaylist();
    if (pl == null) {
      items.add(
          menuItem(
              "-> " + res.getString("add_to"),
              () -> {
                menuAddToPlaylist();
              }));
      if (rememberedPlaylist != null) {
        items.add(
            menuItem(
                "-> "
                    + String.format(
                        res.getString("add_to_featured"), rememberedPlaylist.getTitle()),
                () -> {
                  Track t = getSelectedTrack();
                  if (t != null) {
                    addToPlaylist(t, rememberedPlaylist);
                  }
                }));
      }
    } else {
      items.add(
          menuItem(
              "(+) " + res.getString("add_files"),
              () -> {
                FileChooser fileChooser = new FileChooser();
                fileChooser.setInitialDirectory(new File(System.getProperty("user.dir")));
                fileChooser.setTitle(String.format(res.getString("add_files_to"), pl.getTitle()));
                fileChooser
                    .getExtensionFilters()
                    .addAll(new FileChooser.ExtensionFilter("MP3", "*.mp3"));
                List<File> files = fileChooser.showOpenMultipleDialog(null);
                if (files != null) {
                  addToPlaylist(files, pl);
                }
              }));
      items.add(
          menuItem(
              "(+) " + res.getString("add_folder_recursively"),
              () -> {
                DirectoryChooser dirChooser = new DirectoryChooser();
                dirChooser.setTitle(String.format(res.getString("add_folder_to"), pl.getTitle()));
                dirChooser.setInitialDirectory(new File(System.getProperty("user.dir")));
                File dir = dirChooser.showDialog(null);
                if (dir == null) return;
                Collection<File> files = FileUtils.listFiles(dir, new String[] {"mp3"}, true);
                addToPlaylist(new ArrayList(files), pl);
              }));
      items.add(new SeparatorMenuItem());
      if (rememberedPlaylist != null)
        items.add(
            menuItem(
                "-> "
                    + String.format(
                        res.getString("add_to_featured"), rememberedPlaylist.getTitle()),
                () -> {
                  Track t = getSelectedTrack();
                  if (t != null) addToPlaylist(t, rememberedPlaylist);
                }));
      items.add(
          menuItem(
              "-> " + res.getString("add_to"),
              () -> {
                menuAddToPlaylist();
              }));
      items.add(new SeparatorMenuItem());
      items.add(
          menuItem(
              "(...) " + res.getString("rename_track"),
              () -> {
                renameTrack();
              }));
      items.add(new SeparatorMenuItem());
      items.add(
          menuItem(
              "(-) " + res.getString("delete_track") + pl.getTitle(),
              () -> {
                deleteTrackFromPlaylist();
              }));
      items.add(
          menuItem(
              "(-) " + res.getString("delete_dead_items"),
              () -> {
                Track t = getSelectedTrack();
                if (t == null) {
                  return;
                }
                deleteDeadFromOfflinePlaylist(pl);
              }));
    }
  }