com.ibm.ftt.ui.resources.core.editor
Interface IEditorOpener

All Known Implementing Classes:
EditorOpener

public interface IEditorOpener

Interface for utility classes used to open resources in an edit session.


 try {
         EditorOpener.getInstance().open(selectedItem);
 } catch (Exception e) {
         // Exception handling code
 }
 
Each utility class implementing this interface would be responsible for a particular subtype of resources (e.g. MVS Physical Resources, USS Logical Resources, etc). Additional implementations for new resource types can be contributed through the com.ibm.ftt.ui.resources.editorOpener extension point. All classes declared in the com.ibm.ftt.ui.resources.editorOpener extension point should implement the IEditorOpener interface.

Note: Each class implementing IEditorOpener must provide a static method getInstance, returning a singleton instance for the class.

Caller should invoke EditorOpener instead of the resource type specific IEditorOpener implementations directly.


Field Summary
static String COPY_RIGHT
           
 
Method Summary
 org.eclipse.ui.IEditorPart browse(Object resource)
          Opens the specified resource in read only mode.
 boolean canBrowse(Object resource)
          Returns whether the resource can be browsed or not
 org.eclipse.ui.IEditorPart 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.
 org.eclipse.ui.IEditorPart open(Object resource)
          Opens an edit session for the specified resource.
 org.eclipse.ui.IEditorPart open(Object resource, org.eclipse.ui.IEditorDescriptor editorDescriptor)
          Opens an edit session for the specified resource using the specified editor.
 org.eclipse.ui.IEditorPart view(Object resource)
          Opens the specified resource in edit mode without locking the file
 

Field Detail

COPY_RIGHT

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

open

org.eclipse.ui.IEditorPart open(Object resource)
                                throws Exception
Opens an edit session for the specified resource. The default editor will be used.

Parameters:
resource - resource to open
Returns:
the IEditorPart used to open the resource or null if the resource could not be opened.
Throws:
Exception - if the resource cannot be opened.

open

org.eclipse.ui.IEditorPart open(Object resource,
                                org.eclipse.ui.IEditorDescriptor editorDescriptor)
                                throws Exception
Opens an edit session for the specified resource using the specified editor.

Parameters:
resource - resource to open
editorDescriptor - descriptor object for the editor to use
Returns:
the IEditorPart used to open the resource or null if the resource could not be opened.
Throws:
Exception - if the resource cannot be opened.

browse

org.eclipse.ui.IEditorPart browse(Object resource)
                                  throws Exception
Opens the specified resource in read only mode.

Parameters:
resource - resource to browse
Returns:
the IEditorPart used to browse the resource or null if the resource could not be browsed.
Throws:
Exception - if the resource cannot be browsed

view

org.eclipse.ui.IEditorPart view(Object resource)
                                throws Exception
Opens the specified resource in edit mode without locking the file

Parameters:
resource - resource to view
Returns:
the IEditorPart used to view the resource or null if the resource could not be opened.
Throws:
Exception - if the resource cannot be viewed

gotoLine

org.eclipse.ui.IEditorPart gotoLine(Object resource,
                                    int lineNumber,
                                    int charStart,
                                    int charEnd)
                                    throws Exception
Opens the resource and goes to the specified line, highlighting the section from charStart to charEnd.

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)
Returns:
the IEditorPart used to open the resource or null if the resource could not be opened.
Throws:
Exception - if goto line operation fails

canBrowse

boolean canBrowse(Object resource)
Returns whether the resource can be browsed or not

Parameters:
resource - resource to check for browse
Returns:
true if the resource can be browsed, or false if not.