Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-10-15 17:07:14 -0400
committerEike Stepper2008-10-15 17:07:14 -0400
commitd4cf12bcd94545bff4ac686fbce6aea92eb5f184 (patch)
treec52065385443646629029ce1f794a723548dd8b2
parentf54be543d0403c6016b53054615c3cf9ef7a208a (diff)
downloadcdo-d4cf12bcd94545bff4ac686fbce6aea92eb5f184.tar.gz
cdo-d4cf12bcd94545bff4ac686fbce6aea92eb5f184.tar.xz
cdo-d4cf12bcd94545bff4ac686fbce6aea92eb5f184.zip
[249847] Store resources in a hierarchical structure
https://bugs.eclipse.org/bugs/show_bug.cgi?id=249847
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionHandlerTest.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java30
2 files changed, 22 insertions, 12 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionHandlerTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionHandlerTest.java
index 4525fdd3cf..ad482bdbc6 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionHandlerTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionHandlerTest.java
@@ -232,11 +232,9 @@ public class TransactionHandlerTest extends AbstractCDOTest
OrderDetail orderDetail = getModel1Factory().createOrderDetail();
order.getOrderDetails().add(orderDetail);
- CDOResource resource = transaction.getOrCreateResource("/test1");
-
try
{
- resource.getContents().add(order);
+ transaction.getOrCreateResource("/test1");
fail("IllegalStateException expected");
}
catch (IllegalStateException ex)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java
index 11efbe0d10..9c9bdd37a6 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java
@@ -665,19 +665,26 @@ public class CDOResourceImpl extends CDOResourceNodeImpl implements CDOResource,
*/
public void delete(Map<?, ?> defaultDeleteOptions) throws IOException
{
- if (isRoot())
- {
- throw new UnsupportedOperationException();
- }
-
- if (getFolder() == null)
+ if (FSMUtil.isTransient(this))
{
- CDOViewImpl view = cdoView();
- view.getRootResource().getContents().remove(this);
+ removeFromResourceSet();
}
else
{
- setFolder(null);
+ if (isRoot())
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ if (getFolder() == null)
+ {
+ CDOViewImpl view = cdoView();
+ view.getRootResource().getContents().remove(this);
+ }
+ else
+ {
+ setFolder(null);
+ }
}
}
@@ -685,6 +692,11 @@ public class CDOResourceImpl extends CDOResourceNodeImpl implements CDOResource,
public void cdoInternalPostDetach()
{
super.cdoInternalPostDetach();
+ removeFromResourceSet();
+ }
+
+ private void removeFromResourceSet()
+ {
ResourceSet resourceSet = getResourceSet();
if (resourceSet != null)
{

Back to the top