projectviewer.vpt
Class VFSFile

java.lang.Object
  extended byjavax.swing.tree.DefaultMutableTreeNode
      extended byprojectviewer.vpt.VPTNode
          extended byprojectviewer.vpt.VFSFile
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, javax.swing.tree.MutableTreeNode, java.io.Serializable, javax.swing.tree.TreeNode

public class VFSFile
extends VPTNode

Models a file accessed using jEdit's VFS.

Version:
$Id: VFSFile.java 6461 2006-07-30 01:49:45Z vanza $
Author:
Marcelo Vanzin
See Also:
Serialized Form

Field Summary
 
Fields inherited from class projectviewer.vpt.VPTNode
name, treeNoSelectionBackground, treeNoSelectionForeground, treeSelectionBackground, treeSelectionForeground
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
VFSFile(java.lang.String path)
           
 
Method Summary
 boolean canOpen()
          File nodes can be opened, so return true.
 boolean canWrite()
          Returns true.
 void close()
          "Closes" the jEdit buffer that contains the file.
 int compareToNode(VPTNode node)
          Compares a VFSFile node to another VPTNode.
 boolean delete()
          Deletes the file from disk.
 java.awt.Color getForegroundColor(boolean sel)
          Returns the node's foreground color.
 javax.swing.Icon getIcon(boolean expanded)
          Returns the icon to be shown on the tree next to the node name.
 java.lang.String getNodePath()
          Returns the path to the file represented by this node.
 boolean isOpened()
          Returns "true" if the node is a file and is currently opened in jEdit.
 void open()
          Opens a new buffer in jEdit with the file pointed by this node.
 java.lang.String toString()
          Returns a string representation of the current node.
 
Methods inherited from class projectviewer.vpt.VPTNode
compareName, compareTo, findIndexForChild, findProjectFor, getBackgroundColor, getChildWithName, getClipType, getName, isDirectory, isFile, isGroup, isProject, isRoot, persistChildren, setName, setParent, sortChildren, sortChildren
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setUserObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VFSFile

public VFSFile(java.lang.String path)
Method Detail

canWrite

public boolean canWrite()
Returns true. Since we can't check (easily) if we can or cannot write to a file using the VFS api, let the VFS manager decide it, and show an error in case it can't write...

Overrides:
canWrite in class VPTNode

delete

public boolean delete()
Deletes the file from disk. Before deleting, try to close the file.

Overrides:
delete in class VPTNode
Returns:
Whether the deletion was successful or not.

isOpened

public boolean isOpened()
Returns "true" if the node is a file and is currently opened in jEdit.

Overrides:
isOpened in class VPTNode

getIcon

public javax.swing.Icon getIcon(boolean expanded)
Returns the icon to be shown on the tree next to the node name.

Specified by:
getIcon in class VPTNode
Parameters:
expanded - If the node is currently expanded or not.

getForegroundColor

public java.awt.Color getForegroundColor(boolean sel)
Returns the node's foreground color.

Overrides:
getForegroundColor in class VPTNode
Parameters:
sel - If the node is currently selected.

toString

public java.lang.String toString()
Returns a string representation of the current node.

Overrides:
toString in class VPTNode

canOpen

public boolean canOpen()
File nodes can be opened, so return true.

Overrides:
canOpen in class VPTNode

open

public void open()
Opens a new buffer in jEdit with the file pointed by this node. The buffer is loaded in the currently active view.

Overrides:
open in class VPTNode

close

public void close()
"Closes" the jEdit buffer that contains the file.

Overrides:
close in class VPTNode

getNodePath

public java.lang.String getNodePath()
Returns the path to the file represented by this node.

Specified by:
getNodePath in class VPTNode

compareToNode

public int compareToNode(VPTNode node)
Compares a VFSFile node to another VPTNode.

Overrides:
compareToNode in class VPTNode