Bug 577404: Accomodate changes in CDO
Change-Id: I5d5e19b1fac5918456fdba334d30a7a06b311ce0
Signed-off-by: Eike Stepper <stepper@esc-net.de>
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java b/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java
index 0dd6b93..54f86d8 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareModelSet.java
@@ -37,6 +37,8 @@
import org.eclipse.emf.cdo.dawn.gmf.util.DawnDiagramUpdater;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.eresource.CDOResourceNode;
+import org.eclipse.emf.cdo.explorer.CDOExplorerUtil;
+import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.cdo.util.CommitException;
@@ -101,6 +103,11 @@
map.put(SCHEME, resourceFactory);
}
+ @Override
+ public final boolean isShardingSupported() {
+ return false;
+ }
+
public final IListener getInvalidationListener() {
return invalidationListener;
}
@@ -196,6 +203,13 @@
@Override
public void loadModels(URI uri) throws ModelMultiException {
+ // If Eclipse was previously shut down with editors still open, these editors will be reopened now.
+ // This does not go through PapyrusCDOEditorOpener, so we have no chance there to open the needed checkout.
+ CDOCheckout checkout = CDOExplorerUtil.getCheckout(uri);
+ if (checkout != null) {
+ checkout.open();
+ }
+
super.loadModels(uri);
// Did any of the models create a new resource? (the DiModel and/or HistoryModel may have done)
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/PapyrusCDOResourceImpl.java b/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/PapyrusCDOResourceImpl.java
index d77915c..21af695 100644
--- a/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/PapyrusCDOResourceImpl.java
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/PapyrusCDOResourceImpl.java
@@ -20,11 +20,8 @@
import java.util.HashMap;
import java.util.Map;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl;
import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.internal.cdo.view.CDOViewImpl.OptionsImpl;
-import org.eclipse.emf.spi.cdo.InternalCDOView;
import org.eclipse.uml2.common.util.CacheAdapter;
public class PapyrusCDOResourceImpl extends CDOResourceImpl {
@@ -34,23 +31,11 @@
*/
public static final String ORG_ECLIPSE_PAPYRUS_LAZY_CDO_RESOURCE_LOADING = "org.eclipse.papyrus.lazyCDOResourceLoading"; //$NON-NLS-1$
- /**
- * @see org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#load(java.util.Map)
- *
- * @param options
- * @throws IOException
- */
@Override
public void load(Map<?, ?> options) throws IOException {
if (!isLoaded()) {
Boolean lazy = Boolean.getBoolean(ORG_ECLIPSE_PAPYRUS_LAZY_CDO_RESOURCE_LOADING);
if (!lazy) {
- cdoPrefetch(CDORevision.DEPTH_INFINITE);
-
- InternalCDOView cdoView = this.cdoView();
-
- ((OptionsImpl) cdoView.options()).setLockStatePrefetchEnabled(true);
-
CacheAdapter cacheAdapter = CacheAdapter.getInstance();
if (cacheAdapter.getClass() != NonLazyPapyrusCDOCacheAdapter.class) {
NonLazyPapyrusCDOCacheAdapter.register(new NonLazyPapyrusCDOCacheAdapter());
@@ -59,26 +44,15 @@
}
super.load(options);
-
}
}
- /**
- * Constructor.
- *
- */
public PapyrusCDOResourceImpl(URI uri) {
super(uri);
}
- /**
- * @see org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#getDefaultSaveOptions()
- *
- * @return
- */
@Override
public Map<Object, Object> getDefaultSaveOptions() {
return new HashMap<Object, Object>();
}
-
}
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/CDOUtils.java b/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/CDOUtils.java
index b0cac3c..d0669ad 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/CDOUtils.java
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/internal/core/CDOUtils.java
@@ -32,7 +32,6 @@
import org.eclipse.emf.cdo.dawn.spi.DawnState;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.eresource.CDOResourceNode;
-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.emf.cdo.view.CDOViewInvalidationEvent;
@@ -51,6 +50,7 @@
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.spi.cdo.FSMUtil;
import org.eclipse.emf.spi.cdo.InternalCDOView;
import org.eclipse.emf.transaction.ResourceSetChangeEvent;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
@@ -71,7 +71,8 @@
*/
public class CDOUtils {
- private static final Set<String> CDO_URI_SCHEMES = ImmutableSet.of("cdo", "dawn", CDOCheckoutViewProvider.SCHEME); //$NON-NLS-1$ //$NON-NLS-2$
+ @SuppressWarnings("restriction")
+ private static final Set<String> CDO_URI_SCHEMES = ImmutableSet.of("cdo", "dawn", org.eclipse.emf.cdo.internal.explorer.checkouts.CDOCheckoutViewProvider.SCHEME); //$NON-NLS-1$ //$NON-NLS-2$
private static Executor broadcastExecutor = new DirectExecutor();
@@ -190,10 +191,7 @@
}
public static boolean isLockable(CDOObject object) {
- // transient objects do not have lock states, nor do those that are not
- // in a view or are in a closed view
- CDOView view = object.cdoView();
- return (view != null) && !view.isClosed() && (object.cdoLockState() != null);
+ return !FSMUtil.isTransient(object);
}
public static boolean isLocked(CDOObject object, boolean remotely) {
@@ -289,7 +287,7 @@
InternalEList<E> list = (InternalEList<E>) value;
final ListIterator<E> delegate = (resolve) ? list.listIterator() : list.basicListIterator();
- class NonEmpty extends UnmodifiableListIterator<E>implements FeatureListIterator<E> {
+ class NonEmpty extends UnmodifiableListIterator<E> implements FeatureListIterator<E> {
@Override
public EStructuralFeature feature() {
@@ -330,7 +328,7 @@
result = new NonEmpty();
} else if (value == null) {
- class Empty extends UnmodifiableListIterator<E>implements FeatureListIterator<E> {
+ class Empty extends UnmodifiableListIterator<E> implements FeatureListIterator<E> {
@Override
public EStructuralFeature feature() {
@@ -374,7 +372,7 @@
@SuppressWarnings("unchecked")
final E onlyValue = (E) value;
- class Singleton extends UnmodifiableListIterator<E>implements FeatureListIterator<E> {
+ class Singleton extends UnmodifiableListIterator<E> implements FeatureListIterator<E> {
private int index = -1;
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/CDOContextStorageProvider.java b/cdo/bundles/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/CDOContextStorageProvider.java
index 5fb80d5..50efa4f 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/CDOContextStorageProvider.java
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.ui.customization.properties/src/org/eclipse/papyrus/cdo/internal/ui/customization/properties/storage/CDOContextStorageProvider.java
@@ -65,7 +65,7 @@
private CDOTextURIHandler uriHandler;
- private final IListener repositoryAdapter = new IListener() {
+ private final IListener checkoutManagerListener = new IListener() {
@Override
public void notifyEvent(IEvent event) {
@@ -150,34 +150,35 @@
uriHandler = CDOTextURIHandler.install(resourceSet);
- CDOExplorerUtil.getCheckoutManager().addListener(repositoryAdapter);
+ CDOExplorerUtil.getCheckoutManager().addListener(checkoutManagerListener);
}
@Override
public void dispose() {
- if (resourceSet != null) {
- CDOExplorerUtil.getCheckoutManager().removeListener(repositoryAdapter);
+ if (uriHandler != null) {
+ CDOExplorerUtil.getCheckoutManager().removeListener(checkoutManagerListener);
uriHandler.uninstall();
uriHandler = null;
resourceSet = null;
- super.dispose();
}
+
+ super.dispose();
}
@Override
public boolean providesFor(Context context) {
URI uri = EcoreUtil.getURI(context);
- return (uri != null) && (CDOUtils.isCDOURI(uri) || CDOTextURIHandler.SCHEME.equals(uri.scheme()));
+ return uri != null && (CDOUtils.isCDOURI(uri) || CDOTextURIHandler.SCHEME.equals(uri.scheme()));
}
@Override
public Collection<? extends Context> loadContexts() throws CoreException {
- return ImmutableList.copyOf(Iterables.concat(Iterables.transform(getRepositories(), getContexts())));
+ return ImmutableList.copyOf(Iterables.concat(Iterables.transform(getCheckouts(), getContexts())));
}
- Iterable<? extends CDOCheckout> getRepositories() {
+ Iterable<? extends CDOCheckout> getCheckouts() {
return Arrays.asList(CDOExplorerUtil.getCheckoutManager().getCheckouts());
}
diff --git a/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusCDOEditorInput.java b/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusCDOEditorInput.java
index 0a09c75..cee697a 100755
--- a/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusCDOEditorInput.java
+++ b/cdo/bundles/org.eclipse.papyrus.cdo.ui/src/org/eclipse/papyrus/cdo/internal/ui/editors/PapyrusCDOEditorInput.java
@@ -15,7 +15,10 @@
import org.eclipse.emf.common.ui.URIEditorInput;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.net4j.util.om.pref.OMPreference;
+import org.eclipse.papyrus.cdo.ui.Activator;
import org.eclipse.papyrus.infra.ui.editor.IPapyrusPageInput;
+import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPersistableElement;
/**
@@ -23,6 +26,9 @@
*/
public class PapyrusCDOEditorInput extends URIEditorInput {
+ @SuppressWarnings("restriction")
+ private static final OMPreference<Boolean> PREF_REMEMBER_OPEN_EDITORS = org.eclipse.emf.cdo.explorer.ui.bundle.OM.PREF_REMEMBER_OPEN_EDITORS;
+
public PapyrusCDOEditorInput(URI uri) {
this(uri, uri.trimFileExtension().lastSegment());
}
@@ -30,27 +36,38 @@
public PapyrusCDOEditorInput(URI uri, String name) {
super(uri, name);
}
+
+ public PapyrusCDOEditorInput(IMemento memento) {
+ super(memento);
+ }
- /**
- * Editors on CDO resources cannot be re-opened without re-connecting the
- * repository, so return {@code null}.
- */
+ @Override
+ public URI getURI() {
+ return super.getURI();
+ }
+
+ @Override
+ protected String getBundleSymbolicName() {
+ return Activator.PLUGIN_ID;
+ }
+
@Override
public IPersistableElement getPersistable() {
- return null;
+ if (PREF_REMEMBER_OPEN_EDITORS.getValue() == Boolean.TRUE)
+ {
+ return this;
+ }
+
+ return null;
}
@Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
- Object result;
-
if (adapter == URI.class) {
- result = getURI();
- } else {
- result = super.getAdapter(adapter);
+ return getURI();
}
- return result;
+ return super.getAdapter(adapter);
}
/**
@@ -85,6 +102,5 @@
public boolean closeOtherPages() {
return closeOtherPages;
}
-
}
}
diff --git a/cdo/features/org.eclipse.papyrus.cdo.feature/feature.xml b/cdo/features/org.eclipse.papyrus.cdo.feature/feature.xml
index bfbb29e..1464473 100755
--- a/cdo/features/org.eclipse.papyrus.cdo.feature/feature.xml
+++ b/cdo/features/org.eclipse.papyrus.cdo.feature/feature.xml
@@ -34,11 +34,11 @@
<requires>
<import feature="org.eclipse.papyrus.sdk.feature" version="6.0.0" match="compatible"/>
- <import plugin="org.eclipse.emf.cdo.ecore" version="1.1.2" match="compatible"/>
- <import plugin="org.eclipse.emf.cdo.gmf.notation" version="1.10.1" match="compatible"/>
+ <import plugin="org.eclipse.emf.cdo.ecore" version="1.1.3" match="compatible"/>
+ <import plugin="org.eclipse.emf.cdo.gmf.notation" version="1.10.2" match="compatible"/>
<import plugin="org.eclipse.emf.cdo.genmodel" version="1.0.0" match="compatible"/>
- <import feature="org.eclipse.emf.cdo.sdk" version="5.6.0" match="compatible"/>
- <import feature="org.eclipse.emf.cdo.dawn" version="2.3.0" match="compatible"/>
+ <import feature="org.eclipse.emf.cdo.sdk" version="5.9.0" match="compatible"/>
+ <import feature="org.eclipse.emf.cdo.dawn" version="2.3.1" match="compatible"/>
</requires>
<plugin
diff --git a/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.targetplatform/org.eclipse.papyrus.cdo.targetplatform.target b/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.targetplatform/org.eclipse.papyrus.cdo.targetplatform.target
index 1e37397..20dfcff 100755
--- a/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.targetplatform/org.eclipse.papyrus.cdo.targetplatform.target
+++ b/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.targetplatform/org.eclipse.papyrus.cdo.targetplatform.target
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="CollaborativeModeling CDO - Papyrus latest release" sequenceNumber="1633015463">
+<target name="CollaborativeModeling CDO - Papyrus latest release" sequenceNumber="1637665700">
<locations>
<location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
<unit id="org.eclipse.papyrus.sdk.feature.feature.group" version="0.0.0"/>
@@ -22,7 +22,7 @@
<unit id="org.eclipse.emf.cdo.ecore" version="0.0.0"/>
<unit id="org.eclipse.emf.cdo.genmodel" version="0.0.0"/>
<unit id="org.eclipse.emf.cdo.gmf.notation" version="0.0.0"/>
- <repository id="cdo" location="https://download.eclipse.org/modeling/emf/cdo/drops/R20210908-0655"/>
+ <repository id="cdo" location="https://download.eclipse.org/modeling/emf/cdo/updates/integration/latest/"/>
</location>
<location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
<unit id="org.eclipse.xwt.feature.feature.group" version="0.0.0"/>
diff --git a/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.targetplatform/org.eclipse.papyrus.cdo.targetplatform.tpd b/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.targetplatform/org.eclipse.papyrus.cdo.targetplatform.tpd
index 3744727..0014d7c 100755
--- a/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.targetplatform/org.eclipse.papyrus.cdo.targetplatform.tpd
+++ b/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.targetplatform/org.eclipse.papyrus.cdo.targetplatform.tpd
@@ -7,8 +7,6 @@
org.eclipse.papyrus.junit.utils lazy
org.eclipse.papyrus.junit.framework lazy
org.eclipse.papyrus.toolsmiths.feature.feature.group lazy
- //TODO add this feature for the next update:
- //org.eclipse.papyrus.infra.textedit.feature.feature.group lazy
}
location "https://download.eclipse.org/releases/2021-09/" eclipse {
@@ -19,7 +17,7 @@
// manual update
//location cdo "https://download.eclipse.org/modeling/emf/cdo/updates/integration/latest/" {
-location cdo "https://download.eclipse.org/modeling/emf/cdo/drops/R20210908-0655"{
+location cdo "https://download.eclipse.org/modeling/emf/cdo/updates/integration/latest/"{
org.eclipse.emf.cdo.sdk.feature.group lazy
org.eclipse.emf.cdo.dawn.feature.group lazy
org.eclipse.emf.cdo.ecore lazy