Skip to content

Fix view transport across perspectives when moved to editor area#3778

Draft
fedejeanne wants to merge 2 commits intoeclipse-platform:masterfrom
fedejeanne:bug-2984-perspective-scoped-shared-views
Draft

Fix view transport across perspectives when moved to editor area#3778
fedejeanne wants to merge 2 commits intoeclipse-platform:masterfrom
fedejeanne:bug-2984-perspective-scoped-shared-views

Conversation

@fedejeanne
Copy link
Member

Fixes #2984.

This change keeps non-editor views dropped into the editor-area stack scoped to the active perspective instead of making them globally visible across perspectives.

What changed:

  • Tag non-editor shared-area drops with an owner perspective id during stack drag-and-drop.
  • On perspective switch, render only shared-area view placeholders owned by the active perspective.
  • During perspective reset, preserve shared-area placeholders owned by other perspectives.

Result:

  • Views such as Package Explorer no longer get transported to other perspectives.
  • Resetting one perspective no longer removes editor-area view placements belonging to another perspective.

@eclipse-platform-bot
Copy link
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.e4.ui.workbench.addons.swt/META-INF/MANIFEST.MF
bundles/org.eclipse.e4.ui.workbench/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 a139247f49b22c6b6421300e86a78d2f557321ce Mon Sep 17 00:00:00 2001
From: Eclipse Platform Bot <platform-bot@eclipse.org>
Date: Sun, 15 Mar 2026 20:13:49 +0000
Subject: [PATCH] Version bump(s) for 4.40 stream


diff --git a/bundles/org.eclipse.e4.ui.workbench.addons.swt/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.workbench.addons.swt/META-INF/MANIFEST.MF
index b671e2de07..b01ce42504 100644
--- a/bundles/org.eclipse.e4.ui.workbench.addons.swt/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.workbench.addons.swt/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.eclipse.e4.ui.workbench.addons.swt;singleton:=true
-Bundle-Version: 1.6.0.qualifier
+Bundle-Version: 1.6.100.qualifier
 Bundle-Name: %pluginName
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.e4.ui.workbench/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.workbench/META-INF/MANIFEST.MF
index 844d05c5e4..e2fe621770 100644
--- a/bundles/org.eclipse.e4.ui.workbench/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.workbench/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.eclipse.e4.ui.workbench;singleton:=true
-Bundle-Version: 1.18.200.qualifier
+Bundle-Version: 1.18.300.qualifier
 Bundle-Name: %pluginName
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
-- 
2.53.0

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

Copy link

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

This PR fixes Eclipse workbench behavior where non-editor views dragged into the editor area (“shared area”) become incorrectly visible across perspectives, and ensures perspective resets don’t remove editor-area view placements belonging to other perspectives.

Changes:

  • Tag non-editor views dropped into the shared/editor area with an “owner perspective id” persisted-state key during stack DnD.
  • On perspective switch, render only shared-area view placeholders/parts owned by the active perspective.
  • During perspective reset, preserve shared-area placeholders owned by other perspectives.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/WorkbenchPage.java Applies owner-based render scoping on perspective switches and updates container render state accordingly.
bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java Preserves shared-area placeholders owned by other perspectives during perspective reset.
bundles/org.eclipse.e4.ui.workbench/META-INF/MANIFEST.MF Bundle version bump for the workbench model service change.
bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/StackDropAgent.java Tags moved non-editor stack elements with the owning perspective id when dropped into the shared/editor area.
bundles/org.eclipse.e4.ui.workbench.addons.swt/META-INF/MANIFEST.MF Bundle version bump for the SWT DnD addon change.

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

Comment on lines +2986 to +3014
private void updatePerspectiveScopedSharedViews(MPerspective activePerspective) {
String activePerspectiveId = activePerspective == null ? null : activePerspective.getElementId();

List<MPlaceholder> sharedPlaceholders = modelService.findElements(window, null, MPlaceholder.class, null,
EModelService.OUTSIDE_PERSPECTIVE | EModelService.IN_SHARED_AREA);
for (MPlaceholder placeholder : sharedPlaceholders) {
String ownerPerspectiveId = placeholder.getPersistedState().get(PERSPECTIVE_SCOPED_OWNER_ID);
if (ownerPerspectiveId == null) {
continue;
}
boolean shouldRender = ownerPerspectiveId.equals(activePerspectiveId);
placeholder.setToBeRendered(shouldRender);
updateContainerVisibility(placeholder.getParent());
}

List<MPart> sharedParts = modelService.findElements(window, null, MPart.class, null,
EModelService.OUTSIDE_PERSPECTIVE | EModelService.IN_SHARED_AREA);
for (MPart part : sharedParts) {
if (part.getCurSharedRef() != null) {
continue;
}
String ownerPerspectiveId = part.getPersistedState().get(PERSPECTIVE_SCOPED_OWNER_ID);
if (ownerPerspectiveId == null) {
continue;
}
boolean shouldRender = ownerPerspectiveId.equals(activePerspectiveId);
part.setToBeRendered(shouldRender);
updateContainerVisibility(part.getParent());
}
Comment on lines +3027 to +3028
parent.setToBeRendered(false);
updateContainerVisibility(parent.getParent());
@github-actions
Copy link
Contributor

Test Results

   852 files  ±0     852 suites  ±0   53m 32s ⏱️ - 1m 7s
 7 848 tests ±0   7 604 ✅  - 1  243 💤 ±0  1 ❌ +1 
20 070 runs  ±0  19 413 ✅  - 1  656 💤 ±0  1 ❌ +1 

For more details on these failures, see this check.

Results for commit 44ec6d7. ± Comparison against base commit 7324f31.

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.

Views are transported between perspectives when placed in the editor area

3 participants