Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java122
1 files changed, 61 insertions, 61 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java
index cce0f4947..705b10734 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelLabelProvider.java
@@ -45,17 +45,17 @@ import org.eclipse.swt.widgets.Display;
/**
* @since 3.3
*/
-public class TreeModelLabelProvider extends ColumnLabelProvider
- implements ITreeModelLabelProvider, IModelChangedListener
+public class TreeModelLabelProvider extends ColumnLabelProvider
+ implements ITreeModelLabelProvider, IModelChangedListener
{
-
+
private IInternalTreeModelViewer fViewer;
/**
* Note: access this variable should be synchronized with <code>this</code>.
*/
private List<ILabelUpdate> fComplete;
-
+
/**
* Cache of images used for elements in this label provider. Label updates
* use the method <code>getImage(...)</code> to cache images for
@@ -76,32 +76,32 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
* RGB values. The colors are disposed with this label provider.
*/
private Map<RGB, Color> fColorCache = new HashMap<RGB, Color>();
-
+
/**
* Label listeners
*/
private ListenerList<ILabelUpdateListener> fLabelListeners = new ListenerList<>();
-
+
/**
* Updates waiting to be sent to the label provider. The map contains
- * lists of updates, keyed using the provider.
+ * lists of updates, keyed using the provider.
*/
private Map<IElementLabelProvider, List<ILabelUpdate>> fPendingUpdates = new HashMap<IElementLabelProvider, List<ILabelUpdate>>();
-
+
/**
* A runnable that will send the label update requests.
- * This variable allows the job to be canceled and re-scheduled if
- * new updates are requested.
+ * This variable allows the job to be canceled and re-scheduled if
+ * new updates are requested.
*/
private Runnable fPendingUpdatesRunnable;
-
+
/**
* List of updates in progress
*/
private List<ILabelUpdate> fUpdatesInProgress = new ArrayList<ILabelUpdate>();
-
+
/**
- * Delta visitor actively cancels the outstanding label updates for
+ * Delta visitor actively cancels the outstanding label updates for
* elements that are changed and are about to be updated.
*/
class CancelPendingUpdatesVisitor implements IModelDeltaVisitor {
@@ -116,7 +116,7 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
} else if ((delta.getFlags() & IModelDelta.STATE) > 0) {
cancelElementUpdates(delta.getElement(), false);
return true;
- }
+ }
return true;
}
}
@@ -125,7 +125,7 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
* Delta visitor
*/
private CancelPendingUpdatesVisitor fCancelPendingUpdatesVisitor = new CancelPendingUpdatesVisitor();
-
+
/**
* Constructs a new label provider on the given display
* @param viewer Viewer that this label provider is used with.
@@ -134,11 +134,11 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
fViewer = viewer;
fViewer.addModelChangedListener(this);
}
-
+
/**
* Returns an image for the given image descriptor or <code>null</code>. Adds the image
* to a cache of images if it does not already exist.
- *
+ *
* @param descriptor image descriptor or <code>null</code>
* @return image or <code>null</code>
*/
@@ -157,17 +157,17 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
/**
* Returns the display to use for resource allocation.
- *
+ *
* @return display
*/
private Display getDisplay() {
return fViewer.getDisplay();
}
-
+
/**
- * Returns a font for the given font data or <code>null</code>. Adds the font to the font
+ * Returns a font for the given font data or <code>null</code>. Adds the font to the font
* cache if not yet created.
- *
+ *
* @param fontData font data or <code>null</code>
* @return font font or <code>null</code>
*/
@@ -182,12 +182,12 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
fFontCache.put(fontData, font);
}
return font;
- }
-
+ }
+
/**
- * Returns a color for the given RGB or <code>null</code>. Adds the color to the color
+ * Returns a color for the given RGB or <code>null</code>. Adds the color to the color
* cache if not yet created.
- *
+ *
* @param rgb RGB or <code>null</code>
* @return color or <code>null</code>
*/
@@ -210,10 +210,10 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
@Override
public void dispose() {
Assert.isTrue(fViewer.getDisplay().getThread() == Thread.currentThread());
-
+
fViewer.removeModelChangedListener(this);
fViewer = null;
-
+
List<ILabelUpdate> complete = null;
synchronized(this) {
complete = fComplete;
@@ -225,7 +225,7 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
}
}
for (ILabelUpdate currentUpdate : fUpdatesInProgress) {
- currentUpdate.cancel();
+ currentUpdate.cancel();
}
if (fPendingUpdatesRunnable != null) {
@@ -255,18 +255,18 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
private boolean isDisposed() {
return fViewer == null;
}
-
+
@Override
public void update(ViewerCell cell) {
- // NOT USED - the viewer updates each row instead
- }
-
+ // NOT USED - the viewer updates each row instead
+ }
+
@Override
public boolean update(TreePath elementPath) {
Assert.isTrue(fViewer.getDisplay().getThread() == Thread.currentThread());
-
+
cancelPathUpdates(elementPath);
-
+
String[] visibleColumns = fViewer.getVisibleColumns();
Object element = elementPath.getLastSegment();
IElementLabelProvider presentation = ViewerAdapterService.getLabelProvider(element);
@@ -292,9 +292,9 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
return false;
}
}
-
+
/**
- * Cancel any outstanding updates that are running for this element.
+ * Cancel any outstanding updates that are running for this element.
* @param elementPath Element to cancel updates for.
*/
private void cancelPathUpdates(TreePath elementPath) {
@@ -308,28 +308,28 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
/**
* Sets the element's display information in the viewer.
- *
- * @param path Element path.
+ *
+ * @param path Element path.
* @param numColumns Number of columns in the data.
- * @param labels Array of labels. The array cannot to be
+ * @param labels Array of labels. The array cannot to be
* <code>null</code>, but values within the array may be.
* @param images Array of image descriptors, may be <code>null</code>.
* @param fontDatas Array of fond data objects, may be <code>null</code>.
- * @param foregrounds Array of RGB values for foreground colors, may be
+ * @param foregrounds Array of RGB values for foreground colors, may be
* <code>null</code>.
- * @param backgrounds Array of RGB values for background colors, may be
+ * @param backgrounds Array of RGB values for background colors, may be
* <code>null</code>.
* @param checked Whether given item should be checked.
* @param grayed Whether given item's checkbox should be grayed.
*/
void setElementData(TreePath path, int numColumns, String[] labels, ImageDescriptor[] images,
- FontData[] fontDatas, RGB[] foregrounds, RGB[] backgrounds, boolean checked, boolean grayed)
+ FontData[] fontDatas, RGB[] foregrounds, RGB[] backgrounds, boolean checked, boolean grayed)
{
fViewer.setElementData(path, numColumns, labels, images, fontDatas, foregrounds, backgrounds);
fViewer.setElementChecked(path, checked, grayed);
}
-
+
private void startRequests(Runnable runnable) {
if (runnable != fPendingUpdatesRunnable) {
return;
@@ -347,11 +347,11 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
fPendingUpdates.clear();
fPendingUpdatesRunnable = null;
}
-
+
/**
* Cancels all running updates for the given element. If seachFullPath is true,
- * all updates will be canceled which have the given element anywhere in their
- * patch.
+ * all updates will be canceled which have the given element anywhere in their
+ * patch.
* @param element element to search for.
* @param searchFullPath flag whether to look for the element in the full path
* of the update
@@ -367,7 +367,7 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
if (element.equals(updatePath.getSegment(i))) {
currentUpdate.cancel();
break; // Exit the for loop, stay in the while loop
- }
+ }
}
}
} else {
@@ -380,7 +380,7 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
/**
* Returns the presentation context for this label provider.
- *
+ *
* @return presentation context
*/
private IPresentationContext getPresentationContext() {
@@ -389,14 +389,14 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
/**
* A label update is complete.
- *
+ *
* @param update Update that is to be completed.
*/
synchronized void complete(ILabelUpdate update) {
if (fViewer == null) {
return;
}
-
+
if (fComplete == null) {
fComplete = new LinkedList<ILabelUpdate>();
fViewer.getDisplay().asyncExec(new Runnable() {
@@ -422,28 +422,28 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
}
fComplete.add(update);
}
-
+
@Override
public void addLabelUpdateListener(ILabelUpdateListener listener) {
fLabelListeners.add(listener);
}
-
+
@Override
public void removeLabelUpdateListener(ILabelUpdateListener listener) {
fLabelListeners.remove(listener);
}
-
+
/**
* Notification an update request has started
- *
+ *
* @param update Update that was started
*/
void updateStarted(ILabelUpdate update) {
Assert.isTrue(fViewer.getDisplay().getThread() == Thread.currentThread());
-
+
boolean begin = fUpdatesInProgress.isEmpty();
fUpdatesInProgress.add(update);
-
+
if (begin) {
if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
DebugUIPlugin.trace("LABEL SEQUENCE BEGINS"); //$NON-NLS-1$
@@ -455,15 +455,15 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
}
notifyUpdate(TreeModelContentProvider.UPDATE_BEGINS, update);
}
-
+
/**
* Notification an update request has completed
- *
+ *
* @param update Update that completed.
*/
void updateComplete(ILabelUpdate update) {
fUpdatesInProgress.remove(update);
-
+
if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
DebugUIPlugin.trace("\tEND - " + update); //$NON-NLS-1$
}
@@ -475,7 +475,7 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
notifyUpdate(TreeModelContentProvider.UPDATE_SEQUENCE_COMPLETE, null);
}
}
-
+
private void notifyUpdate(final int type, final ILabelUpdate update) {
if (!fLabelListeners.isEmpty()) {
for (ILabelUpdateListener iLabelUpdateListener : fLabelListeners) {
@@ -513,5 +513,5 @@ public class TreeModelLabelProvider extends ColumnLabelProvider
public void modelChanged(IModelDelta delta, IModelProxy proxy) {
delta.accept(fCancelPendingUpdatesVisitor);
}
-
+
}

Back to the top