org.eclipse.core.filesystem.IFileSystem Java Examples

The following examples show how to use org.eclipse.core.filesystem.IFileSystem. 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 File: ResourceUtils.java    From xds-ide with 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 File: CompilationDirectorCLI.java    From textuml with 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
Source File: VirtualFileSystem.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public static IFileSystem getInstance() {
	if (instance == null) {
		try {
			EFS.getFileSystem(SCHEME_VIRTUAL);
		} catch (CoreException e) {
			throw new RuntimeException(e);
		}
	}
	return instance;
}
 
Example #4
Source File: WorkspaceFileSystem.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
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 File: URIResolver.java    From APICloud-Studio with 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
Source File: FileStoreNotificationWrapper.java    From orion.server with Eclipse Public License 1.0 4 votes vote down vote up
public IFileSystem getFileSystem() {
	return wrapped.getFileSystem();
}
 
Example #7
Source File: ResourceUtils.java    From xds-ide with 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 File: UIHelper.java    From tlaplus with 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
Source File: WorkspaceFile.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
@Override
public IFileSystem getFileSystem() {
	return WorkspaceFileSystem.getInstance();
}
 
Example #10
Source File: PlatformUtil.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public static IFileSystem getFileSystem() {
    if (fileSystem == null) {
        fileSystem = EFS.getLocalFileSystem();
    }
    return fileSystem;
}