Search in sources :

Example 1 with BrowserDialog

use of org.erlide.cover.ui.views.util.BrowserDialog in project erlide_eclipse by erlang.

the class HtmlReportAction method run.

@Override
public void run() {
    log.info("html report!");
    if (StatsTreeModel.getInstance().getRoot().getHtmlPath() == null) {
        final IPath location = Activator.getDefault().getStateLocation().append(CoverConstants.REPORT_DIR);
        final File dir = location.toFile();
        if (!dir.exists() && !dir.mkdir()) {
            CoverageHelper.reportError("Can not save results!");
            return;
        }
        generateReportTree(StatsTreeModel.getInstance().getRoot(), dir.getAbsolutePath());
    }
    final ISelection selection = viewer.getSelection();
    log.info(selection.getClass().getName());
    if (!(selection instanceof ITreeSelection)) {
        final IStatus executionStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Internall error occured: bad sellection type", null);
        StatusManager.getManager().handle(executionStatus, StatusManager.SHOW);
        return;
    }
    final ITreeSelection treeSelection = (ITreeSelection) selection;
    log.info(treeSelection.getFirstElement());
    log.info(treeSelection.getFirstElement().getClass().getName());
    log.info(treeSelection.getPaths());
    final StatsTreeObject selObj = (StatsTreeObject) treeSelection.getFirstElement();
    final BrowserDialog browser = new BrowserDialog(shell);
    if (selObj instanceof FunctionStats) {
        final ModuleStats module = (ModuleStats) selObj.getParent();
        browser.setObject(module);
    } else {
        browser.setObject(selObj);
    }
    browser.open();
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) ITreeSelection(org.eclipse.jface.viewers.ITreeSelection) IPath(org.eclipse.core.runtime.IPath) ISelection(org.eclipse.jface.viewers.ISelection) FunctionStats(org.erlide.cover.views.model.FunctionStats) BrowserDialog(org.erlide.cover.ui.views.util.BrowserDialog) StatsTreeObject(org.erlide.cover.views.model.StatsTreeObject) ModuleStats(org.erlide.cover.views.model.ModuleStats) File(java.io.File)

Aggregations

File (java.io.File)1 IPath (org.eclipse.core.runtime.IPath)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 ISelection (org.eclipse.jface.viewers.ISelection)1 ITreeSelection (org.eclipse.jface.viewers.ITreeSelection)1 BrowserDialog (org.erlide.cover.ui.views.util.BrowserDialog)1 FunctionStats (org.erlide.cover.views.model.FunctionStats)1 ModuleStats (org.erlide.cover.views.model.ModuleStats)1 StatsTreeObject (org.erlide.cover.views.model.StatsTreeObject)1