|
What this is
Other links
The source code
/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package org.openide.text;
import java.io.Writer;
import java.util.Collections;
import java.util.Enumeration;
import javax.swing.text.*;
import org.openide.ServiceType;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
/** 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.
*
* @author Jaroslav Tulach
*/
public abstract class IndentEngine extends ServiceType {
static final long serialVersionUID = -8548906260608507035L;
private static final String HELP_ID = "editing.indentation"; // !!! NOI18N
/** hashtable mapping MIME type to engine (String, IndentEngine) */
private static java.util.HashMap map = new java.util.HashMap (7);
public HelpCtx getHelpCtx() {
return new HelpCtx(HELP_ID);
}
/** Indents the current line. Should not effect any other
* lines.
* @param doc the document to work on
* @param offset the offset of a character on the line
* @return new offset of the original character
*/
public abstract int indentLine (Document doc, int offset);
/** Inserts new line at given position and indents the new line with
* spaces.
*
* @param doc the document to work on
* @param offset the offset of a character on the line
* @return new offset to place cursor to
*/
public abstract int indentNewLine (Document doc, int offset);
/** Creates writer that formats text that is inserted into it.
* The writer should not modify the document but use the
* provided writer to write to. Usually the underlaying writer
* will modify the document itself and optionally it can remember
* the current position in document. That is why the newly created
* writer should do no buffering.
*
|
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.