Skip to content

Close a project when its .project file is deleted - #2895

Open
vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:close-project-without-description
Open

Close a project when its .project file is deleted#2895
vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:close-project-without-description

Conversation

@vogella

@vogella vogella commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

When the .project file disappears, for example after switching to a git branch that no longer contains the project, the workspace kept the project open and silently wrote the description back to disk at the next snapshot, save or close, leaving a dirty working tree (#1074).

A refresh that finds .project deleted, and deleting the file through the workspace, now close the project instead, and closing or saving no longer recreates a missing description file. The project can be reopened once the file is back, just like a project with a missing description on startup.

A project move whose content could only be moved partially now refreshes the destination after the tree has been moved, instead of refreshing the source before. The tree always ends up under the destination name, so the old source refresh described the destination with the leftovers of the source and dropped moved files and their markers; it would now also close the project because its .project is gone. The destination refresh keeps the moved resources with their markers and trims whatever was never copied.

Code that deletes every member of a project including .project and keeps using it now sees a closed project; five tests in this repository were adjusted accordingly. The full org.eclipse.core.tests.resources suite passes locally.

Fixes #1074

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Test Results

    54 files  ± 0      54 suites  ±0   54m 28s ⏱️ - 2m 27s
 4 771 tests + 5   4 749 ✅ + 5   22 💤 ±0  0 ❌ ±0 
12 204 runs  +15  12 051 ✅ +15  153 💤 ±0  0 ❌ ±0 

Results for commit 1a6e3bb. ± Comparison against base commit 241fa27.

♻️ This comment has been updated with latest results.

@vogella
vogella force-pushed the close-project-without-description branch 2 times, most recently from 8d66678 to 9923ce5 Compare September 3, 2026 07:56
@vogella
vogella requested a balanced review from Copilot September 3, 2026 08:27

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.

🔵 Needs a closer look

It changes core project lifecycle, persistence, refresh, and partial-move recovery behavior requiring final human validation.

Pull request overview

Closes open Eclipse workspace projects when their .project file disappears, preventing saves from recreating deleted metadata.

Changes:

  • Detects .project deletion during resource deletion and refresh, then closes the project.
  • Stops save/close operations from recreating missing descriptions.
  • Preserves partially moved project content and updates affected tests.
File summaries
File Description
Snapshot2Test.java Retains .project during snapshot setup.
TestBug12575.java Updates cross-session deletion expectations.
IWorkspaceTest.java Verifies saves do not recreate .project.
ISynchronizerTest.java Retains project descriptions during synchronization testing.
IProjectTest.java Tests explicit description rewriting.
IProjectDescriptionTest.java Covers deletion, refresh, close, reopen, and failed moves.
LocalSyncTest.java Expects refresh to close deleted projects.
SaveManager.java Removes automatic project-description repair during saves.
ResourceTree.java Avoids source refresh after partial project moves.
Resource.java Closes projects after workspace .project deletion.
Project.java Extracts reusable internal project-closing logic.
File.java Centralizes .project identification.
RefreshLocalVisitor.java Tracks projects whose descriptions disappeared.
FileSystemResourceManager.java Closes tracked projects after refresh.
Review details
  • Files reviewed: 14/14 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@vogella
vogella force-pushed the close-project-without-description branch from 9923ce5 to bb8ca9d Compare September 3, 2026 23:17
@vogella

vogella commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@iloveeclipse To your question: The code was done without bug reference AFAICS. John Arthorne on 2002-03-16 in commit f64fa15 ("Moved project description file to content area"), the Eclipse 2.0 change that moved .project out of .metadata into the project folder

@vogella
vogella force-pushed the close-project-without-description branch from bb8ca9d to 7a81528 Compare September 4, 2026 07:53
When the project description file disappeared, the workspace kept the
project open with the in-memory description, logged a refresh error and
silently wrote the description back to disk at the next snapshot or on
close. Switching to a git branch that no longer contains a project thus
left a dirty working tree with a recreated .project file.

A refresh that finds the description file deleted, and deleting the file
through the workspace, now close the project instead. Closing a project
and saving the workspace no longer recreate a missing description file.
Opening the project again works once the file is back, as for a project
with a missing description on startup.

A project move whose content could only be moved partially now refreshes
the destination after the tree has been moved, instead of the source
before. The tree always ends up under the destination name, so the
source refresh described the destination with the leftovers of the
source: files already deleted there were dropped from the tree with
their markers even though they exist at the destination, and with this
change the source refresh would also have closed the project because its
description file is gone. The destination refresh keeps the moved
resources and their markers and trims what was never copied.

Fixes eclipse-platform#1074

Assisted-by: multiple AI agents and layers of automated tooling 🤖
@vogella
vogella force-pushed the close-project-without-description branch from 7a81528 to 1a6e3bb Compare September 4, 2026 11:38
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 the project file should ask to remove the project from workspace

3 participants