站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

Overview (Editor Settings) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.editor.settings/1 1.9

Editor Settings
Official

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:

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);

What is New (see all changes)?

Use Cases

Accessing settings

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);
Listening on changes

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.

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 NameIn/OutStabilitySpecified in What Document?
EditorSettingsAPIExportedOfficial

API

Implementation Details

Where are the sources for the module?

The sources for the module are in NetBeans CVS in editor/settings directory.

What do other modules need to do to declare a dependency on this one, in addition to or instead of a plain module dependency?
Nothing.

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


org.netbeans.modules.editor.settings/1 1.9

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.