Skip to main content
summaryrefslogtreecommitdiffstats
blob: f050ffa226eef6871e65e5d85bee2fb1feb9137f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*******************************************************************************
 * Copyright (c) 2006, 2008 Oracle. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
 * 
 * Contributors:
 *     Oracle - initial API and implementation
 ******************************************************************************/
package org.eclipse.jpt.common.ui.internal.jface;

import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;

/**
 * Null implementation of the ILabelProvider interface.
 * Implemented as a singleton.
 */
public final class NullTreeContentProvider
	implements ITreeContentProvider 
{
	private static final Object[] EMPTY_ARRAY = new Object[0];
	public static final NullTreeContentProvider INSTANCE = new NullTreeContentProvider();

	public static ITreeContentProvider instance() {
		return INSTANCE;
	}

	/**
	 * Ensure a single instance.
	 */
	private NullTreeContentProvider() {
		super();
	}

	public Object[] getChildren(Object parentElement) {
		return EMPTY_ARRAY;
	}

	public Object getParent(Object element) {
		return null;
	}

	public boolean hasChildren(Object element) {
		return false;
	}

	public Object[] getElements(Object inputElement) {
		return EMPTY_ARRAY;
	}

	public void dispose() {
		// do nothing
	}

	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
		// do nothing
	}

}

Back to the top