<!-- <questionid="arch-what"when="init"> Whatisthisprojectgoodfor? <hint> Pleaseprovidehereafewlinesdescribingtheproject, whatproblemitshouldsolve,providelinkstodocumentation, specifications,etc. </hint> </question>
-->
<answer id="arch-what">
<p>
The legacy settings system in the editor module is complicated, error prone
and hard to use. It'd been created spontaneously over the years to support
immediate needs at that time without paying enough attention to extensibility
and interoperability. Historically any module providing editor settings needed
to depend on the whole editor module.
</p>
<p>
The main purpose of this project is to define API for editor settings, that
is lightweight and easily extensible. The API relies on <code>MimeLookup</code>
to provide a way of registering and looking up settings.
The aim is NOT to provide an implementation of a storage for editor settings,
but to define an interface between this storage and clients
like <mime-type> editors, externaleditor, etc.
</p>
</answer>
<p>
The <code>editor/settings</code> module consists of several
<api name="EditorSettingsAPI" group="java"type="export" category="official">API</api>
classes for accessing editor related settings. The classes are stored in the
<code>org.netbeans.api.editor.settings</code> package. Each class is responsible
for a different group of settings:
</p>
<ul>
<li>
<a href="@org-netbeans-modules-editor-settings@/org/netbeans/api/editor/settings/FontColorSettings.html">FontColorSettings</a> -
the map of names (i.e. <code>String</code>s) of colorings and their parameters
(i.e. <code>AttributeSet</code>s).
</li>
<li>
<a href="@org-netbeans-modules-editor-settings@/org/netbeans/api/editor/settings/CodeTemplateSettings.html">CodeTemplateSettings</a> -
the map of template names (i.e. <code>String</code>s) and their bodies
(i.e. <code>String</code>s).
</li>
<li>
<a href="@org-netbeans-modules-editor-settings@/org/netbeans/api/editor/settings/KeyBindingSettings.html">KeyBindingSettings</a> -
the list of
<code><a href="@org-netbeans-modules-editor-settings@/org/netbeans/api/editor/settings/MultiKeyBinding.html">MultiKeyBinding</a></code>s.
Each <code>MultiKeyBinding</code> is a list of keyboard shortcuts associated
to an <code>Action</code>.
</li>
</ul>
<p>
Editor settings for a particular mime type can be obtained through <code>MimeLookup</code>
</p>
<pre>
MimePath mimePath = MimePath.parse("text/x-java");
FontColorSettings fcs = (FontColorSettings) MimeLookup.getLookup(mimePath).lookup(FontColorSettings.class);
</pre>
</answer>
<!-- <questionid="arch-quality"when="init"> Howwillthe<ahref="http://www.netbeans.org/community/guidelines/q-evangelism.html">quality</a> ofyourcodebetestedand howarefutureregressionsgoingtobeprevented? <hint> Whatkindoftestingdo youwanttouse?Howmuchfunctionality,inwhichareas, shouldbecoveredbythetests? </hint> </question>
-->
<answer id="arch-quality">
There are unit tests available covering the module's functionality.
</answer>
<!-- <questionid="arch-time"when="init"> Whatarethetimeestimatesofthework? <hint> Pleaseexpressyourestimatesofhowlongthedesign,implementation, stabilizationarelikelytolast.Howmanypeoplewillbeneededto implementthisandwhatistheexpectedmilestonebywhichtheworkshouldbe ready? </hint> </question>
-->
<answer id="arch-time">
The modules is available in CVS trunk.
</answer>
<usecase id="accessing-settings" name="Accessing settings">
<p>
All editor settings are mime type specific and therefore should be retrieved
using <code>MimeLookup</code>. The following example shows how to retrieve
the <code>FontColorSettings</code> for java files and how to get <code>AttributeSet</code>
with coloring attributes for a particular coloring (i.e. in this case the
colors used for highlighting selected text)
</p>
<usecase id="listening-on-changes" name="Listening on changes">
<p>
If clients need to react on changes in editor settings they can attach <code>LookupListener</code>
to the <code>LookupResult</code> they got for their particular settings class
from <code>MimeLookup</code>. The following example shows how to do it.
</p>
result.addLookupListener(new LookupListener() { public void resultChanged(LookupEvent ev) {
//... the client's response to the settings change
}
});
</pre>
<p>
The <code>FontColorSettings</code> class implementor is responsible and will create
a new instance of <code>FontColorSettings</code> whenever some coloring will change.
This new instance will be placed in <code>MimeLookup</code> replacing the old one.
</p>
</usecase>
<!-- <questionid="deploy-packages"when="init"> Arepackagesofyourmodulemadeinaccessiblebynotdeclaringthem public? <hint> NetBeansmodulesystemallowsrestrictionofaccessrightsto publicclassesofyourmodulefromothermodules.Thisprevents unwanteddependenciesofothersonyourcodeandshouldbeused wheneverpossible(<ahref="http://www.netbeans.org/download/javadoc/OpenAPIs/org/openide/doc-files/upgrade.html#3.4-public-packages"> publicpackages </a>).Ifyoudonotrestrictaccesstoyourclassesyouare makingittooeasyforotherpeopletomisuseyourimplementation details,thatiswhyyoushouldhavegoodreasonfornot restrictingpackageaccess. </hint> </question>
-->
<answer id="deploy-packages">
Yes, only the API is public. There is no implementation in the editor/settings module.
</answer>
<!-- <questionid="format-types"when="impl"> Whichprotocolsandfileformats(ifany)doesyourmodulereadorwriteondisk, ortransmitorreceiveoverthenetwork? </question>
-->
<answer id="format-types">
No files read or written to the disk.
</answer>
<!-- <questionid="lookup-lookup"when="init"> Doesyourmoduleuse<code>org.openide.util.Lookup</code> oranysimilartechnologytofindanycomponentstocommunicatewith?Whichones? <hint> Pleasedescribetheinterfacesyouaresearchingfor,where aredefined,whetheryouaresearchingforjustoneormoreofthem, iftheorderisimportant,etc.Alsoclassifythestabilityofsuch APIcontract. </hint> </question>
-->
<answer id="lookup-lookup">
No. It only defines the classes that can be looked up via MimeLookup.
</answer>
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.25Bemerkung:
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.