diff options
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java')
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java index 942b0b82b..d16ba7b2c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2012 IBM Corporation and others. + * Copyright (c) 2006, 2013 IBM Corporation 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 @@ -27,7 +27,7 @@ class HasChildrenUpdate extends ViewerUpdateMonitor implements IHasChildrenUpdat private boolean fHasChildren = false; - private List fBatchedRequests = null; + private List<ViewerUpdateMonitor> fBatchedRequests = null; /** * Constructs a request to update an element @@ -45,6 +45,7 @@ class HasChildrenUpdate extends ViewerUpdateMonitor implements IHasChildrenUpdat /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.viewers.model.provisional.viewers.ViewerUpdateMonitor#performUpdate() */ + @Override protected void performUpdate() { TreeModelContentProvider contentProvider = getContentProvider(); TreePath elementPath = getElementPath(); @@ -62,10 +63,12 @@ class HasChildrenUpdate extends ViewerUpdateMonitor implements IHasChildrenUpdat } } + @Override public void setHasChilren(boolean hasChildren) { fHasChildren = hasChildren; } + @Override public String toString() { StringBuffer buf = new StringBuffer(); buf.append("IHasChildrenUpdate: "); //$NON-NLS-1$ @@ -76,6 +79,7 @@ class HasChildrenUpdate extends ViewerUpdateMonitor implements IHasChildrenUpdat /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.viewers.model.ViewerUpdateMonitor#coalesce(org.eclipse.debug.internal.ui.viewers.model.ViewerUpdateMonitor) */ + @Override boolean coalesce(ViewerUpdateMonitor request) { if (request instanceof HasChildrenUpdate) { if (getElementPath().equals(request.getElementPath())) { @@ -83,7 +87,7 @@ class HasChildrenUpdate extends ViewerUpdateMonitor implements IHasChildrenUpdat return true; } else if (getElementContentProvider().equals(request.getElementContentProvider())) { if (fBatchedRequests == null) { - fBatchedRequests = new ArrayList(); + fBatchedRequests = new ArrayList<ViewerUpdateMonitor>(); fBatchedRequests.add(this); } fBatchedRequests.add(request); @@ -96,11 +100,12 @@ class HasChildrenUpdate extends ViewerUpdateMonitor implements IHasChildrenUpdat /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.viewers.model.ViewerUpdateMonitor#startRequest() */ + @Override void startRequest() { if (fBatchedRequests == null) { getElementContentProvider().update(new IHasChildrenUpdate[]{this}); } else { - IHasChildrenUpdate[] updates = (IHasChildrenUpdate[]) fBatchedRequests.toArray(new IHasChildrenUpdate[fBatchedRequests.size()]); + IHasChildrenUpdate[] updates = fBatchedRequests.toArray(new IHasChildrenUpdate[fBatchedRequests.size()]); // notify that the other updates have also started to ensure correct sequence // of model updates - **** start at index 1 since the first (0) update has // already notified the content provider that it has started. @@ -111,12 +116,13 @@ class HasChildrenUpdate extends ViewerUpdateMonitor implements IHasChildrenUpdat } } + @Override boolean containsUpdate(TreePath path) { if (getElementPath().equals(path)) { return true; } else if (fBatchedRequests != null) { for (int i = 0; i < fBatchedRequests.size(); i++) { - if (((ViewerUpdateMonitor)fBatchedRequests.get(i)).getElementPath().equals(path)) { + if (fBatchedRequests.get(i).getElementPath().equals(path)) { return true; } } @@ -128,6 +134,7 @@ class HasChildrenUpdate extends ViewerUpdateMonitor implements IHasChildrenUpdat /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.viewers.model.ViewerUpdateMonitor#getPriority() */ + @Override int getPriority() { return 1; } @@ -135,6 +142,7 @@ class HasChildrenUpdate extends ViewerUpdateMonitor implements IHasChildrenUpdat /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.viewers.model.ViewerUpdateMonitor#getSchedulingPath() */ + @Override TreePath getSchedulingPath() { TreePath path = getElementPath(); if (path.getSegmentCount() > 0) { @@ -147,14 +155,16 @@ class HasChildrenUpdate extends ViewerUpdateMonitor implements IHasChildrenUpdat return fHasChildren; } - protected boolean doEquals(ViewerUpdateMonitor update) { + @Override + protected boolean doEquals(ViewerUpdateMonitor update) { return update instanceof HasChildrenUpdate && getViewerInput().equals(update.getViewerInput()) && getElementPath().equals(update.getElementPath()); } - protected int doHashCode() { + @Override + protected int doHashCode() { return getClass().hashCode() + getViewerInput().hashCode() + getElementPath().hashCode(); } |