Search in sources :

Example 1 with STExportToCSVAction

use of org.eclipse.linuxtools.dataviewers.actions.STExportToCSVAction in project linuxtools by eclipse.

the class GcovTest method testGcovSummary.

private void testGcovSummary(final String filename, String binPath, final boolean testProducedReference) {
    openGcovResult(project.getFile(filename), binPath, true);
    IViewPart vp = window.getActivePage().findView("org.eclipse.linuxtools.gcov.view");
    // No IDs on toolbar items, so explicitly check each one for tooltip texts
    List<String> sortTypes = new ArrayList<>(Arrays.asList("function", "file", "folder"));
    IContributionItem[] items = vp.getViewSite().getActionBars().getToolBarManager().getItems();
    STExportToCSVAction csvAction = null;
    for (IContributionItem item : items) {
        if (item instanceof ActionContributionItem && ((ActionContributionItem) item).getAction() instanceof STExportToCSVAction) {
            csvAction = (STExportToCSVAction) ((ActionContributionItem) item).getAction();
        }
    }
    Assert.assertNotNull("CSV-Export toolbar button does not exist.", csvAction);
    for (IContributionItem item : items) {
        if (item instanceof ActionContributionItem) {
            final IAction action = ((ActionContributionItem) item).getAction();
            for (int i = 0, n = sortTypes.size(); i < n; i++) {
                String sortType = sortTypes.get(i);
                if (action.getText().equals("Sort coverage per " + sortType)) {
                    dumpCSV(action, csvAction, sortType, testProducedReference);
                    if (sortTypes.size() == 1) {
                        return;
                    }
                    sortTypes.remove(i);
                    break;
                }
            }
        }
    }
}
Also used : IViewPart(org.eclipse.ui.IViewPart) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) STExportToCSVAction(org.eclipse.linuxtools.dataviewers.actions.STExportToCSVAction) IAction(org.eclipse.jface.action.IAction) IContributionItem(org.eclipse.jface.action.IContributionItem) ArrayList(java.util.ArrayList)

Example 2 with STExportToCSVAction

use of org.eclipse.linuxtools.dataviewers.actions.STExportToCSVAction in project linuxtools by eclipse.

the class GmonView method createExportToCSVAction.

@Override
protected IAction createExportToCSVAction() {
    IAction action = new STExportToCSVAction(this.getSTViewer()) {

        @Override
        public void run() {
            Object o = getSTViewer().getInput();
            if (o instanceof GmonDecoder) {
                GmonDecoder gd = (GmonDecoder) o;
                // $NON-NLS-1$
                getExporter().setFilePath(gd.getGmonFile() + ".csv");
            }
            super.run();
        }
    };
    return action;
}
Also used : STExportToCSVAction(org.eclipse.linuxtools.dataviewers.actions.STExportToCSVAction) IAction(org.eclipse.jface.action.IAction) GmonDecoder(org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder) IBinaryObject(org.eclipse.cdt.core.IBinaryParser.IBinaryObject)

Example 3 with STExportToCSVAction

use of org.eclipse.linuxtools.dataviewers.actions.STExportToCSVAction in project linuxtools by eclipse.

the class CovView method createExportToCSVAction.

@Override
protected IAction createExportToCSVAction() {
    IAction action = new STExportToCSVAction(this.getSTViewer()) {

        @Override
        public void run() {
            Object o = getSTViewer().getInput();
            if (o instanceof CovManager) {
                getExporter().setFilePath(defaultCSVPath);
            }
            super.run();
        }
    };
    return action;
}
Also used : CovManager(org.eclipse.linuxtools.internal.gcov.parser.CovManager) STExportToCSVAction(org.eclipse.linuxtools.dataviewers.actions.STExportToCSVAction) IAction(org.eclipse.jface.action.IAction)

Aggregations

IAction (org.eclipse.jface.action.IAction)3 STExportToCSVAction (org.eclipse.linuxtools.dataviewers.actions.STExportToCSVAction)3 ArrayList (java.util.ArrayList)1 IBinaryObject (org.eclipse.cdt.core.IBinaryParser.IBinaryObject)1 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)1 IContributionItem (org.eclipse.jface.action.IContributionItem)1 CovManager (org.eclipse.linuxtools.internal.gcov.parser.CovManager)1 GmonDecoder (org.eclipse.linuxtools.internal.gprof.parser.GmonDecoder)1 IViewPart (org.eclipse.ui.IViewPart)1