org.eclipse.datatools.sqltools.sqleditor
Class SQLEditorFileEditorInput

java.lang.Object
  extended byFileEditorInput
      extended byorg.eclipse.datatools.sqltools.sqleditor.SQLEditorFileEditorInput
All Implemented Interfaces:
ISQLEditorInput

public class SQLEditorFileEditorInput
extends FileEditorInput
implements ISQLEditorInput

This class implements the ISQLEditorInput interface using a FileEditorInput as the base. It is provided as a convenience for callers of the SQL Editor who want to open the SQL Editor on a file.

See Also:
Serialized Form

Constructor Summary
SQLEditorFileEditorInput(IFile aFile)
          Creates an instance of this class with the given file as the input.
 
Method Summary
static IFile createTempFileResource(java.lang.String initialFileContent)
          Creates and returns a file resource in a temporary location (determined by the operating system) with the given file content.
static IFile createTempFileResource(java.lang.String initialFileContent, java.lang.String fileNamePrefix, java.lang.String fileExtension)
          Creates and returns a file resource in a temporary location (determined by the operating system) with the given file content, file name prefix and file extension.
 ISQLEditorConnectionInfo getConnectionInfo()
          Gets the ISQLEditorConnectionInfo associated with this input.
 java.lang.String getFactoryId()
          Returns the id of the element factory which should be used to re-create this object.
 void saveState(IMemento memento)
          Saves the state of the object in the given memento.
 void setConnectionInfo(ISQLEditorConnectionInfo connInfo)
          Sets the ISQLEditorConnectionInfo associated with this input to the given object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLEditorFileEditorInput

public SQLEditorFileEditorInput(IFile aFile)
Creates an instance of this class with the given file as the input.

Parameters:
aFile - the file to associate with this input
Method Detail

createTempFileResource

public static IFile createTempFileResource(java.lang.String initialFileContent)
Creates and returns a file resource in a temporary location (determined by the operating system) with the given file content. This can be used as the file resource input for constructing an instance of this class. The name of the returned file resource will be "SQLStatement" + nnnnn + ".sql", where nnnnnn is a number chosen by the OS to ensure the file name is unique.

Parameters:
initialFileContent - the initial content of the file
Returns:
the new file temporary file, or null if the file was not created successfully

createTempFileResource

public static IFile createTempFileResource(java.lang.String initialFileContent,
                                           java.lang.String fileNamePrefix,
                                           java.lang.String fileExtension)
Creates and returns a file resource in a temporary location (determined by the operating system) with the given file content, file name prefix and file extension. This can be used as the file resource input for constructing an instance of this class. The file name of the new file will be + nnnnn + . For example, if the file name prefix is "SQLStatement" and the extension is ".sql", the returned file name would look something like "SQLStatement45934.sql".

Parameters:
initialFileContent - the initial content of the file
fileNamePrefix - the name (prefix) of the new file
fileExtension - the extension of the file. It should begin with "."
Returns:
the new file temporary file, or null if the file was not created successfully

getConnectionInfo

public ISQLEditorConnectionInfo getConnectionInfo()
Gets the ISQLEditorConnectionInfo associated with this input.

Specified by:
getConnectionInfo in interface ISQLEditorInput
Returns:
the current ISQLEditorConnectionInfo object

getFactoryId

public java.lang.String getFactoryId()
Returns the id of the element factory which should be used to re-create this object.

See Also:
org.eclipse.ui.IPersistableElement#getFactoryId()

saveState

public void saveState(IMemento memento)
Saves the state of the object in the given memento.

Parameters:
memento - the storage area for object's state
See Also:
org.eclipse.ui.IPersistableElement#saveState(org.eclipse.ui.IMemento)

setConnectionInfo

public void setConnectionInfo(ISQLEditorConnectionInfo connInfo)
Sets the ISQLEditorConnectionInfo associated with this input to the given object.

Specified by:
setConnectionInfo in interface ISQLEditorInput
Parameters:
connInfo - the ISQLEditorConnectionInfo object to set


Copyright © 2006 Actuate, IBM Corporation, Sybase, Inc. and others. All rights reserved.