예제 #1
0
파일: Prompt.java 프로젝트: jcjolley/mo
  /**
   * 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;
  }
예제 #2
0
 @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());
   }
 }
예제 #3
0
  @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();
    }
  }
예제 #4
0
  @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");
  }
예제 #5
0
 public void chooseFolder(ActionEvent event) {
   DirectoryChooser dc = new DirectoryChooser();
   dc.setTitle("选择路径");
   File file = dc.showDialog(toolTable.getScene().getWindow());
   pathField.setText(file.getPath());
 }
예제 #6
0
  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);
              }));
    }
  }
 @Override
 public void setTitle(String string) {
   directoryChooser.setTitle(string);
 }