org.eclipse.ocl.examples.modelregistry.eclipse
Class EclipseFileHandle

java.lang.Object
  extended by org.eclipse.core.runtime.PlatformObject
      extended by org.eclipse.ocl.examples.modelregistry.eclipse.EclipseFileHandle
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, FileHandle
Direct Known Subclasses:
EclipseProjectHandle

public class EclipseFileHandle
extends org.eclipse.core.runtime.PlatformObject
implements FileHandle


Field Summary
protected  EclipseProjectHandle projectHandle
           
protected  org.eclipse.core.resources.IResource resource
           
 
Constructor Summary
  EclipseFileHandle(EclipseProjectHandle projectHandle, org.eclipse.core.resources.IResource resource)
           
protected EclipseFileHandle(org.eclipse.core.resources.IProject project)
           
 
Method Summary
 boolean exists()
          Return true if file exists.
 java.lang.String getAbsoluteName()
          Return a name that can access the physical storage without reference to any other context.
 java.io.InputStream getContents()
          Return a stream from which the contents can be read.
 java.lang.String getName()
          Return a name that can access the physical storage with respect to its parent.
 EclipseFileHandle getParentFileHandle()
          Return the handle of the parent of this handle.
 ProjectHandle getProjectHandle()
          Return the handle of the project.
 java.lang.String getProjectRelativeName()
          Return a name that can access the physical storage with respect to the project.
 org.eclipse.core.runtime.IPath getProjectRelativePath()
           
 org.eclipse.core.resources.IResource getResource()
           
 org.eclipse.emf.common.util.URI getURI()
          Get the URI of the file.
 org.eclipse.core.resources.IFile isFile()
          Return a non-null file object if this Handle applies to a file.
 org.eclipse.core.resources.IFolder isFolder()
          Return a non-null folder object if this Handle applies to a folder or directory.
 org.eclipse.core.resources.IProject isProject()
          Return a non-null project object if this Handle applies to a project.
 java.lang.String toString()
           
 
Methods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

projectHandle

protected final EclipseProjectHandle projectHandle

resource

protected final org.eclipse.core.resources.IResource resource
Constructor Detail

EclipseFileHandle

protected EclipseFileHandle(org.eclipse.core.resources.IProject project)

EclipseFileHandle

public EclipseFileHandle(EclipseProjectHandle projectHandle,
                         org.eclipse.core.resources.IResource resource)
Method Detail

exists

public boolean exists()
Description copied from interface: FileHandle
Return true if file exists.

Specified by:
exists in interface FileHandle
Returns:
true if exists.

getAbsoluteName

public java.lang.String getAbsoluteName()
Description copied from interface: FileHandle
Return a name that can access the physical storage without reference to any other context.

Specified by:
getAbsoluteName in interface FileHandle
Returns:
the absolute name.

getContents

public java.io.InputStream getContents()
                                throws org.eclipse.core.runtime.CoreException
Description copied from interface: FileHandle
Return a stream from which the contents can be read.

Specified by:
getContents in interface FileHandle
Returns:
the stream
Throws:
org.eclipse.core.runtime.CoreException - if Eclipse resource access problem

getName

public java.lang.String getName()
Description copied from interface: FileHandle
Return a name that can access the physical storage with respect to its parent. e.g the file name and extension without any devuice or directories.

Specified by:
getName in interface FileHandle
Returns:
the name.

getParentFileHandle

public EclipseFileHandle getParentFileHandle()
Description copied from interface: FileHandle
Return the handle of the parent of this handle.

Specified by:
getParentFileHandle in interface FileHandle
Returns:
the parent handle, null for the parent of the project.

getProjectHandle

public ProjectHandle getProjectHandle()
Description copied from interface: FileHandle
Return the handle of the project.

Specified by:
getProjectHandle in interface FileHandle
Returns:
the project handle.

getProjectRelativeName

public java.lang.String getProjectRelativeName()
Description copied from interface: FileHandle
Return a name that can access the physical storage with respect to the project.

Specified by:
getProjectRelativeName in interface FileHandle
Returns:
the project relative name.

getProjectRelativePath

public org.eclipse.core.runtime.IPath getProjectRelativePath()

getResource

public org.eclipse.core.resources.IResource getResource()

getURI

public org.eclipse.emf.common.util.URI getURI()
Description copied from interface: FileHandle
Get the URI of the file.

Specified by:
getURI in interface FileHandle
Returns:
the file URI

isFile

public org.eclipse.core.resources.IFile isFile()
Description copied from interface: FileHandle
Return a non-null file object if this Handle applies to a file.

Specified by:
isFile in interface FileHandle
Returns:
non-null file object.

isFolder

public org.eclipse.core.resources.IFolder isFolder()
Description copied from interface: FileHandle
Return a non-null folder object if this Handle applies to a folder or directory.

Specified by:
isFolder in interface FileHandle
Returns:
non-null folder object.

isProject

public org.eclipse.core.resources.IProject isProject()
Description copied from interface: FileHandle
Return a non-null project object if this Handle applies to a project.

Specified by:
isProject in interface FileHandle
Returns:
non-null project object.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object