#2045: Add tool slection and version or edition configuration via gui#2080
Conversation
- Added testing class for modals
- Added logging to IdeGuiStateManager. - Added functionality, that selecting a different project now switches the IdeContext to the new project.
- Added testing class for modals
- Added logging to IdeGuiStateManager. - Added functionality, that selecting a different project now switches the IdeContext to the new project.
…t-for-gui' into devonfw#1785-implement-modals-in-idecontext
- Added functionality, that selecting a different project now switches the IdeContext to the new project.
…plementation' into devonfw#1802-state-management-implementation
…r other ui feature branches
- added DI for IdeGuiStateManager.switchContext
…reading the list of workspaces/projects instead of reading those from the UI
…nager, when switchContext(Path rootDirectory, ...) is called.
This reverts commit 6f92d93.
…plementation' into devonfw#1802-state-management-implementation
…tateManager is now set when calling getInstance(), allowing us to provide a getInstance() method with a DI parameter
… getInstance()) (see previous commit)
…can be extended by tests
…plementation' into devonfw#1802-state-management-implementation
Coverage Report for CI Build 29110111512Coverage decreased (-0.1%) to 72.112%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions29 previously-covered lines in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
…-slection-and-version-or-edition-configuration-via-gui # Conflicts: # CHANGELOG.adoc
…ol-slection-and-version-or-edition-configuration-via-gui
…tion-configuration-via-gui"
…tion-configuration-via-gui"
…oolSettingsServiceTest
quando632
left a comment
There was a problem hiding this comment.
Thanks for the detailed write-up. Structure is solid (clean Service/Controller/Model split,
good service test coverage). Below are findings, cross-checked against the PR description.
Version validation diverges from the story (and contradicts your own test plan)
The PR states validation flags "a free-text entry that isn't in the loaded version list".
The code confirms this attachVersionValidation only does availableVersions.contains(...)
(plus a * exception). But the story explicitly requires pattern support: 2026.1* /
2026*! must be valid, and 2027* / 2026.1.2.4.5 must be detected as invalid by format.
With the current check:
- a valid pattern like
2026.1*is wrongly flagged (it's not literally in the list); - malformed input like
2026.1.2.4.5is only "not in list", not recognized as invalid format.
The CLI already has the right tool: VersionIdentifier.of(String), isPattern(), matches(...).
Validation should parse the input and, for patterns, matches() against the available versions.
This ideally lives in the service (so it's unit-testable), not in the cell.
Validation is skipped unless the dropdown was opened first breaks your test plan step
availableVersions is only populated in the version combo's setOnShowing handler. In
attachVersionValidation, when availableVersions == null the check is skipped entirely.
Typing into the editable combo does not trigger setOnShowing, so a user who types a value
and tabs away (without ever opening the dropdown) gets no red border and no error.
This directly contradicts the manual test: "Type a nonsense string into a version field, then
click away, red border and ✗ icon appear." That only passes if the dropdown was opened first.
Since onSave relies solely on the disabled button, invalid values can also be saved this way.
Changing edition doesn't re-validate the current version
On edition change the version list reloads, but the already-entered version and its error state
are not re-checked. A version valid for edition A may be invalid for edition B and stays unflagged
(or a stale red icon remains).
Window UI does not show everything
The window opens at half the screen height (new Scene(root, bounds/2, bounds/2) in App.java),
but the root layout is pinned to a fixed 515px (prefHeight="515.0" with maxHeight="-Infinity" and
minHeight="-Infinity" in main-view.fxml). When half the screen height is < 515px (common on
laptops), the 515px layout overflows the window and the bottom bar — i.e. the Cancel/Preview/Save
buttons is clipped and invisible until the user manually enlarges the window. The fixed
min/maxHeight should be relaxed (a BorderPane.bottom action bar is always reserved space anyway),
or the tab content given a sensible minimum height, so the primary action stays reachable.
PR description vs. implementation drift
The description mentions a spinner replacing the button text and a dialog that opens only once loaded, but the current code is a tab whose initialize() calls listToolConfigurations synchronously on the FX thread (only editions load in the background). Please align the description with the tab-based implementation, or move the initial load off the FX thread if blocking is a concern.
Tests
ToolSettingsServiceTest (32 tests) is thorough for the service preview generation, applyAndSave,
backup, edition/version loading incl. exception paths. The story's core requirement (version
validation, esp. patterns) is untested, because it lives in the cell/controller. Moving validation
into the service would let you unit-test 2026.1* valid / 2027* invalid / 2026.1.2.4.5 invalid,
There was a problem hiding this comment.
State bug: validationErrors / currentContext are static
A new ToolSettingsController is created every time the tab is opened
(MainController.loadToolConfigContent). Because validationErrors is static, its state
outlives the instance. initialize() → updateButtonStates() reads the static set, so if an
error is left in it when closing, Save/Preview are wrongly disabled on the next open even
though the fresh tree shows no error. The comment justifies static with cell recycling, but the
cells already hold a controller reference, so an instance field survives recycling without
the leak. currentContext/service static are additional smells (not multi-window safe).
Edition combo: setManaged(true) while invisible
When supportsEdition == false, the combo is set setVisible(false) but setManaged(true), so
it still occupies layout space → visible gap in the column. Use setManaged(false) to collapse it.
There was a problem hiding this comment.
Regarding the first point, you are absolutely right --> I've removed the static declarations from validationErrors, currentContext, and service
Regarding the second point, I left setManaged(true) intentionally. The goal was to preserve the layout structure so all rows remain aligned and tool entries with and without editions keep the same version-combobox width. In that case the empty space is expected
|
Thanks @quando632 for the comprehensive review and for taking the time to provide such detailed feedback and suggestions. Great job with the findings I have addressed the points from your comment:
|
This PR fixes #2045
Implemented changes:
A Tools Configuration tab that lets users manage which tools are active in their IDEasy workspace and what version/edition each one uses, all persisted to
ide.propertiesin the project settings layer.How it works
Opening the tab — After selecting a Project and workspace, the "Tool Config" tab is enabled, clicking it triggers a background load of
listToolConfigurations, which walks theCommandletManagerand reads each tool's current version and edition from the environment variables. Then the tab is populated with the list of toolsThe tree view — tools are grouped by type (IDE, Global, Local, NPM, PIP, Other) and sorted alphabetically within each group. Each row has an enable checkbox, the tool name, an edition combo (if the tool has more than one configurable edition, and a version combo.
Editions — after the tab opens, a single background thread walks all tools and calls
loadEditionsForTool(a repository directory scan) for each, then triggers a singletoolsTree.refresh()when done. The edition combo is hidden for tools with ≤1 edition. If exactly one editionexists and none is configured, it is auto-selected.
Versions — the version combo lazy-loads on first open to avoid fetching all tools' version lists upfront. When the user changes the edition, the version list refreshes automatically in a background thread.
Because JavaFX doesn't repaint an already-open popup after its items change, the combo is hidden and reshown to force the updated list to appear.
Validation — version input is validated on focus-lost. A free-text entry that isn't in the loaded version list gets a red border and a ✗ error icon. Blank input is normalised to
*(meaning "latest"). The Save and Preview buttons are disabled until all errors are resolved.Saving —
applyAndSavewrites the enabled-tools list and per-tool_VERSION/_EDITIONvariables into the settings environment-variables layer and callssave(). Blank version strings are normalised tonull(removes the variable). The_EDITIONvariable is only written/cleared fortools where
supportsEdition=true.Preview — opens a read-only
TextAreashowing the exactide.propertiescontent that would result from the current state. Includes a Save button to apply directly from the preview.Testing instructions
ToolSettingsServiceTest` covers all public methods:
toToolConfiguration— name mapping, enabled/disabled, case-insensitivematch, null enabled-tools list
loadEditionsForTool— happy path, unknown tool, repository exceptionreloadVersionsForSelectedEdition— happy path, null/blank edition,unknown tool, repository exception
buildPreviewSettingsContent— version/edition present, omitted whennull/blank, edition suppressed when
supportsEdition=false, multipletools, no enabled tools
applyAndSave— version and edition written, disabled tool clearsexisting entries, blank version clears existing entry, edition suppressed
when
supportsEdition=false, IDE_TOOLS list updated, backup created,no backup when file absent
Test plan
Unit tests
ToolSettingsServiceTest— all 31 tests greenOpening the dialog
Enabling / disabling tools
Edition combo
populated after the background scan
Version combo
the popup reopens automatically with the version list
Version validation
red border and ✗ icon appear; Save and Preview are disabled
*) — error clears, buttons re-enablePreview
ide.propertiescontent matching current stateSave and file output
<project>/settings/ide.propertiesand verify:IDE_TOOLSlists only enabled tools, names lowercased_VERSIONlines present for enabled tools with a version set_EDITIONlines present only for tools withsupportsEdition=trueide.properties.bakwas created alongside the fileEdge cases
version field — existing
_VERSIONline must be removedChecklist for this PR
Make sure everything is checked before merging this PR. For further info please also see
our DoD.
mvn clean testlocally all tests pass and build is successful#«issue-id»: «brief summary»(e.g.#921: fixed setup.bat). If no issue ID exists, title only.In Progressand assigned to you or there is no issue (might happen for very small PRs)with
internal