git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3dce97f
)
JAL-1421 added type to List and Vector
feature/JAL-3169cancelOverwrite
author
gmungoc
<g.m.carstairs@dundee.ac.uk>
Mon, 10 Dec 2018 12:09:43 +0000
(12:09 +0000)
committer
gmungoc
<g.m.carstairs@dundee.ac.uk>
Mon, 10 Dec 2018 12:09:43 +0000
(12:09 +0000)
src/jalview/io/JalviewFileChooser.java
patch
|
blob
|
history
diff --git
a/src/jalview/io/JalviewFileChooser.java
b/src/jalview/io/JalviewFileChooser.java
index
271ac53
..
6b0eba8
100755
(executable)
--- a/
src/jalview/io/JalviewFileChooser.java
+++ b/
src/jalview/io/JalviewFileChooser.java
@@
-44,6
+44,8
@@
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SpringLayout;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SpringLayout;
+import javax.swing.SwingUtilities;
+import javax.swing.border.TitledBorder;
import javax.swing.plaf.basic.BasicFileChooserUI;
/**
import javax.swing.plaf.basic.BasicFileChooserUI;
/**
@@
-392,28
+394,35
@@
public class JalviewFileChooser extends JFileChooser
}
}
}
}
+ /**
+ * A panel to set as the 'accessory' component to the file chooser dialog,
+ * holding a list of recently opened files (if any). These are held as a
+ * tab-separated list of file paths under key <code>RECENT_FILE</code> in
+ * <code>.jalview_properties</code>. A click in the list calls a method in
+ * JalviewFileChooser to set the chosen file as the selection.
+ */
class RecentlyOpened extends JPanel
{
class RecentlyOpened extends JPanel
{
- JList list;
+ private static final long serialVersionUID = 1L;
- public RecentlyOpened()
- {
+ private JList<String> list;
- String historyItems = jalview.bin.Cache.getProperty("RECENT_FILE");
+ RecentlyOpened()
+ {
+ String historyItems = Cache.getProperty("RECENT_FILE");
StringTokenizer st;
StringTokenizer st;
- Vector recent = new Vector();
+ Vector<String> recent = new Vector<>();
if (historyItems != null)
{
st = new StringTokenizer(historyItems, "\t");
if (historyItems != null)
{
st = new StringTokenizer(historyItems, "\t");
-
while (st.hasMoreTokens())
{
while (st.hasMoreTokens())
{
- recent.addElement(st.nextElement());
+ recent.addElement(st.nextToken());
}
}
}
}
- list = new JList(recent);
+ list = new JList<>(recent);
DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
dlcr.setHorizontalAlignment(DefaultListCellRenderer.RIGHT);
DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
dlcr.setHorizontalAlignment(DefaultListCellRenderer.RIGHT);
@@
-428,7
+437,7
@@
public class JalviewFileChooser extends JFileChooser
}
});
}
});
- this.setBorder(new javax.swing.border.TitledBorder(
+ this.setBorder(new TitledBorder(
MessageManager.getString("label.recently_opened")));
final JScrollPane scroller = new JScrollPane(list);
MessageManager.getString("label.recently_opened")));
final JScrollPane scroller = new JScrollPane(list);
@@
-439,7
+448,7
@@
public class JalviewFileChooser extends JFileChooser
layout.putConstraint(SpringLayout.NORTH, scroller, 5,
SpringLayout.NORTH, this);
layout.putConstraint(SpringLayout.NORTH, scroller, 5,
SpringLayout.NORTH, this);
- if (new Platform().isAMac())
+ if (Platform.isAMac())
{
scroller.setPreferredSize(new Dimension(500, 100));
}
{
scroller.setPreferredSize(new Dimension(500, 100));
}
@@
-450,7
+459,7
@@
public class JalviewFileChooser extends JFileChooser
this.add(scroller);
this.add(scroller);
- javax.swing.SwingUtilities.invokeLater(new Runnable()
+ SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
@Override
public void run()
@@
-459,8
+468,6
@@
public class JalviewFileChooser extends JFileChooser
.setValue(scroller.getHorizontalScrollBar().getMaximum());
}
});
.setValue(scroller.getHorizontalScrollBar().getMaximum());
}
});
-
}
}
-
}
}
}
}