KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > core > ICodeFormatter


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.core;
12
13 /**
14  * Specification for a generic source code formatter. Client plug-ins can contribute
15  * an implementation for an ICodeFormatter, through the extension point "org.eclipse.jdt.core.codeFormatter".
16  * In case none is found, a default formatter can be provided through the ToolFactory.
17  *
18  * @see ToolFactory#createCodeFormatter()
19  * @see ToolFactory#createDefaultCodeFormatter(java.util.Map options)
20  * @since 2.0
21  * @deprecated Use {@link org.eclipse.jdt.core.formatter.CodeFormatter} instead (note: options have changed)
22  */

23 public interface ICodeFormatter {
24
25     /**
26      * Formats the String <code>sourceString</code>,
27      * and returns a string containing the formatted version.
28      *
29      * @param string the string to format
30      * @param indentationLevel the initial indentation level, used
31      * to shift left/right the entire source fragment. An initial indentation
32      * level of zero has no effect.
33      * @param positions an array of positions to map. These are
34      * character-based source positions inside the original source,
35      * arranged in non-decreasing order, for which corresponding positions in
36      * the formatted source will be computed (so as to relocate elements associated
37      * with the original source). It updates the positions array with updated
38      * positions. If set to <code>null</code>, then no positions are mapped.
39      * @param lineSeparator the line separator to use in formatted source,
40      * if set to <code>null</code>, then the platform default one will be used.
41      * @return the formatted output string.
42      */

43     String JavaDoc format(String JavaDoc string, int indentationLevel, int[] positions, String JavaDoc lineSeparator);
44 }
45
Popular Tags