This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 242815
Collapse All | Expand All

(-)a/dlight.remote/src/org/netbeans/modules/remote/api/ui/FileChooserBuilder.java (+12 lines)
Lines 116-121 Link Here
116
         */
116
         */
117
        /*package*/ public abstract boolean isUnix();
117
        /*package*/ public abstract boolean isUnix();
118
118
119
        /*package*/ public abstract char getFileSeparatorChar();
120
        
119
        @Override
121
        @Override
120
        public final File getCurrentDirectory() {
122
        public final File getCurrentDirectory() {
121
            return curFile;
123
            return curFile;
Lines 257-262 Link Here
257
        }
259
        }
258
260
259
        @Override
261
        @Override
262
        public char getFileSeparatorChar() {
263
            return File.separatorChar;
264
        }
265
266
        @Override
260
        public void setCurrentDirectory(FileObject dir) {
267
        public void setCurrentDirectory(FileObject dir) {
261
            if (dir != null && dir.isFolder()) {
268
            if (dir != null && dir.isFolder()) {
262
                File file = FileUtil.toFile(dir);
269
                File file = FileUtil.toFile(dir);
Lines 398-403 Link Here
398
        }
405
        }
399
406
400
        @Override
407
        @Override
408
        public char getFileSeparatorChar() {
409
            return '/';
410
        }
411
412
        @Override
401
        protected void setup(FileSystemView view) {
413
        protected void setup(FileSystemView view) {
402
            super.setup(view);
414
            super.setup(view);
403
        }
415
        }
(-)a/dlight.remote/src/org/netbeans/modules/remote/api/ui/FileChooserUIImpl.java (-12 / +15 lines)
Lines 287-296 Link Here
287
    private FileFilter actualFileFilter = null;
287
    private FileFilter actualFileFilter = null;
288
    private GlobFilter globFilter = null;
288
    private GlobFilter globFilter = null;
289
289
290
    private final char fileSeparatorChar;
291
    
290
    public FileChooserUIImpl(FileChooserBuilder.JFileChooserEx filechooser) {
292
    public FileChooserUIImpl(FileChooserBuilder.JFileChooserEx filechooser) {
291
        super(filechooser);
293
        super(filechooser);
292
        approveSelectionAction = new ApproveSelectionAction();
294
        approveSelectionAction = new ApproveSelectionAction();
293
        cancelSelectionAction = new CancelSelectionAction();
295
        cancelSelectionAction = new CancelSelectionAction();
296
        fileSeparatorChar = filechooser.getFileSeparatorChar();
294
    }
297
    }
295
298
296
    @Override
299
    @Override
Lines 1140-1146 Link Here
1140
    private void updateCompletions() {
1143
    private void updateCompletions() {
1141
        if (showPopupCompletion) {
1144
        if (showPopupCompletion) {
1142
            final String name = normalizeFile(getFileName());
1145
            final String name = normalizeFile(getFileName());
1143
            int slash = name.lastIndexOf(File.separatorChar);
1146
            int slash = name.lastIndexOf(fileSeparatorChar);
1144
            if (slash != -1) {
1147
            if (slash != -1) {
1145
                String prefix = name.substring(0, slash + 1);
1148
                String prefix = name.substring(0, slash + 1);
1146
                File[] children;
1149
                File[] children;
Lines 1238-1244 Link Here
1238
    }
1241
    }
1239
    
1242
    
1240
    
1243
    
1241
    private static String normalizeFile(String text) {
1244
    private String normalizeFile(String text) {
1242
        // See #21690 for background.
1245
        // See #21690 for background.
1243
        // XXX what are legal chars for var names? bash manual says only:
1246
        // XXX what are legal chars for var names? bash manual says only:
1244
        // "The braces are required when PARAMETER [...] is followed by a
1247
        // "The braces are required when PARAMETER [...] is followed by a
Lines 1257-1265 Link Here
1257
            text = text.substring(0, m.end(1)) + var + text.substring(m.end(2));
1260
            text = text.substring(0, m.end(1)) + var + text.substring(m.end(2));
1258
        }
1261
        }
1259
        if (text.equals("~")) {//NOI18N
1262
        if (text.equals("~")) {//NOI18N
1260
            return System.getProperty("user.home");//NOI18N
1263
            return fileChooser.getHomePath(); //NOI18N
1261
        } else if (text.startsWith("~" + File.separatorChar)) {//NOI18N
1264
        } else if (text.startsWith("~" + fileSeparatorChar)) {//NOI18N
1262
            return System.getProperty("user.home") + text.substring(1);//NOI18N
1265
            return fileChooser.getHomePath() + text.substring(1);//NOI18N
1263
        } else {
1266
        } else {
1264
            int i = text.lastIndexOf("//");//NOI18N
1267
            int i = text.lastIndexOf("//");//NOI18N
1265
            if (i != -1) {
1268
            if (i != -1) {
Lines 1267-1276 Link Here
1267
                // (so that you can use "//" to start a new path, without selecting & deleting)
1270
                // (so that you can use "//" to start a new path, without selecting & deleting)
1268
                return text.substring(i + 1);
1271
                return text.substring(i + 1);
1269
            }
1272
            }
1270
            i = text.lastIndexOf(File.separatorChar + "~" + File.separatorChar);//NOI18N
1273
            i = text.lastIndexOf(fileSeparatorChar + "~" + fileSeparatorChar);//NOI18N
1271
            if (i != -1) {
1274
            if (i != -1) {
1272
                // Treat /usr/local/~/stuff as /home/me/stuff
1275
                // Treat /usr/local/~/stuff as /home/me/stuff
1273
                return System.getProperty("user.home") + text.substring(i + 2);//NOI18N
1276
                return fileChooser.getHomePath() + text.substring(i + 2);//NOI18N
1274
            }
1277
            }
1275
            return text;
1278
            return text;
1276
        }
1279
        }
Lines 2521-2527 Link Here
2521
        }
2524
        }
2522
        
2525
        
2523
        private void changeTreeDirectory(File dir) {
2526
        private void changeTreeDirectory(File dir) {
2524
            if (File.separatorChar == '\\' && dir.getPath().endsWith(".lnk")) {//NOI18N
2527
            if (fileSeparatorChar == '\\' && dir.getPath().endsWith(".lnk")) {//NOI18N
2525
                File linkLocation = getShellFolderForFileLinkLoc(dir);
2528
                File linkLocation = getShellFolderForFileLinkLoc(dir);
2526
                if (linkLocation != null && fileChooser.isTraversable(linkLocation)) {
2529
                if (linkLocation != null && fileChooser.isTraversable(linkLocation)) {
2527
                    dir = linkLocation;
2530
                    dir = linkLocation;
Lines 3415-3424 Link Here
3415
        }
3418
        }
3416
    }    
3419
    }    
3417
    
3420
    
3418
    private static boolean isGlobPattern(String filename) {
3421
    private boolean isGlobPattern(String filename) {
3419
        return ((File.separatorChar == '\\' && (filename.indexOf('*') >= 0
3422
        return ((fileSeparatorChar == '\\' && (filename.indexOf('*') >= 0
3420
                                                  || filename.indexOf('?') >= 0))
3423
                                                  || filename.indexOf('?') >= 0))
3421
                || (File.separatorChar == '/' && (filename.indexOf('*') >= 0
3424
                || (fileSeparatorChar == '/' && (filename.indexOf('*') >= 0
3422
                                                  || filename.indexOf('?') >= 0
3425
                                                  || filename.indexOf('?') >= 0
3423
                                                  || filename.indexOf('[') >= 0)));
3426
                                                  || filename.indexOf('[') >= 0)));
3424
    }
3427
    }
Lines 3434-3440 Link Here
3434
        public void setPattern(String globPattern) {
3437
        public void setPattern(String globPattern) {
3435
            char[] gPat = globPattern.toCharArray();
3438
            char[] gPat = globPattern.toCharArray();
3436
            char[] rPat = new char[gPat.length * 2];
3439
            char[] rPat = new char[gPat.length * 2];
3437
            boolean isWin32 = (File.separatorChar == '\\');
3440
            boolean isWin32 = (fileSeparatorChar == '\\');
3438
            boolean inBrackets = false;
3441
            boolean inBrackets = false;
3439
            int j = 0;
3442
            int j = 0;
3440
3443
(-)a/dlight.remote/src/org/netbeans/modules/remote/api/ui/FileCompletionPopup.java (-5 / +5 lines)
Lines 79-89 Link Here
79
 */
79
 */
80
class FileCompletionPopup extends JPopupMenu implements KeyListener {
80
class FileCompletionPopup extends JPopupMenu implements KeyListener {
81
    
81
    
82
    private JList list;
82
    private final JList list;
83
    private JTextField textField;
83
    private final JTextField textField;
84
    private JFileChooser chooser;
84
    private final FileChooserBuilder.JFileChooserEx chooser;
85
    
85
    
86
    public FileCompletionPopup(JFileChooser chooser, JTextField textField, Vector<File> files) {
86
    public FileCompletionPopup(FileChooserBuilder.JFileChooserEx chooser, JTextField textField, Vector<File> files) {
87
        this.list = new JList(files);
87
        this.list = new JList(files);
88
        this.textField = textField;
88
        this.textField = textField;
89
        this.chooser = chooser;
89
        this.chooser = chooser;
Lines 255-261 Link Here
255
                if (file.isDirectory()) {
255
                if (file.isDirectory()) {
256
                    try {
256
                    try {
257
                        Document doc = textField.getDocument();
257
                        Document doc = textField.getDocument();
258
                        doc.insertString(doc.getLength(), File.separator, null);
258
                        doc.insertString(doc.getLength(), String.valueOf(chooser.getFileSeparatorChar()), null);
259
                    } catch (BadLocationException ex) {
259
                    } catch (BadLocationException ex) {
260
                        Logger.getLogger(getClass().getName()).log(
260
                        Logger.getLogger(getClass().getName()).log(
261
                                Level.FINE, "Cannot append directory separator.", ex);//NOI18N
261
                                Level.FINE, "Cannot append directory separator.", ex);//NOI18N

Return to bug 242815