From 7d6039a2950de01392c33a3fe355f6880667e4df Mon Sep 17 00:00:00 2001 From: Jonah Graham Date: Fri, 18 Aug 2023 17:24:45 -0400 Subject: [PATCH] Code review changes --- NewAndNoteworthy/CDT-11.3.md | 7 +++++ .../internal/RemoteConnectionManager.java | 3 +- .../terminal/control/ITerminalListener3.java | 2 +- .../control/ITerminalViewControl.java | 4 +-- .../control/impl/ITerminalControlForText.java | 3 +- .../terminal/emulator/VT100Emulator.java | 2 +- .../emulator/VT100TerminalControl.java | 3 +- .../provisional/api/ITerminalControl.java | 3 +- .../TerminalConnectorFactoryTest.java | 3 +- .../connector/TerminalConnectorTest.java | 3 +- .../emulator/MockTerminalControlForText.java | 3 +- .../speedtest/SpeedTestConnection.java | 3 +- .../speedtest/SpeedTestConnector.java | 3 +- .../terminal/test/ui/VT100DataSource.java | 3 +- .../ITerminalsConnectorConstants.java | 7 ++--- .../META-INF/MANIFEST.MF | 2 +- .../view/ui/actions/RenameTerminalAction.java | 3 +- .../view/ui/services/TerminalService.java | 8 +++--- .../view/ui/tabs/TabTerminalListener.java | 28 +++++++++++-------- 19 files changed, 46 insertions(+), 47 deletions(-) diff --git a/NewAndNoteworthy/CDT-11.3.md b/NewAndNoteworthy/CDT-11.3.md index cb1edd53692..f84b0fbbb0d 100644 --- a/NewAndNoteworthy/CDT-11.3.md +++ b/NewAndNoteworthy/CDT-11.3.md @@ -18,6 +18,13 @@ In cases where the configured binary parser does not support the launching of GN # API Changes, current and planned +## New API to create terminal that blocks updating title from ANSI escape sequence + +When calling `ITerminalService.openConsole(Map properties, Done done)` the `properties` understands a new key that allows the option to disable updating titles from ASNI Escape Sequences. +By setting `ITerminalsConnectorConstants.PROP_TITLE_DISABLE_ANSI_TITLE` to `true` the title of the tab terminal will not be affected by ANSI escape sequences. + +## Breaking API changes + Please see [CHANGELOG-API](CHANGELOG-API.md) for details on the breaking API changes in this release as well as future planned API changes. # Noteworthy Issues and Pull Requests diff --git a/terminal/plugins/org.eclipse.tm.terminal.connector.remote/src/org/eclipse/tm/terminal/connector/remote/internal/RemoteConnectionManager.java b/terminal/plugins/org.eclipse.tm.terminal.connector.remote/src/org/eclipse/tm/terminal/connector/remote/internal/RemoteConnectionManager.java index 007ea998303..4795f836528 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.connector.remote/src/org/eclipse/tm/terminal/connector/remote/internal/RemoteConnectionManager.java +++ b/terminal/plugins/org.eclipse.tm.terminal.connector.remote/src/org/eclipse/tm/terminal/connector/remote/internal/RemoteConnectionManager.java @@ -9,8 +9,6 @@ *******************************************************************************/ package org.eclipse.tm.terminal.connector.remote.internal; -import static org.eclipse.tm.internal.terminal.control.ITerminalListener3.*; - import java.io.IOException; import java.io.InputStream; @@ -35,6 +33,7 @@ import org.eclipse.remote.core.IRemoteProcessTerminalService; import org.eclipse.remote.core.IRemoteServicesManager; import org.eclipse.remote.core.exception.RemoteConnectionException; +import org.eclipse.tm.internal.terminal.control.ITerminalListener3.TerminalTitleRequestor; import org.eclipse.tm.internal.terminal.emulator.VT100Emulator; import org.eclipse.tm.internal.terminal.emulator.VT100TerminalControl; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl; diff --git a/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/control/ITerminalListener3.java b/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/control/ITerminalListener3.java index 19a132a27a3..e9e983621e8 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/control/ITerminalListener3.java +++ b/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/control/ITerminalListener3.java @@ -33,7 +33,7 @@ enum TerminalTitleRequestor { /** * Set the title of the terminal. * - * @param title Termianl title. + * @param title Terminal title. * @param requestor Item that requests terminal title update. */ void setTerminalTitle(String title, TerminalTitleRequestor requestor); diff --git a/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/control/ITerminalViewControl.java b/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/control/ITerminalViewControl.java index 7e2c7e8b002..d19b6516975 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/control/ITerminalViewControl.java +++ b/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/control/ITerminalViewControl.java @@ -16,14 +16,13 @@ ******************************************************************************/ package org.eclipse.tm.internal.terminal.control; -import static org.eclipse.tm.internal.terminal.control.ITerminalListener3.*; - import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; import org.eclipse.swt.dnd.Clipboard; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.widgets.Control; +import org.eclipse.tm.internal.terminal.control.ITerminalListener3.TerminalTitleRequestor; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl; import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; @@ -193,6 +192,7 @@ public interface ITerminalViewControl { void removeMouseListener(ITerminalMouseListener listener); /** + * @since 5.1 * @deprecated call {@link #setTerminalTitle(String, String)} instead */ @Deprecated(forRemoval = true) diff --git a/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/control/impl/ITerminalControlForText.java b/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/control/impl/ITerminalControlForText.java index a2b7918c05d..fc492dea59d 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/control/impl/ITerminalControlForText.java +++ b/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/control/impl/ITerminalControlForText.java @@ -12,10 +12,9 @@ *******************************************************************************/ package org.eclipse.tm.internal.terminal.control.impl; -import static org.eclipse.tm.internal.terminal.control.ITerminalListener3.*; - import java.io.OutputStream; +import org.eclipse.tm.internal.terminal.control.ITerminalListener3.TerminalTitleRequestor; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; diff --git a/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/emulator/VT100Emulator.java b/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/emulator/VT100Emulator.java index 70fac89a484..56970c23a63 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/emulator/VT100Emulator.java +++ b/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/emulator/VT100Emulator.java @@ -37,7 +37,6 @@ import static org.eclipse.tm.terminal.model.TerminalColor.RED; import static org.eclipse.tm.terminal.model.TerminalColor.WHITE; import static org.eclipse.tm.terminal.model.TerminalColor.YELLOW; -import static org.eclipse.tm.internal.terminal.control.ITerminalListener3.*; import java.io.IOException; import java.io.Reader; @@ -46,6 +45,7 @@ import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.events.ControlListener; import org.eclipse.swt.graphics.RGB; +import org.eclipse.tm.internal.terminal.control.ITerminalListener3.TerminalTitleRequestor; import org.eclipse.tm.internal.terminal.control.impl.ITerminalControlForText; import org.eclipse.tm.internal.terminal.control.impl.TerminalPlugin; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; diff --git a/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java b/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java index 2fd213e569a..5680e3b1fc5 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java +++ b/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java @@ -45,8 +45,6 @@ *******************************************************************************/ package org.eclipse.tm.internal.terminal.emulator; -import static org.eclipse.tm.internal.terminal.control.ITerminalListener3.*; - import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; @@ -101,6 +99,7 @@ import org.eclipse.tm.internal.terminal.control.ITerminalListener; import org.eclipse.tm.internal.terminal.control.ITerminalListener2; import org.eclipse.tm.internal.terminal.control.ITerminalListener3; +import org.eclipse.tm.internal.terminal.control.ITerminalListener3.TerminalTitleRequestor; import org.eclipse.tm.internal.terminal.control.ITerminalMouseListener; import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; import org.eclipse.tm.internal.terminal.control.impl.ITerminalControlForText; diff --git a/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/provisional/api/ITerminalControl.java b/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/provisional/api/ITerminalControl.java index 1aab960a752..b47c0788a2e 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/provisional/api/ITerminalControl.java +++ b/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/provisional/api/ITerminalControl.java @@ -16,14 +16,13 @@ *******************************************************************************/ package org.eclipse.tm.internal.terminal.provisional.api; -import static org.eclipse.tm.internal.terminal.control.ITerminalListener3.*; - import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; +import org.eclipse.tm.internal.terminal.control.ITerminalListener3.TerminalTitleRequestor; /** * Represents the terminal view as seen by a terminal connection. diff --git a/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/connector/TerminalConnectorFactoryTest.java b/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/connector/TerminalConnectorFactoryTest.java index 18ee6b36777..df1cff86b6a 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/connector/TerminalConnectorFactoryTest.java +++ b/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/connector/TerminalConnectorFactoryTest.java @@ -16,14 +16,13 @@ *******************************************************************************/ package org.eclipse.tm.internal.terminal.connector; -import static org.eclipse.tm.internal.terminal.control.ITerminalListener3.*; - import java.io.OutputStream; import java.nio.charset.Charset; import org.eclipse.core.runtime.Platform; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; +import org.eclipse.tm.internal.terminal.control.ITerminalListener3.TerminalTitleRequestor; import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl; import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; diff --git a/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/connector/TerminalConnectorTest.java b/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/connector/TerminalConnectorTest.java index 3a7f96b2d43..e24cbba35de 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/connector/TerminalConnectorTest.java +++ b/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/connector/TerminalConnectorTest.java @@ -16,14 +16,13 @@ *******************************************************************************/ package org.eclipse.tm.internal.terminal.connector; -import static org.eclipse.tm.internal.terminal.control.ITerminalListener3.*; - import java.io.OutputStream; import java.nio.charset.Charset; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; import org.eclipse.tm.internal.terminal.connector.TerminalConnector.Factory; +import org.eclipse.tm.internal.terminal.control.ITerminalListener3.TerminalTitleRequestor; import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl; import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; diff --git a/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/emulator/MockTerminalControlForText.java b/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/emulator/MockTerminalControlForText.java index 9df42e40278..b8c81ccd1a1 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/emulator/MockTerminalControlForText.java +++ b/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/emulator/MockTerminalControlForText.java @@ -9,13 +9,12 @@ *******************************************************************************/ package org.eclipse.tm.internal.terminal.emulator; -import static org.eclipse.tm.internal.terminal.control.ITerminalListener3.*; - import java.io.OutputStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.eclipse.tm.internal.terminal.control.ITerminalListener3.TerminalTitleRequestor; import org.eclipse.tm.internal.terminal.control.impl.ITerminalControlForText; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; diff --git a/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/speedtest/SpeedTestConnection.java b/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/speedtest/SpeedTestConnection.java index 73ef03abcb6..ea670329ddb 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/speedtest/SpeedTestConnection.java +++ b/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/speedtest/SpeedTestConnection.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.tm.internal.terminal.speedtest; -import static org.eclipse.tm.internal.terminal.control.ITerminalListener3.*; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -19,6 +17,7 @@ import java.io.OutputStream; import org.eclipse.swt.widgets.Display; +import org.eclipse.tm.internal.terminal.control.ITerminalListener3.TerminalTitleRequestor; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl; import org.eclipse.tm.internal.terminal.provisional.api.Logger; import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; diff --git a/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/speedtest/SpeedTestConnector.java b/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/speedtest/SpeedTestConnector.java index 68678de1081..b2b1c33f88c 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/speedtest/SpeedTestConnector.java +++ b/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/speedtest/SpeedTestConnector.java @@ -13,14 +13,13 @@ *******************************************************************************/ package org.eclipse.tm.internal.terminal.speedtest; -import static org.eclipse.tm.internal.terminal.control.ITerminalListener3.*; - import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.io.OutputStream; +import org.eclipse.tm.internal.terminal.control.ITerminalListener3.TerminalTitleRequestor; import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl; import org.eclipse.tm.internal.terminal.provisional.api.Logger; diff --git a/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/test/ui/VT100DataSource.java b/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/test/ui/VT100DataSource.java index feb08ca1226..6ec10f847da 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/test/ui/VT100DataSource.java +++ b/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/test/ui/VT100DataSource.java @@ -14,8 +14,6 @@ *******************************************************************************/ package org.eclipse.tm.internal.terminal.test.ui; -import static org.eclipse.tm.internal.terminal.control.ITerminalListener3.*; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.FileInputStream; @@ -27,6 +25,7 @@ import java.io.Reader; import java.nio.charset.StandardCharsets; +import org.eclipse.tm.internal.terminal.control.ITerminalListener3.TerminalTitleRequestor; import org.eclipse.tm.internal.terminal.control.impl.ITerminalControlForText; import org.eclipse.tm.internal.terminal.emulator.VT100Emulator; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; diff --git a/terminal/plugins/org.eclipse.tm.terminal.view.core/src/org/eclipse/tm/terminal/view/core/interfaces/constants/ITerminalsConnectorConstants.java b/terminal/plugins/org.eclipse.tm.terminal.view.core/src/org/eclipse/tm/terminal/view/core/interfaces/constants/ITerminalsConnectorConstants.java index 833f1f185a7..4d60d49c31b 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.view.core/src/org/eclipse/tm/terminal/view/core/interfaces/constants/ITerminalsConnectorConstants.java +++ b/terminal/plugins/org.eclipse.tm.terminal.view.core/src/org/eclipse/tm/terminal/view/core/interfaces/constants/ITerminalsConnectorConstants.java @@ -72,13 +72,12 @@ public interface ITerminalsConnectorConstants { public static final String PROP_TITLE = "title"; //$NON-NLS-1$ /** - * Property: Flag to set terminal title either using terminal API only or - * using terminal API and ANSI command. + * Property: Flag to disable updating the terminal title from ANSI escape sequences. *

- * Property Type: {@link String} + * Property Type: {@link Boolean} * @since 4.10 */ - public static final String PROP_TITLE_UPDATE_API = "titleUpdateAPI"; //$NON-NLS-1$ + public static final String PROP_TITLE_DISABLE_ANSI_TITLE = "titleDisableAnsiTitle"; //$NON-NLS-1$ /** * Property: The encoding of the terminal tab to open. diff --git a/terminal/plugins/org.eclipse.tm.terminal.view.ui/META-INF/MANIFEST.MF b/terminal/plugins/org.eclipse.tm.terminal.view.ui/META-INF/MANIFEST.MF index 285f6af7180..652bc77fa5f 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.view.ui/META-INF/MANIFEST.MF +++ b/terminal/plugins/org.eclipse.tm.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.tm.terminal.view.ui;singleton:=true -Bundle-Version: 4.11.100.qualifier +Bundle-Version: 4.11.200.qualifier Bundle-Activator: org.eclipse.tm.terminal.view.ui.activator.UIPlugin Bundle-Vendor: %providerName Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400", diff --git a/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/actions/RenameTerminalAction.java b/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/actions/RenameTerminalAction.java index 179354cf1b4..9eeae1df516 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/actions/RenameTerminalAction.java +++ b/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/actions/RenameTerminalAction.java @@ -11,12 +11,11 @@ package org.eclipse.tm.terminal.view.ui.actions; -import static org.eclipse.tm.internal.terminal.control.ITerminalListener3.*; - import org.eclipse.core.runtime.Assert; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.window.Window; +import org.eclipse.tm.internal.terminal.control.ITerminalListener3.TerminalTitleRequestor; import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; import org.eclipse.tm.internal.terminal.control.actions.AbstractTerminalAction; import org.eclipse.tm.terminal.view.ui.nls.Messages; diff --git a/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/services/TerminalService.java b/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/services/TerminalService.java index a92ad229a0a..fc372b9caad 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/services/TerminalService.java +++ b/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/services/TerminalService.java @@ -293,11 +293,11 @@ public void doRun(String id, String secondaryId, String title, ITerminalConnecto flags.put(ITerminalsConnectorConstants.PROP_DATA_NO_RECONNECT, (Boolean) properties.get(ITerminalsConnectorConstants.PROP_DATA_NO_RECONNECT)); } - if (properties.get(ITerminalsConnectorConstants.PROP_TITLE_UPDATE_API) instanceof Boolean) { - flags.put(ITerminalsConnectorConstants.PROP_TITLE_UPDATE_API, - (Boolean) properties.get(ITerminalsConnectorConstants.PROP_TITLE_UPDATE_API)); + if (properties.get(ITerminalsConnectorConstants.PROP_TITLE_DISABLE_ANSI_TITLE) instanceof Boolean) { + flags.put(ITerminalsConnectorConstants.PROP_TITLE_DISABLE_ANSI_TITLE, + (Boolean) properties.get(ITerminalsConnectorConstants.PROP_TITLE_DISABLE_ANSI_TITLE)); } else { - flags.put(ITerminalsConnectorConstants.PROP_TITLE_UPDATE_API, false); + flags.put(ITerminalsConnectorConstants.PROP_TITLE_DISABLE_ANSI_TITLE, false); } // Open the new console CTabItem item; diff --git a/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabTerminalListener.java b/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabTerminalListener.java index 6725407626d..717d51c6152 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabTerminalListener.java +++ b/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/tabs/TabTerminalListener.java @@ -11,8 +11,6 @@ *******************************************************************************/ package org.eclipse.tm.terminal.view.ui.tabs; -import static org.eclipse.tm.internal.terminal.control.ITerminalListener3.*; - import java.util.Map; import org.eclipse.core.runtime.Assert; @@ -121,16 +119,22 @@ private void updateTitle(final String title, final TerminalTitleRequestor reques } // Run asynchronously in the display thread item.getDisplay().asyncExec(() -> { - Boolean flag = false; + if (item.isDisposed()) { + // tab has been closed + return; + } + // Get the original terminal properties associated with the tab item + @SuppressWarnings({ "unchecked" }) final Map properties = (Map) item.getData("properties"); //$NON-NLS-1$ - if (properties.containsKey(ITerminalsConnectorConstants.PROP_TITLE_UPDATE_API)) { - flag = (Boolean) properties.get(ITerminalsConnectorConstants.PROP_TITLE_UPDATE_API); - } - // Check if terminal should be updated either using API only (flag == true) - // or using API and ANSI command (flag == false). - if (flag == true && requestor != null && requestor == TerminalTitleRequestor.ANSI) { - return; + if (properties.containsKey(ITerminalsConnectorConstants.PROP_TITLE_DISABLE_ANSI_TITLE)) { + if (properties.get( + ITerminalsConnectorConstants.PROP_TITLE_DISABLE_ANSI_TITLE) instanceof Boolean disableAnsi) { + // Check if terminal title can be updated from ANSI escape sequence + if (disableAnsi && requestor == TerminalTitleRequestor.ANSI) { + return; + } + } } // New title must have value. @@ -188,9 +192,9 @@ public void setTerminalTitle(final String title) { } /** - * Sets Terminal tilte and checks if originator is ANSI command. + * Sets Terminal title and checks if originator is ANSI command. * If originator is ANSI command in terminal and user does not want to use - * ANSI command to upate terminal then return else update title. + * ANSI command to update terminal then return else update title. * @param title Title to update. * @param requestor Item that requests terminal title update. */