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
9 * IBM - Initial API and implementation
10 **********************************************************************/
11 package org.eclipse.webbrowser.internal;
14 import org.eclipse.jface.viewers.Viewer;
15 import org.eclipse.jface.viewers.IStructuredContentProvider;
16 import org.eclipse.webbrowser.IWebBrowser;
19 * Monitor content provider.
21 public class BrowserContentProvider implements IStructuredContentProvider {
23 * BrowserContentProvider constructor comment.
25 public BrowserContentProvider() {
30 * Disposes of this content provider.
31 * This is called by the viewer when it is disposed.
33 public void dispose() { }
36 * Returns the elements to display in the viewer
37 * when its input is set to the given element.
38 * These elements can be presented as rows in a table, items in a list, etc.
39 * The result is not modified by the viewer.
41 * @param inputElement the input element
42 * @return the array of elements to display in the viewer
44 public Object[] getElements(Object inputElement) {
45 List list = new ArrayList();
46 Iterator iterator = BrowserManager.getInstance().getWebBrowsers().iterator();
47 while (iterator.hasNext()) {
48 IWebBrowser browser = (IWebBrowser) iterator.next();
51 return list.toArray();
55 * Notifies this content provider that the given viewer's input
56 * has been switched to a different element.
58 * A typical use for this method is registering the content provider as a listener
59 * to changes on the new input (using model-specific means), and deregistering the viewer
60 * from the old input. In response to these change notifications, the content provider
61 * propagates the changes to the viewer.
64 * @param viewer the viewer
65 * @param oldInput the old input element, or <code>null</code> if the viewer
66 * did not previously have an input
67 * @param newInput the new input element, or <code>null</code> if the viewer
68 * does not have an input
70 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}