|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.datatools.sqltools.sqlbuilder.util.WorkbenchUtility
public class WorkbenchUtility
Field Summary | |
---|---|
static java.lang.String |
QUERY_DDL_EXTENSION
|
static java.lang.String |
QUERY_EXTENSION
|
static java.lang.String |
SQL_BUILDER_ID
|
static java.lang.String |
SQL_EDITOR_ID
|
Constructor Summary | |
---|---|
WorkbenchUtility()
|
Method Summary | |
---|---|
static org.eclipse.ui.IEditorPart |
getActiveEditor()
Gets the current editor. |
static int[] |
getSegments(int offset,
java.lang.String text)
Searches a string and returns the segments containing qoutes '"' |
static java.util.List |
getSelectStatementsFromProject(org.eclipse.core.resources.IProject project,
SQLDomainModel domainModel)
Gets a list of QuerySelectStatement objects contained within
the given project. |
static org.eclipse.core.resources.IFile |
getSQLFileResource(java.lang.String projectName,
java.lang.String resourceName)
Gets a SQL file resource with the given name in the given project. |
static org.eclipse.core.runtime.Path |
getSQLResourcePath(java.lang.String projectName,
java.lang.String resourceName)
Gets a Path object for the given project name and SQL resource name. |
static org.eclipse.core.resources.IResource[] |
getSQLStatements(org.eclipse.core.resources.IProject aProj)
Get the SQL statements given a project. |
static void |
openEditor(org.eclipse.ui.IEditorInput editorInput,
java.lang.String editorId)
Opens the given editor input object using the given editor. |
static void |
openEditor(org.eclipse.core.resources.IFile fileResource)
Opens the given file using the SQL Query Builder editor. |
static void |
openEditor(org.eclipse.core.resources.IFile fileResource,
java.lang.String editorID)
Opens the given file using the given editor. |
static java.lang.String |
readFileContentsToString(org.eclipse.core.resources.IFile fileResource,
boolean includeNewlines)
Returns the contents of the given file resource as a string, optionally including or suppressing newlines in the text. |
static boolean |
refreshLocalWorkspaceFile(org.eclipse.core.resources.IFile fileResource,
org.eclipse.core.runtime.IProgressMonitor progressMonitor)
Refreshes the given file so it will be in synch with the local file system. |
static org.eclipse.core.resources.IFile |
saveStatementAsSQLFileResource(QueryStatement statement,
java.lang.String projectName)
Saves the given SQL statement as a file resource in the given project. |
static void |
saveStringAsFileResource(org.eclipse.core.resources.IFile fileResource,
java.lang.String content)
Saves the given string as the content of the given file resource. |
static org.eclipse.core.resources.IFile |
saveTextAsSQLFileResource(java.lang.String content,
java.lang.String resourceName,
java.lang.String projectName)
Saves the given string as the content as a SQL file resource with the given name in the given project. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SQL_BUILDER_ID
public static final java.lang.String SQL_EDITOR_ID
public static final java.lang.String QUERY_EXTENSION
public static final java.lang.String QUERY_DDL_EXTENSION
Constructor Detail |
---|
public WorkbenchUtility()
Method Detail |
---|
public static org.eclipse.ui.IEditorPart getActiveEditor()
public static org.eclipse.core.resources.IFile getSQLFileResource(java.lang.String projectName, java.lang.String resourceName)
projectName
- the name of the project containing the statementresourceName
- the name of the file resource to get
null
if a file resource with
for the given name cannot be openedpublic static org.eclipse.core.runtime.Path getSQLResourcePath(java.lang.String projectName, java.lang.String resourceName)
Path
object for the given project name and SQL resource name. The path
is formed as /projectName/resourceName.sql
projectName
- the name of the project to use to create the pathresourceName
- the resource name to use to create the path
Path
objectpublic static java.util.List getSelectStatementsFromProject(org.eclipse.core.resources.IProject project, SQLDomainModel domainModel)
QuerySelectStatement
objects contained within
the given project.
public static org.eclipse.core.resources.IResource[] getSQLStatements(org.eclipse.core.resources.IProject aProj)
aProj
- the database development project
public static void openEditor(org.eclipse.ui.IEditorInput editorInput, java.lang.String editorId)
editorInput
- the editor input for the editor to openeditorId
- the editor ID (defined in plugin.xml) of the editor to usepublic static void openEditor(org.eclipse.core.resources.IFile fileResource)
fileResource
- the file to openpublic static void openEditor(org.eclipse.core.resources.IFile fileResource, java.lang.String editorID)
fileResource
- the file to openeditorID
- the editor ID (defined in plugin.xml) of the editor to usepublic static java.lang.String readFileContentsToString(org.eclipse.core.resources.IFile fileResource, boolean includeNewlines)
fileResource
- the file resource to readinclueNewlines
- true when newlines should be included in the generated
string, otherwise false
public static boolean refreshLocalWorkspaceFile(org.eclipse.core.resources.IFile fileResource, org.eclipse.core.runtime.IProgressMonitor progressMonitor)
fileResource
- the file to refreshprogressMonitor
- a progress monitor to use during the refresh
true
when the file was refreshed OK, otherwise false
public static org.eclipse.core.resources.IFile saveStatementAsSQLFileResource(QueryStatement statement, java.lang.String projectName)
statement
- the SQL statement to saveprojectName
- the name of the project into which the query is to be saved
null
if it wasn't saved sucessfullypublic static org.eclipse.core.resources.IFile saveTextAsSQLFileResource(java.lang.String content, java.lang.String resourceName, java.lang.String projectName)
content
- the string to saveresourceName
- the name of the SQL resource (the file name)projectName
- the project in which to save the statement
null
if it wasn't saved sucessfullypublic static void saveStringAsFileResource(org.eclipse.core.resources.IFile fileResource, java.lang.String content)
fileResource
- the file resource in which to save the stringcontent
- the string to savepublic static int[] getSegments(int offset, java.lang.String text)
offset
- the line offsettext
- the string text to search
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |