8c4b0980324fec7a27f5811653d3855bcce15881
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / src / net / sourceforge / phpdt / internal / ui / viewsupport / ListContentProvider.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.ui.viewsupport;
12
13 import java.util.List;
14
15 import org.eclipse.jface.viewers.IStructuredContentProvider;
16 import org.eclipse.jface.viewers.Viewer;
17
18 /**
19  * A specialized content provider to show a list of editor parts.
20  */
21 public class ListContentProvider implements IStructuredContentProvider {
22         List fContents;
23
24         public ListContentProvider() {
25         }
26
27         public Object[] getElements(Object input) {
28                 if (fContents != null && fContents == input)
29                         return fContents.toArray();
30                 return new Object[0];
31         }
32
33         public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
34                 if (newInput instanceof List)
35                         fContents = (List) newInput;
36                 else
37                         fContents = null;
38                 // we use a fixed set.
39         }
40
41         public void dispose() {
42         }
43
44 //      public boolean isDeleted(Object o) {
45 //              return fContents != null && !fContents.contains(o);
46 //      }
47 }