package net.sourceforge.phpeclipse.phpeditor;

/**********************************************************************
Copyright (c) 2000, 2002 IBM Corp. and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Common Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/cpl-v10.html

Contributors:
    IBM Corporation - Initial implementation
    Klaus Hartlage - www.eclipseproject.de
**********************************************************************/

import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.views.contentoutline.ContentOutlinePage;

/**
 * An abstraction of a content outline page 
 */
public abstract class AbstractContentOutlinePage extends ContentOutlinePage {
  
  protected Object fInput;
  /**
   * Sets the input of the outline page
   */
  public void setInput(Object input) {
    fInput = input;
    update();
  }

  /**
   * 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);
        viewer.expandAll();
        control.setRedraw(true);
      }
    }
  }
  

}