import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
-import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.JTable;
import jalview.api.structures.JalviewStructureDisplayI;
import jalview.bin.Cache;
+import jalview.bin.Console;
import jalview.bin.Jalview;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
{
private static final String AUTOSUPERIMPOSE = "AUTOSUPERIMPOSE";
+ /**
+ * warn user if need to fetch more than this many uniprot records at once
+ */
+ private static final int THRESHOLD_WARN_UNIPROT_FETCH_NEEDED = 20;
+
private SequenceI selectedSequence;
private SequenceI[] selectedSequences;
Executors.defaultThreadFactory().newThread(new Runnable()
{
+ @Override
public void run()
{
populateSeqsWithoutSourceDBRef();
};
final Runnable revertview = new Runnable()
{
+ @Override
public void run()
{
if (lastSelected != null)
}
};
};
- if (ignoreGui)
+ int threshold = Cache.getDefault("THRESHOLD_WARN_UNIPROT_FETCH",
+ THRESHOLD_WARN_UNIPROT_FETCH_NEEDED);
+ Console.debug("Using Uniprot fetch threshold of " + threshold);
+ boolean runThread = false;
+ if (ignoreGui || seqsWithoutSourceDBRef.size() < threshold)
+ {
+ runThread = true;
+ }
+ // need cancel and no to result in the discoverPDB action - mocked is
+ // 'cancel' TODO: mock should be OK
+ if (!runThread)
+ {
+ int answer = JvOptionPane.showConfirmDialog(this,
+ MessageManager.formatMessage(
+ "label.fetch_references_for_3dbeacons",
+ seqsWithoutSourceDBRef.size()),
+ MessageManager.getString("label.3dbeacons"),
+ JvOptionPane.YES_NO_OPTION, JvOptionPane.PLAIN_MESSAGE);
+ runThread = (answer == JvOptionPane.OK_OPTION);
+ }
+ if (runThread)
{
Executors.defaultThreadFactory().newThread(discoverCanonicalDBrefs)
.start();
return;
}
- // need cancel and no to result in the discoverPDB action - mocked is
- // 'cancel' TODO: mock should be OK
- JvOptionPane.newOptionDialog(this)
- .setResponseHandler(JvOptionPane.OK_OPTION,
- discoverCanonicalDBrefs)
- .setResponseHandler(JvOptionPane.CANCEL_OPTION, revertview)
- .setResponseHandler(JvOptionPane.NO_OPTION, revertview)
- .showDialog(
- MessageManager.formatMessage(
- "label.fetch_references_for_3dbeacons",
- seqsWithoutSourceDBRef.size()),
- MessageManager.getString("label.3dbeacons"),
- JvOptionPane.YES_NO_OPTION, JvOptionPane.PLAIN_MESSAGE,
- null, new Object[]
- { MessageManager.getString("action.ok"),
- MessageManager.getString("action.cancel") },
- MessageManager.getString("action.ok"));
+ else
+ {
+ revertview.run();
+ }
}
/**
popup.add(viewUrl);
SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
popup.show(getResultTable(), x, y);