Initial EGit contribution to eclipse.org
[egit.git] / org.eclipse.egit.core / src / org / eclipse / egit / core / ResourceList.java
blobc475a0c1d01d56889fe432de98cdf95ad17888ec
1 /*******************************************************************************
2 * Copyright (C) 2006, Robin Rosenberg <robin.rosenberg@dewire.com>
3 * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
9 *******************************************************************************/
10 package org.eclipse.egit.core;
12 import org.eclipse.core.resources.IResource;
13 import org.eclipse.core.runtime.IAdaptable;
15 /** A list of IResource, adaptable to the first item. */
16 public class ResourceList implements IAdaptable {
17 private final IResource[] list;
19 /**
20 * Create a new list of resources.
22 * @param items
23 * the items to contain in this list.
25 public ResourceList(final IResource[] items) {
26 list = items;
29 /**
30 * Get the items stored in this list.
32 * @return the list provided to our constructor.
34 public IResource[] getItems() {
35 return list;
38 public Object getAdapter(final Class adapter) {
39 if (adapter == IResource.class && list != null && list.length > 0)
40 return list[0];
41 return null;