Search in sources :

Example 1 with LaunchType

use of org.erlide.cover.runtime.launch.LaunchType in project erlide_eclipse by erlang.

the class CoverMainTab method initializeFrom.

@Override
public void initializeFrom(final ILaunchConfiguration config) {
    try {
        final String projectName = config.getAttribute(ICoverAttributes.PROJECT, "");
        projectMBr.setText(projectName);
        if (projectName != null && !projectName.isEmpty()) {
            final IErlProject p = ErlangEngine.getInstance().getModel().getErlangProject(ResourcesPlugin.getWorkspace().getRoot().getProject(projectName));
            if (p != null) {
                moduleDialog.setElements(createModuleArray(p));
            }
        }
    } catch (final CoreException e) {
        projectMBr.setText("");
    }
    try {
        moduleBr.setText(config.getAttribute(ICoverAttributes.MODULE, ""));
    } catch (final CoreException e) {
        moduleBr.setText("");
    }
    try {
        fileBr.setText(config.getAttribute(ICoverAttributes.FILE, ""));
    } catch (final CoreException e) {
        fileBr.setText("");
    }
    try {
        final String type = config.getAttribute(ICoverAttributes.TYPE, LaunchType.MODULE.toString());
        final LaunchType typeT = LaunchType.valueOf(type);
        switch(typeT) {
            case MODULE:
                singleRadio.setSelection(true);
                projectMBr.setEnabled(true);
                moduleBr.setEnabled(true);
                fileBr.setEnabled(false);
                break;
            case ALL:
                allRadio.setSelection(true);
                projectMBr.setEnabled(false);
                moduleBr.setEnabled(false);
                fileBr.setEnabled(true);
                break;
            default:
                singleRadio.setSelection(true);
                projectMBr.setEnabled(true);
                moduleBr.setEnabled(true);
                fileBr.setEnabled(false);
                break;
        }
    } catch (final CoreException e) {
        singleRadio.setSelection(true);
    }
    String combo;
    try {
        combo = config.getAttribute(ICoverAttributes.COMBO, FrameworkType.EUNIT.getRepr());
        final int idx = testCombo.indexOf(combo);
        testCombo.select(idx);
    } catch (final CoreException e) {
        testCombo.select(0);
    }
}
Also used : IErlProject(org.erlide.engine.model.root.IErlProject) CoreException(org.eclipse.core.runtime.CoreException) LaunchType(org.erlide.cover.runtime.launch.LaunchType)

Example 2 with LaunchType

use of org.erlide.cover.runtime.launch.LaunchType in project erlide_eclipse by erlang.

the class CoverMainTab method performApply.

@Override
public void performApply(final ILaunchConfigurationWorkingCopy config) {
    LaunchType type;
    if (allRadio.getSelection()) {
        type = LaunchType.ALL;
    } else {
        type = LaunchType.MODULE;
    }
    config.setAttribute(ICoverAttributes.PROJECT, projectMBr.getText());
    config.setAttribute(ICoverAttributes.MODULE, moduleBr.getText());
    config.setAttribute(ICoverAttributes.FILE, fileBr.getText());
    config.setAttribute(ICoverAttributes.TYPE, type.toString());
    config.setAttribute(ICoverAttributes.COMBO, testCombo.getText());
}
Also used : LaunchType(org.erlide.cover.runtime.launch.LaunchType)

Aggregations

LaunchType (org.erlide.cover.runtime.launch.LaunchType)2 CoreException (org.eclipse.core.runtime.CoreException)1 IErlProject (org.erlide.engine.model.root.IErlProject)1