edu.uky.rch.ept.data
Class DataLayerEditorInput

java.lang.Object
  extended byedu.uky.rch.ept.data.DataLayerEditorInput
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, IDataLayerEditorInput, org.eclipse.ui.IEditorInput
Direct Known Subclasses:
ProjectEditorInput

public class DataLayerEditorInput
extends Object
implements IDataLayerEditorInput

Editor input for data layer resources. In addition to implementing IDataLayerEditorInput, this class provides the convenience methods getInputStream(), getOutputStream(), and getOutputStream(boolean).

Author:
Neil Moore

Constructor Summary
DataLayerEditorInput(String address)
          Create an editor input referring to a data layer resource.
 
Method Summary
 boolean equals(Object obj)
           
 boolean exists()
          Determine whether the resource exists in the data layer.
 Object getAdapter(Class adapter)
           
 String getAddress()
          Get the data layer address for this editor input.
 org.eclipse.jface.resource.ImageDescriptor getImageDescriptor()
          Get the image descriptor for the editor input.
 BufferedInputStream getInputStream()
          Returns an input stream that reads data from the resource pointed to by this editor input.
 String getName()
           
 BufferedOutputStream getOutputStream()
          Returns an output stream that writes data to the resource pointed to by this editor input.
 BufferedOutputStream getOutputStream(boolean append)
          Returns an output stream that writes or appends data to the resource pointed to by this editor input.
 org.eclipse.ui.IPersistableElement getPersistable()
           
 String getToolTipText()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataLayerEditorInput

public DataLayerEditorInput(String address)
                     throws MalformedAddressException,
                            IOException
Create an editor input referring to a data layer resource. The resource is not tested for existence, but the resource address must be well-formed.

Parameters:
address - the absolute data layer address of a resource.
Throws:
MalformedAddressException - if the address was not a valid data layer address.
IOException - if there was an error accessing the resource.
Method Detail

getAddress

public String getAddress()
Description copied from interface: IDataLayerEditorInput
Get the data layer address for this editor input.

Specified by:
getAddress in interface IDataLayerEditorInput
Returns:
the absolute data layer address of the resource pointed to by this editor.

exists

public boolean exists()
Determine whether the resource exists in the data layer.

Specified by:
exists in interface org.eclipse.ui.IEditorInput
See Also:
IEditorInput.exists()

getImageDescriptor

public org.eclipse.jface.resource.ImageDescriptor getImageDescriptor()
Get the image descriptor for the editor input. The descriptor is based on the file name and the registered editors.

Specified by:
getImageDescriptor in interface org.eclipse.ui.IEditorInput
Returns:
an image descriptor for this resource.

getName

public String getName()
Specified by:
getName in interface org.eclipse.ui.IEditorInput

getPersistable

public org.eclipse.ui.IPersistableElement getPersistable()
Specified by:
getPersistable in interface org.eclipse.ui.IEditorInput

getToolTipText

public String getToolTipText()
Specified by:
getToolTipText in interface org.eclipse.ui.IEditorInput

getAdapter

public Object getAdapter(Class adapter)
Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable

getInputStream

public BufferedInputStream getInputStream()
                                   throws ResourceNotFoundException,
                                          IOException
Returns an input stream that reads data from the resource pointed to by this editor input.

Returns:
an input stream for reading the resource
Throws:
ResourceNotFoundException - if the resource pointed to by this editor input does not exist.
IOException - if there was an error accessing the resource.

getOutputStream

public BufferedOutputStream getOutputStream(boolean append)
                                     throws ResourceNotFoundException,
                                            IOException
Returns an output stream that writes or appends data to the resource pointed to by this editor input.

Parameters:
append - if true, the stream will be opened for appending.
Returns:
an output stream for writing or appending to the resource.
Throws:
ResourceNotFoundException - if the resource pointed to by this editor input does not exist and cannot be created.
IOException - if there was an error accessing the resource, or if the resource was not writable.

getOutputStream

public BufferedOutputStream getOutputStream()
                                     throws ResourceNotFoundException,
                                            IOException
Returns an output stream that writes data to the resource pointed to by this editor input.

Returns:
an output stream for writing to the resource
Throws:
ResourceNotFoundException - if the resource pointed to by this editor input does not exist and cannot be created.
IOException - if there was an error accessing the resource, or if the resource was not writable.

equals

public boolean equals(Object obj)