summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-07 03:39:40 (EDT)
committerEike Stepper2007-10-07 03:39:40 (EDT)
commit3f0626c833d39355de60eab28d895bef72942001 (patch)
treefc7be3b1545642f4f170ace9dcd4448c8a99bf1b
parent278e8a6062c12ee55a24860feb3971872a3e228a (diff)
downloadcdo-3f0626c833d39355de60eab28d895bef72942001.zip
cdo-3f0626c833d39355de60eab28d895bef72942001.tar.gz
cdo-3f0626c833d39355de60eab28d895bef72942001.tar.bz2
[205652] Prevent duplicate resources
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205652
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java20
2 files changed, 19 insertions, 8 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
index 0ce132d..71b5fe6 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
@@ -357,11 +357,7 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
public void writeRevision(CDORevisionImpl revision)
{
- if (TRACER.isEnabled())
- {
- TRACER.format("Inserting revision: {0}", revision);
- }
-
+ if (TRACER.isEnabled()) TRACER.format("Inserting revision: {0}", revision);
CDOClassImpl cdoClass = revision.getCDOClass();
IMappingStrategy mappingStrategy = getStore().getMappingStrategy();
@@ -373,6 +369,7 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
{
try
{
+ if (TRACER.isEnabled()) TRACER.format("Rolling back transaction: {0}", view);
connection.rollback();
}
catch (SQLException ex)
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
index d8fb3d1..779f34d 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
@@ -15,9 +15,6 @@ import org.eclipse.emf.cdo.protocol.model.CDOClass;
import org.eclipse.emf.cdo.protocol.model.CDOPackage;
import org.eclipse.emf.cdo.util.CDOUtil;
-import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.ui.actions.LongRunningAction;
-
import org.eclipse.emf.common.command.BasicCommandStack;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
@@ -62,6 +59,10 @@ import org.eclipse.emf.internal.cdo.CDOTransactionImpl;
import org.eclipse.emf.internal.cdo.InternalCDOObject;
import org.eclipse.emf.internal.cdo.util.FSMUtil;
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.transaction.TransactionException;
+import org.eclipse.net4j.util.ui.actions.LongRunningAction;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
@@ -101,6 +102,7 @@ import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorInput;
@@ -1562,6 +1564,18 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
savedResources.add(resource);
resource.save(saveOptions);
}
+ catch (final TransactionException exception)
+ {
+ OM.LOG.error(exception);
+ final Shell shell = getSite().getShell();
+ shell.getDisplay().syncExec(new Runnable()
+ {
+ public void run()
+ {
+ MessageDialog.openError(shell, "Transaction Error", exception.getMessage());
+ }
+ });
+ }
catch (Exception exception)
{
OM.LOG.error(exception);