From 103db309feb81eb9e1f26f8bb2ecd2b66ac1cff1 Mon Sep 17 00:00:00 2001 From: danthe1st Date: Fri, 14 Aug 2026 17:28:22 +0200 Subject: [PATCH 1/2] skip restoring terminals with missing working directory --- .../view/TerminalsViewMementoHandler.java | 71 ++++++++++--------- 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/terminal/bundles/org.eclipse.terminal.view.ui/src/org/eclipse/terminal/view/ui/internal/view/TerminalsViewMementoHandler.java b/terminal/bundles/org.eclipse.terminal.view.ui/src/org/eclipse/terminal/view/ui/internal/view/TerminalsViewMementoHandler.java index f168203adb2..59e8684da20 100644 --- a/terminal/bundles/org.eclipse.terminal.view.ui/src/org/eclipse/terminal/view/ui/internal/view/TerminalsViewMementoHandler.java +++ b/terminal/bundles/org.eclipse.terminal.view.ui/src/org/eclipse/terminal/view/ui/internal/view/TerminalsViewMementoHandler.java @@ -12,6 +12,8 @@ *******************************************************************************/ package org.eclipse.terminal.view.ui.internal.view; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -154,43 +156,48 @@ protected void restoreState(final TerminalsView view, IMemento memento) { // Get all the "connection" memento's. IMemento[] connections = memento.getChildren("connection"); //$NON-NLS-1$ for (IMemento connection : connections) { - // Create the properties container that holds the terminal properties - Map properties = new HashMap<>(); - - // Set the view id attributes - properties.put(ITerminalsConnectorConstants.PROP_ID, id); - properties.put(ITerminalsConnectorConstants.PROP_SECONDARY_ID, secondaryId); - - // Restore the common attributes - properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, - connection.getString(ITerminalsConnectorConstants.PROP_DELEGATE_ID)); - properties.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, - connection.getString(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID)); - if (connection.getBoolean(ITerminalsConnectorConstants.PROP_FORCE_NEW) != null) { - properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, - connection.getBoolean(ITerminalsConnectorConstants.PROP_FORCE_NEW)); - } + restoreConnection(id, secondaryId, connection); + } + } + } - // Restore the encoding - if (connection.getString(ITerminalsConnectorConstants.PROP_ENCODING) != null) { - properties.put(ITerminalsConnectorConstants.PROP_ENCODING, - connection.getString(ITerminalsConnectorConstants.PROP_ENCODING)); - } + private void restoreConnection(String id, String secondaryId, IMemento connection) { + // Create the properties container that holds the terminal properties + Map properties = new HashMap<>(); + + // Set the view id attributes + properties.put(ITerminalsConnectorConstants.PROP_ID, id); + properties.put(ITerminalsConnectorConstants.PROP_SECONDARY_ID, secondaryId); + + // Restore the common attributes + properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, + connection.getString(ITerminalsConnectorConstants.PROP_DELEGATE_ID)); + properties.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, + connection.getString(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID)); + if (connection.getBoolean(ITerminalsConnectorConstants.PROP_FORCE_NEW) != null) { + properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, + connection.getBoolean(ITerminalsConnectorConstants.PROP_FORCE_NEW)); + } - // Restore the working directory - if (connection.getString(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR) != null) { - properties.put(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, - connection.getString(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR)); - } - Optional delegate = findDelegate(properties); - // Pass on to the memento handler - delegate.map(d -> d.getAdapter(IMementoHandler.class)) - .ifPresent(mh -> mh.restoreState(connection, properties)); - // Restore the terminal connection - delegate.ifPresent(d -> executeDelegate(properties, d)); + // Restore the encoding + if (connection.getString(ITerminalsConnectorConstants.PROP_ENCODING) != null) { + properties.put(ITerminalsConnectorConstants.PROP_ENCODING, + connection.getString(ITerminalsConnectorConstants.PROP_ENCODING)); + } + // Restore the working directory + String workingDirectory = connection.getString(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR); + if (workingDirectory != null) { + if (!Files.isDirectory(Path.of(workingDirectory))) { + return; } + properties.put(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, workingDirectory); } + Optional delegate = findDelegate(properties); + // Pass on to the memento handler + delegate.map(d -> d.getAdapter(IMementoHandler.class)).ifPresent(mh -> mh.restoreState(connection, properties)); + // Restore the terminal connection + delegate.ifPresent(d -> executeDelegate(properties, d)); } private Optional findDelegate(Map properties) { From b0d0ca80d33bdf3e62058d2855324c7ad31172c7 Mon Sep 17 00:00:00 2001 From: Eclipse Platform Bot Date: Sun, 30 Aug 2026 14:02:35 +0000 Subject: [PATCH 2/2] Version bump(s) for 4.42 stream --- .../bundles/org.eclipse.terminal.view.ui/META-INF/MANIFEST.MF | 2 +- terminal/features/org.eclipse.terminal.feature/feature.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/terminal/bundles/org.eclipse.terminal.view.ui/META-INF/MANIFEST.MF b/terminal/bundles/org.eclipse.terminal.view.ui/META-INF/MANIFEST.MF index 9652e27d4af..26ecaadcb4b 100644 --- a/terminal/bundles/org.eclipse.terminal.view.ui/META-INF/MANIFEST.MF +++ b/terminal/bundles/org.eclipse.terminal.view.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.terminal.view.ui;singleton:=true -Bundle-Version: 1.1.200.qualifier +Bundle-Version: 1.1.300.qualifier Bundle-Activator: org.eclipse.terminal.view.ui.internal.UIPlugin Bundle-Vendor: %providerName Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.9.0,4.0.0)", diff --git a/terminal/features/org.eclipse.terminal.feature/feature.xml b/terminal/features/org.eclipse.terminal.feature/feature.xml index 044c0b1ba2c..276e237b4b3 100644 --- a/terminal/features/org.eclipse.terminal.feature/feature.xml +++ b/terminal/features/org.eclipse.terminal.feature/feature.xml @@ -2,7 +2,7 @@