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/provisional')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckUpdate.java24
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckboxModelProxy.java34
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementContentProvider.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementMementoProvider.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ILabelUpdate.java58
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy2.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelSelectionPolicy.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IPresentationContext.java154
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStateUpdateListener.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStatusMonitor.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ITreeModelViewer.java438
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IViewerUpdate.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemListener.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemValidator.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ModelDelta.java306
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java252
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewer.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewerFilter.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java34
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualItem.java996
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTree.java332
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTreeModelViewer.java318
23 files changed, 1590 insertions, 1590 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckUpdate.java
index 4be545f67..14afa964f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckUpdate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckUpdate.java
@@ -22,18 +22,18 @@ package org.eclipse.debug.internal.ui.viewers.model.provisional;
*/
public interface ICheckUpdate extends ILabelUpdate {
- /**
- * Property of the presentation context which indicates that the viewer
- * has the check box style.
- */
- String PROP_CHECK = "org.eclipse.debug.ui.check"; //$NON-NLS-1$
+ /**
+ * Property of the presentation context which indicates that the viewer
+ * has the check box style.
+ */
+ String PROP_CHECK = "org.eclipse.debug.ui.check"; //$NON-NLS-1$
- /**
- * Sets the check state of the tree node.
- *
- * @param checked Whether element should be checked.
- * @param grayed Whether element should be grayed out.
- */
- void setChecked(boolean checked, boolean grayed);
+ /**
+ * Sets the check state of the tree node.
+ *
+ * @param checked Whether element should be checked.
+ * @param grayed Whether element should be grayed out.
+ */
+ void setChecked(boolean checked, boolean grayed);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckboxModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckboxModelProxy.java
index c85c55220..d8c9f3c99 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckboxModelProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckboxModelProxy.java
@@ -26,22 +26,22 @@ import org.eclipse.jface.viewers.TreePath;
*/
public interface ICheckboxModelProxy {
- /**
- * Notifies the receiver that the given element has had its
- * checked state modified in the viewer.
- * <p>
- * This method is called in the UI thread. Clients that execute long running operations or
- * communicate with a potentially unreliable or blocking model should run those operations
- * asynchronously.
- * </p>
- *
- * @param context Presentation context in which the element was updated.
- * @param viewerInput The root element of the viewer where the check
- * selection took place.
- * @param path Path of the element that had its checked state changed
- * @param checked The new checked state of the element
- * @return false if the check state should not change
- */
- boolean setChecked(IPresentationContext context, Object viewerInput, TreePath path, boolean checked);
+ /**
+ * Notifies the receiver that the given element has had its
+ * checked state modified in the viewer.
+ * <p>
+ * This method is called in the UI thread. Clients that execute long running operations or
+ * communicate with a potentially unreliable or blocking model should run those operations
+ * asynchronously.
+ * </p>
+ *
+ * @param context Presentation context in which the element was updated.
+ * @param viewerInput The root element of the viewer where the check
+ * selection took place.
+ * @param path Path of the element that had its checked state changed
+ * @param checked The new checked state of the element
+ * @return false if the check state should not change
+ */
+ boolean setChecked(IPresentationContext context, Object viewerInput, TreePath path, boolean checked);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementContentProvider.java
index 67c0b8bbf..6d43b485a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementContentProvider.java
@@ -42,7 +42,7 @@ public interface IElementContentProvider {
*
* @param updates Each update specifies children to update and stores results.
* The update array is guaranteed to have at least one element, and for
- * all updates to have the same presentation context.
+ * all updates to have the same presentation context.
*/
void update(IChildrenUpdate[] updates);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementMementoProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementMementoProvider.java
index 8ab79d3ad..93bbd0c0e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementMementoProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementMementoProvider.java
@@ -35,7 +35,7 @@ public interface IElementMementoProvider {
*
* @param requests Specifies elements and provides memento stores.
* The requests array is guaranteed to have at least one element, and for
- * all requests to have the same presentation context.
+ * all requests to have the same presentation context.
*/
void encodeElements(IElementMementoRequest[] requests);
@@ -44,7 +44,7 @@ public interface IElementMementoProvider {
*
* @param requests Specifies each element and previously created memento.
* The requests array is guaranteed to have at least one element, and for
- * all requests to have the same presentation context.
+ * all requests to have the same presentation context.
*/
void compareElements(IElementCompareRequest[] requests);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ILabelUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ILabelUpdate.java
index cee30bef4..351a5db90 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ILabelUpdate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ILabelUpdate.java
@@ -41,37 +41,37 @@ public interface ILabelUpdate extends IViewerUpdate {
* @param text to set to viewer
* @param columnIndex column index (0 when no columns)
*/
- void setLabel(String text, int columnIndex);
+ void setLabel(String text, int columnIndex);
- /**
- * Sets the font of the label.
- *
- * @param fontData to set to viewer
- * @param columnIndex column index (0 when no columns)
- */
- void setFontData(FontData fontData, int columnIndex);
+ /**
+ * Sets the font of the label.
+ *
+ * @param fontData to set to viewer
+ * @param columnIndex column index (0 when no columns)
+ */
+ void setFontData(FontData fontData, int columnIndex);
- /**
- * Sets the image of the label.
- *
- * @param image to set to viewer
- * @param columnIndex column index (0 when no columns)
- */
- void setImageDescriptor(ImageDescriptor image, int columnIndex);
+ /**
+ * Sets the image of the label.
+ *
+ * @param image to set to viewer
+ * @param columnIndex column index (0 when no columns)
+ */
+ void setImageDescriptor(ImageDescriptor image, int columnIndex);
- /**
- * Sets the foreground color of the label.
- *
- * @param foreground to set to viewer
- * @param columnIndex column index (0 when no columns)
- */
- void setForeground(RGB foreground, int columnIndex);
+ /**
+ * Sets the foreground color of the label.
+ *
+ * @param foreground to set to viewer
+ * @param columnIndex column index (0 when no columns)
+ */
+ void setForeground(RGB foreground, int columnIndex);
- /**
- * Sets the background color of the label.
- *
- * @param background to set to viewer
- * @param columnIndex column index (0 when no columns)
- */
- void setBackground(RGB background, int columnIndex);
+ /**
+ * Sets the background color of the label.
+ *
+ * @param background to set to viewer
+ * @param columnIndex column index (0 when no columns)
+ */
+ void setBackground(RGB background, int columnIndex);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy.java
index 975081ff1..5fd7ca553 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy.java
@@ -69,8 +69,8 @@ public interface IModelProxy {
* This method is called by the asynchronous viewer framework and should not
* be called by clients.
* </p>
- * @param viewer viewer
- * @see IModelProxy2#initialize(ITreeModelViewer)
+ * @param viewer viewer
+ * @see IModelProxy2#initialize(ITreeModelViewer)
* @since 3.3
*/
void installed(Viewer viewer);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy2.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy2.java
index c6eb135ab..eaeccfd63 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy2.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy2.java
@@ -26,20 +26,20 @@ import org.eclipse.jface.viewers.Viewer;
*/
public interface IModelProxy2 extends IModelProxy {
- /**
- * Initialize model proxy with given tree model viewer. This method is
- * called on the viewer's Display thread and is guaranteed to be called
- * before the dispose() method is called on the same proxy. The default
- * implementation of this method calls {@link #init(IPresentationContext)}
- * and {@link #installed(Viewer)} asynchornously and not in the Display
- * thread.
- * <p>
- * This method is called by the asynchronous viewer framework and should
- * not be called by clients.
- * </p>
- * @param viewer Viewer that is installing this model proxy.
- *
- */
- void initialize(ITreeModelViewer viewer);
+ /**
+ * Initialize model proxy with given tree model viewer. This method is
+ * called on the viewer's Display thread and is guaranteed to be called
+ * before the dispose() method is called on the same proxy. The default
+ * implementation of this method calls {@link #init(IPresentationContext)}
+ * and {@link #installed(Viewer)} asynchornously and not in the Display
+ * thread.
+ * <p>
+ * This method is called by the asynchronous viewer framework and should
+ * not be called by clients.
+ * </p>
+ * @param viewer Viewer that is installing this model proxy.
+ *
+ */
+ void initialize(ITreeModelViewer viewer);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelSelectionPolicy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelSelectionPolicy.java
index 9107eecc9..cf846b64f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelSelectionPolicy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelSelectionPolicy.java
@@ -85,5 +85,5 @@ public interface IModelSelectionPolicy {
* the selection after the update, or <code>null</code> if none
* @return new selection or <code>null</code> if none
*/
- ISelection replaceInvalidSelection(ISelection invalidSelection, ISelection newSelection);
+ ISelection replaceInvalidSelection(ISelection invalidSelection, ISelection newSelection);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IPresentationContext.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IPresentationContext.java
index 4cc72bfe2..bc411b429 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IPresentationContext.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IPresentationContext.java
@@ -44,91 +44,91 @@ public interface IPresentationContext {
*/
String PROPERTY_DISPOSED = "PROPERTY_DISPOSED"; //$NON-NLS-1$
- /**
- * Returns identifiers of the visible columns in the order
- * labels should be provided, or <code>null</code> if columns
- * are not being displayed. Label providers use this
- * information.
- *
- * @return visible column identifiers or <code>null</code>
- * @see IColumnPresentation
- */
- String[] getColumns();
+ /**
+ * Returns identifiers of the visible columns in the order
+ * labels should be provided, or <code>null</code> if columns
+ * are not being displayed. Label providers use this
+ * information.
+ *
+ * @return visible column identifiers or <code>null</code>
+ * @see IColumnPresentation
+ */
+ String[] getColumns();
- /**
- * Registers the given listener for property change notification.
- *
- * @param listener property listener
- */
- void addPropertyChangeListener(IPropertyChangeListener listener);
+ /**
+ * Registers the given listener for property change notification.
+ *
+ * @param listener property listener
+ */
+ void addPropertyChangeListener(IPropertyChangeListener listener);
- /**
- * Unregisters the given listener from property change notification.
- *
- * @param listener property listener.
- */
- void removePropertyChangeListener(IPropertyChangeListener listener);
+ /**
+ * Unregisters the given listener from property change notification.
+ *
+ * @param listener property listener.
+ */
+ void removePropertyChangeListener(IPropertyChangeListener listener);
- /**
- * Returns the id of this presentation context. Usually this is the id of
- * the associated part. However, when no part is associated with this context,
- * the id may exist on its own. Allows for a context that is not tied to a part.
- *
- * @return id
- * @since 3.3
- */
- String getId();
+ /**
+ * Returns the id of this presentation context. Usually this is the id of
+ * the associated part. However, when no part is associated with this context,
+ * the id may exist on its own. Allows for a context that is not tied to a part.
+ *
+ * @return id
+ * @since 3.3
+ */
+ String getId();
- /**
- * Sets the specified property and notifies listeners of changes.
- *
- * @param property property name
- * @param value property value
- */
- void setProperty(String property, Object value);
+ /**
+ * Sets the specified property and notifies listeners of changes.
+ *
+ * @param property property name
+ * @param value property value
+ */
+ void setProperty(String property, Object value);
- /**
- * Returns the property with the specified name or <code>null</code>
- * if none.
- *
- * @param property property name
- * @return property value or <code>null</code>
- */
- Object getProperty(String property);
+ /**
+ * Returns the property with the specified name or <code>null</code>
+ * if none.
+ *
+ * @param property property name
+ * @return property value or <code>null</code>
+ */
+ Object getProperty(String property);
- /**
- * Disposes this presentation context. Called by the framework
- * when the associated viewer is disposed.
- */
- void dispose();
+ /**
+ * Disposes this presentation context. Called by the framework
+ * when the associated viewer is disposed.
+ */
+ void dispose();
- /**
- * Returns all keys of properties currently set in this context,
- * possibly an empty collection
- *
- * @return keys of all current properties
- * @since 3.4
- */
- String[] getProperties();
+ /**
+ * Returns all keys of properties currently set in this context,
+ * possibly an empty collection
+ *
+ * @return keys of all current properties
+ * @since 3.4
+ */
+ String[] getProperties();
- /**
- * Returns the part that this presentation context is associated with.
- * May return <code>null</code> if the presentation is not associated
- * with a part.
- *
- * @return IWorkbenchPart or <code>null</code>
- * @since 3.6
- */
- IWorkbenchPart getPart();
+ /**
+ * Returns the part that this presentation context is associated with.
+ * May return <code>null</code> if the presentation is not associated
+ * with a part.
+ *
+ * @return IWorkbenchPart or <code>null</code>
+ * @since 3.6
+ */
+ IWorkbenchPart getPart();
- /**
- * Returns the window that this presentation context is associated with.
- * May return <code>null</code> if the presentation is not associated
- * with a window.
- *
- * @return IWorkbenchWindow or <code>null</code>
- * @since 3.6
- */
- IWorkbenchWindow getWindow();
+ /**
+ * Returns the window that this presentation context is associated with.
+ * May return <code>null</code> if the presentation is not associated
+ * with a window.
+ *
+ * @return IWorkbenchWindow or <code>null</code>
+ * @since 3.6
+ */
+ IWorkbenchWindow getWindow();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStateUpdateListener.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStateUpdateListener.java
index 198b97a0e..fddacb5cd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStateUpdateListener.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStateUpdateListener.java
@@ -32,30 +32,30 @@ public interface IStateUpdateListener {
* Notification that viewer updates are complete. Corresponds to
* a <code>viewerUpdatesBegin()</code> notification.
*
- * @param input Input object for the state operation.
+ * @param input Input object for the state operation.
*/
void stateSaveUpdatesComplete(Object input);
/**
- * Notification that a sequence of viewer updates are starting.
- *
- * @param input Input object for the state operation.
- */
- void stateRestoreUpdatesBegin(Object input);
+ * Notification that a sequence of viewer updates are starting.
+ *
+ * @param input Input object for the state operation.
+ */
+ void stateRestoreUpdatesBegin(Object input);
- /**
- * Notification that viewer updates are complete. Corresponds to
- * a <code>viewerUpdatesBegin()</code> notification.
- *
- * @param input Input object for the state operation.
- */
- void stateRestoreUpdatesComplete(Object input);
+ /**
+ * Notification that viewer updates are complete. Corresponds to
+ * a <code>viewerUpdatesBegin()</code> notification.
+ *
+ * @param input Input object for the state operation.
+ */
+ void stateRestoreUpdatesComplete(Object input);
/**
* Notification that a specific update has started within
* a sequence of updates.
*
- * @param input Input object for the state operation.
+ * @param input Input object for the state operation.
* @param update update
*/
void stateUpdateStarted(Object input, IViewerUpdate update);
@@ -64,7 +64,7 @@ public interface IStateUpdateListener {
* Notification that a specific update has completed within a
* sequence of updates.
*
- * @param input Input object for the state operation.
+ * @param input Input object for the state operation.
* @param update update
*/
void stateUpdateComplete(Object input, IViewerUpdate update);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStatusMonitor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStatusMonitor.java
index 6e63beb16..5c7b18f74 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStatusMonitor.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IStatusMonitor.java
@@ -42,20 +42,20 @@ import org.eclipse.core.runtime.IStatus;
*/
public interface IStatusMonitor extends IProgressMonitor {
- /**
- * Sets the status for a request, possibly <code>null</code>.
- * When a request fails, the status indicates why the request failed.
- * A <code>null</code> status is considered to be successful.
- *
- * @param status request status
- */
- void setStatus(IStatus status);
+ /**
+ * Sets the status for a request, possibly <code>null</code>.
+ * When a request fails, the status indicates why the request failed.
+ * A <code>null</code> status is considered to be successful.
+ *
+ * @param status request status
+ */
+ void setStatus(IStatus status);
- /**
- * Returns the status of this request, or <code>null</code>.
- *
- * @return request status - <code>null</code> is equivalent
- * to an OK status
- */
- IStatus getStatus();
+ /**
+ * Returns the status of this request, or <code>null</code>.
+ *
+ * @return request status - <code>null</code> is equivalent
+ * to an OK status
+ */
+ IStatus getStatus();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ITreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ITreeModelViewer.java
index 8c0dc9887..b7ba38a9a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ITreeModelViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ITreeModelViewer.java
@@ -31,251 +31,251 @@ import org.eclipse.swt.widgets.Display;
*/
public interface ITreeModelViewer extends ISelectionProvider {
- /**
- * Constant indicating that all levels of the tree should be expanded or
- * collapsed.
- *
- * @see #setAutoExpandLevel(int)
- * @see #getAutoExpandLevel()
- */
- int ALL_LEVELS = -1;
+ /**
+ * Constant indicating that all levels of the tree should be expanded or
+ * collapsed.
+ *
+ * @see #setAutoExpandLevel(int)
+ * @see #getAutoExpandLevel()
+ */
+ int ALL_LEVELS = -1;
- /**
- * Returns the Display object that this viewer is in. The
- * display object can be used by clients to access the display thread
- * to call the viewer methods.
- *
- * @return The display.
- */
- Display getDisplay();
+ /**
+ * Returns the Display object that this viewer is in. The
+ * display object can be used by clients to access the display thread
+ * to call the viewer methods.
+ *
+ * @return The display.
+ */
+ Display getDisplay();
- /**
- * Returns this viewer's presentation context.
- *
- * @return presentation context
- */
- IPresentationContext getPresentationContext();
+ /**
+ * Returns this viewer's presentation context.
+ *
+ * @return presentation context
+ */
+ IPresentationContext getPresentationContext();
- /**
- * Returns the current input of this viewer, or <code>null</code>
- * if none. The viewer's input provides the "model" for the viewer's
- * content.
- *
- * @return Input object
- */
- Object getInput();
+ /**
+ * Returns the current input of this viewer, or <code>null</code>
+ * if none. The viewer's input provides the "model" for the viewer's
+ * content.
+ *
+ * @return Input object
+ */
+ Object getInput();
- /**
- * Sets the input of this viewer. Setting the input resets the
- * viewer's contents and triggers an update starting at the input
- * element.
- *
- * @param object Input element, or <code>null</code> if none.
- */
- void setInput(Object object);
+ /**
+ * Sets the input of this viewer. Setting the input resets the
+ * viewer's contents and triggers an update starting at the input
+ * element.
+ *
+ * @param object Input element, or <code>null</code> if none.
+ */
+ void setInput(Object object);
- /**
- * Returns the current selection in viewer.
- *
- * @return selection object
- */
- @Override ISelection getSelection();
+ /**
+ * Returns the current selection in viewer.
+ *
+ * @return selection object
+ */
+ @Override ISelection getSelection();
- /**
- * Sets a new selection for this viewer and optionally makes it visible.
- * The selection is not set if the model selection policy overrides the
- * attempt to set the selection.
- *
- * @param selection the new selection
- * @param reveal <code>true</code> if the selection is to be made
- * visible, and <code>false</code> otherwise
- * @param force <code>true</code> if the selection should override the
- * model selection policy
- */
- void setSelection(ISelection selection, boolean reveal, boolean force);
+ /**
+ * Sets a new selection for this viewer and optionally makes it visible.
+ * The selection is not set if the model selection policy overrides the
+ * attempt to set the selection.
+ *
+ * @param selection the new selection
+ * @param reveal <code>true</code> if the selection is to be made
+ * visible, and <code>false</code> otherwise
+ * @param force <code>true</code> if the selection should override the
+ * model selection policy
+ */
+ void setSelection(ISelection selection, boolean reveal, boolean force);
- /**
- * Attempts to set the selection for this viewer and optionally makes it visible.
- * The selection is not set if the model selection policy overrides the
- * attempt to set the selection.
- *
- * @param selection the new selection
- * @param reveal whether to make the selection visible after successfully setting
- * the selection
- * @param force whether to force the selection (override the model selection policy)
- * @return <code>true</code> if the selection was set and <code>false</code> if the
- * model selection policy overrides the selection attempt
- */
- boolean trySelection(ISelection selection, boolean reveal, boolean force);
+ /**
+ * Attempts to set the selection for this viewer and optionally makes it visible.
+ * The selection is not set if the model selection policy overrides the
+ * attempt to set the selection.
+ *
+ * @param selection the new selection
+ * @param reveal whether to make the selection visible after successfully setting
+ * the selection
+ * @param force whether to force the selection (override the model selection policy)
+ * @return <code>true</code> if the selection was set and <code>false</code> if the
+ * model selection policy overrides the selection attempt
+ */
+ boolean trySelection(ISelection selection, boolean reveal, boolean force);
- /**
- * Returns the auto-expand level.
- *
- * @return non-negative level, or <code>ALL_LEVELS</code> if all levels of
- * the tree are expanded automatically
- * @see #setAutoExpandLevel
- */
- int getAutoExpandLevel();
+ /**
+ * Returns the auto-expand level.
+ *
+ * @return non-negative level, or <code>ALL_LEVELS</code> if all levels of
+ * the tree are expanded automatically
+ * @see #setAutoExpandLevel
+ */
+ int getAutoExpandLevel();
- /**
- * Sets the auto-expand level to be used when the input of the viewer is set
- * using {@link #setInput(Object)}. The value 0 means that there is no
- * auto-expand; 1 means that the invisible root element is expanded (since
- * most concrete implementations do not show the root element, there is usually
- * no practical difference between using the values 0 and 1); 2 means that
- * top-level elements are expanded, but not their children; 3 means that
- * top-level elements are expanded, and their children, but not
- * grandchildren; and so on.
- * <p>
- * The value <code>ALL_LEVELS</code> means that all subtrees should be
- * expanded.
- * </p>
- *
- * @param level
- * non-negative level, or <code>ALL_LEVELS</code> to expand all
- * levels of the tree
- */
- void setAutoExpandLevel(int level);
+ /**
+ * Sets the auto-expand level to be used when the input of the viewer is set
+ * using {@link #setInput(Object)}. The value 0 means that there is no
+ * auto-expand; 1 means that the invisible root element is expanded (since
+ * most concrete implementations do not show the root element, there is usually
+ * no practical difference between using the values 0 and 1); 2 means that
+ * top-level elements are expanded, but not their children; 3 means that
+ * top-level elements are expanded, and their children, but not
+ * grandchildren; and so on.
+ * <p>
+ * The value <code>ALL_LEVELS</code> means that all subtrees should be
+ * expanded.
+ * </p>
+ *
+ * @param level
+ * non-negative level, or <code>ALL_LEVELS</code> to expand all
+ * levels of the tree
+ */
+ void setAutoExpandLevel(int level);
- /**
- * Returns the label data for the given element and for the given column,
- * Returns <code>null</code> if the given element is not found or is not
- * materialized in the virtual viewer. Clients may listen to label update
- * events to be notified when element labels are updated.
- *
- * @param path Path of the element.
- * @param columnId ID of the column for which to return the label data.
- * @return Label object containing the label information. Can be
- * <code>null</code> if the given element is not found or is not
- * materialized in the virtual viewer.
- */
- ViewerLabel getElementLabel(TreePath path, String columnId);
+ /**
+ * Returns the label data for the given element and for the given column,
+ * Returns <code>null</code> if the given element is not found or is not
+ * materialized in the virtual viewer. Clients may listen to label update
+ * events to be notified when element labels are updated.
+ *
+ * @param path Path of the element.
+ * @param columnId ID of the column for which to return the label data.
+ * @return Label object containing the label information. Can be
+ * <code>null</code> if the given element is not found or is not
+ * materialized in the virtual viewer.
+ */
+ ViewerLabel getElementLabel(TreePath path, String columnId);
- /**
- * Registers the specified listener for view update notifications.
- *
- * @param listener Listener to add
- */
- void addViewerUpdateListener(IViewerUpdateListener listener);
+ /**
+ * Registers the specified listener for view update notifications.
+ *
+ * @param listener Listener to add
+ */
+ void addViewerUpdateListener(IViewerUpdateListener listener);
- /**
- * Removes the specified listener from update notifications.
- *
- * @param listener Listener to remove
- */
- void removeViewerUpdateListener(IViewerUpdateListener listener);
+ /**
+ * Removes the specified listener from update notifications.
+ *
+ * @param listener Listener to remove
+ */
+ void removeViewerUpdateListener(IViewerUpdateListener listener);
- /**
- * Registers the specified listener for state update notifications.
- *
- * @param listener Listener to add
- */
- void addStateUpdateListener(IStateUpdateListener listener);
+ /**
+ * Registers the specified listener for state update notifications.
+ *
+ * @param listener Listener to add
+ */
+ void addStateUpdateListener(IStateUpdateListener listener);
- /**
- * Removes the specified listener from state update notifications.
- *
- * @param listener Listener to remove
- */
- void removeStateUpdateListener(IStateUpdateListener listener);
+ /**
+ * Removes the specified listener from state update notifications.
+ *
+ * @param listener Listener to remove
+ */
+ void removeStateUpdateListener(IStateUpdateListener listener);
- /**
- * Registers the specified listener for view label update notifications.
- *
- * @param listener Listener to add
- */
- void addLabelUpdateListener(ILabelUpdateListener listener);
+ /**
+ * Registers the specified listener for view label update notifications.
+ *
+ * @param listener Listener to add
+ */
+ void addLabelUpdateListener(ILabelUpdateListener listener);
- /**
- * Removes the specified listener from view label update notifications.
- *
- * @param listener Listener to remove
- */
- void removeLabelUpdateListener(ILabelUpdateListener listener);
+ /**
+ * Removes the specified listener from view label update notifications.
+ *
+ * @param listener Listener to remove
+ */
+ void removeLabelUpdateListener(ILabelUpdateListener listener);
- /**
- * Registers the given listener for model delta notification.
- * This listener is called immediately after the viewer processes
- * the delta.
- *
- * @param listener Listener to add
- */
- void addModelChangedListener(IModelChangedListener listener);
+ /**
+ * Registers the given listener for model delta notification.
+ * This listener is called immediately after the viewer processes
+ * the delta.
+ *
+ * @param listener Listener to add
+ */
+ void addModelChangedListener(IModelChangedListener listener);
- /**
- * Removes the given listener from model delta notification.
- *
- * @param listener Listener to remove
- */
- void removeModelChangedListener(IModelChangedListener listener);
+ /**
+ * Removes the given listener from model delta notification.
+ *
+ * @param listener Listener to remove
+ */
+ void removeModelChangedListener(IModelChangedListener listener);
- /**
- * Writes state information into a delta for the sub-tree at the given
- * path. It adds delta nodes and IModelDelta.EXPAND and IModelDelta.SELECT
- * as it parses the sub-tree.
- *
- * @param path Path where to start saving the state.
- * @param delta The delta where the state is to be saved.
- * @param flagsToSave The flags to preserve during the state save. The
- * supported flags are <code>IModelDelta.SELECT</code>,
- * <code>IModelDelta.EXPAND</code>, <code>IModelDelta.COLLAPSE</code>.
- * @return Returns whether the state was saved for the given path. Will
- * return <code>false</code> if an element at the given path cannot
- * be found.
- */
- boolean saveElementState(TreePath path, ModelDelta delta, int flagsToSave);
+ /**
+ * Writes state information into a delta for the sub-tree at the given
+ * path. It adds delta nodes and IModelDelta.EXPAND and IModelDelta.SELECT
+ * as it parses the sub-tree.
+ *
+ * @param path Path where to start saving the state.
+ * @param delta The delta where the state is to be saved.
+ * @param flagsToSave The flags to preserve during the state save. The
+ * supported flags are <code>IModelDelta.SELECT</code>,
+ * <code>IModelDelta.EXPAND</code>, <code>IModelDelta.COLLAPSE</code>.
+ * @return Returns whether the state was saved for the given path. Will
+ * return <code>false</code> if an element at the given path cannot
+ * be found.
+ */
+ boolean saveElementState(TreePath path, ModelDelta delta, int flagsToSave);
- /**
- * Causes the viewer to process the given delta as if it came from a
- * model proxy. This method is intended to be used to restore state
- * saved using {@link #saveElementState(TreePath, ModelDelta, int)}.
- *
- * @param delta Delta to process.
- */
- void updateViewer(IModelDelta delta);
+ /**
+ * Causes the viewer to process the given delta as if it came from a
+ * model proxy. This method is intended to be used to restore state
+ * saved using {@link #saveElementState(TreePath, ModelDelta, int)}.
+ *
+ * @param delta Delta to process.
+ */
+ void updateViewer(IModelDelta delta);
- /**
- * Triggers an update of the given element and its children. If
- * multiple instances of the given element are found in the tree,
- * they will all be updated.
- *
- * @param element Element to update.
- */
- void refresh(Object element);
+ /**
+ * Triggers an update of the given element and its children. If
+ * multiple instances of the given element are found in the tree,
+ * they will all be updated.
+ *
+ * @param element Element to update.
+ */
+ void refresh(Object element);
- /**
- * Triggers a full update of all the elements in the tree.
- */
- void refresh();
+ /**
+ * Triggers a full update of all the elements in the tree.
+ */
+ void refresh();
- /**
- * Returns the paths at which the given element is found realized in viewer
- * or an empty array if not found.
- *
- * @param element Element to find.
- * @return Array of paths for given element.
- */
- TreePath[] getElementPaths(Object element);
+ /**
+ * Returns the paths at which the given element is found realized in viewer
+ * or an empty array if not found.
+ *
+ * @param element Element to find.
+ * @return Array of paths for given element.
+ */
+ TreePath[] getElementPaths(Object element);
- /**
- * Returns filters currently configured in viewer.
- *
- * @return filter array in viewer.
- */
- ViewerFilter[] getFilters();
+ /**
+ * Returns filters currently configured in viewer.
+ *
+ * @return filter array in viewer.
+ */
+ ViewerFilter[] getFilters();
- /**
- * Add a new filter to use in viewer.
- *
- * @param filter Filter to add.
- */
- void addFilter(ViewerFilter filter);
+ /**
+ * Add a new filter to use in viewer.
+ *
+ * @param filter Filter to add.
+ */
+ void addFilter(ViewerFilter filter);
- /**
- * Sets viewer filters to the filters in array.
- *
- * @param filters New filter array to use.
- */
+ /**
+ * Sets viewer filters to the filters in array.
+ *
+ * @param filters New filter array to use.
+ */
void setFilters(ViewerFilter... filters);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IViewerUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IViewerUpdate.java
index a7141a47e..dda5ce605 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IViewerUpdate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IViewerUpdate.java
@@ -31,27 +31,27 @@ public interface IViewerUpdate extends IRequest {
*/
IPresentationContext getPresentationContext();
- /**
- * Returns the model element associated with this request.
- *
- * @return associated model element
- */
- Object getElement();
+ /**
+ * Returns the model element associated with this request.
+ *
+ * @return associated model element
+ */
+ Object getElement();
- /**
- * Returns the viewer tree path to the model element associated with this
- * request. An empty path indicates a root element.
- *
- * @return tree path, possibly empty
- */
- TreePath getElementPath();
+ /**
+ * Returns the viewer tree path to the model element associated with this
+ * request. An empty path indicates a root element.
+ *
+ * @return tree path, possibly empty
+ */
+ TreePath getElementPath();
- /**
- * Returns the element that was the viewer input at the time the
- * request was made, possibly <code>null</code>.
- *
- * @return viewer input element, possibly <code>null</code>
- * @since 3.4
- */
- Object getViewerInput();
+ /**
+ * Returns the element that was the viewer input at the time the
+ * request was made, possibly <code>null</code>.
+ *
+ * @return viewer input element, possibly <code>null</code>
+ * @since 3.4
+ */
+ Object getViewerInput();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemListener.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemListener.java
index 41d449be7..bee1e2b4c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemListener.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemListener.java
@@ -22,20 +22,20 @@ package org.eclipse.debug.internal.ui.viewers.model.provisional;
*/
public interface IVirtualItemListener {
- /**
- * Called when the item has been shown in the virtual viewer's
- * view-port. This indicates to the viewer that it should check
- * the item's status and request needed data.
- *
- * @param item The item that was revealed.
- */
- void revealed(VirtualItem item);
+ /**
+ * Called when the item has been shown in the virtual viewer's
+ * view-port. This indicates to the viewer that it should check
+ * the item's status and request needed data.
+ *
+ * @param item The item that was revealed.
+ */
+ void revealed(VirtualItem item);
- /**
- * Called when an item is disposed. It tells the viewer to
- * clean up any remaining mappings and cached data of this item.
- *
- * @param item The itam that was disposed.
- */
- void disposed(VirtualItem item);
+ /**
+ * Called when an item is disposed. It tells the viewer to
+ * clean up any remaining mappings and cached data of this item.
+ *
+ * @param item The itam that was disposed.
+ */
+ void disposed(VirtualItem item);
} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemValidator.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemValidator.java
index d0054865b..981a842e0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemValidator.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IVirtualItemValidator.java
@@ -23,19 +23,19 @@ package org.eclipse.debug.internal.ui.viewers.model.provisional;
*/
public interface IVirtualItemValidator {
- /**
- * Allows the validator to determine whether the given item is to be deemed
- * visible in the virtual tree.
- *
- * @param item Item to be tested.
- * @return returns true if the item should be considered visible.
- */
- boolean isItemVisible(VirtualItem item);
+ /**
+ * Allows the validator to determine whether the given item is to be deemed
+ * visible in the virtual tree.
+ *
+ * @param item Item to be tested.
+ * @return returns true if the item should be considered visible.
+ */
+ boolean isItemVisible(VirtualItem item);
- /**
- * Indicates that the viewer requested to reveal the given item in viewer.
- *
- * @param item Item to show.
- */
- void showItem(VirtualItem item);
+ /**
+ * Indicates that the viewer requested to reveal the given item in viewer.
+ *
+ * @param item Item to show.
+ */
+ void showItem(VirtualItem item);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ModelDelta.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ModelDelta.java
index 369307a8f..cb147026e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ModelDelta.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ModelDelta.java
@@ -64,8 +64,8 @@ public class ModelDelta implements IModelDelta {
*/
public ModelDelta(Object element, Object replacement, int flags) {
this(element, flags);
- fReplacement = replacement;
- }
+ fReplacement = replacement;
+ }
/**
* Constructs a new delta for the given element to be inserted at
@@ -75,10 +75,10 @@ public class ModelDelta implements IModelDelta {
* @param index insertion position
* @param flags change flags
*/
- public ModelDelta(Object element, int index, int flags) {
+ public ModelDelta(Object element, int index, int flags) {
this(element, flags);
- fIndex = index;
- }
+ fIndex = index;
+ }
/**
* Constructs a new delta for the given element at the specified index
@@ -89,12 +89,12 @@ public class ModelDelta implements IModelDelta {
* @param flags change flags
* @param childCount number of children this node has
*/
- public ModelDelta(Object element, int index, int flags, int childCount) {
+ public ModelDelta(Object element, int index, int flags, int childCount) {
this(element, index, flags);
- fChildCount = childCount;
- }
+ fChildCount = childCount;
+ }
- @Override
+ @Override
public Object getElement() {
return fElement;
}
@@ -126,74 +126,74 @@ public class ModelDelta implements IModelDelta {
* @return corresponding delta node, or <code>null</code>
*/
public ModelDelta getChildDelta(Object element) {
- if (fNodesMap == null) {
- mapNodes();
- }
- Object nodeOrNodes = fNodesMap.get(element);
- if (nodeOrNodes instanceof ModelDelta) {
- return (ModelDelta)nodeOrNodes;
- } else if (nodeOrNodes instanceof ModelDelta[]) {
- return ((ModelDelta[])nodeOrNodes)[0];
- }
- return null;
+ if (fNodesMap == null) {
+ mapNodes();
+ }
+ Object nodeOrNodes = fNodesMap.get(element);
+ if (nodeOrNodes instanceof ModelDelta) {
+ return (ModelDelta)nodeOrNodes;
+ } else if (nodeOrNodes instanceof ModelDelta[]) {
+ return ((ModelDelta[])nodeOrNodes)[0];
+ }
+ return null;
}
/**
- * Returns the child delta for the given element and index, or <code>null</code> if none.
- *
- * @param element Element of the child delta to find
- * @param index Index of the child delta to find.
- * @return corresponding delta node, or <code>null</code>
- *
- * @since 3.8
- */
- public ModelDelta getChildDelta(Object element, int index) {
- if (fNodesMap == null) {
- mapNodes();
- }
- Object nodeOrNodes = fNodesMap.get(element);
- if (nodeOrNodes instanceof ModelDelta) {
- ModelDelta node = (ModelDelta)nodeOrNodes;
- if (index == node.getIndex()) {
- return node;
- }
- } else if (nodeOrNodes instanceof ModelDelta[]) {
- ModelDelta[] nodes = (ModelDelta[])nodeOrNodes;
- for (int i = 0; i < nodes.length; i++) {
- if (index == nodes[i].getIndex()) {
- return nodes[i];
- }
- }
- }
- return null;
- }
+ * Returns the child delta for the given element and index, or <code>null</code> if none.
+ *
+ * @param element Element of the child delta to find
+ * @param index Index of the child delta to find.
+ * @return corresponding delta node, or <code>null</code>
+ *
+ * @since 3.8
+ */
+ public ModelDelta getChildDelta(Object element, int index) {
+ if (fNodesMap == null) {
+ mapNodes();
+ }
+ Object nodeOrNodes = fNodesMap.get(element);
+ if (nodeOrNodes instanceof ModelDelta) {
+ ModelDelta node = (ModelDelta)nodeOrNodes;
+ if (index == node.getIndex()) {
+ return node;
+ }
+ } else if (nodeOrNodes instanceof ModelDelta[]) {
+ ModelDelta[] nodes = (ModelDelta[])nodeOrNodes;
+ for (int i = 0; i < nodes.length; i++) {
+ if (index == nodes[i].getIndex()) {
+ return nodes[i];
+ }
+ }
+ }
+ return null;
+ }
private void mapNodes() {
- if (fNodesList == null) {
+ if (fNodesList == null) {
fNodesMap = new HashMap<>(1);
- return;
- }
- // Create a map with capacity for all child nodes.
+ return;
+ }
+ // Create a map with capacity for all child nodes.
fNodesMap = new HashMap<>(fNodesList.size() * 4 / 3);
- for (int i = 0; i < fNodesList.size(); i++) {
- mapNode( fNodesList.get(i) );
- }
+ for (int i = 0; i < fNodesList.size(); i++) {
+ mapNode( fNodesList.get(i) );
+ }
}
private void mapNode(ModelDelta node) {
- Object oldValue = fNodesMap.put(node.getElement(), node);
- if (oldValue instanceof ModelDelta) {
- // Edge case: already a node for given element was added.
- ModelDelta[] nodes = new ModelDelta[] { (ModelDelta)oldValue, node };
- fNodesMap.put(node.getElement(), nodes);
- } else if (oldValue instanceof ModelDelta[]) {
- // Even more remote case: multiple delta nodes for the same element were already added
- ModelDelta[] oldNodes = (ModelDelta[])oldValue;
- ModelDelta[] newNodes = new ModelDelta[oldNodes.length + 1];
- System.arraycopy(oldNodes, 0, newNodes, 0, oldNodes.length);
- newNodes[newNodes.length - 1] = node;
- fNodesMap.put(node.getElement(), newNodes);
- }
+ Object oldValue = fNodesMap.put(node.getElement(), node);
+ if (oldValue instanceof ModelDelta) {
+ // Edge case: already a node for given element was added.
+ ModelDelta[] nodes = new ModelDelta[] { (ModelDelta)oldValue, node };
+ fNodesMap.put(node.getElement(), nodes);
+ } else if (oldValue instanceof ModelDelta[]) {
+ // Even more remote case: multiple delta nodes for the same element were already added
+ ModelDelta[] oldNodes = (ModelDelta[])oldValue;
+ ModelDelta[] newNodes = new ModelDelta[oldNodes.length + 1];
+ System.arraycopy(oldNodes, 0, newNodes, 0, oldNodes.length);
+ newNodes[newNodes.length - 1] = node;
+ fNodesMap.put(node.getElement(), newNodes);
+ }
}
@@ -207,51 +207,51 @@ public class ModelDelta implements IModelDelta {
* @param flags change flags
* @return newly created child delta
*/
- public ModelDelta addNode(Object element, Object replacement, int flags) {
- ModelDelta node = new ModelDelta(element, replacement, flags);
- node.setParent(this);
- addDelta(node);
- return node;
- }
-
- /**
- * Adds a child delta to this delta to insert the specified element at
- * the given index, and returns the newly created child delta.
- *
- * @param element child element in insert
- * @param index index of insertion
- * @param flags change flags
- * @return newly created child delta
- */
- public ModelDelta addNode(Object element, int index, int flags) {
- ModelDelta node = new ModelDelta(element, index, flags);
- node.setParent(this);
- addDelta(node);
- return node;
- }
-
- /**
- * Adds a child delta to this delta at the specified index with the
- * given number of children, and returns the newly created child delta.
- *
- * @param element child element in insert
- * @param index index of the element relative to parent
- * @param flags change flags
- * @param numChildren the number of children the element has
- * @return newly created child delta
- */
- public ModelDelta addNode(Object element, int index, int flags, int numChildren) {
- ModelDelta node = new ModelDelta(element, index, flags, numChildren);
- node.setParent(this);
- addDelta(node);
- return node;
- }
-
- /**
- * Sets the parent delta of this delta
- *
- * @param node parent delta
- */
+ public ModelDelta addNode(Object element, Object replacement, int flags) {
+ ModelDelta node = new ModelDelta(element, replacement, flags);
+ node.setParent(this);
+ addDelta(node);
+ return node;
+ }
+
+ /**
+ * Adds a child delta to this delta to insert the specified element at
+ * the given index, and returns the newly created child delta.
+ *
+ * @param element child element in insert
+ * @param index index of insertion
+ * @param flags change flags
+ * @return newly created child delta
+ */
+ public ModelDelta addNode(Object element, int index, int flags) {
+ ModelDelta node = new ModelDelta(element, index, flags);
+ node.setParent(this);
+ addDelta(node);
+ return node;
+ }
+
+ /**
+ * Adds a child delta to this delta at the specified index with the
+ * given number of children, and returns the newly created child delta.
+ *
+ * @param element child element in insert
+ * @param index index of the element relative to parent
+ * @param flags change flags
+ * @param numChildren the number of children the element has
+ * @return newly created child delta
+ */
+ public ModelDelta addNode(Object element, int index, int flags, int numChildren) {
+ ModelDelta node = new ModelDelta(element, index, flags, numChildren);
+ node.setParent(this);
+ addDelta(node);
+ return node;
+ }
+
+ /**
+ * Sets the parent delta of this delta
+ *
+ * @param node parent delta
+ */
void setParent(ModelDelta node) {
fParent = node;
}
@@ -261,21 +261,21 @@ public class ModelDelta implements IModelDelta {
return fParent;
}
- @Override
+ @Override
public Object getReplacementElement() {
- return fReplacement;
- }
+ return fReplacement;
+ }
- @Override
+ @Override
public int getIndex() {
- return fIndex;
- }
+ return fIndex;
+ }
@Override
public IModelDelta[] getChildDeltas() {
- if (fNodes == null) {
- fNodes = fNodesList.toArray(new ModelDelta[fNodesList.size()]);
- }
+ if (fNodes == null) {
+ fNodes = fNodesList.toArray(new ModelDelta[fNodesList.size()]);
+ }
return fNodes;
}
@@ -283,11 +283,11 @@ public class ModelDelta implements IModelDelta {
if (fNodesList == null) {
fNodesList = new ArrayList<>(4);
}
- fNodesList.add(delta);
- fNodes = null;
- if (fNodesMap != null) {
- mapNode(delta);
- }
+ fNodesList.add(delta);
+ fNodes = null;
+ if (fNodesMap != null) {
+ mapNode(delta);
+ }
}
@Override
@@ -300,11 +300,11 @@ public class ModelDelta implements IModelDelta {
}
private void appendDetail(String indent, StringBuffer buf, IModelDelta delta) {
- buf.append(indent);
+ buf.append(indent);
buf.append("Element: "); //$NON-NLS-1$
buf.append(delta.getElement());
buf.append('\n');
- buf.append(indent);
+ buf.append(indent);
buf.append(" Flags: "); //$NON-NLS-1$
int flags = delta.getFlags();
if (flags == 0) {
@@ -316,9 +316,9 @@ public class ModelDelta implements IModelDelta {
if ((flags & IModelDelta.CONTENT) > 0) {
buf.append("CONTENT | "); //$NON-NLS-1$
}
- if ((flags & IModelDelta.COLLAPSE) > 0) {
- buf.append("COLLAPSE | "); //$NON-NLS-1$
- }
+ if ((flags & IModelDelta.COLLAPSE) > 0) {
+ buf.append("COLLAPSE | "); //$NON-NLS-1$
+ }
if ((flags & IModelDelta.EXPAND) > 0) {
buf.append("EXPAND | "); //$NON-NLS-1$
}
@@ -344,15 +344,15 @@ public class ModelDelta implements IModelDelta {
buf.append("UNINSTALL | "); //$NON-NLS-1$
}
if ((flags & IModelDelta.REVEAL) > 0) {
- buf.append("REVEAL | "); //$NON-NLS-1$
- }
- if ((flags & IModelDelta.FORCE) > 0) {
- buf.append("FORCE | "); //$NON-NLS-1$
- }
+ buf.append("REVEAL | "); //$NON-NLS-1$
+ }
+ if ((flags & IModelDelta.FORCE) > 0) {
+ buf.append("FORCE | "); //$NON-NLS-1$
+ }
}
buf.append('\n');
- buf.append(indent);
+ buf.append(indent);
buf.append(" Index: "); //$NON-NLS-1$
buf.append(delta.getIndex());
buf.append(" Child Count: "); //$NON-NLS-1$
@@ -401,23 +401,23 @@ public class ModelDelta implements IModelDelta {
fFlags = flags;
}
- /**
- * Sets this delta's index
- *
- * @param index new index to set
- * @since 3.6
- */
- public void setIndex(int index) {
- fIndex = index;
- }
+ /**
+ * Sets this delta's index
+ *
+ * @param index new index to set
+ * @since 3.6
+ */
+ public void setIndex(int index) {
+ fIndex = index;
+ }
/**
- * Sets this delta's child count.
- *
- * @param count new child count to set
- */
- public void setChildCount(int count) {
- fChildCount = count;
- }
+ * Sets this delta's child count.
+ *
+ * @param count new child count to set
+ */
+ public void setChildCount(int count) {
+ fChildCount = count;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java
index 6cf38ac23..7fed0f718 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java
@@ -40,63 +40,63 @@ import org.eclipse.ui.PlatformUI;
*/
public class PresentationContext implements IPresentationContext {
- private static final String PRESENTATION_CONTEXT_PROPERTIES = "PRESENTATION_CONTEXT_PROPERTIES"; //$NON-NLS-1$
- private static final String BOOLEAN = "BOOLEAN"; //$NON-NLS-1$
- private static final String STRING = "STRING"; //$NON-NLS-1$
- private static final String INTEGER = "INTEGER"; //$NON-NLS-1$
- private static final String PERSISTABLE = "PERSISTABLE"; //$NON-NLS-1$
+ private static final String PRESENTATION_CONTEXT_PROPERTIES = "PRESENTATION_CONTEXT_PROPERTIES"; //$NON-NLS-1$
+ private static final String BOOLEAN = "BOOLEAN"; //$NON-NLS-1$
+ private static final String STRING = "STRING"; //$NON-NLS-1$
+ private static final String INTEGER = "INTEGER"; //$NON-NLS-1$
+ private static final String PERSISTABLE = "PERSISTABLE"; //$NON-NLS-1$
- final private String fId;
+ final private String fId;
final private ListenerList<IPropertyChangeListener> fListeners = new ListenerList<>();
final private Map<String, Object> fProperties = new HashMap<>();
- private IWorkbenchWindow fWindow;
- private IWorkbenchPart fPart;
-
- /**
- * Constructs a presentation context for the given id.
- *
- * @param id presentation context id
- */
- public PresentationContext(String id) {
- this (id, null, null);
- }
-
- /**
- * Constructs a presentation context for the given id and window.
- *
- * @param id presentation context id
- * @param window presentation context window, may be <code>null</code>
- */
- public PresentationContext(String id, IWorkbenchWindow window) {
- this (id, window, null);
- }
-
- /**
- * Constructs a presentation context for the given id and part.
- * The presentation context window is derived from the part.
- *
- * @param id presentation context id
- * @param part presentation context part, may be <code>null</code>
- */
- public PresentationContext(String id, IWorkbenchPart part) {
- this (id, part == null ? null : part.getSite().getWorkbenchWindow(), part);
- }
-
- /**
- * Constructs a presentation context for the given id and part.
- * The presentation context id and window are derived from the part.
- *
- * @param part presentation context part, can NOT be <code>null</code>
- */
- public PresentationContext(IWorkbenchPart part) {
- this (part.getSite().getId(), part.getSite().getWorkbenchWindow(), part);
- }
-
- private PresentationContext(String id, IWorkbenchWindow window, IWorkbenchPart part) {
- fId = id;
- fWindow = window;
- fPart = part;
- }
+ private IWorkbenchWindow fWindow;
+ private IWorkbenchPart fPart;
+
+ /**
+ * Constructs a presentation context for the given id.
+ *
+ * @param id presentation context id
+ */
+ public PresentationContext(String id) {
+ this (id, null, null);
+ }
+
+ /**
+ * Constructs a presentation context for the given id and window.
+ *
+ * @param id presentation context id
+ * @param window presentation context window, may be <code>null</code>
+ */
+ public PresentationContext(String id, IWorkbenchWindow window) {
+ this (id, window, null);
+ }
+
+ /**
+ * Constructs a presentation context for the given id and part.
+ * The presentation context window is derived from the part.
+ *
+ * @param id presentation context id
+ * @param part presentation context part, may be <code>null</code>
+ */
+ public PresentationContext(String id, IWorkbenchPart part) {
+ this (id, part == null ? null : part.getSite().getWorkbenchWindow(), part);
+ }
+
+ /**
+ * Constructs a presentation context for the given id and part.
+ * The presentation context id and window are derived from the part.
+ *
+ * @param part presentation context part, can NOT be <code>null</code>
+ */
+ public PresentationContext(IWorkbenchPart part) {
+ this (part.getSite().getId(), part.getSite().getWorkbenchWindow(), part);
+ }
+
+ private PresentationContext(String id, IWorkbenchWindow window, IWorkbenchPart part) {
+ fId = id;
+ fWindow = window;
+ fPart = part;
+ }
@Override
public String[] getColumns() {
@@ -136,8 +136,8 @@ public class PresentationContext implements IPresentationContext {
@Override
public void dispose() {
- fProperties.clear();
- setProperty(PROPERTY_DISPOSED, Boolean.TRUE);
+ fProperties.clear();
+ setProperty(PROPERTY_DISPOSED, Boolean.TRUE);
fListeners.clear();
// Free the reference to fWindow (Bug 321658).
fWindow = null;
@@ -168,18 +168,18 @@ public class PresentationContext implements IPresentationContext {
@Override
public void setProperty(String property, Object value) {
- Object oldValue = null;
- boolean propertySet = false;
+ Object oldValue = null;
+ boolean propertySet = false;
synchronized (fProperties) {
oldValue = fProperties.get(property);
if (!isEqual(oldValue, value)) {
- propertySet = true;
+ propertySet = true;
fProperties.put(property, value);
}
}
if (propertySet) {
- firePropertyChange(property, oldValue, value);
+ firePropertyChange(property, oldValue, value);
}
}
@@ -188,46 +188,46 @@ public class PresentationContext implements IPresentationContext {
* @param memento Memento to restore from.
*/
public void initProperties(IMemento memento) {
- IMemento presentationMemento = null;
-
- IMemento[] mementos = memento.getChildren(PRESENTATION_CONTEXT_PROPERTIES);
- for (int i = 0; i < mementos.length; i++) {
- if (getId().equals(mementos[i].getID())) {
- presentationMemento = mementos[i];
- break;
- }
- }
-
- if (presentationMemento != null) {
- IMemento[] stringProperties = presentationMemento.getChildren(STRING);
- for (int i = 0; i < stringProperties.length; i++) {
- fProperties.put(stringProperties[i].getID(), stringProperties[i].getString(STRING));
- }
-
- IMemento[] integerMementos = presentationMemento.getChildren(INTEGER);
- for (int i = 0; i < integerMementos.length; i++) {
- fProperties.put(integerMementos[i].getID(), integerMementos[i].getInteger(INTEGER));
- }
-
- IMemento[] booleanMementos = presentationMemento.getChildren(BOOLEAN);
- for (int i = 0; i < booleanMementos.length; i++) {
- fProperties.put(booleanMementos[i].getID(), booleanMementos[i].getBoolean(BOOLEAN));
- }
-
- IMemento[] persistableMementos = presentationMemento.getChildren(PERSISTABLE);
- for (int i = 0; i < persistableMementos.length; i++) {
- String factoryID = persistableMementos[i].getString(PERSISTABLE);
- if (factoryID != null) {
- IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(factoryID);
- if (factory != null) {
- Object element = factory.createElement(persistableMementos[i]);
- if (element != null) {
- fProperties.put(persistableMementos[i].getID(), element);
- }
- }
- }
- }
- }
+ IMemento presentationMemento = null;
+
+ IMemento[] mementos = memento.getChildren(PRESENTATION_CONTEXT_PROPERTIES);
+ for (int i = 0; i < mementos.length; i++) {
+ if (getId().equals(mementos[i].getID())) {
+ presentationMemento = mementos[i];
+ break;
+ }
+ }
+
+ if (presentationMemento != null) {
+ IMemento[] stringProperties = presentationMemento.getChildren(STRING);
+ for (int i = 0; i < stringProperties.length; i++) {
+ fProperties.put(stringProperties[i].getID(), stringProperties[i].getString(STRING));
+ }
+
+ IMemento[] integerMementos = presentationMemento.getChildren(INTEGER);
+ for (int i = 0; i < integerMementos.length; i++) {
+ fProperties.put(integerMementos[i].getID(), integerMementos[i].getInteger(INTEGER));
+ }
+
+ IMemento[] booleanMementos = presentationMemento.getChildren(BOOLEAN);
+ for (int i = 0; i < booleanMementos.length; i++) {
+ fProperties.put(booleanMementos[i].getID(), booleanMementos[i].getBoolean(BOOLEAN));
+ }
+
+ IMemento[] persistableMementos = presentationMemento.getChildren(PERSISTABLE);
+ for (int i = 0; i < persistableMementos.length; i++) {
+ String factoryID = persistableMementos[i].getString(PERSISTABLE);
+ if (factoryID != null) {
+ IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(factoryID);
+ if (factory != null) {
+ Object element = factory.createElement(persistableMementos[i]);
+ if (element != null) {
+ fProperties.put(persistableMementos[i].getID(), element);
+ }
+ }
+ }
+ }
+ }
}
/**
@@ -235,27 +235,27 @@ public class PresentationContext implements IPresentationContext {
* @param memento Memento to save to.
*/
public void saveProperites(IMemento memento) {
- if (fProperties.isEmpty()) {
- return;
- }
- IMemento properties = memento.createChild(PRESENTATION_CONTEXT_PROPERTIES, getId());
+ if (fProperties.isEmpty()) {
+ return;
+ }
+ IMemento properties = memento.createChild(PRESENTATION_CONTEXT_PROPERTIES, getId());
for (Entry<String, Object> entry : fProperties.entrySet()) {
- if (entry.getValue() instanceof String) {
- IMemento value = properties.createChild(STRING, entry.getKey());
- value.putString(STRING, (String)entry.getValue());
- } else if (entry.getValue() instanceof Integer) {
- IMemento value = properties.createChild(INTEGER, entry.getKey());
- value.putInteger(INTEGER, ((Integer)entry.getValue()).intValue());
- } else if (entry.getValue() instanceof Boolean) {
- IMemento value = properties.createChild(BOOLEAN, entry.getKey());
- value.putBoolean(BOOLEAN, ((Boolean)entry.getValue()).booleanValue());
- } else if (entry.getValue() instanceof IPersistableElement) {
- IPersistableElement persistable = (IPersistableElement)entry.getValue();
- IMemento value = properties.createChild(PERSISTABLE, entry.getKey());
- value.putString(PERSISTABLE, persistable.getFactoryId());
- persistable.saveState(value);
- }
- }
+ if (entry.getValue() instanceof String) {
+ IMemento value = properties.createChild(STRING, entry.getKey());
+ value.putString(STRING, (String)entry.getValue());
+ } else if (entry.getValue() instanceof Integer) {
+ IMemento value = properties.createChild(INTEGER, entry.getKey());
+ value.putInteger(INTEGER, ((Integer)entry.getValue()).intValue());
+ } else if (entry.getValue() instanceof Boolean) {
+ IMemento value = properties.createChild(BOOLEAN, entry.getKey());
+ value.putBoolean(BOOLEAN, ((Boolean)entry.getValue()).booleanValue());
+ } else if (entry.getValue() instanceof IPersistableElement) {
+ IPersistableElement persistable = (IPersistableElement)entry.getValue();
+ IMemento value = properties.createChild(PERSISTABLE, entry.getKey());
+ value.putString(PERSISTABLE, persistable.getFactoryId());
+ persistable.saveState(value);
+ }
+ }
}
private boolean isEqual(Object a, Object b) {
@@ -273,15 +273,15 @@ public class PresentationContext implements IPresentationContext {
}
}
- @Override
+ @Override
public IWorkbenchPart getPart() {
- return fPart;
- }
+ return fPart;
+ }
- @Override
+ @Override
public IWorkbenchWindow getWindow() {
- return fWindow;
- }
+ return fWindow;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewer.java
index eb6492cd3..a1a498ecb 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewer.java
@@ -128,7 +128,7 @@ public class TreeModelViewer extends InternalTreeModelViewer {
/**
* Initializes viewer state from the memento
*
- * @param memento the {@link IMemento} to read from
+ * @param memento the {@link IMemento} to read from
*/
@Override
public void initState(IMemento memento) {
@@ -138,16 +138,16 @@ public class TreeModelViewer extends InternalTreeModelViewer {
/**
* Save viewer state into the given memento.
*
- * @param memento the {@link IMemento} to save to
+ * @param memento the {@link IMemento} to save to
*/
@Override
public void saveState(IMemento memento) {
super.saveState(memento);
}
- /**
- * @return Returns true if columns are being displayed currently.
- */
+ /**
+ * @return Returns true if columns are being displayed currently.
+ */
@Override
public boolean isShowColumns() {
return super.isShowColumns();
@@ -187,8 +187,8 @@ public class TreeModelViewer extends InternalTreeModelViewer {
super.setVisibleColumns(ids);
}
- @Override
+ @Override
public ViewerLabel getElementLabel(TreePath path, String columnId) {
- return super.getElementLabel(path, columnId);
- }
+ return super.getElementLabel(path, columnId);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewerFilter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewerFilter.java
index f48408a7b..54153c113 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewerFilter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/TreeModelViewerFilter.java
@@ -30,12 +30,12 @@ import org.eclipse.jface.viewers.ViewerFilter;
*/
abstract public class TreeModelViewerFilter extends ViewerFilter {
- /**
- * Determines whether the filter applies to the given parent element.
- * @return Returns true if the viewer should use the given filter on the
- * given element.
- * @param viewer The viewer that is using this filter to select elements.
- * @param parentElement Parent element to check filter for.
- */
- abstract public boolean isApplicable(ITreeModelViewer viewer, Object parentElement);
+ /**
+ * Determines whether the filter applies to the given parent element.
+ * @return Returns true if the viewer should use the given filter on the
+ * given element.
+ * @param viewer The viewer that is using this filter to select elements.
+ * @param parentElement Parent element to check filter for.
+ */
+ abstract public boolean isApplicable(ITreeModelViewer viewer, Object parentElement);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java
index 51e385737..a52928877 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java
@@ -28,18 +28,18 @@ import org.eclipse.debug.internal.ui.viewers.model.ViewerInputUpdate;
*/
public class ViewerInputService {
- /**
- * An input object which will yield a null input element.
- *
- * @since 3.6
- */
- public final static Object NULL_INPUT = new IViewerInputProvider() {
- @Override
+ /**
+ * An input object which will yield a null input element.
+ *
+ * @since 3.6
+ */
+ public final static Object NULL_INPUT = new IViewerInputProvider() {
+ @Override
public void update(IViewerInputUpdate update) {
- update.setInputElement(null);
- update.done();
- }
- };
+ update.setInputElement(null);
+ update.done();
+ }
+ };
// previous update request, cancelled when a new request comes in
private IViewerInputUpdate fPendingUpdate = null;
@@ -63,7 +63,7 @@ public class ViewerInputService {
/**
* Constructs a viewer input service for the given requester and presentation context.
*
- * @param viewer for which inputs are required
+ * @param viewer for which inputs are required
* @param requestor client requesting viewer inputs
*/
public ViewerInputService(ITreeModelViewer viewer, IViewerInputRequestor requestor) {
@@ -90,7 +90,7 @@ public class ViewerInputService {
}
if (provdier == null) {
fPendingUpdate.setInputElement(source);
- fPendingUpdate.done();
+ fPendingUpdate.done();
} else {
provdier.update(fPendingUpdate);
}
@@ -100,9 +100,9 @@ public class ViewerInputService {
* Disposes this viewer input service, canceling any pending jobs.
*/
public synchronized void dispose() {
- if (fPendingUpdate != null) {
- fPendingUpdate.cancel();
- fPendingUpdate = null;
- }
+ if (fPendingUpdate != null) {
+ fPendingUpdate.cancel();
+ fPendingUpdate = null;
+ }
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualItem.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualItem.java
index 0c817a971..0115e8b0a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualItem.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualItem.java
@@ -31,534 +31,534 @@ import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
*/
public class VirtualItem {
- // Data keys for display attributes of an item.
- public static String LABEL_KEY = "LABEL_KEY"; //$NON-NLS-1$
- public static String IMAGE_KEY = "IMAGE_KEY"; //$NON-NLS-1$
- public static String FONT_KEY = "FONT_KEY"; //$NON-NLS-1$
- public static String FOREGROUND_KEY = "FOREGROUND_KEY"; //$NON-NLS-1$
- public static String BACKGROUND_KEY = "BACKGROUND_KEY"; //$NON-NLS-1$
-
- public static String ELEMENT_DATA_KEY = "element"; //$NON-NLS-1$
-
- /**
- * Index object of a tree item. It allows the indexes to be modified
- * as items are inserted and removed.
- */
+ // Data keys for display attributes of an item.
+ public static String LABEL_KEY = "LABEL_KEY"; //$NON-NLS-1$
+ public static String IMAGE_KEY = "IMAGE_KEY"; //$NON-NLS-1$
+ public static String FONT_KEY = "FONT_KEY"; //$NON-NLS-1$
+ public static String FOREGROUND_KEY = "FOREGROUND_KEY"; //$NON-NLS-1$
+ public static String BACKGROUND_KEY = "BACKGROUND_KEY"; //$NON-NLS-1$
+
+ public static String ELEMENT_DATA_KEY = "element"; //$NON-NLS-1$
+
+ /**
+ * Index object of a tree item. It allows the indexes to be modified
+ * as items are inserted and removed.
+ */
public static class Index implements Comparable<Object> {
- private Integer fIndexValue;
+ private Integer fIndexValue;
- public Index(int index) {
- fIndexValue = Integer.valueOf(index);
- }
+ public Index(int index) {
+ fIndexValue = Integer.valueOf(index);
+ }
- @Override
+ @Override
public boolean equals(Object obj) {
- return obj instanceof Index && ((Index)obj).fIndexValue.equals(fIndexValue);
- }
+ return obj instanceof Index && ((Index)obj).fIndexValue.equals(fIndexValue);
+ }
- @Override
+ @Override
public int hashCode() {
- return fIndexValue.hashCode();
- }
+ return fIndexValue.hashCode();
+ }
- public void increment() {
- fIndexValue = Integer.valueOf(fIndexValue.intValue() + 1);
- }
+ public void increment() {
+ fIndexValue = Integer.valueOf(fIndexValue.intValue() + 1);
+ }
- public void decrement() {
- fIndexValue = Integer.valueOf(fIndexValue.intValue() - 1);
- }
+ public void decrement() {
+ fIndexValue = Integer.valueOf(fIndexValue.intValue() - 1);
+ }
- public int intValue() {
- return fIndexValue.intValue();
- }
+ public int intValue() {
+ return fIndexValue.intValue();
+ }
- @Override
+ @Override
public int compareTo(Object obj) {
- return obj instanceof Index ? fIndexValue.compareTo(((Index)obj).fIndexValue) : 0;
- }
+ return obj instanceof Index ? fIndexValue.compareTo(((Index)obj).fIndexValue) : 0;
+ }
- @Override
+ @Override
public String toString() {
- return fIndexValue.toString();
- }
- }
-
- /**
- * Parent items of this item.
- */
- final private VirtualItem fParent;
-
- /**
- * The index of this item.
- */
- final private Index fIndex;
-
- /**
- * Map of child items. The key to the map is the item's index, which
- * must be the same object instance as the index in the item. The tree map
- * keeps the items sorted while allowing indexes (keys) to be modified as
- * child items are inserted and removed.
- */
+ return fIndexValue.toString();
+ }
+ }
+
+ /**
+ * Parent items of this item.
+ */
+ final private VirtualItem fParent;
+
+ /**
+ * The index of this item.
+ */
+ final private Index fIndex;
+
+ /**
+ * Map of child items. The key to the map is the item's index, which
+ * must be the same object instance as the index in the item. The tree map
+ * keeps the items sorted while allowing indexes (keys) to be modified as
+ * child items are inserted and removed.
+ */
private Map<Index, VirtualItem> fItems = new TreeMap<>();
- /**
- * Flag indicating whether this item has child items.
- */
- private boolean fHasItems = false;
-
- /**
- * Indicates that this item has been expanded. It should only
- * be set to <code>true</code> if fHasItems is <code>true</code>.
- */
- private boolean fExpanded = false;
-
- /**
- * The count of child items. <code>-1</code> indicates that the count
- * is not known.
- */
- private int fItemCount = -1;
-
- /**
- * The data held by this item. It includes the element as well as the item
- * display attributes.
- */
+ /**
+ * Flag indicating whether this item has child items.
+ */
+ private boolean fHasItems = false;
+
+ /**
+ * Indicates that this item has been expanded. It should only
+ * be set to <code>true</code> if fHasItems is <code>true</code>.
+ */
+ private boolean fExpanded = false;
+
+ /**
+ * The count of child items. <code>-1</code> indicates that the count
+ * is not known.
+ */
+ private int fItemCount = -1;
+
+ /**
+ * The data held by this item. It includes the element as well as the item
+ * display attributes.
+ */
private Map<String, Object> fData = new HashMap<>(1);
- /**
- * Flag indicating that the item needs to have it's label updated.
- */
- private boolean fNeedsLabelUpdate = true;
-
- /**
- * Flag indicating that the item's count needs to be updated.
- */
- private boolean fNeedsCountUpdate = true;
-
- /**
- * Flag indicating that the item's element needs to be updated.
- */
- private boolean fNeedsDataUpdate = true;
-
- /**
- * Indicates that this item has been disposed.
- */
- private boolean fDisposed = false;
-
-
- /**
- * Virtual item constructor.
- * @param parent parent virtual item
- * @param index index of the item in the parent
- */
- public VirtualItem(VirtualItem parent, Index index) {
- fParent = parent;
- fIndex = index;
- }
-
- /**
- * Clears the child item at the given index.
- * @param index index of item to clear.
- */
- public void clear(Index index) {
- VirtualItem item = fItems.remove(index);
- if (item != null) {
- item.dispose();
- }
- }
-
- /**
- * Clears all child items.
- *
- * @since 3.9
- */
- public void clearAll() {
- fData.clear();
+ /**
+ * Flag indicating that the item needs to have it's label updated.
+ */
+ private boolean fNeedsLabelUpdate = true;
+
+ /**
+ * Flag indicating that the item's count needs to be updated.
+ */
+ private boolean fNeedsCountUpdate = true;
+
+ /**
+ * Flag indicating that the item's element needs to be updated.
+ */
+ private boolean fNeedsDataUpdate = true;
+
+ /**
+ * Indicates that this item has been disposed.
+ */
+ private boolean fDisposed = false;
+
+
+ /**
+ * Virtual item constructor.
+ * @param parent parent virtual item
+ * @param index index of the item in the parent
+ */
+ public VirtualItem(VirtualItem parent, Index index) {
+ fParent = parent;
+ fIndex = index;
+ }
+
+ /**
+ * Clears the child item at the given index.
+ * @param index index of item to clear.
+ */
+ public void clear(Index index) {
+ VirtualItem item = fItems.remove(index);
+ if (item != null) {
+ item.dispose();
+ }
+ }
+
+ /**
+ * Clears all child items.
+ *
+ * @since 3.9
+ */
+ public void clearAll() {
+ fData.clear();
for (VirtualItem item : fItems.values()) {
item.dispose();
- }
- fItems.clear();
- }
- /**
- * Returns the parent item.
- * @return parent item.
- */
- public VirtualItem getParent() {
- return fParent;
- }
-
- /**
- * @return Returns the index of this item.
- */
- public Index getIndex() {
- return fIndex;
- }
-
- /**
- * Finds the given item in the child items of this element.
- * @param element Data object of the item to be found.
- * @return Item if found, <code>null</code> if not.
- */
- public VirtualItem findItem(Object element) {
+ }
+ fItems.clear();
+ }
+ /**
+ * Returns the parent item.
+ * @return parent item.
+ */
+ public VirtualItem getParent() {
+ return fParent;
+ }
+
+ /**
+ * @return Returns the index of this item.
+ */
+ public Index getIndex() {
+ return fIndex;
+ }
+
+ /**
+ * Finds the given item in the child items of this element.
+ * @param element Data object of the item to be found.
+ * @return Item if found, <code>null</code> if not.
+ */
+ public VirtualItem findItem(Object element) {
for (VirtualItem item : fItems.values()) {
Object nextData = item.getData();
- if ( (element != null && element.equals(nextData)) || (element == null && nextData == null) ) {
+ if ( (element != null && element.equals(nextData)) || (element == null && nextData == null) ) {
return item;
- }
- }
- return null;
- }
-
- /**
- * @return Returns whether the data element of this item is stale.
- */
- public boolean needsDataUpdate() {
- return fNeedsDataUpdate;
- }
-
- /**
- * Marks the item as having a stale data item.
- */
- public void setNeedsDataUpdate() {
- fNeedsDataUpdate = true;
- }
-
- /**
- * Clears the stale status of the item's data element.
- */
- public void clearNeedsDataUpdate() {
- fNeedsDataUpdate = false;
- }
-
- /**
- * @return Returns whether the item has stale item count.
- */
- public boolean needsCountUpdate() {
- return fNeedsCountUpdate;
- }
-
- /**
- * Marks the item as having a stale child count.
- */
- public void setNeedsCountUpdate() {
- fNeedsCountUpdate = true;
- fItemCount = -1;
- }
-
- /**
- * Clears the stale status of the item's child count.
- */
- public void clearNeedsCountUpdate() {
- fNeedsCountUpdate = false;
- }
-
- /**
- * @return Returns whether the item has stale label.
- */
- public boolean needsLabelUpdate() {
- return fNeedsLabelUpdate;
- }
-
- /**
- * Marks the item as having a stale label data.
- */
- public void setNeedsLabelUpdate() {
- fNeedsLabelUpdate = true;
- }
-
- /**
- * Clears the stale status of the item's label.
- */
- public void clearNeedsLabelUpdate() {
- fNeedsLabelUpdate = false;
- }
-
- /**
- * @return Returns whether the item has been disposed.
- */
- public boolean isDisposed() {
- return fDisposed;
- }
-
- /**
- * Disposes the item.
- */
- public void dispose() {
- clearAll();
-
- fDisposed = true;
- findTree().fireItemDisposed(this);
- }
-
- /**
- * @param key Key to retrieve data for.
- * @return Returns item data corresponding to given key.
- */
- public Object getData (String key) {
- return fData.get(key);
- }
-
- /**
- * Sets given data element for given key.
- * @param key Key for data.
- * @param data Data value.
- */
- public void setData(String key, Object data) {
- fData.put(key, data);
- }
-
- /**
- * Sets the item's data element.
- * @param data Item's new element.
- */
- public void setData(Object data) {
- fData.put(ELEMENT_DATA_KEY, data);
- }
-
- /**
- * @return Returns item's data element.
- */
- public Object getData () {
- return fData.get(ELEMENT_DATA_KEY);
- }
-
- /**
- * Marks the given item as expanded or collapsed.
- * @param expanded If true, item will be marked as expanded.
- */
- public void setExpanded(boolean expanded) {
- if (fExpanded == expanded) {
- return;
- }
- fExpanded = expanded;
-
- if (fExpanded && getItemCount() == -1) {
- setNeedsCountUpdate();
- }
-
-
- Assert.isTrue(!fExpanded || hasItems());
-
- // If collapsed, make sure that all the children are collapsed as well.
- if (!fExpanded) {
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return Returns whether the data element of this item is stale.
+ */
+ public boolean needsDataUpdate() {
+ return fNeedsDataUpdate;
+ }
+
+ /**
+ * Marks the item as having a stale data item.
+ */
+ public void setNeedsDataUpdate() {
+ fNeedsDataUpdate = true;
+ }
+
+ /**
+ * Clears the stale status of the item's data element.
+ */
+ public void clearNeedsDataUpdate() {
+ fNeedsDataUpdate = false;
+ }
+
+ /**
+ * @return Returns whether the item has stale item count.
+ */
+ public boolean needsCountUpdate() {
+ return fNeedsCountUpdate;
+ }
+
+ /**
+ * Marks the item as having a stale child count.
+ */
+ public void setNeedsCountUpdate() {
+ fNeedsCountUpdate = true;
+ fItemCount = -1;
+ }
+
+ /**
+ * Clears the stale status of the item's child count.
+ */
+ public void clearNeedsCountUpdate() {
+ fNeedsCountUpdate = false;
+ }
+
+ /**
+ * @return Returns whether the item has stale label.
+ */
+ public boolean needsLabelUpdate() {
+ return fNeedsLabelUpdate;
+ }
+
+ /**
+ * Marks the item as having a stale label data.
+ */
+ public void setNeedsLabelUpdate() {
+ fNeedsLabelUpdate = true;
+ }
+
+ /**
+ * Clears the stale status of the item's label.
+ */
+ public void clearNeedsLabelUpdate() {
+ fNeedsLabelUpdate = false;
+ }
+
+ /**
+ * @return Returns whether the item has been disposed.
+ */
+ public boolean isDisposed() {
+ return fDisposed;
+ }
+
+ /**
+ * Disposes the item.
+ */
+ public void dispose() {
+ clearAll();
+
+ fDisposed = true;
+ findTree().fireItemDisposed(this);
+ }
+
+ /**
+ * @param key Key to retrieve data for.
+ * @return Returns item data corresponding to given key.
+ */
+ public Object getData (String key) {
+ return fData.get(key);
+ }
+
+ /**
+ * Sets given data element for given key.
+ * @param key Key for data.
+ * @param data Data value.
+ */
+ public void setData(String key, Object data) {
+ fData.put(key, data);
+ }
+
+ /**
+ * Sets the item's data element.
+ * @param data Item's new element.
+ */
+ public void setData(Object data) {
+ fData.put(ELEMENT_DATA_KEY, data);
+ }
+
+ /**
+ * @return Returns item's data element.
+ */
+ public Object getData () {
+ return fData.get(ELEMENT_DATA_KEY);
+ }
+
+ /**
+ * Marks the given item as expanded or collapsed.
+ * @param expanded If true, item will be marked as expanded.
+ */
+ public void setExpanded(boolean expanded) {
+ if (fExpanded == expanded) {
+ return;
+ }
+ fExpanded = expanded;
+
+ if (fExpanded && getItemCount() == -1) {
+ setNeedsCountUpdate();
+ }
+
+
+ Assert.isTrue(!fExpanded || hasItems());
+
+ // If collapsed, make sure that all the children are collapsed as well.
+ if (!fExpanded) {
for (VirtualItem item : fItems.values()) {
item.setExpanded(expanded);
- }
- }
- }
-
- /**
- * @return Returns item's expanded state.
- */
- public boolean getExpanded() {
- return fExpanded;
- }
-
- /**
- * Sets the flag indicating whether item has child items.
- * @param hasChildren Set to true if child has items.
- */
- public void setHasItems(boolean hasChildren) {
- fHasItems = hasChildren;
- if (!fHasItems) {
- if (getItemCount() != 0) {
- setItemCount(0);
- }
- } else if (getItemCount() == 0) {
- setItemCount(-1);
- }
- }
-
- /**
- * @return Returns true if item has child items.
- */
- public boolean hasItems() {
- return fHasItems;
- }
-
- /**
- * Sets the item's child count.
- * @param count Child count.
- */
- public void setItemCount(int count) {
- fItemCount = count;
+ }
+ }
+ }
+
+ /**
+ * @return Returns item's expanded state.
+ */
+ public boolean getExpanded() {
+ return fExpanded;
+ }
+
+ /**
+ * Sets the flag indicating whether item has child items.
+ * @param hasChildren Set to true if child has items.
+ */
+ public void setHasItems(boolean hasChildren) {
+ fHasItems = hasChildren;
+ if (!fHasItems) {
+ if (getItemCount() != 0) {
+ setItemCount(0);
+ }
+ } else if (getItemCount() == 0) {
+ setItemCount(-1);
+ }
+ }
+
+ /**
+ * @return Returns true if item has child items.
+ */
+ public boolean hasItems() {
+ return fHasItems;
+ }
+
+ /**
+ * Sets the item's child count.
+ * @param count Child count.
+ */
+ public void setItemCount(int count) {
+ fItemCount = count;
for (Iterator<Entry<Index, VirtualItem>> itr = fItems.entrySet().iterator(); itr.hasNext();) {
Entry<Index, VirtualItem> entry = itr.next();
- int index = entry.getKey().intValue();
- if (index >= count) {
- VirtualItem item = entry.getValue();
- item.dispose();
- itr.remove();
- }
- }
- if (fItemCount == 0) {
- if (hasItems()) {
- setHasItems(false);
- }
- if (getExpanded()) {
- setExpanded(false);
- }
- } else {
- if (!hasItems()) {
- setHasItems(true);
- }
- }
- }
-
- /**
- * @return Returns item's child count.
- */
- public int getItemCount() {
- return fItemCount;
- }
-
- /**
- * Returns the child item at given index. Child item is created if needed.
- *
- * @param index Index of the child item.
- * @return Child item.
- */
- public VirtualItem getItem(Index index) {
- ensureItems();
-
- VirtualItem item = fItems.get(index);
- if (item == null) {
- item = new VirtualItem(this, index);
- fItems.put(index, item);
- }
- return item;
- }
-
- /**
- * @return Returns true if any of the child items need a data update.
- */
- public boolean childrenNeedDataUpdate() {
- if (getItemCount() == 0) {
- return false;
- }
- if (fItems == null || fItems.size() != fItemCount) {
- return true;
- }
+ int index = entry.getKey().intValue();
+ if (index >= count) {
+ VirtualItem item = entry.getValue();
+ item.dispose();
+ itr.remove();
+ }
+ }
+ if (fItemCount == 0) {
+ if (hasItems()) {
+ setHasItems(false);
+ }
+ if (getExpanded()) {
+ setExpanded(false);
+ }
+ } else {
+ if (!hasItems()) {
+ setHasItems(true);
+ }
+ }
+ }
+
+ /**
+ * @return Returns item's child count.
+ */
+ public int getItemCount() {
+ return fItemCount;
+ }
+
+ /**
+ * Returns the child item at given index. Child item is created if needed.
+ *
+ * @param index Index of the child item.
+ * @return Child item.
+ */
+ public VirtualItem getItem(Index index) {
+ ensureItems();
+
+ VirtualItem item = fItems.get(index);
+ if (item == null) {
+ item = new VirtualItem(this, index);
+ fItems.put(index, item);
+ }
+ return item;
+ }
+
+ /**
+ * @return Returns true if any of the child items need a data update.
+ */
+ public boolean childrenNeedDataUpdate() {
+ if (getItemCount() == 0) {
+ return false;
+ }
+ if (fItems == null || fItems.size() != fItemCount) {
+ return true;
+ }
for (VirtualItem child : fItems.values()) {
- if (child.needsDataUpdate()) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns an array of current child items. The returned array contains
- * only the items that have been created. It may not contain as many items as the
- * item count.
- *
- * @return Child items array.
- */
- public VirtualItem[] getItems() {
- return fItems.values().toArray(new VirtualItem[fItems.size()]);
- }
-
- /**
- * Adds a child item at the given index position.
- * @param position The index position to inser the new item at.
- * @return Returns the added item.
- */
- public VirtualItem addItem(int position) {
- if (!fHasItems) {
- fHasItems = true;
- }
- if (fItemCount < 0) {
- fItemCount = 0;
- }
-
- // Increment all items with an index higher than the given position.
- fItemCount++;
- ensureItems();
+ if (child.needsDataUpdate()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns an array of current child items. The returned array contains
+ * only the items that have been created. It may not contain as many items as the
+ * item count.
+ *
+ * @return Child items array.
+ */
+ public VirtualItem[] getItems() {
+ return fItems.values().toArray(new VirtualItem[fItems.size()]);
+ }
+
+ /**
+ * Adds a child item at the given index position.
+ * @param position The index position to inser the new item at.
+ * @return Returns the added item.
+ */
+ public VirtualItem addItem(int position) {
+ if (!fHasItems) {
+ fHasItems = true;
+ }
+ if (fItemCount < 0) {
+ fItemCount = 0;
+ }
+
+ // Increment all items with an index higher than the given position.
+ fItemCount++;
+ ensureItems();
for (Index childIndex : fItems.keySet()) {
- if (childIndex.intValue() >= position) {
- childIndex.increment();
- }
- }
-
- // Note: the same index object used to create the item has to
- // be used as the key into the map.
- Index childIndex = new Index(position);
- VirtualItem newChild = new VirtualItem(this, childIndex);
- fItems.put(childIndex, newChild);
- return newChild;
- }
-
- /**
- * Removes the item at the given index.
- * @param position Index of the item to remove.
- */
- public void remove(Index position) {
- fItemCount--;
- if (fItemCount < 0) {
- fHasItems = false;
- }
-
- ensureItems();
-
- VirtualItem removedItem = null;
+ if (childIndex.intValue() >= position) {
+ childIndex.increment();
+ }
+ }
+
+ // Note: the same index object used to create the item has to
+ // be used as the key into the map.
+ Index childIndex = new Index(position);
+ VirtualItem newChild = new VirtualItem(this, childIndex);
+ fItems.put(childIndex, newChild);
+ return newChild;
+ }
+
+ /**
+ * Removes the item at the given index.
+ * @param position Index of the item to remove.
+ */
+ public void remove(Index position) {
+ fItemCount--;
+ if (fItemCount < 0) {
+ fHasItems = false;
+ }
+
+ ensureItems();
+
+ VirtualItem removedItem = null;
for (Iterator<Entry<Index, VirtualItem>> itr = fItems.entrySet().iterator(); itr.hasNext();) {
Entry<Index, VirtualItem> entry = itr.next();
- Index childIndex = entry.getKey();
- if (childIndex.intValue() > position.intValue()) {
- childIndex.decrement();
- } else if (childIndex.intValue() == position.intValue()) {
- removedItem = entry.getValue();
- removedItem.dispose();
- itr.remove();
- }
- }
- }
-
- private void ensureItems() {
- if (fItems == null) {
+ Index childIndex = entry.getKey();
+ if (childIndex.intValue() > position.intValue()) {
+ childIndex.decrement();
+ } else if (childIndex.intValue() == position.intValue()) {
+ removedItem = entry.getValue();
+ removedItem.dispose();
+ itr.remove();
+ }
+ }
+ }
+
+ private void ensureItems() {
+ if (fItems == null) {
fItems = new HashMap<>(Math.max(1, Math.min(fItemCount, 16)));
- }
- }
-
- private VirtualTree findTree() {
- VirtualItem item = this;
- while (!(item instanceof VirtualTree)) {
- item = item.fParent;
- }
- return (VirtualTree)item;
- }
-
- @Override
+ }
+ }
+
+ private VirtualTree findTree() {
+ VirtualItem item = this;
+ while (!(item instanceof VirtualTree)) {
+ item = item.fParent;
+ }
+ return (VirtualTree)item;
+ }
+
+ @Override
public String toString() {
- StringBuffer buffer = new StringBuffer();
- toStringItem(buffer, IInternalDebugCoreConstants.EMPTY_STRING);
- return buffer.toString();
- }
-
- void toStringItem(StringBuffer buffer, String indent) {
- buffer.append(indent);
- buffer.append(toStringElement());
- buffer.append("\n"); //$NON-NLS-1$
- indent = indent + " "; //$NON-NLS-1$
- for (int i = 0; i < fItemCount; i++) {
- VirtualItem item = fItems.get(new Index(i));
- if (item != null) {
- item.toStringItem(buffer, indent);
- } else {
- buffer.append("<no item>\n"); //$NON-NLS-1$
- }
- }
- }
-
- private String toStringElement() {
- String[] label = (String[])fData.get(LABEL_KEY);
- if (label != null && label.length != 0) {
- return label[0];
- }
- Object data = fData.get(ELEMENT_DATA_KEY);
- if (data != null) {
- return data.toString();
- }
- return "<no data>"; //$NON-NLS-1$
- }
+ StringBuffer buffer = new StringBuffer();
+ toStringItem(buffer, IInternalDebugCoreConstants.EMPTY_STRING);
+ return buffer.toString();
+ }
+
+ void toStringItem(StringBuffer buffer, String indent) {
+ buffer.append(indent);
+ buffer.append(toStringElement());
+ buffer.append("\n"); //$NON-NLS-1$
+ indent = indent + " "; //$NON-NLS-1$
+ for (int i = 0; i < fItemCount; i++) {
+ VirtualItem item = fItems.get(new Index(i));
+ if (item != null) {
+ item.toStringItem(buffer, indent);
+ } else {
+ buffer.append("<no item>\n"); //$NON-NLS-1$
+ }
+ }
+ }
+
+ private String toStringElement() {
+ String[] label = (String[])fData.get(LABEL_KEY);
+ if (label != null && label.length != 0) {
+ return label[0];
+ }
+ Object data = fData.get(ELEMENT_DATA_KEY);
+ if (data != null) {
+ return data.toString();
+ }
+ return "<no data>"; //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTree.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTree.java
index 6eca256f3..3395b071e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTree.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTree.java
@@ -29,193 +29,193 @@ import org.eclipse.swt.SWT;
*/
public class VirtualTree extends VirtualItem {
- /**
- * Lazy virtual tree does not retrieve elements or labels,
- * except for the selected elements.
- */
- private boolean fLazy;
+ /**
+ * Lazy virtual tree does not retrieve elements or labels,
+ * except for the selected elements.
+ */
+ private boolean fLazy;
- private IVirtualItemValidator fValidator;
+ private IVirtualItemValidator fValidator;
- private class SelectedItemValidator implements IVirtualItemValidator {
- @Override
+ private class SelectedItemValidator implements IVirtualItemValidator {
+ @Override
public boolean isItemVisible(VirtualItem item) {
- // visible items. For now only mark the selected items as visible.
- for (int i = 0; i < fSelection.length; i++) {
- VirtualItem selectionItem = fSelection[i];
- while (selectionItem != null) {
- if (item.equals(selectionItem)) {
- return true;
- }
- selectionItem = selectionItem.getParent();
- }
- }
- return false;
- }
-
- @Override
+ // visible items. For now only mark the selected items as visible.
+ for (int i = 0; i < fSelection.length; i++) {
+ VirtualItem selectionItem = fSelection[i];
+ while (selectionItem != null) {
+ if (item.equals(selectionItem)) {
+ return true;
+ }
+ selectionItem = selectionItem.getParent();
+ }
+ }
+ return false;
+ }
+
+ @Override
public void showItem(VirtualItem item) {
- }
- }
+ }
+ }
- /**
- * Set of listeners of the virtual tree.
- */
+ /**
+ * Set of listeners of the virtual tree.
+ */
private Set<IVirtualItemListener> fVirtualItemListeners = new HashSet<>(1);
- /**
- * The currently selected items. This array contains only
- * the leaf items which are selected.
- */
- private VirtualItem[] fSelection = new VirtualItem[0];
-
- /**
- * Constructs the virtual tree with the given style and validator.
- *
- * @param style The style flag. Only SWT.VIRTUAL flag is used.
- * @param validator Item validator used to determine item visibility.
- */
- public VirtualTree(int style, IVirtualItemValidator validator) {
- super(null, new VirtualItem.Index(0));
- fLazy = (style & SWT.VIRTUAL) != 0;
- if (fLazy && validator == null) {
- fValidator = new SelectedItemValidator();
- } else {
- fValidator = validator;
- }
- clearNeedsLabelUpdate();
- clearNeedsDataUpdate();
- }
-
- /**
- * Disposes the virtual tree.
- */
- @Override
+ /**
+ * The currently selected items. This array contains only
+ * the leaf items which are selected.
+ */
+ private VirtualItem[] fSelection = new VirtualItem[0];
+
+ /**
+ * Constructs the virtual tree with the given style and validator.
+ *
+ * @param style The style flag. Only SWT.VIRTUAL flag is used.
+ * @param validator Item validator used to determine item visibility.
+ */
+ public VirtualTree(int style, IVirtualItemValidator validator) {
+ super(null, new VirtualItem.Index(0));
+ fLazy = (style & SWT.VIRTUAL) != 0;
+ if (fLazy && validator == null) {
+ fValidator = new SelectedItemValidator();
+ } else {
+ fValidator = validator;
+ }
+ clearNeedsLabelUpdate();
+ clearNeedsDataUpdate();
+ }
+
+ /**
+ * Disposes the virtual tree.
+ */
+ @Override
public void dispose() {
- super.dispose();
- fVirtualItemListeners.clear();
- }
+ super.dispose();
+ fVirtualItemListeners.clear();
+ }
- @Override
+ @Override
public void setNeedsCountUpdate() {
- super.setNeedsCountUpdate();
- clearNeedsLabelUpdate();
- clearNeedsDataUpdate();
- }
+ super.setNeedsCountUpdate();
+ clearNeedsLabelUpdate();
+ clearNeedsDataUpdate();
+ }
- @Override
+ @Override
public void setNeedsLabelUpdate() {
- // no-op
- }
+ // no-op
+ }
- @Override
+ @Override
public void setData(String key, Object data) {
- super.setData(key, data);
- if (data == null) {
- clearNeedsDataUpdate();
- }
- }
-
- /**
- * Adds a listener for when virtual items are revealed in the view.
- * @param listener Listener to add to list of listeners.
- */
- public void addItemListener(IVirtualItemListener listener) {
- fVirtualItemListeners.add(listener);
- }
-
- public void removeItemListener(IVirtualItemListener listener) {
- fVirtualItemListeners.remove(listener);
- }
-
- public VirtualItem[] getSelection() {
- return fSelection;
- }
-
- public void setSelection(VirtualItem[] items) {
- fSelection = items;
- }
-
- public void showItem(VirtualItem item) {
- if (fValidator != null) {
- fValidator.showItem(item);
- }
- }
-
- public void fireItemDisposed(VirtualItem item) {
+ super.setData(key, data);
+ if (data == null) {
+ clearNeedsDataUpdate();
+ }
+ }
+
+ /**
+ * Adds a listener for when virtual items are revealed in the view.
+ * @param listener Listener to add to list of listeners.
+ */
+ public void addItemListener(IVirtualItemListener listener) {
+ fVirtualItemListeners.add(listener);
+ }
+
+ public void removeItemListener(IVirtualItemListener listener) {
+ fVirtualItemListeners.remove(listener);
+ }
+
+ public VirtualItem[] getSelection() {
+ return fSelection;
+ }
+
+ public void setSelection(VirtualItem[] items) {
+ fSelection = items;
+ }
+
+ public void showItem(VirtualItem item) {
+ if (fValidator != null) {
+ fValidator.showItem(item);
+ }
+ }
+
+ public void fireItemDisposed(VirtualItem item) {
for (IVirtualItemListener listener : fVirtualItemListeners) {
listener.disposed(item);
- }
- }
+ }
+ }
- public void fireItemRevealed(VirtualItem item) {
+ public void fireItemRevealed(VirtualItem item) {
for (IVirtualItemListener listener : fVirtualItemListeners) {
listener.revealed(item);
- }
- }
+ }
+ }
- @Override
+ @Override
public void setData(Object data) {
- super.setData(data);
- // The root item always has children as long as the input is non-null,
- // so that it should be expanded.
- setHasItems(data != null);
- }
+ super.setData(data);
+ // The root item always has children as long as the input is non-null,
+ // so that it should be expanded.
+ setHasItems(data != null);
+ }
- @Override
+ @Override
public void setHasItems(boolean hasChildren) {
- super.setHasItems(hasChildren);
- // The root item is always expanded as long as it has children.
- if (hasChildren) {
- setExpanded(true);
- }
- }
-
- /**
- * Returns whether the given item is considered visible by the tree as
- * determined by its virtual item validator.
- *
- * @param item Item to check.
- * @return true if items is vislble.
- * @see IVirtualItemValidator
- */
- public boolean isItemVisible(VirtualItem item) {
- if (fLazy) {
- return fValidator.isItemVisible(item);
- }
- return true;
- }
-
- /**
- * Validates the entire tree.
- */
- public void validate() {
- validate(VirtualTree.this);
- }
-
- /**
- * Validates the item and its children, identifying children which were
- * revealed and need to be updated.
- *
- * @param item The item which to validate.
- */
- public void validate(VirtualItem item) {
- if (item.needsDataUpdate()) {
- if (isItemVisible(item)) {
- fireItemRevealed(item);
- }
- } else if (item.getData() != null) {
- if ( item.needsLabelUpdate() || (item.needsCountUpdate() && item.hasItems() && item.getExpanded()) ) {
- if (isItemVisible(item)) {
- fireItemRevealed(item);
- }
- }
-
- if (item.getData() != null && item.getItemCount() > 0 && item.getExpanded()) {
- for (int i = 0; i < item.getItemCount(); i++) {
- validate(item.getItem(new Index(i)));
- }
- }
- }
- }
+ super.setHasItems(hasChildren);
+ // The root item is always expanded as long as it has children.
+ if (hasChildren) {
+ setExpanded(true);
+ }
+ }
+
+ /**
+ * Returns whether the given item is considered visible by the tree as
+ * determined by its virtual item validator.
+ *
+ * @param item Item to check.
+ * @return true if items is vislble.
+ * @see IVirtualItemValidator
+ */
+ public boolean isItemVisible(VirtualItem item) {
+ if (fLazy) {
+ return fValidator.isItemVisible(item);
+ }
+ return true;
+ }
+
+ /**
+ * Validates the entire tree.
+ */
+ public void validate() {
+ validate(VirtualTree.this);
+ }
+
+ /**
+ * Validates the item and its children, identifying children which were
+ * revealed and need to be updated.
+ *
+ * @param item The item which to validate.
+ */
+ public void validate(VirtualItem item) {
+ if (item.needsDataUpdate()) {
+ if (isItemVisible(item)) {
+ fireItemRevealed(item);
+ }
+ } else if (item.getData() != null) {
+ if ( item.needsLabelUpdate() || (item.needsCountUpdate() && item.hasItems() && item.getExpanded()) ) {
+ if (isItemVisible(item)) {
+ fireItemRevealed(item);
+ }
+ }
+
+ if (item.getData() != null && item.getItemCount() > 0 && item.getExpanded()) {
+ for (int i = 0; i < item.getItemCount(); i++) {
+ validate(item.getItem(new Index(i)));
+ }
+ }
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTreeModelViewer.java
index c822846f8..1913181ba 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTreeModelViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTreeModelViewer.java
@@ -39,187 +39,187 @@ import org.eclipse.ui.IMemento;
public class VirtualTreeModelViewer extends InternalVirtualTreeModelViewer {
- /**
- * Creates a virtual tree model viewer.
- * @param display Display used by the viewer to call the data providers
- * on the UI thread.
- * @param style Stlye flags.
- * @param context Viewer's presentation context.
- */
- public VirtualTreeModelViewer(Display display, int style, IPresentationContext context) {
- super(display, style, context, null);
- }
-
- /**
- * Creates a virtual tree model viewer.
- * @param display Display used by the viewer to call the data providers
- * on the UI thread.
- * @param style style flags.
- * @param context Viewer's presentation context.
- * @param validator Optional validator that is used to determine which items should be
- * considered visible when SWT.VIRTUAL style is used. If <code>null</code> then the
- * standard validator is used that updates only the selected items.
- *
- * @since 3.8
- */
- public VirtualTreeModelViewer(Display display, int style, IPresentationContext context, IVirtualItemValidator validator) {
- super(display, style, context, validator);
- }
-
- /**
- * Returns this viewer's presentation context.
- *
- * @return presentation context
- */
- @Override
+ /**
+ * Creates a virtual tree model viewer.
+ * @param display Display used by the viewer to call the data providers
+ * on the UI thread.
+ * @param style Stlye flags.
+ * @param context Viewer's presentation context.
+ */
+ public VirtualTreeModelViewer(Display display, int style, IPresentationContext context) {
+ super(display, style, context, null);
+ }
+
+ /**
+ * Creates a virtual tree model viewer.
+ * @param display Display used by the viewer to call the data providers
+ * on the UI thread.
+ * @param style style flags.
+ * @param context Viewer's presentation context.
+ * @param validator Optional validator that is used to determine which items should be
+ * considered visible when SWT.VIRTUAL style is used. If <code>null</code> then the
+ * standard validator is used that updates only the selected items.
+ *
+ * @since 3.8
+ */
+ public VirtualTreeModelViewer(Display display, int style, IPresentationContext context, IVirtualItemValidator validator) {
+ super(display, style, context, validator);
+ }
+
+ /**
+ * Returns this viewer's presentation context.
+ *
+ * @return presentation context
+ */
+ @Override
public IPresentationContext getPresentationContext() {
- return super.getPresentationContext();
- }
-
- /**
- * Registers the given listener for model delta notification.
- *
- * @param listener model delta listener
- */
- @Override
+ return super.getPresentationContext();
+ }
+
+ /**
+ * Registers the given listener for model delta notification.
+ *
+ * @param listener model delta listener
+ */
+ @Override
public void addModelChangedListener(IModelChangedListener listener) {
- super.addModelChangedListener(listener);
- }
-
- /**
- * Unregisters the given listener from model delta notification.
- *
- * @param listener model delta listener
- */
- @Override
+ super.addModelChangedListener(listener);
+ }
+
+ /**
+ * Unregisters the given listener from model delta notification.
+ *
+ * @param listener model delta listener
+ */
+ @Override
public void removeModelChangedListener(IModelChangedListener listener) {
- super.removeModelChangedListener(listener);
- }
-
- /**
- * Registers the specified listener for view update notifications.
- *
- * @param listener listener
- */
- @Override
+ super.removeModelChangedListener(listener);
+ }
+
+ /**
+ * Registers the specified listener for view update notifications.
+ *
+ * @param listener listener
+ */
+ @Override
public void addViewerUpdateListener(IViewerUpdateListener listener) {
- super.addViewerUpdateListener(listener);
- }
-
- /**
- * Removes the specified listener from update notifications.
- *
- * @param listener listener
- */
- @Override
+ super.addViewerUpdateListener(listener);
+ }
+
+ /**
+ * Removes the specified listener from update notifications.
+ *
+ * @param listener listener
+ */
+ @Override
public void removeViewerUpdateListener(IViewerUpdateListener listener) {
- super.removeViewerUpdateListener(listener);
- }
-
- /**
- * Returns whether columns can be toggled on/off for this viewer's current
- * input element.
- *
- * @return whether columns can be toggled on/off
- */
- @Override
+ super.removeViewerUpdateListener(listener);
+ }
+
+ /**
+ * Returns whether columns can be toggled on/off for this viewer's current
+ * input element.
+ *
+ * @return whether columns can be toggled on/off
+ */
+ @Override
public boolean canToggleColumns() {
- return super.canToggleColumns();
- }
-
- /**
- * Returns the current column presentation for this viewer, or <code>null</code>
- * if none.
- *
- * @return column presentation or <code>null</code>
- */
- @Override
+ return super.canToggleColumns();
+ }
+
+ /**
+ * Returns the current column presentation for this viewer, or <code>null</code>
+ * if none.
+ *
+ * @return column presentation or <code>null</code>
+ */
+ @Override
public IColumnPresentation getColumnPresentation() {
- return super.getColumnPresentation();
- }
-
- /**
- * Returns identifiers of the visible columns in this viewer, or <code>null</code>
- * if there are currently no columns.
- *
- * @return visible columns identifiers or <code>null</code>
- */
- @Override
+ return super.getColumnPresentation();
+ }
+
+ /**
+ * Returns identifiers of the visible columns in this viewer, or <code>null</code>
+ * if there are currently no columns.
+ *
+ * @return visible columns identifiers or <code>null</code>
+ */
+ @Override
public String[] getVisibleColumns() {
- return super.getVisibleColumns();
- }
-
- /**
- * Initializes viewer state from the memento
- *
- * @param memento the {@link IMemento} to read from
- */
- @Override
+ return super.getVisibleColumns();
+ }
+
+ /**
+ * Initializes viewer state from the memento
+ *
+ * @param memento the {@link IMemento} to read from
+ */
+ @Override
public void initState(IMemento memento) {
- super.initState(memento);
- }
-
- /**
- * Save viewer state into the given memento.
- *
- * @param memento the {@link IMemento} to save to
- */
- @Override
+ super.initState(memento);
+ }
+
+ /**
+ * Save viewer state into the given memento.
+ *
+ * @param memento the {@link IMemento} to save to
+ */
+ @Override
public void saveState(IMemento memento) {
- super.saveState(memento);
- }
+ super.saveState(memento);
+ }
- /**
- * @return Returns true if columns are being displayed currently.
- */
- @Override
+ /**
+ * @return Returns true if columns are being displayed currently.
+ */
+ @Override
public boolean isShowColumns() {
- return super.isShowColumns();
- }
-
- /**
- * Toggles columns on/off for the current column presentation, if any.
- *
- * @param show whether to show columns if the current input supports
- * columns
- */
- @Override
+ return super.isShowColumns();
+ }
+
+ /**
+ * Toggles columns on/off for the current column presentation, if any.
+ *
+ * @param show whether to show columns if the current input supports
+ * columns
+ */
+ @Override
public void setShowColumns(boolean show) {
- super.setShowColumns(show);
- }
-
- /**
- * Sets the visible columns for this viewer. Id's correspond to
- * column identifiers from a column presentation. Use <code>null</code>
- * or an empty collection to display default columns for the current
- * column presentation. Only affects the current column presentation.
- *
- * @param ids column identifiers or <code>null</code>
- */
- @Override
+ super.setShowColumns(show);
+ }
+
+ /**
+ * Sets the visible columns for this viewer. Id's correspond to
+ * column identifiers from a column presentation. Use <code>null</code>
+ * or an empty collection to display default columns for the current
+ * column presentation. Only affects the current column presentation.
+ *
+ * @param ids column identifiers or <code>null</code>
+ */
+ @Override
public void setVisibleColumns(String[] ids) {
- super.setVisibleColumns(ids);
- }
+ super.setVisibleColumns(ids);
+ }
- @Override
+ @Override
public void updateViewer(IModelDelta delta) {
- super.updateViewer(delta);
- }
+ super.updateViewer(delta);
+ }
- @Override
+ @Override
public ViewerLabel getElementLabel(TreePath path, String columnId) {
- return super.getElementLabel(path, columnId);
- }
+ return super.getElementLabel(path, columnId);
+ }
- @Override
+ @Override
public VirtualItem[] findItems(Object elementOrTreePath) {
- return super.findItems(elementOrTreePath);
- }
+ return super.findItems(elementOrTreePath);
+ }
- @Override
+ @Override
public VirtualItem findItem(TreePath path) {
- return super.findItem(path);
- }
+ return super.findItem(path);
+ }

Back to the top