aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Still2013-08-02 05:33:32 (EDT)
committerJohn Arthorne2013-09-04 09:58:33 (EDT)
commitd7e45a3406a034ac1f83e094b4c2d5e8b9c50594 (patch)
treeaab6757d608182ef7218f10dbb4f7a18ff968707
parent6d9bc3ca322eb39f837b2e629b86df70f3866c5b (diff)
downloadeclipse.platform.ui-d7e45a3406a034ac1f83e094b4c2d5e8b9c50594.zip
eclipse.platform.ui-d7e45a3406a034ac1f83e094b4c2d5e8b9c50594.tar.gz
eclipse.platform.ui-d7e45a3406a034ac1f83e094b4c2d5e8b9c50594.tar.bz2
Bug 414356 - [Viewers] Add generics to the ListViewer
Generics are added to the ListViewer to provide a type safty use of this viewer This change depends on the changes from https://git.eclipse.org/r/#/c/14941/ Change-Id: Ie9a8681ac99bc08303adf790a3902e9b3f945ce7 Signed-off-by: Hendrik Still <hendrik.still@gammas.de>
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ListViewer.java10
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredViewer.java2
2 files changed, 7 insertions, 5 deletions
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ListViewer.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ListViewer.java
index ac1ff67..ee6d3b1 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ListViewer.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ListViewer.java
@@ -32,11 +32,13 @@ import org.eclipse.swt.widgets.Control;
* Note that the SWT <code>List</code> control only supports the display of strings, not icons.
* If you need to show icons for items, use <code>TableViewer</code> instead.
* </p>
+ * @param <E> Type of an element of the model
+ * @param <I> Type of the input
*
* @see TableViewer
* @noextend This class is not intended to be subclassed by clients.
*/
-public class ListViewer extends AbstractListViewer {
+public class ListViewer<E,I> extends AbstractListViewer<E,I> {
/**
* This viewer's list control.
@@ -102,7 +104,7 @@ public class ListViewer extends AbstractListViewer {
* Method defined on StructuredViewer.
*/
@Override
- public void reveal(Object element) {
+ public void reveal(E element) {
Assert.isNotNull(element);
int index = getElementIndex(element);
if (index == -1) {
@@ -227,7 +229,7 @@ public class ListViewer extends AbstractListViewer {
* @see org.eclipse.jface.viewers.AbstractListViewer#setSelectionToWidget(java.util.List, boolean)
*/
@Override
- protected void setSelectionToWidget(List in, boolean reveal) {
+ protected void setSelectionToWidget(List<E> in, boolean reveal) {
if( reveal ) {
super.setSelectionToWidget(in, reveal);
} else {
@@ -238,7 +240,7 @@ public class ListViewer extends AbstractListViewer {
int[] ixs = new int[n];
int count = 0;
for (int i = 0; i < n; ++i) {
- Object el = in.get(i);
+ E el = in.get(i);
int ix = getElementIndex(el);
if (ix >= 0) {
ixs[count++] = ix;
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredViewer.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredViewer.java
index 0dd7145..b515481 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredViewer.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredViewer.java
@@ -1673,7 +1673,7 @@ public abstract class StructuredViewer<E,I> extends ContentViewer<E,I> implement
* @param element
* the element to reveal
*/
- public abstract void reveal(Object element);
+ public abstract void reveal(E element);
/*
* (non-Javadoc)