Remove unneeded checkNotNull() calls
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / tracecompass / tmf / ui / viewers / ArrayTreeContentProvider.java
CommitLineData
6b44794a
MK
1/*******************************************************************************
2 * Copyright (c) 2014 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
12
2bdf0193 13package org.eclipse.tracecompass.tmf.ui.viewers;
6b44794a
MK
14
15import java.util.Collection;
16
17import org.eclipse.jface.viewers.ITreeContentProvider;
18import org.eclipse.jface.viewers.Viewer;
19
20/**
21 * This implementation of <code>ITreeContentProvider</code> handles the case
22 * where the viewer input is an unchanging array or collection of elements.
23 * The elements do not have children.
24 *
25 * @author Patrick Tasse
6b44794a
MK
26 */
27public class ArrayTreeContentProvider implements ITreeContentProvider {
28
29 @Override
30 public void dispose() {
31 }
32
33 @Override
34 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
35 }
36
37 @Override
38 public Object[] getChildren(Object parentElement) {
39 return null;
40 }
41
42 @Override
43 public Object getParent(Object element) {
44 return null;
45 }
46
47 @Override
48 public boolean hasChildren(Object element) {
49 return false;
50 }
51
52 @Override
53 public Object[] getElements(Object inputElement) {
54 if (inputElement instanceof Object[]) {
55 return (Object[]) inputElement;
56 }
57 if (inputElement instanceof Collection) {
58 return ((Collection<?>) inputElement).toArray();
59 }
60 return new Object[0];
61 }
62
63}
This page took 0.059619 seconds and 5 git commands to generate.