aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/Bug138608Test.java')
-rw-r--r--tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/Bug138608Test.java48
1 files changed, 25 insertions, 23 deletions
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/Bug138608Test.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/Bug138608Test.java
index da40a0b..04ebdc0 100644
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/Bug138608Test.java
+++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/Bug138608Test.java
@@ -24,26 +24,27 @@ import org.eclipse.swt.widgets.Composite;
/**
* Description of the bug:
* Initially tree is populated by way shown below and is completely expanded.
- *
+ *
* root
* |-a
* |-c
* |-d
* |-b
* |-c
- *
+ *
* Then 'd' model element is added as child of 'b' in model and through
* add(parent,child) method of TreeViewer to tree.
- *
+ *
* The problem - It seems that calling add(parent,child) has no desired efect.
* 'd' model element is not shown as child of 'b'!
- *
+ *
* @since 3.2
- *
+ *
*/
public class Bug138608Test extends ViewerTestCase {
private TreeContentProvider contentProvider;
+ private TreeViewer<TreeNode<String>,TreeNode<String>> treeViewer;
/**
* @param name
@@ -53,12 +54,13 @@ public class Bug138608Test extends ViewerTestCase {
}
protected StructuredViewer createViewer(Composite parent) {
- final TreeViewer viewer = new TreeViewer(parent);
+ final TreeViewer<TreeNode<String>,TreeNode<String>> viewer = new TreeViewer<TreeNode<String>,TreeNode<String>>(parent);
viewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
contentProvider = new TreeContentProvider();
- LabelProvider labelProvider = new LabelProvider();
+ LabelProvider<TreeNode<String>> labelProvider = new LabelProvider<TreeNode<String>>();
viewer.setContentProvider(contentProvider);
viewer.setLabelProvider(labelProvider);
+ treeViewer = viewer;
return viewer;
}
@@ -75,8 +77,8 @@ public class Bug138608Test extends ViewerTestCase {
/**
* @return
*/
- private TreeViewer getTreeViewer() {
- return (TreeViewer) fViewer;
+ private TreeViewer<TreeNode<String>,TreeNode<String>> getTreeViewer() {
+ return treeViewer;
}
public void testBug138608() {
@@ -108,41 +110,41 @@ public class Bug138608Test extends ViewerTestCase {
super.tearDown();
}
- private static class TreeContentProvider implements ITreeContentProvider {
+ private static class TreeContentProvider implements ITreeContentProvider<TreeNode<String>,TreeNode<String>> {
- public TreeNode root = new TreeNode("root");
+ public TreeNode<String> root = new TreeNode<String>("root");
public TreeContentProvider() {
- TreeNode d = new TreeNode("d");
- TreeNode c = new TreeNode("c");
- TreeNode b = new TreeNode("b");
- TreeNode a = new TreeNode("a");
+ TreeNode<String> d = new TreeNode<String>("d");
+ TreeNode<String> c = new TreeNode<String>("c");
+ TreeNode<String> b = new TreeNode<String>("b");
+ TreeNode<String> a = new TreeNode<String>("a");
// build initial hierarchy
root.setChildren(new TreeNode[] { a, b });
a.setChildren(new TreeNode[] { c, d });
b.setChildren(new TreeNode[] { c });
}
- public Object[] getChildren(Object parentElement) {
- return ((TreeNode) parentElement).getChildren();
+ public TreeNode<String>[] getChildren(TreeNode<String> parentElement) {
+ return parentElement.getChildren();
}
- public Object getParent(Object element) {
- return ((TreeNode) element).getParent();
+ public TreeNode<String> getParent(TreeNode<String> element) {
+ return element.getParent();
}
- public boolean hasChildren(Object element) {
- return ((TreeNode) element).hasChildren();
+ public boolean hasChildren(TreeNode<String> element) {
+ return element.hasChildren();
}
- public Object[] getElements(Object inputElement) {
+ public TreeNode<String>[] getElements(TreeNode<String> inputElement) {
return getChildren(inputElement);
}
public void dispose() {
}
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ public void inputChanged(Viewer<TreeNode<String>> viewer, TreeNode<String> oldInput, TreeNode<String> newInput) {
}
}