Skip to content

Commit

Permalink
better recent project list
Browse files Browse the repository at this point in the history
  • Loading branch information
ix0rai committed Dec 29, 2023
1 parent ec21bc3 commit 6986457
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,15 @@ public static Theme.Fonts currentFonts() {

public static void insertRecentProject(String jarPath, String mappingsPath) {
RecentProject project = new RecentProject(jarPath, mappingsPath);
if (!main().recentProjects.value().contains(project)) {
main().recentProjects.value().add(0, new RecentProject(jarPath, mappingsPath));
ValueList<RecentProject> projects = main().recentProjects.value();

// add project, shifting to top if already on the list
projects.remove(project);
projects.add(0, new RecentProject(jarPath, mappingsPath));

// remove the oldest project according to max values
if (projects.size() > main().maxRecentProjects.value()) {
projects.remove(projects.size() - 1);
}
}

Expand Down

0 comments on commit 6986457

Please sign in to comment.