| /******************************************************************************* |
| * Copyright (c) 2003, 2005 IBM Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * IBM Corporation - Initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.wst.server.ui.internal.viewers; |
| |
| import java.util.ArrayList; |
| import java.util.List; |
| |
| import org.eclipse.jface.viewers.IStructuredContentProvider; |
| import org.eclipse.jface.viewers.Viewer; |
| |
| import org.eclipse.wst.server.core.IRuntime; |
| import org.eclipse.wst.server.core.ServerCore; |
| import org.eclipse.wst.server.core.internal.Runtime; |
| /** |
| * Runtime content provider. |
| */ |
| public class RuntimeContentProvider implements IStructuredContentProvider { |
| /** |
| * RuntimeContentProvider constructor comment. |
| */ |
| public RuntimeContentProvider() { |
| super(); |
| } |
| |
| /** |
| * @see org.eclipse.jface.viewers.IContentProvider#dispose() |
| */ |
| public void dispose() { |
| // do nothing |
| } |
| |
| /** |
| * @see IStructuredContentProvider#getElements(Object) |
| */ |
| public Object[] getElements(Object inputElement) { |
| List list = new ArrayList(); |
| IRuntime[] runtimes = ServerCore.getRuntimes(); |
| if (runtimes != null) { |
| int size = runtimes.length; |
| for (int i = 0; i < size; i++) { |
| if (!((Runtime)runtimes[i]).isPrivate()) |
| list.add(runtimes[i]); |
| } |
| } |
| return list.toArray(); |
| } |
| |
| /** |
| * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, Object, Object) |
| */ |
| public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { |
| // do nothing |
| } |
| } |