Skip to content

Prompt user when switching to a locked workspace in Eclipse#3518

Open
SougandhS wants to merge 4 commits intoeclipse-platform:masterfrom
SougandhS:PromptOnSwitch
Open

Prompt user when switching to a locked workspace in Eclipse#3518
SougandhS wants to merge 4 commits intoeclipse-platform:masterfrom
SougandhS:PromptOnSwitch

Conversation

@SougandhS
Copy link
Contributor

@SougandhS SougandhS commented Nov 8, 2025

This change prompts the user when attempting to switch to a workspace in Eclipse that is currently locked by another instance, preventing Eclipse from restarting into the locked workspace. Previously, if Eclipse restarted with a locked workspace, the workspace lock prompt would appear, and clicking “OK” would exit the application, requiring the user to reopen Eclipse to select an active workspace. With this update, the user is warned before switching, informed about the lock via a dialog, and prevented from restarting into the locked workspace, improving workflow and avoiding unnecessary restarts.

Before :

before.mp4

After :
(commented out the initial development mode check for this video)

after.mp4

@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2025

Test Results

   852 files  ±0     852 suites  ±0   56m 17s ⏱️ +7s
 7 857 tests ±0   7 614 ✅ ±0  243 💤 ±0  0 ❌ ±0 
20 097 runs  ±0  19 441 ✅ ±0  656 💤 ±0  0 ❌ ±0 

Results for commit 5cc76a7. ± Comparison against base commit ce3b75a.

♻️ This comment has been updated with latest results.

@SougandhS
Copy link
Contributor Author

Hi @iloveeclipse, could you please check this PR when you get some time ?

Copy link
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.

I can check on Monday. The idea itself is good.

@BeckerWdf
Copy link
Member

would it be possible to bring up the exact same dialog (with the same information) in both situations?

@SougandhS
Copy link
Contributor Author

would it be possible to bring up the exact same dialog (with the same information) in both situations?

Sure 👍

@SougandhS
Copy link
Contributor Author

would it be possible to bring up the exact same dialog (with the same information) in both situations?

Updated as suggested

My.Movie.mp4

@SougandhS SougandhS force-pushed the PromptOnSwitch branch 3 times, most recently from b3e89f9 to a7c8013 Compare November 11, 2025 00:47
@SougandhS SougandhS force-pushed the PromptOnSwitch branch 3 times, most recently from e2ca711 to fc83bc2 Compare November 12, 2025 14:44
@SougandhS
Copy link
Contributor Author

@iloveeclipse Could u please re-check this ?

Copy link
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.

I believe M3 is the bad time for changing workspace locking code. Take time, test the change also please with the workspace selection dialog that is shown on Eclipse startup, and if everything will work, it could land in the next release.

@eclipse-platform-bot
Copy link
Contributor

eclipse-platform-bot commented Dec 2, 2025

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.ui.ide.application/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 d198af70fd64dd8a913eec7368a80e87fedef897 Mon Sep 17 00:00:00 2001
From: Eclipse Platform Bot <[email protected]>
Date: Wed, 18 Mar 2026 09:39:30 +0000
Subject: [PATCH] Version bump(s) for 4.40 stream


diff --git a/bundles/org.eclipse.ui.ide.application/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.ide.application/META-INF/MANIFEST.MF
index cb3e4ac4a2..7c3f352aad 100644
--- a/bundles/org.eclipse.ui.ide.application/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui.ide.application/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Plugin.name
 Bundle-SymbolicName: org.eclipse.ui.ide.application;singleton:=true
-Bundle-Version: 1.6.0.qualifier
+Bundle-Version: 1.6.100.qualifier
 Bundle-Vendor: %Plugin.providerName
 Bundle-Localization: plugin
 Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.21.0,4.0.0)",
-- 
2.53.0

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

@SougandhS
Copy link
Contributor Author

I believe M3 is the bad time for changing workspace locking code. Take time, test the change also please with the workspace selection dialog that is shown on Eclipse startup, and if everything will work, it could land in the next release.

I have tested the change with a new SDK build and is even working with Eclipse startup case
image


image

@iloveeclipse
Copy link
Member

I've moved messages to the right bundle & rebased on master.

TODO (for me)

  • Update bundle version requirements for ide and application bundles on latest workbench
  • Code review
  • Behavior validation

@SougandhS : would it be OK if I would squash everything to one commit (except bundle version updates)?

@iloveeclipse
Copy link
Member

would it be OK if I would squash everything to one commit (except bundle version updates)?

We must do that, the API tools sees "touched" code which was reverted and complains about missing version bump.

[ERROR] Failed to execute goal org.eclipse.tycho.extras:tycho-p2-extras-plugin:5.0.3-SNAPSHOT:compare-version-with-baselines (compare-attached-artifacts-with-release) on project org.eclipse.e4.ui.workbench.swt: Only qualifier changed for (org.eclipse.e4.ui.workbench.swt/0.18.0.v20260317-1600). Expected to have bigger x.y.z than what is available in baseline (0.18.0.v20260119-0835) -> [Help 1]

There is no reason to bump that version for not really changed code.

iloveeclipse and others added 2 commits March 18, 2026 08:41
`org.eclipse.ui.ide.application` needs latest API from
`org.eclipse.ui.workbench`, `org.eclipse.ui` is the bundle that
re-exports it, because `org.eclipse.ui.workbench` has bumped minor
version segment, `org.eclipse.ui` must bump minor version segment too.

See eclipse-platform#3518
Prompts user on attempting to switch to a workspace that is currently
locked by another Eclipse instance. Prompt dialog is now shown
informing the user about the lock details and preventing Eclipse from
exiting.

- Refactored code to use common WorkspaceLock class
- Moved related messages to the workbench bundle

Also-by: Andrey Loskutov <[email protected]>
@SougandhS
Copy link
Contributor Author

@SougandhS : would it be OK if I would squash everything to one commit (except bundle version updates)?

Please go ahead 👍

Copy link
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.

I've fixed version constraints needed, refactored WorkspaceLock and started to look into Workbench code changes needed. Unfortunately be51d14 changes were not consistent, we have to understand how that can be fixed in context of the required changes here.

I will push updated PR now, but I plan to continue looking into Workbench changes needed.

return null;
}
} catch (MalformedURLException e) {
return null;
Copy link
Member

Choose a reason for hiding this comment

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

this return null here is wrong, because we simply can't get workspace URL, but have no idea if workspace is locked or not. Probably exception should be propagated.

* @param workspacePath the new workspace location
* @return {@link IApplication#EXIT_OK} or {@link IApplication#EXIT_RELAUNCH}
* @return {@link IApplication#EXIT_OK} or {@link IApplication#EXIT_RELAUNCH} or
* <code>null</code> if workspace is locked
Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately code doesn't match the javadoc, see retrurn null at line 2708 after be51d14.

This all needs careful rework.

TODO: Workbench.setRestartArguments() null handling is wrong ATM because
of the be51d14 changes.

See eclipse-platform#3518
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.

5 participants