Example usage for org.eclipse.jface.viewers TreeNodeContentProvider getChildren

List of usage examples for org.eclipse.jface.viewers TreeNodeContentProvider getChildren

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers TreeNodeContentProvider getChildren.

Prototype

@Override
    public Object[] getChildren(final Object parentElement) 

Source Link

Usage

From source file:lost.tok.linkDisView.LinkDisView.java

License:Open Source License

public void next() {
    Object input = viewer.getInput();

    IContentProvider contentProvider = viewer.getContentProvider();
    if (!(contentProvider instanceof TreeNodeContentProvider))
        return;/*w w  w. j  ava  2 s .  c o m*/

    TreeNodeContentProvider tcp = (TreeNodeContentProvider) contentProvider;

    Object[] d = tcp.getElements(input);
    if (d == null || d.length == 0)
        return;

    if (lastDiscussion == null || lastDiscussionIndex >= d.length || d[lastDiscussionIndex] != lastDiscussion) {
        lastDiscussionIndex = 0;
        lastDiscussion = d[lastDiscussionIndex];
    }

    Object[] e = tcp.getChildren(lastDiscussion);
    if (lastExcerption == null || lastExcerptionIndex >= e.length || e[lastExcerptionIndex] != lastExcerption)
        lastExcerptionIndex = -1;

    lastExcerptionIndex++;
    if (lastExcerptionIndex >= e.length) {
        lastDiscussionIndex = (lastDiscussionIndex + 1) % d.length;
        lastDiscussion = d[lastDiscussionIndex];
        e = tcp.getChildren(lastDiscussion);

        lastExcerptionIndex = 0;
    }
    lastExcerption = e[lastExcerptionIndex];
    setCurrentExcerption();
}

From source file:lost.tok.linkDisView.LinkDisView.java

License:Open Source License

public void prev() {
    Object input = viewer.getInput();

    IContentProvider contentProvider = viewer.getContentProvider();
    if (!(contentProvider instanceof TreeNodeContentProvider))
        return;/*  www. j  a  v a 2s .  c o  m*/

    TreeNodeContentProvider tcp = (TreeNodeContentProvider) contentProvider;

    Object[] d = tcp.getElements(input);
    if (d == null || d.length == 0)
        return;

    if (lastDiscussion == null || lastDiscussionIndex >= d.length || d[lastDiscussionIndex] != lastDiscussion) {
        lastDiscussionIndex = d.length - 1;
        lastDiscussion = d[lastDiscussionIndex];
    }

    Object[] e = tcp.getChildren(lastDiscussion);
    if (lastExcerption == null || lastExcerptionIndex >= e.length || e[lastExcerptionIndex] != lastExcerption)
        lastExcerptionIndex = e.length;

    lastExcerptionIndex--;
    if (lastExcerptionIndex < 0) {
        lastDiscussionIndex = (lastDiscussionIndex - 1) % d.length;
        lastDiscussion = d[lastDiscussionIndex];
        e = tcp.getChildren(lastDiscussion);

        lastExcerptionIndex = e.length - 1;
    }
    lastExcerption = e[lastExcerptionIndex];
    setCurrentExcerption();
}