aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/Bug203657TreeViewerTest.java')
-rw-r--r--tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/Bug203657TreeViewerTest.java34
1 files changed, 19 insertions, 15 deletions
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/Bug203657TreeViewerTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/Bug203657TreeViewerTest.java
index b5cab34..dac528d 100644
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/Bug203657TreeViewerTest.java
+++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/Bug203657TreeViewerTest.java
@@ -32,10 +32,13 @@ import org.eclipse.swt.widgets.TreeColumn;
*
*/
public class Bug203657TreeViewerTest extends ViewerTestCase {
+
+ private TreeViewer<MyModel,MyModel> treeViewer;
+
public class MyModel {
public MyModel parent;
- public ArrayList child = new ArrayList();
+ public ArrayList<MyModel> child = new ArrayList<MyModel>();
public int counter;
@@ -64,37 +67,38 @@ public class Bug203657TreeViewerTest extends ViewerTestCase {
}
protected StructuredViewer createViewer(Composite parent) {
- final TreeViewer treeViewer = new TreeViewer(parent, SWT.FULL_SELECTION);
+ treeViewer = new TreeViewer<MyModel,MyModel>(parent, SWT.FULL_SELECTION);
- treeViewer.setContentProvider(new ITreeContentProvider() {
+ treeViewer.setContentProvider(new ITreeContentProvider<MyModel,MyModel>() {
- public Object[] getElements(Object inputElement) {
- return ((MyModel) inputElement).child.toArray();
+ public MyModel[] getElements(MyModel inputElement) {
+ MyModel[] children = new MyModel[inputElement.child.size()];
+ return inputElement.child.toArray(children);
}
public void dispose() {
}
- public void inputChanged(Viewer viewer, Object oldInput,
- Object newInput) {
+ public void inputChanged(Viewer<MyModel> viewer, MyModel oldInput,
+ MyModel newInput) {
}
- public Object[] getChildren(Object parentElement) {
+ public MyModel[] getChildren(MyModel parentElement) {
return getElements(parentElement);
}
- public Object getParent(Object element) {
+ public MyModel getParent(MyModel element) {
if (element == null) {
return null;
}
- return ((MyModel) element).parent;
+ return element.parent;
}
- public boolean hasChildren(Object element) {
- return ((MyModel) element).child.size() > 0;
+ public boolean hasChildren(MyModel element) {
+ return element.child.size() > 0;
}
});
@@ -141,15 +145,15 @@ public class Bug203657TreeViewerTest extends ViewerTestCase {
getTreeViewer().setInput(root);
}
- private TreeViewer getTreeViewer() {
- return (TreeViewer) fViewer;
+ private TreeViewer<MyModel,MyModel> getTreeViewer() {
+ return treeViewer;
}
public void testBug203657() {
try {
Field f = ColumnViewer.class.getDeclaredField("cell");
f.setAccessible(true);
- ViewerCell cell = (ViewerCell) f.get(getTreeViewer());
+ ViewerCell<MyModel> cell = (ViewerCell<MyModel>) f.get(getTreeViewer());
assertNull(cell.getElement());
assertNull(cell.getViewerRow());
assertEquals(0, cell.getColumnIndex());