com.aptana.ide.core.ui.io.file
Class LocalFile

java.lang.Object
  extended by com.aptana.ide.core.io.VirtualFile
      extended by com.aptana.ide.core.ui.io.file.LocalFile
All Implemented Interfaces:
IVirtualFile, java.lang.Comparable

public class LocalFile
extends VirtualFile

Author:
Robin Debreuil

Field Summary
protected static javax.swing.filechooser.FileSystemView filesys
          filesys
 
Constructor Summary
LocalFile(LocalFileManager manager, java.io.File file)
          LocalFile
 
Method Summary
 boolean canRead()
          Determine if this virtual file is readable given the current set of permissions
 boolean canWrite()
          Determine if this virtual file is writable given the current set of permissions
 int compareTo(java.lang.Object o)
           
 boolean delete()
          Remove this virtual file from the file manager
 void editProperties(org.eclipse.swt.widgets.Shell shell)
          editProperties
 boolean equals(java.lang.Object arg0)
           
 boolean exists()
          Determine if this virtual file exists in it's file system
 java.lang.String getAbsolutePath()
          Get the path, filename and extension of this virtual file
 long getCreationMillis()
          Get the creation time of this file in milliseconds
 java.lang.String getExtension()
          Get the extension for this virtual file
 java.io.File getFile()
          getFile
 IVirtualFileManager getFileManager()
          Get the file manager that this file belongs to
 IVirtualFile[] getFiles()
          Retrieve a list of files contained by this virtual file
 IVirtualFile[] getFiles(boolean recurse, boolean includeCloakedFiles)
          Retrieve a list of files contained by this virtual file
 java.lang.String getGroup()
          Get the group to which this file belongs
 org.eclipse.swt.graphics.Image getImage()
          getImage
 long getModificationMillis()
          Get the modification time of this file in milliseconds
 java.lang.String getName()
          Get the filename and extension of this virtual file.
 java.lang.String getOwner()
          Get the owner of this file
 IVirtualFile getParentFile()
          Retrieve the virtual file that contains file file
 java.lang.String getPath()
          Doesn't include filename and extension.
 long getPermissions()
          Get the file permissions for this file
 java.lang.String getRelativePath()
          Returns a path relative to the parent virtual file manager
 long getSize()
          getSize
 java.io.InputStream getStream()
          Get an input stream for the contents of this virtual file
 boolean hasFiles()
          Determines if this virtual file contains files
 boolean hasFiles(boolean includeCloakedFiles)
          hasFiles
 int hashCode()
           
 boolean isCloaked()
          Is this file cloaked?
 boolean isDirectory()
          Determines if this virtual file represents a directory
 boolean isFile()
          Determines if this virtual file represents a file
 boolean isLocal()
          Is this file local?
 void putStream(java.io.InputStream input)
          Put the content of the specified input stream into this virtual file.
 boolean rename(java.lang.String newName)
          Rename this file
 void setCloaked(boolean cloak)
          Set the file as cloaked or not
 void setGroup(java.lang.String group)
          Change this file's group name
 void setImage(org.eclipse.swt.graphics.Image image)
          setImage
 void setModificationMillis(long modificationTime)
          Sets the modification time of this file in milliseconds
 void setOwner(java.lang.String owner)
          Change this file's owner
 void setPermissions(long permissions)
          Set the file permissions on this file
 
Methods inherited from class com.aptana.ide.core.io.VirtualFile
getParentDirectories, getTimeStamp, removeDuplicateFile, reparentFiles, setTimeStamp
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filesys

protected static javax.swing.filechooser.FileSystemView filesys
filesys

Constructor Detail

LocalFile

public LocalFile(LocalFileManager manager,
                 java.io.File file)
LocalFile

Parameters:
manager -
file -
Method Detail

getFile

public java.io.File getFile()
getFile

Returns:
File

getName

public java.lang.String getName()
Description copied from interface: IVirtualFile
Get the filename and extension of this virtual file. This should exclude the parent directory of the file

Specified by:
getName in interface IVirtualFile
Specified by:
getName in class VirtualFile
Returns:
Returns this virtual file's name and extension
See Also:
IVirtualFile.getName()

getExtension

public java.lang.String getExtension()
Description copied from interface: IVirtualFile
Get the extension for this virtual file

Specified by:
getExtension in interface IVirtualFile
Specified by:
getExtension in class VirtualFile
Returns:
Returns the file extension including the leading '.'
See Also:
IVirtualFile.getExtension()

getAbsolutePath

public java.lang.String getAbsolutePath()
Description copied from interface: IVirtualFile
Get the path, filename and extension of this virtual file

Specified by:
getAbsolutePath in interface IVirtualFile
Specified by:
getAbsolutePath in class VirtualFile
Returns:
Returns the full path, name, and extension for this file
See Also:
IVirtualFile.getAbsolutePath()

getPath

public java.lang.String getPath()
Description copied from interface: IVirtualFile
Doesn't include filename and extension. Includes trailing file separator

Specified by:
getPath in interface IVirtualFile
Specified by:
getPath in class VirtualFile
Returns:
Returns the path to this virtual file
See Also:
IVirtualFile.getPath()

isDirectory

public boolean isDirectory()
Description copied from interface: IVirtualFile
Determines if this virtual file represents a directory

Specified by:
isDirectory in interface IVirtualFile
Specified by:
isDirectory in class VirtualFile
Returns:
Returns true if this virtual file is a directory
See Also:
IVirtualFile.isDirectory()

isFile

public boolean isFile()
Description copied from interface: IVirtualFile
Determines if this virtual file represents a file

Specified by:
isFile in interface IVirtualFile
Specified by:
isFile in class VirtualFile
Returns:
Returns true if this virtual file is a file
See Also:
IVirtualFile.isFile()

isLocal

public boolean isLocal()
Description copied from interface: IVirtualFile
Is this file local?

Specified by:
isLocal in interface IVirtualFile
Overrides:
isLocal in class VirtualFile
Returns:
boolean
See Also:
IVirtualFile.isLocal()

getFileManager

public IVirtualFileManager getFileManager()
Description copied from interface: IVirtualFile
Get the file manager that this file belongs to

Specified by:
getFileManager in interface IVirtualFile
Specified by:
getFileManager in class VirtualFile
Returns:
Returns this file's owning file manager
See Also:
IVirtualFile.getFileManager()

hasFiles

public boolean hasFiles()
Description copied from interface: IVirtualFile
Determines if this virtual file contains files

Specified by:
hasFiles in interface IVirtualFile
Specified by:
hasFiles in class VirtualFile
Returns:
Returns true if this virtual file is a directory containing other files
See Also:
IVirtualFile.hasFiles()

hasFiles

public boolean hasFiles(boolean includeCloakedFiles)
hasFiles

Parameters:
includeCloakedFiles -
Returns:
boolean

getFiles

public IVirtualFile[] getFiles()
                        throws java.io.IOException
Description copied from interface: IVirtualFile
Retrieve a list of files contained by this virtual file

Specified by:
getFiles in interface IVirtualFile
Overrides:
getFiles in class VirtualFile
Returns:
Returns an array of virtual files. This will return an empty array if this virtual file contains no other files
Throws:
java.io.IOException
See Also:
IVirtualFile.getFiles()

getFiles

public IVirtualFile[] getFiles(boolean recurse,
                               boolean includeCloakedFiles)
                        throws java.io.IOException
Description copied from interface: IVirtualFile
Retrieve a list of files contained by this virtual file

Specified by:
getFiles in interface IVirtualFile
Specified by:
getFiles in class VirtualFile
Parameters:
recurse - Do we recurse through sub-directories?
includeCloakedFiles - Do we include cloaked files in the list?
Returns:
IVirtualFile[]
Throws:
java.io.IOException
See Also:
IVirtualFile.getFiles(boolean, boolean)

getGroup

public java.lang.String getGroup()
Description copied from interface: IVirtualFile
Get the group to which this file belongs

Specified by:
getGroup in interface IVirtualFile
Specified by:
getGroup in class VirtualFile
Returns:
This file's group name
See Also:
IVirtualFile.getGroup()

setGroup

public void setGroup(java.lang.String group)
Description copied from interface: IVirtualFile
Change this file's group name

Specified by:
setGroup in interface IVirtualFile
Specified by:
setGroup in class VirtualFile
See Also:
IVirtualFile.setGroup(java.lang.String)

getParentFile

public IVirtualFile getParentFile()
Description copied from interface: IVirtualFile
Retrieve the virtual file that contains file file

Specified by:
getParentFile in interface IVirtualFile
Specified by:
getParentFile in class VirtualFile
Returns:
Returns this file's parent file
See Also:
IVirtualFile.getParentFile()

delete

public boolean delete()
Description copied from interface: IVirtualFile
Remove this virtual file from the file manager

Specified by:
delete in interface IVirtualFile
Specified by:
delete in class VirtualFile
Returns:
Returns true if the file was successfully deleted
See Also:
IVirtualFile.delete()

rename

public boolean rename(java.lang.String newName)
Description copied from interface: IVirtualFile
Rename this file

Specified by:
rename in interface IVirtualFile
Specified by:
rename in class VirtualFile
Parameters:
newName - The new name for this file
Returns:
Returns true if the rename was successful
See Also:
IVirtualFile.rename(java.lang.String)

getCreationMillis

public long getCreationMillis()
Description copied from interface: IVirtualFile
Get the creation time of this file in milliseconds

Specified by:
getCreationMillis in interface IVirtualFile
Specified by:
getCreationMillis in class VirtualFile
Returns:
long
See Also:
IVirtualFile.getCreationMillis()

getModificationMillis

public long getModificationMillis()
Description copied from interface: IVirtualFile
Get the modification time of this file in milliseconds

Specified by:
getModificationMillis in interface IVirtualFile
Specified by:
getModificationMillis in class VirtualFile
Returns:
long
See Also:
IVirtualFile.getModificationMillis()

setModificationMillis

public void setModificationMillis(long modificationTime)
Description copied from interface: IVirtualFile
Sets the modification time of this file in milliseconds

Specified by:
setModificationMillis in interface IVirtualFile
Specified by:
setModificationMillis in class VirtualFile
See Also:
IVirtualFile.setModificationMillis(long)

getOwner

public java.lang.String getOwner()
Description copied from interface: IVirtualFile
Get the owner of this file

Specified by:
getOwner in interface IVirtualFile
Specified by:
getOwner in class VirtualFile
Returns:
This file's group name
See Also:
IVirtualFile.getOwner()

setOwner

public void setOwner(java.lang.String owner)
Description copied from interface: IVirtualFile
Change this file's owner

Specified by:
setOwner in interface IVirtualFile
Specified by:
setOwner in class VirtualFile
See Also:
IVirtualFile.setOwner(java.lang.String)

setPermissions

public void setPermissions(long permissions)
Description copied from interface: IVirtualFile
Set the file permissions on this file

Specified by:
setPermissions in interface IVirtualFile
Specified by:
setPermissions in class VirtualFile
Parameters:
permissions - The new file permission settings
See Also:
IVirtualFile.setPermissions(long)

getPermissions

public long getPermissions()
Description copied from interface: IVirtualFile
Get the file permissions for this file

Specified by:
getPermissions in interface IVirtualFile
Specified by:
getPermissions in class VirtualFile
Returns:
Returns the file permissions settings for this file
See Also:
IVirtualFile.getPermissions()

getSize

public long getSize()
getSize

Specified by:
getSize in interface IVirtualFile
Specified by:
getSize in class VirtualFile
Returns:
long
See Also:
IVirtualFile.getSize()

getStream

public java.io.InputStream getStream()
Description copied from interface: IVirtualFile
Get an input stream for the contents of this virtual file

Specified by:
getStream in interface IVirtualFile
Specified by:
getStream in class VirtualFile
Returns:
Returns an InputStream of null
See Also:
IVirtualFile.getStream()

putStream

public void putStream(java.io.InputStream input)
               throws java.io.IOException
Description copied from interface: IVirtualFile
Put the content of the specified input stream into this virtual file. This will create a new file if it does not already exist. This will replace the entire content of the file if it does exist

Specified by:
putStream in interface IVirtualFile
Specified by:
putStream in class VirtualFile
Parameters:
input - The input stream from which to retrieve data to place into this virtual file
Throws:
VirtualFileManagerException
java.io.IOException
See Also:
IVirtualFile.putStream(java.io.InputStream)

getImage

public org.eclipse.swt.graphics.Image getImage()
Description copied from interface: IVirtualFile
getImage

Specified by:
getImage in interface IVirtualFile
Specified by:
getImage in class VirtualFile
Returns:
Image
See Also:
IVirtualFile.getImage()

setImage

public void setImage(org.eclipse.swt.graphics.Image image)
Description copied from interface: IVirtualFile
setImage

Specified by:
setImage in interface IVirtualFile
Specified by:
setImage in class VirtualFile
See Also:
IVirtualFile.setImage(org.eclipse.swt.graphics.Image)

compareTo

public int compareTo(java.lang.Object o)
See Also:
Comparable.compareTo(java.lang.Object)

canRead

public boolean canRead()
Description copied from interface: IVirtualFile
Determine if this virtual file is readable given the current set of permissions

Specified by:
canRead in interface IVirtualFile
Specified by:
canRead in class VirtualFile
Returns:
Returns true if this virtual file is readable
See Also:
IVirtualFile.canRead()

canWrite

public boolean canWrite()
Description copied from interface: IVirtualFile
Determine if this virtual file is writable given the current set of permissions

Specified by:
canWrite in interface IVirtualFile
Specified by:
canWrite in class VirtualFile
Returns:
Returns true if this virtual file is writable
See Also:
IVirtualFile.canWrite()

exists

public boolean exists()
Description copied from interface: IVirtualFile
Determine if this virtual file exists in it's file system

Specified by:
exists in interface IVirtualFile
Specified by:
exists in class VirtualFile
Returns:
Returns true if the file exists
See Also:
IVirtualFile.exists()

editProperties

public void editProperties(org.eclipse.swt.widgets.Shell shell)
Description copied from interface: IVirtualFile
editProperties

See Also:
IVirtualFile.editProperties(org.eclipse.swt.widgets.Shell)

equals

public boolean equals(java.lang.Object arg0)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

getRelativePath

public java.lang.String getRelativePath()
Description copied from interface: IVirtualFile
Returns a path relative to the parent virtual file manager

Specified by:
getRelativePath in interface IVirtualFile
Specified by:
getRelativePath in class VirtualFile
Returns:
A relative path, or "/" if it is the root.
See Also:
IVirtualFile.getRelativePath()

setCloaked

public void setCloaked(boolean cloak)
Description copied from interface: IVirtualFile
Set the file as cloaked or not

See Also:
IVirtualFile.setCloaked(boolean)

isCloaked

public boolean isCloaked()
Description copied from interface: IVirtualFile
Is this file cloaked?

Returns:
boolean
See Also:
IVirtualFile.isCloaked()