com.ibm.ftt.ui.resources.core.editor
Class EditorOpener

java.lang.Object
  extended by com.ibm.ftt.ui.resources.core.editor.EditorOpener
All Implemented Interfaces:
IEditorOpener

public class EditorOpener
extends Object
implements IEditorOpener

EditorOpener can be used to open resources in an edit session.

The EditorOpener class is intended to handle all known resource types by delegating to the appropriate IEditorOpener. Caller should invoke this class instead of the resource type specific IEditorOpener implementations directly.


Field Summary
static String COPY_RIGHT
           
 
Method Summary
 void browse(Object resource)
          Opens the specified resource in read only mode.
 boolean canBrowse(Object resource)
          Returns whether the resource can be browsed or not
static EditorOpener getInstance()
          Returns the singleton instance of the EditorOpener class
 void gotoLine(Object resource, int lineNumber, int charStart, int charEnd)
          Opens the resource and goes to the specified line, highlighting the section from charStart to charEnd.
 void open(Object resource)
          Opens an edit session for the specified resource.
 void open(Object resource, IEditorDescriptor editorDescriptor)
          Opens an edit session for the specified resource using the specified editor.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPY_RIGHT

public static final String COPY_RIGHT
See Also:
Constant Field Values
Method Detail

getInstance

public static EditorOpener getInstance()
Returns the singleton instance of the EditorOpener class

Returns:
the singleton EditorOpener object

open

public void open(Object resource)
          throws Exception
Description copied from interface: IEditorOpener
Opens an edit session for the specified resource. The default editor will be used.

Specified by:
open in interface IEditorOpener
Parameters:
resource - resource to open
Throws:
Exception - if the resource cannot be opened.

open

public void open(Object resource,
                 IEditorDescriptor editorDescriptor)
          throws Exception
Description copied from interface: IEditorOpener
Opens an edit session for the specified resource using the specified editor.

Specified by:
open in interface IEditorOpener
Parameters:
resource - resource to open
editorDescriptor - descriptor object for the editor to use
Throws:
Exception - if the resource cannot be opened.

browse

public void browse(Object resource)
            throws Exception
Description copied from interface: IEditorOpener
Opens the specified resource in read only mode.

Specified by:
browse in interface IEditorOpener
Parameters:
resource - resource to browse
Throws:
Exception - if the resource cannot be browsed

gotoLine

public void gotoLine(Object resource,
                     int lineNumber,
                     int charStart,
                     int charEnd)
              throws Exception
Description copied from interface: IEditorOpener
Opens the resource and goes to the specified line, highlighting the section from charStart to charEnd.

Specified by:
gotoLine in interface IEditorOpener
Parameters:
resource - resource to open
lineNumber - line number to go to (line 1 is the first line)
charStart - start of the highlighted section (char 0 is the first character)
charEnd - end of the highlighted section (char 0 is the first character)
Throws:
Exception - if goto line operation fails

canBrowse

public boolean canBrowse(Object resource)
Description copied from interface: IEditorOpener
Returns whether the resource can be browsed or not

Specified by:
canBrowse in interface IEditorOpener
Parameters:
resource - resource to check for browse
Returns:
true if the resource can be browsed, or false if not.