Skip to content

Commit c8a2696

Browse files
committed
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: eclipse-equinox/p2#1049
1 parent 1e6a7c9 commit c8a2696

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/dialogs/PropertyDialog.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717

1818
import java.util.Iterator;
1919
import org.eclipse.core.runtime.Adapters;
20+
import org.eclipse.jface.dialogs.IDialogConstants;
2021
import org.eclipse.jface.dialogs.MessageDialog;
2122
import org.eclipse.jface.preference.IPreferenceNode;
2223
import org.eclipse.jface.preference.PreferenceManager;
2324
import org.eclipse.jface.viewers.ISelection;
2425
import org.eclipse.jface.viewers.IStructuredSelection;
2526
import org.eclipse.jface.viewers.StructuredSelection;
2627
import org.eclipse.osgi.util.NLS;
28+
import org.eclipse.swt.widgets.Composite;
2729
import org.eclipse.swt.widgets.Control;
2830
import org.eclipse.swt.widgets.Shell;
2931
import org.eclipse.ui.PlatformUI;
@@ -90,6 +92,20 @@ public static PropertyDialog createDialogOn(Shell shell, final String propertyPa
9092
return propertyDialog;
9193

9294
}
95+
96+
@Override
97+
protected void buttonPressed(int buttonId) {
98+
if (buttonId == IDialogConstants.CLOSE_ID) {
99+
cancelPressed();
100+
return;
101+
}
102+
super.buttonPressed(buttonId);
103+
}
104+
105+
@Override
106+
protected void createButtonsForButtonBar(Composite parent) {
107+
createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true);
108+
}
93109

94110
@Override
95111
protected void addButtonsToHelpControl(Control control) {
@@ -162,6 +178,11 @@ protected String getSelectedNodePreference() {
162178
return lastPropertyId;
163179
}
164180

181+
@Override
182+
public void updateButtons() {
183+
// This function is overridden to remove the Apply and close button
184+
}
185+
165186
/**
166187
* Get the name of the selected item preference
167188
*/

0 commit comments

Comments
 (0)