View Javadoc

1   /* ======================================
2    * Copyright (c) 2004-2005 Achim Nierbeck
3    * All rights reserved.
4    *
5    * You may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *       http://www.gnu.org/licenses/lgpl.html
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   * ======================================
16   */
17  
18  /*
19   * EntriesContentProvider.java
20   * $Revision: 1.3 $
21   * Date 14.12.2005
22   * 
23   * $Author: nierbeck $ 
24   * $Date: 2006/02/02 21:33:07 $ 
25   * 
26   */
27  
28  package de.nierbeck.timeTrack.views;
29  
30  import org.apache.commons.lang.ArrayUtils;
31  import org.eclipse.jface.viewers.IStructuredContentProvider;
32  import org.eclipse.jface.viewers.Viewer;
33  
34  import de.nierbeck.timeTrack.model.Entries;
35  
36  /***
37   * @author Achim
38   * 
39   */
40  public class EntriesContentProvider implements IStructuredContentProvider {
41  
42  	/***
43  	 * @param inputElement - the given Element
44  	 *  
45  	 * @return a array of the selected Entries
46  	 * 
47  	 * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
48  	 */
49  	public final Object[] getElements(Object inputElement) {
50  		if (inputElement instanceof Entries) {
51  			Object[] objects = ((Entries) inputElement).getEntry().toArray();
52  			ArrayUtils.reverse(objects);
53  			return objects;
54  		}
55  		return new Object[0];
56  	}
57  
58  	/***
59  	 * 
60  	 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
61  	 */
62  	public void dispose() {
63  		// TODO Auto-generated method stub
64  
65  	}
66  
67  	/***
68  	 * @param viewer - does nothing
69  	 * @param oldInput - does nothing
70  	 * @param newInput - does nothing
71  	 * 
72  	 * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
73  	 *      java.lang.Object, java.lang.Object)
74  	 */
75  	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
76  		// TODO Auto-generated method stub
77  
78  	}
79  
80  }