Skip to content

Sort examples by display name #1002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions app/src/processing/app/ui/ExamplesFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Enumeration;

import javax.swing.Box;
Expand All @@ -57,6 +59,7 @@
import processing.app.Platform;
import processing.app.Preferences;
import processing.app.SketchReference;
import processing.app.contrib.Contribution;
import processing.app.contrib.ContributionManager;
import processing.app.contrib.ContributionType;
import processing.app.contrib.ExamplesContribution;
Expand Down Expand Up @@ -313,9 +316,11 @@ protected DefaultMutableTreeNode buildTree() {
}

// Get examples for third party libraries
DefaultMutableTreeNode contributedLibExamples = new
DefaultMutableTreeNode(Language.text("examples.libraries"));
for (Library lib : mode.contribLibraries) {
DefaultMutableTreeNode contributedLibExamples = new DefaultMutableTreeNode(Language.text("examples.libraries"));
var sortedContribLibs = new ArrayList<>(mode.contribLibraries);
// Sort the libraries by actual name (not the name of the folder)
sortedContribLibs.sort(Comparator.comparing(Contribution::getName));
for (Library lib : sortedContribLibs) {
if (lib.hasExamples()) {
DefaultMutableTreeNode libNode =
new DefaultMutableTreeNode(lib.getName());
Expand Down