org.formaria.editor.project.pages
Interface IEditorUtility

All Known Implementing Classes:
EditorUtility, EditorUtility

public interface IEditorUtility

An abstraction of some of the methods used to interact with the editors and panels used in the IDE


Field Summary
static int FRAME_HEIGHT
           
static int FRAME_WIDTH
           
 
Method Summary
 boolean activateEditor(PageResource pageRes, boolean activate)
          Activate the source code editor for this page
 void addJar(EditorProject currentProject, java.net.URL jarUrl)
          Add a jar reference to the project class path.
 boolean canImportDbTable(java.awt.datatransfer.DataFlavor transferFlavor)
          Indicates whether database table can be imported from the given data flavor.
 void copy(java.io.InputStream is, java.io.OutputStream os)
           
 void copyToClipboard(java.lang.String text)
          Copy text to the clipboard
 Page getCachedPage(EditorProject currentProject, PageResource pageRes)
          If the page xml has been cached we want to use that xml to generate the page otherwise we just return the page contained in the pageRes object
 java.sql.Connection getDbConnection(java.lang.Object obj)
          Get database connection
 java.lang.String getDbConnectionName(java.lang.Object obj)
          Get database connection name
 java.lang.String getDbDriver(java.lang.Object obj)
          Get database connection driver
 java.lang.String getDbDriverFile(java.lang.Object obj)
          Get the path to the file (zip, jar) containing the jdbc driver used to connect the the database.
 java.lang.String getDbPassword(java.lang.Object obj)
          Get database connection password It cannot be obtained from the Connection object
 java.lang.String getDbTableName(java.lang.Object obj)
          Get database table name
 java.lang.ClassLoader getEditorClassLoader(EditorProject project)
          Gets the class loader being used by the editor to load resources of the specified project.
 javax.swing.JEditorPane getEditorPane(java.awt.Container cont)
          Search the container for an instance of JEditorPane
 javax.swing.JEditorPane getEditorPane(java.lang.String fileName)
          Search the container for an instance of JEditorPane
 java.lang.Object[] getHandlerMethods(EditorProject currentProject, java.lang.String fileName)
          Get a list of the methods provided by the page class
 Modifiable getPageDataObject(EditorProject currentProject, java.lang.String name)
          Retrieve the PageDataObject for the page with the passed name
 java.lang.String getPlatform()
           
 java.net.URL[] getProjectURLs(EditorProject project)
          Gets the classpath URLs of the given project.
 boolean hasMethod(EditorProject currentProject, java.lang.String fileName, java.lang.String methodName)
          Check if a method is already contained within the direct superclass
 void insertTextAtCaret(java.lang.Object sourceCodeEditor, java.lang.String newText)
           
 boolean isEclipse()
          Is this an eclipse plugin?
 boolean isValid(java.lang.Object sourceCodeEditor)
           
 java.awt.Image loadImage(java.lang.String name)
           
 boolean locateMethod(Project currentProject, PageResource pageRes, java.lang.Object sourceCodeEditor, java.lang.String methodName, java.lang.String searchText, boolean addNew, boolean ctrlDown)
           
 void markDirty(EditorProject project)
          Mark the project as dirty
 boolean openSourceFile(EditorProject currentProject, PageResource pageResource, java.lang.String fileNme)
           
 void requestActive(java.lang.Object window)
           
 boolean setSourceCodeEditor(PageResource pageRes, java.lang.String fileName)
          Set the source code editor for the pageResource
 void showErrorMessage(java.lang.String msg, java.lang.String title)
           
 

Field Detail

FRAME_WIDTH

static final int FRAME_WIDTH
See Also:
Constant Field Values

FRAME_HEIGHT

static final int FRAME_HEIGHT
See Also:
Constant Field Values
Method Detail

copyToClipboard

void copyToClipboard(java.lang.String text)
Copy text to the clipboard

Parameters:
text - the text to be copied

getDbConnection

java.sql.Connection getDbConnection(java.lang.Object obj)
Get database connection

Parameters:
obj - the object that the connection is to be obtained from
Returns:
the database connection

getDbConnectionName

java.lang.String getDbConnectionName(java.lang.Object obj)
Get database connection name

Parameters:
obj - object containing connection name
Returns:
connection name

getDbDriver

java.lang.String getDbDriver(java.lang.Object obj)
Get database connection driver

Parameters:
obj - the object from which the database connection is to be obtained
Returns:
the db driver

getDbDriverFile

java.lang.String getDbDriverFile(java.lang.Object obj)
Get the path to the file (zip, jar) containing the jdbc driver used to connect the the database.

Parameters:
obj - the object from which the db driver path will be otained.

getDbTableName

java.lang.String getDbTableName(java.lang.Object obj)
Get database table name

Returns:
database table name

getDbPassword

java.lang.String getDbPassword(java.lang.Object obj)
Get database connection password It cannot be obtained from the Connection object

Parameters:
obj - from which password is to be obtained
Returns:
database connection password

canImportDbTable

boolean canImportDbTable(java.awt.datatransfer.DataFlavor transferFlavor)
Indicates whether database table can be imported from the given data flavor.

Parameters:
transferFlavors - the data formats available
Returns:
true if database table can be imported, false otherwise

setSourceCodeEditor

boolean setSourceCodeEditor(PageResource pageRes,
                            java.lang.String fileName)
Set the source code editor for the pageResource


activateEditor

boolean activateEditor(PageResource pageRes,
                       boolean activate)
Activate the source code editor for this page

Parameters:
pageRes - the page resource that owns the source
activate - force the source editor to display if true
Returns:
true if the editor is open and has been activated, otherwise false

getEditorPane

javax.swing.JEditorPane getEditorPane(java.awt.Container cont)
Search the container for an instance of JEditorPane

Parameters:
cont - the container to search
Returns:
the editor or null if none is found

getEditorPane

javax.swing.JEditorPane getEditorPane(java.lang.String fileName)
Search the container for an instance of JEditorPane

Parameters:
cont - the container to search
Returns:
the editor or null if none is found

getPageDataObject

Modifiable getPageDataObject(EditorProject currentProject,
                             java.lang.String name)
Retrieve the PageDataObject for the page with the passed name

Parameters:
name - the name of the page whose PageDataObject we wish to retrieve
Returns:
the PageDataObject

getProjectURLs

java.net.URL[] getProjectURLs(EditorProject project)
Gets the classpath URLs of the given project.

Parameters:
project - project whose classpath entries will be returned
Returns:
table containing classpath URLs

getEditorClassLoader

java.lang.ClassLoader getEditorClassLoader(EditorProject project)
Gets the class loader being used by the editor to load resources of the specified project.

Parameters:
project - project the classloader of which is to be obtained
Returns:
the ClassLoader object

getCachedPage

Page getCachedPage(EditorProject currentProject,
                   PageResource pageRes)
If the page xml has been cached we want to use that xml to generate the page otherwise we just return the page contained in the pageRes object

Parameters:
pageRes - the pageResource we're checking
Returns:
the newly parsed page or the page in the pageRes

requestActive

void requestActive(java.lang.Object window)

locateMethod

boolean locateMethod(Project currentProject,
                     PageResource pageRes,
                     java.lang.Object sourceCodeEditor,
                     java.lang.String methodName,
                     java.lang.String searchText,
                     boolean addNew,
                     boolean ctrlDown)

insertTextAtCaret

void insertTextAtCaret(java.lang.Object sourceCodeEditor,
                       java.lang.String newText)

isValid

boolean isValid(java.lang.Object sourceCodeEditor)

openSourceFile

boolean openSourceFile(EditorProject currentProject,
                       PageResource pageResource,
                       java.lang.String fileNme)

hasMethod

boolean hasMethod(EditorProject currentProject,
                  java.lang.String fileName,
                  java.lang.String methodName)
Check if a method is already contained within the direct superclass

Parameters:
currentProject - the current project
fileName - the full file name for the enclosing class
methodName - the bare method name e.g. 'showPrevious'

getHandlerMethods

java.lang.Object[] getHandlerMethods(EditorProject currentProject,
                                     java.lang.String fileName)
Get a list of the methods provided by the page class

Parameters:
currentProject - the current project
fileName - the full file name for the enclosing class

copy

void copy(java.io.InputStream is,
          java.io.OutputStream os)

loadImage

java.awt.Image loadImage(java.lang.String name)

getPlatform

java.lang.String getPlatform()

showErrorMessage

void showErrorMessage(java.lang.String msg,
                      java.lang.String title)

addJar

void addJar(EditorProject currentProject,
            java.net.URL jarUrl)
Add a jar reference to the project class path. Only add the jar if it is not already present

Parameters:
currentProject - the current project
jarUrl - the jar to add

isEclipse

boolean isEclipse()
Is this an eclipse plugin?

Returns:
true if the plugin is designed to run on eclipse

markDirty

void markDirty(EditorProject project)
Mark the project as dirty

Parameters:
project - the current project