diff options
9 files changed, 100 insertions, 18 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/notifications/impl/DawnGMFHandler.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/notifications/impl/DawnGMFHandler.java index cd4708aa7c..c05859c71e 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/notifications/impl/DawnGMFHandler.java +++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/notifications/impl/DawnGMFHandler.java @@ -74,24 +74,17 @@ public class DawnGMFHandler extends BasicDawnTransactionHandler TRACER.format("Dirty Objects {0} ", e.getDirtyObjects()); //$NON-NLS-1$ } - int xxx; - // if (!e.getDetachedObjects().isEmpty()) + adjustDeletedEdges(e); + + for (CDOObject dirtyObject : e.getDirtyObjects()) { - editor.getDawnEditorSupport().refresh(); - return; + handleObject(dirtyObject); } - // adjustDeletedEdges(e); - // - // for (CDOObject dirtyObject : e.getDirtyObjects()) - // { - // handleObject(dirtyObject); - // } - // - // for (CDOObject detachedObject : e.getDetachedObjects()) - // { - // handleObject(detachedObject); - // } + for (CDOObject detachedObject : e.getDetachedObjects()) + { + handleObject(detachedObject); + } } /** diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/util/DawnDiagramUpdater.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/util/DawnDiagramUpdater.java index a77842c6bd..5fadbb52f1 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/util/DawnDiagramUpdater.java +++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/util/DawnDiagramUpdater.java @@ -11,7 +11,9 @@ */ package org.eclipse.emf.cdo.dawn.gmf.util; +import org.eclipse.emf.cdo.CDOObject; import org.eclipse.emf.cdo.dawn.internal.util.bundle.OM; +import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.net4j.util.om.trace.ContextTracer; @@ -139,7 +141,10 @@ public class DawnDiagramUpdater // nextEditPolicy.refresh(); // } - editPart.refresh(); + if (hasValidModel(editPart)) + { + editPart.refresh(); + } } catch (Exception e) { @@ -170,6 +175,21 @@ public class DawnDiagramUpdater } } + private static boolean hasValidModel(EditPart editPart) + { + Object model = editPart.getModel(); + if (model instanceof EObject) + { + CDOObject cdoObject = CDOUtil.getCDOObject((EObject)model, false); + if (cdoObject.cdoInvalid()) + { + return false; + } + } + + return true; + } + public static View findViewByContainer(EObject element) { if (element instanceof View) diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOExplorerElement.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOExplorerElement.java index 9f1b2bab5b..94e816a285 100644 --- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOExplorerElement.java +++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOExplorerElement.java @@ -16,6 +16,8 @@ import org.eclipse.emf.common.notify.Adapter; import org.eclipse.core.runtime.IAdaptable; +import java.io.File; + /** * A CDO server independent representation of a repository. * @@ -38,5 +40,10 @@ public interface CDOExplorerElement extends INotifier, IAdaptable, Adapter, Comp public void setDescription(String description); + /** + * @since 4.5 + */ + public File getStateFolder(String path); + public void delete(boolean deleteContents); } diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOExplorerUtil.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOExplorerUtil.java index 83efc00113..ae3a8c8207 100644 --- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOExplorerUtil.java +++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOExplorerUtil.java @@ -18,11 +18,13 @@ import org.eclipse.emf.cdo.explorer.repositories.CDORepositoryManager; import org.eclipse.emf.cdo.internal.explorer.bundle.OM; import org.eclipse.emf.cdo.internal.explorer.checkouts.CDOCheckoutImpl; import org.eclipse.emf.cdo.internal.explorer.checkouts.CDOCheckoutViewProvider; +import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.emf.cdo.view.CDOView; import org.eclipse.net4j.util.AdapterUtil; import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; @@ -70,7 +72,23 @@ public final class CDOExplorerUtil return getCheckoutManager().getCheckout(id); } - return walkUp(object, null); + CDOCheckout checkout = walkUp(object, null); + if (checkout != null) + { + return checkout; + } + + if (object instanceof Notifier) + { + Notifier notifier = (Notifier)object; + CDOView view = CDOUtil.getView(notifier); + if (view != null) + { + return getCheckout(view); + } + } + + return null; } public static Object getParent(Object object) diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/AbstractElement.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/AbstractElement.java index ef3970d082..55ffdfab03 100644 --- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/AbstractElement.java +++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/AbstractElement.java @@ -238,6 +238,20 @@ public abstract class AbstractElement extends Notifier implements CDOExplorerEle return label1.compareTo(label2); } + /** + * @since 4.5 + */ + public File getStateFolder(String path) + { + File stateFolder = new File(folder, path); + if (!stateFolder.exists()) + { + stateFolder.mkdirs(); + } + + return stateFolder; + } + public void delete(boolean deleteContents) { if (deleteContents) diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java index 3b5ecd4b29..3d0812d23b 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java @@ -407,7 +407,7 @@ public final class CDOUtil } Resource.Internal resource = object.eDirectResource(); - if (resource != null) + if (resource != null && resource != object) { CDOViewSet viewSet = getViewSet(resource); if (viewSet != null) diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java index 37b9c7fabd..7b771c9fef 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java @@ -361,6 +361,11 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb public void setProvider(CDOViewProvider provider) { this.provider = provider; + + if (viewSet != null) + { + viewSet.remapView(this); + } } public synchronized CDOResourceImpl getRootResource() diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewSetImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewSetImpl.java index 1d7ded72aa..7a2d961752 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewSetImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewSetImpl.java @@ -45,6 +45,7 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -207,6 +208,25 @@ public class CDOViewSetImpl extends NotifierImpl implements InternalCDOViewSet } } + public void remapView(InternalCDOView view) + { + synchronized (views) + { + for (Iterator<Map.Entry<URI, InternalCDOView>> it = mapOfViews.entrySet().iterator(); it.hasNext();) + { + Map.Entry<URI, InternalCDOView> entry = it.next(); + if (entry.getValue() == view) + { + it.remove(); + break; + } + } + + URI viewURI = getViewURI(view); + mapOfViews.put(viewURI, view); + } + } + public Notifier getTarget() { return resourceSet; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOViewSet.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOViewSet.java index c14ecd66b2..0aa3d5c5c0 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOViewSet.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOViewSet.java @@ -32,6 +32,11 @@ public interface InternalCDOViewSet extends CDOViewSet, Adapter public void remove(InternalCDOView view); /** + * @since 4.5 + */ + public void remapView(InternalCDOView view); + + /** * @since 4.4 */ public InternalCDOView resolveView(URI viewURI); |