Apache NetBeans Wiki Index

Note: These pages are being reviewed.

What are .settings files?

.settings files are similar to [[DevFaqInstanceDataObject| .instance files]], with the difference that they are XML format, and can contain serialized data rather than just default instances.

Since the introduction of [http://bits.netbeans.org/dev/javadoc/org-openide-util/org/openide/util/NbPreferences.html NbPreferences] to replace [http://bits.netbeans.org/dev/javadoc/org-openide-options/org/openide/options/SystemOption.html SystemOption], very little new code uses these files, and they should be considered semi-deprecated. They are difficult and error-prone to use, and have a fair amount of overhead. The Window System still requires them to be used to persist the state of opened windows/tabs (caret position, what file is opened, or other state that should be restored when reopening a [http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.html TopComponent] after a restart) across application runs.

A .settings file can encode the entire parent class and interface hierarchy of the object it represents, so that a query about whether an object of a given type is present (such as using Lookups.forPath("path/to/folder").allItems()) can be answered without actually creating an instance of the object.

Settings files are also useful if you are declaring some objects in a layer file (see DevFaqModulesLayerFile) and intend to write them back out to disk after they have been modified in-memory (note this involves writing ugly and inefficient hexadecimal-encoded serialized data into XML files - if the object is a singleton, using NbPreferences will be both more efficient and more readable).


<?xml version="1.0"?>
<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN"
<settings version="1.0">
    <module name="org.netbeans.core.io.ui/1" spec="1.6"/>
    <instanceof class="org.openide.windows.TopComponent"/>
    <instanceof class="org.netbeans.core.io.ui.IOWindow$IOWindowImpl"/>
    <serialdata class="org.netbeans.core.io.ui.IOWindow$IOWindowImpl">

Apache Migration Information

The content in this page was kindly donated by Oracle Corp. to the Apache Software Foundation.

This page was exported from http://wiki.netbeans.org/DevFaqDotSettingsFiles , that was last modified by NetBeans user Jglick on 2010-06-14T21:40:32Z.

NOTE: This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.