Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2015-09-25 10:20:22 +0000
committerEike Stepper2015-09-25 10:20:22 +0000
commit196eb7b8b72e7ea56999f3b1a813a0ce2f6886c2 (patch)
tree355db400690f04747d8d89a95f7937b233d78f38
parent4236ed99a4915943d3958a5aae1e5bfd6dbf2bb4 (diff)
downloadcdo-196eb7b8b72e7ea56999f3b1a813a0ce2f6886c2.tar.gz
cdo-196eb7b8b72e7ea56999f3b1a813a0ce2f6886c2.tar.xz
cdo-196eb7b8b72e7ea56999f3b1a813a0ce2f6886c2.zip
[458349] Consolidate UI - Better handling of unconnectable repositories
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=458349
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutContentProvider.java142
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java37
2 files changed, 110 insertions, 69 deletions
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 8822982a14..73e187f73c 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
@@ -529,106 +529,112 @@ public class CDOCheckoutContentProvider implements ICommonContentProvider, IProp
}
}
+ boolean firstLoad;
synchronized (LOADING_OBJECTS)
{
- LOADING_OBJECTS.add(originalObject);
+ firstLoad = LOADING_OBJECTS.add(originalObject);
}
- new Job("Load " + finalObject)
+ if (firstLoad || finalOpeningCheckout == null)
{
- @Override
- protected IStatus run(IProgressMonitor monitor)
+ Job job = new Job("Load " + finalObject)
{
- try
+ @Override
+ protected IStatus run(IProgressMonitor monitor)
{
- if (finalOpeningCheckout != null)
+ try
{
- finalOpeningCheckout.open();
- determineChildRevisions(finalObject, loadedRevisions, missingIDs);
- }
+ if (finalOpeningCheckout != null)
+ {
+ finalOpeningCheckout.open();
+ determineChildRevisions(finalObject, loadedRevisions, missingIDs);
+ }
- if (!missingIDs.isEmpty())
- {
- CDOObject cdoObject = getCDOObject((EObject)finalObject);
- CDOView view = cdoObject.cdoView();
- CDORevisionManager revisionManager = view.getSession().getRevisionManager();
+ if (!missingIDs.isEmpty())
+ {
+ CDOObject cdoObject = 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);
- }
+ List<CDORevision> revisions = revisionManager.getRevisions(missingIDs, view, CDORevision.UNCHUNKED,
+ CDORevision.DEPTH_NONE, true);
+ loadedRevisions.addAll(revisions);
+ }
- Object[] children = contentProvider.getChildren(finalObject);
+ Object[] children = contentProvider.getChildren(finalObject);
- // Adjust possible legacy adapters.
- for (int i = 0; i < children.length; i++)
- {
- Object child = children[i];
- if (child instanceof InternalCDOObject)
+ // Adjust possible legacy adapters.
+ for (int i = 0; i < children.length; i++)
{
- InternalCDOObject cdoObject = (InternalCDOObject)child;
- InternalEObject instance = cdoObject.cdoInternalInstance();
- if (instance != cdoObject)
+ Object child = children[i];
+ if (child instanceof InternalCDOObject)
{
- children[i] = instance;
+ InternalCDOObject cdoObject = (InternalCDOObject)child;
+ InternalEObject instance = cdoObject.cdoInternalInstance();
+ if (instance != cdoObject)
+ {
+ children[i] = instance;
+ }
}
}
- }
-
- children = CDOCheckoutContentModifier.Registry.INSTANCE.modifyChildren(finalObject, children);
- childrenCache.put(originalObject, children);
- }
- catch (final Exception ex)
- {
- childrenCache.remove(originalObject);
- if (finalOpeningCheckout != null)
- {
- finalOpeningCheckout.close();
+ children = CDOCheckoutContentModifier.Registry.INSTANCE.modifyChildren(finalObject, children);
+ childrenCache.put(originalObject, children);
}
+ catch (final Exception ex)
+ {
+ childrenCache.remove(originalObject);
- OM.LOG.error(ex);
+ if (finalOpeningCheckout != null)
+ {
+ finalOpeningCheckout.close();
+ }
- final Control control = viewer.getControl();
- if (!control.isDisposed())
- {
- UIUtil.getDisplay().asyncExec(new Runnable()
+ OM.LOG.error(ex);
+
+ final Control control = viewer.getControl();
+ if (!control.isDisposed())
{
- public void run()
+ UIUtil.getDisplay().asyncExec(new Runnable()
{
- try
+ public void run()
{
- if (!control.isDisposed())
+ try
{
- Shell shell = control.getShell();
- String title = (finalOpeningCheckout != null ? "Open" : "Load") + " Error";
- MessageDialog.openError(shell, title, ex.getMessage());
+ if (!control.isDisposed())
+ {
+ Shell shell = control.getShell();
+ String title = (finalOpeningCheckout != null ? "Open" : "Load") + " Error";
+ MessageDialog.openError(shell, title, ex.getMessage());
+ }
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
}
}
- catch (Exception ex)
- {
- OM.LOG.error(ex);
- }
- }
- });
+ });
+ }
}
- }
- CDOCheckoutViewerRefresh viewerRefresh = stateManager.getViewerRefresh();
- viewerRefresh.addNotification(originalObject, true, true, new Runnable()
- {
- public void run()
+ CDOCheckoutViewerRefresh viewerRefresh = stateManager.getViewerRefresh();
+ viewerRefresh.addNotification(originalObject, true, true, new Runnable()
{
- synchronized (LOADING_OBJECTS)
+ public void run()
{
- LOADING_OBJECTS.remove(originalObject);
+ synchronized (LOADING_OBJECTS)
+ {
+ LOADING_OBJECTS.remove(originalObject);
+ }
}
- }
- });
+ });
- return Status.OK_STATUS;
- }
- }.schedule();
+ return Status.OK_STATUS;
+ }
+ };
+
+ job.schedule();
+ }
if (FIND_ITEM_METHOD != null)
{
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java
index b086a009ef..8268176b59 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java
@@ -632,7 +632,42 @@ public abstract class CDOCheckoutImpl extends AbstractElement implements CDOChec
CDOBranch branch = view.getBranch();
CDOBranchPoint head = branch.getHead();
- return session.openTransaction(head, resourceSet);
+
+ final CDOTransaction transaction = session.openTransaction(head, resourceSet);
+ // transaction.addTransactionHandler(new CDODefaultTransactionHandler1()
+ // {
+ // private Job commitJob = new Job("Commit")
+ // {
+ // @Override
+ // protected IStatus run(IProgressMonitor monitor)
+ // {
+ // try
+ // {
+ // synchronized (transaction)
+ // {
+ // if (transaction.isDirty())
+ // {
+ // transaction.commit();
+ // }
+ // }
+ // }
+ // catch (Throwable ex)
+ // {
+ // ex.printStackTrace();
+ // }
+ //
+ // return Status.OK_STATUS;
+ // }
+ // };
+ //
+ // @Override
+ // public void modifyingObject(CDOTransaction transaction, CDOObject object, CDOFeatureDelta featureChange)
+ // {
+ // commitJob.schedule(200);
+ // }
+ // });
+
+ return transaction;
}
protected CDOView configureView(final CDOView view)

Back to the top