Skip to content

Use IFile.isContentRestricted() when restricting file search#3841

Merged
iloveeclipse merged 1 commit intoeclipse-platform:masterfrom
trancexpress:gh3815
Apr 2, 2026
Merged

Use IFile.isContentRestricted() when restricting file search#3841
iloveeclipse merged 1 commit intoeclipse-platform:masterfrom
trancexpress:gh3815

Conversation

@trancexpress
Copy link
Copy Markdown
Contributor

This change adjusts the initial change for file search restrictions, to use the newly added API: IFile.isContentRestricted()

Fixes: #3815

@trancexpress trancexpress force-pushed the gh3815 branch 2 times, most recently from e52c391 to 3750a3c Compare March 31, 2026 13:48
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 2026

Test Results

   852 files  ±0     852 suites  ±0   54m 13s ⏱️ + 4m 20s
 7 890 tests ±0   7 647 ✅ ±0  243 💤 ±0  0 ❌ ±0 
20 172 runs  ±0  19 516 ✅ ±0  656 💤 ±0  0 ❌ ±0 

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.
org.eclipse.search.tests.filesearch.ExcludedFilesSearchTest ‑ testFileLinks1
org.eclipse.search.tests.filesearch.ExcludedFilesSearchTest ‑ testFileLinks2
org.eclipse.search.tests.filesearch.ExcludedFilesSearchTest ‑ testSimpleFilesParallel
org.eclipse.search.tests.filesearch.ExcludedFilesSearchTest ‑ testSimpleFilesSerial
org.eclipse.search.tests.filesearch.RestrictedFilesSearchTest ‑ testFileLinks1
org.eclipse.search.tests.filesearch.RestrictedFilesSearchTest ‑ testFileLinks2
org.eclipse.search.tests.filesearch.RestrictedFilesSearchTest ‑ testSimpleFilesParallel
org.eclipse.search.tests.filesearch.RestrictedFilesSearchTest ‑ testSimpleFilesSerial

♻️ This comment has been updated with latest results.

@iloveeclipse iloveeclipse marked this pull request as ready for review March 31, 2026 15:24
@iloveeclipse iloveeclipse requested a review from Copilot March 31, 2026 18:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 TextSearchVisitor to consult IFile.isContentRestricted() when the preference disableRestrictedFileSearch is 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 property search_excluded_file). The implementation now uses disableRestrictedFileSearch and IFile#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 helper setSessionProperty(...)) even though the new behavior is based on IFile#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 via IFile#setContentRestricted(true). Rename the method (and any related wording like sessionProperty) to reflect the new restriction mechanism.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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
Copy link
Copy Markdown
Member

@iloveeclipse iloveeclipse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@iloveeclipse iloveeclipse merged commit ed75400 into eclipse-platform:master Apr 2, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide options for disabling file search on some files

3 participants