01: package net.refractions.udig.validation.ui;
02:
03: import java.util.HashSet;
04: import java.util.Iterator;
05: import java.util.Map;
06: import java.util.Set;
07:
08: import org.eclipse.jface.viewers.IStructuredContentProvider;
09: import org.eclipse.jface.viewers.Viewer;
10: import org.geotools.validation.dto.ArgumentDTO;
11: import org.geotools.validation.dto.TestDTO;
12:
13: /**
14: * Content provider for representing launch configuration types & launch configurations in a tree.
15: *
16: */
17: public class ValidationTableContentProvider implements
18: IStructuredContentProvider {
19:
20: private static final Object[] EMPTY_ARRAY = new Object[0];
21:
22: public ValidationTableContentProvider() {
23: }
24:
25: public void dispose() {
26: }
27:
28: public void inputChanged(Viewer viewer, Object oldInput,
29: Object newInput) {
30: }
31:
32: public Object[] getElements(Object inputElement) {
33: if (inputElement instanceof TestDTO) {
34: TestDTO test = (TestDTO) inputElement;
35: Set argumentSet = new HashSet();
36: Map args = test.getArgs();
37: //add each argument to the set
38: for (Iterator i = args.keySet().iterator(); i.hasNext();) {
39: ArgumentDTO currentArg = (ArgumentDTO) args.get(i
40: .next());
41: argumentSet.add(currentArg);
42: }
43: return argumentSet.toArray();
44: }
45: return EMPTY_ARRAY;
46: }
47: }
|