blob: 574ec062b09fe406f46951be4afde379ba8f878e (
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
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
87
88
89
90
91
92
93
94
95
96
97
98
|
/*
* Copyright (c) 2012 Robert Bosch Engineering and Business Solutions Ltd India. 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
*/
package org.eclipse.osee.reports.efficiency.ui;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.osee.ats.AtsImage;
import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
import org.eclipse.osee.ats.core.config.TeamDefinitions;
import org.eclipse.osee.ats.api.version.IAtsVersion;
import org.eclipse.osee.ats.util.widgets.dialog.TeamDefinitionDialog;
import org.eclipse.osee.framework.core.enums.Active;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItemAction;
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.reports.efficiency.team.TeamEfficiencyModel;
import org.eclipse.osee.reports.efficiency.team.VersionEfficiency;
/**
* Class to take inputs from user and populate TeamEfficiencyModel
*
* @author Praveen Joseph
*/
public class EfficiencyItem extends XNavigateItemAction {
/**
* Constructor that calls its parent constructor
*
* @param parent :
*/
public EfficiencyItem(final XNavigateItem parent) {
super(parent, "Efficiency Report", AtsImage.REPORT);
}
@Override
public void run(final TableLoadOption... tableLoadOptions) throws Exception {
// Get input from the user.
TeamDefinitionDialog dlg = new TeamDefinitionDialog("Team Efficiency Report", "Please Select the Team Definition");
dlg.setInput(TeamDefinitions.getTeamReleaseableDefinitions(Active.Both));
int open = dlg.open();
if (open == 0) {
populateModel(dlg);
ResultsEditor.open(new IResultsEditorProvider() {
@Override
public String getEditorName() {
return "Efficiency Report";
}
@Override
public List<IResultsEditorTab> getResultsEditorTabs() {
List<IResultsEditorTab> tabs = new ArrayList<IResultsEditorTab>();
tabs.add(new TeamEfficiencyTab());
tabs.add(new TeamEfficiencyLineTab());
return tabs;
}
});
}
}
private boolean populateModel(final TeamDefinitionDialog dlg) {
try {
Object[] result = dlg.getResult();
if ((result == null) || (result.length == 0)) {
return false;
}
Object res = result[0];
if (res instanceof IAtsTeamDefinition) {
IAtsTeamDefinition teamDef = (IAtsTeamDefinition) res;
List<VersionEfficiency> verEffs = new ArrayList<VersionEfficiency>();
for (IAtsVersion version : teamDef.getVersions()) {
VersionEfficiency eff = new VersionEfficiency(version);
eff.compute();
verEffs.add(eff);
}
TeamEfficiencyModel.setVersionEfficiency(verEffs);
}
}
catch (OseeCoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
}
|