Skip to content

Allow disabling automatic reconstruction of terminals #2563 - #2850

Merged
iloveeclipse merged 1 commit into
eclipse-platform:masterfrom
danthe1st:allow-disabling-terminal-restore
Aug 6, 2026
Merged

Allow disabling automatic reconstruction of terminals #2563#2850
iloveeclipse merged 1 commit into
eclipse-platform:masterfrom
danthe1st:allow-disabling-terminal-restore

Conversation

@danthe1st

@danthe1st danthe1st commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds a preference to disable automatically restoring the open terminals in the terminal view.

Demonstration steps:

  • Open Eclipse
  • Open a terminal view with multiple terminals
  • Close Eclipse while the terminal view is open
  • Open Eclipse again
  • After navigating to the terminal view, all terminals are restored.

This PR adds a new preference in Window > Preferences > Terminal named Reopen terminals after restart which is checked by default. If unchecked, no terminals will be restored.

image

Notes

  • The terminal preference screen is located in org.eclipse.terminal.control while the related logic is present in org.eclipse.terminal.view.ui. I don't know what the best way to expose these classes is as they are x-internal. For now, I added an x-friends (mainly for documentation) and marked the access with @SuppressWarnings("restriction").
  • If you want to have a working terminal from a local "Eclipse Application" run configuration, you might need to add the org.eclipse.cdt.core.native and org.eclipse.cdt.core.<your OS/arch> bundles. I got them from the update site https://download.eclipse.org/releases/2026-09. This PR can still be tested without that but local terminals might just be empty rectangles without those.
    image
    image
  • I assume a small preference addition like this doesn't need a N&N? If one is wanted, I can also create that.

Issues

Fixes #2563

@SougandhS SougandhS left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Works well ! 👍
Small suggestion..could we move this option to the top of the preference page ? The other settings (colors, buffer size) are all about how the terminal looks, but this one controls whether terminals come back at all after a restart, which feels more fundamental. Having it first would make it easier to find.

image

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Test Results

    54 files  ±0      54 suites  ±0   56m 16s ⏱️ - 2m 44s
 4 705 tests ±0   4 683 ✅ ±0   22 💤 ±0  0 ❌ ±0 
12 006 runs  ±0  11 853 ✅ ±0  153 💤 ±0  0 ❌ ±0 

Results for commit 3070afe. ± Comparison against base commit 3690a58.

♻️ This comment has been updated with latest results.

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 adds a user preference in the Terminal preferences page to control whether previously-open terminals are automatically reconstructed when the Terminal view is reopened after an IDE restart (default: enabled), addressing the workflow pain described in #2563.

Changes:

  • Adds a new boolean preference (Reopen terminals after restart) to the terminal preference UI and initializes its default value.
  • Gates TerminalsView memento restoration based on the new preference.
  • Updates bundle wiring/export metadata to allow the Terminal view bundle to read the preference from the Terminal control bundle (via x-friends + @SuppressWarnings("restriction")).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
terminal/bundles/org.eclipse.terminal.view.ui/src/org/eclipse/terminal/view/ui/internal/view/TerminalsView.java Reads the new preference and conditionally skips restoring terminals from the view memento.
terminal/bundles/org.eclipse.terminal.view.ui/META-INF/MANIFEST.MF Adds a dependency on org.eclipse.terminal.control to access preference infrastructure/constants.
terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/preferences/TerminalPreferencePage.java Adds the checkbox field to the terminal preferences page.
terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/preferences/TerminalPreferenceInitializer.java Defines the default value for the new preference.
terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/preferences/ITerminalConstants.java Introduces the preference key and its default constant.
terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/control/impl/TerminalMessages.properties Adds the user-visible label text for the new preference.
terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/control/impl/TerminalMessages.java Adds the NLS field for the new preference label.
terminal/bundles/org.eclipse.terminal.control/META-INF/MANIFEST.MF Adds x-friends to allow the view bundle to access internal preference/control packages.
Suppressed comments (1)

terminal/bundles/org.eclipse.terminal.view.ui/src/org/eclipse/terminal/view/ui/internal/view/TerminalsView.java:719

  • restoreState() reads from preferenceStore without ensuring it has been initialized or that TerminalPlugin.getDefault() is non-null. Given other code in this component defensively checks TerminalPlugin.getDefault() != null, this should be null-safe to avoid NPEs in early-startup or test scenarios.
	@SuppressWarnings("restriction")
	public void restoreState(IMemento memento) {
		if (memento == null || !preferenceStore.getBoolean(ITerminalConstants.PREF_RESTORE_TERMINALS)) {
			return;
		}

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

…m#2563

This change adds a preference to disable automatically restoring the
open terminals in the terminal view.

Fixes eclipse-platform#2563
@danthe1st
danthe1st force-pushed the allow-disabling-terminal-restore branch from b024dc2 to 3070afe Compare August 5, 2026 14:57
@danthe1st

Copy link
Copy Markdown
Contributor Author

Small suggestion..could we move this option to the top of the preference page ?

Done in 3070afe.

@iloveeclipse
iloveeclipse merged commit 7763306 into eclipse-platform:master Aug 6, 2026
18 checks passed
@iloveeclipse

Copy link
Copy Markdown
Member

Thanks. Please add N&N.

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.

Allow disabling automatic reconstruction of terminals

4 participants