Rational Developer for Power Systems Software
V7.6

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

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

public class SQLFormattingSettings
extends Object

This class is used to handle the settings for formatting

Since:
7.0

Field Summary
static int AFTER
          Break line after
static int BEFORE
          Break line before
static int BOTTOM
          Move to bottom
static String Copyright
           
static int EOL
          Break line only when EOL is reached
static int IGNORE
          Ignore
static int TOP
          Move to top
 
Constructor Summary
SQLFormattingSettings()
          Empty constructor for this class.
SQLFormattingSettings(int onComma, int onAndOr, boolean onCase, int commentLocation, int ccsid)
          Use to create formatting setting with the appropriate options
 
Method Summary
 int getCCSID()
          Retrieve the CCSID for the formatting.
 int getCommentLocation()
          Retrieves the comment location setting
static SQLFormattingSettings getFormattingSettings(String preferenceKey, int ccsid)
          Retrieves the formatting settings from the preference store
 int getIndent()
          Retrieves the indent value to be used by the formatted
 int getLineLength()
          Retrieves the maximum line length to use for the formatter
 int getMaxIndent()
          Retrieves the maximum indent allowed when formatting.
 int getOnAndOr()
          Retrieves the AND/OR linebreak setting
 boolean getOnCase()
          Retrieves the on Case linbreak setting
 int getOnComma()
          Retrieves the on comma linebreak setting
 LpexColumnRange getRange()
          Retrieves the range of columns allowed to be used by the formatter
 boolean isIgnoreAllExceptForRange()
          Tells the formatter whether or not formatting options from the registry have been set.
 void setIndent(int value)
          Sets the indent value to be used by the formatter
 void setIndent(String preferenceKey)
          Sets the indent value to be used by the formatter
 void setLineLength(int value)
          Sets the line length to use for the formatter.
 void setMaxIndent(int maxIndent)
          Sets the maximum number of blanks to allow for indenting.
 void setRange(LpexColumnRange range)
          Sets the colum range to be used by the formatter when replacing text.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

AFTER

public static final int AFTER
Break line after

See Also:
Constant Field Values

BEFORE

public static final int BEFORE
Break line before

See Also:
Constant Field Values

EOL

public static final int EOL
Break line only when EOL is reached

See Also:
Constant Field Values

TOP

public static final int TOP
Move to top

See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
Move to bottom

See Also:
Constant Field Values

IGNORE

public static final int IGNORE
Ignore

See Also:
Constant Field Values
Constructor Detail

SQLFormattingSettings

public SQLFormattingSettings()
Empty constructor for this class. Use when the formatter should not format text, but might still need to uppercase


SQLFormattingSettings

public SQLFormattingSettings(int onComma,
                             int onAndOr,
                             boolean onCase,
                             int commentLocation,
                             int ccsid)
Use to create formatting setting with the appropriate options

Parameters:
onComma - how comma linebreaks should be handled
onAndOr - how and/or linebreaks should be handled
onCase - how case linebreaks should be handled
commentLocation - how comment location should be handled
ccsid - the ccsid to use for formatting, needed for proper NL support
See Also:
com.ibm.etools.iseries.editor.sql.SQLFormattingSettings#TOP, com.ibm.etools.iseries.editor.sql.SQLFormattingSettings#BOTTOM, com.ibm.etools.iseries.editor.sql.SQLFormattingSettings#IGNORE, com.ibm.etools.iseries.editor.sql.SQLFormattingSettings#AFTER, com.ibm.etools.iseries.editor.sql.SQLFormattingSettings#BEFORE
Method Detail

getFormattingSettings

public static SQLFormattingSettings getFormattingSettings(String preferenceKey,
                                                          int ccsid)
Retrieves the formatting settings from the preference store

Parameters:
preferenceKey - The main key for the formatting preferences
ccsid - The ccsid to use for the formatter. Needed for proper NL support
Returns:
SQLFormattingSettings with all necessary options set

getCommentLocation

public int getCommentLocation()
Retrieves the comment location setting

Returns:
the setting for the formatter to use when comments are encountered
See Also:
com.ibm.etools.iseries.editor.sql.SQLFormattingSettings#AFTER, com.ibm.etools.iseries.editor.sql.SQLFormattingSettings#BEFORE, com.ibm.etools.iseries.editor.sql.SQLFormattingSettings#TOP, com.ibm.etools.iseries.editor.sql.SQLFormattingSettings#BOTTOM, com.ibm.etools.iseries.editor.sql.SQLFormattingSettings#IGNORE

getIndent

public int getIndent()
Retrieves the indent value to be used by the formatted

Returns:
The indent value for the formatter, 0 if no indent is desired

getMaxIndent

public int getMaxIndent()
Retrieves the maximum indent allowed when formatting. Default value is 50 blanks

Returns:
The maximum number of blanks allowed for indenting

getOnAndOr

public int getOnAndOr()
Retrieves the AND/OR linebreak setting

Returns:
the setting for the formatter to user when a comma is encountered
See Also:
com.ibm.etools.iseries.editor.sql.SQLFormattingSettings#AFTER, com.ibm.etools.iseries.editor.sql.SQLFormattingSettings#BEFORE, com.ibm.etools.iseries.editor.sql.SQLFormattingSettings#EOL

getOnCase

public boolean getOnCase()
Retrieves the on Case linbreak setting

Returns:
true if line break is needed when CASE is encountered, false otherwise

getOnComma

public int getOnComma()
Retrieves the on comma linebreak setting

Returns:
the setting for the formatter to user when a comma is encountered
See Also:
com.ibm.etools.iseries.editor.sql.SQLFormattingSettings#AFTER, com.ibm.etools.iseries.editor.sql.SQLFormattingSettings#BEFORE, com.ibm.etools.iseries.editor.sql.SQLFormattingSettings#EOL

getRange

public LpexColumnRange getRange()
Retrieves the range of columns allowed to be used by the formatter

Returns:
The range allowed by the formatter.

isIgnoreAllExceptForRange

public boolean isIgnoreAllExceptForRange()
Tells the formatter whether or not formatting options from the registry have been set. If this returns false, then the formatter does not format text, but may uppercase if needed

Returns:
true if the formatter should format the text, false otherwise

setIndent

public void setIndent(int value)
Sets the indent value to be used by the formatter

Parameters:
value - The value to indent, use 0 if you don't want indenting

setIndent

public void setIndent(String preferenceKey)
Sets the indent value to be used by the formatter

Parameters:
preferenceKey - The key in the preference store that contains the indent information

setMaxIndent

public void setMaxIndent(int maxIndent)
Sets the maximum number of blanks to allow for indenting. Use to override the default value of 50 blanks

Parameters:
maxIndent - The maximum number of characters allowed for indent.

setRange

public void setRange(LpexColumnRange range)
Sets the colum range to be used by the formatter when replacing text. Use this if the formatter is not allowed to use all the columns available in the LpexView

Parameters:
range - The range for the formatter to use

setLineLength

public void setLineLength(int value)
Sets the line length to use for the formatter. If not set, defaults to MAX_LINE_LENGTH

Parameters:
value - the desired line length.
See Also:
SQLFormattingSettings#m

getLineLength

public int getLineLength()
Retrieves the maximum line length to use for the formatter

Returns:
The maximum line length

getCCSID

public int getCCSID()
Retrieve the CCSID for the formatting. This helps determine line length in NL situations

Returns:
The CCSID to use for formatting.

toString

public String toString()
Overrides:
toString in class Object

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.