blob: 6c50ddb5b2d7d3a54c95284c22d34df762c02736 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_181) on Fri Sep 14 11:35:09 BST 2018 -->
<title>Overview (Editor Settings)</title>
<meta name="date" content="2018-09-14">
<link rel="stylesheet" type="text/css" href="javadoc.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Overview (Editor Settings)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li class="navBarCell1Rev">Overview</li>
<li><a href="org/netbeans/api/editor/settings/package-summary.html">Package</a></li>
<li>Class</li>
<li>Use</li>
<li><a href="org/netbeans/api/editor/settings/package-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-files/index-1.html">Index</a></li>
<li><a href="help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">org.netbeans.modules.editor.settings/1 1.59.1 </div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?overview-summary.html" target="_top">Frames</a></li>
<li><a href="overview-summary.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 class="title">Editor Settings<br/><span style='font-style:normal; font-size:medium; font-weight:normal; background-color:#ffffff;'><a href='http://wiki.netbeans.org/API_Stability#Official' target='_blank'>Official</a></span></h1>
</div>
<div class="header">
<p>See: <a href="#overview.description">Description</a></p>
</div>
<div class="contentContainer">
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Editor Settings table, listing packages, and an explanation">
<caption><span>Editor Settings</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="org/netbeans/api/editor/settings/package-summary.html">org.netbeans.api.editor.settings</a></td>
<td class="colLast">&nbsp;</td>
</tr>
</tbody>
</table>
</div>
<div class="contentContainer"><a name="overview.description">
<!-- -->
</a>
<div class="block"><p>
<p>
The <code>editor/settings</code> module consists of several
EditorSettingsAPIAPI
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" shape="rect">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" shape="rect">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" shape="rect">KeyBindingSettings</a> -
the list of
<code><a href="../org-netbeans-modules-editor-settings/org/netbeans/api/editor/settings/MultiKeyBinding.html" shape="rect">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 xml:space="preserve">
MimePath mimePath = MimePath.parse("text/x-java");
FontColorSettings fcs = (FontColorSettings) MimeLookup.getLookup(mimePath).lookup(FontColorSettings.class);
</pre>
</p>
<h3>What is New (see <a href="apichanges.html">all changes</a>)?</h3>
<ul>
<!--Search for dates that are later or equal to 1997-09-01 in
.-->
<!--Checking date 2012-8-28 with count of newer 0--><!--year ok-->
<li>Aug 28 '12 <a href="apichanges.html#added.SimpleValueNames.ON_SAVE_REFORMAT">Adding ON_SAVE_REFORMAT</a>
<p>
<p>
Adding new constants <code>SimpleValueNames.ON_SAVE_REFORMAT</code>
and <code>SimpleValueNames.ON_SAVE_USE_GLOBAL_SETTINGS</code>.
</p>
</p>
</li>
<!--Checking date 2012-7-5 with count of newer 1--><!--year ok-->
<li>Jul 5 '12 <a href="apichanges.html#added.SimpleValueNames.EDITOR_BRACES">Adding BRACE_SHOW_OUTLINE and BRACE_FIRST_TOOLTIP</a>
<p>
<p>
Adding new constants
<code>SimpleValueNames.BRACE_SHOW_OUTLINE</code> and
<code>SimpleValueNames.BRACE_FIRST_TOOLTIP</code> which control brace outline
behaviour
</p>
</p>
</li>
<!--Checking date 2012-4-12 with count of newer 2--><!--year ok-->
<li>Apr 12 '12 <a href="apichanges.html#added.SimpleValueNames.EDITOR_SEARCH_TYPE">Adding SimpleValueNames.EDITOR_SEARCH_TYPE</a>
<p>
<p>
Adding new constant <code>SimpleValueNames.EDITOR_SEARCH_TYPE</code>.
</p>
</p>
</li>
<!--Checking date 2010-6-9 with count of newer 3--><!--year ok-->
<li>Jun 9 '10 <a href="apichanges.html#added.SimpleValueNames.ON_SAVE_REMOVE_TRAILING_WHITESPACE">Adding SimpleValueNames.ON_SAVE_REMOVE_TRAILING_WHITESPACE</a>
<p>
<p>
Adding new constant <code>SimpleValueNames.ON_SAVE_REMOVE_TRAILING_WHITESPACE</code>.
</p>
</p>
</li>
<!--Checking date 2010-3-4 with count of newer 4--><!--year ok-->
<li>Mar 4 '10 <a href="apichanges.html#added.SimpleValueNames.NON_PRINTABLE_CHARACTERS_VISIBLE">Adding SimpleValueNames.NON_PRINTABLE_CHARACTERS_VISIBLE</a>
<p>
<p>
Adding new constant <code>SimpleValueNames.NON_PRINTABLE_CHARACTERS_VISIBLE</code>.
</p>
</p>
</li>
<!--Checking date 2010-3-4 with count of newer 4--><!--year ok-->
<li>Mar 4 '10 <a href="apichanges.html#added.SimpleValueNames.TEXT_LINE_WRAP">Adding SimpleValueNames.TEXT_LINE_WRAP</a>
<p>
<p>
Adding new constant <code>SimpleValueNames.TEXT_LINE_WRAP</code>.
</p>
</p>
</li>
<!--Checking date 2009-2-16 with count of newer 6--><!--Skipped as the amount of changes is too big-->
<!--Checking date 2008-8-28 with count of newer 7--><!--Skipped as the amount of changes is too big-->
<!--Checking date 2008-6-3 with count of newer 8--><!--Skipped as the amount of changes is too big-->
<!--Checking date 2008-5-27 with count of newer 9--><!--Skipped as the amount of changes is too big-->
<!--Checking date 2008-5-26 with count of newer 10--><!--Skipped as the amount of changes is too big-->
<!--Checking date 2008-5-13 with count of newer 11--><!--Skipped as the amount of changes is too big-->
<!--Checking date 2008-2-28 with count of newer 12--><!--Skipped as the amount of changes is too big-->
<!--Checking date 2008-2-14 with count of newer 13--><!--Skipped as the amount of changes is too big-->
<!--Checking date 2007-9-13 with count of newer 14--><!--Skipped as the amount of changes is too big-->
<!--Checking date 2007-6-15 with count of newer 15--><!--Skipped as the amount of changes is too big-->
<!--Checking date 2007-6-10 with count of newer 16--><!--Skipped as the amount of changes is too big-->
<!--Checking date 2007-1-26 with count of newer 17--><!--Skipped as the amount of changes is too big-->
<!--Checking date 2007-1-4 with count of newer 18--><!--Skipped as the amount of changes is too big-->
<!--Checking date 2006-11-13 with count of newer 19--><!--Skipped as the amount of changes is too big-->
<!--Checking date 2006-11-8 with count of newer 20--><!--Skipped as the amount of changes is too big-->
<!--Checking date 2005-8-26 with count of newer 21--><!--Skipped as the amount of changes is too big-->
</ul>
<h3>Use Cases</h3>
<answer id="arch-usecases">
<h5>Accessing settings</h5>
<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>
<pre xml:space="preserve">
MimePath mimePath = MimePath.parse("text/x-java");
FontColorSettings fcs = (FontColorSettings) MimeLookup.getLookup(mimePath).lookup(FontColorSettings.class);
AttributeSet coloring = fcs.getFontColors(FontColorNames.SELECTION_COLORING);
</pre>
<h5>Listening on changes</h5>
<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>
<pre xml:space="preserve">
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
}
});
</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>
</answer>
<h3>Exported Interfaces</h3>
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. <a href="architecture-summary.html">Read them all</a>...
<a name="group-java">
<h5>Group of java interfaces</h5>
</a>
<table cellpadding="1" cellspacing="0" border="0" class="tablebg" width="100%">
<tr>
<td>
<table border="0" cellpadding="3" cellspacing="1" width="100%">
<tr class="tablersh">
<td align="CENTER" width="25%"><span class="titlectable">Interface Name</span></td><td align="CENTER" width="10%"><span class="titlectable">In/Out</span></td><td align="CENTER" width="10%"><span class="titlectable">Stability</span></td><td align="CENTER"><span class="titlectable">Specified in What Document?</span></td>
</tr>
<tr class="tabler">
<td>EditorSettingsAPI</td><td>Exported</td><td><a href="http://wiki.netbeans.org/API_Stability#Official">Official</a></td><td><a name="java-EditorSettingsAPI">
<p></p>API<p></p>
</a></td>
</tr>
</table>
</td>
</tr>
</table>
<p></p>
<h3>Implementation Details</h3>
<h5>Where are the sources for the module?</h5>
<p>
<p>
The sources for the module are in the
<a href="http://hg.netbeans.org/" shape="rect">NetBeans Mercurial repositories</a>.
</p>
</p>
<h5>What do other modules need to do to declare a dependency on this one, in addition to or instead of a plain module dependency?</h5>
Nothing.
<p>
Read more about the implementation in the <a href="architecture-summary.html">answers to
architecture questions</a>.
</p></div>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li class="navBarCell1Rev">Overview</li>
<li><a href="org/netbeans/api/editor/settings/package-summary.html">Package</a></li>
<li>Class</li>
<li>Use</li>
<li><a href="org/netbeans/api/editor/settings/package-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-files/index-1.html">Index</a></li>
<li><a href="help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">org.netbeans.modules.editor.settings/1 1.59.1 </div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?overview-summary.html" target="_top">Frames</a></li>
<li><a href="overview-summary.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small><span class="footnote">Built on September 14 2018.&nbsp;&nbsp;|&nbsp;&nbsp; Copyright &#169; 2017-2018 Apache Software Foundation. All Rights Reserved.</span></small></p>
</body>
</html>