Java Code Examples for org.eclipse.core.filesystem.IFileSystem

The following examples show how to use org.eclipse.core.filesystem.IFileSystem. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: xds-ide   Source File: ResourceUtils.java    License: Eclipse Public License 1.0 6 votes vote down vote up
public static IFileStore toFileStore(URI uri) {
   	if (uri == null){
   		return null;
   	}
   	if (isFileScheme(uri)) {
   		return EFS.getLocalFileSystem().getStore(uri);
   	}
   	else {
   		try {
			IFileSystem fs = EFS.getFileSystem(uri.getScheme());
			return fs.getStore(uri);
		} catch (CoreException e) {
			LogHelper.logError(e);
		}
   		return null;
   	}
}
 
Example 2
Source Project: textuml   Source File: CompilationDirectorCLI.java    License: Eclipse Public License 1.0 6 votes vote down vote up
private void compile(IRepository repository, final String inputPathAsString, final String outputPathAsString)
		throws CoreException {
	IFileSystem localFS = EFS.getLocalFileSystem();
	final IFileStore outputPath = localFS.getStore(new Path(outputPathAsString));
	LocationContext context = new LocationContext(outputPath);
	final IFileStore sourcePath = localFS.getStore(new Path(inputPathAsString));
	if (!sourcePath.fetchInfo().exists()) {
		System.err.println(sourcePath + " does not exist");
		System.exit(1);
	}
	context.addSourcePath(sourcePath, outputPath);
	int mode = ICompilationDirector.CLEAN | ICompilationDirector.FULL_BUILD;
	if (Boolean.getBoolean("args.debug"))
		mode |= ICompilationDirector.DEBUG;
	IProblem[] problems = CompilationDirector.getInstance().compile(null, repository, context, mode, null);
	if (problems.length > 0) {
		MultiStatus parent = new MultiStatus(FrontEnd.PLUGIN_ID, IStatus.OK, "Problems occurred", null);
		for (int i = 0; i < problems.length; i++) {
			String message = problems[i].toString();
			parent.add(buildStatus(message, null));
		}
		LogUtils.log(parent);
	} else
		LogUtils.logInfo(FrontEnd.PLUGIN_ID, "Done", null);
}
 
Example 3
public static IFileSystem getInstance() {
	if (instance == null) {
		try {
			EFS.getFileSystem(SCHEME_VIRTUAL);
		} catch (CoreException e) {
			throw new RuntimeException(e);
		}
	}
	return instance;
}
 
Example 4
public static IFileSystem getInstance() {
	if (instance == null) {
		try {
			instance = EFS.getFileSystem(SCHEME_WORKSPACE);
		} catch (CoreException e) {
			throw new RuntimeException(e);
		}
	}
	return instance;
}
 
Example 5
Source Project: APICloud-Studio   Source File: URIResolver.java    License: GNU General Public License v3.0 5 votes vote down vote up
protected IFileStore getFileStore(URI uri) throws CoreException
{
	IFileSystem fileSystem = EFS.getFileSystem(uri.getScheme());
	if (fileSystem == null)
	{
		return EFS.getNullFileSystem().getStore(uri);
	}
	return fileSystem.getStore(uri);
}
 
Example 6
public IFileSystem getFileSystem() {
	return wrapped.getFileSystem();
}
 
Example 7
Source Project: xds-ide   Source File: ResourceUtils.java    License: Eclipse Public License 1.0 4 votes vote down vote up
public static IFileSystem getFileSystem(URI uri) throws CoreException {
	return EFS.getFileSystem(uri.getScheme());
}
 
Example 8
Source Project: tlaplus   Source File: UIHelper.java    License: MIT License 4 votes vote down vote up
/**
 * @param file The file to open
 * @param name A human readable name for the input file. If the file name is to be used, pass {@link File#getName()}
 * @see UIHelper#openEditorUnchecked(String, IEditorInput, boolean)
 */
public static IEditorPart openEditorUnchecked(final String editorId, final File file, final String name, final boolean activate) throws PartInitException {
	final IFileSystem localFileSystem = EFS.getLocalFileSystem();
	final IFileStore fromLocalFile = localFileSystem.fromLocalFile(file);
	return openEditorUnchecked(editorId, new NamedFileStoreEditorInput(fromLocalFile, name), activate);
}
 
Example 9
@Override
public IFileSystem getFileSystem() {
	return WorkspaceFileSystem.getInstance();
}
 
Example 10
Source Project: bonita-studio   Source File: PlatformUtil.java    License: GNU General Public License v2.0 4 votes vote down vote up
public static IFileSystem getFileSystem() {
    if (fileSystem == null) {
        fileSystem = EFS.getLocalFileSystem();
    }
    return fileSystem;
}