List of usage examples for org.eclipse.jface.viewers TreeNodeContentProvider getElements
@Override
public Object[] getElements(final Object inputElement)
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;/* www . j ava2s.c om*/ 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;/*from w ww. j a v a 2s . c om*/ 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(); }