use of org.eclipse.titanium.metrics.utils.RiskLevel in project titan.EclipsePlug-ins by eclipse.
the class MeasureableGraphHandler method calculateColour.
/**
* This method calculates the colour of a given node according to a given
* metric.
*
* @param node
* : The node that you want to colour
* @param metric
* : The given metric type (currently it handles <font
* color="red">ONLY</font> one metric)
* @return The calculated node colour
*/
public Color calculateColour(final NodeDescriptor node, final IMetricEnum metric) {
chosenColouringMetric = metric;
if (node.isMissing()) {
node.setNodeColour(NodeColours.MISSING_COLOUR);
return NodeColours.MISSING_COLOUR;
}
Color actColor;
final ModuleMetricsWrapper actProvider = WrapperStore.getWrapper(node.getProject());
final RiskLevel rColor = actProvider.getRisk(metric, node.getName());
switch(rColor) {
case NO:
actColor = NodeColours.DARK_GREEN;
break;
case LOW:
actColor = NodeColours.DARK_YELLOW;
break;
case HIGH:
actColor = NodeColours.DARK_RED;
break;
default:
actColor = NodeColours.NO_VALUE_COLOUR;
break;
}
node.setNodeColour(actColor);
return actColor;
}
use of org.eclipse.titanium.metrics.utils.RiskLevel in project titan.EclipsePlug-ins by eclipse.
the class ExportAllMetrics method exportInformationForProject.
@Override
protected void exportInformationForProject(final String[] args, final IProject project, final IProgressMonitor monitor) {
final MetricData data = MetricData.measure(project);
final RiskLevel r = RiskLevel.NO;
final String fn = args[0] + project.getName() + ".xls";
final File file = new File(fn);
final XLSExporter xlsWriter = new XLSExporter(data);
xlsWriter.setFile(file);
xlsWriter.write(r);
}
use of org.eclipse.titanium.metrics.utils.RiskLevel in project titan.EclipsePlug-ins by eclipse.
the class MetricsView method createExportToXlsButton.
private void createExportToXlsButton(final Composite head) {
export = new Button(head, SWT.NONE);
export.setImage(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "resources/icons/metrics_export_csv.gif").createImage());
export.setToolTipText(EXPORT_TOOLTIP);
export.setEnabled(false);
export.setLayoutData(new GridData(SWT.DEFAULT, 25));
export.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent event) {
// choose the set of metrics to export
final RiskLevel r = new ExportSetDialog(parent.getDisplay()).open();
if (r == null) {
return;
}
final FileDialog d = new FileDialog(parent.getShell(), SWT.SAVE);
d.setText("Export metric results to xls");
d.setFilterExtensions(new String[] { "*.xls" });
final Calendar now = Calendar.getInstance();
d.setFileName(projectSelector.getText() + "--" + now.get(Calendar.YEAR) + "-" + (1 + now.get(Calendar.MONTH)) + "-" + now.get(Calendar.DAY_OF_MONTH));
final String fn = d.open();
if (fn == null) {
return;
}
final File file = new File(fn);
final XLSExporter xlsWriter = new XLSExporter(data);
xlsWriter.setFile(file);
xlsWriter.write(r);
}
});
}
Aggregations