Search in sources :

Example 6 with ClassFilter

use of com.intellij.ui.classFilter.ClassFilter in project intellij-community by JetBrains.

the class JavaCoverageEnabledConfiguration method writeExternal.

@Override
public void writeExternal(Element element) throws WriteExternalException {
    // just for backward compatibility with settings format before "Huge Coverage Refactoring"
    // see [IDEA-56800] ProjectRunConfigurationManager component: "coverage" extension: "merge" attribute is misplaced
    // here we can't use super.writeExternal(...) due to differences in format between IDEA 10 and IDEA 9.x
    // enabled
    element.setAttribute(COVERAGE_ENABLED_ATTRIBUTE_NAME, String.valueOf(isCoverageEnabled()));
    // merge with prev
    element.setAttribute(COVERAGE_MERGE_ATTRIBUTE_NAME, String.valueOf(myIsMergeWithPreviousResults));
    if (myIsMergeWithPreviousResults && mySuiteToMergeWith != null) {
        element.setAttribute(COVERAGE_MERGE_SUITE_ATT_NAME, mySuiteToMergeWith);
    }
    // track per test
    final boolean trackPerTestCoverage = isTrackPerTestCoverage();
    if (!trackPerTestCoverage) {
        element.setAttribute(TRACK_PER_TEST_COVERAGE_ATTRIBUTE_NAME, String.valueOf(trackPerTestCoverage));
    }
    // sampling
    final boolean sampling = isSampling();
    if (sampling) {
        element.setAttribute(SAMPLING_COVERAGE_ATTRIBUTE_NAME, String.valueOf(sampling));
    }
    // test folders
    final boolean trackTestFolders = isTrackTestFolders();
    if (trackTestFolders) {
        element.setAttribute(TRACK_TEST_FOLDERS, String.valueOf(trackTestFolders));
    }
    // runner
    final CoverageRunner coverageRunner = getCoverageRunner();
    final String runnerId = getRunnerId();
    if (coverageRunner != null) {
        element.setAttribute(COVERAGE_RUNNER, coverageRunner.getId());
    } else if (runnerId != null) {
        element.setAttribute(COVERAGE_RUNNER, runnerId);
    }
    // patterns
    if (myCoveragePatterns != null) {
        for (ClassFilter pattern : myCoveragePatterns) {
            @NonNls final Element patternElement = new Element(COVERAGE_PATTERN_ELEMENT_NAME);
            DefaultJDOMExternalizer.writeExternal(pattern, patternElement);
            element.addContent(patternElement);
        }
    }
}
Also used : NonNls(org.jetbrains.annotations.NonNls) CoverageRunner(com.intellij.coverage.CoverageRunner) IDEACoverageRunner(com.intellij.coverage.IDEACoverageRunner) JavaCoverageRunner(com.intellij.coverage.JavaCoverageRunner) ClassFilter(com.intellij.ui.classFilter.ClassFilter) Element(org.jdom.Element)

Example 7 with ClassFilter

use of com.intellij.ui.classFilter.ClassFilter in project intellij-community by JetBrains.

the class ExecutionWithDebuggerToolsTestCase method readClassFilters.

private static Pair<ClassFilter[], ClassFilter[]> readClassFilters(String filtersString) {
    ArrayList<ClassFilter> include = new ArrayList<>();
    ArrayList<ClassFilter> exclude = new ArrayList<>();
    for (String s : filtersString.split(",")) {
        ClassFilter filter = new ClassFilter();
        filter.setEnabled(true);
        if (s.startsWith("-")) {
            exclude.add(filter);
            s = s.substring(1);
        } else {
            include.add(filter);
        }
        filter.setPattern(s);
    }
    return Pair.create(include.toArray(ClassFilter.EMPTY_ARRAY), exclude.toArray(ClassFilter.EMPTY_ARRAY));
}
Also used : ClassFilter(com.intellij.ui.classFilter.ClassFilter) ArrayList(java.util.ArrayList)

Example 8 with ClassFilter

use of com.intellij.ui.classFilter.ClassFilter in project kotlin by JetBrains.

the class KotlinBreakpointFiltersPanel method updateClassFilterEditor.

private void updateClassFilterEditor(boolean updateText) {
    List<String> filters = new ArrayList<String>();
    for (ClassFilter classFilter : myClassFilters) {
        if (classFilter.isEnabled()) {
            filters.add(classFilter.getPattern());
        }
    }
    List<String> excludeFilters = new ArrayList<String>();
    for (ClassFilter classFilter : myClassExclusionFilters) {
        if (classFilter.isEnabled()) {
            excludeFilters.add("-" + classFilter.getPattern());
        }
    }
    if (updateText) {
        String editorText = StringUtil.join(filters, " ");
        if (!filters.isEmpty()) {
            editorText += " ";
        }
        editorText += StringUtil.join(excludeFilters, " ");
        myClassFiltersField.setText(editorText);
    }
    int width = (int) Math.sqrt(myClassExclusionFilters.length + myClassFilters.length) + 1;
    String tipText = concatWithEx(filters, " ", width, "\n");
    if (!filters.isEmpty()) {
        tipText += "\n";
    }
    tipText += concatWithEx(excludeFilters, " ", width, "\n");
    myClassFiltersField.getTextField().setToolTipText(tipText);
}
Also used : ClassFilter(com.intellij.ui.classFilter.ClassFilter) ArrayList(java.util.ArrayList) XBreakpoint(com.intellij.xdebugger.breakpoints.XBreakpoint)

Example 9 with ClassFilter

use of com.intellij.ui.classFilter.ClassFilter in project kotlin by JetBrains.

the class KotlinBreakpointFiltersPanel method reloadClassFilters.

private void reloadClassFilters() {
    String filtersText = myClassFiltersField.getText();
    ArrayList<ClassFilter> classFilters = new ArrayList<ClassFilter>();
    ArrayList<ClassFilter> exclusionFilters = new ArrayList<ClassFilter>();
    int startFilter = -1;
    for (int i = 0; i <= filtersText.length(); i++) {
        if (i < filtersText.length() && !Character.isWhitespace(filtersText.charAt(i))) {
            if (startFilter == -1) {
                startFilter = i;
            }
        } else {
            if (startFilter >= 0) {
                if (filtersText.charAt(startFilter) == '-') {
                    exclusionFilters.add(new ClassFilter(filtersText.substring(startFilter + 1, i)));
                } else {
                    classFilters.add(new ClassFilter(filtersText.substring(startFilter, i)));
                }
                startFilter = -1;
            }
        }
    }
    for (ClassFilter classFilter : myClassFilters) {
        if (!classFilter.isEnabled()) {
            classFilters.add(classFilter);
        }
    }
    for (ClassFilter classFilter : myClassExclusionFilters) {
        if (!classFilter.isEnabled()) {
            exclusionFilters.add(classFilter);
        }
    }
    myClassFilters = classFilters.toArray(new ClassFilter[classFilters.size()]);
    myClassExclusionFilters = exclusionFilters.toArray(new ClassFilter[exclusionFilters.size()]);
}
Also used : ClassFilter(com.intellij.ui.classFilter.ClassFilter) ArrayList(java.util.ArrayList) XBreakpoint(com.intellij.xdebugger.breakpoints.XBreakpoint)

Example 10 with ClassFilter

use of com.intellij.ui.classFilter.ClassFilter in project intellij-community by JetBrains.

the class DebugProcessImpl method getActiveFilters.

@NotNull
private static List<ClassFilter> getActiveFilters() {
    DebuggerSettings settings = DebuggerSettings.getInstance();
    StreamEx<ClassFilter> stream = StreamEx.of(Extensions.getExtensions(DebuggerClassFilterProvider.EP_NAME)).flatCollection(DebuggerClassFilterProvider::getFilters);
    if (settings.TRACING_FILTERS_ENABLED) {
        stream = stream.prepend(settings.getSteppingFilters());
    }
    return stream.filter(ClassFilter::isEnabled).toList();
}
Also used : DebuggerSettings(com.intellij.debugger.settings.DebuggerSettings) DebuggerClassFilterProvider(com.intellij.ui.classFilter.DebuggerClassFilterProvider) ClassFilter(com.intellij.ui.classFilter.ClassFilter) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ClassFilter (com.intellij.ui.classFilter.ClassFilter)18 ArrayList (java.util.ArrayList)6 Project (com.intellij.openapi.project.Project)3 NotNull (org.jetbrains.annotations.NotNull)3 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)2 DebuggerSettings (com.intellij.debugger.settings.DebuggerSettings)2 PsiClass (com.intellij.psi.PsiClass)2 DebuggerClassFilterProvider (com.intellij.ui.classFilter.DebuggerClassFilterProvider)2 XBreakpoint (com.intellij.xdebugger.breakpoints.XBreakpoint)2 Element (org.jdom.Element)2 CoverageRunner (com.intellij.coverage.CoverageRunner)1 IDEACoverageRunner (com.intellij.coverage.IDEACoverageRunner)1 JavaCoverageRunner (com.intellij.coverage.JavaCoverageRunner)1 InstanceFilter (com.intellij.debugger.InstanceFilter)1 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)1 TextWithImportsImpl (com.intellij.debugger.engine.evaluation.TextWithImportsImpl)1 DebuggerCommandImpl (com.intellij.debugger.engine.events.DebuggerCommandImpl)1 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)1 StackFrameProxyImpl (com.intellij.debugger.jdi.StackFrameProxyImpl)1 JavaCoverageEnabledConfiguration (com.intellij.execution.configurations.coverage.JavaCoverageEnabledConfiguration)1