Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-10-18 08:17:07 -0400
committerEike Stepper2008-10-18 08:17:07 -0400
commitbd83b81314f717f3464f259b7fdc3da790f2c929 (patch)
tree6f5f241dfc3eef0f8035c7e719c3b5c01cd3a052
parent869d0b1c0d8df7e45b5c6c6cbe71fcc4a1a856c6 (diff)
downloadcdo-bd83b81314f717f3464f259b7fdc3da790f2c929.tar.gz
cdo-bd83b81314f717f3464f259b7fdc3da790f2c929.tar.xz
cdo-bd83b81314f717f3464f259b7fdc3da790f2c929.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.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceNodeClassImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEventHandler.java16
3 files changed, 27 insertions, 7 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceNodeClassImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceNodeClassImpl.java
index b3cc654280..c62bc5fdcd 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceNodeClassImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceNodeClassImpl.java
@@ -26,7 +26,7 @@ public class CDOResourceNodeClassImpl extends CDOClassImpl implements CDOResourc
public CDOResourceNodeClassImpl(CDOPackage containingPackage, CDOPackageManager packageManager)
{
- super(containingPackage, CLASSIFIER_ID, NAME, false);
+ super(containingPackage, CLASSIFIER_ID, NAME, true);
addFeature(cdoFolderFeature = new CDOFolderFeatureImpl(this, packageManager));
addFeature(cdoNameFeature = new CDONameFeatureImpl(this));
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java
index 2adb419d0b..aa62d0f497 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java
@@ -318,9 +318,9 @@ public abstract class MappingStrategy extends Lifecycle implements IMappingStrat
Set<IDBTable> tables = new HashSet<IDBTable>();
CDOResourcePackage resourcePackage = getStore().getRepository().getPackageManager().getCDOResourcePackage();
- tables.addAll(getClassMapping(resourcePackage.getCDOResourceNodeClass()).getAffectedTables());
- tables.addAll(getClassMapping(resourcePackage.getCDOResourceFolderClass()).getAffectedTables());
- tables.addAll(getClassMapping(resourcePackage.getCDOResourceClass()).getAffectedTables());
+ addResourceTables(resourcePackage.getCDOResourceNodeClass(), tables);
+ addResourceTables(resourcePackage.getCDOResourceFolderClass(), tables);
+ addResourceTables(resourcePackage.getCDOResourceClass(), tables);
if (dbAdapter.createTables(tables, connection).size() != tables.size())
{
@@ -328,6 +328,16 @@ public abstract class MappingStrategy extends Lifecycle implements IMappingStrat
}
}
+ private void addResourceTables(CDOClass cdoClass, Set<IDBTable> tables)
+ {
+ IClassMapping mapping = getClassMapping(cdoClass);
+ if (mapping != null)
+ {
+ Set<IDBTable> affectedTables = mapping.getAffectedTables();
+ tables.addAll(affectedTables);
+ }
+ }
+
public long repairAfterCrash(IDBAdapter dbAdapter, Connection connection)
{
long maxCDOID = 0L;
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEventHandler.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEventHandler.java
index d2f37e7b09..4dcee02513 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEventHandler.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEventHandler.java
@@ -11,6 +11,7 @@
package org.eclipse.emf.cdo.ui;
import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.CDOSession;
import org.eclipse.emf.cdo.CDOSessionInvalidationEvent;
import org.eclipse.emf.cdo.CDOTransactionConflictEvent;
import org.eclipse.emf.cdo.CDOTransactionFinishedEvent;
@@ -140,10 +141,19 @@ public class CDOEventHandler
public void dispose()
{
- view.removeListener(viewListener);
- view.getSession().removeListener(sessionListener);
+ if (view != null)
+ {
+ view.removeListener(viewListener);
+ view = null;
+
+ CDOSession session = view.getSession();
+ if (session != null)
+ {
+ session.removeListener(sessionListener);
+ }
+ }
+
treeViewer = null;
- view = null;
}
public CDOView getView()

Back to the top