Make "Execution Env." combo editable to support future/unknown EE values#7174
Closed
Make "Execution Env." combo editable to support future/unknown EE values#7174
Conversation
Co-authored-by: chrisrueger <188422+chrisrueger@users.noreply.github.com> Agent-Logs-Url: https://github.com/bndtools/bnd/sessions/916fc9dd-f318-49bb-b632-12dee28c6c2f
Copilot
AI
changed the title
[WIP] Change Execution Env. dropdown to editable combo
Make "Execution Env." combo editable to support future/unknown EE values
Mar 22, 2026
Replace the typed EE converters/formatters with string-backed handling for the RUNEE property. getEE() now parses the stored string into the EE enum (returns null if absent), while getRunEE()/setRunEE(String) expose the raw string value for newer or unknown JDK names. Update setEE to store EE.getEEName() via the newlineEscapeFormatter. Update tests to assert the string run EE and bump package version to 4.6.0. This allows tolerant handling of RUNEE values that aren't yet represented in the EE enum. Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
Contributor
|
This was an experiment (related to #6859) to allow entering unsupported (free text) values into the Execution Environment Dropdown in .bndrun editor (for more lenient behavior in case the EE enum does not have the value (yet). But during working on it I noticed the EE enum is all over the place. The core places which rely on the enum are too many, to support free text. So I guess I will close this PR again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The
RunFrameworkPartEE combo wasREAD_ONLY, restricting users toEEenum values and making it impossible to specify execution environments not yet in the enum (e.g. future Java versions).Changes
BndEditModel— raw string accessors forRUNEEgetRunEE()— readsRUNEEas a raw string viastringConvertersetRunEE(String)— writesRUNEEas a raw string vianewlineEscapeFormatter, bypassingEEFormatterwhich only handlesEEenum instancesRunFrameworkPart— editable combo with suggestionsSWT.READ_ONLYfromcmbExecEnvto enable free-text inputselectedEEfield fromEEtoStringeeViewer.addSelectionChangedListenerwith aModifyListeneroncmbExecEnv— covers both typed input and dropdown selection (consistent with howcmbFrameworkworks)refreshFromModel()falls back tomodel.getRunEE()whenmodel.getEE()returnsnull(i.e. the stored value is not a known enum member), then sets the text directly on the combo widgetcommitToModel()callsmodel.setRunEE(selectedEE)instead ofmodel.setEE(EE)The
eeViewerand its content/label provider are unchanged — all knownEE.values()remain available as dropdown suggestions.Original prompt
Goal
Change the "Execution Env." combo in
RunFrameworkPartfrom a read-only dropdown to an editable combo (dropdown with free-text input), so users can enter EE values that are not yet part of theEEenum (e.g. future Java versions).File to Change
bndtools.core/src/bndtools/editor/project/RunFrameworkPart.javaDetailed Changes Required
1. Change the field type of
selectedEEfromEEtoString(line 41)2. Remove
SWT.READ_ONLYfromcmbExecEnv(line 86)3. Replace the
eeViewerselection listener with aModifyListeneroncmbExecEnv(lines 124–127)The
eeViewer.addSelectionChangedListenerblock currently casts the selection result toEE. SinceselectedEEis now aString, replace it with aModifyListeneroncmbExecEnv(just likecmbFrameworkalready uses), which handles both typed values and dropdown selections:4. Update
refreshFromModel()to restore the EE value as text (lines 159–160)5. Update
commitToModel()to write the raw string usinggenericSet(line 171)BndEditModel.genericSet(String propertyName, Object value)writes the value using the registered formatter. ForRUNEE, the formatter isEEFormatter, which is very simple — it callsinput.getEEName()if input is anEE, or returnsnullotherwise. Since we now pass aStringdirectly, bypasssetEE(EE)entirely and usegenericSetwith the raw string, or write it viadoSetObjectwithstringConverter.The cleanest approach without modifying
BndEditModelis to usemodel.genericSet(Constants.RUNEE, selectedEE)— however sinceEEFormatterexpects anEEobject, this will not work cleanly. Instead, write to the raw document properties directly using the string-based approach already used forRUNFW:Correct approach for
commitToModel— AddsetRunEE(String)toBndEditModelAdd the following method to
biz.aQute.bndlib/src/aQute/bnd/build/model/BndEditModel.java:Then in
RunFrameworkPart.commitToModel():And in `RunFrameworkPart.refre...
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.