Skip to content
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

Fixes several bugs in the editor annotation options. #8231

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mbien
Copy link
Member

@mbien mbien commented Feb 11, 2025

Fixes several issues with the editor annotation options.

  • Make sure the current editor annotation profile is correctly copied on profile duplication.
  • Make sure annotation profile settings are correctly persisted and applied on change
  • All profiles must have annotation color configs to have inherited values work correctly (added missing)
  • EditorSettings: fix javadoc since the impl never returned null in the last 20 years.

manual test:

  • open options -> fonts & colors -> annotations
  • change settings, try duplicate, delete, restore etc
    • changes to copied profiles shouldn't apply to other profiles
    • UI should display the right values when profile is switched
    • persistence should work
    • editor should update to the changed settings

fixes #8143 and https://issues.apache.org/jira/browse/NETBEANS-1493

@mbien mbien added Editor UI User Interface ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Feb 11, 2025
@mbien mbien added this to the NB26 milestone Feb 11, 2025
@mbien mbien force-pushed the fix-anotation-editor-settings branch from 5adda61 to d95f30b Compare February 22, 2025 01:20
@mbien
Copy link
Member Author

mbien commented Feb 22, 2025

there is still something weird going on when annotation colors of copied profiles are persisted. Have to take another look.

edit: I think I have found the (hopefully) last remaining problem. Fix in progress.

@mbien mbien marked this pull request as draft February 26, 2025 08:39
@mbien mbien removed this from the NB26 milestone Feb 26, 2025
 - Make sure the current editor annotation profile is correctly copied
   on profile duplication.
 - Make sure annotation profile settings are correctly persisted and
   applied on change
 - All profiles must have annotation color configs to have inherited
   values work correctly (added missing)
 - EditorSettings: fix javadoc since the impl never returned null in
   the last 20 years.
@mbien mbien force-pushed the fix-anotation-editor-settings branch from d95f30b to 86fe0a9 Compare March 6, 2025 18:49
@mbien mbien added this to the NB26 milestone Mar 6, 2025
@mbien mbien marked this pull request as ready for review March 6, 2025 18:53
@mbien mbien requested a review from matthiasblaesing March 6, 2025 18:54
@mbien
Copy link
Member Author

mbien commented Mar 6, 2025

unfortunately this required more changes than anticipated. But I think the editor annotation color profile options work now as intended I hope.

The missing bit is that the inherited colors make only sense if the base theme is well defined. Currently its the "NetBeans" theme which doesn't make a lot of sense for dark themes etc. But fixing this would go beyond the annotations tab. I fear the "Highlighting" tab is also broken, but I need a break from the color settings :)

Comment on lines 209 to 216
/**
* Returns annotations properties for given profile or null, if the
* Returns annotations properties for given profile or an empty Map, if the
* profile is not known.
*
* @param profile a profile name
* @return annotations properties for given profile or null
* @return annotations properties for given profile or an empty map
*/
public abstract Map<String, AttributeSet> getAnnotations (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the impl never returned null in the last ~20 years. Since it is friend API I decided to change the doc instead of the impl since it seemed to be lower risk.

if (this.kbsi == evt.getSource()) {
kbsChanged = true;

} else if (evt.getPropertyName() == null) {
} else if (prop == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just reading the diff, though about using switch over String in this case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing against it, but it would reformat a big section which would make reviews more difficult and might risk to hide the change in it. The main reason I extracted the prop name is because it would make the added || longer a few lines later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Editor UI User Interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate Color Profile doesn't copy all colors
2 participants