Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2015-01-28 10:34:07 +0000
committerEike Stepper2015-02-18 14:39:14 +0000
commit167116586abca36ecf727c007074339c444f8373 (patch)
tree6ee9dd2d5ad2c2b37cc115758bc6e6dd35333e0f
parent53962cf5c51ca08ab8e1ce11021c74096e2fb8e7 (diff)
downloadcdo-167116586abca36ecf727c007074339c444f8373.tar.gz
cdo-167116586abca36ecf727c007074339c444f8373.tar.xz
cdo-167116586abca36ecf727c007074339c444f8373.zip
[458349] Consolidate UI
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=458349
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/.settings/org.eclipse.jdt.ui.prefs10
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/icons/checkout_closed.gifbin0 -> 574 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml4
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutContentProvider.java497
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutLabelProvider.java55
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoriesView.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoryItemProvider.java36
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/NewRepositoryDialog.java (renamed from plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/NewRepositoryLocationDialog.java)4
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/ViewerUtil.java107
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOCheckout.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOCheckoutManager.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOCheckoutImpl.java86
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOCheckoutManagerImpl.java41
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryImpl.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadRevisionsRequest.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/FSMUtil.java17
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java14
19 files changed, 845 insertions, 73 deletions
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.emf.cdo.explorer.ui/.settings/org.eclipse.jdt.ui.prefs
index 72f4c75fe8..c53448dbe3 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/.settings/org.eclipse.jdt.ui.prefs
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -12,7 +12,7 @@ cleanup.always_use_parentheses_in_expressions=false
cleanup.always_use_this_for_non_static_field_access=false
cleanup.always_use_this_for_non_static_method_access=false
cleanup.convert_to_enhanced_for_loop=false
-cleanup.correct_indentation=true
+cleanup.correct_indentation=false
cleanup.format_source_code=true
cleanup.format_source_code_changes_only=false
cleanup.make_local_variable_final=true
@@ -78,10 +78,12 @@ sp_cleanup.always_use_blocks=true
sp_cleanup.always_use_parentheses_in_expressions=false
sp_cleanup.always_use_this_for_non_static_field_access=false
sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=false
sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=true
+sp_cleanup.correct_indentation=false
sp_cleanup.format_source_code=true
sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
sp_cleanup.make_local_variable_final=false
sp_cleanup.make_parameters_final=false
sp_cleanup.make_private_fields_final=true
@@ -97,6 +99,7 @@ sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=false
sp_cleanup.remove_trailing_whitespaces=true
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
@@ -110,10 +113,13 @@ sp_cleanup.remove_unused_private_methods=true
sp_cleanup.remove_unused_private_types=true
sp_cleanup.sort_members=false
sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
sp_cleanup.use_blocks=true
sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=false
sp_cleanup.use_parentheses_in_expressions=true
sp_cleanup.use_this_for_non_static_field_access=true
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
sp_cleanup.use_this_for_non_static_method_access=true
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+sp_cleanup.use_type_arguments=false
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.explorer.ui/META-INF/MANIFEST.MF
index 919e83e44d..1ed45edeca 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/META-INF/MANIFEST.MF
@@ -10,6 +10,7 @@ Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
+ org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)",
org.eclipse.emf.cdo.explorer;bundle-version="[4.4.0,5.0.0)",
org.eclipse.emf.cdo.ui;bundle-version="[4.0.0,5.0.0)",
org.eclipse.ui.navigator;bundle-version="[3.5.0,4.0.0)",
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/checkout_closed.gif b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/checkout_closed.gif
new file mode 100644
index 0000000000..5fbf13bd8b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/checkout_closed.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml b/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
index 759cacbe0f..85d5e43b6e 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
@@ -64,6 +64,9 @@
<triggerPoints>
<or>
<instanceof
+ value="org.eclipse.core.resources.IWorkspaceRoot">
+ </instanceof>
+ <instanceof
value="org.eclipse.emf.cdo.explorer.CDOCheckout">
</instanceof>
<instanceof
@@ -80,7 +83,6 @@
viewerId="org.eclipse.ui.navigator.ProjectExplorer">
<includes>
<contentExtension
- isRoot="true"
pattern="org.eclipse.emf.cdo.explorer.ui.CDOCheckouts">
</contentExtension>
</includes>
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutContentProvider.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutContentProvider.java
index 4041d12cd7..be57aba6eb 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutContentProvider.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutContentProvider.java
@@ -11,29 +11,109 @@
*/
package org.eclipse.emf.cdo.explorer.ui;
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDOList;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
import org.eclipse.emf.cdo.explorer.CDOCheckout;
import org.eclipse.emf.cdo.explorer.CDOCheckoutManager;
+import org.eclipse.emf.cdo.explorer.CDOCheckoutManager.CheckoutOpenEvent;
import org.eclipse.emf.cdo.explorer.CDOExplorerUtil;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
+import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.net4j.util.container.IContainerEvent;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.edit.EMFEditPlugin;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
+import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.spi.cdo.FSMUtil;
+import org.eclipse.emf.spi.cdo.InternalCDOObject;
+import org.eclipse.emf.spi.cdo.InternalCDOView;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.viewers.IOpenListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.OpenEvent;
+import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.events.TreeEvent;
+import org.eclipse.swt.events.TreeListener;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
/**
* @author Eike Stepper
- * @since 4.3
*/
-public class CDOCheckoutContentProvider extends AdapterFactoryContentProvider
+public class CDOCheckoutContentProvider extends AdapterFactoryContentProvider implements IOpenListener, TreeListener
{
- private static final CDOCheckoutManager MANAGER = CDOExplorerUtil.getCheckoutManager();
+ private static final Method GET_CHILDREN_FEATURES_METHOD;
+
+ private static final CDOCheckoutManager CHECKOUT_MANAGER = CDOExplorerUtil.getCheckoutManager();
+
+ private final IListener checkoutManagerListener = new IListener()
+ {
+ public void notifyEvent(IEvent event)
+ {
+ if (event instanceof IContainerEvent)
+ {
+ ViewerUtil.refresh(viewer, null);
+ }
+ else if (event instanceof CheckoutOpenEvent)
+ {
+ CheckoutOpenEvent e = (CheckoutOpenEvent)event;
+ CDOCheckout checkout = e.getCheckout();
+
+ if (!e.isOpen())
+ {
+ ViewerUtil.expand(viewer, checkout, false);
+ }
+
+ ViewerUtil.refresh(viewer, checkout);
+
+ if (e.isOpen())
+ {
+ ViewerUtil.expand(viewer, checkout, true);
+ }
+ }
+ }
+ };
+
+ private final Map<CDOCheckout, CDOCheckout> openingCheckouts = new ConcurrentHashMap<CDOCheckout, CDOCheckout>();
+
+ private final Map<Object, Object[]> childrenCache = new ConcurrentHashMap<Object, Object[]>();
private final ComposedAdapterFactory adapterFactory;
+ private TreeViewer viewer;
+
private Object input;
public CDOCheckoutContentProvider()
@@ -45,62 +125,254 @@ public class CDOCheckoutContentProvider extends AdapterFactoryContentProvider
adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
setAdapterFactory(adapterFactory);
+
+ CHECKOUT_MANAGER.addListener(checkoutManagerListener);
}
@Override
public void dispose()
{
super.dispose();
+
+ CHECKOUT_MANAGER.removeListener(checkoutManagerListener);
adapterFactory.dispose();
}
@Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+ public void inputChanged(Viewer newViewer, Object oldInput, Object newInput)
{
- super.inputChanged(viewer, oldInput, newInput);
+ TreeViewer newTreeViewer = null;
+ if (newViewer instanceof TreeViewer)
+ {
+ newTreeViewer = (TreeViewer)newViewer;
+ }
+
+ if (newTreeViewer != viewer)
+ {
+ if (viewer != null)
+ {
+ viewer.removeOpenListener(this);
+ viewer.getTree().removeTreeListener(this);
+ }
+
+ viewer = newTreeViewer;
+
+ if (viewer != null)
+ {
+ viewer.getTree().addTreeListener(this);
+ viewer.addOpenListener(this);
+ }
+ }
+
input = newInput;
+
+ super.inputChanged(newTreeViewer, oldInput, newInput);
}
@Override
- public Object[] getElements(Object object)
+ public boolean hasChildren(Object object)
{
- Object[] children = getRootContent(object);
- if (children != null)
+ boolean children = doHasChildren(object);
+ System.out.println("hasChildren(" + object + ") = " + children);
+ return children;
+ }
+
+ private boolean doHasChildren(Object object)
+ {
+ if (object == input)
{
- return children;
+ return !CHECKOUT_MANAGER.isEmpty();
}
- return super.getElements(object);
- }
+ if (object instanceof ViewerUtil.Pending)
+ {
+ return false;
+ }
- @Override
- public Object[] getChildren(Object object)
- {
- Object[] children = getRootContent(object);
- if (children != null)
+ if (object instanceof CDOCheckout)
{
- return children;
+ CDOCheckout checkout = (CDOCheckout)object;
+ if (!checkout.isOpen())
+ {
+ if (openingCheckouts.get(checkout) != null)
+ {
+ // This must be the ViewerUtil.Pending element.
+ return true;
+ }
+
+ return false;
+ }
+
+ object = checkout.getRootObject();
+ }
+
+ if (GET_CHILDREN_FEATURES_METHOD != null && object instanceof EObject)
+ {
+ EObject eObject = (EObject)object;
+
+ InternalCDOObject cdoObject = getCDOObject(eObject);
+ if (cdoObject != null)
+ {
+ InternalCDORevision revision = cdoObject.cdoRevision(false);
+ if (revision != null)
+ {
+ ITreeItemContentProvider provider = (ITreeItemContentProvider)adapterFactory.adapt(object,
+ ITreeItemContentProvider.class);
+ if (provider instanceof ItemProviderAdapter)
+ {
+ try
+ {
+ return hasChildren(cdoObject, revision, (ItemProviderAdapter)provider);
+ }
+ catch (Exception ex)
+ {
+ //$FALL-THROUGH$
+ }
+ }
+ }
+ }
}
- return super.getChildren(object);
+ return super.hasChildren(object);
}
@Override
- public boolean hasChildren(Object object)
+ public Object[] getChildren(Object object)
+ {
+ Object[] children = doGetChildren(object);
+ System.out.println("getChildren(" + object + ") = " + Arrays.asList(children));
+ return children;
+ }
+
+ private Object[] doGetChildren(Object object)
{
if (object == input)
{
- return !MANAGER.isEmpty();
+ return CHECKOUT_MANAGER.getCheckouts();
+ }
+
+ if (object instanceof ViewerUtil.Pending)
+ {
+ return ViewerUtil.NO_CHILDREN;
}
+ final Object originalObject = object;
+ Object[] children = childrenCache.remove(originalObject);
+ if (children != null)
+ {
+ return children;
+ }
+
+ CDOCheckout openingCheckout = null;
+
if (object instanceof CDOCheckout)
{
CDOCheckout checkout = (CDOCheckout)object;
- EObject rootObject = checkout.getRootObject();
- return super.hasChildren(rootObject);
+ if (!checkout.isOpen())
+ {
+ openingCheckout = openingCheckouts.remove(checkout);
+ if (openingCheckout == null)
+ {
+ return ViewerUtil.NO_CHILDREN;
+ }
+ }
+
+ if (openingCheckout == null)
+ {
+ object = checkout.getRootObject();
+ }
}
- return super.hasChildren(object);
+ final List<CDORevision> loadedRevisions = new ArrayList<CDORevision>();
+ final List<CDOID> missingIDs = new ArrayList<CDOID>();
+
+ if (openingCheckout == null)
+ {
+ children = determineChildRevisions(object, loadedRevisions, missingIDs);
+ if (children != null)
+ {
+ return children;
+ }
+ }
+
+ final Object finalObject = object;
+ final CDOCheckout finalOpeningCheckout = openingCheckout;
+
+ new Job("Load " + finalObject)
+ {
+ @Override
+ protected IStatus run(IProgressMonitor monitor)
+ {
+ if (finalOpeningCheckout != null)
+ {
+ finalOpeningCheckout.open();
+ determineChildRevisions(finalObject, loadedRevisions, missingIDs);
+ }
+
+ if (!missingIDs.isEmpty())
+ {
+ CDOObject cdoObject = CDOUtil.getCDOObject((EObject)finalObject);
+ CDOView view = cdoObject.cdoView();
+ CDORevisionManager revisionManager = view.getSession().getRevisionManager();
+ List<CDORevision> revisions = revisionManager.getRevisions(missingIDs, view, CDORevision.UNCHUNKED,
+ CDORevision.DEPTH_NONE, true);
+ loadedRevisions.addAll(revisions);
+ }
+
+ Object[] children = CDOCheckoutContentProvider.super.getChildren(finalObject);
+ childrenCache.put(originalObject, children);
+
+ // The viewer must be refreshed synchronously so that the loaded children don't get garbage collected.
+ ViewerUtil.refresh(viewer, originalObject, false);
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+
+ return new Object[] { new ViewerUtil.Pending(finalObject) };
+ }
+
+ private Object[] determineChildRevisions(Object object, List<CDORevision> loadedRevisions, List<CDOID> missingIDs)
+ {
+ if (GET_CHILDREN_FEATURES_METHOD != null && object instanceof EObject)
+ {
+ EObject eObject = (EObject)object;
+
+ InternalCDOObject cdoObject = getCDOObject(eObject);
+ if (cdoObject != null)
+ {
+ InternalCDORevision revision = cdoObject.cdoRevision(false);
+ if (revision != null)
+ {
+ ITreeItemContentProvider provider = (ITreeItemContentProvider)adapterFactory.adapt(object,
+ ITreeItemContentProvider.class);
+ if (provider instanceof ItemProviderAdapter)
+ {
+ try
+ {
+ determineChildRevisions(cdoObject, revision, (ItemProviderAdapter)provider, loadedRevisions, missingIDs);
+ }
+ catch (Exception ex)
+ {
+ //$FALL-THROUGH$
+ }
+
+ if (missingIDs.isEmpty())
+ {
+ // All revisions are cached. Just return the objects without server round-trips.
+ return super.getChildren(object);
+ }
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public Object[] getElements(Object object)
+ {
+ return getChildren(object);
}
@Override
@@ -119,19 +391,186 @@ public class CDOCheckoutContentProvider extends AdapterFactoryContentProvider
return super.getParent(object);
}
- private Object[] getRootContent(Object object)
+ @Override
+ public void notifyChanged(Notification notification)
{
- if (object == input)
+ Object notifier = notification.getNotifier();
+ if (notifier instanceof EObject)
{
- return MANAGER.getCheckouts();
+ EObject eObject = (EObject)notifier;
+
+ Object feature = notification.getFeature();
+ if (feature instanceof EReference)
+ {
+ EReference reference = (EReference)feature;
+ if (reference.isContainment())
+ {
+ Adapter adapter = EcoreUtil.getAdapter(eObject.eAdapters(), CDOCheckout.class);
+ if (adapter instanceof CDOCheckout)
+ {
+ CDOCheckout checkout = (CDOCheckout)adapter;
+ if (checkout.isOpen())
+ {
+ notification = new ViewerNotification(notification, checkout, true, true);
+ }
+ }
+ }
+ }
}
- if (object instanceof CDOCheckout)
+ super.notifyChanged(notification);
+ }
+
+ public void treeCollapsed(TreeEvent e)
+ {
+ // TODO Check if this optimization is still needed!
+ int xxx;
+
+ if (e.data instanceof EObject)
{
- CDOCheckout checkout = (CDOCheckout)object;
- return super.getChildren(checkout.getRootObject());
+ // Make sure that invisible children can be garbage collected.
+ // In getChildren() is a special check for collapsed parents that removes of the TreeItems from the Tree.
+ viewer.refresh(e.data, false);
+ }
+ }
+
+ public void treeExpanded(TreeEvent e)
+ {
+ // Do nothing.
+ }
+
+ public void open(OpenEvent event)
+ {
+ ISelection selection = event.getSelection();
+ if (selection instanceof IStructuredSelection)
+ {
+ IStructuredSelection ssel = (IStructuredSelection)selection;
+ if (ssel.size() == 1)
+ {
+ Object element = ssel.getFirstElement();
+ if (element instanceof CDOCheckout)
+ {
+ CDOCheckout checkout = (CDOCheckout)element;
+ if (!checkout.isOpen())
+ {
+ // Mark this checkout as loading.
+ openingCheckouts.put(checkout, checkout);
+
+ // Trigger hasChildren().
+ ViewerUtil.refresh(viewer, checkout);
+
+ // Trigger getChildren().
+ ViewerUtil.expand(viewer, checkout, true);
+ }
+ }
+ }
+ }
+ }
+
+ private static InternalCDOObject getCDOObject(EObject eObject)
+ {
+ if (eObject instanceof InternalCDOObject)
+ {
+ return (InternalCDOObject)eObject;
+ }
+
+ Adapter adapter = FSMUtil.getLegacyAdapter(eObject);
+ if (adapter != null)
+ {
+ return (InternalCDOObject)adapter;
}
return null;
}
+
+ private static boolean hasChildren(InternalCDOObject cdoObject, InternalCDORevision revision,
+ ItemProviderAdapter provider) throws Exception
+ {
+ for (EStructuralFeature feature : getChildrenFeatures(cdoObject, provider))
+ {
+ if (feature.isMany())
+ {
+ if (!revision.isEmpty(feature))
+ {
+ return true;
+ }
+ }
+ else if (revision.getValue(feature) != null)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private static InternalCDORevisionManager determineChildRevisions(InternalCDOObject cdoObject,
+ InternalCDORevision revision, ItemProviderAdapter provider, List<CDORevision> loadedRevisions,
+ List<CDOID> missingIDs) throws Exception
+ {
+ InternalCDOView view = cdoObject.cdoView();
+ InternalCDORevisionManager revisionManager = view.getSession().getRevisionManager();
+ InternalCDORevisionCache cache = revisionManager.getCache();
+
+ for (EStructuralFeature feature : getChildrenFeatures(cdoObject, provider))
+ {
+ if (feature.isMany())
+ {
+ CDOList list = revision.getList(feature);
+ for (Object object : list)
+ {
+ determineChildRevision(loadedRevisions, missingIDs, view, cache, object);
+ }
+ }
+ else
+ {
+ Object value = revision.getValue(feature);
+ determineChildRevision(loadedRevisions, missingIDs, view, cache, value);
+ }
+ }
+
+ return revisionManager;
+ }
+
+ private static void determineChildRevision(List<CDORevision> loadedRevisions, List<CDOID> missingIDs,
+ InternalCDOView view, InternalCDORevisionCache cache, Object object)
+ {
+ if (object instanceof CDOID)
+ {
+ CDOID id = (CDOID)object;
+ CDORevision childRevision = cache.getRevision(id, view);
+ if (childRevision != null)
+ {
+ loadedRevisions.add(childRevision);
+ }
+ else
+ {
+ missingIDs.add(id);
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private static Collection<? extends EStructuralFeature> getChildrenFeatures(InternalCDOObject cdoObject,
+ ItemProviderAdapter provider) throws Exception
+ {
+ return (Collection<? extends EStructuralFeature>)GET_CHILDREN_FEATURES_METHOD.invoke(provider, cdoObject);
+ }
+
+ static
+ {
+ Method method = null;
+
+ try
+ {
+ method = ItemProviderAdapter.class.getDeclaredMethod("getChildrenFeatures", Object.class);
+ method.setAccessible(true);
+ }
+ catch (Throwable ex)
+ {
+ //$FALL-THROUGH$
+ }
+
+ GET_CHILDREN_FEATURES_METHOD = method;
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutLabelProvider.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutLabelProvider.java
index 85274001c4..781c96c8a3 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutLabelProvider.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutLabelProvider.java
@@ -14,24 +14,30 @@ import org.eclipse.emf.cdo.eresource.CDOResourceNode;
import org.eclipse.emf.cdo.explorer.CDOCheckout;
import org.eclipse.emf.cdo.explorer.ui.bundle.OM;
+import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
+
import org.eclipse.emf.edit.EMFEditPlugin;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
/**
* @author Eike Stepper
- * @since 4.3
*/
public class CDOCheckoutLabelProvider extends AdapterFactoryLabelProvider
{
private final ComposedAdapterFactory adapterFactory;
- private Image checkoutImage;
+ private final Image checkoutImage;
+
+ private final Image checkoutClosedImage;
+
+ private final Image errorImage;
public CDOCheckoutLabelProvider()
{
@@ -43,13 +49,15 @@ public class CDOCheckoutLabelProvider extends AdapterFactoryLabelProvider
adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
setAdapterFactory(adapterFactory);
- ImageDescriptor imageDescriptor = OM.getImageDescriptor("icons/checkout.gif");
- checkoutImage = imageDescriptor.createImage();
+ checkoutImage = OM.getImageDescriptor("icons/checkout.gif").createImage();
+ checkoutClosedImage = OM.getImageDescriptor("icons/checkout_closed.gif").createImage();
+ errorImage = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
}
@Override
public void dispose()
{
+ checkoutClosedImage.dispose();
checkoutImage.dispose();
super.dispose();
@@ -69,7 +77,20 @@ public class CDOCheckoutLabelProvider extends AdapterFactoryLabelProvider
if (element instanceof CDOResourceNode)
{
CDOResourceNode resourceNode = (CDOResourceNode)element;
- return resourceNode.getName();
+
+ try
+ {
+ return resourceNode.getName();
+ }
+ catch (Exception ex)
+ {
+ return ex.getMessage();
+ }
+ }
+
+ if (element instanceof ViewerUtil.Pending)
+ {
+ return "Loading...";
}
return super.getText(element);
@@ -80,9 +101,27 @@ public class CDOCheckoutLabelProvider extends AdapterFactoryLabelProvider
{
if (element instanceof CDOCheckout)
{
- return checkoutImage;
+ CDOCheckout checkout = (CDOCheckout)element;
+ if (checkout.isOpen())
+ {
+ return checkoutImage;
+ }
+
+ return checkoutClosedImage;
+ }
+
+ if (element instanceof ViewerUtil.Pending)
+ {
+ return ContainerItemProvider.IMAGE_PENDING;
}
- return super.getImage(element);
+ try
+ {
+ return super.getImage(element);
+ }
+ catch (Exception ex)
+ {
+ return errorImage;
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoriesView.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoriesView.java
index 0217abf4dd..87addb1cc3 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoriesView.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoriesView.java
@@ -115,7 +115,7 @@ public class CDORepositoriesView extends ContainerView
if (selection.size() == 1)
{
Object element = selection.getFirstElement();
- manager.add(new ConnectAction(element));
+ manager.add(new CheckoutAction(element));
}
}
@@ -127,7 +127,11 @@ public class CDORepositoriesView extends ContainerView
CDORepository repository = (CDORepository)object;
if (!repository.isConnected())
{
+ int xxx;
+ // TODO Make async!
repository.connect();
+
+ ViewerUtil.expand(getViewer(), repository, true);
return;
}
}
@@ -229,8 +233,8 @@ public class CDORepositoriesView extends ContainerView
{
try
{
- NewRepositoryLocationDialog dialog = new NewRepositoryLocationDialog(getSite().getShell());
- if (dialog.open() == NewRepositoryLocationDialog.OK)
+ NewRepositoryDialog dialog = new NewRepositoryDialog(getSite().getShell());
+ if (dialog.open() == NewRepositoryDialog.OK)
{
String connectorType = dialog.getConnectorType();
String connectorDescription = dialog.getConnectorDescription();
@@ -251,15 +255,15 @@ public class CDORepositoriesView extends ContainerView
/**
* @author Eike Stepper
*/
- private final class ConnectAction extends Action
+ private final class CheckoutAction extends Action
{
private final Object element;
- public ConnectAction(Object element)
+ public CheckoutAction(Object element)
{
this.element = element;
- setText("Connect...");
+ setText("Checkout...");
setToolTipText("Create an online checkout");
setImageDescriptor(OM.getImageDescriptor("icons/add.gif"));
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoryItemProvider.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoryItemProvider.java
index 9086c98ee2..4e0a5d535d 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoryItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoryItemProvider.java
@@ -12,7 +12,7 @@ package org.eclipse.emf.cdo.explorer.ui;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.explorer.CDORepository;
-import org.eclipse.emf.cdo.explorer.CDORepositoryManager;
+import org.eclipse.emf.cdo.explorer.CDORepositoryManager.RepositoryConnectionEvent;
import org.eclipse.emf.cdo.ui.shared.SharedIcons;
import org.eclipse.net4j.util.container.IContainer;
@@ -25,6 +25,7 @@ import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
@@ -46,10 +47,23 @@ public class CDORepositoryItemProvider extends ContainerItemProvider<IContainer<
{
public void notifyEvent(IEvent event)
{
- if (event instanceof CDORepositoryManager.RepositoryConnectionEvent)
+ if (event instanceof RepositoryConnectionEvent)
{
- CDORepositoryManager.RepositoryConnectionEvent e = (CDORepositoryManager.RepositoryConnectionEvent)event;
- refreshElement(e.getRepository(), true);
+ RepositoryConnectionEvent e = (RepositoryConnectionEvent)event;
+ CDORepository repository = e.getRepository();
+ TreeViewer viewer = getViewer();
+
+ if (!e.isConnected())
+ {
+ ViewerUtil.expand(viewer, repository, false);
+ }
+
+ ViewerUtil.refresh(viewer, repository);
+
+ // if (e.isConnected())
+ // {
+ // ViewerUtil.setExpandedState(viewer, repository, true);
+ // }
}
}
};
@@ -66,6 +80,12 @@ public class CDORepositoryItemProvider extends ContainerItemProvider<IContainer<
}
@Override
+ public TreeViewer getViewer()
+ {
+ return (TreeViewer)super.getViewer();
+ }
+
+ @Override
public boolean hasChildren(Object element)
{
if (element instanceof CDORepository)
@@ -88,7 +108,7 @@ public class CDORepositoryItemProvider extends ContainerItemProvider<IContainer<
CDORepository repository = (CDORepository)element;
if (!repository.isConnected())
{
- return new Object[0];
+ return ViewerUtil.NO_CHILDREN;
}
}
@@ -98,6 +118,12 @@ public class CDORepositoryItemProvider extends ContainerItemProvider<IContainer<
@Override
public String getText(Object element)
{
+ if (element instanceof CDORepository)
+ {
+ CDORepository repository = (CDORepository)element;
+ return repository.getLabel();
+ }
+
if (element instanceof CDOBranch)
{
CDOBranch branch = (CDOBranch)element;
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/NewRepositoryLocationDialog.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/NewRepositoryDialog.java
index 1e459497b9..625050e99b 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/NewRepositoryLocationDialog.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/NewRepositoryDialog.java
@@ -27,7 +27,7 @@ import org.eclipse.swt.widgets.Text;
/**
* @author Eike Stepper
*/
-public class NewRepositoryLocationDialog extends TitleAreaDialog
+public class NewRepositoryDialog extends TitleAreaDialog
{
private ElementWizardComposite connectorWizard;
@@ -39,7 +39,7 @@ public class NewRepositoryLocationDialog extends TitleAreaDialog
private String repositoryName;
- public NewRepositoryLocationDialog(Shell parentShell)
+ public NewRepositoryDialog(Shell parentShell)
{
super(parentShell);
setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.MAX | SWT.TITLE | SWT.RESIZE);
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/ViewerUtil.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/ViewerUtil.java
new file mode 100644
index 0000000000..72b58a5973
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/ViewerUtil.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2009-2013 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.explorer.ui;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Tree;
+
+/**
+ * @author Eike Stepper
+ */
+public final class ViewerUtil
+{
+ public static final Object[] NO_CHILDREN = {};
+
+ private ViewerUtil()
+ {
+ }
+
+ public static void refresh(TreeViewer viewer, Object element)
+ {
+ refresh(viewer, element, true);
+ }
+
+ public static void refresh(final TreeViewer viewer, final Object element, boolean async)
+ {
+ if (viewer != null)
+ {
+ Tree tree = viewer.getTree();
+ if (!tree.isDisposed())
+ {
+ Runnable runnable = new Runnable()
+ {
+ public void run()
+ {
+ if (element == null)
+ {
+ viewer.refresh();
+ }
+ else
+ {
+ System.out.println("refreshViewer(" + element + ")");
+ viewer.refresh(element);
+ }
+ }
+ };
+
+ Display display = tree.getDisplay();
+
+ if (async)
+ {
+ display.asyncExec(runnable);
+ }
+ else
+ {
+ display.syncExec(runnable);
+ }
+ }
+ }
+ }
+
+ public static void expand(final TreeViewer viewer, final Object element, final boolean expanded)
+ {
+ if (viewer != null)
+ {
+ Tree tree = viewer.getTree();
+ if (!tree.isDisposed())
+ {
+ Display display = tree.getDisplay();
+ display.asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ viewer.setExpandedState(element, expanded);
+ }
+ });
+ }
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Pending
+ {
+ private final Object parent;
+
+ public Pending(Object parent)
+ {
+ this.parent = parent;
+ }
+
+ public final Object getParent()
+ {
+ return parent;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOCheckout.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOCheckout.java
index 1cbdbf100d..718275bcd7 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOCheckout.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOCheckout.java
@@ -50,9 +50,13 @@ public interface CDOCheckout extends IAdaptable
public void setRootID(CDOID rootID);
- public CDOView getView();
+ public boolean isOpen();
- public EObject getRootObject();
+ public void open();
public void close();
+
+ public CDOView getView();
+
+ public EObject getRootObject();
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOCheckoutManager.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOCheckoutManager.java
index 90f28d3138..80386f115d 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOCheckoutManager.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOCheckoutManager.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.explorer;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.event.IEvent;
/**
* Manages a set of {@link CDOCheckout checkouts}.
@@ -27,4 +28,16 @@ public interface CDOCheckoutManager extends IContainer<CDOCheckout>
public CDOCheckout connect(String label, CDORepository repository, String branchPath, long timeStamp,
boolean readOnly, CDOID rootID);
+
+ /**
+ * @author Eike Stepper
+ */
+ public interface CheckoutOpenEvent extends IEvent
+ {
+ public CDOCheckoutManager getSource();
+
+ public CDOCheckout getCheckout();
+
+ public boolean isOpen();
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOCheckoutImpl.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOCheckoutImpl.java
index 39f384b745..fdaf9f1083 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOCheckoutImpl.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOCheckoutImpl.java
@@ -17,15 +17,36 @@ import org.eclipse.emf.cdo.explorer.CDORepository;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
+import org.eclipse.net4j.util.lifecycle.ILifecycleEvent.Kind;
+
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.core.runtime.Platform;
/**
* @author Eike Stepper
*/
-public abstract class CDOCheckoutImpl extends PlatformObject implements CDOCheckout
+public abstract class CDOCheckoutImpl extends AdapterImpl implements CDOCheckout
{
+ private final IListener viewListener = new IListener()
+ {
+ public void notifyEvent(IEvent event)
+ {
+ if (event instanceof ILifecycleEvent)
+ {
+ ILifecycleEvent e = (ILifecycleEvent)event;
+ if (e.getKind() == Kind.DEACTIVATED)
+ {
+ close();
+ }
+ }
+ }
+ };
+
private final CDOCheckoutManager checkoutManager;
private final CDORepository repository;
@@ -123,22 +144,49 @@ public abstract class CDOCheckoutImpl extends PlatformObject implements CDOCheck
public final synchronized void open()
{
- if (!isOpen())
+ boolean opened = false;
+ synchronized (viewListener)
{
- CDOSession session = ((CDORepositoryImpl)repository).openCheckout(this);
- view = openView(session);
- rootObject = loadRootObject();
+ if (!isOpen())
+ {
+ CDOSession session = ((CDORepositoryImpl)repository).openCheckout(this);
+
+ view = openView(session);
+ view.addListener(viewListener);
+
+ rootObject = loadRootObject();
+ rootObject.eAdapters().add(this);
+
+ opened = true;
+ }
+ }
+
+ if (opened)
+ {
+ ((CDOCheckoutManagerImpl)checkoutManager).fireCheckoutOpenEvent(this, true);
}
}
public final synchronized void close()
{
- if (isOpen())
+ boolean closed = false;
+ synchronized (viewListener)
{
- rootObject = null;
+ if (isOpen())
+ {
+ rootObject.eAdapters().remove(this);
+ rootObject = null;
+
+ view.close();
+ view = null;
- view.close();
- view = null;
+ closed = true;
+ }
+ }
+
+ if (closed)
+ {
+ ((CDOCheckoutManagerImpl)checkoutManager).fireCheckoutOpenEvent(this, false);
}
}
@@ -153,6 +201,16 @@ public abstract class CDOCheckoutImpl extends PlatformObject implements CDOCheck
}
@Override
+ public boolean isAdapterForType(Object type)
+ {
+ if (type == CDOCheckout.class)
+ {
+ return true;
+ }
+
+ return super.isAdapterForType(type);
+ }
+
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter)
{
if (adapter == EObject.class)
@@ -160,7 +218,13 @@ public abstract class CDOCheckoutImpl extends PlatformObject implements CDOCheck
return rootObject;
}
- return super.getAdapter(adapter);
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
+
+ @Override
+ public String toString()
+ {
+ return getLabel();
}
protected EObject loadRootObject()
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOCheckoutManagerImpl.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOCheckoutManagerImpl.java
index 27e5f395df..b2841ce238 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOCheckoutManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOCheckoutManagerImpl.java
@@ -16,6 +16,7 @@ import org.eclipse.emf.cdo.explorer.CDOCheckoutManager;
import org.eclipse.emf.cdo.explorer.CDORepository;
import org.eclipse.net4j.util.container.SetContainer;
+import org.eclipse.net4j.util.event.Event;
/**
* @author Eike Stepper
@@ -50,4 +51,44 @@ public class CDOCheckoutManagerImpl extends SetContainer<CDOCheckout> implements
return null;
}
+
+ public void fireCheckoutOpenEvent(CDOCheckout checkout, boolean open)
+ {
+ fireEvent(new CheckoutOpenEventImpl(this, checkout, open));
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static final class CheckoutOpenEventImpl extends Event implements CheckoutOpenEvent
+ {
+ private static final long serialVersionUID = 1L;
+
+ private final CDOCheckout checkout;
+
+ private final boolean open;
+
+ public CheckoutOpenEventImpl(CDOCheckoutManager repositoryManager, CDOCheckout checkout, boolean open)
+ {
+ super(repositoryManager);
+ this.checkout = checkout;
+ this.open = open;
+ }
+
+ @Override
+ public CDOCheckoutManager getSource()
+ {
+ return (CDOCheckoutManager)super.getSource();
+ }
+
+ public CDOCheckout getCheckout()
+ {
+ return checkout;
+ }
+
+ public boolean isOpen()
+ {
+ return open;
+ }
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryImpl.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryImpl.java
index 220f7ece97..5d426245bc 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryImpl.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryImpl.java
@@ -80,6 +80,7 @@ public abstract class CDORepositoryImpl extends Notifier implements CDORepositor
public CDORepositoryImpl(CDORepositoryManager repositoryManager, String label, String repositoryName)
{
this.repositoryManager = repositoryManager;
+ this.label = label;
this.repositoryName = repositoryName;
}
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java
index 92e84e7585..a2a6a88094 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java
@@ -183,8 +183,8 @@ public class CDOClientProtocol extends AuthenticatingSignalProtocol<CDOSessionIm
return send(new LoadChunkRequest(this, revision, feature, accessIndex, fetchIndex, fromIndex, toIndex));
}
- public List<RevisionInfo> loadRevisions(List<RevisionInfo> infos, CDOBranchPoint branchPoint,
- int referenceChunk, int prefetchDepth)
+ public List<RevisionInfo> loadRevisions(List<RevisionInfo> infos, CDOBranchPoint branchPoint, int referenceChunk,
+ int prefetchDepth)
{
return send(new LoadRevisionsRequest(this, infos, branchPoint, referenceChunk, prefetchDepth));
}
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadRevisionsRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadRevisionsRequest.java
index 34d8d584ff..c213097bc4 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadRevisionsRequest.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadRevisionsRequest.java
@@ -22,6 +22,7 @@ import org.eclipse.emf.cdo.session.CDOCollectionLoadingPolicy;
import org.eclipse.emf.cdo.spi.common.revision.RevisionInfo;
import org.eclipse.emf.cdo.view.CDOFetchRuleManager;
+import org.eclipse.net4j.util.concurrent.ConcurrencyUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import java.io.IOException;
@@ -131,6 +132,9 @@ public class LoadRevisionsRequest extends CDOClientRequest<List<RevisionInfo>>
@Override
protected List<RevisionInfo> confirming(CDODataInput in) throws IOException
{
+ int xxx;
+ ConcurrencyUtil.sleep(1000);
+
int size = infos.size();
if (TRACER.isEnabled())
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/FSMUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/FSMUtil.java
index 2c16dab68f..d1df67d70f 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/FSMUtil.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/FSMUtil.java
@@ -111,7 +111,7 @@ public final class FSMUtil
public static InternalCDOObject adaptLegacy(InternalEObject object)
{
EList<Adapter> adapters = object.eAdapters();
- CDOLegacyAdapter adapter = getLegacyAdapter(adapters);
+ CDOLegacyAdapter adapter = (CDOLegacyAdapter)getLegacyAdapter(adapters);
if (adapter == null)
{
adapter = new CDOLegacyAdapter(object);
@@ -132,9 +132,20 @@ public final class FSMUtil
// return wrapper;
}
- private static CDOLegacyAdapter getLegacyAdapter(EList<Adapter> adapters)
+ /**
+ * @since 4.4
+ */
+ public static Adapter getLegacyAdapter(EObject object)
+ {
+ return getLegacyAdapter(object.eAdapters());
+ }
+
+ /**
+ * @since 4.4
+ */
+ public static Adapter getLegacyAdapter(EList<Adapter> adapters)
{
- return (CDOLegacyAdapter)EcoreUtil.getAdapter(adapters, CDOLegacyAdapter.class);
+ return EcoreUtil.getAdapter(adapters, CDOLegacyAdapter.class);
}
public static Iterator<InternalCDOObject> iterator(final Iterator<?> delegate, final InternalCDOView view)
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java
index 20f684ba6b..0fcdc23f92 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java
@@ -50,6 +50,16 @@ import java.util.Map;
*/
public class ContainerItemProvider<CONTAINER extends IContainer<Object>> extends ItemProvider<CONTAINER>
{
+ /**
+ * @since 3.5
+ */
+ public static final Image IMAGE_PENDING = SharedIcons.getImage(SharedIcons.OBJ_PENDING);
+
+ /**
+ * @since 3.5
+ */
+ public static final Image IMAGE_ERROR = SharedIcons.getImage(SharedIcons.OBJ_ERROR);
+
private Map<Object, Node> nodes = new HashMap<Object, Node>();
private Node root;
@@ -383,12 +393,12 @@ public class ContainerItemProvider<CONTAINER extends IContainer<Object>> extends
{
if (obj instanceof ContainerItemProvider.LazyElement)
{
- return SharedIcons.getImage(SharedIcons.OBJ_PENDING);
+ return IMAGE_PENDING;
}
if (obj instanceof ContainerItemProvider.ErrorElement)
{
- return SharedIcons.getImage(SharedIcons.OBJ_ERROR);
+ return IMAGE_ERROR;
}
return super.getImage(obj);

Back to the top