Search in sources :

Example 1 with AbstractSTTreeViewer

use of org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTreeViewer in project linuxtools by eclipse.

the class GprofTest method changeMode.

private void changeMode(GmonView view, boolean timeModeRequested) {
    AbstractSTTreeViewer gmonViewer = (AbstractSTTreeViewer) view.getSTViewer();
    GmonDecoder decoder = (GmonDecoder) gmonViewer.getInput();
    int prof_rate = decoder.getHistogramDecoder().getProfRate();
    if (prof_rate == 0) {
        return;
    }
    TreeColumn tc = gmonViewer.getViewer().getTree().getColumn(1);
    SampleProfField spf = (SampleProfField) tc.getData();
    if (spf.getColumnHeaderText().endsWith("Samples") ^ !timeModeRequested) {
        new SwitchSampleTimeAction(view).run();
    }
}
Also used : TreeColumn(org.eclipse.swt.widgets.TreeColumn) GmonDecoder(org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder) SwitchSampleTimeAction(org.eclipse.linuxtools.internal.gprof.action.SwitchSampleTimeAction) AbstractSTTreeViewer(org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTreeViewer) SampleProfField(org.eclipse.linuxtools.internal.gprof.view.fields.SampleProfField)

Example 2 with AbstractSTTreeViewer

use of org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTreeViewer in project linuxtools by eclipse.

the class SwitchSampleTimeAction method run.

@Override
public void run() {
    AbstractSTTreeViewer gmonViewer = (AbstractSTTreeViewer) view.getSTViewer();
    GmonDecoder decoder = (GmonDecoder) gmonViewer.getInput();
    if (decoder != null) {
        int prof_rate = decoder.getHistogramDecoder().getProfRate();
        if (prof_rate == 0) {
            MessageDialog.openError(view.getSite().getShell(), Messages.SwitchSampleTimeAction_GMON_PROF_RATE_IS_NULL, Messages.SwitchSampleTimeAction_GMON_PROF_RATE_IS_NULL_LONG_MSG);
            return;
        }
        TreeColumn tc = gmonViewer.getViewer().getTree().getColumn(1);
        SampleProfField spf = (SampleProfField) tc.getData();
        spf.toggle();
        tc.setText(spf.getColumnHeaderText());
        gmonViewer.getViewer().refresh();
    }
}
Also used : TreeColumn(org.eclipse.swt.widgets.TreeColumn) GmonDecoder(org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder) AbstractSTTreeViewer(org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTreeViewer) SampleProfField(org.eclipse.linuxtools.internal.gprof.view.fields.SampleProfField)

Aggregations

AbstractSTTreeViewer (org.eclipse.linuxtools.dataviewers.abstractviewers.AbstractSTTreeViewer)2 GmonDecoder (org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder)2 SampleProfField (org.eclipse.linuxtools.internal.gprof.view.fields.SampleProfField)2 TreeColumn (org.eclipse.swt.widgets.TreeColumn)2 SwitchSampleTimeAction (org.eclipse.linuxtools.internal.gprof.action.SwitchSampleTimeAction)1