/** Get the default folder URL */ public URL getDefaultFolderURL() { try { final File defaultFolder = getDefaultFolder(); return (defaultFolder != null) ? defaultFolder.toURI().toURL() : null; } catch (MalformedURLException exception) { throw new RuntimeException("Exception getting the default document URL.", exception); } }
/** * Show the selector for selecting the default folder. * * @return true if the user selected a default folder and false if not. */ protected boolean showDefaultFolderSelector() throws Exception { final JFileChooser selector = new JFileChooser(_activeFileChooser.getCurrentDirectory()); selector.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); final String title = (_subfolderName == null) ? "Default Folder" : "Default Parent Folder of " + _subfolderName; selector.setDialogTitle(title); final int status = selector.showDialog(_view, "Make Default"); switch (status) { case JFileChooser.APPROVE_OPTION: final File defaultFolder = selector.getSelectedFile(); if (defaultFolder != null) { _folderTracker.cacheURL(defaultFolder.toURI().toURL()); return true; } else { return false; } default: return false; } }