org.eclipse.datatools.sqltools.sqlbuilder.util
Class SQLStatementSupport

java.lang.Object
  extended by org.eclipse.datatools.sqltools.sqlbuilder.util.SQLStatementSupport
All Implemented Interfaces:
java.util.EventListener, org.eclipse.jface.util.IPropertyChangeListener

public class SQLStatementSupport
extends java.lang.Object
implements org.eclipse.jface.util.IPropertyChangeListener

This class provides helpful methods for working with one or more SQL statements contained within a SQL script document.


Field Summary
static java.lang.String CURRENT_STATEMENT_TERMINATOR
          A property name the the statement terminator property for use in property change notification.
static java.lang.String DEFAULT_STATEMENT_TERMINATOR
          The default statement terminator string.
 
Constructor Summary
SQLStatementSupport()
          Constructs an instance of this class.
SQLStatementSupport(org.eclipse.jface.text.IDocument doc)
          Constructs an instance of this class with the given document.
 
Method Summary
 java.lang.String getDefaultStatementTerminator()
          Gets the default statement terminator string for the current document.
 java.util.List getSQLStatementList()
          Gets the SQL statements contained in the given document, as a list of strings.
 java.lang.String getStatementTerminator()
          Gets the current statement terminator string for the current document.
 void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event)
          Handles notifications to the object that a property has changed.
 void setDocument(org.eclipse.jface.text.IDocument doc)
          Sets the document associated with this object to the given SQL script document.
 void setStatementTerminator(java.lang.String newStatementTerminator)
          Sets the current statement terminator string for this editor to the given string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURRENT_STATEMENT_TERMINATOR

public static final java.lang.String CURRENT_STATEMENT_TERMINATOR
A property name the the statement terminator property for use in property change notification.

See Also:
Constant Field Values

DEFAULT_STATEMENT_TERMINATOR

public static final java.lang.String DEFAULT_STATEMENT_TERMINATOR
The default statement terminator string.

See Also:
Constant Field Values
Constructor Detail

SQLStatementSupport

public SQLStatementSupport()
Constructs an instance of this class. This is the default constructor.


SQLStatementSupport

public SQLStatementSupport(org.eclipse.jface.text.IDocument doc)
Constructs an instance of this class with the given document.

Parameters:
doc - a IDocument for which statement support is needed
Method Detail

getDefaultStatementTerminator

public java.lang.String getDefaultStatementTerminator()
Gets the default statement terminator string for the current document.

Returns:
the default statement terminator

getSQLStatementList

public java.util.List getSQLStatementList()
Gets the SQL statements contained in the given document, as a list of strings.

Returns:
the list of SQL statements

getStatementTerminator

public java.lang.String getStatementTerminator()
Gets the current statement terminator string for the current document.

Returns:
the current statement terminator

propertyChange

public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event)
Handles notifications to the object that a property has changed.

Specified by:
propertyChange in interface org.eclipse.jface.util.IPropertyChangeListener
Parameters:
event - the property change event object describing which property changed and how

setDocument

public void setDocument(org.eclipse.jface.text.IDocument doc)
Sets the document associated with this object to the given SQL script document.

Parameters:
doc - the IDocument for which support is needed

setStatementTerminator

public void setStatementTerminator(java.lang.String newStatementTerminator)
Sets the current statement terminator string for this editor to the given string. If the given statement terminator is different from the default, an XML-like tag containing the statement terminator will be added to the beginning of the document. If there already is such a tag, it will be updated with the new statement terminator value.

Parameters:
newStatementTerminator - the statement terminator to use for this editor