KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > ide > dialogs > SimpleListContentProvider


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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 org.eclipse.ui.internal.ide.dialogs;
12
13 import org.eclipse.jface.viewers.IStructuredContentProvider;
14 import org.eclipse.jface.viewers.Viewer;
15
16 /**
17  * The SimpleListContentProvider is a class designed to return a static list of items
18  * when queried for use in simple list dialogs.
19  */

20 public class SimpleListContentProvider implements IStructuredContentProvider {
21
22     //The elements to display
23
private Object JavaDoc[] elements;
24
25     /**
26      * SimpleListContentProvider constructor comment.
27      */

28     public SimpleListContentProvider() {
29         super();
30     }
31
32     /**
33      * Do nothing when disposing,
34      */

35     public void dispose() {
36     }
37
38     /**
39      * Returns the elements to display in the viewer. The inputElement is ignored for this
40      * provider.
41      */

42     public Object JavaDoc[] getElements(Object JavaDoc inputElement) {
43         return this.elements;
44     }
45
46     /**
47      * Required method from IStructuredContentProvider. The input is assumed to not change
48      * for the SimpleListContentViewer so do nothing here.
49      */

50     public void inputChanged(Viewer viewer, Object JavaDoc oldInput, Object JavaDoc newInput) {
51     }
52
53     /**
54      * Set the elements to display.
55      * @param items Object[]
56      */

57     public void setElements(Object JavaDoc[] items) {
58
59         this.elements = items;
60     }
61 }
62
Popular Tags