Exemplo n.º 1
0
 public void setChecked(
     final CheckboxTreeViewer checkboxTreeViewer, final Collection<IErlModule> modules) {
   final Control tree = checkboxTreeViewer.getControl();
   tree.setRedraw(false);
   try {
     doSetChecked(checkboxTreeViewer, modules);
   } finally {
     tree.setRedraw(true);
   }
 }
  /** Updates the outline page. */
  public void update() {
    TreeViewer viewer = getTreeViewer();

    if (viewer != null) {
      Control control = viewer.getControl();
      if (control != null && !control.isDisposed()) {
        control.setRedraw(false);
        viewer.setInput(fInput);
        control.setRedraw(true);
      }
    }
  }
 /**
  * Sets which elements are grayed in this viewer's tree. The given list contains the elements that
  * are to be grayed; all other elements are to be ungrayed.
  *
  * <p>This method is typically used when restoring the interesting state of a viewer captured by
  * an earlier call to <code>getGrayedElements</code>.
  *
  * @param elements the array of grayed elements
  * @see #getGrayedElements
  */
 public void setGrayedElements(Object[] elements) {
   assertElementsNotNull(elements);
   CustomHashtable grayedElements = newHashtable(elements.length * 2 + 1);
   for (int i = 0; i < elements.length; ++i) {
     Object element = elements[i];
     // Ensure item exists for element
     internalExpand(element, false);
     grayedElements.put(element, element);
   }
   Control tree = getControl();
   tree.setRedraw(false);
   internalSetGrayed(grayedElements, tree);
   tree.setRedraw(true);
 }
Exemplo n.º 4
0
  public void update(OutlineNode input) {
    this.input = input;

    TreeViewer viewer = getTreeViewer();
    if (viewer != null) {

      Control control = viewer.getControl();
      if (control != null && !control.isDisposed()) {
        control.setRedraw(false);
        // save viewer state
        // ISelection selection = viewer.getSelection();
        viewer.getTree().deselectAll();

        Object[] expandedElements = viewer.getExpandedElements();

        /*
         * ArrayList oldNodes = new ArrayList(expandedElements.length);
         * for (int i = 0; i < expandedElements.length; i++) {
         * oldNodes.add(expandedElements[i]); }
         */

        // set new input
        viewer.setInput(input);

        // restore viewer state
        viewer.setExpandedElements(expandedElements);

        /*
         * ArrayList newNodes = new ArrayList(); OutlineNode newNode;
         * for (Iterator iter = this.input.getRootNodes().iterator();
         * iter.hasNext();) { newNode = (OutlineNode)iter.next();
         * restoreExpandState(newNode, oldNodes, newNodes); }
         */
        control.setRedraw(true);
      }
    }
  }