org.eclipse.gmt.umlx.registry.standalone
Class FileHandle

java.lang.Object
  extended by org.eclipse.core.runtime.PlatformObject
      extended by org.eclipse.gmt.umlx.registry.standalone.FileHandle
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, AbstractFileHandle
Direct Known Subclasses:
ProjectHandle

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


Constructor Summary
FileHandle(ProjectHandle projectHandle, java.io.File file)
           
 
Method Summary
static java.lang.String createCanonicalFileName(java.io.File file)
           
 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.io.File getFile()
           
 java.lang.String getName()
          Return a name that can access the physical storage with respect to its parent.
 FileHandle getParentFileHandle()
          Return the handle of the parent of this handle.
 AbstractProjectHandle 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.emf.common.util.URI getURI()
          Get the URI of the file.
 java.io.File isFile()
          Return a non-null file object if this Handle applies to a file.
 java.io.File isFolder()
          Return a non-null folder object if this Handle applies to a folder or directory.
 java.io.File 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Constructor Detail

FileHandle

public FileHandle(ProjectHandle projectHandle,
                  java.io.File file)
           throws java.io.IOException
Throws:
java.io.IOException
Method Detail

createCanonicalFileName

public static java.lang.String createCanonicalFileName(java.io.File file)
                                                throws java.io.IOException
Throws:
java.io.IOException

exists

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

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

getAbsoluteName

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

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

getContents

public java.io.InputStream getContents()
                                throws java.io.FileNotFoundException
Description copied from interface: AbstractFileHandle
Return a stream from which the contents can be read.

Specified by:
getContents in interface AbstractFileHandle
Returns:
the stream
Throws:
java.io.FileNotFoundException - if File access problem

getFile

public java.io.File getFile()

getName

public java.lang.String getName()
Description copied from interface: AbstractFileHandle
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 AbstractFileHandle
Returns:
the name.

getParentFileHandle

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

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

getProjectHandle

public AbstractProjectHandle getProjectHandle()
Description copied from interface: AbstractFileHandle
Return the handle of the project.

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

getProjectRelativeName

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

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

getProjectRelativePath

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

getURI

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

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

isFile

public java.io.File isFile()
Description copied from interface: AbstractFileHandle
Return a non-null file object if this Handle applies to a file.

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

isFolder

public java.io.File isFolder()
Description copied from interface: AbstractFileHandle
Return a non-null folder object if this Handle applies to a folder or directory.

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

isProject

public java.io.File isProject()
Description copied from interface: AbstractFileHandle
Return a non-null project object if this Handle applies to a project.

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

toString

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