See: Description
| Package | Description |
|---|---|
| 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:
Strings) of colorings and their parameters
(i.e. AttributeSets).
Strings) and their bodies
(i.e. Strings).
MultiKeyBindings.
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 constants SimpleValueNames.ON_SAVE_REFORMAT
and SimpleValueNames.ON_SAVE_USE_GLOBAL_SETTINGS.
Adding new constants
SimpleValueNames.BRACE_SHOW_OUTLINE and
SimpleValueNames.BRACE_FIRST_TOOLTIP which control brace outline
behaviour
Adding new constant SimpleValueNames.EDITOR_SEARCH_TYPE.
Adding new constant SimpleValueNames.ON_SAVE_REMOVE_TRAILING_WHITESPACE.
Adding new constant SimpleValueNames.NON_PRINTABLE_CHARACTERS_VISIBLE.
Adding new constant SimpleValueNames.TEXT_LINE_WRAP.
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.
Built on June 18 2013. | Portions Copyright 1997-2013 Oracle. All rights reserved.