Java Code Examples for org.openide.filesystems.FileChooserBuilder#setDirectoriesOnly()
The following examples show how to use
org.openide.filesystems.FileChooserBuilder#setDirectoriesOnly() .
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: Utils.java From netbeans with Apache License 2.0 | 6 votes |
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 2
Source File: AvdHwProfile.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
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 3
Source File: CreateAvdVisualPanel3.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
private void skinSelectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skinSelectActionPerformed // 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()) { skinCombo.setModel(new SkinsComboboxModel(new File(skinFolder.getParent()))); skinCombo.setSelectedItem(skinFolder); } else { NotifyDescriptor nd = new NotifyDescriptor.Message("The selected directory does not contain a skin!", NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notifyLater(nd); } } }
Example 4
Source File: MobilePanel.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed FileChooserBuilder builder = new FileChooserBuilder(AndroidSdkTool.class); builder.setTitle("Please select Android SDK Folder"); builder.setDirectoriesOnly(true); File file = builder.showOpenDialog(); if (file != null) { FileObject folder = FileUtil.toFileObject(file); if (folder.getFileObject("tools") == null) { Message msg = new NotifyDescriptor.Message( "Not a valid SDK folder!", NotifyDescriptor.ERROR_MESSAGE); DialogDisplayer.getDefault().notifyLater(msg); } else { String name = file.getPath(); jTextField1.setText(name); } } }
Example 5
Source File: CreateProjectVisualPanel1.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
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 6
Source File: AttachCustomizer.java From netbeans with Apache License 2.0 | 5 votes |
private void localSourcesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_localSourcesButtonActionPerformed FileChooserBuilder fchb = new FileChooserBuilder(AttachCustomizer.class); fchb.setDirectoriesOnly(true); File dir = fchb.showOpenDialog(); if (dir != null) { localSourcesTextField.setText(dir.getAbsolutePath()); } }
Example 7
Source File: SaveAsAction.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
@Override protected void performAction(Node[] activatedNodes) { Node node = activatedNodes[0]; FileObject fo = node.getLookup().lookup(FileObject.class); if (fo != null) { FileChooserBuilder builder = new FileChooserBuilder(SaveAsAction.class); builder.setDirectoriesOnly(false); builder.setApproveText("Save"); builder.setControlButtonsAreShown(true); builder.setTitle("Save As..."); builder.setFilesOnly(true); builder.setFileFilter(new FileNameExtensionFilter(fo.getExt(), fo.getExt())); JFileChooser chooser = builder.createFileChooser(); chooser.setSelectedFile(new File(fo.getNameExt())); int resp = chooser.showSaveDialog(findDialogParent()); if (JFileChooser.APPROVE_OPTION == resp) { File saveFile = chooser.getSelectedFile(); if (saveFile != null) { try { saveFile.getParentFile().mkdirs(); FileObject dfo = FileUtil.toFileObject(saveFile.getParentFile()); if (dfo == null) { NotifyDescriptor nd = new NotifyDescriptor.Message("Unable to Save file!", NotifyDescriptor.ERROR_MESSAGE); DialogDisplayer.getDefault().notifyLater(nd); return; } if (saveFile.exists()) { saveFile.delete(); } fo.copy(dfo, saveFile.getName(), ""); } catch (IOException ex) { Exceptions.printStackTrace(ex); } } } } }
Example 8
Source File: SDKVisualPanelSelect.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
private void browseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseActionPerformed // TODO add your handling code here: FileChooserBuilder chooserBuilder = new FileChooserBuilder(SDKVisualPanelSelect.class); chooserBuilder.setDirectoriesOnly(true); chooserBuilder.setTitle("Choose the folder where is the Android SDK installed."); chooserBuilder.setApproveText("OK"); File tmp = chooserBuilder.showOpenDialog(); if (tmp != null) { path.setText(tmp.getAbsolutePath()); } }
Example 9
Source File: SDKVisualPanelInstall.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
private void browseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseActionPerformed // TODO add your handling code here: FileChooserBuilder chooserBuilder = new FileChooserBuilder(SDKVisualPanelInstall.class); chooserBuilder.setDirectoriesOnly(true); chooserBuilder.setTitle("Choose the folder in which to install Android SDK Tools."); chooserBuilder.setApproveText("OK"); File tmp = chooserBuilder.showOpenDialog(); if (tmp != null) { path.setText(tmp.getAbsolutePath()); } }
Example 10
Source File: AndroidSdkTool.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
/** * Returns a String with the path to the SDK or null if none is specified. * @return */ public static String getSdkPath() { String path = NbPreferences.forModule(AndroidSdkTool.class).get("sdk_path", null); if (path == null) { FileChooserBuilder builder = new FileChooserBuilder(AndroidSdkTool.class); builder.setTitle("Please select Android SDK Folder"); builder.setDirectoriesOnly(true); File file = builder.showOpenDialog(); if (file != null) { FileObject folder = FileUtil.toFileObject(file); if (folder.getFileObject("tools") == null) { Message msg = new NotifyDescriptor.Message( "Not a valid SDK folder!", NotifyDescriptor.ERROR_MESSAGE); DialogDisplayer.getDefault().notifyLater(msg); } else { String name = file.getPath(); NbPreferences.forModule(AndroidSdkTool.class).put("sdk_path", name); return name; } } } else { return path; } return null; }
Example 11
Source File: PublishAssetPackVisualPanel2.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed FileChooserBuilder builder = new FileChooserBuilder(this.getClass()); builder.setDirectoriesOnly(true); builder.setTitle("Select Export Folder"); File file = builder.showOpenDialog(); if (file != null) { try { jTextField1.setText(file.getAbsolutePath()); } catch (Exception e) { } } }
Example 12
Source File: InstallBlenderExporterPanel.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed FileChooserBuilder builder = new FileChooserBuilder(""); builder.setDirectoriesOnly(true); builder.setTitle("Select Blender Scripts Directory"); File file = builder.showOpenDialog(); if (file != null) { jTextField1.setText(file.getPath()); } }
Example 13
Source File: CodelessProjectWizardVisualPanel1.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed FileChooserBuilder builder = new FileChooserBuilder(System.getProperty("user.home")); builder.setDirectoriesOnly(true); builder.setTitle("Select Project Folder"); File file = builder.showOpenDialog(); if (file != null) { jTextField1.setText(file.getPath()); } }
Example 14
Source File: CodelessProjectWizardVisualPanel1.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed File path=new File(jTextField1.getText()); if(path.isDirectory()){ FileChooserBuilder builder = new FileChooserBuilder(path.getAbsolutePath()); builder.setDirectoriesOnly(true); builder.setTitle("Select Assets Folder"); File file = builder.showOpenDialog(); if (file != null) { try { jTextField2.setText(file.getAbsolutePath().substring(path.getAbsolutePath().length(), file.getAbsolutePath().length())); } catch (Exception e) { } } } }