}
public HistoryMenu(String name) {
super(name);
final History history = IGV.getInstance().getSession().getHistory();
clearAllItem = new JMenuItem("Clear all");
clearAllItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
history.clear();
}
});
//backItem = new JMenuItem("<html>Back <i>Alt →");
backItem = new JMenuItem("Back Alt+Arrow");
backItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
history.back();
}
});
forwardItem = new JMenuItem("Forward Alt+Arrow");
forwardItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
history.forward();
}
});
this.addMenuListener(new MenuListener() {
public void menuSelected(MenuEvent menuEvent) {
final History history = IGV.getInstance().getSession().getHistory();
List<History.Entry> allLoci = IGV.getInstance().getSession().getAllHistory();
boolean hasBack = history.peekBack() != null;
boolean hasForward = history.peekForward() != null;
backItem.setEnabled(hasBack);
forwardItem.setEnabled(hasForward);
clearAllItem.setEnabled(allLoci.size() > 0);
// Update history list