Skip to content

Use NetBeans utilities for font color settings#30

Open
Shredder121 wants to merge 1 commit into
Chris2011:masterfrom
Shredder121-me:performance
Open

Use NetBeans utilities for font color settings#30
Shredder121 wants to merge 1 commit into
Chris2011:masterfrom
Shredder121-me:performance

Conversation

@Shredder121

Copy link
Copy Markdown

Hey @markiewb,

Nice plugin, why haven't I seen this before?

👍

Do you think it would make sense to add caching from mimetype to AttributeSet?

@Shredder121

Copy link
Copy Markdown
Author

Or maybe from mimetype to FontColorSettings?

the 'Lookup.lookup()` call is the slowest in the few method calls.

@markiewb

markiewb commented Sep 4, 2016

Copy link
Copy Markdown
Collaborator

Currently I do not care about the performance. A better way than caching would be to add a listener to the settings. Like it is done in standard NB: When you change a color in the option, then it is reflected in the editor after saving the options.

@Shredder121

Copy link
Copy Markdown
Author

A better way than caching would be to add a listener to the settings.

I agree.
Do you know what component we have to listen to for that?
EditorSettings seems to be the way to go, but its API is not stable.

Or do you know a better one?

@markiewb

markiewb commented Sep 9, 2016

Copy link
Copy Markdown
Collaborator

@Shredder121: I do not know a better implementation. But I did not search for others.

I was pleased with the solution I implemented originally. It worked at least [grin]

@markiewb

Copy link
Copy Markdown
Collaborator

@Shredder121

Copy link
Copy Markdown
Author

Yeah, and then register the listener for each MimeType it sees along the way.
So if you never opened e.g. a JSON file, we don't need to lookup the color settings for that.

Shall I do that then?

@markiewb

Copy link
Copy Markdown
Collaborator

Yes. Try that.

Some remarks:

  • Do not add too much listeners. One per mimetype would be enough.
  • Unregister the listeners properlz (WeakListeners?)

@Chris2011

Copy link
Copy Markdown
Owner

@Shredder121 I know it is very late but is this still relevant for you? We already had a PR that it is working for the latest NetBeans version 23. Otherwise I will close the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants