Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use NetBeans utilities for font color settings #30

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

Conversation

Shredder121
Copy link

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
Author

Or maybe from mimetype to FontColorSettings?

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

@markiewb
Copy link
Collaborator

markiewb commented Sep 4, 2016

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
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
Copy link
Collaborator

markiewb commented Sep 9, 2016

@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]

@Shredder121
Copy link
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
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
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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants