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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
/*******************************************************************************
* Copyright (c) 2011 Boeing.
* 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:
* Boeing - initial API and implementation
*******************************************************************************/
package org.eclipse.osee.ats.config.editor;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
import org.eclipse.nebula.widgets.xviewer.XViewerColumn.SortDataType;
import org.eclipse.nebula.widgets.xviewer.XViewerLabelProvider;
import org.eclipse.osee.ats.api.IAtsConfigObject;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorProvider;
import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorTab;
import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor;
import org.eclipse.osee.framework.ui.skynet.results.table.IResultsXViewerRow;
import org.eclipse.osee.framework.ui.skynet.results.table.ResultsEditorTableTab;
import org.eclipse.osee.framework.ui.skynet.results.table.ResultsEditorTableTab.IResultsEditorLabelProvider;
import org.eclipse.osee.framework.ui.skynet.results.table.ResultsXViewerRow;
import org.eclipse.osee.framework.ui.skynet.results.table.xresults.ResultsXViewer;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.swt.SWT;
/**
* @author Donald G. Dunne
*/
public class AtsConfigResultsEditor extends AbstractOperation {
private final List<IAtsConfigObject> configObjects;
public AtsConfigResultsEditor(String operationName, String pluginId, List<IAtsConfigObject> configObjects) {
super(operationName, pluginId);
this.configObjects = configObjects;
}
@Override
protected void doWork(IProgressMonitor monitor) throws Exception {
List<IResultsXViewerRow> artRows = new LinkedList<IResultsXViewerRow>();
for (IAtsConfigObject obj : configObjects) {
artRows.add(new ResultsXViewerRow(new String[] {obj.getName(), ""}, obj));
}
List<XViewerColumn> artColumns =
Arrays.asList(new XViewerColumn("Type", "Type", 175, SWT.LEFT, true, SortDataType.String, false, "Type"),
new XViewerColumn("Name", "Name", 300, SWT.LEFT, true, SortDataType.String, false, "Name"),
new XViewerColumn("Guid", "Guid", 150, SWT.LEFT, true, SortDataType.String, false, "Guid"));
final List<IResultsEditorTab> toReturn = new LinkedList<IResultsEditorTab>();
IResultsEditorLabelProvider provider = new IResultsEditorLabelProvider() {
@Override
public XViewerLabelProvider getLabelProvider(ResultsXViewer xViewer) {
return new AtsConfigLabelProvider(xViewer);
}
};
toReturn.add(new ResultsEditorTableTab("Config", artColumns, artRows, new AtsConfigContentProvider(), provider));
Displays.ensureInDisplayThread(new Runnable() {
@Override
public void run() {
ResultsEditor.open(new IResultsEditorProvider() {
@Override
public String getEditorName() {
return "ATS Config Viewer";
}
@Override
public List<IResultsEditorTab> getResultsEditorTabs() {
return toReturn;
}
});
}
});
}
}
|