import java.io.File;
import java.io.IOException;
-import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.Map.Entry;
import jalview.analysis.AlignmentUtils;
import jalview.bin.argparser.Arg;
* m.get(Arg.OPEN).getValue(); String data = null; FileFormatI format = null;
* DataSourceType protocol = null;
*/
- if (avm.containsArg(Arg.OPEN) || avm.containsArg(Arg.OPENNEW))
+ if (avm.containsArg(Arg.APPEND) || avm.containsArg(Arg.OPEN))
{
commandArgsProvided = true;
long progress = -1;
boolean first = true;
boolean progressBarSet = false;
AlignFrame af;
- // Combine the OPEN and OPENNEW files into one list, along with whether it
- // was OPEN or OPENNEW
- List<Entry<Arg, ArgValue>> openAvList = new ArrayList<>();
- avm.getArgValueList(Arg.OPEN).stream()
- .forEachOrdered(av -> openAvList.add(
- new AbstractMap.SimpleEntry<Arg, ArgValue>(Arg.OPEN,
- av)));
- avm.getArgValueList(Arg.OPENNEW).stream()
- .forEachOrdered(av -> openAvList
- .add(new AbstractMap.SimpleEntry<Arg, ArgValue>(
- Arg.OPENNEW, av)));
- for (Entry<Arg, ArgValue> aav : openAvList)
+ // Combine the APPEND and OPEN files into one list, along with whether it
+ // was APPEND or OPEN
+ List<ArgValue> openAvList = new ArrayList<>();
+ openAvList.addAll(avm.getArgValueList(Arg.OPEN));
+ openAvList.addAll(avm.getArgValueList(Arg.APPEND));
+ // sort avlist based on av.getArgIndex()
+ Collections.sort(openAvList);
+ for (ArgValue av : openAvList)
{
- Arg a = aav.getKey();
- ArgValue av = aav.getValue();
+ Arg a = av.getArg();
String openFile = av.getValue();
if (openFile == null)
continue;
af = afMap.get(id);
if (af == null || "true".equals(av.getSubVal("new"))
- || a == Arg.OPENNEW || format == FileFormat.Jalview)
+ || a == Arg.OPEN || format == FileFormat.Jalview)
{
/*
* this approach isn't working yet // get default annotations before opening
af.getCurrentView().addFile(new File(openFile), format, false);
}
- Console.debug("Command " + Arg.OPEN + " executed successfully!");
+ Console.debug("Command " + Arg.APPEND + " executed successfully!");
}
if (first) // first=true means nothing opened