When ambiguous files are found, user is not asked about the same file name BLD200408111800
authormentlicher@netbeans.org
Wed, 11 Aug 2004 16:57:59 +0000
changeset 5018c5ba1b20f386
parent 5017 0bb1077ae928
child 5019 9d84475e6876
When ambiguous files are found, user is not asked about the same file name
multiple times. Also [Skip All] button added.
This is a further fix to issue #46128.
vcs.profiles.vss/src/org/netbeans/modules/vcs/profiles/vss/commands/Bundle.properties
vcs.profiles.vss/src/org/netbeans/modules/vcs/profiles/vss/commands/ConfirmationCommand.java
     1.1 --- a/vcs.profiles.vss/src/org/netbeans/modules/vcs/profiles/vss/commands/Bundle.properties	Wed Aug 11 15:41:28 2004 +0000
     1.2 +++ b/vcs.profiles.vss/src/org/netbeans/modules/vcs/profiles/vss/commands/Bundle.properties	Wed Aug 11 16:57:59 2004 +0000
     1.3 @@ -21,6 +21,7 @@
     1.4  CTL_YesAll=Yes All
     1.5  CTL_NoAll=No All
     1.6  CTL_Skip=Skip
     1.7 +CTL_SkipAll=Skip All
     1.8  MSG_Ambiguous=No unique file was detected in the question.\nPlease run the action directly on the appropriate file.
     1.9  
    1.10  # CvsVerifyAction, PvcsVerifyAction VssVerifyAction
     2.1 --- a/vcs.profiles.vss/src/org/netbeans/modules/vcs/profiles/vss/commands/ConfirmationCommand.java	Wed Aug 11 15:41:28 2004 +0000
     2.2 +++ b/vcs.profiles.vss/src/org/netbeans/modules/vcs/profiles/vss/commands/ConfirmationCommand.java	Wed Aug 11 16:57:59 2004 +0000
     2.3 @@ -16,9 +16,11 @@
     2.4  import java.io.File;
     2.5  import java.util.ArrayList;
     2.6  import java.util.Collection;
     2.7 +import java.util.HashSet;
     2.8  import java.util.Hashtable;
     2.9  import java.util.Iterator;
    2.10  import java.util.List;
    2.11 +import java.util.Set;
    2.12  import java.util.Stack;
    2.13  import org.netbeans.api.vcs.commands.Command;
    2.14  import org.netbeans.api.vcs.commands.CommandTask;
    2.15 @@ -475,7 +477,11 @@
    2.16          Object yesAllOption = NbBundle.getMessage(ConfirmationCommand.class, "CTL_YesAll");
    2.17          Object noAllOption = NbBundle.getMessage(ConfirmationCommand.class, "CTL_NoAll");
    2.18          Object skipOption = NbBundle.getMessage(ConfirmationCommand.class, "CTL_Skip");
    2.19 +        Object skipAllOption = NbBundle.getMessage(ConfirmationCommand.class, "CTL_SkipAll");
    2.20          List patternItems = new ArrayList();
    2.21 +        String[] ambiguousFile = new String[] { null };
    2.22 +        Set ambiguousFiles = new HashSet();
    2.23 +        boolean doSkipAll = false;
    2.24          for (int i = 0; i < messages.length; i++) {
    2.25              String file = checkPatterns(confirmedPatterns, messages[i]);
    2.26              if (file != null) {
    2.27 @@ -495,21 +501,28 @@
    2.28                  continue;
    2.29              }
    2.30              patternItems.clear();
    2.31 -            file = getUnambiguousFile(messages[i], rootDir, selectedFiles, patternItems);
    2.32 +            file = getUnambiguousFile(messages[i], rootDir, selectedFiles, patternItems, ambiguousFile);
    2.33              //System.out.println("  file = '"+file+"', patternItems = "+patternItems);
    2.34              if (file == null) {
    2.35 +                if (doSkipAll || ambiguousFiles.contains(ambiguousFile[0])) {
    2.36 +                    continue;
    2.37 +                }
    2.38 +                ambiguousFiles.add(ambiguousFile[0]);
    2.39                  String msg = reduceBigMessage(messages[i]) + "\n\n" +
    2.40                               NbBundle.getMessage(ConfirmationCommand.class, "MSG_Ambiguous");
    2.41                  NotifyDescriptor confirmation = new NotifyDescriptor(msg,
    2.42                      NbBundle.getMessage(ConfirmationCommand.class, "TTL_Warning"), 
    2.43                      NotifyDescriptor.OK_CANCEL_OPTION,
    2.44                      NotifyDescriptor.WARNING_MESSAGE,
    2.45 -                    new Object[] { skipOption,
    2.46 +                    new Object[] { skipOption, skipAllOption,
    2.47                                     NotifyDescriptor.CANCEL_OPTION },
    2.48                      skipOption);
    2.49                  Object result = DialogDisplayer.getDefault().notify(confirmation);
    2.50                  if (skipOption.equals(result)) {
    2.51                      continue;
    2.52 +                } if (skipAllOption.equals(result)) {
    2.53 +                    doSkipAll = true;
    2.54 +                    continue;
    2.55                  } else {
    2.56                      return null;
    2.57                  }
    2.58 @@ -544,7 +557,8 @@
    2.59       * Get the file relative to rootDir.
    2.60       */
    2.61      private static String getUnambiguousFile(String message, String rootDir,
    2.62 -                                             String[] selectedFiles, List patternItems) {
    2.63 +                                             String[] selectedFiles, List patternItems,
    2.64 +                                             String[] ambiguousFile) {
    2.65          int begin = 0;
    2.66          int fileIndex;
    2.67          String file = null;
    2.68 @@ -579,6 +593,7 @@
    2.69              int firstSpace = message.indexOf(' ', sentenceEnd);
    2.70              if (firstSpace > 0) {
    2.71                  file = message.substring(sentenceEnd, firstSpace);
    2.72 +                ambiguousFile[0] = file;
    2.73                  file = uniqueFilePath(file, selectedFiles);
    2.74                  if (file == null) {
    2.75                      return null;