aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Still2013-08-02 05:33:32 (EDT)
committerGerrit Code Review @ Eclipse.org2013-08-12 13:20:58 (EDT)
commit271b294d172cbd37cc253d4b2b1884b6e449ed38 (patch)
tree3e5e444d0f979503e8153e3c159b40c32ce588dc
parent25a15c42431b76ae264e67836e07056d99b46c53 (diff)
downloadeclipse.platform.ui-271b294d172cbd37cc253d4b2b1884b6e449ed38.zip
eclipse.platform.ui-271b294d172cbd37cc253d4b2b1884b6e449ed38.tar.gz
eclipse.platform.ui-271b294d172cbd37cc253d4b2b1884b6e449ed38.tar.bz2
Bug 414356 - [Viewers] Add generics to the ListViewerrefs/changes/22/15122/2
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)