projectviewer
Class VFSHelper

java.lang.Object
  extended by projectviewer.VFSHelper

public class VFSHelper
extends java.lang.Object

Class with helper functions for dealing with jEdit's VFS.

Since:
PV 3.0.0
Author:
Marcelo Vanzin

Nested Class Summary
static class VFSHelper.SessionErrorException
           
 
Constructor Summary
VFSHelper()
           
 
Method Summary
static java.lang.Object createVFSSession(org.gjt.sp.jedit.io.VFS vfs, java.lang.String path)
          Creates a VFS session.
static java.lang.Object createVFSSession(org.gjt.sp.jedit.io.VFS vfs, java.lang.String path, org.gjt.sp.jedit.View v)
          Creates a VFS session.
static void deleteFile(java.lang.String url)
          Deletes a file.
static void endVFSSession(org.gjt.sp.jedit.io.VFS vfs, java.lang.Object session, org.gjt.sp.jedit.View v)
          Ends a VFS session, logging any exceptions.
static org.gjt.sp.jedit.io.VFSFile getFile(java.lang.String url)
          Creates a VFSFile instance for the given URL.
static org.gjt.sp.jedit.io.VFSFile getFileExtExc(java.lang.String url)
          Creates a VFSFile instance for the given URL.
static boolean isLocal(java.lang.String url)
          Returns whether the path references a local file.
static boolean pathExists(java.lang.String path)
          Returns whether a VFS path exists.
static boolean pathExists(java.lang.String path, java.lang.String[] aCorr)
          Returns whether a VFS path exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VFSHelper

public VFSHelper()
Method Detail

createVFSSession

public static java.lang.Object createVFSSession(org.gjt.sp.jedit.io.VFS vfs,
                                                java.lang.String path)
Creates a VFS session. Makes sure the VFS method for creating a session is called from the AWT thread.

Parameters:
vfs - The VFS instance.
path - The path for which a session is being created.

createVFSSession

public static java.lang.Object createVFSSession(org.gjt.sp.jedit.io.VFS vfs,
                                                java.lang.String path,
                                                org.gjt.sp.jedit.View v)
Creates a VFS session. Makes sure the VFS method for creating a session is called from the AWT thread.

Parameters:
vfs - The VFS instance.
path - The path for which a session is being created.
v - View for error reporting.

endVFSSession

public static void endVFSSession(org.gjt.sp.jedit.io.VFS vfs,
                                 java.lang.Object session,
                                 org.gjt.sp.jedit.View v)
Ends a VFS session, logging any exceptions.

Parameters:
vfs - The VFS instance.
session - The session to end.
v - A jEdit view.

deleteFile

public static void deleteFile(java.lang.String url)
                       throws java.io.IOException
Deletes a file.

Parameters:
url - The URL for the file to delete.
Throws:
java.io.IOException

getFile

public static org.gjt.sp.jedit.io.VFSFile getFile(java.lang.String url)
                                           throws java.io.IOException
Creates a VFSFile instance for the given URL.

Throws:
java.io.IOException

getFileExtExc

public static org.gjt.sp.jedit.io.VFSFile getFileExtExc(java.lang.String url)
                                                 throws java.io.IOException,
                                                        VFSHelper.SessionErrorException
Creates a VFSFile instance for the given URL. Throws more exceptions to provide more info in case of failure.

Throws:
java.io.IOException
VFSHelper.SessionErrorException

isLocal

public static boolean isLocal(java.lang.String url)
Returns whether the path references a local file.

Parameters:
url - VFS URL to check.

pathExists

public static boolean pathExists(java.lang.String path)
Returns whether a VFS path exists.

Parameters:
path - Path to check.

pathExists

public static boolean pathExists(java.lang.String path,
                                 java.lang.String[] aCorr)
Returns whether a VFS path exists.

This method should not be called from outside ProjectViewer.

Parameters:
path - A path to check.
aCorr - An array to return the path in correct case. This is for case insensitive filesystems, if user supplied a path in a non-canonical case. May be null.