JAL-629 Change --open to --append and --opennew to --open. Make --open(new) part...
[jalview.git] / src / jalview / bin / argparser / ArgParser.java
index 70ed5d1..b31beab 100644 (file)
@@ -55,11 +55,12 @@ public class ArgParser
   // the substitution string used to use the defaultLinkedIdCounter
   private static final String DEFAULTLINKEDIDCOUNTER = "{}";
 
-  // the counter added to the default linked id prefix
-  private int opennewLinkedIdCounter = 0;
+  // the counter added to the default linked id prefix. NOW using
+  // linkedIdAutoCounter
+  // private int openLinkedIdCounter = 0;
 
-  // the linked id prefix used for --opennew files
-  protected static final String OPENNEWLINKEDIDPREFIX = "OPENNEW:";
+  // the linked id prefix used for --open files. NOW the same as DEFAULT
+  protected static final String OPENLINKEDIDPREFIX = DEFAULTLINKEDIDPREFIX;
 
   // the counter used for {n} substitutions
   private int linkedIdAutoCounter = 0;
@@ -71,12 +72,12 @@ public class ArgParser
   // the linked id substitution string used to use the idCounter
   private static final String LINKEDIDAUTOCOUNTER = "{n}";
 
-  // the linked id substitution string used to use the base filename of --open
-  // or --opennew
+  // the linked id substitution string used to use the base filename of --append
+  // or --open
   private static final String LINKEDIDBASENAME = "{basename}";
 
-  // the linked id substitution string used to use the dir path of --open
-  // or --opennew
+  // the linked id substitution string used to use the dir path of --append
+  // or --open
   private static final String LINKEDIDDIRNAME = "{dirname}";
 
   // the current argfile
@@ -141,7 +142,7 @@ public class ArgParser
     // Make a mutable new ArrayList so that shell globbing parser works.
     // (When shell file globbing is used, there are a sequence of non-Arg
     // arguments (which are the expanded globbed filenames) that need to be
-    // consumed by the --open/--argfile/etc Arg which is most easily done by
+    // consumed by the --append/--argfile/etc Arg which is most easily done by
     // removing these filenames from the list one at a time. This can't be done
     // with an ArrayList made with only Arrays.asList(String[] args). )
     this(new ArrayList<>(Arrays.asList(args)), initsubstitutions);
@@ -197,7 +198,7 @@ public class ArgParser
       if (openEachInitialFilenames && !arg.startsWith(DOUBLEDASH)
               && !arg.startsWith("-") && new File(arg).exists())
       {
-        arg = Arg.OPENNEW.argString();
+        arg = Arg.OPEN.argString();
       }
       else
       {
@@ -360,13 +361,14 @@ public class ArgParser
         {
           if (linkedId == null)
           {
-            if (a == Arg.OPENNEW)
+            if (a == Arg.OPEN)
             {
-              // use the next default prefixed OPENNEWLINKEDID
-              linkedId = new StringBuilder(OPENNEWLINKEDIDPREFIX)
-                      .append(Integer.toString(opennewLinkedIdCounter))
+              // use the next default prefixed OPENLINKEDID
+              // NOW using the linkedIdAutoCounter
+              defaultLinkedIdCounter++;
+              linkedId = new StringBuilder(OPENLINKEDIDPREFIX)
+                      .append(Integer.toString(defaultLinkedIdCounter))
                       .toString();
-              opennewLinkedIdCounter++;
             }
             else
             {