本文整理汇总了Java中org.eclipse.core.filesystem.IFileStore.childStores方法的典型用法代码示例。如果您正苦于以下问题:Java IFileStore.childStores方法的具体用法?Java IFileStore.childStores怎么用?Java IFileStore.childStores使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.filesystem.IFileStore
的用法示例。
在下文中一共展示了IFileStore.childStores方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFiles
import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
/**
* getFiles
*
* @param file
* @param recurse
* @param list
* @param includeCloakedFiles
* @param monitor
* the progress monitor to use for reporting progress to the user. It is the caller's responsibility to
* call done() on the given monitor. Accepts null, indicating that no progress should be reported and
* that the operation cannot be cancelled.
* @throws CoreException
*/
private static void getFiles(IFileStore file, boolean recurse, List<IFileStore> list, boolean includeCloakedFiles,
IProgressMonitor monitor) throws CoreException
{
if (file == null)
{
return;
}
if (monitor != null)
{
Policy.checkCanceled(monitor);
}
if (isFolder(file, monitor))
{
IFileStore[] children = file.childStores(EFS.NONE, monitor);
if (children != null)
{
SubMonitor progress = SubMonitor.convert(monitor, children.length);
boolean addingFile;
for (IFileStore child : children)
{
Policy.checkCanceled(progress);
addingFile = false;
if (includeCloakedFiles || !CloakingUtils.isFileCloaked(child))
{
list.add(child);
addingFile = true;
}
if (recurse && addingFile && isFolder(child, progress))
{
getFiles(child, recurse, list, includeCloakedFiles, progress.newChild(1));
}
}
}
}
}
示例2: removeIndexTree
import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
/**
* Removes the refactoring history index tree spanned by the specified file store.
*
* @param store the file store spanning the history index tree
* @param monitor the progress monitor to use
* @param task the task label to use
* @throws CoreException if an error occurs while removing the index tree
*/
private static void removeIndexTree(
final IFileStore store, final IProgressMonitor monitor, final String task)
throws CoreException {
try {
monitor.beginTask(task, 16);
final IFileInfo info =
store.fetchInfo(
EFS.NONE,
new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
if (info.isDirectory()) {
if (info.getName().equalsIgnoreCase(RefactoringHistoryService.NAME_HISTORY_FOLDER)) return;
final IFileStore[] stores =
store.childStores(
EFS.NONE,
new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
final IProgressMonitor subMonitor =
new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL);
try {
subMonitor.beginTask(
RefactoringCoreMessages.RefactoringHistoryService_updating_history, stores.length);
for (int index = 0; index < stores.length; index++) {
final IFileInfo current =
stores[index].fetchInfo(
EFS.NONE,
new SubProgressMonitor(
subMonitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
if (current.isDirectory()) {
final char[] characters = stores[index].getName().toCharArray();
for (int offset = 0; offset < characters.length; offset++) {
if (Character.isDigit(characters[offset])) return;
else continue;
}
}
}
} finally {
subMonitor.done();
}
}
final IFileStore parent = store.getParent();
store.delete(
0, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
removeIndexTree(
parent,
new SubProgressMonitor(monitor, 12, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL),
task);
} finally {
monitor.done();
}
}
示例3: suggestChildrenOfFileStore
import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
/**
* @param offset
* @param valuePrefix
* @param editorStoreURI
* The URI of the current file. We use this to eliminate it from list of possible completions.
* @param parent
* The parent we're grabbing children for.
* @return
* @throws CoreException
*/
protected List<ICompletionProposal> suggestChildrenOfFileStore(int offset, String valuePrefix, URI editorStoreURI,
IFileStore parent) throws CoreException
{
IFileStore[] children = parent.childStores(EFS.NONE, new NullProgressMonitor());
if (children == null || children.length == 0)
{
return Collections.emptyList();
}
List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
Image[] userAgentIcons = this.getAllUserAgentIcons();
for (IFileStore f : children)
{
String name = f.getName();
// Don't include the current file in the list
// FIXME this is a possible perf issue. We really only need to check for editor store on local URIs
if (name.charAt(0) == '.' || f.toURI().equals(editorStoreURI))
{
continue;
}
if (valuePrefix != null && valuePrefix.length() > 0 && !name.startsWith(valuePrefix))
{
continue;
}
IFileInfo info = f.fetchInfo();
boolean isDir = false;
if (info.isDirectory())
{
isDir = true;
}
// build proposal
int replaceOffset = offset;
int replaceLength = 0;
if (this._replaceRange != null)
{
replaceOffset = this._replaceRange.getStartingOffset();
replaceLength = this._replaceRange.getLength();
}
CommonCompletionProposal proposal = new URIPathProposal(name, replaceOffset, replaceLength, isDir,
userAgentIcons);
proposals.add(proposal);
}
return proposals;
}