Set files, that were not found by findResource(), as disk files to the delete command. QBE200301290100-BLD200302041521
authormentlicher@netbeans.org
Tue, 28 Jan 2003 17:29:04 +0000
changeset 3045f5772750686e
parent 3044 4f890cd5596d
child 3046 edfcf94da205
Set files, that were not found by findResource(), as disk files to the delete command.
This is necessary so that:
1) No file will be forgotten,
2) we will not get NPE when trying to access a null FO later.
vcscore/src/org/netbeans/modules/vcscore/VcsFileSystem.java
     1.1 --- a/vcscore/src/org/netbeans/modules/vcscore/VcsFileSystem.java	Mon Jan 27 22:00:52 2003 +0000
     1.2 +++ b/vcscore/src/org/netbeans/modules/vcscore/VcsFileSystem.java	Tue Jan 28 17:29:04 2003 +0000
     1.3 @@ -3616,13 +3616,22 @@
     1.4      
     1.5      private void runDeleteFilesCommand(java.util.List filesList, CommandSupport cmd) {
     1.6          ArrayList files = new ArrayList();
     1.7 +        ArrayList diskFiles = new ArrayList();
     1.8          //Table files = new Table();
     1.9          for (Iterator it = filesList.iterator(); it.hasNext(); ) {
    1.10              String name = (String) it.next();
    1.11 -            files.add(findResource(name));
    1.12 +            FileObject fo = findResource(name);
    1.13 +            if (fo != null) {
    1.14 +                files.add(fo);
    1.15 +            } else {
    1.16 +                diskFiles.add(getFile(name));
    1.17 +            }
    1.18          }
    1.19          Command command = cmd.createCommand();
    1.20          command.setFiles((FileObject[]) files.toArray(new FileObject[files.size()]));
    1.21 +        if (command instanceof VcsDescribedCommand) {
    1.22 +            ((VcsDescribedCommand) command).setDiskFiles((File[]) diskFiles.toArray(new File[diskFiles.size()]));
    1.23 +        }
    1.24          command.setGUIMode(false);
    1.25          command.execute();
    1.26          //VcsAction.doCommand(files, cmd, null, this);