diff --git a/core/org.eclipse.cdt.core/.classpath b/core/org.eclipse.cdt.core/.classpath
index 7628a2b870a..2288d9b1dc8 100644
--- a/core/org.eclipse.cdt.core/.classpath
+++ b/core/org.eclipse.cdt.core/.classpath
@@ -6,7 +6,7 @@
-
+
diff --git a/core/org.eclipse.cdt.core/.settings/org.eclipse.jdt.core.prefs b/core/org.eclipse.cdt.core/.settings/org.eclipse.jdt.core.prefs
index c67af907127..ceb4ffa42ce 100644
--- a/core/org.eclipse.cdt.core/.settings/org.eclipse.jdt.core.prefs
+++ b/core/org.eclipse.cdt.core/.settings/org.eclipse.jdt.core.prefs
@@ -1,12 +1,12 @@
-#Thu Oct 05 16:52:57 CEST 2006
+#Fri Dec 28 14:46:56 EST 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.source=1.4
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
index ab35fce1539..a5e283c9195 100644
--- a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
@@ -46,6 +46,7 @@ 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,
@@ -94,4 +95,4 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.filebuffers;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.filesystem;bundle-version="[1.1.0,2.0.0)"
Eclipse-LazyStart: true
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/core/org.eclipse.cdt.core/plugin.xml b/core/org.eclipse.cdt.core/plugin.xml
index 49d76de7e10..252553918fb 100644
--- a/core/org.eclipse.cdt.core/plugin.xml
+++ b/core/org.eclipse.cdt.core/plugin.xml
@@ -707,7 +707,7 @@
+ scheme="ecproj">
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
new file mode 100644
index 00000000000..c0addc1c63d
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ffs/FFSEcprojFile.java
@@ -0,0 +1,45 @@
+/**********************************************************************
+ * 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
new file mode 100644
index 00000000000..64752450d0f
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/ffs/FFSFileStore.java
@@ -0,0 +1,157 @@
+/**********************************************************************
+ * 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
index b2943312a80..71c5295f886 100644
--- 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
@@ -14,6 +14,8 @@ 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;
@@ -23,24 +25,54 @@ 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 virtual file system. It maps URIs to files in underlying file systems.
- * In doing so, it allows the hierarchical structure of URIs to be different.
- * In particular, you can add files from one location to another and excludes files
- * and directories from the tree.
+ * 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:///?#
+ *
+ * For example:
+ *
+ * ecproj:///c:/Eclipse/workspace/s?.project
+ *
*/
public class FFSFileSystem extends FileSystem {
- public FFSFileSystem() {
+ private Map ecprojFiles = new HashMap();
+
+ 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 {
- URI realURI = new URI(getScheme(), uri.getSchemeSpecificPart(), uri.getFragment());
- return EFS.getStore(realURI);
+ 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) {
diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml
index c7d13f480b6..f51d0b6b8cc 100644
--- a/core/org.eclipse.cdt.ui/plugin.xml
+++ b/core/org.eclipse.cdt.ui/plugin.xml
@@ -2405,7 +2405,7 @@
+ scheme="ecproj">
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ffs/FFSFileSystemContributor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ffs/FFSFileSystemContributor.java
index 0cdb898b767..ab766196e9c 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ffs/FFSFileSystemContributor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ffs/FFSFileSystemContributor.java
@@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.ui.ffs;
import java.io.File;
import java.net.URI;
+import java.net.URISyntaxException;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileInfo;
@@ -21,12 +22,22 @@ import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.ide.fileSystem.FileSystemContributor;
+import org.eclipse.cdt.internal.core.ffs.FFSFileSystem;
+
/**
* @author Doug Schaefer
*
*/
public class FFSFileSystemContributor extends FileSystemContributor {
+ public URI getURI(String string) {
+ try {
+ return new URI(string);
+ } catch (URISyntaxException e) {
+ return super.getURI(string);
+ }
+ }
+
public URI browseFileSystem(String initialPath, Shell shell) {
DirectoryDialog dialog = new DirectoryDialog(shell);
dialog.setMessage("Select Project Location");
@@ -42,7 +53,12 @@ public class FFSFileSystemContributor extends FileSystemContributor {
if (selectedDirectory == null) {
return null;
}
- return new File(selectedDirectory).toURI();
+ URI rootURI = new File(selectedDirectory).toURI();
+ try {
+ return new URI("ecproj", rootURI.getAuthority(), rootURI.getPath(), null, rootURI.getScheme());
+ } catch (URISyntaxException e) {
+ return rootURI;
+ }
}
}