Skip to content

Commit 1db3a95

Browse files
committed
Make message dialog more compact
Removed unnecessary spacing in the message dialog to improve visual alignment and create a more compact, cleaner layout. Fixes : #2929
1 parent d4ffd3f commit 1db3a95

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IconAndMessageDialog.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2015 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -100,13 +100,14 @@ protected Control createMessageArea(Composite composite) {
100100
if (message != null) {
101101
messageLabel = new Label(composite, getMessageLabelStyle());
102102
messageLabel.setText(message);
103+
int minWidthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH - 50);
103104
GridDataFactory
104105
.fillDefaults()
105106
.align(SWT.FILL, SWT.BEGINNING)
106107
.grab(true, false)
107-
.hint(
108-
convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH),
109-
SWT.DEFAULT).applyTo(messageLabel);
108+
.indent(5, 0)
109+
.hint(message.length() > 40 ? minWidthHint : SWT.DEFAULT, SWT.DEFAULT)
110+
.applyTo(messageLabel);
110111
}
111112
return composite;
112113
}

bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/MessageDialog.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2016 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -328,7 +328,6 @@ protected Control createDialogArea(Composite parent) {
328328
layout.marginWidth = 0;
329329
composite.setLayout(layout);
330330
GridData data = new GridData(GridData.FILL_BOTH);
331-
data.horizontalSpan = 2;
332331
composite.setLayoutData(data);
333332
// allow subclasses to add custom controls
334333
customArea = createCustomArea(composite);

0 commit comments

Comments
 (0)