本文整理汇总了Java中org.openide.filesystems.FileChooserBuilder.showMultiOpenDialog方法的典型用法代码示例。如果您正苦于以下问题:Java FileChooserBuilder.showMultiOpenDialog方法的具体用法?Java FileChooserBuilder.showMultiOpenDialog怎么用?Java FileChooserBuilder.showMultiOpenDialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.filesystems.FileChooserBuilder
的用法示例。
在下文中一共展示了FileChooserBuilder.showMultiOpenDialog方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: chooseRoots
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
/**
* 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;
}
示例2: actionPerformed
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
/** Handles button events
*/
public void actionPerformed( ActionEvent e ) {
Object source = e.getSource();
if ( source == addFolderButton ) {
// Let user search for the Jar file
FileChooserBuilder builder = new FileChooserBuilder(SourceRootsUi.class).setDirectoriesOnly(true);
builder.setDefaultWorkingDirectory(FileUtil.toFile(this.project.getProjectDirectory()));
String type = RootsAccessor.getInstance().getType(sourceRoots);
boolean isModule = JavaProjectConstants.SOURCES_TYPE_MODULES.equals(type);
if (sourceRoots.isTest()) {
builder.setTitle(NbBundle.getMessage(SourceRootsUi.class, isModule ? "LBL_TestModuleFolder_DialogTitle" : "LBL_TestFolder_DialogTitle")); // NOI18N
} else {
builder.setTitle(NbBundle.getMessage(SourceRootsUi.class, isModule ? "LBL_ModuleFolder_DialogTitle" : "LBL_SourceFolder_DialogTitle")); // NOI18N
}
File files[] = builder.showMultiOpenDialog();
if ( files != null ) {
addFolders( files );
}
}
else if ( source == removeButton ) {
removeElements();
}
else if ( source == upButton ) {
moveUp();
}
else if ( source == downButton ) {
moveDown();
}
}
示例3: addJavadocActionPerformed
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private void addJavadocActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addJavadocActionPerformed
FileChooserBuilder builder = new FileChooserBuilder(AndroidPlatformCustomizer.class);
builder.setAcceptAllFileFilterUsed(false);
builder.setFileFilter(new ArchiveFileFilter("javadoc files", new String[]{"JAR", "ZIP"}));
builder.setTitle("Select Javadocs to add");
File[] files = builder.showMultiOpenDialog();
if (files != null) {
for (File file : files) {
aPackage.addJavadocPath(FileUtil.toFileObject(file).toURL(), true);
}
sdk.store();
fireJavadocAdded();
}
}
示例4: addClasspathActionPerformed
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private void addClasspathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addClasspathActionPerformed
FileChooserBuilder builder = new FileChooserBuilder(AndroidPlatformCustomizer.class);
builder.setAcceptAllFileFilterUsed(false);
builder.setFileFilter(new ArchiveFileFilter("Jar files", new String[]{"JAR"}));
builder.setTitle("Select ClassPath to add");
File[] files = builder.showMultiOpenDialog();
if (files != null) {
for (File file : files) {
aPackage.addBootPath(FileUtil.toFileObject(file).toURL(), true);
}
sdk.store();
fireClassPathAdded();
}
}
示例5: addSourcesActionPerformed
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private void addSourcesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addSourcesActionPerformed
FileChooserBuilder builder = new FileChooserBuilder(AndroidPlatformCustomizer.class);
builder.setAcceptAllFileFilterUsed(false);
builder.setFileFilter(new ArchiveFileFilter("src files", new String[]{"JAR", "ZIP"}));
builder.setTitle("Select Sources to add");
File[] files = builder.showMultiOpenDialog();
if (files != null) {
for (File file : files) {
aPackage.addSrcPath(FileUtil.toFileObject(file).toURL(), true);
}
sdk.store();
fireSourcesAdded();
}
}
示例6: selectFile
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private void selectFile() {
FileChooserBuilder builder = new FileChooserBuilder(this.getClass());
builder.setFilesOnly(true);
builder.setTitle("Select Asset File");
File[] file = builder.showMultiOpenDialog();
if (file != null) {
for (int i = 0; i < file.length; i++) {
File file1 = file[i];
FileDescription description = AssetPackLoader.getFileDescription(file1);
description.setPath(pathString());
list.add(description);
}
updateList();
}
}
示例7: getFiles
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private File[] getFiles() {
FileChooserBuilder fcb = new FileChooserBuilder(AddClassPathItemAction.class);
fcb.setTitle(Bundle.CTL_AddClassPathItemAction_Dialog_Title());
fcb.setApproveText(Bundle.CTL_AddClassPathItemAction_Dialog_Approve());
fcb.addFileFilter(JavaSourceFilter.getInstance());
fcb.setFileFilter(JavaSourceFilter.getInstance());
return fcb.showMultiOpenDialog();
}
示例8: selectFiles
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private File[] selectFiles() {
FileChooserBuilder fcb = new FileChooserBuilder(GRScriptDataObject.class);
fcb.setTitle(Bundle.LBL_OpenScriptsAction_Dialog_Title());
fcb.setApproveText(Bundle.LBL_OpenScriptsAction_Dialog_Approve());
fcb.addFileFilter(GRScriptFileFilter.getDefault());
fcb.setFileFilter(GRScriptFileFilter.getDefault());
return fcb.showMultiOpenDialog();
}
示例9: browseButtonActionPerformed
import org.openide.filesystems.FileChooserBuilder; //导入方法依赖的package包/类
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
stopProgress();
FileChooserBuilder fileChooserBuilder = new FileChooserBuilder(AddDriverDialog.class);
fileChooserBuilder.setTitle(NbBundle.getMessage(AddDriverDialog.class, "AddDriver_Chooser_Title")); //NOI18N
//.jar and .zip file filter
fileChooserBuilder.setFileFilter(new FileFilter() {
@Override
public boolean accept(File f) {
return (f.isDirectory() || f.getName().endsWith(".jar") || f.getName().endsWith(".zip")); //NOI18N
}
@Override
public String getDescription() {
return NbBundle.getMessage(AddDriverDialog.class, "AddDriver_Chooser_Filter"); //NOI18N
}
});
File[] selectedFiles = fileChooserBuilder.showMultiOpenDialog();
if (selectedFiles != null) {
for (final File file : selectedFiles) {
if (file.isFile()) {
if (dlm.contains(file.toString())) {
// file already added
NotifyDescriptor msgDesc = new NotifyDescriptor.Message(NbBundle.getMessage(AddDriverDialog.class, "AddDriverDuplicateFile", file.toString()));
DialogDisplayer.getDefault().notify(msgDesc);
continue;
}
if (drvs.isEmpty()) {
dlm.clear();
}
dlm.addElement(file.toString());
try {
drvs.add(file.toURI().toURL());
} catch (MalformedURLException exc) {
LOGGER.log(Level.WARNING,
"Unable to add driver jar file " +
file.getAbsolutePath() +
": can not convert to URL", exc);
}
if (wd != null) {
boolean privileged = wd.getAllPrivilegedNames().isEmpty();
for (String name : wd.getAllPrivilegedNames()) {
if (file.getName().startsWith(name)) {
privileged = true;
break;
}
}
if (privileged) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
notifyUser(null, false);
}
});
} else {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
notifyUser(NbBundle.getMessage(AddDriverDialog.class, "AddDriverDialog_NotPrivilegedDriver", // NOI18N
file.getName(), wd.getPrivilegedName()), true);
}
});
}
}
}
}
findDriverClass();
if (wp != null) {
wp.fireChangeEvent();
}
}
updateState();
}