/** * Reverts the input for the tree back to the state when the adapter was created. * * <p>All of the frames are removed from the drill stack. Then the oldest frame is used to reset * the input and expansion state for the child tree. */ public void goHome() { Object currentInput = fChildTree.getInput(); DrillFrame oFrame = fDrillStack.goHome(); Object input = oFrame.getElement(); fChildTree.setInput(input); expand(oFrame.getExpansion()); // if there was a selection, it should have been preserved, // but if not, select the element that was last drilled into if (fChildTree.getSelection().isEmpty()) { fChildTree.setSelection(new StructuredSelection(currentInput), true); } updateNavigationButtons(); }
/** * Sets the input for the tree to a particular item in the tree. * * <p>The current input and expansion state are saved in a frame and added to the drill stack. * Then the input for the tree is changed to be <code>newInput</code>. The expansion state for the * tree is maintained during the operation. * * <p>On return the client may revert back to the previous state by invoking <code>goBack</code> * or <code>goHome</code>. * * @param newInput the new input element */ public void goInto(Object newInput) { // If we can drill .. if (canExpand(newInput)) { // Save the old state. Object oldInput = fChildTree.getInput(); List expandedList = getExpanded(); fDrillStack.add(new DrillFrame(oldInput, "null", expandedList)); // $NON-NLS-1$ // Install the new state. fChildTree.setInput(newInput); expand(expandedList); updateNavigationButtons(); } }
/** * Resets the drill down adapter. * * <p>This method is typically called when the input for the underlying view is reset by something * other than the adapter. On return the drill stack has been cleared and the navigation buttons * reflect the new state of the underlying viewer. */ public void reset() { fDrillStack.reset(); updateNavigationButtons(); }
/** * Returns whether "go home" is possible for child tree. This is only possible if the client has * performed one or more drilling operations. * * @return <code>true</code> if "go home" is possible; <code>false</code> otherwise */ public boolean canGoHome() { return fDrillStack.canGoHome(); }
/** * Returns whether "go back" is possible for child tree. This is only possible if the client has * performed one or more drilling operations. * * @return <code>true</code> if "go back" is possible; <code>false</code> otherwise */ public boolean canGoBack() { return fDrillStack.canGoBack(); }