Use IFile.isContentRestricted() when restricting file search#3841
Use IFile.isContentRestricted() when restricting file search#3841iloveeclipse merged 1 commit intoeclipse-platform:masterfrom
Conversation
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/CompositeImageDescriptor.java
Outdated
Show resolved
Hide resolved
e52c391 to
3750a3c
Compare
Test Results 852 files ±0 852 suites ±0 54m 13s ⏱️ + 4m 20s Results for commit f8338f8. ± Comparison against base commit 0b9521c. This pull request removes 4 and adds 4 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Pull request overview
Updates Eclipse file search restriction handling to use the new Resources API (IFile.isContentRestricted()) instead of relying on a configurable session property name, aligning the implementation with the newly introduced “content restricted” concept (Issue #3815).
Changes:
- Switch file exclusion logic in
TextSearchVisitorto consultIFile.isContentRestricted()when the preferencedisableRestrictedFileSearchis enabled. - Update file search tests to mark resources as restricted via
IFile#setContentRestricted(true)and adjust suite registration for the renamed test class.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
bundles/org.eclipse.search.core/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java |
Replaces session-property based exclusion with isContentRestricted() gated by a new preference key. |
tests/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/RestrictedFilesSearchTest.java |
Updates test setup to mark files as content-restricted and toggles the new preference key. |
tests/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/AllFileSearchTests.java |
Updates the test suite to reference RestrictedFilesSearchTest. |
Comments suppressed due to low confidence (3)
tests/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/RestrictedFilesSearchTest.java:56
- The class-level Javadoc still describes the old mechanism (preference
org.eclipse.search/search_exclusion_property=...and a session propertysearch_excluded_file). The implementation now usesdisableRestrictedFileSearchandIFile#setContentRestricted(...), so the Javadoc should be updated to match the new behavior to avoid misleading future maintainers.
tests/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/RestrictedFilesSearchTest.java:164 - This block still uses the name
sessionProperty(and the helpersetSessionProperty(...)) even though the new behavior is based onIFile#setContentRestricted(true). Consider renaming the parameter/helper to reflect “restricted” rather than “session property” and update the nearby Javadoc accordingly, to keep the test semantics aligned with the new API.
tests/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/RestrictedFilesSearchTest.java:177 - Method name
setSessionProperty(...)is now misleading: it no longer sets a session property but marks files as content-restricted viaIFile#setContentRestricted(true). Rename the method (and any related wording likesessionProperty) to reflect the new restriction mechanism.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
.../org.eclipse.search.core/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java
Outdated
Show resolved
Hide resolved
This change adjusts the initial change for file search restrictions, to use the newly added API: IFile.isContentRestricted() In addition, the respective preference is changed to: disableRestrictedFileSearch Example preference for product customization: org.eclipse.search.core/disableRestrictedFileSearch=true Fixes: eclipse-platform#3815
This change adjusts the initial change for file search restrictions, to use the newly added API:
IFile.isContentRestricted()Fixes: #3815