|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openide.ServiceType org.openide.text.IndentEngine
Indentation engine for formating text in documents. Provides mapping between MIME types and engines, so anybody can find appropriate type of engine for type of document.
Nested Class Summary |
Nested classes inherited from class org.openide.ServiceType |
ServiceType.Handle, ServiceType.Registry |
Field Summary |
Fields inherited from class org.openide.ServiceType |
PROP_NAME |
Constructor Summary | |
IndentEngine()
|
Method Summary | |
protected boolean |
acceptMimeType(String mime)
Allow subclasses to decide whether they are suitable for the given mime-type or not. |
abstract Writer |
createWriter(Document doc,
int offset,
Writer writer)
Creates writer that formats text that is inserted into it. |
static IndentEngine |
find(Document doc)
Finds engine associated with given document. |
static IndentEngine |
find(String mime)
Finds engine associated with given mime type. |
static IndentEngine |
getDefault()
Returns a simple indentation engine that does no formatting. |
HelpCtx |
getHelpCtx()
Get context help for this service type. |
static Enumeration |
indentEngines()
Returns enumeration of all registered indentation engines. |
abstract int |
indentLine(Document doc,
int offset)
Indents the current line. |
abstract int |
indentNewLine(Document doc,
int offset)
Inserts new line at given position and indents the new line with spaces. |
static void |
register(String mime,
IndentEngine eng)
Deprecated. IndentEngine now is a ServiceType |
Methods inherited from class org.openide.ServiceType |
addPropertyChangeListener, clone, createClone, displayName, firePropertyChange, getName, removePropertyChangeListener, setName |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public IndentEngine()
Method Detail |
public HelpCtx getHelpCtx()
ServiceType
getHelpCtx
in interface HelpCtx.Provider
getHelpCtx
in class ServiceType
public abstract int indentLine(Document doc, int offset)
doc
- the document to work onoffset
- the offset of a character on the line
public abstract int indentNewLine(Document doc, int offset)
doc
- the document to work onoffset
- the offset of a character on the line
public abstract Writer createWriter(Document doc, int offset, Writer writer)
The provided document and offset are only informational, should not be modified but only used to find correct indentation strategy.
doc
- documentoffset
- position to begin inserts atwriter
- writer to write to
protected boolean acceptMimeType(String mime)
mime
- mime-type string
public static void register(String mime, IndentEngine eng)
public static Enumeration indentEngines()
public static IndentEngine find(String mime)
public static IndentEngine find(Document doc)
public static IndentEngine getDefault()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |