From 18634bb4971fcf78eee467ebf5e173ef023a011b Mon Sep 17 00:00:00 2001 From: Jonah Graham Date: Tue, 15 Aug 2023 20:00:18 -0400 Subject: [PATCH] Evolve the API - Create new interface (ITerminalListener3) so clients can opt in to new API but clients that haven't updated will still work as they are called from VT100TerminalControl.setTerminalTitle - Restore the ITerminalControl.setTerminalTitle(String) and ITerminalViewControl.setTerminalTitle(String) - Mark all the old methods as deprecated for removal and document plan to remove - Fix and update all version numbers (since tags, MANIFEST versions and dependencies ranges) --- NewAndNoteworthy/CHANGELOG-API.md | 12 +++++++++ .../META-INF/MANIFEST.MF | 6 ++--- .../META-INF/MANIFEST.MF | 2 +- .../terminal/control/ITerminalListener.java | 7 ++--- .../terminal/control/ITerminalListener3.java | 27 +++++++++++++++++++ .../control/ITerminalViewControl.java | 7 +++++ .../emulator/VT100TerminalControl.java | 14 +++++++++- .../provisional/api/ITerminalControl.java | 7 +++++ .../TerminalConnectorFactoryTest.java | 4 +++ .../connector/TerminalConnectorTest.java | 4 +++ .../META-INF/MANIFEST.MF | 2 +- .../ITerminalsConnectorConstants.java | 1 + .../META-INF/MANIFEST.MF | 4 +-- .../view/ui/tabs/TabTerminalListener.java | 11 +++++--- 14 files changed, 94 insertions(+), 14 deletions(-) create mode 100644 terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/control/ITerminalListener3.java diff --git a/NewAndNoteworthy/CHANGELOG-API.md b/NewAndNoteworthy/CHANGELOG-API.md index 959172965d7..63a743cdd3c 100644 --- a/NewAndNoteworthy/CHANGELOG-API.md +++ b/NewAndNoteworthy/CHANGELOG-API.md @@ -604,3 +604,15 @@ spelled BuiltinDetectionArgsGeneric instead. These APIs will be removed and remote connection for attach launch will be moved in the implementation of `IGDBProcesses.attachDebuggerToProcess()`. See https://github.com/eclipse-cdt/cdt/pull/336 + +## API Removals after September 2025 + +### Terminal Control API for setting title without `requestor` will be removed + +These APIs will be removed and are replaced by versions with `requestor` parameter. + +- org.eclipse.tm.internal.terminal.control.ITerminalListener.setTerminalTitle(String) +- org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl.setTerminalTitle(String) +- org.eclipse.tm.internal.terminal.control.ITerminalViewControl.setTerminalTitle(String) + +See https://github.com/eclipse-cdt/cdt/issues/494 diff --git a/terminal/plugins/org.eclipse.tm.terminal.connector.remote/META-INF/MANIFEST.MF b/terminal/plugins/org.eclipse.tm.terminal.connector.remote/META-INF/MANIFEST.MF index fc25e2566e8..709a7792d30 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.connector.remote/META-INF/MANIFEST.MF +++ b/terminal/plugins/org.eclipse.tm.terminal.connector.remote/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.tm.terminal.connector.remote;singleton:=true -Bundle-Version: 4.8.0.qualifier +Bundle-Version: 4.8.100.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Require-Bundle: org.eclipse.ui, @@ -13,8 +13,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.core.resources, org.eclipse.swt, org.eclipse.jface, - org.eclipse.tm.terminal.view.core;bundle-version="4.5.0";resolution:=optional, - org.eclipse.tm.terminal.view.ui;bundle-version="4.5.0";resolution:=optional, + org.eclipse.tm.terminal.view.core;bundle-version="4.10.0";resolution:=optional, + org.eclipse.tm.terminal.view.ui;bundle-version="4.11.100";resolution:=optional, org.eclipse.core.expressions Bundle-RequiredExecutionEnvironment: JavaSE-17 Export-Package: org.eclipse.tm.terminal.connector.remote, diff --git a/terminal/plugins/org.eclipse.tm.terminal.control/META-INF/MANIFEST.MF b/terminal/plugins/org.eclipse.tm.terminal.control/META-INF/MANIFEST.MF index a684dd2c5a1..e368e8d27cb 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.control/META-INF/MANIFEST.MF +++ b/terminal/plugins/org.eclipse.tm.terminal.control/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.tm.terminal.control; singleton:=true -Bundle-Version: 5.4.100.qualifier +Bundle-Version: 5.5.0.qualifier Bundle-Activator: org.eclipse.tm.internal.terminal.control.impl.TerminalPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/control/ITerminalListener.java b/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/control/ITerminalListener.java index c6ec0790a65..400521ae774 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/control/ITerminalListener.java +++ b/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/control/ITerminalListener.java @@ -28,9 +28,10 @@ public interface ITerminalListener { void setState(TerminalState state); /** - * Set the title of the terminal. + * @deprecated Migrate to implementing {@link ITerminalListener3} and + * override {@link ITerminalListener3#setTerminalTitle(String, String) * @param title - * @param requestor Who requests update. */ - void setTerminalTitle(String title, String requestor); + @Deprecated(forRemoval = true) + void setTerminalTitle(String title); } 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 new file mode 100644 index 00000000000..718528638bd --- /dev/null +++ b/terminal/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/control/ITerminalListener3.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2023 YOUR COPYRIGHT HOLDER HERE + * + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License 2.0 which accompanies this distribution, and is + * available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ +package org.eclipse.tm.internal.terminal.control; + +/** + * TODO add comment here to say that if ITerminalListener3 is implemented, + * {@link #setTerminalTitle(String, String)} will be called instead of {@link #setTerminalTitle(String)} + * + * @since 5.5 + */ +public interface ITerminalListener3 extends ITerminalListener2 { + + /** + * Set the title of the terminal. + * + * @param title + * @param requestor Who requests update. + */ + void setTerminalTitle(String title, String 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 51d46e2f24b..9c90e4d9afe 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 @@ -190,10 +190,17 @@ public interface ITerminalViewControl { */ void removeMouseListener(ITerminalMouseListener listener); + /** + * @deprecated call {@link #setTerminalTitle(String, String)} instead + */ + @Deprecated(forRemoval = true) + void setTerminalTitle(String newTitle); + /** * Set the title of the terminal. * @param newTitle * @param requestor Who requests update. + * @since 5.5 */ void setTerminalTitle(String newTitle, String requestor); 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 417c2848428..0bda4221e12 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 @@ -98,6 +98,7 @@ import org.eclipse.tm.internal.terminal.control.ICommandInputField; 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.ITerminalMouseListener; import org.eclipse.tm.internal.terminal.control.ITerminalViewControl; import org.eclipse.tm.internal.terminal.control.impl.ITerminalControlForText; @@ -1259,9 +1260,20 @@ private void processKeyBinding(KeyEvent event, int accelerator) { } + @Override + public void setTerminalTitle(String title) { + setTerminalTitle(title, + "deprecated or unknown or null (depending on what the enum that replaces this string looks like)"); + } + @Override public void setTerminalTitle(String title, String requestor) { - fTerminalListener.setTerminalTitle(title, requestor); + if (fTerminalListener instanceof ITerminalListener3 listener3) { + listener3.setTerminalTitle(title, requestor); + } else { + fTerminalListener.setTerminalTitle(title); + } + } @Override 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 ddee1db05ac..1e4f0efbdc0 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 @@ -154,10 +154,17 @@ public interface ITerminalControl { */ OutputStream getRemoteToTerminalOutputStream(); + /** + * @deprecated call {@link #setTerminalTitle(String, String)} instead + */ + @Deprecated(forRemoval = true) + void setTerminalTitle(String title); + /** * Set the title of the terminal view. * @param title * @param requestor Who requests title update. + * @since 5.5 */ void setTerminalTitle(String title, String requestor); 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 bd7f1c7091f..0e355717a01 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 @@ -95,6 +95,10 @@ public void setMsg(String msg) { public void setState(TerminalState state) { } + @Override + public void setTerminalTitle(String title) { + } + @Override public void setTerminalTitle(String title, String requestor) { } 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 88fbabf70f8..68aa5b3bf0b 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 @@ -95,6 +95,10 @@ public void setMsg(String msg) { public void setState(TerminalState state) { } + @Override + public void setTerminalTitle(String title) { + } + @Override public void setTerminalTitle(String title, String requestor) { } diff --git a/terminal/plugins/org.eclipse.tm.terminal.view.core/META-INF/MANIFEST.MF b/terminal/plugins/org.eclipse.tm.terminal.view.core/META-INF/MANIFEST.MF index c99f00a361b..23ed06406eb 100644 --- a/terminal/plugins/org.eclipse.tm.terminal.view.core/META-INF/MANIFEST.MF +++ b/terminal/plugins/org.eclipse.tm.terminal.view.core/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.core;singleton:=true -Bundle-Version: 4.9.100.qualifier +Bundle-Version: 4.10.0.qualifier Bundle-Activator: org.eclipse.tm.terminal.view.core.activator.CoreBundleActivator Bundle-Vendor: %providerName Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400", 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 b5608abc237..833f1f185a7 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 @@ -76,6 +76,7 @@ public interface ITerminalsConnectorConstants { * using terminal API and ANSI command. *

* Property Type: {@link String} + * @since 4.10 */ public static final String PROP_TITLE_UPDATE_API = "titleUpdateAPI"; //$NON-NLS-1$ 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 0a913fbb056..285f6af7180 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 @@ -11,8 +11,8 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400", org.eclipse.core.variables;bundle-version="3.2.600", org.eclipse.debug.ui;bundle-version="3.8.1";resolution:=optional, org.eclipse.egit.ui;bundle-version="2.0.0";resolution:=optional, - org.eclipse.tm.terminal.view.core;bundle-version="[4.8.0,5.0.0)", - org.eclipse.tm.terminal.control;bundle-version="[5.2.0,6.0.0)", + org.eclipse.tm.terminal.view.core;bundle-version="[4.10.0,5.0.0)", + org.eclipse.tm.terminal.control;bundle-version="[5.5.0,6.0.0)", org.eclipse.ui;bundle-version="3.8.0", org.eclipse.ui.ide;bundle-version="3.18.0";resolution:=optional, org.eclipse.ui.editors;bundle-version="3.14.0";resolution:=optional, 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 ba6b04420bc..4e44863f5b8 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 @@ -18,7 +18,7 @@ import org.eclipse.osgi.util.NLS; import org.eclipse.swt.custom.CTabItem; import org.eclipse.swt.widgets.Display; -import org.eclipse.tm.internal.terminal.control.ITerminalListener2; +import org.eclipse.tm.internal.terminal.control.ITerminalListener3; import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; import org.eclipse.tm.terminal.view.core.interfaces.constants.ITerminalsConnectorConstants; import org.eclipse.tm.terminal.view.ui.nls.Messages; @@ -26,7 +26,7 @@ /** * Terminal tab default terminal listener implementation. */ -public class TabTerminalListener implements ITerminalListener2 { +public class TabTerminalListener implements ITerminalListener3 { private static final String TAB_TERMINAL_LISTENER = "TabTerminalListener"; //$NON-NLS-1$ /* default */ final TabFolderManager tabFolderManager; private CTabItem tabItem; @@ -163,14 +163,19 @@ protected String getTerminalConsoleTabTitle(TerminalState state) { return newTitle != null && !newTitle.equals(oldTitle) ? newTitle : null; } + @Override + public void setTerminalTitle(String title) { + throw new UnsupportedOperationException("Should not be called as this class implements ITerminalListener3"); //$NON-NLS-1$ + } + /** * Sets Terminal tilte 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. * @param title Title to update. * @param requestor Who requests title update. Can be null. - * @since 11.3 */ + @Override public void setTerminalTitle(String title, String requestor) { CTabItem item = getTabItem();