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


Java IFileStore类代码示例

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


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

示例1: editFile

import org.eclipse.core.filesystem.IFileStore; //导入依赖的package包/类
public static IEditorPart editFile(File file, boolean preferIdeEditor) throws IOException, PartInitException {

        if (file == null || !file.exists() || !file.isFile() || !file.canRead()) {
            throw new IOException("Invalid file: '" + file + "'");
        }

        IWorkbench workBench = PlatformUI.getWorkbench();
        IWorkbenchPage page = workBench.getActiveWorkbenchWindow().getActivePage();
        IPath location = Path.fromOSString(file.getAbsolutePath());

        IFileStore fileStore = EFS.getLocalFileSystem().getStore(location);
        FileStoreEditorInput fileStoreEditorInput = new FileStoreEditorInput(fileStore);

        String editorId = IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID;
        if (preferIdeEditor) {
            IEditorDescriptor editorDescriptor = workBench.getEditorRegistry().getDefaultEditor(file.getName());
            if (editorDescriptor != null) {
                editorId = editorDescriptor.getId();
            }
        }

        return page.openEditor(fileStoreEditorInput, editorId);
    }
 
开发者ID:baloise,项目名称:eZooKeeper,代码行数:24,代码来源:FileEditor.java

示例2: saveOpenTmpSqlEditor

import org.eclipse.core.filesystem.IFileStore; //导入依赖的package包/类
/**
 * Saves the content as a temp-file, opens it using SQL-editor
 * and ensures that UTF-8 is used for everything.
 */
public static void saveOpenTmpSqlEditor(String content, String filenamePrefix) throws IOException, CoreException {
    Log.log(Log.LOG_INFO, "Creating file " + filenamePrefix); //$NON-NLS-1$
    Path path = Files.createTempFile(filenamePrefix + '_', ".sql"); //$NON-NLS-1$
    Files.write(path, content.getBytes(StandardCharsets.UTF_8));
    IFileStore externalFile = EFS.getLocalFileSystem().fromLocalFile(path.toFile());
    IEditorInput input = new FileStoreEditorInput(externalFile);

    IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
            .openEditor(input, EDITOR.SQL);
    if (part instanceof ITextEditor) {
        IDocumentProvider prov = ((ITextEditor) part).getDocumentProvider();
        if (prov instanceof TextFileDocumentProvider) {
            ((TextFileDocumentProvider) prov).setEncoding(input, ApgdiffConsts.UTF_8);
            prov.resetDocument(input);
        }
    }
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:22,代码来源:FileUtilsUi.java

示例3: openManifestForProject

import org.eclipse.core.filesystem.IFileStore; //导入依赖的package包/类
public static void openManifestForProject(IProject project) {
	File fileToOpen = new File(project.getFile("META-INF/MANIFEST.MF")
			.getLocation().toOSString());
	if (fileToOpen.exists() && fileToOpen.isFile()) {
		IFileStore fileStore = EFS.getLocalFileSystem().getStore(
				fileToOpen.toURI());
		IWorkbenchPage page = PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow().getActivePage();

		try {
			IDE.openEditorOnFileStore(page, fileStore);
		} catch (PartInitException e) {
			// Put your exception handler here if you wish to
		}
	} else {
		// Do something if the file does not exist
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:19,代码来源:OpenEditor.java

示例4: openFile

import org.eclipse.core.filesystem.IFileStore; //导入依赖的package包/类
public static void openFile(File file) {
	if (file.exists() && file.isFile()) {
		IFileStore fileStore = EFS.getLocalFileSystem().getStore(
				file.toURI());
		IWorkbenchPage page = PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow().getActivePage();

		try {
			IDE.openEditorOnFileStore(page, fileStore);
		} catch (PartInitException e) {
			// Put your exception handler here if you wish to
		}
	} else {
		// Do something if the file does not exist
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:17,代码来源:OpenEditor.java

示例5: convertToXML

import org.eclipse.core.filesystem.IFileStore; //导入依赖的package包/类
/**
	 * Convert UI objects to target xml.
	 *
	 * @param container
	 * @param validate
	 * @param outPutFile
	 * @param externalOutputFile
	 * @throws Exception
	 */
	public void convertToXML(Container container, boolean validate, IFile outPutFile,  IFileStore externalOutputFile) throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException{
		LOGGER.debug("Creating converter based on component");
			Graph graph = new ObjectFactory().createGraph();
			graph.setUniqueJobId(container.getUniqueJobId());
			graph.setName(getGraphName(outPutFile,externalOutputFile));
			List<Component> children = container.getUIComponentList();
			unknownComponentLists = new ArrayList<>();
			if(children != null && !children.isEmpty()){
				for (Component component : children) {
					Converter converter = ConverterFactory.INSTANCE.getConverter(component);
//					if(converter ==null){
//						unknownComponentLists.add(component);
//						continue;
//					}
					converter.prepareForXML();
					TypeBaseComponent typeBaseComponent = converter.getComponent();
					graph.getInputsOrOutputsOrStraightPulls().add(typeBaseComponent);
				}
			}
//			To-do will be removed in future
//			processUnknownComponents();
			graph.setRuntimeProperties(getRuntimeProperties(container));
			marshall(graph, validate, outPutFile,externalOutputFile);
	}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:34,代码来源:ConverterUtil.java

示例6: marshall

import org.eclipse.core.filesystem.IFileStore; //导入依赖的package包/类
/**
 * Marshall UI objects to target XML.
 *
 * @param graph
 * @param validate
 * @param outPutFile
 * @param externalOutputFile
 */
private void marshall(Graph graph, boolean validate, IFile outPutFile, IFileStore externalOutputFile) {
	LOGGER.debug("Marshaling generated object into target XML");
	ByteArrayOutputStream out = null;
	try {
		 if (outPutFile!=null)
			 storeFileIntoWorkspace(graph, validate, outPutFile, out);
		else if(externalOutputFile!=null)
			storeFileIntoLocalFileSystem(graph, validate, externalOutputFile, out);
		else
			validateJobState(graph, validate, externalOutputFile, out);			
		
	} catch (JAXBException |CoreException| IOException exception) {
		LOGGER.error("Failed in marshal", exception);
	}finally{
		if(out != null){
			try {
				out.close();
			} catch (IOException e) {
			LOGGER.error("ERROR WHILE CLOSING OUT STREAM OF TARGETXML"+e);
			}
		}
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:32,代码来源:ConverterUtil.java

示例7: storeEditorInput

import org.eclipse.core.filesystem.IFileStore; //导入依赖的package包/类
/**
 * Storing FileStorageEditor input into Ifile
 * 
 * Generate Container from xml
 * @throws IOException
 */	
@Override
public void storeEditorInput() throws IOException, CoreException {
	logger.debug("storeEditorInput - Storing FileStorageEditor input into Ifile");
	File file = new File(fileStorageEditorInput.getToolTipText());
	FileOutputStream fsout = new FileOutputStream(file);
	ByteArrayOutputStream arrayOutputStream=new ByteArrayOutputStream();
	CanvasUtils.INSTANCE.fromObjectToXML(
			eltGraphicalEditorInstance.getContainer(),arrayOutputStream);
	fsout.write(arrayOutputStream.toByteArray());
	arrayOutputStream.close();
	fsout.close();
	eltGraphicalEditorInstance.getCommandStack().markSaveLocation();
	eltGraphicalEditorInstance.setDirty(false);
	IFileStore fileStore = EFS.getLocalFileSystem().fromLocalFile(file);
	this.eltGraphicalEditorInstance.genrateTargetXml(null,fileStore,null);

}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:24,代码来源:FileStorageEditorContainer.java

示例8: generateTargetXMLInLocalFileSystem

import org.eclipse.core.filesystem.IFileStore; //导入依赖的package包/类
private void generateTargetXMLInLocalFileSystem(IFileStore fileStore, Container container) {

		try {
			if(container!=null)
				ConverterUtil.INSTANCE.convertToXML(container, false, null,fileStore);
			else
				ConverterUtil.INSTANCE.convertToXML(this.container, false,null,fileStore);
		} catch (EngineException eexception) {
			logger.warn("Failed to create the engine xml", eexception);
			MessageDialog.openError(Display.getDefault().getActiveShell(), "Failed to create the engine xml", eexception.getMessage());
		}catch (InstantiationException| IllegalAccessException| InvocationTargetException| NoSuchMethodException exception) {
			logger.error("Failed to create the engine xml", exception);
			Status status = new Status(IStatus.ERROR, "hydrograph.ui.graph",
					"Failed to create Engine XML " + exception.getMessage());
			StatusManager.getManager().handle(status, StatusManager.SHOW);
		}
		
	}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:19,代码来源:ELTGraphicalEditor.java

示例9: openEditor

import org.eclipse.core.filesystem.IFileStore; //导入依赖的package包/类
private Container openEditor(IPath jobFilePath) throws CoreException {
	IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
	if (!isJobAlreadyOpen(jobFilePath)) {
		if (ResourcesPlugin.getWorkspace().getRoot().getFile(jobFilePath).exists()) {
			IFile iFile = ResourcesPlugin.getWorkspace().getRoot().getFile(jobFilePath);
			IDE.openEditor(page, iFile);
	} else {
		if (jobFilePath.toFile().exists()) {
			IFileStore fileStore = EFS.getLocalFileSystem().fromLocalFile(jobFilePath.toFile());
			IEditorInput store = new FileStoreEditorInput(fileStore);
			IDE.openEditorOnFileStore(page, fileStore);
		}
	}

	return SubJobUtility.getCurrentEditor().getContainer();
	}else
		MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error",
				"Unable to open subjob : "+jobFilePath.lastSegment()+" Subjob is already open \n" +
						"Please close the job and retry");
	return null;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:22,代码来源:SubJobOpenAction.java

示例10: getEditorInput

import org.eclipse.core.filesystem.IFileStore; //导入依赖的package包/类
@Override
public IEditorInput getEditorInput(Object element) {
	if (element instanceof ILineBreakpoint) {
		return new FileEditorInput((IFile) ((ILineBreakpoint) element).getMarker().getResource());
	}
	IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(element.toString()));
	IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
	IFile[] files = root.findFilesForLocationURI(fileStore.toURI());
	if (files != null) {
		for (IFile file : files) {
			if (file.exists()) {
				return new FileEditorInput(file);
			}
		}
	}
	return new FileStoreEditorInput(fileStore);
}
 
开发者ID:tracymiranda,项目名称:dsp4e,代码行数:18,代码来源:DSPDebugModelPresentation.java

示例11: handleFileLink

import org.eclipse.core.filesystem.IFileStore; //导入依赖的package包/类
private IHyperlink[] handleFileLink(IRegion lineInfo, GradleHyperLinkResult result) {
	try {
		File folder = editorFile.getParentFile();
		String fileName = result.linkContent;
		
		File target = new File(folder, fileName); 
		if (!target.exists()) {
			target = new File(fileName);
		}
		if (!target.exists()) {
			return null;
		}

		IFileStore fileStore = EFS.getLocalFileSystem().getStore(target.toURI());
		if (fileStore==null){
			return null;
		}
		IRegion urlRegion = new Region(lineInfo.getOffset() + result.linkOffsetInLine, result.linkLength);
		GradleFileHyperlink	gradleFileHyperlink = new GradleFileHyperlink(urlRegion, fileStore);
		return new IHyperlink[] { gradleFileHyperlink };
	} catch (RuntimeException e) {
		return null;
	}
}
 
开发者ID:de-jcup,项目名称:egradle,代码行数:25,代码来源:GradleHyperlinkDetector.java

示例12: getEditorId

import org.eclipse.core.filesystem.IFileStore; //导入依赖的package包/类
private String getEditorId(IFileStore file) {
//		IWorkbench workbench= fWindow.getWorkbench();
		IWorkbench workbench = PlatformUI.getWorkbench();
		IEditorRegistry editorRegistry= workbench.getEditorRegistry();
		IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(file.getName(), getContentType(file));

		// check the OS for in-place editor (OLE on Win32)
		if (descriptor == null && editorRegistry.isSystemInPlaceEditorAvailable(file.getName()))
			descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);
		
		// check the OS for external editor
		if (descriptor == null && editorRegistry.isSystemExternalEditorAvailable(file.getName()))
			descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
		
		if (descriptor != null)
			return descriptor.getId();
		
		return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
	}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:20,代码来源:SVNConflictResolver.java

示例13: getEditorId

import org.eclipse.core.filesystem.IFileStore; //导入依赖的package包/类
private String getEditorId(IFileStore file) {
	IWorkbench workbench = PlatformUI.getWorkbench();
	IEditorRegistry editorRegistry= workbench.getEditorRegistry();
	IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(file.getName(), getContentType(file));

	// check the OS for in-place editor (OLE on Win32)
	if (descriptor == null && editorRegistry.isSystemInPlaceEditorAvailable(file.getName()))
		descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);
	
	// check the OS for external editor
	if (descriptor == null && editorRegistry.isSystemExternalEditorAvailable(file.getName()))
		descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
	
	if (descriptor != null)
		return descriptor.getId();
	
	return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:19,代码来源:SVNConflictResolver.java

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

示例15: getTypeScriptFile

import org.eclipse.core.filesystem.IFileStore; //导入依赖的package包/类
private ITypeScriptFile getTypeScriptFile(IDocument document) {
	IResource file = EditorUtils.getResource(this);
	if (file != null) {
		IIDETypeScriptProject tsProject;
		try {
			tsProject = TypeScriptResourceUtil.getTypeScriptProject(file.getProject());
			return tsProject.openFile(file, document);
		} catch (Exception e) {
			Trace.trace(Trace.SEVERE, "Error while getting typscript file", e);
			return null;
		}
	}
	IFileStore fs = EditorUtils.getFileStore(this);
	if (fs != null) {
		// TODO
	}
	return null;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:19,代码来源:TypeScriptEditor.java


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