Skip to content

Refresh resources before sync check in DeleteResourcesProcessor#4046

Merged
vogella merged 2 commits into
eclipse-platform:masterfrom
vogella:lv/delete-resources-honor-lightweight-auto-refresh
Jun 19, 2026
Merged

Refresh resources before sync check in DeleteResourcesProcessor#4046
vogella merged 2 commits into
eclipse-platform:masterfrom
vogella:lv/delete-resources-honor-lightweight-auto-refresh

Conversation

@vogella

@vogella vogella commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

The Delete Resources refactoring wizard reported "is not in sync with" warnings for files that were changed outside Eclipse, even though the "Refresh on access" workspace preference promises a lazy refresh and is enabled by default. The sync check used IResource.isSynchronized, which only compares timestamps and never triggers that refresh.

DeleteResourcesProcessor now follows the same pattern as RenameResourceProcessor: when the preference (PREF_LIGHTWEIGHT_AUTO_REFRESH) is enabled and the sync check fails, the resource is refreshed and the check is repeated, so resources that are already in sync pay no refresh cost. If the refresh reveals that a resource was deleted externally, it is dropped from the deletion set instead of failing later with "resource does not exist". The refresh stays cancelable via a child progress monitor, and a failed refresh degrades to the existing out-of-sync warning.

New tests cover the warning with the preference disabled, the refresh with it enabled, and the externally deleted case.

Fixes #3982

@eclipse-platform-bot

eclipse-platform-bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

bundles/org.eclipse.ltk.core.refactoring/META-INF/MANIFEST.MF

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From 736e9087f4b940e766e677ff96a5a5372ca45d65 Mon Sep 17 00:00:00 2001
From: Eclipse Platform Bot <platform-bot@eclipse.org>
Date: Thu, 11 Jun 2026 17:25:25 +0000
Subject: [PATCH] Version bump(s) for 4.41 stream


diff --git a/bundles/org.eclipse.ltk.core.refactoring/META-INF/MANIFEST.MF b/bundles/org.eclipse.ltk.core.refactoring/META-INF/MANIFEST.MF
index 9f0f659919..0933dc953b 100644
--- a/bundles/org.eclipse.ltk.core.refactoring/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ltk.core.refactoring/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.ltk.core.refactoring
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.ltk.core.refactoring; singleton:=true
-Bundle-Version: 3.15.200.qualifier
+Bundle-Version: 3.15.300.qualifier
 Bundle-Activator: org.eclipse.ltk.internal.core.refactoring.RefactoringCorePlugin
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: %providerName
-- 
2.54.0

Further information are available in Common Build Issues - Missing version increments.

@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Test Results

   855 files     855 suites   49m 15s ⏱️
 8 075 tests  7 832 ✅ 243 💤 0 ❌
20 127 runs  19 473 ✅ 654 💤 0 ❌

Results for commit 158eebd.

♻️ This comment has been updated with latest results.

@vogella vogella force-pushed the lv/delete-resources-honor-lightweight-auto-refresh branch 11 times, most recently from 3aa88d0 to a53009a Compare June 18, 2026 13:46
@vogella vogella requested a review from Copilot June 19, 2026 05:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the LTK delete-resources refactoring to honor the workspace “Refresh on access” (lightweight auto-refresh) preference when performing out-of-sync checks, aligning its behavior with other resource refactorings and reducing unnecessary out-of-sync warnings when resources were modified outside Eclipse.

Changes:

  • In DeleteResourcesProcessor, when the sync check fails and lightweight auto-refresh is enabled, refresh the resource and re-check synchronization; if refresh reveals the resource was deleted externally, drop it from the deletion set.
  • Add regression tests covering: warning when auto-refresh is disabled, successful delete without warnings when enabled, and externally deleted resources being handled gracefully.
  • Bump org.eclipse.ltk.core.refactoring bundle version.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringTests.java Adds tests for delete refactoring behavior with/without lightweight auto-refresh and for external deletion.
bundles/org.eclipse.ltk.core.refactoring/src/org/eclipse/ltk/internal/core/refactoring/resource/DeleteResourcesProcessor.java Implements refresh-and-recheck flow for out-of-sync resources and removes externally deleted resources from the delete set.
bundles/org.eclipse.ltk.core.refactoring/META-INF/MANIFEST.MF Increments bundle version for the change.

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

vogella and others added 2 commits June 19, 2026 09:36
When the workspace "Refresh on access" preference (Preferences >
General > Workspace > "Refresh on access", backed by
ResourcesPlugin.PREF_LIGHTWEIGHT_AUTO_REFRESH) is enabled, the Delete
Resources refactoring wizard reports "is not in sync with" warnings even
though the user explicitly opted into refresh on access. Note that this
preference is enabled by default.

DeleteResourcesProcessor now follows the same pattern as
RenameResourceProcessor: if the sync check fails and the preference is
enabled, the resource is refreshed and the check is repeated. Resources
that are already in sync are not refreshed.

If the refresh reveals that a resource was deleted externally, the
resource is dropped from the set to delete instead of failing later in
DeleteResourceChange with "resource does not exist".

The refresh runs under a child progress monitor so it stays cancelable,
and a failed refresh degrades to the existing out-of-sync warning rather
than aborting the condition check.

Fixes eclipse-platform#3982
@vogella vogella force-pushed the lv/delete-resources-honor-lightweight-auto-refresh branch from a53009a to 158eebd Compare June 19, 2026 07:37
@vogella vogella merged commit 50c7151 into eclipse-platform:master Jun 19, 2026
18 checks passed
@vogella vogella deleted the lv/delete-resources-honor-lightweight-auto-refresh branch June 19, 2026 08:34
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.

Delete resource does not honor the "Refresh on access" preference

3 participants