Search in sources :

Example 6 with MetricGroup

use of org.eclipse.titanium.metrics.MetricGroup in project titan.EclipsePlug-ins by eclipse.

the class CNComparator method write.

public void write(final RiskLevel r) {
    try {
        final HSSFWorkbook workbook = new HSSFWorkbook();
        for (final MetricGroup type : new MetricGroup[] { MetricGroup.MODULE, MetricGroup.ALTSTEP, MetricGroup.FUNCTION, MetricGroup.TESTCASE }) {
            for (final IMetricEnum metric : type.getMetrics()) {
                if (!(PreferenceManager.isEnabledOnView(metric))) {
                    continue;
                }
                final ProjectStatNode pn = new ProjectStatNode(metric);
                if (!pn.hasChildren(data) || pn.getRiskLevel(data).compareTo(r) < 0) {
                    continue;
                }
                final Sheet sheet = workbook.createSheet(getSheetName(metric));
                printChildren(sheet, pn, 0, 0);
            }
        }
        final FileOutputStream fileOutputStream = new FileOutputStream(file);
        workbook.write(fileOutputStream);
        IOUtils.closeQuietly(fileOutputStream);
    } catch (IOException e) {
        ErrorReporter.logExceptionStackTrace("Error while exporting to excel", e);
    }
}
Also used : IMetricEnum(org.eclipse.titanium.metrics.IMetricEnum) FileOutputStream(java.io.FileOutputStream) MetricGroup(org.eclipse.titanium.metrics.MetricGroup) IOException(java.io.IOException) Sheet(org.apache.poi.ss.usermodel.Sheet) HSSFWorkbook(org.apache.poi.hssf.usermodel.HSSFWorkbook)

Aggregations

MetricGroup (org.eclipse.titanium.metrics.MetricGroup)6 IMetricEnum (org.eclipse.titanium.metrics.IMetricEnum)5 GridData (org.eclipse.swt.layout.GridData)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Composite (org.eclipse.swt.widgets.Composite)3 Label (org.eclipse.swt.widgets.Label)3 BooleanFieldEditor (org.eclipse.jface.preference.BooleanFieldEditor)2 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 HSSFWorkbook (org.apache.poi.hssf.usermodel.HSSFWorkbook)1 Sheet (org.apache.poi.ss.usermodel.Sheet)1 MetricData (org.eclipse.titanium.metrics.MetricData)1 StatColumn (org.eclipse.titanium.metrics.StatColumn)1 Statistics (org.eclipse.titanium.metrics.Statistics)1 IRiskEditorListener (org.eclipse.titanium.metrics.preferences.IRiskEditorListener)1 IRiskEditorPropertyListener (org.eclipse.titanium.metrics.preferences.IRiskEditorPropertyListener)1 IRiskFieldEditor (org.eclipse.titanium.metrics.preferences.IRiskFieldEditor)1