本文整理汇总了Java中org.eclipse.core.filesystem.IFileStore.fetchInfo方法的典型用法代码示例。如果您正苦于以下问题:Java IFileStore.fetchInfo方法的具体用法?Java IFileStore.fetchInfo怎么用?Java IFileStore.fetchInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.filesystem.IFileStore
的用法示例。
在下文中一共展示了IFileStore.fetchInfo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEditorInput
import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
private static IEditorInput getEditorInput(final String path) {
final IFile file = Resources.getFileForLocation(path);
if (file != null) {
return new FileEditorInput(file);
} else {
// file is outside of workbench
final IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(path));
final IFileInfo fetchInfo = fileStore.fetchInfo();
if (fetchInfo.isDirectory() || !fetchInfo.exists()) {
return null; // ensure the file exists
}
return new FileStoreEditorInput(fileStore);
}
}
示例2: openEditor
import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
private IEditorPart openEditor(IWorkbenchWindow window, IPath filePath) {
IFileStore fileStore = EFS.getLocalFileSystem().getStore(filePath);
IFileInfo fetchInfo = fileStore.fetchInfo();
if (fetchInfo.isDirectory() || !fetchInfo.exists()) {
return null;
}
IWorkbenchPage page = window.getActivePage();
try {
IEditorPart editorPart = IDE.openEditorOnFileStore(page, fileStore);
return editorPart;
} catch (PartInitException e) {
return null;
}
}
示例3: create
import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
public void create(IFileStore fileStore, IProgressMonitor monitor) throws CoreException {
IFileInfo info = fileStore.fetchInfo();
fFileStore = fileStore;
if (fLocation == null) fLocation = URIUtil.toPath(fileStore.toURI());
initializeFileBufferContent(monitor);
if (info.exists()) fSynchronizationStamp = info.getLastModified();
addFileBufferContentListeners();
}
示例4: 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();
}
}
示例5: getExternalFile
import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
public static IFileStore getExternalFile(IPath path) {
IFileStore fileStore = EFS.getLocalFileSystem().getStore(path);
IFileInfo fileInfo = fileStore.fetchInfo();
return fileInfo != null && fileInfo.exists() ? fileStore : null;
}
示例6: openFiles
import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
public void openFiles() {
if (filesToOpen.isEmpty())
return;
String[] filePaths = filesToOpen
.toArray(new String[filesToOpen.size()]);
filesToOpen.clear();
for (String path : filePaths)
{
System.out.println("Processing " + path);
if (path.toLowerCase().endsWith(".jrxml"))
{
java.io.File file = new java.io.File(path);
if (!file.exists()) continue;
IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(file.getParent()));
fileStore = fileStore.getChild(file.getName());
IFileInfo fetchInfo = fileStore.fetchInfo();
if (!fetchInfo.isDirectory() && fetchInfo.exists()) {
IWorkbenchWindow window=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
try {
IDE.openEditorOnFileStore(page, fileStore);
} catch (PartInitException e) {
}
}
// IFile fileToBeOpened = (IFile) EFS.getLocalFileSystem().getStore(new Path(path));
// IEditorInput editorInput = new FileEditorInput(fileToBeOpened);
//
// try {
// IDE.openEditor(page, fileToBeOpened);
//
// IEditorPart part = page.openEditor(editorInput, "com.jaspersoft.studio.editor.JrxmlEditor");
// System.out.println(part);
//
// } catch (PartInitException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
}
}
}
示例7: handleRequest
import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
private void handleRequest(HttpRequest request, HttpResponse response, boolean head) throws HttpException,
IOException, CoreException, URISyntaxException
{
String target = URLDecoder.decode(request.getRequestLine().getUri(), IOUtil.UTF_8);
URI uri = URIUtil.fromString(target);
IFileStore fileStore = uriMapper.resolve(uri);
IFileInfo fileInfo = fileStore.fetchInfo();
if (fileInfo.isDirectory())
{
fileInfo = getIndex(fileStore);
if (fileInfo.exists())
{
fileStore = fileStore.getChild(fileInfo.getName());
}
}
if (!fileInfo.exists())
{
response.setStatusCode(HttpStatus.SC_NOT_FOUND);
response.setEntity(createTextEntity(MessageFormat.format(
Messages.LocalWebServerHttpRequestHandler_FILE_NOT_FOUND, uri.getPath())));
}
else if (fileInfo.isDirectory())
{
response.setStatusCode(HttpStatus.SC_FORBIDDEN);
response.setEntity(createTextEntity(Messages.LocalWebServerHttpRequestHandler_FORBIDDEN));
}
else
{
response.setStatusCode(HttpStatus.SC_OK);
if (head)
{
response.setEntity(null);
}
else
{
File file = fileStore.toLocalFile(EFS.NONE, new NullProgressMonitor());
final File temporaryFile = (file == null) ? fileStore.toLocalFile(EFS.CACHE, new NullProgressMonitor())
: null;
response.setEntity(new NFileEntity((file != null) ? file : temporaryFile, getMimeType(fileStore
.getName()))
{
@Override
public void close() throws IOException
{
try
{
super.close();
}
finally
{
if (temporaryFile != null && !temporaryFile.delete())
{
temporaryFile.deleteOnExit();
}
}
}
});
}
}
}
示例8: 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;
}