Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2020-05-27 05:39:19 +0000
committerEike Stepper2020-05-27 05:39:19 +0000
commit2662faf94c9f96e32766475a2b61463137193c31 (patch)
treef5cf1bf873927cfd87203f4481bce5fc05c8842e
parent55a82e7bba8d6a8073ae2aaa332e45b27883349f (diff)
downloadcdo-2662faf94c9f96e32766475a2b61463137193c31.tar.gz
cdo-2662faf94c9f96e32766475a2b61463137193c31.tar.xz
cdo-2662faf94c9f96e32766475a2b61463137193c31.zip
[561892] Make CDO Editor initialization asynchronous and resilient to connection failures
https://bugs.eclipse.org/bugs/show_bug.cgi?id=561892
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml8
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutContentProvider.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOModelEditorInput.java (renamed from plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutEditorInput.java)12
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOModelEditorOpener.java (renamed from plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutEditorOpener.java)6
4 files changed, 21 insertions, 15 deletions
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml b/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
index 76e37ccdbb..4bc15adfd0 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
@@ -817,15 +817,15 @@
<extension point="org.eclipse.ui.elementFactories">
<factory
- id="org.eclipse.emf.cdo.explorer.ui.checkouts.CDOCheckoutEditorInput.ElementFactory"
- class="org.eclipse.emf.cdo.explorer.ui.checkouts.CDOCheckoutEditorInput$ElementFactory"/>
+ id="org.eclipse.emf.cdo.explorer.ui.checkouts.CDOModelEditorInput.ElementFactory"
+ class="org.eclipse.emf.cdo.explorer.ui.checkouts.CDOModelEditorInput$ElementFactory"/>
</extension>
<extension point="org.eclipse.emf.cdo.ui.editorOpeners">
<editorOpener
- class="org.eclipse.emf.cdo.explorer.ui.checkouts.CDOCheckoutEditorOpener"
+ class="org.eclipse.emf.cdo.explorer.ui.checkouts.CDOModelEditorOpener"
icon="icons/cdo_editor.gif"
- id="org.eclipse.emf.cdo.explorer.ui.CDOCheckoutEditorOpener"
+ id="org.eclipse.emf.cdo.explorer.ui.CDOModelEditorOpener"
name="CDO Editor"
priority="100"
regex="cdo\.checkout://.*"/>
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutContentProvider.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutContentProvider.java
index c654b54b96..9dafaa6517 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutContentProvider.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutContentProvider.java
@@ -80,6 +80,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.function.Predicate;
/**
* @author Eike Stepper
@@ -557,7 +558,7 @@ public class CDOCheckoutContentProvider extends CDOContentProvider<CDOCheckout>
return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
}
- public static TreeViewer createTreeViewer(Composite container)
+ public static TreeViewer createTreeViewer(Composite container, Predicate<Object> contentPredicate)
{
// TODO This is not lazy, async:
CDOItemProvider parentItemProvider = new CDOItemProvider(null)
@@ -574,7 +575,7 @@ public class CDOCheckoutContentProvider extends CDOContentProvider<CDOCheckout>
List<Object> children = new ArrayList<>();
for (Object child : doGetChildren(element))
{
- if (child instanceof CDOCheckout || child instanceof CDOResourceFolder)
+ if (contentPredicate.test(child))
{
children.add(child);
}
@@ -616,6 +617,11 @@ public class CDOCheckoutContentProvider extends CDOContentProvider<CDOCheckout>
return parentViewer;
}
+ public static TreeViewer createTreeViewer(Composite container)
+ {
+ return createTreeViewer(container, child -> child instanceof CDOCheckout || child instanceof CDOResourceFolder);
+ }
+
public static final CDOCheckoutContentProvider getInstance(String viewerID)
{
return INSTANCES.get(viewerID);
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutEditorInput.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOModelEditorInput.java
index c1574b4db7..6f9fd79697 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutEditorInput.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOModelEditorInput.java
@@ -43,7 +43,7 @@ import org.eclipse.ui.IPersistableElement;
/**
* @author Eike Stepper
*/
-public class CDOCheckoutEditorInput extends PlatformObject implements CDOEditorInput2, CDOEditorInput3, IPersistableElement
+public class CDOModelEditorInput extends PlatformObject implements CDOEditorInput2, CDOEditorInput3, IPersistableElement
{
protected static final String URI_TAG = "uri";
@@ -57,7 +57,7 @@ public class CDOCheckoutEditorInput extends PlatformObject implements CDOEditorI
private CDOID objectID;
- public CDOCheckoutEditorInput(URI uri)
+ public CDOModelEditorInput(URI uri)
{
CheckUtil.checkArg(uri, "uri is null");
this.uri = uri;
@@ -241,7 +241,7 @@ public class CDOCheckoutEditorInput extends PlatformObject implements CDOEditorI
@Override
public boolean equals(Object o)
{
- return this == o || o instanceof CDOCheckoutEditorInput && uri.equals(((CDOCheckoutEditorInput)o).getURI());
+ return this == o || o instanceof CDOModelEditorInput && uri.equals(((CDOModelEditorInput)o).getURI());
}
protected void configureView(CDOView view)
@@ -254,7 +254,7 @@ public class CDOCheckoutEditorInput extends PlatformObject implements CDOEditorI
protected void configureTransaction(CDOTransaction transaction)
{
- CDOCheckoutEditorOpener.addConflictResolver(transaction);
+ CDOModelEditorOpener.addConflictResolver(transaction);
}
/**
@@ -262,7 +262,7 @@ public class CDOCheckoutEditorInput extends PlatformObject implements CDOEditorI
*/
public static class ElementFactory implements IElementFactory
{
- public static final String ID = "org.eclipse.emf.cdo.explorer.ui.checkouts.CDOCheckoutEditorInput.ElementFactory";
+ public static final String ID = "org.eclipse.emf.cdo.explorer.ui.checkouts.CDOModelEditorInput.ElementFactory";
public ElementFactory()
{
@@ -272,7 +272,7 @@ public class CDOCheckoutEditorInput extends PlatformObject implements CDOEditorI
public IAdaptable createElement(IMemento memento)
{
URI uri = URI.createURI(memento.getString(URI_TAG));
- return new CDOCheckoutEditorInput(uri);
+ return new CDOModelEditorInput(uri);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutEditorOpener.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOModelEditorOpener.java
index 12efd7f609..e1450528ae 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutEditorOpener.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOModelEditorOpener.java
@@ -30,18 +30,18 @@ import org.eclipse.ui.PartInitException;
/**
* @author Eike Stepper
*/
-public class CDOCheckoutEditorOpener extends CDOEditorOpener.Default
+public class CDOModelEditorOpener extends CDOEditorOpener.Default
{
private static final boolean INTERACTIVE_CONFLICT_RESOLUTION = OMPlatform.INSTANCE.isProperty("cdo.interactive.conflict.resolution", true);
- public CDOCheckoutEditorOpener()
+ public CDOModelEditorOpener()
{
}
@Override
protected IEditorPart doOpenEditor(IWorkbenchPage page, URI uri)
{
- CDOCheckoutEditorInput editorInput = new CDOCheckoutEditorInput(uri);
+ CDOModelEditorInput editorInput = new CDOModelEditorInput(uri);
String editorID = CDOEditorUtil.getEditorID();
try

Back to the top