01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.ide.dialogs;
11:
12: import org.eclipse.jface.viewers.IStructuredContentProvider;
13: import org.eclipse.jface.viewers.Viewer;
14:
15: /**
16: * The SimpleListContentProvider is a class designed to return a static list of items
17: * when queried for use in simple list dialogs.
18: */
19: public class SimpleListContentProvider implements
20: IStructuredContentProvider {
21:
22: //The elements to display
23: private Object[] 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[] getElements(Object 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 oldInput,
51: Object newInput) {
52: }
53:
54: /**
55: * Set the elements to display.
56: * @param items Object[]
57: */
58: public void setElements(Object[] items) {
59:
60: this.elements = items;
61: }
62: }
|