1 /*******************************************************************************
2 * Copyright (c) 2014 Ericsson
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
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.tmf
.ui
.viewers
;
15 import java
.util
.Collection
;
17 import org
.eclipse
.jface
.viewers
.ITreeContentProvider
;
18 import org
.eclipse
.jface
.viewers
.Viewer
;
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.
25 * @author Patrick Tasse
28 public class ArrayTreeContentProvider
implements ITreeContentProvider
{
31 public void dispose() {
35 public void inputChanged(Viewer viewer
, Object oldInput
, Object newInput
) {
39 public Object
[] getChildren(Object parentElement
) {
44 public Object
getParent(Object element
) {
49 public boolean hasChildren(Object element
) {
54 public Object
[] getElements(Object inputElement
) {
55 if (inputElement
instanceof Object
[]) {
56 return (Object
[]) inputElement
;
58 if (inputElement
instanceof Collection
) {
59 return ((Collection
<?
>) inputElement
).toArray();
This page took 0.04319 seconds and 6 git commands to generate.