com.iw.plugins.spindle.util.JavaListSelectionProvider.java Source code

Java tutorial

Introduction

Here is the source code for com.iw.plugins.spindle.util.JavaListSelectionProvider.java

Source

/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is Spindle, an Eclipse Plugin for Tapestry.
 *
 * The Initial Developer of the Original Code is
 * Intelligent Works Incorporated.
 * Portions created by the Initial Developer are Copyright (C) 2002
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 * 
 *  glongman@intelligentworks.com
 *
 * ***** END LICENSE BLOCK ***** */
package com.iw.plugins.spindle.util;

import java.util.Iterator;
import java.util.List;

import org.eclipse.jface.viewers.IStructuredSelection;

public class JavaListSelectionProvider implements IStructuredSelection {

    List list;

    /**
     * Constructor for JavaListSelectionProvider
     */
    public JavaListSelectionProvider(List aList) {
        list = aList;
    }

    public boolean isEmpty() {
        return list.isEmpty();
    }

    public Object getFirstElement() {
        return list.get(0);
    }

    public Iterator iterator() {
        return list.iterator();
    }

    public int size() {
        return list.size();
    }

    public Object[] toArray() {
        return list.toArray();
    }

    public java.util.List toList() {
        return list;
    }

}