moveToNext();
treeView.refresh();
}
public void moveToNext() {
TreeSelection selection = (TreeSelection) treeView.getSelection();
AnnotationCheckTreeNode firstElement = (AnnotationCheckTreeNode) selection.getFirstElement();
if (firstElement == null) {
return;
}
IAnnotationCheckTreeNode parent = firstElement.getParent();
AnnotationCheckTreeNode[] children = parent.getChildren();
List<AnnotationCheckTreeNode> list = Arrays.asList(children);
int indexOf = list.indexOf(firstElement);
IAnnotationCheckTreeNode brother = null;
IAnnotationCheckTreeNode uncle = parent;
if (list == null || list.isEmpty()) {
} else if (indexOf == -1) {
brother = list.get(0);
} else if (firstElement.getElement() instanceof CheckDocument && indexOf < list.size() - 1) {
uncle = list.get(indexOf + 1);
if (uncle.getChildren().length > 0) {
brother = uncle.getChildren()[0];
}
} else if (indexOf < list.size() - 1) {
brother = list.get(indexOf + 1);
} else if (firstElement.getElement() instanceof CheckAnnotation) {
brother = null;
AnnotationCheckTreeNode[] children2 = parent.getParent().getChildren();
List<AnnotationCheckTreeNode> list2 = Arrays.asList(children2);
int indexOf2 = list2.indexOf(parent);
if (list2 == null || list2.isEmpty()) {
} else if (indexOf2 == -1) {
uncle = list2.get(0);
} else if (indexOf2 < list2.size() - 1) {
uncle = list2.get(indexOf2 + 1);
if (uncle.getChildren().length != 0) {
brother = uncle.getChildren()[0];
}
}
}
TreePath treePath = null;
if (brother == null) {
treePath = new TreePath(new Object[] { treeView.getInput(), uncle });
} else {
treePath = new TreePath(new Object[] { treeView.getInput(), uncle, brother });
}
final TreeSelection newSelection = new TreeSelection(treePath);
treeView.setSelection(newSelection, true);
if (firstElement.getElement() instanceof CheckAnnotation) {
boolean allChecked = true;
boolean oneKeep = false;