Open PHP Help Online Manual in the browser / add other http querie for google and...
[phpeclipse.git] / net.sourceforge.phpeclipse.phphelp / src / net / sourceforge / phpdt / httpquery / preferences / ConfigurationContentProvider.java
1 /**********************************************************************
2  * Copyright (c) 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7   *
8  * Contributors:
9  *    IBM - Initial API and implementation
10  **********************************************************************/
11 package net.sourceforge.phpdt.httpquery.preferences;
12
13 import java.util.ArrayList;
14 import java.util.Iterator;
15 import java.util.List;
16
17 import net.sourceforge.phpdt.httpquery.config.IConfiguration;
18 import net.sourceforge.phpdt.phphelp.PHPHelpPlugin;
19
20 import org.eclipse.jface.viewers.IStructuredContentProvider;
21 import org.eclipse.jface.viewers.Viewer;
22
23 /**
24  * Configuration content provider.
25  */
26 public class ConfigurationContentProvider implements IStructuredContentProvider {
27         /**
28          * ConfigurationContentProvider constructor comment.
29          */
30         public ConfigurationContentProvider() {
31                 super();
32         }
33
34         /**
35          * Disposes of this content provider. This is called by the viewer when it is
36          * disposed.
37          */
38         public void dispose() {
39         }
40
41         /**
42          * Returns the elements to display in the viewer when its input is set to the
43          * given element. These elements can be presented as rows in a table, items in
44          * a list, etc. The result is not modified by the viewer.
45          *
46          * @param inputElement
47          *          the input element
48          * @return the array of elements to display in the viewer
49          */
50         public Object[] getElements(Object inputElement) {
51                 List list = new ArrayList();
52                 Iterator iterator = PHPHelpPlugin.getConfigurations().iterator();
53                 while (iterator.hasNext()) {
54                         IConfiguration configuration = (IConfiguration) iterator.next();
55                         list.add(configuration);
56                 }
57                 return list.toArray();
58         }
59
60         /**
61          * Notifies this content provider that the given viewer's input has been
62          * switched to a different element.
63          * <p>
64          * A typical use for this method is registering the content provider as a
65          * listener to changes on the new input (using model-specific means), and
66          * deregistering the viewer from the old input. In response to these change
67          * notifications, the content provider propagates the changes to the viewer.
68          * </p>
69          *
70          * @param viewer
71          *          the viewer
72          * @param oldInput
73          *          the old input element, or <code>null</code> if the viewer did
74          *          not previously have an input
75          * @param newInput
76          *          the new input element, or <code>null</code> if the viewer does
77          *          not have an input
78          */
79         public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
80         }
81 }