Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.netbeans.modules.editor.settings/1 1.4.22
PREV NEXT | FRAMES NO FRAMES

# NetBeans Editor Settings

See:
Description

Editor Settings
org.netbeans.api.editor.settings |

It is a module located under /cvs/editor/settings directory.

It consists of

- API in org.netbeans.api.editor.settings

Editor Settings module defines EditorSettingsAPI.

API contains abstract classes, responsible for particular editor settings:

- FontColorSettings - Fonts and Colors settings are represented by map of key=<String>fonts and colors syntax name and value=AttributeSet.
- CodeTemplateSettings - Code templates settings are represented by map of key=<String>code template name and value=<String>code template string.
- KeyBindingSettings - Key bindings settings are represented by List of MultiKeyBindings.
- MacroSettings - Macros settings are represented by map of key=<String>macro-name and value=<String>macro-commands.
- SimpleValueSettings - SimpleValues settings represents simple properties like Integer, String, Boolean, etc.

The particular mime-type settings can be found for example using the following mimelookup search:
`FontColorSettings fcs = (FontColorSettings) MimeLookup.getMimeLookup("text/x-java").lookup(FontColorSettings.class);`

The Javadoc documentation can be generated by using

        cd /cvs/editor/settings
        ant javadoc

### What is New (see all changes)?

- Aug 26 '05 Editor Settings API created

  Editor Settings API was created. It defines settings classes, which can be looked up via mimelookup.

### Use Cases

##### Per mime-type operation

The particular mime-type settings can be found for example using the following mimelookup search:

    FontColorSettings fcs  = (FontColorSettings) MimeLookup.getMimeLookup("text/x-java").lookup(FontColorSettings.class);
    AttributeSet fontColors = fcs.getFontColors(FontColorNames.SELECTION_COLORING);

This will resolve Fonts ant Colors settings of the coloring used for selection for the mime-type "text/x-java" in AttributeSet representation.

##### Listening on settings change

Settings clients often need to be able to listen on the settings change and handle this event. This can be done using mimelookup via `Lookup.Template` by registering LookupListener on the returned Lookup.Result.

    LookupResult fontsColors  = MimeLookup.getMimeLookup("text/x-java").lookup(
        new Lookup.Template(FontColorSettings.class));
    if (fontsColors !=null) {
        fontsColors.addLookupListener(new LookupListener(){
            public void resultChanged(LookupEvent ev) {
                Lookup.Result result = ((Lookup.Result)ev.getSource());
                //... settings client response on settings change
            }
        });
    }

FontColorSettings implementor is responsible of creation of new instance of FontColorSettings if some setting will change in the lookup, it provides.

### Exported Interfaces

This table lists all of the module exported APIs with defined stability classifications. It is generated based on answers to questions about the architecture of the module. Read them all...

##### Group of java interfaces

Interface Name | In/Out | Stability | Specified in What Document?
EditorSettingsAPI | Exported | Official |

### Implementation Details

##### What do other modules need to do to declare a dependency on this one?

    OpenIDE-Module-Module-Dependencies: org.netbeans.modules.editor.settings/1 > 1.4.22

Read more about the implementation in the answers to architecture questions.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.netbeans.modules.editor.settings/1 1.4.22
PREV NEXT | FRAMES NO FRAMES

Built on December 7 2006. | Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.