Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Added alphabetical sorting to the "Select Project" dropdown (https://github.com/nbclaudecodegui/NetbeansClaudeCodeGui/issues/21)
- Fixed Default profile settings (API key, connection type, proxy, etc.) not being saved when edited in Tools → Options → Claude Code → Profiles
- Fixed MCP config not working on Windows due to quote stripping in CreateProcess (https://github.com/nbclaudecodegui/NetbeansClaudeCodeGui/issues/13)
- Improved error panel on process start failure: shows Working Directory and CLAUDE_CONFIG_DIR fields (before Command and Error) for easier diagnosis; all fields have a right-click Copy menu; fixed "Restart Advanced…" not dismissing the error panel
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.github.nbclaudecodegui</groupId>
<artifactId>netbeans-claude-code-gui</artifactId>
<version>0.21.40-SNAPSHOT</version>
<version>0.21.41-SNAPSHOT</version>
<packaging>nbm</packaging>
<name>Netbeans Claude Code GUI</name>
<description>NetBeans plugin that provides a GUI for Claude Code CLI — run claude code sessions directly inside the IDE.</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.logging.Logger;
import java.util.prefs.Preferences;
Expand Down Expand Up @@ -494,7 +496,13 @@ private void populateProjectCombo() {
DefaultComboBoxModel<ProjectItem> cbModel = new DefaultComboBoxModel<>();
cbModel.addElement(new ProjectItem(null,
NbBundle.getMessage(ClaudeSessionSelectorPanel.class, "LBL_SelectProject")));
for (Project p : OpenProjects.getDefault().getOpenProjects()) {
// Sort projects alphabetically (case-insensitive) so the user can find
// their project quickly regardless of the order NetBeans returns them.
Project[] projects = OpenProjects.getDefault().getOpenProjects();
Arrays.sort(projects, Comparator.comparing(
p -> ProjectUtils.getInformation(p).getDisplayName(),
String.CASE_INSENSITIVE_ORDER));
for (Project p : projects) {
cbModel.addElement(new ProjectItem(p,
ProjectUtils.getInformation(p).getDisplayName()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.Comparator;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
Expand Down Expand Up @@ -157,6 +159,36 @@ void resolveTabLabelNonProjectDirReturnsFallback() throws IOException {
}
}

// -------------------------------------------------------------------------
// Project combo sorting (issue #21)
// -------------------------------------------------------------------------

/**
* Verifies that the comparator used in {@code populateProjectCombo()} sorts
* project names case-insensitively. The test stands in for the full UI
* flow (which requires a live NetBeans module system) and confirms that
* the sorting algorithm itself is correct.
*/
@Test
void projectComboSortIsCaseInsensitive() {
String[] names = {"Zebra", "apple", "Banana", "cherry"};
Arrays.sort(names, Comparator.comparing(s -> s, String.CASE_INSENSITIVE_ORDER));
assertArrayEquals(new String[]{"apple", "Banana", "cherry", "Zebra"}, names,
"Projects must be sorted alphabetically, case-insensitive");
}

@Test
void projectComboSortIsStableForEqualCaseNames() {
String[] names = {"Beta", "alpha", "ALPHA", "beta"};
Arrays.sort(names, Comparator.comparing(s -> s, String.CASE_INSENSITIVE_ORDER));
// All alpha-variants before beta-variants; relative order within a group
// is preserved (Arrays.sort is stable).
assertEquals("alpha", names[0].toLowerCase(),
"First group must be 'alpha' variants");
assertEquals("beta", names[2].toLowerCase(),
"Second group must be 'beta' variants");
}

// -------------------------------------------------------------------------
// History persistence helpers
// -------------------------------------------------------------------------
Expand Down
Loading