当前位置: 首页>>代码示例>>Java>>正文


Java IFileStore.fetchInfo方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:15,代码来源:EclipseFileViewer.java

示例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;
	}
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:15,代码来源:GotoExternalFileBookmark.java

示例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();
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:FileStoreFileBuffer.java

示例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();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:58,代码来源:RefactoringHistoryManager.java

示例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;
}
 
开发者ID:RepreZen,项目名称:KaiZen-OpenAPI-Editor,代码行数:7,代码来源:DocumentUtils.java

示例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();
//				}
			}
		}
	}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:52,代码来源:OpenDocumentEventProcessor.java

示例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();
						}
					}
				}
			});
		}
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:61,代码来源:LocalWebServerHttpRequestHandler.java

示例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;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:58,代码来源:HTMLContentAssistProcessor.java


注:本文中的org.eclipse.core.filesystem.IFileStore.fetchInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。