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


Java IFileStore.getChild方法代码示例

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


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

示例1: getChild

import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
/**
 * The default implementation of {@link IFileStore#getChild(IPath)}. Subclasses may override.
 *
 * @deprecated
 */
public IFileStore getChild(IPath path) {
  IFileStore result = this;
  for (int i = 0, imax = path.segmentCount(); i < imax; i++)
    result = result.getChild(path.segment(i));
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:12,代码来源:FileStore.java

示例2: getFileStore

import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
/**
 * The default implementation of {@link IFileStore#getFileStore(IPath)} Subclasses may override.
 *
 * @since org.eclipse.core.filesystem 1.2
 */
public IFileStore getFileStore(IPath path) {
  IFileStore result = this;
  String segment = null;
  for (int i = 0, imax = path.segmentCount(); i < imax; i++) {
    segment = path.segment(i);
    if (segment.equals(".")) // $NON-NLS-1$
    continue;
    else if (segment.equals("..") && result.getParent() != null) // $NON-NLS-1$
    result = result.getParent();
    else result = result.getChild(segment);
  }
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:FileStore.java

示例3: moveHistory

import org.eclipse.core.filesystem.IFileStore; //导入方法依赖的package包/类
/**
 * Moves the project history from the old project to the new one.
 *
 * @param oldProject the old project, which does not exist anymore
 * @param newProject the new project, which already exists
 * @param monitor the progress monitor to use
 */
private void moveHistory(
    final IProject oldProject, final IProject newProject, final IProgressMonitor monitor) {
  try {
    monitor.beginTask(RefactoringCoreMessages.RefactoringHistoryService_updating_history, 60);
    final IFileStore historyStore =
        EFS.getLocalFileSystem()
            .getStore(RefactoringCorePlugin.getDefault().getStateLocation())
            .getChild(NAME_HISTORY_FOLDER);
    final String oldName = oldProject.getName();
    final String newName = newProject.getName();
    final IFileStore oldStore = historyStore.getChild(oldName);
    if (oldStore
        .fetchInfo(
            EFS.NONE,
            new SubProgressMonitor(monitor, 10, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL))
        .exists()) {
      final IFileStore newStore = historyStore.getChild(newName);
      if (newStore
          .fetchInfo(
              EFS.NONE,
              new SubProgressMonitor(monitor, 10, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL))
          .exists())
        newStore.delete(
            EFS.NONE,
            new SubProgressMonitor(monitor, 20, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
      oldStore.move(
          newStore,
          EFS.OVERWRITE,
          new SubProgressMonitor(monitor, 20, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
    }
  } catch (CoreException exception) {
    RefactoringCorePlugin.log(exception);
  } finally {
    monitor.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:44,代码来源:RefactoringHistoryService.java

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

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


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