726536a9c942d73b6fe15c32ffe312e701cbd6b2
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / AbstractContentOutlinePage.java
1 package net.sourceforge.phpeclipse.phpeditor;
2
3 /**********************************************************************
4 Copyright (c) 2000, 2002 IBM Corp. and others.
5 All rights reserved. This program and the accompanying materials
6 are made available under the terms of the Common Public License v1.0
7 which accompanies this distribution, and is available at
8 http://www.eclipse.org/legal/cpl-v10.html
9
10 Contributors:
11     IBM Corporation - Initial implementation
12     Klaus Hartlage - www.eclipseproject.de
13 **********************************************************************/
14
15 import org.eclipse.jface.viewers.TreeViewer;
16 import org.eclipse.swt.widgets.Control;
17 import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
18
19 /**
20  * An abstraction of a content outline page 
21  */
22 public abstract class AbstractContentOutlinePage extends ContentOutlinePage {
23   
24   protected Object fInput;
25   /**
26    * Sets the input of the outline page
27    */
28   public void setInput(Object input) {
29     fInput = input;
30     update();
31   }
32
33   /**
34    * Updates the outline page.
35    */
36   public void update() {
37     TreeViewer viewer = getTreeViewer();
38
39     if (viewer != null) {
40       Control control = viewer.getControl();
41       if (control != null && !control.isDisposed()) {
42         control.setRedraw(false);
43         viewer.setInput(fInput);
44         viewer.expandAll();
45         control.setRedraw(true);
46       }
47     }
48   }
49   
50
51 }