Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-10-25 05:55:58 -0400
committerEike Stepper2010-10-25 05:55:58 -0400
commit191409bb69f812f1b8c1d91af487c88aea558bb6 (patch)
tree5291c44d2eb5adb6d15f6c54a3309b77128dc9bf /plugins/org.eclipse.emf.cdo.workspace.efs
parent033dd286f0682ac1cdf4c15bdeb6216d4c92dfcc (diff)
downloadcdo-191409bb69f812f1b8c1d91af487c88aea558bb6.tar.gz
cdo-191409bb69f812f1b8c1d91af487c88aea558bb6.tar.xz
cdo-191409bb69f812f1b8c1d91af487c88aea558bb6.zip
[327405] Provide an offline CDOWorkspace with Checkout/Update/Commit workflows
https://bugs.eclipse.org/bugs/show_bug.cgi?id=327405
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.workspace.efs')
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractResourceNodeStore.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOResourceNodeStore.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceStore.java15
3 files changed, 26 insertions, 3 deletions
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractResourceNodeStore.java b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractResourceNodeStore.java
index 951416d3f8..98e10c3d60 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractResourceNodeStore.java
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractResourceNodeStore.java
@@ -70,14 +70,19 @@ public abstract class AbstractResourceNodeStore extends AbstractFileStore
@Override
protected IFileInfo run(CDOResourceNode node)
{
+ long lastModified = EFS.NONE;
boolean exists = node != null;
boolean directory = exists && isDirectory(node);
+ if (!directory)
+ {
+ lastModified = getWorkspaceStore().getLastModified(node.getPath());
+ }
FileInfo info = new FileInfo(getName());
+ info.setLastModified(lastModified);
info.setExists(exists);
- info.setLength(EFS.NONE);
- info.setLastModified(EFS.NONE);
info.setDirectory(directory);
+ info.setLength(EFS.NONE);
info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, false);
info.setAttribute(EFS.ATTRIBUTE_HIDDEN, false);
return info;
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOResourceNodeStore.java b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOResourceNodeStore.java
index cd1c2a69da..320a45b5a3 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOResourceNodeStore.java
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOResourceNodeStore.java
@@ -114,8 +114,11 @@ public final class CDOResourceNodeStore extends AbstractResourceNodeStore
XMIResource xmiResource = new XMIResourceImpl();
xmiResource.load(in, null);
+ String path = getPath();
+ getWorkspaceStore().setLastModified(path, System.currentTimeMillis());
+
SaveContext saveContext = getWorkspaceStore().getSaveContext();
- saveContext.save(xmiResource, getPath());
+ saveContext.save(xmiResource, path);
}
};
}
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceStore.java b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceStore.java
index fa612fabf0..7b0a2f1e95 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceStore.java
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceStore.java
@@ -36,6 +36,7 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.xmi.XMIResource;
import org.eclipse.emf.spi.cdo.InternalCDOObject;
+import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -65,6 +66,8 @@ public final class CDOWorkspaceStore extends AbstractResourceNodeStore
private CDOWorkspace workspace;
+ private Map<String, Long> lastModifiedTimes = new HashMap<String, Long>();
+
private CDOView view;
private SaveContext saveContext;
@@ -170,6 +173,18 @@ public final class CDOWorkspaceStore extends AbstractResourceNodeStore
return this;
}
+ public long getLastModified(String path)
+ {
+ Long time = lastModifiedTimes.get(path);
+ return time == null ? EFS.NONE : time;
+ }
+
+ public void setLastModified(String path, long time)
+ {
+ lastModifiedTimes.put(path, time);
+ // TODO Save lastModifiedTimes
+ }
+
public SaveContext getSaveContext()
{
if (saveContext == null)

Back to the top