private void browseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseActionPerformed // TODO add your handling code here: String dlgTitle = NbBundle.getMessage(DefaultProjectCopyPanel.class, "TITLE_BrowseProjectLocation"); String okText = NbBundle.getMessage(DefaultProjectCopyPanel.class, "LBL_BrowseProjectLocation_OK_Button"); File dir = new FileChooserBuilder(DefaultProjectCopyPanel.class).setDefaultWorkingDirectory( new File(projectLocation.getText())).setDirectoriesOnly( true).setTitle(dlgTitle).setApproveText(okText).showOpenDialog(); if (dir != null) { projectLocation.setText(dir.getAbsolutePath()); } }//GEN-LAST:event_browseActionPerformed
private void locationButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_locationButtonActionPerformed FileChooserBuilder builder = new FileChooserBuilder(PatchContextChooser.class); File file = builder.setApproveText(NbBundle.getMessage(PatchContextChooser.class, "LBL_Select")).showOpenDialog(); if (file != null) { FileObject fob = FileUtil.toFileObject(file); locationField.setText(FileUtil.getFileDisplayName(fob)); } }//GEN-LAST:event_locationButtonActionPerformed
private void chooseDocButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chooseDocButtonActionPerformed File file = new FileChooserBuilder(SupportPanel.class) .setDirectoriesOnly(true) .setDefaultWorkingDirectory(null) .setTitle(NbBundle.getMessage(SupportPanel.class, "LBL_Select_Directory")) .setApproveText(NbBundle.getMessage(SupportPanel.class, "LBL_Select_Directory")) .showOpenDialog(); if (file != null) { if (!new File(new File(file, "groovy-jdk"), "index.html").isFile()) { DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message( NbBundle.getMessage(SupportPanel.class, "LBL_Not_groovy_doc"), NotifyDescriptor.Message.WARNING_MESSAGE)); return; } groovyDocTextField.setText(file.getAbsolutePath()); } }//GEN-LAST:event_chooseDocButtonActionPerformed
private void chooseDirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chooseDirActionPerformed File file = new FileChooserBuilder(GrailsRuntimePanel.class) .setDirectoriesOnly(true) .setDefaultWorkingDirectory(new File(System.getProperty("user.home"))) .setApproveText(NbBundle.getMessage(GrailsRuntimePanel.class, "LBL_Select_Directory")) .setTitle(NbBundle.getMessage(GrailsRuntimePanel.class, "LBL_Select_Directory")) .showOpenDialog(); if (file != null && RuntimeHelper.isValidRuntime(file)) { grailsHomeLocation.setText(file.getAbsolutePath()); } else if (file != null) { displayGrailsHomeWarning(); } }//GEN-LAST:event_chooseDirActionPerformed
fcb.setDefaultWorkingDirectory(userHome); fcb.addFileFilter(ff); fcb.setApproveText(NbBundle.getMessage(this.getClass(), "chooser.shape.approve.text")); File file = fcb.showOpenDialog();
/** * Shows the actual filepicker and return the selected file or dir * @return The selected file */ private File showPicker() { String name = AreaFieldPreference.LAST_SHAPE_DIR.getValue(); File userHome = (name.equals("")) ? new File(System.getProperty(USER_HOME)) : new File(name); List<String> supportedExtensions = new ArrayList<String>(); supportedExtensions.add(".shp"); FileFilter ff = FilePickerUtil.createSwingFileFilter(supportedExtensions, "Shape file (*.shp)"); FileChooserBuilder fcb = new FileChooserBuilder(FILECHOOSER_DIR); fcb.setTitle(FILECHOOSER_TITLE); fcb.setDefaultWorkingDirectory(userHome); fcb.addFileFilter(ff); fcb.setApproveText(FILECHOOSER_APPROVE_TEXT); File file = fcb.showOpenDialog(); // file will be null if cancel is pressed if (file != null) { // save the file path for next time window is opened AreaFieldPreference.LAST_SHAPE_DIR.saveValue(file.getPath()); } return file; }
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed File file = new FileChooserBuilder(SiteZipPanel.class.getName()) .setTitle(Bundle.LBL_SiteZipPanel_Title()) .setFilesOnly(true) .setApproveText(Bundle.LBL_SiteZipPanel_Select()) .showOpenDialog(); if (file != null) { ((JTextField)(archiveComboBox.getEditor().getEditorComponent())).setText(file.getAbsolutePath()); } }//GEN-LAST:event_browseButtonActionPerformed
fileChooserBuilder.setTitle("Load project"); fileChooserBuilder.setDefaultWorkingDirectory(initialDirectory); fileChooserBuilder.setApproveText("Load"); fileChooserBuilder.setDirectoriesOnly(true);
fcb.setTitle(FILEPICKER_TITLE); fcb.setDefaultWorkingDirectory(new File(System.getProperty("user.home"))); fcb.setApproveText(FILEPICKER_APPROVE);
/** * Get the save location for the file. * pops up a save dialog * @return a file from the save dialog */ public File getSaveLocation() { if (fcb == null) { fcb = new FileChooserBuilder("Export-directory"); fcb.setTitle(FILECHOOSER_TITLE); fcb.setApproveText(FILECHOOSER_OK); fcb.addFileFilter(new FileFilter() { @Override public boolean accept(File pathname) { if (pathname.isDirectory() && pathname.getName().startsWith(".")) { return false; } return true; } @Override public String getDescription() { return FILECHOOSER_FILE_DESC; } }); } File workingDirectory = new File(SensorPreference.LAST_EXPORT_DIR.getValue()); fcb.setDefaultWorkingDirectory(workingDirectory); return fcb.showSaveDialog(); }
@NbBundle.Messages("DirectoryProblemResolver.dialog.choose=Choose") @Override public Future<ProjectProblemsProvider.Result> resolve() { File projectDir = FileUtil.toFile(project.getProjectDirectory()); File selectedDir = new FileChooserBuilder(ProjectPropertiesProblemProvider.class) .setTitle(dialogTitle) .setDefaultWorkingDirectory(projectDir) .forceUseOfDefaultWorkingDirectory(true) .setDirectoriesOnly(true) .setFileHiding(true) .setApproveText(Bundle.DirectoryProblemResolver_dialog_choose()) .showOpenDialog(); if (selectedDir == null) { // no file selected return new Done(ProjectProblemsProvider.Result.create(ProjectProblemsProvider.Status.UNRESOLVED)); } // save metadata String relPath = ProjectPropertiesSupport.relativizeFile(projectDir, selectedDir); PhpProjectProperties.save(project, Collections.singletonMap(propertyName, relPath), Collections.<String, String>emptyMap()); // return unresolved state; it will change automatically once the metadata are really saved (property change will be fired) return new Done(ProjectProblemsProvider.Result.create(ProjectProblemsProvider.Status.UNRESOLVED)); }