Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2007-12-31 20:31:08 +0000
committerDoug Schaefer2007-12-31 20:31:08 +0000
commite8019df50455830ddc2b4079aad378335d3f72a2 (patch)
tree6b685c711f461b9078f86f7334fd91e1563ddd58 /core/org.eclipse.cdt.core
parent0d50d5b2223b085f5d1855e5b461f1fb5e26395d (diff)
downloadorg.eclipse.cdt-e8019df50455830ddc2b4079aad378335d3f72a2.tar.gz
org.eclipse.cdt-e8019df50455830ddc2b4079aad378335d3f72a2.tar.xz
org.eclipse.cdt-e8019df50455830ddc2b4079aad378335d3f72a2.zip
Flexible File System. Get project creation working by replacing the use of IPath for project location with URIs. Also move FFS to its own plugin to avoid early initialization of the CDT.
Diffstat (limited to 'core/org.eclipse.cdt.core')
-rw-r--r--core/org.eclipse.cdt.core/META-INF/MANIFEST.MF1
-rw-r--r--core/org.eclipse.cdt.core/plugin.xml9
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ffs/FFSEcprojFile.java45
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ffs/FFSFileStore.java157
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ffs/FFSFileSystem.java120
5 files changed, 0 insertions, 332 deletions
diff --git a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
index a5e283c9195..ef275abe466 100644
--- a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
@@ -46,7 +46,6 @@ Export-Package: org.eclipse.cdt.core,
org.eclipse.cdt.internal.core.dom.parser.c;x-friends:="org.eclipse.cdt.refactoring",
org.eclipse.cdt.internal.core.dom.parser.cpp;x-friends:="org.eclipse.cdt.ui,org.eclipse.cdt.refactoring",
org.eclipse.cdt.internal.core.envvar,
- org.eclipse.cdt.internal.core.ffs;x-friends:="org.eclipse.cdt.ui",
org.eclipse.cdt.internal.core.index;x-friends:="org.eclipse.cdt.ui",
org.eclipse.cdt.internal.core.index.provider,
org.eclipse.cdt.internal.core.language,
diff --git a/core/org.eclipse.cdt.core/plugin.xml b/core/org.eclipse.cdt.core/plugin.xml
index 252553918fb..9ec93e4f893 100644
--- a/core/org.eclipse.cdt.core/plugin.xml
+++ b/core/org.eclipse.cdt.core/plugin.xml
@@ -704,14 +704,5 @@
<simple name="appName"/>
</processType>
</extension>
- <extension
- point="org.eclipse.core.filesystem.filesystems">
- <filesystem
- scheme="ecproj">
- <run
- class="org.eclipse.cdt.internal.core.ffs.FFSFileSystem">
- </run>
- </filesystem>
- </extension>
</plugin>
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ffs/FFSEcprojFile.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ffs/FFSEcprojFile.java
deleted file mode 100644
index c0addc1c63d..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ffs/FFSEcprojFile.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2007 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - Initial API and implementation
- **********************************************************************/
-
-package org.eclipse.cdt.internal.core.ffs;
-
-import java.net.URI;
-
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * @author Doug Schaefer
- *
- * Contents of the ecproj file.
- */
-public class FFSEcprojFile {
-
- private final URI uri;
- private final IFileStore root;
- private final FFSFileSystem fileSystem;
-
- public FFSEcprojFile(FFSFileSystem fileSystem, URI uri) throws CoreException {
- this.uri = uri;
- this.fileSystem = fileSystem;
- this.root = EFS.getStore(uri);
- }
-
- public FFSFileSystem getFileSystem() {
- return fileSystem;
- }
-
- public IFileStore getRoot() {
- return new FFSFileStore(this, null, root);
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ffs/FFSFileStore.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ffs/FFSFileStore.java
deleted file mode 100644
index 64752450d0f..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ffs/FFSFileStore.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2007 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - Initial API and implementation
- **********************************************************************/
-
-package org.eclipse.cdt.internal.core.ffs;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URI;
-
-import org.eclipse.core.filesystem.IFileInfo;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.filesystem.IFileSystem;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * @author Doug Schaefer
- *
- */
-public class FFSFileStore implements org.eclipse.core.filesystem.IFileStore {
-
- private final IFileStore target;
- private final IFileStore parent;
- private final FFSEcprojFile ecprojFile;
-
- public FFSFileStore(FFSEcprojFile ecprojFile, IFileStore parent, IFileStore target) {
- this.ecprojFile = ecprojFile;
- this.parent = parent;
- this.target = target;
- }
-
- public IFileInfo[] childInfos(int options, IProgressMonitor monitor) throws CoreException {
- return target.childInfos(options, monitor);
- }
-
- public String[] childNames(int options, IProgressMonitor monitor) throws CoreException {
- // TODO child handling
- return target.childNames(options, monitor);
- }
-
- public IFileStore[] childStores(int options, IProgressMonitor monitor) throws CoreException {
- IFileStore[] targetChildren = target.childStores(options, monitor);
- IFileStore[] children = new IFileStore[targetChildren.length];
- for (int i = 0; i < children.length; ++i)
- children[i] = new FFSFileStore(ecprojFile, this, targetChildren[i]);
- return children;
- }
-
- public void copy(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException {
- target.copy(destination, options, monitor);
- }
-
- public void delete(int options, IProgressMonitor monitor) throws CoreException {
- target.delete(options, monitor);
- }
-
- public IFileInfo fetchInfo() {
- return target.fetchInfo();
- }
-
- public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException {
- return target.fetchInfo(options, monitor);
- }
-
- public IFileStore getChild(IPath path) {
- IFileStore store = getChild(path.segment(0));
- if (store == null)
- return null;
- return store.getChild(path.removeFirstSegments(1));
- }
-
- public IFileStore getChild(String name) {
- // TODO child handling
- return target.getChild(name);
- }
-
- public IFileSystem getFileSystem() {
- return ecprojFile.getFileSystem();
- }
-
- public String getName() {
- return target.getName();
- }
-
- public IFileStore getParent() {
- return parent;
- }
-
- public boolean isParentOf(IFileStore other) {
- if (other == null || !(other instanceof FFSFileStore))
- return false;
-
- if (other.equals(this))
- return true;
-
- return isParentOf(other.getParent());
- }
-
- public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException {
- return target.mkdir(options, monitor);
- }
-
- public void move(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException {
- // TODO what happens if destination is a different target file system?
- target.move(destination, options, monitor);
- }
-
- public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException {
- return target.openInputStream(options, monitor);
- }
-
- public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException {
- return target.openOutputStream(options, monitor);
- }
-
- public void putInfo(IFileInfo info, int options, IProgressMonitor monitor) throws CoreException {
- target.putInfo(info, options, monitor);
- }
-
- public File toLocalFile(int options, IProgressMonitor monitor) throws CoreException {
- return target.toLocalFile(options, monitor);
- }
-
- public URI toURI() {
- // TODO
- // need base URI from file system
- // then add in the child path as the query
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public Object getAdapter(Class adapter) {
- if (adapter == IFileStore.class || adapter == FFSFileStore.class)
- return this;
-
- return null;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof FFSFileStore)
- return target.equals(((FFSFileStore)obj).target);
- else
- return target.equals(obj);
- }
-
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ffs/FFSFileSystem.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ffs/FFSFileSystem.java
deleted file mode 100644
index 71c5295f886..00000000000
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ffs/FFSFileSystem.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2007 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- **********************************************************************/
-
-package org.eclipse.cdt.internal.core.ffs;
-
-import java.io.File;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.filesystem.IFileTree;
-import org.eclipse.core.filesystem.provider.FileSystem;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-
-/**
- * @author Doug Schaefer
- *
- * This is the flexible file system. It allows you to add and exclude
- * entries from from a given directory.
- *
- * The URI's for this system are as follows:
- *
- * ecproj:///<ecproj file location>?<logical path>#<ecproj file schema>
- *
- * For example:
- *
- * ecproj:///c:/Eclipse/workspace/s?.project
- *
- */
-public class FFSFileSystem extends FileSystem {
-
- private Map<URI, FFSEcprojFile> ecprojFiles = new HashMap<URI, FFSEcprojFile>();
-
- private synchronized FFSEcprojFile getEcprojFile(FFSFileSystem fileSystem, URI uri) throws CoreException {
- uri.normalize();
- FFSEcprojFile ecprojFile = ecprojFiles.get(uri);
- if (ecprojFile == null) {
- ecprojFile = new FFSEcprojFile(fileSystem, uri);
- ecprojFiles.put(uri, ecprojFile);
- }
- return ecprojFile;
- }
-
- public IFileStore getStore(URI uri) {
- try {
- String ecprojScheme = uri.getFragment();
- if (ecprojScheme == null)
- ecprojScheme = EFS.SCHEME_FILE;
-
- URI ecprojURI = new URI(ecprojScheme, uri.getAuthority(), uri.getPath(), null, null);
- FFSEcprojFile ecprojFile = getEcprojFile(this, ecprojURI);
-
- IFileStore root = ecprojFile.getRoot();
- String pathStr = uri.getQuery();
- if (pathStr == null)
- return root;
- IPath path = new Path(pathStr);
- if (path.segmentCount() == 0)
- return root;
- return root.getChild(path);
- } catch (URISyntaxException e) {
- CCorePlugin.log(e);
- } catch (CoreException e) {
- CCorePlugin.log(e);
- }
-
- return EFS.getNullFileSystem().getStore(uri);
- }
-
- public int attributes() {
- // TODO what attributes should we support?
- return 0;
- }
-
- public boolean canDelete() {
- return true;
- }
-
- public boolean canWrite() {
- return true;
- }
-
- public IFileTree fetchFileTree(IFileStore root, IProgressMonitor monitor) {
- try {
- // TODO obviously
- return EFS.getNullFileSystem().fetchFileTree(root, monitor);
- } catch (CoreException e) {
- CCorePlugin.log(e);
- return null;
- }
- }
-
- public IFileStore fromLocalFile(File file) {
- return EFS.getLocalFileSystem().fromLocalFile(file);
- }
-
- public IFileStore getStore(IPath path) {
- return EFS.getLocalFileSystem().getStore(path);
- }
-
- public boolean isCaseSensitive() {
- return EFS.getLocalFileSystem().isCaseSensitive();
- }
-
-}

Back to the top