*** empty log message ***
diff --git a/bundles/org.eclipse.core.resources/file system separation issues.txt b/bundles/org.eclipse.core.resources/file system separation issues.txt
new file mode 100644
index 0000000..9a44ed1
--- /dev/null
+++ b/bundles/org.eclipse.core.resources/file system separation issues.txt
@@ -0,0 +1,49 @@
+
+File System details exposed as API:
+===================================
+
+IResource.getLocation() - returns an IPath with the local location of the resource. Returns
+ null if it is not applicable to the given resource.
+
+IProjectDescription.setLocation()
+IProjectDescription.getLocation() - returns an IPath with the local location of the resource.
+ Returns null if using the default location.
+
+IResource.setReadOnly()
+IResource.isReadOnly() - some file systems may not support this feature.
+
+IWorkspaceRoot.getFileForLocation()
+IWorkspaceRoot.getContainerForLocation() -
+
+File system separation:
+=======================
+
+1) Metadata
+ The metadata will continue being local. Only the project content will be
+able to be stored in different ways (local file system, webdav, etc...)
+
+2) History
+ The history mechanism is currently attached to the local file system
+notion. In the proposed scenario, we have the option of continue keeping
+history locally or have it in a per project basis, giving the oportunity
+to the implementor of the file store to have it or not.
+
+
+Problems raised by the file system separation:
+==============================================
+
+1) IResource.getLocation():
+ In the new scenario, the resource might not have a local location anymore.
+<null> might be returned in this case.
+
+2) File Editors:
+ Some file editors are using a parallel mechanism to detect when the file
+it has opened, has changed on the file system. Basicaly they rely on the
+java.io.File API to do so.
+ In the new scenario, this API is not guaranteed to be helpful anymore. They
+would only be able to rely on the file content stream.
+
+3) Reporting errors:
+ If this mechanism becomes API, we have to have a better story for reporting
+errors. Classes like ResourceException, ResourceStatus and Policy.bind should
+somehow be available for implementors.
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/filesystem/FileSystemFile.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/filesystem/FileSystemFile.java
new file mode 100644
index 0000000..a2fb24d
--- /dev/null
+++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/filesystem/FileSystemFile.java
@@ -0,0 +1,44 @@
+package org.eclipse.core.internal.filesystem;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.internal.localstore.CoreFileSystemLibrary;
+import org.eclipse.core.internal.localstore.FileObject;
+
+public class FileSystemFile extends FileObject {
+
+protected String location;
+protected long stat;
+
+public FileSystemFile(String location) {
+ this.location = location;
+ stat = CoreFileSystemLibrary.getStat(location);
+}
+
+public boolean exists() {
+ return CoreFileSystemLibrary.isFile(stat) || CoreFileSystemLibrary.isFolder(stat);
+}
+
+public boolean isFile() {
+ return CoreFileSystemLibrary.isFile(stat);
+}
+
+public boolean isFolder() {
+ return CoreFileSystemLibrary.isFolder(stat);
+}
+
+public long getLastModified() {
+ return CoreFileSystemLibrary.getLastModified(stat);
+}
+
+public String getLocation() {
+ return location;
+}
+
+public void refresh() {
+ stat = CoreFileSystemLibrary.getStat(location);
+}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/filesystem/FileSystemStore2.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/filesystem/FileSystemStore2.java
new file mode 100644
index 0000000..8718bb6
--- /dev/null
+++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/filesystem/FileSystemStore2.java
@@ -0,0 +1,43 @@
+package org.eclipse.core.internal.filesystem;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+// FIXME: no internal import should be here
+import org.eclipse.core.internal.localstore.FileObject;
+import org.eclipse.core.internal.localstore.FileStore;
+import org.eclipse.core.internal.localstore.FileSystemStore;
+import org.eclipse.core.internal.utils.Policy;
+
+// OK imports
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import java.io.File;
+
+// FIXME: should only extend FileStore
+// FIXME: should be renamed to FileSystemStore
+public class FileSystemStore2 extends FileSystemStore {
+
+public FileObject getFile(IResource target) throws CoreException {
+ // FIXME: use locationFor instead of getLocation()
+ return new FileSystemFile(target.getLocation().toOSString());
+}
+
+public void write(IFolder target) throws CoreException {
+ // FIXME: use locationFor instead of getLocation()
+ File folder = target.getLocation().toFile();
+ if (!folder.exists())
+ folder.mkdirs();
+ if (!folder.isDirectory()) {
+ String message;
+ if (folder.isFile())
+ message = "Resource is not a folder: " + folder.getAbsolutePath();
+ else
+ message = Policy.bind("localstore.couldNotCreateFolder", folder.getAbsolutePath());
+ IStatus status = new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, IResourceStatus.FAILED_WRITE_LOCAL, message, null);
+ throw new CoreException(status);
+ }
+}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/DeleteVisitor.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/DeleteVisitor.java
index e8a4d6c..594b1cc 100644
--- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/DeleteVisitor.java
+++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/DeleteVisitor.java
@@ -42,7 +42,7 @@
delete(target, location);
return;
}
- HistoryStore store = target.getLocalManager().getHistoryStore();
+ HistoryStore store = ((Workspace) target.getWorkspace()).getFileManager().getHistoryStore();
store.addState(target.getFullPath(), location, node.getLastModified(), true);
if (target.getLocation().toFile().exists())
delete(target, location);
@@ -53,7 +53,7 @@
}
}
protected void delete(Resource target, IPath location) {
- if(!target.getLocalManager().getStore().delete(location.toFile(), status))
+ if(!target.getFileManager().getStore().delete(location.toFile(), status))
return;
try {
target.deleteResource(convertToPhantom, status);
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileManager.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileManager.java
new file mode 100644
index 0000000..e565c06
--- /dev/null
+++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileManager.java
@@ -0,0 +1,53 @@
+package org.eclipse.core.internal.localstore;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.internal.filesystem.FileSystemStore2;
+import org.eclipse.core.internal.resources.*;
+import org.eclipse.core.internal.utils.Policy;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * This class should only contain algorithms to execute file
+ * management. The "real work" will be done by a separate
+ * store like the FileSystemStore or DavStore.
+ */
+
+// FIXME: should remove the superclass later
+public class FileManager extends FileSystemResourceManager {
+
+protected FileStore fileStore;
+
+public FileManager(Workspace workspace) {
+ super(workspace);
+ fileStore = new FileSystemStore2();
+}
+
+public FileManager(Workspace workspace, FileStore fileStore) {
+ super(workspace);
+ this.fileStore = fileStore;
+}
+
+public void write(IFolder target, boolean force, IProgressMonitor monitor) throws CoreException {
+ FileObject file = fileStore.getFile(target);
+ if (!force)
+ if (file.isFolder()) {
+ String message = Policy.bind("localstore.resourceExists", target.getFullPath().toString());
+ throw new ResourceException(IResourceStatus.EXISTS_LOCAL, target.getFullPath(), message, null);
+ } else {
+ if (file.exists()) {
+ String message = Policy.bind("localstore.fileExists", target.getFullPath().toString());
+ throw new ResourceException(IResourceStatus.OUT_OF_SYNC_LOCAL, target.getFullPath(), message, null);
+ }
+ }
+ fileStore.write(target);
+ file.refresh();
+ ResourceInfo info = ((Resource) target).getResourceInfo(false, true);
+ updateLocalSync(info, file.getLastModified(), false);
+}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileObject.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileObject.java
new file mode 100644
index 0000000..b76f1a3
--- /dev/null
+++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileObject.java
@@ -0,0 +1,29 @@
+package org.eclipse.core.internal.localstore;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+/**
+ * Abstract representation of a file. This is the object managed by
+ * the FileManager.
+ */
+
+public abstract class FileObject {
+
+abstract public boolean exists();
+
+abstract public boolean isFile();
+
+abstract public boolean isFolder();
+
+abstract public long getLastModified();
+
+abstract public String getLocation();
+
+/**
+ * Clean all the cached information about this file.
+ */
+abstract public void refresh();
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileStore.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileStore.java
new file mode 100644
index 0000000..5c22646
--- /dev/null
+++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileStore.java
@@ -0,0 +1,23 @@
+package org.eclipse.core.internal.localstore;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.CoreException;
+
+public abstract class FileStore {
+
+/**
+ * Creates a folder in the store.
+ */
+abstract public FileObject getFile(IResource target) throws CoreException;
+
+/**
+ * Creates a folder in the store.
+ */
+abstract public void write(IFolder target) throws CoreException;
+
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemStore.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemStore.java
index 0659524..727e648 100644
--- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemStore.java
+++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemStore.java
@@ -12,7 +12,7 @@
import org.eclipse.core.internal.utils.*;
import java.io.*;
-public class FileSystemStore implements ILocalStoreConstants {
+public class FileSystemStore extends FileStore implements ILocalStoreConstants {
public FileSystemStore() {
}
public void copy(File source, File destination, int depth, IProgressMonitor monitor) throws CoreException {
@@ -246,4 +246,14 @@
throw new ResourceException(IResourceStatus.FAILED_WRITE_LOCAL, new Path(target.getAbsolutePath()), message, null);
}
}
+
+// HACK:
+public void write(IFolder target) throws CoreException {
+ writeFolder(target.getLocation().toFile());
+}
+// HACK:
+public FileObject getFile(IResource target) throws CoreException {
+ return null;
+}
+
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/RefreshLocalVisitor.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/RefreshLocalVisitor.java
index 2d41faf..7783edd 100644
--- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/RefreshLocalVisitor.java
+++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/RefreshLocalVisitor.java
@@ -45,7 +45,7 @@
/* Use the basic file creation protocol since we don't want to create any content on disk. */
workspace.createResource(target, false);
info = target.getResourceInfo(false, true);
- target.getLocalManager().updateLocalSync(info, node.getLastModified(), target.getType() == IResource.FILE);
+ target.getFileManager().updateLocalSync(info, node.getLastModified(), target.getType() == IResource.FILE);
}
protected void deleteResource(UnifiedTreeNode node, Resource target) throws CoreException {
ResourceInfo info = target.getResourceInfo(false, false);
@@ -68,7 +68,7 @@
}
node.setResource(target);
info = target.getResourceInfo(false, true);
- target.getLocalManager().updateLocalSync(info, node.getLastModified(), false);
+ target.getFileManager().updateLocalSync(info, node.getLastModified(), false);
}
protected void folderToFile(UnifiedTreeNode node, Resource target) throws CoreException {
ResourceInfo info = target.getResourceInfo(false, false);
@@ -85,13 +85,13 @@
}
node.setResource(target);
info = target.getResourceInfo(false, true);
- target.getLocalManager().updateLocalSync(info, node.getLastModified(), true);
+ target.getFileManager().updateLocalSync(info, node.getLastModified(), true);
}
protected void resourceChanged(Resource target, long lastModified) throws CoreException {
ResourceInfo info = target.getResourceInfo(false, true);
if (info == null)
return;
- target.getLocalManager().updateLocalSync(info, lastModified, target.getType() == IResource.FILE);
+ target.getFileManager().updateLocalSync(info, lastModified, target.getType() == IResource.FILE);
info.incrementContentId();
workspace.updateModificationStamp(info);
}
@@ -124,12 +124,12 @@
if (!CoreFileSystemLibrary.isCaseSensitive()) {
Container parent = (Container) target.getParent();
if (!parent.exists()) {
- parent.getLocalManager().refresh(parent, IResource.DEPTH_ZERO, null);
+ parent.getFileManager().refresh(parent, IResource.DEPTH_ZERO, null);
if (!parent.exists())
return RL_NOT_IN_SYNC;
}
IPath location = node.getLocalLocation();
- String name = target.getLocalManager().getLocalName(location.toFile());
+ String name = target.getFileManager().getLocalName(location.toFile());
if (!target.getName().equals(name))
return RL_IN_SYNC;
}
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/File.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/File.java
index f0b48f1..ad106f0 100644
--- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/File.java
+++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/File.java
@@ -78,12 +78,12 @@
parent.checkAccessible(getFlags(info));
workspace.beginOperation(true);
- IPath location = getLocalManager().locationFor(this);
+ IPath location = getFileManager().locationFor(this);
java.io.File localFile = location.toFile();
if (force) {
if (!CoreFileSystemLibrary.isCaseSensitive()) {
if (localFile.exists()) {
- String name = getLocalManager().getLocalName(localFile);
+ String name = getFileManager().getLocalName(localFile);
if (localFile.getName().equals(name)) {
delete(true, null);
} else {
@@ -140,14 +140,14 @@
int flags = getFlags(info);
checkAccessible(flags);
checkLocal(flags, DEPTH_ZERO);
- return getLocalManager().read(this, force, null);
+ return getFileManager().read(this, force, null);
}
/**
* @see IFile#getHistory
*/
public IFileState[] getHistory(IProgressMonitor monitor) throws CoreException {
// FIXME: monitor is not used
- return getLocalManager().getHistoryStore().getStates(getFullPath());
+ return getFileManager().getHistoryStore().getStates(getFullPath());
}
public int getType() {
return FILE;
@@ -155,7 +155,7 @@
protected void internalSetContents(InputStream content, boolean force, boolean keepHistory, boolean append, IProgressMonitor monitor) throws CoreException {
if (content == null)
content = new ByteArrayInputStream(new byte[0]);
- getLocalManager().write(this, content, force, keepHistory, append, monitor);
+ getFileManager().write(this, content, force, keepHistory, append, monitor);
ResourceInfo info = getResourceInfo(false, true);
info.incrementContentId();
workspace.updateModificationStamp(info);
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Folder.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Folder.java
index 3583d1f..d1705f7 100644
--- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Folder.java
+++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Folder.java
@@ -48,12 +48,12 @@
parent.checkAccessible(getFlags(info));
workspace.beginOperation(true);
- IPath location = getLocalManager().locationFor(this);
+ IPath location = getFileManager().locationFor(this);
java.io.File localFile = location.toFile();
if (force) {
if (!CoreFileSystemLibrary.isCaseSensitive()) {
if (localFile.exists()) {
- String name = getLocalManager().getLocalName(localFile);
+ String name = getFileManager().getLocalName(localFile);
if (localFile.getName().equals(name)) {
delete(true, null);
} else {
@@ -118,7 +118,7 @@
workspace.createResource(this, false);
if (local) {
try {
- getLocalManager().write(this, force, Policy.subMonitorFor(monitor, Policy.totalWork * 75 / 100));
+ getFileManager().write(this, force, Policy.subMonitorFor(monitor, Policy.totalWork * 75 / 100));
} catch (CoreException e) {
// a problem happened creating the folder on disk, so delete from the workspace
workspace.deleteResource(this);
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Project.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Project.java
index 3d99eee..91f5116 100644
--- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Project.java
+++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Project.java
@@ -16,8 +16,12 @@
import java.util.*;
public class Project extends Container implements IProject {
+
+protected FileManager fileManager;
+
protected Project(IPath path, Workspace container) {
super(path, container);
+ fileManager = new FileManager(workspace);
}
/**
* Deletes everything but contents. Needed for restore where we do not find
@@ -263,12 +267,12 @@
protected void copyMetaArea(IProject source, IProject destination, IProgressMonitor monitor) throws CoreException {
java.io.File oldMetaArea = workspace.getMetaArea().getLocationFor(source).toFile();
java.io.File newMetaArea = workspace.getMetaArea().getLocationFor(destination).toFile();
- getLocalManager().getStore().copy(oldMetaArea, newMetaArea, IResource.DEPTH_INFINITE, monitor);
+ getFileManager().getStore().copy(oldMetaArea, newMetaArea, IResource.DEPTH_INFINITE, monitor);
}
protected void renameMetaArea(IProject source, IProject destination, IProgressMonitor monitor) throws CoreException {
java.io.File oldMetaArea = workspace.getMetaArea().getLocationFor(source).toFile();
java.io.File newMetaArea = workspace.getMetaArea().getLocationFor(destination).toFile();
- getLocalManager().getStore().move(oldMetaArea, newMetaArea, false, monitor);
+ getFileManager().getStore().move(oldMetaArea, newMetaArea, false, monitor);
}
/**
* @see IProject#create
@@ -302,7 +306,7 @@
// updates the stamp
info.setModificationStamp(IResource.NULL_STAMP);
try {
- getLocalManager().write(this, Policy.subMonitorFor(monitor, Policy.opWork));
+ getFileManager().write(this, Policy.subMonitorFor(monitor, Policy.opWork));
} catch (CoreException e) {
workspace.deleteResource(this);
throw e;
@@ -414,9 +418,9 @@
pseudoOpen();
try {
if (force)
- getLocalManager().getStore().delete(getLocation().toFile(), status);
+ getFileManager().getStore().delete(getLocation().toFile(), status);
else
- getLocalManager().delete(this, force, false, false, Policy.monitorFor(null));
+ getFileManager().delete(this, force, false, false, Policy.monitorFor(null));
} catch (CoreException e) {
if (info != null) {
getPropertyManager().closePropertyStore(this);
@@ -443,7 +447,7 @@
// close project's propertyStore
getPropertyManager().closePropertyStore(project);
java.io.File location = workspace.getMetaArea().getLocationFor(project).toFile();
- getLocalManager().getStore().delete(location);
+ getFileManager().getStore().delete(location);
}
/**
* @see IProject
@@ -453,6 +457,11 @@
checkAccessible(getFlags(info));
return (IProjectDescription) ((ProjectInfo) info).getDescription().clone();
}
+
+public FileManager getFileManager() {
+ return fileManager;
+}
+
/**
* @see IProject#getNature
*/
@@ -574,7 +583,7 @@
workspace.changing(this);
workspace.beginOperation(true);
- getLocalManager().refresh(this, DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 20 / 100));
+ getFileManager().refresh(this, DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 20 / 100));
// close the property store so incorrect info is not copied to the destination
getPropertyManager().closePropertyStore(this);
@@ -592,7 +601,7 @@
// copied over from the source but we want to ensure the .prj file
// contains the correct info
try {
- getLocalManager().write(destProject, Policy.subMonitorFor(monitor, Policy.opWork * 10 / 100));
+ getFileManager().write(destProject, Policy.subMonitorFor(monitor, Policy.opWork * 10 / 100));
} catch (CoreException e) {
try {
destProject.delete(force, null);
@@ -612,7 +621,7 @@
// refresh local
monitor.subTask(Policy.bind("resources.updating"));
- getLocalManager().refresh(destProject, DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 10 / 100));
+ getFileManager().refresh(destProject, DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 10 / 100));
} catch (OperationCanceledException e) {
workspace.getWorkManager().operationCanceled();
throw e;
@@ -650,7 +659,7 @@
workspace.beginOperation(true);
// flush the build order early in case there is a problem
workspace.flushBuildOrder();
- getLocalManager().refresh(this, DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 20 / 100));
+ getFileManager().refresh(this, DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 20 / 100));
// copy just the project and not its children
internalCopyProjectOnly(destFolder, Policy.subMonitorFor(monitor, Policy.opWork * 10 / 100));
@@ -662,7 +671,7 @@
// refresh local
monitor.subTask(Policy.bind("resources.updating"));
- getLocalManager().refresh(destFolder, DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 20 / 100));
+ getFileManager().refresh(destFolder, DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 20 / 100));
} catch (OperationCanceledException e) {
workspace.getWorkManager().operationCanceled();
throw e;
@@ -705,7 +714,7 @@
workspace.beginOperation(true);
// flush the build order early in case there is a problem
workspace.flushBuildOrder();
- getLocalManager().refresh(this, DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 20 / 100));
+ getFileManager().refresh(this, DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 20 / 100));
// let people know that we are deleting the project
workspace.deleting(this);
@@ -733,7 +742,7 @@
// copied over from the source but we want to ensure the .prj file
// contains the correct info
try {
- getLocalManager().write(destProject, Policy.subMonitorFor(monitor, Policy.opWork * 10 / 100));
+ getFileManager().write(destProject, Policy.subMonitorFor(monitor, Policy.opWork * 10 / 100));
} catch (CoreException e) {
try {
destProject.delete(force, null);
@@ -795,7 +804,7 @@
IPath destination = getLocation();
rollbackLevel++;
// actually move the resources
- getLocalManager().getStore().move(source.toFile(), destination.toFile(), force, Policy.subMonitorFor(monitor, Policy.opWork * 70 / 100));
+ getFileManager().getStore().move(source.toFile(), destination.toFile(), force, Policy.subMonitorFor(monitor, Policy.opWork * 70 / 100));
rollbackLevel = 0;
// we need to refresh local in case we moved to an existing location
// that already had content
@@ -832,7 +841,7 @@
workspace.beginOperation(true);
// flush the build order early in case there is a problem
workspace.flushBuildOrder();
- getLocalManager().refresh(this, DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 20 / 100));
+ getFileManager().refresh(this, DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 20 / 100));
// copy just the project and not its children
internalCopyProjectOnly(destFolder, Policy.subMonitorFor(monitor, Policy.opWork * 10 / 100));
@@ -851,7 +860,7 @@
// refresh local
monitor.subTask(Policy.bind("resources.updating"));
- getLocalManager().refresh(destFolder, DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 20 / 100));
+ getFileManager().refresh(destFolder, DEPTH_INFINITE, Policy.subMonitorFor(monitor, Policy.opWork * 20 / 100));
} catch (OperationCanceledException e) {
workspace.getWorkManager().operationCanceled();
throw e;
@@ -1055,6 +1064,11 @@
monitor.done();
}
}
+
+public void setFileStore(FileStore store) {
+ fileManager = new FileManager(workspace, store);
+}
+
/**
* Restore the non-persisted state for the project. For example, read and set
* the description from the local meta area. Also, open the property store etc.
@@ -1126,7 +1140,7 @@
info.clearNatures();
// write out the project info to the meta area
- getLocalManager().write(destProject, Policy.subMonitorFor(monitor, Policy.opWork * 10 / 100));
+ getFileManager().write(destProject, Policy.subMonitorFor(monitor, Policy.opWork * 10 / 100));
// rename meta-area
renameMetaArea(this, destProject, null);
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java
index e001317..24a6792 100644
--- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java
+++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java
@@ -243,7 +243,7 @@
* @see IResource
*/
public void clearHistory(IProgressMonitor monitor) throws CoreException {
- getLocalManager().getHistoryStore().removeAll(this);
+ workspace.getFileManager().getHistoryStore().removeAll(this);
}
public void convertToPhantom() throws CoreException {
ResourceInfo info = getResourceInfo(false, true);
@@ -251,7 +251,7 @@
return;
info.clearSessionProperties();
info.set(M_PHANTOM);
- getLocalManager().updateLocalSync(info, I_NULL_SYNC_INFO, getType() == FILE);
+ getFileManager().updateLocalSync(info, I_NULL_SYNC_INFO, getType() == FILE);
info.setModificationStamp(IResource.NULL_STAMP);
// should already be done by the #deleteResource call but left in
// just to be safe and for code clarity.
@@ -321,7 +321,7 @@
workspace.beginOperation(true);
Resource destResource = workspace.newResource(makePathAbsolute(destination), getType());
- getLocalManager().copy(this, destResource, force, Policy.subMonitorFor(monitor, Policy.opWork));
+ getFileManager().copy(this, destResource, force, Policy.subMonitorFor(monitor, Policy.opWork));
} catch (OperationCanceledException e) {
workspace.getWorkManager().operationCanceled();
throw e;
@@ -394,7 +394,7 @@
return;
workspace.beginOperation(true);
- getLocalManager().delete(this, force, true, keepHistory, Policy.subMonitorFor(monitor, Policy.opWork));
+ getFileManager().delete(this, force, true, keepHistory, Policy.subMonitorFor(monitor, Policy.opWork));
} catch (OperationCanceledException e) {
workspace.getWorkManager().operationCanceled();
throw e;
@@ -515,8 +515,8 @@
public IPath getFullPath() {
return path;
}
-public FileSystemResourceManager getLocalManager() {
- return workspace.getFileSystemManager();
+public FileManager getFileManager() {
+ return ((Project) getProject()).getFileManager();
}
/**
* @see IResource#getLocation
@@ -525,7 +525,7 @@
IProject project = getProject();
if (project != null && !project.exists())
return null;
- return getLocalManager().locationFor(this);
+ return getFileManager().locationFor(this);
}
/**
@@ -839,7 +839,7 @@
if (!force)
if (!visitor.getStatus().isOK())
throw new ResourceException(visitor.getStatus());
- getLocalManager().move(this, destination, keepHistory, Policy.subMonitorFor(monitor, 70));
+ getFileManager().move(this, destination, keepHistory, Policy.subMonitorFor(monitor, 70));
} finally {
monitor.done();
}
@@ -858,7 +858,7 @@
if (getType() != ROOT && !getProject().isAccessible())
return;
workspace.beginOperation(true);
- build = getLocalManager().refresh(this, depth, Policy.subMonitorFor(monitor, Policy.opWork));
+ build = getFileManager().refresh(this, depth, Policy.subMonitorFor(monitor, Policy.opWork));
} catch (OperationCanceledException e) {
workspace.getWorkManager().operationCanceled();
throw e;
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/SaveManager.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/SaveManager.java
index 3e7f4ec..0d2ac23 100644
--- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/SaveManager.java
+++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/SaveManager.java
@@ -684,7 +684,7 @@
protected void saveMetaInfo(Project project, IProgressMonitor monitor) throws CoreException {
ProjectDescription description = (ProjectDescription) project.internalGetDescription();
if (description.isDirty()) {
- workspace.getFileSystemManager().write(project, null);
+ workspace.getFileManager().write(project, null);
description.clean();
}
}
@@ -1131,7 +1131,7 @@
removeUnusedSafeTables();
removeUnusedTreeFiles();
cleanMasterTable();
- workspace.getFileSystemManager().getHistoryStore().clean();
+ workspace.getFileManager().getHistoryStore().clean();
}
workspace.endOperation(false, null);
}
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Workspace.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Workspace.java
index c01e432..7cf15af 100644
--- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Workspace.java
+++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Workspace.java
@@ -8,7 +8,7 @@
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.core.internal.events.*;
-import org.eclipse.core.internal.localstore.FileSystemResourceManager;
+import org.eclipse.core.internal.localstore.FileManager;
import org.eclipse.core.internal.properties.PropertyManager;
import org.eclipse.core.internal.utils.*;
import org.eclipse.core.internal.watson.*;
@@ -24,7 +24,7 @@
protected SaveManager saveManager;
protected BuildManager buildManager;
protected NotificationManager notificationManager;
- protected FileSystemResourceManager fileSystemManager;
+ protected FileManager fileManager;
protected PropertyManager propertyManager;
protected MarkerManager markerManager;
protected long nextNodeId = 0;
@@ -810,8 +810,8 @@
public ElementTree getElementTree() {
return tree;
}
-public FileSystemResourceManager getFileSystemManager() {
- return fileSystemManager;
+public FileManager getFileManager() {
+ return fileManager;
}
/**
* Returns the marker manager for this workspace
@@ -1262,7 +1262,7 @@
protected void shutdown(IProgressMonitor monitor) throws CoreException {
monitor = Policy.monitorFor(monitor);
try {
- IManager[] managers = { buildManager, notificationManager, propertyManager, fileSystemManager, markerManager, saveManager, workManager };
+ IManager[] managers = { buildManager, notificationManager, propertyManager, fileManager, markerManager, saveManager, workManager };
monitor.beginTask(null, managers.length);
String message = Policy.bind("resources.shutdownProblems");
MultiStatus status = new MultiStatus(ResourcesPlugin.PI_RESOURCES, IResourceStatus.INTERNAL_ERROR, message, null);
@@ -1283,7 +1283,7 @@
buildManager = null;
notificationManager = null;
propertyManager = null;
- fileSystemManager = null;
+ fileManager = null;
markerManager = null;
synchronizer = null;
saveManager = null;
@@ -1298,8 +1298,8 @@
// ensure the tree is locked during the startup notification
workManager = new WorkManager(this);
workManager.startup(null);
- fileSystemManager = new FileSystemResourceManager(this);
- fileSystemManager.startup(monitor);
+ fileManager = new FileManager(this);
+ fileManager.startup(monitor);
propertyManager = new PropertyManager(this);
propertyManager.startup(monitor);
buildManager = new BuildManager(this);
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/WorkspaceRoot.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/WorkspaceRoot.java
index ba0bd08..268fcd6 100644
--- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/WorkspaceRoot.java
+++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/WorkspaceRoot.java
@@ -7,6 +7,7 @@
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
+import org.eclipse.core.internal.localstore.FileManager;
import org.eclipse.core.internal.utils.Assert;
import org.eclipse.core.internal.utils.Policy;
@@ -19,7 +20,7 @@
* @see IResource
*/
public void clearHistory(IProgressMonitor monitor) throws CoreException {
- getLocalManager().getHistoryStore().removeAll();
+ getFileManager().getHistoryStore().removeAll();
}
/**
* @see IResource#delete
@@ -69,14 +70,19 @@
* @see IWorkspaceRoot
*/
public IContainer getContainerForLocation(IPath location) {
- return getLocalManager().containerFor(location);
+ return getFileManager().containerFor(location);
}
/**
* @see IWorkspaceRoot
*/
public IFile getFileForLocation(IPath location) {
- return getLocalManager().fileFor(location);
+ return getFileManager().fileFor(location);
}
+
+public FileManager getFileManager() {
+ return workspace.getFileManager();
+}
+
/**
* @see IResource#getLocation
*/