From a2c14a40d1ae33a746090a708a85c90d83e16794 Mon Sep 17 00:00:00 2001 From: Simeon Andreev Date: Tue, 26 May 2026 19:10:51 +0300 Subject: [PATCH] Allow customizing CommonTab Open up CommonTab for overriding methods, to customize what elements are shown in the UI. This allows to e.g. hide common tab elements that are not relevant for custom launch types. Fixes: https://github.com/eclipse-platform/eclipse.platform/issues/2675 --- .../ui/org/eclipse/debug/ui/CommonTab.java | 42 ++++++++++++------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java index 1caddfe3e09..3bc965d90c8 100644 --- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java +++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java @@ -205,9 +205,9 @@ IDialogSettings getDialogBoundsSettings(String id) { /** * Creates the favorites control * @param parent the parent composite to add this one to - * @since 3.2 + * @since 3.21 */ - private void createFavoritesComponent(Composite parent) { + protected void createFavoritesComponent(Composite parent) { Group favComp = SWTFactory.createGroup(parent, LaunchConfigurationsMessages.CommonTab_Display_in_favorites_menu__10, 1, 1, GridData.FILL_BOTH); fFavoritesTable = CheckboxTableViewer.newCheckList(favComp, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION); Control table = fFavoritesTable.getControl(); @@ -222,9 +222,9 @@ private void createFavoritesComponent(Composite parent) { /** * Creates the shared config component * @param parent the parent composite to add this component to - * @since 3.2 + * @since 3.21 */ - private void createSharedConfigComponent(Composite parent) { + protected void createSharedConfigComponent(Composite parent) { Group group = SWTFactory.createGroup(parent, LaunchConfigurationsMessages.CommonTab_0, 3, 2, GridData.FILL_HORIZONTAL); Composite comp = SWTFactory.createComposite(group, parent.getFont(), 3, 3, GridData.FILL_BOTH, 0, 0); fLocalRadioButton = createRadioButton(comp, LaunchConfigurationsMessages.CommonTab_L_ocal_3); @@ -660,6 +660,24 @@ private IContainer getContainer(String path) { @Override public void initializeFrom(ILaunchConfiguration configuration) { + updateSharedConfig(configuration); + updateFavoritesFromConfig(configuration); + updateLaunchInBackground(configuration); + updateEncoding(configuration); + updateConsoleOutput(configuration); + + boolean terminateDescendants = getAttribute(configuration, DebugPlugin.ATTR_TERMINATE_DESCENDANTS, true); + fTerminateDescendantsButton.setSelection(terminateDescendants); + } + + /** + * Updates a configuration with the values set in the section for shared + * configurations. + * + * @param configuration the configuration to update + * @since 3.21 + */ + protected void updateSharedConfig(ILaunchConfiguration configuration) { boolean isShared = !configuration.isLocal(); fSharedRadioButton.setSelection(isShared); fLocalRadioButton.setSelection(!isShared); @@ -676,13 +694,6 @@ public void initializeFrom(ILaunchConfiguration configuration) { } fSharedLocationText.setText(containerName); } - updateFavoritesFromConfig(configuration); - updateLaunchInBackground(configuration); - updateEncoding(configuration); - updateConsoleOutput(configuration); - - boolean terminateDescendants = getAttribute(configuration, DebugPlugin.ATTR_TERMINATE_DESCENDANTS, true); - fTerminateDescendantsButton.setSelection(terminateDescendants); } /** @@ -802,9 +813,10 @@ public static boolean isLaunchInBackground(ILaunchConfiguration configuration) { /** * Updates the favorites selections from the local configuration * @param config the local configuration + * @since 3.21 */ @SuppressWarnings("deprecation") - private void updateFavoritesFromConfig(ILaunchConfiguration config) { + protected void updateFavoritesFromConfig(ILaunchConfiguration config) { fFavoritesTable.setInput(config); fFavoritesTable.setCheckedElements(new Object[]{}); List groups = getAttribute(config, IDebugUIConstants.ATTR_FAVORITE_GROUPS, new ArrayList<>()); @@ -833,8 +845,9 @@ private void updateFavoritesFromConfig(ILaunchConfiguration config) { /** * Updates the configuration form the local shared config working copy * @param config the local shared config working copy + * @since 3.21 */ - private void updateConfigFromLocalShared(ILaunchConfigurationWorkingCopy config) { + protected void updateConfigFromLocalShared(ILaunchConfigurationWorkingCopy config) { if (isShared()) { String containerPathString = fSharedLocationText.getText(); IContainer container = getContainer(containerPathString); @@ -865,9 +878,10 @@ protected LaunchConfigurationManager getLaunchConfigurationManager() { * when comparing if content is equal, since 'false' is default * and will be missing for older configurations. * @param config the configuration to update + * @since 3.21 */ @SuppressWarnings("deprecation") - private void updateConfigFromFavorites(ILaunchConfigurationWorkingCopy config) { + protected void updateConfigFromFavorites(ILaunchConfigurationWorkingCopy config) { Object[] checked = fFavoritesTable.getCheckedElements(); boolean debug = getAttribute(config, IDebugUIConstants.ATTR_DEBUG_FAVORITE, false); boolean run = getAttribute(config, IDebugUIConstants.ATTR_RUN_FAVORITE, false);