Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

oracle.javatools.parser.java.v2.util
Class Formatting

java.lang.Object
  extended by oracle.javatools.parser.java.v2.util.Formatting

public class Formatting
extends java.lang.Object

Utility class for use in formatting a SourceFile.


Nested Class Summary
static class Formatting.Selection
           
 
Method Summary
static Formatting.Selection reformatRegion(SourceFile file, int startOffset, int endOffset)
          Attempts to reformat between the (inclusive) input Textbuffer offsets.
static javax.swing.undo.UndoableEdit reformatSelection(SourceFile file, int start, int end)
          This method reformats the selected region of code.
static void reformatSubtree(SourceElement subtree)
          Attempts to reformat the given subtree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

reformatRegion

public static Formatting.Selection reformatRegion(SourceFile file,
                                                  int startOffset,
                                                  int endOffset)
Attempts to reformat between the (inclusive) input Textbuffer offsets. If a write operation is not permitted, an exception is thrown.

Returns:
If this reformat operation was successful, then the offsets defining the dirty region are returned via the Selection class. If the operation was not successful, null is returned.

reformatSubtree

public static void reformatSubtree(SourceElement subtree)
Attempts to reformat the given subtree. If a write operation is not permitted, an exception is thrown.


reformatSelection

public static javax.swing.undo.UndoableEdit reformatSelection(SourceFile file,
                                                              int start,
                                                              int end)
This method reformats the selected region of code.

Parameters:
file - is the source file that contains the selection region
start - is the start offset of the selected region
end - is the end offset of the selected region
Returns:

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

Copyright © 1997, 2011, Oracle. All rights reserved.