use of org.eclipse.titanium.metrics.MetricGroup in project titan.EclipsePlug-ins by eclipse.
the class GraphMetricsPage method createContents.
@Override
protected Control createContents(final Composite parent) {
final Composite page = new Composite(parent, 0);
final GridLayout l = new GridLayout();
l.numColumns = 2;
page.setLayout(l);
for (final MetricGroup type : new MetricGroup[] { MetricGroup.MODULE, MetricGroup.FUNCTION, MetricGroup.TESTCASE, MetricGroup.ALTSTEP }) {
final Label header = new Label(page, 0);
header.setText(type.getGroupName() + " metrics");
final GridData headerData = new GridData();
headerData.horizontalSpan = 2;
header.setLayoutData(headerData);
final Composite padding = new Composite(page, 0);
padding.setLayoutData(new GridData(25, 0));
final Composite inner = new Composite(page, 0);
for (final IMetricEnum metric : type.getMetrics()) {
final BooleanFieldEditor editor = new BooleanFieldEditor(PreferenceConstants.nameMetricGraph(metric.id()), metric.getName(), inner);
editor.getDescriptionControl(inner).setToolTipText(metric.getHint());
editor.setPage(this);
editor.setPreferenceStore(this.getPreferenceStore());
editor.load();
editors.add(editor);
}
}
return page;
}
use of org.eclipse.titanium.metrics.MetricGroup in project titan.EclipsePlug-ins by eclipse.
the class MetricsLimitPreferencePage method createContents.
@Override
protected Control createContents(final Composite parent) {
final Composite page = new Composite(parent, 0);
final GridLayout l = new GridLayout();
l.numColumns = 2;
page.setLayout(l);
for (final MetricGroup type : MetricGroup.values()) {
final Label header = new Label(page, 0);
header.setText(type.getGroupName() + " metrics");
final GridData headerData = new GridData();
headerData.horizontalSpan = 2;
header.setLayoutData(headerData);
final Composite padding = new Composite(page, 0);
padding.setLayoutData(new GridData(25, 0));
final Composite inner = new Composite(page, 0);
final GridLayout layout = new GridLayout();
layout.numColumns = 2;
inner.setLayout(layout);
final IRiskEditorListener listener = new IRiskEditorListener() {
@Override
public void editorChanged() {
inner.layout();
page.layout();
}
};
final IRiskEditorPropertyListener propertyListener = new IRiskEditorPropertyListener() {
@Override
public void propertyChange(final boolean valid) {
if (!valid) {
setValid(false);
updateApplyButton();
} else if (!isValid()) {
checkState();
}
}
};
for (final IMetricEnum metric : type.getMetrics()) {
final Label name = new Label(inner, 0);
name.setText(metric.getName());
name.setToolTipText(metric.getHint());
final IRiskFieldEditor editor = getRiskEditor(inner, metric);
editor.addRiskEditorListener(listener);
editor.setPropListener(propertyListener);
editor.load();
editors.add(editor);
}
}
checkState();
return page;
}
use of org.eclipse.titanium.metrics.MetricGroup in project titan.EclipsePlug-ins by eclipse.
the class MetricsViewPreferencePage method createContents.
@Override
protected Control createContents(final Composite parent) {
final Composite page = new Composite(parent, 0);
final GridLayout l = new GridLayout();
l.numColumns = 2;
page.setLayout(l);
for (final MetricGroup type : MetricGroup.values()) {
final Label header = new Label(page, 0);
header.setText(type.getGroupName() + " metrics");
final GridData headerData = new GridData();
headerData.horizontalSpan = 2;
header.setLayoutData(headerData);
final Composite padding = new Composite(page, 0);
padding.setLayoutData(new GridData(25, 0));
final Composite inner = new Composite(page, 0);
for (final IMetricEnum metric : type.getMetrics()) {
final BooleanFieldEditor editor = new BooleanFieldEditor(PreferenceConstants.nameMetricEnabled(metric.id()), metric.getName(), inner);
editor.getDescriptionControl(inner).setToolTipText(metric.getHint());
editor.setPage(this);
editor.setPreferenceStore(this.getPreferenceStore());
editor.load();
editors.add(editor);
}
}
return page;
}
use of org.eclipse.titanium.metrics.MetricGroup in project titan.EclipsePlug-ins by eclipse.
the class ContentProvider method getElements.
@Override
public Object[] getElements(final Object inputElement) {
if (!(inputElement instanceof MetricData)) {
throw new IllegalArgumentException();
}
data = (MetricData) inputElement;
final List<? super INode> children = new ArrayList<INode>();
for (final MetricGroup t : MetricGroup.values()) {
final RootNode n = new RootNode(t);
if (n.hasChildren(data)) {
children.add(n);
}
}
return children.toArray();
}
use of org.eclipse.titanium.metrics.MetricGroup in project titan.EclipsePlug-ins by eclipse.
the class InfoWindow method createContents.
/**
* Fills the table with metrics data, and shows the InfoWindow
*
* @param node
* : The module to show info about.
*/
private void createContents(final NodeDescriptor node) {
if (node.isMissing()) {
errorHandler.reportErrorMessage("The module \"" + node.getDisplayName() + "\" cannot be found on the disk!");
return;
}
final String shownName = node.getDisplayName();
List<String> actRow = null;
addRow(new ArrayList<String>(Arrays.asList("General Information")), Color.lightGray);
addRow(new ArrayList<String>(Arrays.asList("Module name", shownName)), Color.white);
for (final MetricGroup type : new MetricGroup[] { MetricGroup.MODULE }) {
addRow(new ArrayList<String>(Arrays.asList(type.getGroupName() + " metrics")), Color.lightGray);
for (final IMetricEnum metric : type.getMetrics()) {
if (!PreferenceManager.isEnabledOnModuleGraph(metric)) {
continue;
}
actRow = new ArrayList<String>();
actRow.add(metric.getName());
String val = null;
final Number tempVal = metricsProvider.getValue(metric, module.getName());
if (tempVal != null) {
val = tempVal.toString();
}
actRow.add(val);
if (chosenMetric.equals(metric)) {
addRow(actRow, node.getColor());
} else {
addRow(actRow, Color.white);
}
}
}
for (final MetricGroup type : new MetricGroup[] { MetricGroup.ALTSTEP, MetricGroup.FUNCTION, MetricGroup.TESTCASE }) {
addRow(new ArrayList<String>(Arrays.asList(type.getGroupName())), Color.lightGray);
for (final IMetricEnum metric : type.getMetrics()) {
if (!PreferenceManager.isEnabledOnModuleGraph(metric)) {
continue;
}
actRow = new ArrayList<String>();
actRow.add(metric.getName());
final Statistics stat = metricsProvider.getStats(metric, module.getName());
for (final StatColumn actCol : StatColumn.values()) {
final Number val = stat == null ? null : stat.get(actCol);
actRow.add(val == null ? "-" : val.toString());
}
if (chosenMetric.equals(metric)) {
addRow(actRow, node.getColor());
} else {
addRow(actRow, Color.white);
}
}
}
}
Aggregations