|
org.netbeans.modules.editor.settings/1 1.36.1 | |||||||||
PREV NEXT | FRAMES NO FRAMES |
See:
Description
Editor Settings | |
---|---|
org.netbeans.api.editor.settings |
The editor/settings
module consists of several
EditorSettingsAPIAPI
classes for accessing editor related settings. The classes are stored in the
org.netbeans.api.editor.settings
package. Each class is responsible
for a different group of settings:
String
s) of colorings and their parameters
(i.e. AttributeSet
s).
String
s) and their bodies
(i.e. String
s).
MultiKeyBinding
s.
Each MultiKeyBinding
is a list of keyboard shortcuts associated
to an Action
.
Editor settings for a particular mime type can be obtained through MimeLookup
MimePath mimePath = MimePath.parse("text/x-java"); FontColorSettings fcs = (FontColorSettings) MimeLookup.getLookup(mimePath).lookup(FontColorSettings.class);
Adding new constant SimpleValueNames.ON_SAVE_REMOVE_TRAILING_WHITESPACE
.
Adding new constant SimpleValueNames.NON_PRINTABLE_CHARACTERS_VISIBLE
.
Adding new constant SimpleValueNames.TEXT_LINE_WRAP
.
Adding a new constant SimpleValueNames.ALT_HYPERLINK_ACTIVATION_MODIFIERS
as the name
of an editor setting that determins shortcut for activating alternative (other than go to declaration)
hyperlink action.
Adding new constant SimpleValueNames.JAVADOC_POPUP_NEXT_TO_CC
.
All editor settings are mime type specific and therefore should be retrieved
using MimeLookup
. The following example shows how to retrieve
the FontColorSettings
for java files and how to get AttributeSet
with coloring attributes for a particular coloring (i.e. in this case the
colors used for highlighting selected text)
MimePath mimePath = MimePath.parse("text/x-java"); FontColorSettings fcs = (FontColorSettings) MimeLookup.getLookup(mimePath).lookup(FontColorSettings.class); AttributeSet coloring = fcs.getFontColors(FontColorNames.SELECTION_COLORING);
If clients need to react on changes in editor settings they can attach LookupListener
to the LookupResult
they got for their particular settings class
from MimeLookup
. The following example shows how to do it.
MimePath mimePath = MimePath.parse("text/x-java"); Lookup lookup = MimeLookup.getLookup(mimePath); LookupResult result = lookup.lookup(new Lookup.Template(FontColorSettings.class)); result.addLookupListener(new LookupListener() { public void resultChanged(LookupEvent ev) { //... the client's response to the settings change } });
The FontColorSettings
class implementor is responsible and will create
a new instance of FontColorSettings
whenever some coloring will change.
This new instance will be placed in MimeLookup
replacing the old one.
|
The sources for the module are in the NetBeans Mercurial repositories.
Read more about the implementation in the answers to architecture questions.
|
org.netbeans.modules.editor.settings/1 1.36.1 | |||||||||
PREV NEXT | FRAMES NO FRAMES |