|
org.netbeans.modules.editor.indent/2 1.28 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.netbeans.modules.editor.indent.spi.CodeStylePreferences
public final class CodeStylePreferences
Provides access to formatting settings for a document or file. The formatting
settings can either be stored globally in the IDE or they can be stored in a
project owning the document. The settings are provided in form of a
java.util.prefs.Prefernces instance.
Typical usecase: This class is typically called from an implementation
of IndentTask or ReformatTask, which needs to know formatting
setting in order to do its job. The implementation is given a context object
with a javax.swing.text.Document instance where the formatting is
taking place. The implementation should call get(javax.swing.text.Document)
and getPreferences() in order to get Preferences with
formatting settings.
The infrastructure will take care of providing the right Preferences
instance from either MimeLookup or a project depending on the formatted
document and user's choice. It is important not to cache the Preferences
instance, because a different instance may be provided in the future if a user
changes his mind in using global or per-project formatting settings.
| Nested Class Summary | |
|---|---|
static interface |
CodeStylePreferences.Provider
Code style preferences provider. |
| Method Summary | |
|---|---|
static CodeStylePreferences |
get(Document doc)
Gets CodeStylePreferences for a document. |
static CodeStylePreferences |
get(Document doc,
String mimeType)
Gets CodeStylePreferences for a document and an embedding mimeType. |
static CodeStylePreferences |
get(FileObject file)
Gets CodeStylePreferences for a file. |
static CodeStylePreferences |
get(FileObject file,
String mimeType)
Gets CodeStylePreferences for a file. |
Preferences |
getPreferences()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static CodeStylePreferences get(Document doc)
CodeStylePreferences for a document. This is the prefered
method to use. Whenever you have both Document and its
FileObject always use this method and provide the Document
instance.
doc - The document to get CodeStylePreferences for,
can be null. If null, the method will return
global preferences for 'all languages'.
CodeStylePreferences, never null.
public static CodeStylePreferences get(Document doc,
String mimeType)
CodeStylePreferences for a document and an embedding mimeType.
This is the prefered method to use. Whenever you have both Document and its
FileObject always use this method and provide the Document
instance.
doc - The document to get CodeStylePreferences for,
can be null. If null, the method will return
global preferences for 'all languages'.
CodeStylePreferences, never null.public static CodeStylePreferences get(FileObject file)
CodeStylePreferences for a file. If you also have a
Document instance you should use the get(javax.swing.text.Document)
method.
file - The file to get CodeStylePreferences for,
can be null. If null, the method will return
global preferences for 'all languages'.
CodeStylePreferences, never null.
public static CodeStylePreferences get(FileObject file,
String mimeType)
CodeStylePreferences for a file. If you also have a
Document instance you should use the get(javax.swing.text.Document)
method.
file - The file to get CodeStylePreferences for,
can be null. If null, the method will return
global preferences for 'all languages'.
CodeStylePreferences, never null.public Preferences getPreferences()
|
org.netbeans.modules.editor.indent/2 1.28 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||