From 47d2cac9cac5bca5bf19a0444b9ec585c43b5770 Mon Sep 17 00:00:00 2001 From: Calixte Bonsart Date: Thu, 23 Apr 2026 13:27:32 -0400 Subject: [PATCH] Issue #451: add MatchXpath#settersHaveSinceTag to checkstyle config --- config/checkstyle-checks.xml | 13 + .../CheckConfigurationConfigureDialog.java | 26 +- .../ui/stats/data/CreateStatsJob.java | 2 +- .../ui/stats/views/AbstractStatsView.java | 46 +- .../internal/CheckstyleMarkerFilter.java | 411 +++++------------- .../CheckstyleMarkerFilterDialog.java | 51 +-- 6 files changed, 168 insertions(+), 381 deletions(-) diff --git a/config/checkstyle-checks.xml b/config/checkstyle-checks.xml index 9cecd89dd..f37f7634a 100644 --- a/config/checkstyle-checks.xml +++ b/config/checkstyle-checks.xml @@ -443,6 +443,19 @@ value="'@noinspection' Javadoc tags should be accompanied by a '@noinspectionreason' tag, explaining why we suppressed inspection."/> + + + + + oldProjects = CheckstyleMarkerFilter.getProjectsAsCollection(oldResources); - Collection newProjects = CheckstyleMarkerFilter.getProjectsAsCollection(newResources); - - return oldProjects.size() != newProjects.size() || !newProjects.containsAll(oldProjects); + return CheckstyleMarkerFilter.getProjects(oldResources) + .equals(CheckstyleMarkerFilter.getProjects(newResources)); } return true; diff --git a/net.sf.eclipsecs.ui/src/net/sf/eclipsecs/ui/stats/views/internal/CheckstyleMarkerFilter.java b/net.sf.eclipsecs.ui/src/net/sf/eclipsecs/ui/stats/views/internal/CheckstyleMarkerFilter.java index f92fb4f4b..e680d005d 100644 --- a/net.sf.eclipsecs.ui/src/net/sf/eclipsecs/ui/stats/views/internal/CheckstyleMarkerFilter.java +++ b/net.sf.eclipsecs.ui/src/net/sf/eclipsecs/ui/stats/views/internal/CheckstyleMarkerFilter.java @@ -24,9 +24,10 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.HashSet; import java.util.List; import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IProject; @@ -44,8 +45,26 @@ /** * Filter class for Checkstyle markers. This filter is used by the Checkstyle statistics views. * + * @param enabled + * Determines if this filter is enabled. + * @param onResource + * The selection mode (e.g., ON_ANY_RESOURCE, ON_SELECTED_RESOURCE, etc.). + * @param workingSet + * The selected working set to filter by, if the mode is ON_WORKING_SET. + * @param selectBySeverity + * Flags if the severity-based filtering is active. + * @param severity + * The bitmask of selected severities (Error, Warning, Info). + * @param filterByRegex + * Flags if the regular expression-based filtering is enabled. + * @param filterRegex + * The list of regular expressions used to exclude markers by their message. + * @param focusResources + * The transient resources currently focused in the workbench. */ -public class CheckstyleMarkerFilter implements Cloneable { +public record CheckstyleMarkerFilter(boolean enabled, int onResource, IWorkingSet workingSet, + boolean selectBySeverity, int severity, boolean filterByRegex, List filterRegex, + IResource[] focusResources) { // // constants @@ -90,38 +109,15 @@ public class CheckstyleMarkerFilter implements Cloneable { private static final boolean DEFAULT_ACTIVATION_STATUS = true; - // - // attributes - // - - /** Determines if this filter is enabled. */ - private boolean mEnabled; - - /** The selection mode. */ - private int mOnResource; - - /** The selected working set. */ - private IWorkingSet mWorkingSet; - - /** Flags if the severity filtering is active. */ - private boolean mSelectBySeverity; - - /** The selected severity. */ - private int mSeverity; - - /** The focused resources within the current workbench page. */ - private IResource[] mFocusResources; - - /** Flags if the regex filter is enabled. */ - private boolean mFilterByRegex; - - /** List of regular expressions used to filter messages. */ - private List mFilterRegex; - // // methods // + public CheckstyleMarkerFilter withFocusResources(IResource[] resources) { + return new CheckstyleMarkerFilter(enabled, onResource, workingSet, selectBySeverity, + severity, filterByRegex, filterRegex, resources); + } + /** * Searches the workspace for markers that pass this filter. * @@ -135,8 +131,8 @@ public IMarker[] findMarkers(IProgressMonitor mon) throws CoreException { List unfiltered = Collections.emptyList(); - if (isEnabled()) { - switch (getOnResource()) { + if (enabled) { + switch (onResource) { case ON_ANY_RESOURCE: { unfiltered = findCheckstyleMarkers( new IResource[] { ResourcesPlugin.getWorkspace().getRoot() }, @@ -144,20 +140,20 @@ public IMarker[] findMarkers(IProgressMonitor mon) throws CoreException { break; } case ON_SELECTED_RESOURCE_ONLY: { - unfiltered = findCheckstyleMarkers(mFocusResources, IResource.DEPTH_ZERO, mon); + unfiltered = findCheckstyleMarkers(focusResources, IResource.DEPTH_ZERO, mon); break; } case ON_SELECTED_RESOURCE_AND_CHILDREN: { - unfiltered = findCheckstyleMarkers(mFocusResources, IResource.DEPTH_INFINITE, mon); + unfiltered = findCheckstyleMarkers(focusResources, IResource.DEPTH_INFINITE, mon); break; } case ON_ANY_RESOURCE_OF_SAME_PROJECT: { - unfiltered = findCheckstyleMarkers(getProjects(mFocusResources), IResource.DEPTH_INFINITE, - mon); + unfiltered = findCheckstyleMarkers(getProjects(focusResources).toArray(new IResource[0]), + IResource.DEPTH_INFINITE, mon); break; } case ON_WORKING_SET: { - unfiltered = findCheckstyleMarkers(getResourcesInWorkingSet(mWorkingSet), + unfiltered = findCheckstyleMarkers(getResourcesInWorkingSet(workingSet), IResource.DEPTH_INFINITE, mon); break; } @@ -178,231 +174,66 @@ public IMarker[] findMarkers(IProgressMonitor mon) throws CoreException { return unfiltered.toArray(new IMarker[unfiltered.size()]); } - /** - * @return - *
    - *
  • MarkerFilter.ON_ANY_RESOURCE if showing items associated with any - * resource.
  • - *
  • MarkerFilter.ON_SELECTED_RESOURCE_ONLY if showing items associated - * with the selected resource within the workbench.
  • - *
  • MarkerFilter.ON_SELECTED_RESOURCE_AND_CHILDREN if showing items - * associated with the selected resource within the workbench and its children.
  • - *
  • MarkerFilter.ON_ANY_RESOURCE_OF_SAME_PROJECT if showing items in the - * same project as the selected resource within the workbench.
  • - *
  • MarkerFilter.ON_WORKING_SET if showing items in some working set.
  • - *
- */ - public int getOnResource() { - return mOnResource; - } - - /** - * Sets the type of filtering by selection. - * - * @param onResource - * must be one of: - *
    - *
  • MarkerFilter.ON_ANY_RESOURCE
  • - *
  • MarkerFilter.ON_SELECTED_RESOURCE_ONLY
  • - *
  • MarkerFilter.ON_SELECTED_RESOURCE_AND_CHILDREN
  • - *
  • MarkerFilter.ON_ANY_RESOURCE_OF_SAME_PROJECT
  • - *
  • MarkerFilter.ON_WORKING_SET
  • - *
- */ - public void setOnResource(int onResource) { - if (onResource >= ON_ANY_RESOURCE && onResource <= ON_WORKING_SET) { - this.mOnResource = onResource; - } - } - - /** - * Returns the selected resource. - * - * @return the selected resource(s) within the workbench. - */ - public IResource[] getFocusResource() { - return mFocusResources; - } - - /** - * Sets the focused resources. - * - * @param resources - * the focused resources - */ - public void setFocusResource(IResource[] resources) { - mFocusResources = resources; - } - - /** - * @return - *
    - *
  • true if the filter is enabled.
  • - *
  • false if the filter is not enabled.
  • - *
- */ - public boolean isEnabled() { - return mEnabled; - } - - /** - * Sets the enablement state of the filter. - * - * @param enabled - * the enablement - */ - public void setEnabled(boolean enabled) { - this.mEnabled = enabled; - } - - /** - * Returns the current working set. - * - * @return the current working set or null if no working set is defined. - */ - public IWorkingSet getWorkingSet() { - return mWorkingSet; - } - - /** - * Sets the current working set. - * - * @param workingSet - * the working set - */ - public void setWorkingSet(IWorkingSet workingSet) { - this.mWorkingSet = workingSet; - } - - /** - * Returns if the markers will be selected by severity. - * - * @return true if markers will be selected by severity - */ - public boolean getSelectBySeverity() { - return mSelectBySeverity; - } - - /** - * Sets if the markers will be selected by severity. - * - * @param selectBySeverity - * true if markers will be selected by severity - */ - public void setSelectBySeverity(boolean selectBySeverity) { - this.mSelectBySeverity = selectBySeverity; - } - - /** - * Returns the severity. - * - * @return the severity - */ - public int getSeverity() { - return mSeverity; - } - - /** - * Sets the severity. - * - * @param severity - * the severity - */ - public void setSeverity(int severity) { - this.mSeverity = severity; - } - - /** - * Returns if the regex filter is enabled. - * - * @return true if the regex filter is enabled - */ - public boolean isFilterByRegex() { - return mFilterByRegex; - } - - /** - * Sets if the regex filter is enabled. - * - * @param filterByRegex - * true if messages are filtered by the regular expressions - */ - public void setFilterByRegex(boolean filterByRegex) { - mFilterByRegex = filterByRegex; - } - - /** - * Returns the regular expressions. - * - * @return the regular expressions - */ - public List getFilterRegex() { - return mFilterRegex; - } - - /** - * Sets the list of regular expressions. - * - * @param filterRegex - * the list of regular expression to filter by - */ - public void setFilterRegex(List filterRegex) { - mFilterRegex = filterRegex; - } - /** * Restores the state of the filter from the given dialog settings. * * @param dialogSettings * the dialog settings + * @param focusResource */ - public void restoreState(IDialogSettings dialogSettings) { - resetState(); + public static CheckstyleMarkerFilter restoreState(IDialogSettings dialogSettings, IResource[] focusResource) { IDialogSettings settings = dialogSettings.getSection(TAG_DIALOG_SECTION); - if (settings == null) { - return; - } - - findBooleanSetting(settings, TAG_ENABLED) - .ifPresent(setting -> mEnabled = setting); - findBooleanSetting(settings, TAG_SELECT_BY_SEVERITY) - .ifPresent(setting -> mSelectBySeverity = setting); - findBooleanSetting(settings, TAG_SELECT_BY_REGEX) - .ifPresent(setting -> mFilterByRegex = setting); - - String setting = settings.get(TAG_ON_RESOURCE); - if (setting != null) { - try { - mOnResource = Integer.parseInt(setting); - } catch (NumberFormatException ex) { - // ignore and use default value - } - } - - setting = settings.get(TAG_WORKING_SET); - if (setting != null) { - setWorkingSet(PlatformUI.getWorkbench().getWorkingSetManager() - .getWorkingSet(setting)); - } - setting = settings.get(TAG_SEVERITY); - if (setting != null) { - try { - mSeverity = Integer.parseInt(setting); - } catch (NumberFormatException ex) { - // ignore and use default value - } - } - + boolean enabled = findSetting(settings, TAG_ENABLED) + .map(Boolean::parseBoolean) + .orElse(DEFAULT_ACTIVATION_STATUS); + boolean selectBySeverity = findSetting(settings, TAG_SELECT_BY_SEVERITY) + .map(Boolean::parseBoolean) + .orElse(DEFAULT_SELECT_BY_SEVERITY); + boolean filterByRegex = findSetting(settings, TAG_SELECT_BY_REGEX) + .map(Boolean::parseBoolean) + .orElse(false); + + int mOnResource = findSetting(settings, TAG_ON_RESOURCE) + .flatMap(setting -> { + try { + return Optional.of(Integer.parseInt(setting)); + } catch (NumberFormatException ex) { + return Optional.empty(); + } + }) + .orElse(DEFAULT_ON_RESOURCE); + + IWorkingSet mWorkingSet = findSetting(settings, TAG_WORKING_SET) + .map(PlatformUI.getWorkbench().getWorkingSetManager()::getWorkingSet) + .orElse(null); + + int mSeverity = findSetting(settings, TAG_SEVERITY) + .flatMap(setting -> { + try { + return Optional.of(Integer.parseInt(setting)); + } catch (NumberFormatException ex) { + return Optional.empty(); + } + }) + .orElse(DEFAULT_SEVERITY); + + List mFilterRegex; String[] regex = settings.getArray(TAG_REGULAR_EXPRESSIONS); if (regex != null) { mFilterRegex = Arrays.asList(regex); + } else { + mFilterRegex = new ArrayList<>(); } + + return new CheckstyleMarkerFilter(enabled, mOnResource, mWorkingSet, selectBySeverity, + mSeverity, filterByRegex, mFilterRegex, focusResource); } - private static Optional findBooleanSetting(IDialogSettings dialogSettings, + private static Optional findSetting(IDialogSettings dialogSettings, String key) { - return Optional.ofNullable(dialogSettings.get(key)).map(Boolean::parseBoolean); + return Optional.ofNullable(dialogSettings) + .flatMap(settings -> Optional.ofNullable(settings.get(key))); } /** @@ -419,36 +250,32 @@ public void saveState(IDialogSettings dialogSettings) { settings = dialogSettings.addNewSection(TAG_DIALOG_SECTION); } - settings.put(TAG_ENABLED, mEnabled); - settings.put(TAG_ON_RESOURCE, mOnResource); + settings.put(TAG_ENABLED, enabled); + settings.put(TAG_ON_RESOURCE, onResource); - if (mWorkingSet != null) { - settings.put(TAG_WORKING_SET, mWorkingSet.getName()); + if (workingSet != null) { + settings.put(TAG_WORKING_SET, workingSet.getName()); } - settings.put(TAG_SELECT_BY_SEVERITY, mSelectBySeverity); - settings.put(TAG_SEVERITY, mSeverity); + settings.put(TAG_SELECT_BY_SEVERITY, selectBySeverity); + settings.put(TAG_SEVERITY, severity); - settings.put(TAG_SELECT_BY_REGEX, mFilterByRegex); + settings.put(TAG_SELECT_BY_REGEX, filterByRegex); - if (mFilterRegex != null) { + if (filterRegex != null) { settings.put(TAG_REGULAR_EXPRESSIONS, - mFilterRegex.toArray(new String[mFilterRegex.size()])); + filterRegex.toArray(new String[filterRegex.size()])); } } } /** * Restores the default state of the filter. + * @param focusResources */ - public void resetState() { - mEnabled = DEFAULT_ACTIVATION_STATUS; - mOnResource = DEFAULT_ON_RESOURCE; - setWorkingSet(null); - mSelectBySeverity = DEFAULT_SELECT_BY_SEVERITY; - mSeverity = DEFAULT_SEVERITY; - mFilterByRegex = false; - mFilterRegex = new ArrayList<>(); + public static CheckstyleMarkerFilter resetState(IResource[] focusResources) { + return new CheckstyleMarkerFilter(DEFAULT_ACTIVATION_STATUS, DEFAULT_ON_RESOURCE, null, + DEFAULT_SELECT_BY_SEVERITY, DEFAULT_SEVERITY, false, new ArrayList<>(), focusResources); } /** @@ -480,22 +307,22 @@ private List findCheckstyleMarkers(IResource[] resources, int depth, IP } } - if (!mEnabled) { + if (!enabled) { return resultList; } - if (mSelectBySeverity) { + if (selectBySeverity) { // further filter the markers by severity int size = resultList.size(); for (int i = size - 1; i >= 0; i--) { IMarker marker = resultList.get(i); - if (!selectBySeverity(marker)) { + if (!doSelectBySeverity(marker)) { resultList.remove(i); } } } - if (mFilterByRegex) { + if (filterByRegex) { // further filter the markers by regular expressions int size = resultList.size(); for (int i = size - 1; i >= 0; i--) { @@ -516,15 +343,15 @@ private List findCheckstyleMarkers(IResource[] resources, int depth, IP * the marker * @return true if the marker is selected */ - private boolean selectBySeverity(IMarker item) { - if (mSelectBySeverity) { + private boolean doSelectBySeverity(IMarker item) { + if (selectBySeverity) { int markerSeverity = item.getAttribute(IMarker.SEVERITY, -1); if (markerSeverity == IMarker.SEVERITY_ERROR) { - return (mSeverity & SEVERITY_ERROR) > 0; + return (severity & SEVERITY_ERROR) > 0; } else if (markerSeverity == IMarker.SEVERITY_WARNING) { - return (mSeverity & SEVERITY_WARNING) > 0; + return (severity & SEVERITY_WARNING) > 0; } else if (markerSeverity == IMarker.SEVERITY_INFO) { - return (mSeverity & SEVERITY_INFO) > 0; + return (severity & SEVERITY_INFO) > 0; } } @@ -540,12 +367,12 @@ private boolean selectBySeverity(IMarker item) { */ private boolean selectByRegex(IMarker item) { - if (mFilterByRegex) { + if (filterByRegex) { - int size = mFilterRegex != null ? mFilterRegex.size() : 0; + int size = filterRegex != null ? filterRegex.size() : 0; for (int i = 0; i < size; i++) { - String regex = mFilterRegex.get(i); + String regex = filterRegex.get(i); String message = item.getAttribute(IMarker.MESSAGE, null); @@ -558,18 +385,6 @@ private boolean selectByRegex(IMarker item) { } - /** - * Returns the set of projects that contain the given set of resources. - * - * @param resources - * the resources - * @return the array of projects for the given resources - */ - private static IProject[] getProjects(IResource[] resources) { - Collection projects = getProjectsAsCollection(resources); - return projects.toArray(new IProject[projects.size()]); - } - /** * Returns the set of projects that contain the given set of resources. * @@ -577,13 +392,10 @@ private static IProject[] getProjects(IResource[] resources) { * the resources * @return the collection of projects for the given resources */ - public static Collection getProjectsAsCollection(IResource[] resources) { - HashSet projects = new HashSet<>(); - - for (int idx = 0, size = resources != null ? resources.length : 0; idx < size; idx++) { - projects.add(resources[idx].getProject()); - } - return projects; + public static Set getProjects(IResource[] resources) { + return Arrays.stream(resources) + .map(IResource::getProject) + .collect(Collectors.toSet()); } /** @@ -612,13 +424,4 @@ private static IResource[] getResourcesInWorkingSet(IWorkingSet workingSet) { return result.toArray(new IResource[result.size()]); } - @Override - public Object clone() { - try { - return super.clone(); - } catch (CloneNotSupportedException ex) { - // this should never happen - throw new InternalError(ex); - } - } } diff --git a/net.sf.eclipsecs.ui/src/net/sf/eclipsecs/ui/stats/views/internal/CheckstyleMarkerFilterDialog.java b/net.sf.eclipsecs.ui/src/net/sf/eclipsecs/ui/stats/views/internal/CheckstyleMarkerFilterDialog.java index 911623d65..f1609e7e3 100644 --- a/net.sf.eclipsecs.ui/src/net/sf/eclipsecs/ui/stats/views/internal/CheckstyleMarkerFilterDialog.java +++ b/net.sf.eclipsecs.ui/src/net/sf/eclipsecs/ui/stats/views/internal/CheckstyleMarkerFilterDialog.java @@ -289,33 +289,33 @@ protected void okPressed() { */ private void updateUIFromFilter() { - mChkFilterEnabled.setSelection(mFilter.isEnabled()); + mChkFilterEnabled.setSelection(mFilter.enabled()); mRadioOnAnyResource - .setSelection(mFilter.getOnResource() == CheckstyleMarkerFilter.ON_ANY_RESOURCE); + .setSelection(mFilter.onResource() == CheckstyleMarkerFilter.ON_ANY_RESOURCE); mRadioAnyResourceInSameProject.setSelection( - mFilter.getOnResource() == CheckstyleMarkerFilter.ON_ANY_RESOURCE_OF_SAME_PROJECT); + mFilter.onResource() == CheckstyleMarkerFilter.ON_ANY_RESOURCE_OF_SAME_PROJECT); mRadioSelectedResource.setSelection( - mFilter.getOnResource() == CheckstyleMarkerFilter.ON_SELECTED_RESOURCE_ONLY); + mFilter.onResource() == CheckstyleMarkerFilter.ON_SELECTED_RESOURCE_ONLY); mRadioSelectedResourceAndChildren.setSelection( - mFilter.getOnResource() == CheckstyleMarkerFilter.ON_SELECTED_RESOURCE_AND_CHILDREN); + mFilter.onResource() == CheckstyleMarkerFilter.ON_SELECTED_RESOURCE_AND_CHILDREN); mRadioSelectedWorkingSet - .setSelection(mFilter.getOnResource() == CheckstyleMarkerFilter.ON_WORKING_SET); + .setSelection(mFilter.onResource() == CheckstyleMarkerFilter.ON_WORKING_SET); - mSelectedWorkingSet = mFilter.getWorkingSet(); + mSelectedWorkingSet = mFilter.workingSet(); initWorkingSetLabel(); - mChkSeverityEnabled.setSelection(mFilter.getSelectBySeverity()); + mChkSeverityEnabled.setSelection(mFilter.selectBySeverity()); mChkSeverityError - .setSelection((mFilter.getSeverity() & CheckstyleMarkerFilter.SEVERITY_ERROR) > 0); + .setSelection((mFilter.severity() & CheckstyleMarkerFilter.SEVERITY_ERROR) > 0); mChkSeverityWarning - .setSelection((mFilter.getSeverity() & CheckstyleMarkerFilter.SEVERITY_WARNING) > 0); + .setSelection((mFilter.severity() & CheckstyleMarkerFilter.SEVERITY_WARNING) > 0); mChkSeverityInfo - .setSelection((mFilter.getSeverity() & CheckstyleMarkerFilter.SEVERITY_INFO) > 0); + .setSelection((mFilter.severity() & CheckstyleMarkerFilter.SEVERITY_INFO) > 0); - mChkSelectByRegex.setSelection(mFilter.isFilterByRegex()); - mRegularExpressions = mFilter.getFilterRegex(); + mChkSelectByRegex.setSelection(mFilter.filterByRegex()); + mRegularExpressions = mFilter.filterRegex(); initRegexLabel(); mController.updateControlState(); @@ -325,24 +325,19 @@ private void updateUIFromFilter() { * Updates the filter data from the ui controls. */ private void updateFilterFromUI() { - - mFilter.setEnabled(mChkFilterEnabled.getSelection()); - + int onResource; if (mRadioSelectedResource.getSelection()) { - mFilter.setOnResource(CheckstyleMarkerFilter.ON_SELECTED_RESOURCE_ONLY); + onResource = CheckstyleMarkerFilter.ON_SELECTED_RESOURCE_ONLY; } else if (mRadioSelectedResourceAndChildren.getSelection()) { - mFilter.setOnResource(CheckstyleMarkerFilter.ON_SELECTED_RESOURCE_AND_CHILDREN); + onResource = CheckstyleMarkerFilter.ON_SELECTED_RESOURCE_AND_CHILDREN; } else if (mRadioAnyResourceInSameProject.getSelection()) { - mFilter.setOnResource(CheckstyleMarkerFilter.ON_ANY_RESOURCE_OF_SAME_PROJECT); + onResource = CheckstyleMarkerFilter.ON_ANY_RESOURCE_OF_SAME_PROJECT; } else if (mRadioSelectedWorkingSet.getSelection()) { - mFilter.setOnResource(CheckstyleMarkerFilter.ON_WORKING_SET); + onResource = CheckstyleMarkerFilter.ON_WORKING_SET; } else { - mFilter.setOnResource(CheckstyleMarkerFilter.ON_ANY_RESOURCE); + onResource = CheckstyleMarkerFilter.ON_ANY_RESOURCE; } - mFilter.setWorkingSet(mSelectedWorkingSet); - - mFilter.setSelectBySeverity(mChkSeverityEnabled.getSelection()); int severity = 0; if (mChkSeverityError.getSelection()) { severity = severity | CheckstyleMarkerFilter.SEVERITY_ERROR; @@ -353,10 +348,10 @@ private void updateFilterFromUI() { if (mChkSeverityInfo.getSelection()) { severity = severity | CheckstyleMarkerFilter.SEVERITY_INFO; } - mFilter.setSeverity(severity); - mFilter.setFilterByRegex(mChkSelectByRegex.getSelection()); - mFilter.setFilterRegex(mRegularExpressions); + mFilter = new CheckstyleMarkerFilter(mChkFilterEnabled.getSelection(), onResource, + mSelectedWorkingSet, mChkSeverityEnabled.getSelection(), severity, + mChkSelectByRegex.getSelection(), mRegularExpressions, mFilter.focusResources()); } /** @@ -404,7 +399,7 @@ public void widgetSelected(SelectionEvent e) { if (e.widget == mChkFilterEnabled || e.widget == mChkSeverityEnabled) { updateControlState(); } else if (mBtnDefault == e.widget) { - mFilter.resetState(); + mFilter = CheckstyleMarkerFilter.resetState(mFilter.focusResources()); updateUIFromFilter(); } else if (mBtnWorkingSet == e.widget) { IWorkingSetSelectionDialog dialog = PlatformUI.getWorkbench().getWorkingSetManager()