org.openide.filesystems.FileChooserBuilder Java Examples

The following examples show how to use org.openide.filesystems.FileChooserBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExistingProjectVisual.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private File browseFile(String dirKey, String title, String currentDirectory) {
    File workDir = null;
    if (currentDirectory != null && !currentDirectory.isEmpty()) {
        File currDir = new File(currentDirectory);
        if (currDir.isDirectory()) {
            workDir = currDir;
        }
    }
    FileChooserBuilder builder = new FileChooserBuilder(ExistingProjectVisual.class.getName() + dirKey)
            .setTitle(title)
            .setDirectoriesOnly(true);
    if (workDir != null) {
        builder.setDefaultWorkingDirectory(workDir)
                .forceUseOfDefaultWorkingDirectory(true);
    }
    return builder.showOpenDialog();
}
 
Example #2
Source File: AttachmentsPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void saveToFile() {
    final File file = new FileChooserBuilder(AttachmentsPanel.class)
            .setFilesOnly(true).showSaveDialog();
    if (file != null) {
        String progressFormat = NbBundle.getMessage(
                                    SaveAttachmentAction.class,
                                    "Attachment.saveToFile.progress"); //NOI18N
        String progressMessage = MessageFormat.format(progressFormat, getFilename());
        final ProgressHandle handle = ProgressHandleFactory.createHandle(progressMessage);
        handle.start();
        handle.switchToIndeterminate();
        Support.getInstance().getParallelRP().post(new Runnable() {
            @Override
            public void run() {
                try {
                    getAttachmentData(file);
                } catch (IOException ioex) {
                    LOG.log(Level.INFO, ioex.getMessage(), ioex);
                } finally {
                    handle.finish();
                }
            }
        });
    }
}
 
Example #3
Source File: BigStringCustomEditor.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
@NbBundle.Messages("DLG_SaveToFile=Save to File")
public void actionPerformed(ActionEvent e) {
    // Save
    FileChooserBuilder fchb = new FileChooserBuilder(BigStringCustomEditor.class);
    fchb.setTitle(Bundle.DLG_SaveToFile());
    final File f = fchb.showSaveDialog();
    if (f != null) {
        new RequestProcessor(BigStringCustomEditor.class).post(new Runnable() {
            @Override
            public void run() {
                save(f);
            }
        });
    }
}
 
Example #4
Source File: ScreenshotComponent.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void save() throws IOException {
    FileChooserBuilder fchb = new FileChooserBuilder(ScreenshotComponent.class);
    String[] writerFileSuffixes = ImageIO.getWriterFileSuffixes();
    fchb.setFileFilter(new FileNameExtensionFilter(Bundle.CTL_ImageFiles(), writerFileSuffixes));
    File file = fchb.showSaveDialog();
    if (file != null) {
        if (file.exists()) {
            NotifyDescriptor nd = new NotifyDescriptor.Confirmation(Bundle.MSG_Overwrite(file.getName()), toString());
            Object doOverwrite = DialogDisplayer.getDefault().notify(nd);
            if (!NotifyDescriptor.YES_OPTION.equals(doOverwrite)) {
                return ;
            }
        }
        canvas.save(file);
    }
}
 
Example #5
Source File: PathUiSupport.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void addFolders() {
    FileChooserBuilder builder = new FileChooserBuilder(directoryHandler.getDirKey())
            .setDirectoriesOnly(true)
            .setTitle(NbBundle.getMessage(PathUiSupport.class, "LBL_AddFolders_DialogTitle"));
    File currentDirectory = directoryHandler.getCurrentDirectory();
    if (currentDirectory != null) {
        builder.forceUseOfDefaultWorkingDirectory(true)
                .setDefaultWorkingDirectory(currentDirectory);
    }
    File[] selectedFiles = builder.showMultiOpenDialog();
    if (selectedFiles != null
            && selectedFiles.length > 0) {
        String[] paths = new String[selectedFiles.length];
        for (int i = 0; i < selectedFiles.length; i++) {
            paths[i] = selectedFiles[i].getAbsolutePath();
        }
        int[] newSelection = PathUiSupport.addFolders(listModel, list.getSelectedIndices(), paths);
        list.setSelectedIndices(newSelection);
    }
}
 
Example #6
Source File: Utils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static File browseAction(String dirKey, String title, boolean filesOnly, File workDir) {
    FileChooserBuilder builder = new FileChooserBuilder(dirKey)
            .setTitle(title);
    if (workDir != null) {
        builder.setDefaultWorkingDirectory(workDir)
                .forceUseOfDefaultWorkingDirectory(true);
    }
    if (filesOnly) {
        builder.setFilesOnly(true);
    } else {
        builder.setDirectoriesOnly(true);
    }
    File selectedFile = builder.showOpenDialog();
    if (selectedFile != null) {
        return FileUtil.normalizeFile(selectedFile);
    }
    return null;
}
 
Example #7
Source File: DialogProviderManager.java    From netbeans-mmd-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public File msgSaveFileDialog(final Component parentComponent, final String id, final String title, final File defaultFolder, final boolean fileOnly, final FileFilter[] fileFilters, final String approveButtonText) {
  final FileChooserBuilder builder = new FileChooserBuilder(id)
          .setTitle(title)
          .setDefaultWorkingDirectory(defaultFolder)
          .setFilesOnly(fileOnly)
          .setApproveText(approveButtonText);

  for (final FileFilter filter : fileFilters) {
    builder.addFileFilter(filter);
  }

  if (fileFilters.length != 0) {
    builder.setFileFilter(fileFilters[0]);
  }

  return builder.showSaveDialog();
}
 
Example #8
Source File: CreateProjectVisualPanel1.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
//        File path = new File(jTextField1.getText());
//        if (path.isDirectory()) {

        FileChooserBuilder builder = new FileChooserBuilder(this.getClass());
        builder.setDirectoriesOnly(true);
        builder.setTitle("Select Project Folder");
        File file = builder.showOpenDialog();
        if (file != null) {
            try {
                jTextField1.setText(file.getAbsolutePath() + File.separator + jTextField2.getText());
            } catch (Exception e) {
            }
        }
//        }
    }
 
Example #9
Source File: DialogProviderManager.java    From netbeans-mmd-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public File msgOpenFileDialog(final Component parentComponent, final String id, final String title, final File defaultFolder, final boolean fileOnly, final FileFilter[] fileFilters, final String approveButtonText) {
  final FileChooserBuilder builder = new FileChooserBuilder(id)
          .setTitle(title)
          .setDefaultWorkingDirectory(defaultFolder)
          .setFilesOnly(fileOnly)
          .setApproveText(approveButtonText);

  for (final FileFilter filter : fileFilters) {
    builder.addFileFilter(filter);
  }

  if (fileFilters.length != 0) {
    builder.setFileFilter(fileFilters[0]);
  }

  return builder.showOpenDialog();
}
 
Example #10
Source File: PHPSamplesPanelVisual.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@NbBundle.Messages("PhpSamplePanelVisual.fileChooser.title=Select Project Location")
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
    FileChooserBuilder builder = new FileChooserBuilder(PHPSamplesPanelVisual.class)
            .setTitle(Bundle.PhpSamplePanelVisual_fileChooser_title())
            .setDirectoriesOnly(true)
            .forceUseOfDefaultWorkingDirectory(true);
    String path = projectLocationTextField.getText();
    if (path.length() > 0) {
        File f = new File(path);
        if (f.exists()) {
            builder.setDefaultWorkingDirectory(f);
        }
    }
    File selectedFile = builder.showOpenDialog();
    if (selectedFile != null) {
        projectLocationTextField.setText(FileUtil.normalizeFile(selectedFile).getAbsolutePath());
    }
    panel.fireChangeEvent();

}
 
Example #11
Source File: DirectoryProblemResolver.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@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));
}
 
Example #12
Source File: SearchScopeBrowse.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Open file chooser to choose search roots.
 */
private FileObject[] chooseRoots() {
    FileChooserBuilder chooserBuilder =
            new FileChooserBuilder(SearchScopeBrowse.class);
    chooserBuilder.setTitle(UiUtils.getText(
            "LBL_ScopeBrowseFileChooserTitle"));                    //NOI18N
    chooserBuilder.setApproveText(UiUtils.getText(
            "LBL_ScopeBrowseFileChooserApprove"));                  //NOI18N
    File[] files = chooserBuilder.showMultiOpenDialog();
    if (files == null) {
        files = new File[0];
    }
    List<File> existingFiles = selectExistingFiles(files);
    FileObject[] fileObjects = new FileObject[existingFiles.size()];
    for (int i = 0; i < existingFiles.size(); i++) {
        fileObjects[i] = FileUtil.toFileObject(existingFiles.get(i));
    }
    if (fileObjects.length > 0) {
        roots = fileObjects;
    }
    return fileObjects;
}
 
Example #13
Source File: MainMemoryPanel.java    From BART with MIT License 6 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
    File home = new File(System.getProperty("user.home"));
    File toLoad = new FileChooserBuilder(" 'Instance/Schema' XML File")
                                .setTitle("Choose File")
                                .setDefaultWorkingDirectory(home)
                                .setApproveText("OK")
                                .setAcceptAllFileFilterUsed(false)
                                .addFileFilter(new FileNameExtensionFilter("XML import file", "xml","XML"))
                                .showOpenDialog();
                
        if(toLoad==null){
            return;
        }
        FileObject fo = FileUtil.toFileObject(toLoad);
        if(fo.isFolder()){
            DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message("Select 'file.xml' no folder", NotifyDescriptor.INFORMATION_MESSAGE));
            return;
        }
        field.setText(fo.getPath());
}
 
Example #14
Source File: SampleVisualPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
    File workDir = null;
    String projectLocation = getProjectLocation();
    if (projectLocation != null && !projectLocation.isEmpty()) {
        File projDir = new File(projectLocation);
        if (projDir.isDirectory()) {
            workDir = projDir;
        }
    }
    if (workDir == null) {
        workDir = ProjectChooser.getProjectsFolder();
    }
    File projectDir = new FileChooserBuilder(SampleVisualPanel.class)
            .setTitle(NbBundle.getMessage(SampleVisualPanel.class, "TTL_DialogLocation"))   // NOI18N
            .setDirectoriesOnly(true)
            .setDefaultWorkingDirectory(workDir)
            .forceUseOfDefaultWorkingDirectory(true)
            .showOpenDialog();
    if (projectDir != null) {
        projectLocationTextField.setText(FileUtil.normalizeFile(projectDir).getAbsolutePath());
    }
}
 
Example #15
Source File: SelectionPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Shows the dialog for the selection of the library folder.
 */
@NbBundle.Messages({"SelectionPanel.browseDialog.title=Select directory for JS libraries"})
private void showBrowseDialog() {
    File libraryFolder = PropertyUtils.resolveFile(webRoot, getLibraryFolder());
    File selectedDir = new FileChooserBuilder(SelectionPanel.class)
            .setDirectoriesOnly(true)
            .setTitle(Bundle.SelectionPanel_browseDialog_title())
            .setDefaultWorkingDirectory(libraryFolder)
            .forceUseOfDefaultWorkingDirectory(true)
            .showOpenDialog();
    if (selectedDir != null) {
        String relativePath = PropertyUtils.relativizeFile(webRoot, selectedDir);
        String path;
        if (relativePath == null) {
            path = selectedDir.getAbsolutePath();
        } else {
            path = relativePath;
        }
        folderField.setText(path);
    }
}
 
Example #16
Source File: SourcesPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private String browseFolder(String title, File currentPath) {
    File workDir = currentPath;
    if (workDir == null || !workDir.exists()) {
        workDir = FileUtil.toFile(project.getProjectDirectory());
    }
    File folder = new FileChooserBuilder(SourcesPanel.class)
            .setTitle(title)
            .setDirectoriesOnly(true)
            .setDefaultWorkingDirectory(workDir)
            .forceUseOfDefaultWorkingDirectory(true)
            .setFileHiding(true)
            .showOpenDialog();
    if (folder == null) {
        return null;
    }
    String filePath = project.is.relativizeFile(FileUtil.toFile(project.getProjectDirectory()), folder);
    if (filePath == null) {
        // path cannot be relativized
        filePath = folder.getAbsolutePath();
    }
    return beautifyPath(filePath);
}
 
Example #17
Source File: PlainTextEditor.java    From netbeans-mmd-plugin with Apache License 2.0 6 votes vote down vote up
private void buttonLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonLoadActionPerformed
  final File home = new File(System.getProperty("user.home")); //NOI18N
  final File toOpen = new FileChooserBuilder("user-home-dir"). //NOI18N
      setTitle(java.util.ResourceBundle.getBundle("com/igormaznitsa/nbmindmap/i18n/Bundle").getString("PlainTextEditor.buttonLoadActionPerformed.title")).
      addFileFilter(TEXT_FILE_FILTER).setFileFilter(TEXT_FILE_FILTER).
      setFilesOnly(true).
      setDefaultWorkingDirectory(home).
      showOpenDialog();
  if (toOpen != null) {
    try {
      final String text = FileUtils.readFileToString(toOpen, "UTF-8"); //NOI18N
      setText(text);
    }
    catch (Exception ex) {
      LOGGER.error("Error during text file loading", ex); //NOI18N
      NbUtils.msgError(null, java.util.ResourceBundle.getBundle("com/igormaznitsa/nbmindmap/i18n/Bundle").getString("PlainTextEditor.buttonLoadActionPerformed.msgError"));
    }
  }
}
 
Example #18
Source File: ModelImporterVisualPanel1.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
    if (loading.get()) {
        return;
    }
    loading.set(true);
    FileChooserBuilder builder = new FileChooserBuilder(this.getClass());
    builder.setTitle("Select Model File");
    final File file = builder.showOpenDialog();
    if (file != null) {
        jTextField1.setText(file.getAbsolutePath());
        new Thread(new Runnable() {

            public void run() {
                ProgressHandle handle = ProgressHandleFactory.createHandle("Opening Model..");
                handle.start();
                loadModel(file);
                handle.finish();
                loading.set(false);
            }
        }).start();
    }
}
 
Example #19
Source File: OpenFileAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Creates and initializes a file chooser.
 *
 * @return  the initialized file chooser
 */
protected JFileChooser prepareFileChooser() {
    FileChooserBuilder fcb = new FileChooserBuilder(OpenFileAction.class);
    fcb.setSelectionApprover(new OpenFileSelectionApprover());
    fcb.setFilesOnly(true);
    fcb.addDefaultFileFilters();
    for (OpenFileDialogFilter filter :
            Lookup.getDefault().lookupAll(OpenFileDialogFilter.class)) {
        fcb.addFileFilter(filter);
    }
    JFileChooser chooser = fcb.createFileChooser();
    chooser.setMultiSelectionEnabled(true);
    chooser.getCurrentDirectory().listFiles(); //preload
    chooser.setCurrentDirectory(getCurrentDirectory());
    if (currentFileFilter != null) {
        for (FileFilter ff : chooser.getChoosableFileFilters()) {
            if (currentFileFilter.equals(ff.getDescription())) {
                chooser.setFileFilter(ff);
                break;
            }
        }
    }
    HelpCtx.setHelpIDString(chooser, getHelpCtx().getHelpID());
    return chooser;
}
 
Example #20
Source File: OpenEgtaskFile.java    From BART with MIT License 6 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
    File home = new File(System.getProperty("user.home"));
    File toLoad = new FileChooserBuilder("EGTAK_CONF_FILE")
                                    .setTitle("Load File")
                                    .setDefaultWorkingDirectory(home)
                                    .setApproveText("Load")
                                    .setFilesOnly(true)
                                    .setAcceptAllFileFilterUsed(false)
                                    .addFileFilter(new FileNameExtensionFilter("XML Configuration", "xml","XML"))
                                    .showOpenDialog();
    if(toLoad==null){
        return;
    }
    FileObject fo = FileUtil.toFileObject(toLoad);
    if(fo.isFolder()){
        DialogDisplayer.getDefault().notify(myNotify("Select xml file no a folder"));
        return;
    }
    
    if(!controlFile(fo))return;

    ILoadEGTask load = Lookup.getDefault().lookup(ILoadEGTask.class);
    load.load(fo);
}
 
Example #21
Source File: SampleVisualPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
    File workDir = null;
    String projectLocation = getProjectLocation();
    if (projectLocation != null && !projectLocation.isEmpty()) {
        File projDir = new File(projectLocation);
        if (projDir.isDirectory()) {
            workDir = projDir;
        }
    }
    if (workDir == null) {
        workDir = ProjectChooser.getProjectsFolder();
    }
    File projectDir = new FileChooserBuilder(SampleVisualPanel.class)
            .setTitle(NbBundle.getMessage(SampleVisualPanel.class, "TTL_DialogLocation"))   // NOI18N
            .setDirectoriesOnly(true)
            .setDefaultWorkingDirectory(workDir)
            .forceUseOfDefaultWorkingDirectory(true)
            .showOpenDialog();
    if (projectDir != null) {
        projectLocationTextField.setText(FileUtil.normalizeFile(projectDir).getAbsolutePath());
    }
}
 
Example #22
Source File: LicenseComboBoxModel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void setSelectedItem(Object item) {
    String oldSelectedItem = selectedItem;
    selectedItem = (String) item;

    if (names.indexOf(item) != -1) {
        if (types.get(names.indexOf(selectedItem)).equals(
                SuiteInstallerProjectProperties.LICENSE_TYPE_CUSTOM)) {

            File home = FileUtil.toFile(suiteProject.getProjectDirectory());
            File licenseFile = new FileChooserBuilder("installer-license-dir").setTitle(NbBundle.getMessage(LicenseComboBoxModel.class, "InstallerPanel_License.FileChooser.Title")).
                    setDefaultWorkingDirectory(home).setFilesOnly(true).showOpenDialog();
            if (licenseFile != null) {
                names.add(licenseFile.getAbsolutePath());
                types.add(SuiteInstallerProjectProperties.LICENSE_TYPE_FILE);
                selectedItem = names.get(names.size() - 1);
            } else {
                selectedItem = oldSelectedItem;
            }
        }
        selectedItemFromList = true;
    } else {
        selectedItemFromList = false;
    }

    fireContentsChanged(-1);
}
 
Example #23
Source File: SupportPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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());
    }
}
 
Example #24
Source File: AvdHwProfile.java    From NBANDROID-V2 with Apache License 2.0 6 votes vote down vote up
private void skinButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skinButtonActionPerformed
    // TODO add your handling code here:
    FileChooserBuilder builder = new FileChooserBuilder("ANDROID_SKIN");
    builder.setDirectoriesOnly(true);
    builder.setTitle("Select skin directory...");
    File skinFolder = builder.showOpenDialog();
    if (skinFolder != null && skinFolder.exists()) {
        File layout = new File(skinFolder.getAbsolutePath() + File.separator + "layout");
        if (layout.exists()) {
            skin.setModel(new SkinsComboboxModel(new File(skinFolder.getParent())));
            skin.setSelectedItem(skinFolder);
        } else {
            NotifyDescriptor nd = new NotifyDescriptor.Message("The selected directory does not contain a skin!", NotifyDescriptor.WARNING_MESSAGE);
            DialogDisplayer.getDefault().notifyLater(nd);
        }
    }
}
 
Example #25
Source File: MessDetectorOptionsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages("MessDetectorOptionsPanel.configuration.browse.title=Select Mess Detector Rule Set File")
private void messDetectorRuleSetFileBrowseButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_messDetectorRuleSetFileBrowseButtonActionPerformed
     File file = new FileChooserBuilder(MessDetectorOptionsPanel.class.getName() + MESS_DETECTOR_RULE_SET_FILE_LAST_FOLDER_SUFFIX)
            .setFilesOnly(true)
            .setTitle(Bundle.MessDetectorOptionsPanel_configuration_browse_title())
            .showOpenDialog();
    if (file != null) {
        messDetectorRuleSetFileTextField.setText(file.getAbsolutePath());
    }
}
 
Example #26
Source File: CodeSnifferOptionsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages("CodeSnifferOptionsPanel.browse.title=Select Code Sniffer")
private void codeSnifferBrowseButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_codeSnifferBrowseButtonActionPerformed
    File file = new FileChooserBuilder(CodeSnifferOptionsPanel.class.getName() + CODE_SNIFFER_LAST_FOLDER_SUFFIX)
            .setFilesOnly(true)
            .setTitle(Bundle.CodeSnifferOptionsPanel_browse_title())
            .showOpenDialog();
    if (file != null) {
        codeSnifferTextField.setText(file.getAbsolutePath());
    }
}
 
Example #27
Source File: CodingStandardsFixerOptionsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages("CodingStandardsFixerOptionsPanel.browse.title=Select Coding Standards Fixer")
private void codingStandardsFixerBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_codingStandardsFixerBrowseButtonActionPerformed
    File file = new FileChooserBuilder(CodingStandardsFixerOptionsPanel.class.getName() + CODING_STANDARDS_FIXER_LAST_FOLDER_SUFFIX)
            .setFilesOnly(true)
            .setTitle(Bundle.CodingStandardsFixerOptionsPanel_browse_title())
            .showOpenDialog();
    if (file != null) {
        codingStandardsFixerTextField.setText(file.getAbsolutePath());
    }
}
 
Example #28
Source File: ZendOptionsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void browseButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
    File zendScript = new FileChooserBuilder(ZendOptionsPanel.class.getName() + ZEND_LAST_FOLDER_SUFFIX)
            .setTitle(NbBundle.getMessage(ZendOptionsPanel.class, "LBL_SelectZend"))
            .setFilesOnly(true)
            .showOpenDialog();
    if (zendScript != null) {
        zendScript = FileUtil.normalizeFile(zendScript);
        zendTextField.setText(zendScript.getAbsolutePath());
    }
}
 
Example #29
Source File: BrowseFolderPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void browseTargetFolderButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_browseTargetFolderButtonActionPerformed
    File target = new FileChooserBuilder(ApiGenProvider.lastDirFor(phpModule))
            .setTitle(info)
            .setDirectoriesOnly(true)
            .setFileHiding(true)
            .setDefaultWorkingDirectory(FileUtil.toFile(phpModule.getSourceDirectory()))
            .showOpenDialog();
    if (target != null) {
        target = FileUtil.normalizeFile(target);
        targetFolderTextField.setText(target.getAbsolutePath());
    }
}
 
Example #30
Source File: PhpUnitOptionsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages("PhpUnitOptionsPanel.skelGen.browse=Select Skeleton Generator script")
private void skelGenBrowseButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_skelGenBrowseButtonActionPerformed
    File skelGen = new FileChooserBuilder(PhpUnitOptionsPanel.class.getName() + SKELETON_GENERATOR_LAST_FOLDER_SUFFIX)
            .setTitle(Bundle.PhpUnitOptionsPanel_skelGen_browse())
            .setFilesOnly(true)
            .showOpenDialog();
    if (skelGen != null) {
        skelGen = FileUtil.normalizeFile(skelGen);
        skelGenTextField.setText(skelGen.getAbsolutePath());
    }
}