|
RSE Release 3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.rse.core.SystemResourceHelpers
public class SystemResourceHelpers
A class with helper methods for working with the underlying Eclipse resources needed for filters, filter pools and filter pool managers.
Constructor Summary | |
---|---|
SystemResourceHelpers()
Constructor |
Method Summary | |
---|---|
boolean |
accept(File file)
Method required by FilenameFilter interface, used by java.io.File.list() |
IFile[] |
convertToFileArray(Vector vector)
Convert a vector of IFile objects to an array of IFile. |
IFolder[] |
convertToFolderArray(Vector vector)
Convert a vector of IFolder objects to an array of IFolder. |
Vector |
convertToVector(String[] array)
Convert a name array to a vector. |
Vector |
convertToVectorAndStrip(String[] array,
String namePrefix,
String nameSuffix)
Convert a name array to a vector. |
boolean |
createFolder(IFolder folder)
Create new folder |
boolean |
deleteFile(IFile file)
Delete a file |
boolean |
deleteFolder(IFolder folder)
Delete a folder |
void |
deleteResource(IResource fileOrFolder)
Method to delete a folder or file and absorb the exception |
boolean |
ensureFolderExists(IFolder folder)
Create a folder, if it does not already exist. |
boolean |
exists(IResource resource)
For some reason the exists() method on IResource is fundamentally not reliable. |
boolean |
fileExists(IFile file)
Check if a file exists in the file system. |
IFile |
getFile(IContainer parent,
String fileName)
Get a file whose parent is either a project or a folder |
static String |
getFilePath(IFile file)
Return the path of the given file |
IFolder |
getFolder(IContainer parent,
String folderName)
Get a folder whose parent is either a project or a folder |
String |
getFolderPath(IFolder folder)
Return the path of the given folder |
IFolder |
getOrCreateFolder(IContainer parentFolder,
String folderName)
Create a folder, if it does not already exist. |
IFolder |
getRenamedFolder(IFolder oldFolder,
String newFolderName)
Re-get a folder which has been renamed. |
static SystemResourceHelpers |
getResourceHelpers()
Return common instance if unique instance not required. |
IFile[] |
listFiles(IContainer projectOrFolder)
Return a list of child files in the given container |
String[] |
listFiles(IFolder folder,
String namePrefix,
String nameSuffix)
Return a list of names of files in the given container |
IFolder[] |
listFolders(IContainer projectOrFolder)
Return a list of child folders in the given container |
IFolder[] |
listFolders(IContainer projectOrFolder,
String fileName)
Return a list of child folders in the given container, which contain a file of the given name. |
String[] |
listFolders(IFolder folder,
String namePrefix,
String nameSuffix)
Return a list of names of folders in the given container |
void |
logException(String msg,
Exception exc)
|
void |
logMessage(String msg)
|
boolean |
moveFile(IFolder newParent,
IFile file)
Move a file |
boolean |
moveFolder(IFolder newParent,
IFolder folder)
Move a folder |
void |
refreshResource(IResource fileOrFolder)
Refresh a resource from disk. |
void |
refreshResourceShallow(IResource fileOrFolder)
Refresh a resource from disk. |
boolean |
renameFile(IFile file,
String newName)
Rename a file |
boolean |
renameFolder(IFolder folder,
String newName)
Rename a folder |
void |
renameResource(IResource fileOrFolder,
String newName)
Method to rename a folder or file and absorb the exception |
void |
setListValues(boolean filesOnly,
boolean foldersOnly,
String namePrefix,
String nameSuffix)
Method to set variables to affect the folder content subsetting |
static boolean |
testIfResourceInUse(IResource resource)
Test if a resource is in use, prior to attempting to rename or delete it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SystemResourceHelpers()
Method Detail |
---|
public static SystemResourceHelpers getResourceHelpers()
public void deleteResource(IResource fileOrFolder)
public void renameResource(IResource fileOrFolder, String newName)
public void refreshResource(IResource fileOrFolder)
public void refreshResourceShallow(IResource fileOrFolder)
public static boolean testIfResourceInUse(IResource resource)
public IFolder getOrCreateFolder(IContainer parentFolder, String folderName)
public boolean ensureFolderExists(IFolder folder)
public IFolder getFolder(IContainer parent, String folderName)
public IFolder getRenamedFolder(IFolder oldFolder, String newFolderName)
public boolean createFolder(IFolder folder)
public boolean deleteFolder(IFolder folder) throws Exception
Exception
public boolean renameFolder(IFolder folder, String newName) throws Exception
Exception
public boolean moveFolder(IFolder newParent, IFolder folder) throws Exception
Exception
public String getFolderPath(IFolder folder)
public IFolder[] listFolders(IContainer projectOrFolder)
projectOrFolder
- The parent container to search.
public IFolder[] listFolders(IContainer projectOrFolder, String fileName)
projectOrFolder
- The parent container to search.fileName
- The name of the file which must exist
in the folder in order to be included in the returned list
public String[] listFolders(IFolder folder, String namePrefix, String nameSuffix)
folder
- The folder to querynamePrefix
- Optional prefix all names should match. Can be null.nameSuffix
- Optional suffix all names should match. Can be null.public IFile getFile(IContainer parent, String fileName)
public boolean fileExists(IFile file)
public boolean deleteFile(IFile file) throws Exception
Exception
public boolean renameFile(IFile file, String newName) throws Exception
newName
- - the name name for the file, unqualified!
Exception
public boolean moveFile(IFolder newParent, IFile file) throws Exception
Exception
public static String getFilePath(IFile file)
public IFile[] listFiles(IContainer projectOrFolder)
projectOrFolder
- The parent container to search.
public String[] listFiles(IFolder folder, String namePrefix, String nameSuffix)
folder
- The folder to querynamePrefix
- Optional prefix all names should match. Can be null.nameSuffix
- Optional suffix all names should match. Can be null.public IFolder[] convertToFolderArray(Vector vector)
public IFile[] convertToFileArray(Vector vector)
public Vector convertToVector(String[] array)
public Vector convertToVectorAndStrip(String[] array, String namePrefix, String nameSuffix)
public void setListValues(boolean filesOnly, boolean foldersOnly, String namePrefix, String nameSuffix)
public boolean accept(File file)
accept
in interface FileFilter
public void logMessage(String msg)
public void logException(String msg, Exception exc)
public boolean exists(IResource resource)
|
RSE Release 3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |