1 /*******************************************************************************
2  * Copyright (c) 2009, 2010 Fair Isaac Corporation.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     Fair Isaac Corporation - initial API and implementation
13  ******************************************************************************/
14 
15 package org.eclipse.ui.tests.navigator.extension;
16 
17 import org.eclipse.jface.viewers.ITreeContentProvider;
18 import org.eclipse.jface.viewers.Viewer;
19 
20 public class TestEmptyContentProvider implements ITreeContentProvider {
21 
22 	private static final Object[] NO_CHILDREN = new Object[0];
23 
24 	public static boolean _throw;
25 
resetTest()26 	public static void resetTest() {
27 		_throw = false;
28 	}
29 
30 	@Override
getChildren(Object parentElement)31 	public Object[] getChildren(Object parentElement) {
32 		if (_throw)
33 			throw new RuntimeException("Throwing...");
34 		return NO_CHILDREN;
35 	}
36 
37 	@Override
getParent(Object element)38 	public Object getParent(Object element) {
39 		if (_throw)
40 			throw new RuntimeException("Throwing...");
41 		return null;
42 	}
43 
44 	@Override
hasChildren(Object element)45 	public boolean hasChildren(Object element) {
46 		if (_throw)
47 			throw new RuntimeException("Throwing...");
48 		return false;
49 	}
50 
51 	@Override
getElements(Object inputElement)52 	public Object[] getElements(Object inputElement) {
53 		if (_throw)
54 			throw new RuntimeException("Throwing...");
55 		return NO_CHILDREN;
56 	}
57 
58 	@Override
dispose()59 	public void dispose() {}
60 	@Override
inputChanged(Viewer viewer, Object oldInput, Object newInput)61 	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
62 
63 }
64