+ exampleBtn.setEnabled(false);
+ textArea.setEnabled(false);
+ okBtn.setEnabled(false);
+ closeBtn.setEnabled(false);
+ backBtn.setEnabled(false);
+
+ Thread worker = new Thread(this);
+ worker.start();
+ }
+
+ private void resetDialog()
+ {
+ exampleBtn.setEnabled(true);
+ textArea.setEnabled(true);
+ okBtn.setEnabled(true);
+ closeBtn.setEnabled(true);
+ backBtn.setEnabled(parentSearchPanel != null);
+ }
+
+ @Override
+ public void run()
+ {
+ boolean addToLast = false;
+ List<String> aresultq = new ArrayList<>();
+ List<String> presultTitle = new ArrayList<>();
+ List<AlignmentI> presult = new ArrayList<>();
+ List<AlignmentI> aresult = new ArrayList<>();
+ List<DbSourceProxy> sources = sfetch.getSourceProxy(
+ ((StringPair) database.getSelectedItem()).getKey());
+ Iterator<DbSourceProxy> proxies = sources.iterator();
+ String[] qries = textArea.getText().trim().split(";");
+ List<String> nextFetch = Arrays.asList(qries);
+ Iterator<String> en = Arrays.asList(new String[0]).iterator();
+ int nqueries = qries.length;
+
+ FeatureSettingsModelI preferredFeatureColours = null;
+ while (proxies.hasNext() && (en.hasNext() || nextFetch.size() > 0))
+ {
+ if (!en.hasNext() && nextFetch.size() > 0)
+ {
+ en = nextFetch.iterator();
+ nqueries = nextFetch.size();
+ // save the remaining queries in the original array
+ qries = nextFetch.toArray(new String[nqueries]);
+ nextFetch = new ArrayList<>();
+ }
+
+ DbSourceProxy proxy = proxies.next();
+ try
+ {
+ // update status
+ guiWindow.setProgressBar(MessageManager.formatMessage(
+ "status.fetching_sequence_queries_from", new String[]
+ { Integer.valueOf(nqueries).toString(),
+ proxy.getDbName() }),
+ IdUtils.newId(IdType.PROGRESS, Thread.currentThread()));
+ if (proxy.getMaximumQueryCount() == 1)
+ {
+ /*
+ * proxy only handles one accession id at a time
+ */
+ while (en.hasNext())
+ {
+ String acc = en.next();
+ if (!fetchSingleAccession(proxy, acc, aresultq, aresult))
+ {
+ nextFetch.add(acc);