Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.edit.sql
Class SQLFormatter

java.lang.Object
  extended by com.ibm.etools.iseries.edit.sql.SQLFormatter

public class SQLFormatter
extends Object


Field Summary
static String Copyright
           
 
Constructor Summary
SQLFormatter()
          The default contructor for this class
 
Method Summary
 void formatSQLStatement(int startElement, int endElement, LpexView view)
          Formats SQL statements in the range specified
 void formatSQLStatement(int element, LpexView view)
          Formats an SQL statement in an LPEX view
 String formatSQLStatement(String statementString, boolean insertSignature)
          Give a statement string, generates a formatted version based on properties set in the formatter.
 int getFirstFormattedElement()
          Retrieves the first element that was formatted.
 int getIndent(LpexView view, int iElement)
          Retrieves the indent for the view for the specified start element
 int getLastFormattedElement()
          Retrieves the last element that was formatted.
 void resetStopElement()
          Used to reset the formatter stop element.
 void setFormatting(SQLFormattingSettings formatting)
          Sets the formatting settings to use for the formatter
 void setInitialIndent(int value)
          Sets the intial indent for the SQL statement
 void setScanForExecSQL(boolean value)
          Used to set whether on not the formatter needs to scan for exec sql.
 void setSignature(ISQLSignature signature)
          Sets the signature settings for the SQL formatter
 void setStopElement(int iElement)
          Used to force the formatter to stop at a specified element.
 void setUppercasing(SQLUpperCaseSettings uppercasing)
          Sets the uppercasing settings to use for the formatter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values
Constructor Detail

SQLFormatter

public SQLFormatter()
The default contructor for this class

Method Detail

formatSQLStatement

public void formatSQLStatement(int startElement,
                               int endElement,
                               LpexView view)
Formats SQL statements in the range specified

Parameters:
startElement - the start element to start formatting
endElement - the end element to start formatting.
view - the view to format the elements in

formatSQLStatement

public void formatSQLStatement(int element,
                               LpexView view)
Formats an SQL statement in an LPEX view

Parameters:
element - The element number to format
view - the view to format the statement for.

formatSQLStatement

public String formatSQLStatement(String statementString,
                                 boolean insertSignature)
Give a statement string, generates a formatted version based on properties set in the formatter.

Parameters:
statementString - the string to format
insertSignature - whether or not to insert a signature, depending on the signature settings ** NOT CURRRENTLY AVAILABLE
Returns:
the formatted string
See Also:
setFormatting(SQLFormattingSettings), setUppercasing(SQLUpperCaseSettings), setSignature(ISQLSignature)

getFirstFormattedElement

public int getFirstFormattedElement()
Retrieves the first element that was formatted. Used to determine which lines need reparsing

Returns:
the first element formatted by the formatter, 0 if no lines were formatted in the view

getIndent

public int getIndent(LpexView view,
                     int iElement)
Retrieves the indent for the view for the specified start element

Parameters:
view - the view to retrieve the start indent for
iElement - the element the get the indent for
Returns:
the number of characters to indent the specified element

getLastFormattedElement

public int getLastFormattedElement()
Retrieves the last element that was formatted. Used to determine which lines need reparsing

Returns:
the last element formatted by the formatter, 0 if no lines were formatted in the view

resetStopElement

public void resetStopElement()
Used to reset the formatter stop element. After calling this method, the formatter will automatically determine the stop element.


setFormatting

public void setFormatting(SQLFormattingSettings formatting)
Sets the formatting settings to use for the formatter

Parameters:
formatting - The settings that the formatter should use to format the text

setInitialIndent

public void setInitialIndent(int value)
Sets the intial indent for the SQL statement

Parameters:
value - the initial indent to use

setScanForExecSQL

public void setScanForExecSQL(boolean value)
Used to set whether on not the formatter needs to scan for exec sql. Set to true when the starting element specified in formatStatement is not an SQL statement

Parameters:
value - true if the formatter should scan for EXEC SQL, false otherwise

setSignature

public void setSignature(ISQLSignature signature)
Sets the signature settings for the SQL formatter

Parameters:
signature - the signature to use when formatting statements

setStopElement

public void setStopElement(int iElement)
Used to force the formatter to stop at a specified element. Specify -1 to have the formatter automatically determine the end of the statement or use resetStopElement

Parameters:
iElement - the element that the formatter should stop formatting
See Also:
resetStopElement()

setUppercasing

public void setUppercasing(SQLUpperCaseSettings uppercasing)
Sets the uppercasing settings to use for the formatter

Parameters:
uppercasing - uppercase settings for the formatter

Rational Developer for Power Systems Software
V7.6

Copyright © 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.