diff options
author | Roberto E. Escobar | 2012-10-11 01:09:14 +0000 |
---|---|---|
committer | Roberto E. Escobar | 2012-10-11 01:09:14 +0000 |
commit | b6d14a3394ad22886960da680b244953ccc6f503 (patch) | |
tree | a14beb1f8705f44b4ae6e9bfcefc273f70338041 /plugins/org.eclipse.osee.reports.efficiency | |
parent | 4a029b20d2712619915fa73ef1b17777f44d9ffc (diff) | |
download | org.eclipse.osee-b6d14a3394ad22886960da680b244953ccc6f503.tar.gz org.eclipse.osee-b6d14a3394ad22886960da680b244953ccc6f503.tar.xz org.eclipse.osee-b6d14a3394ad22886960da680b244953ccc6f503.zip |
feature[bgz_391218]: Update for OSEE code style
Diffstat (limited to 'plugins/org.eclipse.osee.reports.efficiency')
6 files changed, 263 insertions, 276 deletions
diff --git a/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/Activator.java b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/Activator.java index 14d11fcc0c9..1e6fd3a7bad 100644 --- a/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/Activator.java +++ b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/Activator.java @@ -13,46 +13,47 @@ import org.osgi.framework.BundleContext; */ public class Activator extends AbstractUIPlugin { - /** - * The plug-in ID - */ - public static final String PLUGIN_ID = "org.eclipse.osee.reports.efficiency"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() {} - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - @Override - public void start(final BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - @Override - public void stop(final BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } + /** + * The plug-in ID + */ + public static final String PLUGIN_ID = "org.eclipse.osee.reports.efficiency"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(final BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(final BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } } diff --git a/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/team/TeamEfficiencyModel.java b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/team/TeamEfficiencyModel.java index 3741e97641f..9cf2479025f 100644 --- a/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/team/TeamEfficiencyModel.java +++ b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/team/TeamEfficiencyModel.java @@ -14,19 +14,19 @@ import java.util.List; */ public class TeamEfficiencyModel { - private static List<VersionEfficiency> versionEfficiency; + private static List<VersionEfficiency> versionEfficiency; - /** - * @param versionEfficiency sets the version efficiency list - */ - public static void setVersionEfficiency(final List<VersionEfficiency> versionEfficiency) { - TeamEfficiencyModel.versionEfficiency = versionEfficiency; - } + /** + * @param versionEfficiency sets the version efficiency list + */ + public static void setVersionEfficiency(final List<VersionEfficiency> versionEfficiency) { + TeamEfficiencyModel.versionEfficiency = versionEfficiency; + } - /** - * @return the version efficiency list - */ - public static List<VersionEfficiency> getVersionEfficiency() { - return versionEfficiency; - } + /** + * @return the version efficiency list + */ + public static List<VersionEfficiency> getVersionEfficiency() { + return versionEfficiency; + } } diff --git a/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/team/VersionEfficiency.java b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/team/VersionEfficiency.java index ab5744125a1..796af03e93c 100644 --- a/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/team/VersionEfficiency.java +++ b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/team/VersionEfficiency.java @@ -10,7 +10,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; - import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.osee.ats.api.version.IAtsVersion; @@ -20,7 +19,6 @@ import org.eclipse.osee.ats.core.client.workflow.HoursSpentUtil; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.reports.efficiency.Activator; - /** * Class to collect the list of artifacts and compute work done * @@ -28,69 +26,68 @@ import org.eclipse.osee.reports.efficiency.Activator; */ public class VersionEfficiency { - private final IAtsVersion version; - private final Map<String, Double> efficiency; - /** - * Constructor to set the version - * - * @param version : - */ - public VersionEfficiency(final IAtsVersion version) { - this.version = version; - this.efficiency = new HashMap<String, Double>(); - } + private final IAtsVersion version; + private final Map<String, Double> efficiency; + + /** + * Constructor to set the version + * + * @param version : + */ + public VersionEfficiency(final IAtsVersion version) { + this.version = version; + this.efficiency = new HashMap<String, Double>(); + } - /** - * Method to collect the list of artifacts and compute work done - * - * @throws OseeCoreException : - */ - public void compute() throws OseeCoreException { - final Map<String, List<TeamWorkFlowArtifact>> teams = new HashMap<String, List<TeamWorkFlowArtifact>>(); + /** + * Method to collect the list of artifacts and compute work done + * + * @throws OseeCoreException : + */ + public void compute() throws OseeCoreException { + final Map<String, List<TeamWorkFlowArtifact>> teams = new HashMap<String, List<TeamWorkFlowArtifact>>(); - // 1. For each team, collect the list of artifacts. - for (TeamWorkFlowArtifact teamWorkflow : VersionsClient.getTargetedForTeamWorkflows(this.version)) { - if (teams.containsKey(teamWorkflow.getTeamName())) { - teams.get(teamWorkflow.getTeamName()).add(teamWorkflow); - } - else { - List<TeamWorkFlowArtifact> team = new ArrayList<TeamWorkFlowArtifact>(); - team.add(teamWorkflow); - teams.put(teamWorkflow.getTeamName(), team); - } - } - // 2. compute work done - Iterator<String> teamNames = teams.keySet().iterator(); - while (teamNames.hasNext()) { - String teamName = teamNames.next(); - double estimated = 0; - double actual = 0; - for (TeamWorkFlowArtifact twa : teams.get(teamName)) { - estimated += twa.getEstimatedHoursTotal(); - actual += HoursSpentUtil.getHoursSpentTotal(twa); - } - if (actual != 0) { - this.efficiency.put(teamName, estimated / actual); - } - else { - Activator.getDefault().getLog() - .log(new Status(IStatus.INFO, Activator.PLUGIN_ID, "Actual hours spent by team : " + teamName + " was 0")); - } - } + // 1. For each team, collect the list of artifacts. + for (TeamWorkFlowArtifact teamWorkflow : VersionsClient.getTargetedForTeamWorkflows(this.version)) { + if (teams.containsKey(teamWorkflow.getTeamName())) { + teams.get(teamWorkflow.getTeamName()).add(teamWorkflow); + } else { + List<TeamWorkFlowArtifact> team = new ArrayList<TeamWorkFlowArtifact>(); + team.add(teamWorkflow); + teams.put(teamWorkflow.getTeamName(), team); + } + } + // 2. compute work done + Iterator<String> teamNames = teams.keySet().iterator(); + while (teamNames.hasNext()) { + String teamName = teamNames.next(); + double estimated = 0; + double actual = 0; + for (TeamWorkFlowArtifact twa : teams.get(teamName)) { + estimated += twa.getEstimatedHoursTotal(); + actual += HoursSpentUtil.getHoursSpentTotal(twa); + } + if (actual != 0) { + this.efficiency.put(teamName, estimated / actual); + } else { + Activator.getDefault().getLog().log( + new Status(IStatus.INFO, Activator.PLUGIN_ID, "Actual hours spent by team : " + teamName + " was 0")); + } + } - } + } - /** - * @return the map - */ - public Map<String, Double> getEfficiency() { - return this.efficiency; - } + /** + * @return the map + */ + public Map<String, Double> getEfficiency() { + return this.efficiency; + } - /** - * @return the version artifact - */ - public IAtsVersion getVersion() { - return this.version; - } + /** + * @return the version artifact + */ + public IAtsVersion getVersion() { + return this.version; + } } diff --git a/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/EfficiencyItem.java b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/EfficiencyItem.java index 574ec062b09..4142635ccee 100644 --- a/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/EfficiencyItem.java +++ b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/EfficiencyItem.java @@ -7,11 +7,10 @@ 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.core.config.TeamDefinitions; 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; @@ -24,7 +23,6 @@ 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 * @@ -32,67 +30,67 @@ import org.eclipse.osee.reports.efficiency.team.VersionEfficiency; */ public class EfficiencyItem extends XNavigateItemAction { - /** - * Constructor that calls its parent constructor - * - * @param parent : - */ - public EfficiencyItem(final XNavigateItem parent) { - super(parent, "Efficiency Report", AtsImage.REPORT); - } + /** + * 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 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 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; - } + @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; - } + 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; - } + return true; + } } diff --git a/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/TeamEfficiencyLineTab.java b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/TeamEfficiencyLineTab.java index 0a3ac634689..cd345765e7b 100644 --- a/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/TeamEfficiencyLineTab.java +++ b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/TeamEfficiencyLineTab.java @@ -8,7 +8,6 @@ package org.eclipse.osee.reports.efficiency.ui; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; - import org.eclipse.birt.report.viewer.utilities.WebViewer; import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.Path; @@ -22,7 +21,6 @@ import org.eclipse.swt.browser.Browser; import org.eclipse.swt.widgets.Composite; import org.osgi.framework.Bundle; - /** * Class to create the tab in the ui * @@ -30,59 +28,56 @@ import org.osgi.framework.Bundle; */ public class TeamEfficiencyLineTab implements IResultsEditorTab { - private Browser browser; - - @SuppressWarnings("deprecation") - @Override - public Composite createTab(final Composite parent, final ResultsEditor resultsEditor) throws OseeCoreException { + private Browser browser; - String path = getReportPath(); - this.browser = new Browser(parent, SWT.NONE); - WebViewer.display(path, WebViewer.HTML, this.browser, "frameset"); - this.browser.refresh(); - return this.browser; - } + @SuppressWarnings("deprecation") + @Override + public Composite createTab(final Composite parent, final ResultsEditor resultsEditor) throws OseeCoreException { + String path = getReportPath(); + this.browser = new Browser(parent, SWT.NONE); + WebViewer.display(path, WebViewer.HTML, this.browser, "frameset"); + this.browser.refresh(); + return this.browser; + } - /** - * Method to return the report path - * - * @return the report path - */ - public String getReportPath() { - String path = null; - try { - Bundle bundle = Platform.getBundle(getPluginID()); - URL url = FileLocator.find(bundle, new Path("reports/" + getReport()), null); - path = FileLocator.toFileURL(url).getPath(); - } - catch (MalformedURLException me) { - System.out.println("Fehler bei URL " + me.getStackTrace()); - return null; - } - catch (IOException e) { - e.printStackTrace(); - return null; - } - return path; - } + /** + * Method to return the report path + * + * @return the report path + */ + public String getReportPath() { + String path = null; + try { + Bundle bundle = Platform.getBundle(getPluginID()); + URL url = FileLocator.find(bundle, new Path("reports/" + getReport()), null); + path = FileLocator.toFileURL(url).getPath(); + } catch (MalformedURLException me) { + System.out.println("Fehler bei URL " + me.getStackTrace()); + return null; + } catch (IOException e) { + e.printStackTrace(); + return null; + } + return path; + } - /** - * @return the plugin ID - */ - public String getPluginID() { - return Activator.PLUGIN_ID; - } + /** + * @return the plugin ID + */ + public String getPluginID() { + return Activator.PLUGIN_ID; + } - /** - * @return the name of the report - */ - public String getReport() { - return "TeamEfficiencyLine.rptdesign"; - } + /** + * @return the name of the report + */ + public String getReport() { + return "TeamEfficiencyLine.rptdesign"; + } - @Override - public String getTabName() { - return "Team Efficiency Trend"; - } + @Override + public String getTabName() { + return "Team Efficiency Trend"; + } } diff --git a/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/TeamEfficiencyTab.java b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/TeamEfficiencyTab.java index f28c88f6c9a..20200b09d9d 100644 --- a/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/TeamEfficiencyTab.java +++ b/plugins/org.eclipse.osee.reports.efficiency/src/org/eclipse/osee/reports/efficiency/ui/TeamEfficiencyTab.java @@ -8,7 +8,6 @@ package org.eclipse.osee.reports.efficiency.ui; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; - import org.eclipse.birt.report.viewer.utilities.WebViewer; import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.Path; @@ -22,7 +21,6 @@ import org.eclipse.swt.browser.Browser; import org.eclipse.swt.widgets.Composite; import org.osgi.framework.Bundle; - /** * Class to create the tab in UI * @@ -30,59 +28,57 @@ import org.osgi.framework.Bundle; */ public class TeamEfficiencyTab implements IResultsEditorTab { - private Browser browser; + private Browser browser; - @SuppressWarnings("deprecation") - @Override - public Composite createTab(final Composite parent, final ResultsEditor resultsEditor) throws OseeCoreException { + @SuppressWarnings("deprecation") + @Override + public Composite createTab(final Composite parent, final ResultsEditor resultsEditor) throws OseeCoreException { - String path = getReportPath(); - this.browser = new Browser(parent, SWT.NONE); - WebViewer.display(path, WebViewer.HTML, this.browser, "frameset"); - this.browser.refresh(); - return this.browser; - } + String path = getReportPath(); + this.browser = new Browser(parent, SWT.NONE); + WebViewer.display(path, WebViewer.HTML, this.browser, "frameset"); + this.browser.refresh(); + return this.browser; + } - /** - * Method to return the report path - * - * @return the report path - */ - public String getReportPath() { - String path = null; - try { - Bundle bundle = Platform.getBundle(getPluginID()); - URL url = FileLocator.find(bundle, new Path("reports/" + getReport()), null); - path = FileLocator.toFileURL(url).getPath(); - } - catch (MalformedURLException me) { - System.out.println("Fehler bei URL " + me.getStackTrace()); - return null; - } - catch (IOException e) { - e.printStackTrace(); - return null; - } - return path; - } + /** + * Method to return the report path + * + * @return the report path + */ + public String getReportPath() { + String path = null; + try { + Bundle bundle = Platform.getBundle(getPluginID()); + URL url = FileLocator.find(bundle, new Path("reports/" + getReport()), null); + path = FileLocator.toFileURL(url).getPath(); + } catch (MalformedURLException me) { + System.out.println("Fehler bei URL " + me.getStackTrace()); + return null; + } catch (IOException e) { + e.printStackTrace(); + return null; + } + return path; + } - /** - * @return the plugin ID - */ - public String getPluginID() { - return Activator.PLUGIN_ID; - } + /** + * @return the plugin ID + */ + public String getPluginID() { + return Activator.PLUGIN_ID; + } - /** - * @return the report name - */ - public String getReport() { - return "TeamEfficiencyBar.rptdesign"; - } + /** + * @return the report name + */ + public String getReport() { + return "TeamEfficiencyBar.rptdesign"; + } - @Override - public String getTabName() { - return "Team Efficiency"; - } + @Override + public String getTabName() { + return "Team Efficiency"; + } } |