use of net.sf.mzmine.modules.projectmethods.projectload.ProjectOpeningTask in project mzmine2 by mzmine.
the class MainMenu method setLastProjects.
public void setLastProjects(List<File> list) {
lastProjects = list;
SwingUtilities.invokeLater(() -> {
lastProjectsSub.removeAll();
if (list == null || list.isEmpty()) {
lastProjectsSub.setEnabled(false);
return;
}
lastProjectsSub.setEnabled(true);
// add items to load last used projects directly
lastProjects.stream().map(File::getAbsolutePath).forEach(name -> {
JMenuItem item = new JMenuItem(name);
item.addActionListener(e -> {
JMenuItem c = (JMenuItem) e.getSource();
if (c != null) {
File f = new File(c.getText());
if (f.exists()) {
// load file
ProjectOpeningTask newTask = new ProjectOpeningTask(f);
MZmineCore.getTaskController().addTask(newTask);
}
}
});
lastProjectsSub.add(item);
});
});
}
Aggregations