From 6651650fa658a9f80248286cdbf344f372f51022 Mon Sep 17 00:00:00 2001 From: Elsa Zacharia Date: Fri, 8 May 2026 16:10:42 +0530 Subject: [PATCH] Remove unnecessary Apply and close button in property dialog This commit retains only the cancel button and eliminates the Apply and close button in the property dialog which is unnecessary in the current context there. There is only a description provided in the property dialog and there is no event that needs an apply option. Fixes: https://github.com/eclipse-equinox/p2/issues/1049 --- .../ui/internal/dialogs/PropertyDialog.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/dialogs/PropertyDialog.java b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/dialogs/PropertyDialog.java index 598111cce77..c420c79d02e 100644 --- a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/dialogs/PropertyDialog.java +++ b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/dialogs/PropertyDialog.java @@ -17,6 +17,7 @@ import java.util.Iterator; import org.eclipse.core.runtime.Adapters; +import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.preference.IPreferenceNode; import org.eclipse.jface.preference.PreferenceManager; @@ -24,6 +25,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; @@ -90,6 +92,20 @@ public static PropertyDialog createDialogOn(Shell shell, final String propertyPa return propertyDialog; } + + @Override + protected void buttonPressed(int buttonId) { + if (buttonId == IDialogConstants.CLOSE_ID) { + cancelPressed(); + return; + } + super.buttonPressed(buttonId); + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true); + } @Override protected void addButtonsToHelpControl(Control control) { @@ -162,6 +178,11 @@ protected String getSelectedNodePreference() { return lastPropertyId; } + @Override + public void updateButtons() { + // This function is overridden to remove the Apply and close button + } + /** * Get the name of the selected item preference */