/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2)
- * Copyright (C) 2015 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
*/
package jalview.gui;
+import static jalview.util.UrlConstants.EMBLEBI_STRING;
+import static jalview.util.UrlConstants.SEQUENCE_ID;
+
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.bin.Cache;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+import java.util.ListIterator;
import java.util.StringTokenizer;
import java.util.Vector;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Semaphore;
import javax.swing.AbstractAction;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
import javax.swing.DefaultDesktopManager;
import javax.swing.DesktopManager;
import javax.swing.JButton;
+import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JDesktopPane;
showNews.setVisible(false);
+ checkURLLinks();
+
this.addWindowListener(new WindowAdapter()
{
@Override
public void drop(DropTargetDropEvent evt)
{
boolean success = true;
+ // JAL-1552 - acceptDrop required before getTransferable call for
+ // Java's Transferable for native dnd
+ evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
Transferable t = evt.getTransferable();
java.util.List<String> files = new ArrayList<String>();
java.util.List<String> protocols = new ArrayList<String>();
new Thread(jvq).start();
}
+ public void checkURLLinks()
+ {
+ // Thread off the URL link checker
+ addDialogThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ if (Cache.getDefault("CHECKURLLINKS", true))
+ {
+ // check what the actual links are - if it's just the default don't
+ // bother with the warning
+ Vector<String> links = Preferences.sequenceURLLinks;
+
+ // only need to check links if there is one with a
+ // SEQUENCE_ID which is not the default EMBL_EBI link
+ ListIterator<String> li = links.listIterator();
+ Boolean check = false;
+ while (li.hasNext() && !check)
+ {
+ String link = li.next();
+ check = (link.contains(SEQUENCE_ID) && !link
+ .equals(EMBLEBI_STRING));
+ }
+ if (!check)
+ {
+ return;
+ }
+
+ // ask user to check in case URL links use old style tokens
+ // ($SEQUENCE_ID$ for sequence id _or_ accession id)
+ JPanel msgPanel = new JPanel();
+ msgPanel.setLayout(new BoxLayout(msgPanel, BoxLayout.PAGE_AXIS));
+ msgPanel.add(Box.createVerticalGlue());
+ JLabel msg = new JLabel(
+ MessageManager
+ .getString("label.SEQUENCE_ID_for_DB_ACCESSION1"));
+ JLabel msg2 = new JLabel(
+ MessageManager
+ .getString("label.SEQUENCE_ID_for_DB_ACCESSION2"));
+ msgPanel.add(msg);
+ msgPanel.add(msg2);
+
+ final JCheckBox jcb = new JCheckBox(
+ MessageManager.getString("label.do_not_display_again"));
+ jcb.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // update Cache settings if checkbox is selected
+ if (jcb.isSelected())
+ {
+ Cache.setProperty("CHECKURLLINKS", "false");
+ }
+ else
+ {
+ Cache.setProperty("CHECKURLLINKS", "true");
+ }
+ }
+ });
+ msgPanel.add(jcb);
+
+ JOptionPane.showMessageDialog(Desktop.desktop, msgPanel,
+ MessageManager
+ .getString("label.SEQUENCE_ID_no_longer_used"),
+ JOptionPane.WARNING_MESSAGE);
+ }
+ }
+ });
+ }
+
/**
* Proxy class for JDesktopPane which optionally displays the current memory
* usage and highlights the desktop area with a red bar if free memory runs
{
// Works on Windows and MacOSX
Cache.log.debug("Drop handled as javaFileListFlavor");
- evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
for (Object file : (List) t
.getTransferData(DataFlavor.javaFileListFlavor))
{
{
Cache.log.debug("Drop handled as uriListFlavor");
// This is used by Unix drag system
- evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
data = (String) t.getTransferData(uriListFlavor);
}
if (data == null)
{
Cache.log.debug("Supported transfer dataflavor: "
+ fl.toString());
- evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
Object df = t.getTransferData(fl);
if (df != null)
{