Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-10-11 14:31:06 +0000
committerEike Stepper2010-10-11 14:31:06 +0000
commit6c27108ac40515c3fd568aef70ba321c7632d16b (patch)
tree4206ff5078cc64efd2259e6fc29e2d8fc080f375 /plugins/org.eclipse.emf.cdo.workspace
parent9287a9c3063a844734a932e2ce09e6696ae49aa8 (diff)
downloadcdo-6c27108ac40515c3fd568aef70ba321c7632d16b.tar.gz
cdo-6c27108ac40515c3fd568aef70ba321c7632d16b.tar.xz
cdo-6c27108ac40515c3fd568aef70ba321c7632d16b.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')
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/CDOWorkspaceImpl.java33
1 files changed, 32 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/CDOWorkspaceImpl.java b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/CDOWorkspaceImpl.java
index 1d1cb18d5d..fad5a23818 100644
--- a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/CDOWorkspaceImpl.java
+++ b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/CDOWorkspaceImpl.java
@@ -51,6 +51,8 @@ import org.eclipse.net4j.jvm.IJVMConnector;
import org.eclipse.net4j.jvm.JVMUtil;
import org.eclipse.net4j.util.container.ContainerUtil;
import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+import org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.om.monitor.Monitor;
import org.eclipse.net4j.util.om.monitor.OMMonitor;
@@ -58,8 +60,10 @@ import org.eclipse.net4j.util.om.monitor.OMMonitor;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.spi.cdo.InternalCDOSession;
import org.eclipse.emf.spi.cdo.InternalCDOTransaction;
+import org.eclipse.emf.spi.cdo.InternalCDOView;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -84,6 +88,8 @@ public class CDOWorkspaceImpl implements CDOWorkspace
private CDOSessionConfigurationFactory remoteSessionConfigurationFactory;
+ private Set<InternalCDOView> views = new HashSet<InternalCDOView>();
+
private CDOWorkspaceImpl(IStore local, InternalCDOWorkspaceBaseline baseline)
{
container = createContainer(local);
@@ -204,7 +210,7 @@ public class CDOWorkspaceImpl implements CDOWorkspace
public CDOTransaction update(CDOMerger merger)
{
- return update(merger, CDOBranch.MAIN_BRANCH_NAME);
+ return update(merger, baseline.getBranchPath());
}
public CDOTransaction update(CDOMerger merger, String branchPath)
@@ -382,8 +388,33 @@ public class CDOWorkspaceImpl implements CDOWorkspace
return (InternalCDOSession)configuration.openSession();
}
+ protected InternalCDOView[] getViews()
+ {
+ synchronized (views)
+ {
+ return views.toArray(new InternalCDOView[views.size()]);
+ }
+ }
+
protected void initView(CDOView view)
{
+ synchronized (views)
+ {
+ views.add((InternalCDOView)view);
+ }
+
+ view.addListener(new LifecycleEventAdapter()
+ {
+ @Override
+ protected void onDeactivated(ILifecycle view)
+ {
+ synchronized (views)
+ {
+ views.remove(view);
+ }
+ }
+ });
+
if (view instanceof CDOTransaction)
{
if (baseline.getTimeStamp() != CDOBranchPoint.UNSPECIFIED_DATE)

Back to the top