File libFolder = null;
if (allowRelativePaths != null && allowRelativePaths.booleanValue()) {
baseFolder = new File(URI.create(area.getLocation().toExternalForm())).getParentFile();
libFolder = new File(baseFolder, impl.getName());
}
FileChooser chooser = new FileChooser(baseFolder, libFolder);
FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
chooser.setAcceptAllFileFilterUsed(false);
if (this.volumeType.equals(J2SELibraryTypeProvider.VOLUME_TYPE_CLASSPATH)) {
chooser.setMultiSelectionEnabled (true);
chooser.setDialogTitle(NbBundle.getMessage(J2SEVolumeCustomizer.class,"TXT_OpenClasses"));
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.setFileFilter (new SimpleFileFilter(NbBundle.getMessage(
J2SEVolumeCustomizer.class,"TXT_Classpath"),new String[] {"ZIP","JAR"})); //NOI18N
chooser.setApproveButtonText(NbBundle.getMessage(J2SEVolumeCustomizer.class,"CTL_SelectCP"));
chooser.setApproveButtonMnemonic(NbBundle.getMessage(J2SEVolumeCustomizer.class,"MNE_SelectCP").charAt(0));
}
else if (this.volumeType.equals(J2SELibraryTypeProvider.VOLUME_TYPE_JAVADOC)) {
chooser.setMultiSelectionEnabled (true);
chooser.setDialogTitle(NbBundle.getMessage(J2SEVolumeCustomizer.class,"TXT_OpenJavadoc"));
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.setFileFilter (new SimpleFileFilter(NbBundle.getMessage(
J2SEVolumeCustomizer.class,"TXT_Javadoc"),new String[] {"ZIP","JAR"})); //NOI18N
chooser.setApproveButtonText(NbBundle.getMessage(J2SEVolumeCustomizer.class,"CTL_SelectJD"));
chooser.setApproveButtonMnemonic(NbBundle.getMessage(J2SEVolumeCustomizer.class,"MNE_SelectJD").charAt(0));
}
else if (this.volumeType.equals(J2SELibraryTypeProvider.VOLUME_TYPE_SRC)) {
chooser.setMultiSelectionEnabled (true);
chooser.setDialogTitle(NbBundle.getMessage(J2SEVolumeCustomizer.class,"TXT_OpenSources"));
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.setFileFilter (new SimpleFileFilter(NbBundle.getMessage(
J2SEVolumeCustomizer.class,"TXT_Sources"),new String[] {"ZIP","JAR"})); //NOI18N
chooser.setApproveButtonText(NbBundle.getMessage(J2SEVolumeCustomizer.class,"CTL_SelectSRC"));
chooser.setApproveButtonMnemonic(NbBundle.getMessage(J2SEVolumeCustomizer.class,"MNE_SelectSRC").charAt(0));
}
if (lastFolder != null) {
chooser.setCurrentDirectory (lastFolder);
} else if (baseFolder != null) {
chooser.setCurrentDirectory (baseFolder);
}
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
try {
lastFolder = chooser.getCurrentDirectory();
addFiles (chooser.getSelectedPaths(), area != null ? area.getLocation() : null);
} catch (MalformedURLException mue) {
ErrorManager.getDefault().notify(mue);
} catch (IOException ex) {
ErrorManager.getDefault().notify(ex);
}