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


Java IFileStore.toLocalFile方法代码示例

本文整理汇总了Java中org.eclipse.core.filesystem.IFileStore.toLocalFile方法的典型用法代码示例。如果您正苦于以下问题:Java IFileStore.toLocalFile方法的具体用法?Java IFileStore.toLocalFile怎么用?Java IFileStore.toLocalFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.core.filesystem.IFileStore的用法示例。


在下文中一共展示了IFileStore.toLocalFile方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFilePath

import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
private IPath getFilePath(ITextEditor textEditor) {
	IEditorInput editorInput = textEditor.getEditorInput();
	IFile file = ResourceUtil.getFile(editorInput);
	File localFile = null;
	if (file != null) {
		localFile = file.getLocation().toFile();
	} else if (editorInput instanceof FileStoreEditorInput) {
		FileStoreEditorInput fileStoreEditorInput = (FileStoreEditorInput) editorInput;
		URI uri = fileStoreEditorInput.getURI();
		IFileStore location = EFS.getLocalFileSystem().getStore(uri);
		try {
			localFile = location.toLocalFile(EFS.NONE, null);
		} catch (CoreException e) {
			// ignore
		}
	}
	if (localFile == null) {
		return null;
	} else {
		return Path.fromOSString(localFile.toString());
	}
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:23,代码来源:TextEditorBookmarkPropertiesProvider.java

示例2: resolve

import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
public URI resolve(IFileStore fileStore)
{
	URI uri = baseMapper.resolve(fileStore);
	if (uri == null)
	{
		try
		{
			File file = fileStore.toLocalFile(EFS.NONE, new NullProgressMonitor());
			if (file != null)
			{
				uri = baseMapper.resolve(EFSUtils.getLocalFileStore(file));
			}
		}
		catch (CoreException e)
		{
			IdeLog.logError(WebServerCorePlugin.getDefault(), e);
		}
	}
	return uri;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:21,代码来源:WorkspaceResolvingURIMapper.java

示例3: toFile

import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
/**
 * Returns the file or <code>null</code>
 * @param path
 * @return file or <code>null</code>
 * @throws CoreException
 */
public static File toFile(IPath path) throws CoreException {
	if (path==null){
		return null;
	}
	IFileStore fileStore = FileBuffers.getFileStoreAtLocation(path);
	if (fileStore==null){
		return null;
	}
	File file = null;
	file = fileStore.toLocalFile(EFS.NONE, NULL_MONITOR);
	return file;
}
 
开发者ID:de-jcup,项目名称:eclipse-bash-editor,代码行数:19,代码来源:BashEditorUtil.java

示例4: delete

import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
public void delete(IPath path) throws CoreException {
	IFileStore fileStore = FileBuffers.getFileStoreAtLocation(path);

	File file = null;
	file = fileStore.toLocalFile(EFS.NONE, NULL_MONITOR);
	try {
		getFileHelper().delete(file);
	} catch (IOException e) {
		EclipseUtil.throwCoreException("Was not able to delete path:"+path, e);
	}
}
 
开发者ID:de-jcup,项目名称:egradle,代码行数:12,代码来源:EclipseResourceHelper.java

示例5: toFile

import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
/**
 * Returns the file or <code>null</code>
 * @param path
 * @return file or <code>null</code>
 * @throws CoreException
 */
public File toFile(IPath path) throws CoreException {
	if (path==null){
		return null;
	}
	IFileStore fileStore = FileBuffers.getFileStoreAtLocation(path);

	File file = null;
	file = fileStore.toLocalFile(EFS.NONE, NULL_MONITOR);
	return file;
}
 
开发者ID:de-jcup,项目名称:egradle,代码行数:17,代码来源:EclipseResourceHelper.java

示例6: getLocalFile

import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
static File getLocalFile(URI uri) {
    if (uri != null) {
        try {
            IFileStore store = EFS.getStore(uri);
            if(store != null) {
                return store.toLocalFile(EFS.NONE,
                        new NullProgressMonitor());
            }
        } catch (CoreException e) {
            // ignore
        }
    }
    return null;
}
 
开发者ID:iloveeclipse,项目名称:skin4eclipse,代码行数:15,代码来源:EditorInfo.java

示例7: isRemoteURI

import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
/**
 * Make a best guess as to whether the IFileStore is local or remote. Should be local for LocalFile and
 * WorkspaceFile.
 * 
 * @param baseStore
 * @return
 */
private boolean isRemoteURI(IFileStore baseStore)
{
	try
	{
		return baseStore.toLocalFile(EFS.NONE, new NullProgressMonitor()) == null;
	}
	catch (CoreException e)
	{
		IdeLog.logError(HTMLPlugin.getDefault(), e);
	}
	return true;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:20,代码来源:HTMLContentAssistProcessor.java

示例8: resolveSource

import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
/**
 * Returns null if unable to resolve the path to a URI and grab the contents.
 */
public String resolveSource(String path, IProgressMonitor monitor) throws Exception
{
	SubMonitor sub = SubMonitor.convert(monitor, 100);
	URI uri = resolveURI(path);
	if (uri == null)
	{
		return null;
	}
	sub.worked(5);
	// get the filesystem that can handle the URI
	IFileStore store = getFileStore(uri);

	int options = EFS.CACHE;
	// If file is local no need to cache
	if (store.getFileSystem().equals(EFS.getLocalFileSystem()))
	{
		options = EFS.NONE;
	}
	// grab down a local copy
	File aFile = store.toLocalFile(options, sub.newChild(90));
	if (aFile == null || !aFile.exists())
	{
		// Need to pass up correct original filename and says that's the one that doesn't exist
		throw new FileNotFoundException(uri.toString());
	}
	// now read in the local copy
	return IOUtil.read(new FileInputStream(aFile));
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:32,代码来源:URIResolver.java

示例9: 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

示例10: execute

import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
public Object execute(ExecutionEvent event) throws ExecutionException
{
	if (event == null)
	{
		return Boolean.FALSE;
	}
	Object context = event.getApplicationContext();
	if (!(context instanceof IEvaluationContext))
	{
		return Boolean.FALSE;
	}

	IEvaluationContext evContext = (IEvaluationContext) event.getApplicationContext();
	Object input = evContext.getVariable(ISources.SHOW_IN_INPUT);
	if (input instanceof IFileEditorInput)
	{
		IFileEditorInput fei = (IFileEditorInput) input;
		return URIUtil.open(fei.getFile().getLocationURI());
	}

	if (input instanceof IURIEditorInput)
	{
		IURIEditorInput uriInput = (IURIEditorInput) input;
		return URIUtil.open(uriInput.getURI());
	}

	boolean result = Boolean.TRUE;
	@SuppressWarnings("unchecked")
	List<Object> selectedFiles = (List<Object>) evContext.getDefaultVariable();
	if (selectedFiles.isEmpty())
	{
		return Boolean.FALSE;
	}

	for (Object selected : selectedFiles)
	{
		IResource resource = null;
		if (selected instanceof IAdaptable)
		{
			resource = (IResource) ((IAdaptable) selected).getAdapter(IResource.class);
			if (resource != null)
			{
				result = result && URIUtil.open(resource.getLocationURI());
			}
			else
			{
				IFileStore fileStore = (IFileStore) ((IAdaptable) selected).getAdapter(IFileStore.class);
				try
				{
					if (fileStore != null && fileStore.toLocalFile(EFS.NONE, null) != null)
					{
						result = result && URIUtil.open(fileStore.toURI());
					}
				}
				catch (CoreException e)
				{
				}
			}
		}
	}
	return result;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:63,代码来源:OpenInFinderHandler.java


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