Mercurial > projects > dwt2
comparison org.eclipse.jface/src/org/eclipse/jface/viewers/ArrayContentProvider.d @ 12:bc29606a740c
Added dwt-addons in original directory structure of eclipse.org
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 14 Mar 2009 18:23:29 +0100 |
parents | |
children | 6373fd739945 |
comparison
equal
deleted
inserted
replaced
11:43904fec5dca | 12:bc29606a740c |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2000, 2008 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 | |
14 module org.eclipse.jface.viewers.ArrayContentProvider; | |
15 | |
16 import org.eclipse.jface.viewers.IStructuredContentProvider; | |
17 import org.eclipse.jface.viewers.Viewer; | |
18 | |
19 | |
20 import java.lang.all; | |
21 import java.util.Collection; | |
22 | |
23 /** | |
24 * This implementation of <code>IStructuredContentProvider</code> handles | |
25 * the case where the viewer input is an unchanging array or collection of elements. | |
26 * <p> | |
27 * This class is not intended to be subclassed outside the viewer framework. | |
28 * </p> | |
29 * | |
30 * @since 2.1 | |
31 * @noextend This class is not intended to be subclassed by clients. | |
32 */ | |
33 public class ArrayContentProvider(T) : IStructuredContentProvider { | |
34 | |
35 /** | |
36 * Returns the elements in the input, which must be either an array or a | |
37 * <code>Collection</code>. | |
38 */ | |
39 public Object[] getElements(Object inputElement) { | |
40 if ( auto aw = cast(ArrayWrapperT!(T)) inputElement ) { | |
41 return aw.array; | |
42 } | |
43 if ( auto col = cast(Collection) inputElement ) { | |
44 return col.toArray(); | |
45 } | |
46 return null; | |
47 } | |
48 | |
49 /** | |
50 * This implementation does nothing. | |
51 */ | |
52 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { | |
53 // do nothing. | |
54 } | |
55 | |
56 /** | |
57 * This implementation does nothing. | |
58 */ | |
59 public void dispose() { | |
60 // do nothing. | |
61 } | |
62 } |