You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ne...@apache.org on 2020/07/20 09:26:20 UTC

[netbeans] branch master updated: Allow File chooser for non-project New File Wizard

This is an automated email from the ASF dual-hosted git repository.

neilcsmith pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new ca50591  Allow File chooser for non-project New File Wizard
     new 1b12c2b  Merge pull request #2219 from SiddheshRane/master
ca50591 is described below

commit ca50591eaa2f3f8095f28a82eeb837c11f57a456
Author: Siddhesh Rane <si...@yahoo.com>
AuthorDate: Sun Jun 28 22:53:29 2020 -0400

    Allow File chooser for non-project New File Wizard
---
 .../modules/project/ui/SimpleTargetChooserPanelGUI.java        | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/ide/projectui/src/org/netbeans/modules/project/ui/SimpleTargetChooserPanelGUI.java b/ide/projectui/src/org/netbeans/modules/project/ui/SimpleTargetChooserPanelGUI.java
index 459f51d..3ed00e1 100644
--- a/ide/projectui/src/org/netbeans/modules/project/ui/SimpleTargetChooserPanelGUI.java
+++ b/ide/projectui/src/org/netbeans/modules/project/ui/SimpleTargetChooserPanelGUI.java
@@ -493,10 +493,10 @@ public class SimpleTargetChooserPanelGUI extends javax.swing.JPanel implements A
                 //non project space
                 String previousTargetFolder = getTargetFolder(); //can be relative or absolute..
                 SourceGroup group = (SourceGroup)locationComboBox.getSelectedItem();
-                if (group == null) { // #161478
-                    return;
+                FileObject oldFo = null;
+                if (group != null) {
+                    oldFo = previousTargetFolder != null ? group.getRootFolder().getFileObject(previousTargetFolder) : group.getRootFolder();
                 }
-                FileObject oldFo = previousTargetFolder != null ? group.getRootFolder().getFileObject(previousTargetFolder) : group.getRootFolder();
                 if (oldFo == null && previousTargetFolder != null) {
                     oldFo = FileUtil.toFileObject(FileUtil.normalizeFile(new File(previousTargetFolder)));
                 }
@@ -506,13 +506,13 @@ public class SimpleTargetChooserPanelGUI extends javax.swing.JPanel implements A
                     new FileChooserBuilder(SimpleTargetChooserPanel.class)
                         .setDirectoriesOnly(true)
                         .setDefaultWorkingDirectory(currFile)
-                        .forceUseOfDefaultWorkingDirectory(true)
+                        .forceUseOfDefaultWorkingDirectory(group != null) //if no source group, allow other directories
                         .showSaveDialog();
 
                 FileObject fo = targetFolder != null ? FileUtil.toFileObject(FileUtil.normalizeFile(targetFolder)) : null;
 
                 if ( fo != null && fo.isFolder() ) {
-                    String path =  FileUtil.getRelativePath(group.getRootFolder(), fo);
+                    String path =  group == null ? null : FileUtil.getRelativePath(group.getRootFolder(), fo);
                     if (path == null) {
                          path = fo.getPath();
                     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists