Skip to content

Conversation

deepika-u
Copy link
Contributor

@deepika-u deepika-u commented Aug 26, 2025

Provide "Reopen Closed Tab" option for the user.

Fixes #2148

There are basically 2 types of tabs in eclipse.

  1. Editor tabs.
  2. View tabs.

I have attached step by step screen shots for the implementation where this "Reopen Closed Tab" is visible/shown

  • When Editor tabs are opened and say atleast 1 tab is closed, then there appears the "Reopen Closed Tab" on a right click of any existing opened tab like in screenshot 1.
Screenshot1

Note : When there is no tab yet closed, this menu option doesnt show up.

  • What are all called as View kind of tabs(left, bottom, right set of tabs all considered as view kind of tabs). Rest all contribute to View kind of tabs and same kind of menu shows up as shown in the screenshot.
Screenshot2_views
  • When console is 1 such view which is closed now, hence the menu option "Reopen Closed Tab" shows up in the right click menu.
Screenshot3_console_closed
  • When the console view is opened, the menu option "Reopen Closed Tab" again doesnt show up.
Screenshot_reopen_disabled

Observations

  1. Maximum of only 1 tab can be reopened at a time.
  2. Maximum of 15 times the option "Reopen Closed Tab" will be shown. Which means it can right now only remember most recently closed 15 tabs though you would have closed more.
  3. If anyone uses the option "Detach" and close a particular tab, then this tab is closed and that specific tab cannot be reopened using the option "Reopen Closed Tab". It needs to be opened freshly like any other tab.

@laeubi
Copy link
Contributor

laeubi commented Aug 26, 2025

There are basically 2 types of tabs in eclipse.

I don't think this is true. "Editor" is a concept of E3 / IDE.

A Tab is actually a view in the PartStack and we have a so called "primary stack" where we show things that are used for editing files (what itself are just views).

So I'm not 100% sure from the description what you want to change, but as the PartStack is hidden when the last editor is closed, if one wants to restore tabs it must attach a menu to the Area

private static final String ONBOARDING_TEXT = "EditorStack.OnboardingText"; //$NON-NLS-1$
public static final String TAB_UNIQUE_PATH = "editor.uniquePath"; //$NON-NLS-1$
public static final String VIEW_UNIQUE_ID = "view.uniqueID"; //$NON-NLS-1$
public static final String EDITOR_TAB = "CompatibilityEditor"; //$NON-NLS-1$
Copy link
Contributor

Choose a reason for hiding this comment

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

An editor must not be a compatibility view/editor. this is only when you have E3 editors and using the compatibility layer.

Copy link
Contributor Author

@deepika-u deepika-u Aug 26, 2025

Choose a reason for hiding this comment

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

An editor must not be a compatibility view/editor. this is only when you have E3 editors and using the compatibility layer.

You’re right — strictly speaking, editors only exist in the E3 compatibility layer. But in practice, this was the only reliable way I found to distinguish editor-like parts from views. Since users interact with editor tabs much more frequently than view tabs, I felt it made sense to treat them differently rather than having a single generic reopen option clubbing both.

Copy link
Contributor

@laeubi laeubi left a comment

Choose a reason for hiding this comment

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

I see several problems here:

  1. The feature assumes the E4 Compatibility layer is used
  2. It depends in some hard coded strings to be present in IDs and names
  3. It retains Parts and Context objects possibly forever what will be a source of memory leak that can only be avoided by a restart of Eclipse

Instead I think

  • the distinction between "Editor" and "View" is not needed. The context here is the container (the PartStack) so I would probably want to restore a tab for one stack but it does not matter what is in this stack.
  • if this should be enabled always, we need a tag to disable this feature for a partstack so that users have an option to opt-out. As an alternative one would maybe want a way to opt-in for the feature using a tag
  • The context and parts should not be retained forever. There are already ways to persist and restore state between restarts of Eclipse and we should use these technique here as well so that not objects are retained forever.
  • There should be a preference for the user to configure the number of tabs that can be restore

Copy link
Contributor

github-actions bot commented Aug 26, 2025

Test Results

 2 784 files  ±0   2 784 suites  ±0   1h 50m 0s ⏱️ - 2m 8s
 7 936 tests ±0   7 686 ✅  - 18  232 💤 ±0  13 ❌ +13   5 🔥 + 5 
23 342 runs  ±0  22 551 ✅  - 48  743 💤 ±0  37 ❌ +37  11 🔥 +11 

For more details on these failures and errors, see this check.

Results for commit e372b08. ± Comparison against base commit 81b03a6.

♻️ This comment has been updated with latest results.

@deepika-u
Copy link
Contributor Author

deepika-u commented Aug 26, 2025

There are basically 2 types of tabs in eclipse.

I don't think this is true. "Editor" is a concept of E3 / IDE.

A Tab is actually a view in the PartStack and we have a so called "primary stack" where we show things that are used for editing files (what itself are just views).

So I'm not 100% sure from the description what you want to change, but as the PartStack is hidden when the last editor is closed, if one wants to restore tabs it must attach a menu to the Area

Thanks for the detailing on E3 and E4 differentiation which i was not aware of. I was referring to the E3 kind of terminology itself like

  • Editors: for working on resources (files, etc.).
  • Views: for auxiliary tools (outline, console, problems view, etc.).

@deepika-u deepika-u force-pushed the Reopen_closed_tab_2148 branch from 730c5ae to 90d1f4c Compare August 29, 2025 12:15
@deepika-u deepika-u force-pushed the Reopen_closed_tab_2148 branch from 90d1f4c to 85dbca5 Compare September 1, 2025 04:13
@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.renderers.swt/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 df754a2f7a0ab7a674e6fa5537de2d479019e2fc Mon Sep 17 00:00:00 2001
From: Eclipse Platform Bot <[email protected]>
Date: Mon, 1 Sep 2025 04:17:47 +0000
Subject: [PATCH] Version bump(s) for 4.38 stream


diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/META-INF/MANIFEST.MF
index 9d5e27c11e..249542c521 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.eclipse.e4.ui.workbench.renderers.swt;singleton:=true
-Bundle-Version: 0.16.900.qualifier
+Bundle-Version: 0.16.1000.qualifier
 Bundle-Name: %pluginName
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
-- 
2.51.0

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

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.

Reopen closed tab
3 participants