Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-09-03 17:51:53 +0000
committerEike Stepper2010-09-03 17:51:53 +0000
commit77257035c2fdeae4fab8a91d20d11b8578b36188 (patch)
tree55f42a824ac1b89fb44fbe970c07b9059d9fb1c0 /plugins/org.eclipse.emf.cdo.efs
parent5ef764e430bf50a4e29903978f1c09e0a134dc93 (diff)
downloadcdo-77257035c2fdeae4fab8a91d20d11b8578b36188.tar.gz
cdo-77257035c2fdeae4fab8a91d20d11b8578b36188.tar.xz
cdo-77257035c2fdeae4fab8a91d20d11b8578b36188.zip
*** empty log message ***
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.efs')
-rw-r--r--plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDOFileStore.java46
-rw-r--r--plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDORootStore.java18
-rw-r--r--plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/ui/CreateCDOProjectAction.java11
3 files changed, 61 insertions, 14 deletions
diff --git a/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDOFileStore.java b/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDOFileStore.java
index e45dc0a01d..bd0d5e2662 100644
--- a/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDOFileStore.java
+++ b/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDOFileStore.java
@@ -11,6 +11,8 @@
*******************************************************************************/
package org.eclipse.emf.cdo.internal.efs;
+import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
import org.eclipse.emf.cdo.internal.efs.bundle.OM;
import org.eclipse.core.filesystem.EFS;
@@ -35,6 +37,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
/**
* @author Eike Stepper
@@ -47,6 +51,8 @@ public final class CDOFileStore extends AbstractFileStore
private IPath path;
+ private transient CDOResourceNode resourceNode;
+
public CDOFileStore(CDORootStore rootStore, IPath path)
{
this.rootStore = rootStore;
@@ -91,18 +97,28 @@ public final class CDOFileStore extends AbstractFileStore
{
FileInfo info = new FileInfo(getName());
info.setLastModified(EFS.NONE);
+ info.setLength(EFS.NONE);
+ info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, false);
+
if (isProjectDescription())
{
info.setExists(getProjectDescription() != null);
+ info.setDirectory(false);
}
else
{
- info.setExists(true);
+ try
+ {
+ CDOResourceNode resourceNode = getResourceNode();
+ info.setExists(true);
+ info.setDirectory(resourceNode instanceof CDOResourceFolder);
+ }
+ catch (Exception ex)
+ {
+ info.setExists(false);
+ }
}
- info.setLength(EFS.NONE);
- info.setDirectory(!isProjectDescription());
- info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, false);
return info;
}
@@ -121,12 +137,28 @@ public final class CDOFileStore extends AbstractFileStore
@Override
public String[] childNames(int options, IProgressMonitor monitor) throws CoreException
{
- if (path.segmentCount() == 4)
+ List<String> result = new ArrayList<String>();
+ CDOResourceNode resourceNode = getResourceNode();
+ if (resourceNode instanceof CDOResourceFolder)
+ {
+ CDOResourceFolder resourceFolder = (CDOResourceFolder)resourceNode;
+ for (CDOResourceNode node : resourceFolder.getNodes())
+ {
+ result.add(node.getName());
+ }
+ }
+
+ return result.toArray(new String[result.size()]);
+ }
+
+ private CDOResourceNode getResourceNode()
+ {
+ if (resourceNode == null)
{
- return new String[0];
+ resourceNode = getRootStore().getView().getResourceNode(path.toPortableString());
}
- return new String[] { "a", "b", "c" };
+ return resourceNode;
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDORootStore.java b/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDORootStore.java
index e979944a1d..212edc816f 100644
--- a/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDORootStore.java
+++ b/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDORootStore.java
@@ -12,10 +12,13 @@
package org.eclipse.emf.cdo.internal.efs;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.emf.ecore.EObject;
+
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileInfo;
import org.eclipse.core.filesystem.IFileStore;
@@ -27,6 +30,8 @@ import org.eclipse.core.runtime.Path;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
/**
* @author Eike Stepper
@@ -120,7 +125,18 @@ public final class CDORootStore extends AbstractFileStore
@Override
public String[] childNames(int options, IProgressMonitor monitor) throws CoreException
{
- return new String[] { "src", "src-gen", "META-INF" };
+ List<String> result = new ArrayList<String>();
+
+ for (EObject object : getView().getRootResource().getContents())
+ {
+ if (object instanceof CDOResourceNode)
+ {
+ CDOResourceNode node = (CDOResourceNode)object;
+ result.add(node.getName());
+ }
+ }
+
+ return result.toArray(new String[result.size()]);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/ui/CreateCDOProjectAction.java b/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/ui/CreateCDOProjectAction.java
index ab92475d62..cc323bab95 100644
--- a/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/ui/CreateCDOProjectAction.java
+++ b/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/ui/CreateCDOProjectAction.java
@@ -1,6 +1,5 @@
package org.eclipse.emf.cdo.internal.efs.ui;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IWorkspace;
@@ -82,22 +81,22 @@ public class CreateCDOProjectAction implements IWorkbenchWindowActionDelegate
public static IProject createCDOProject(int suffix) throws CoreException
{
IWorkspace workspace = ResourcesPlugin.getWorkspace();
-
+
IProject project = workspace.getRoot().getProject("cdo" + suffix);
if (project.exists())
{
return null;
}
-
+
IProjectDescription description = workspace.newProjectDescription("cdo" + suffix);
- description.setLocationURI(URI.create("cdo.net4j.tcp://localhost/repo1/MAIN/@" + suffix));
-
+ description.setLocationURI(URI.create("cdo.net4j.tcp://localhost/repo1/MAIN/@"));
+
project.create(description, new NullProgressMonitor());
if (!project.isOpen())
{
project.open(new NullProgressMonitor());
}
-
+
return project;
}
}

Back to the top