Skip to content

Redesign Message Dialog #2934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SougandhS
Copy link

Removes unwanted space and aligns message content & buttons to center

Before
image

After
Screenshot 2025-04-22 at 1 02 49 PM

Fixes : #2929

Copy link
Contributor

Test Results

 1 824 files  ±0   1 824 suites  ±0   1h 30m 39s ⏱️ - 7m 15s
 7 918 tests ±0   7 690 ✅ +1  228 💤 ±0  0 ❌  - 1 
23 841 runs  ±0  23 093 ✅ +1  748 💤 ±0  0 ❌  - 1 

Results for commit cd6224c. ± Comparison against base commit e6eb975.

@mickaelistria
Copy link
Contributor

As the discussion on the bug reveals, there is no obvious consensus to find between aligned left vs centered; however, all OSs recommend to get the width fit the content (ie no extra space), so I think for a first iteration, we should focus on just saving the extra space (changing the min width to 0 or DEFAULT), and consider whether to center or not later; maybe if all OSs align on the same recommendation some day.

@SougandhS
Copy link
Author

SougandhS commented Apr 24, 2025

Updated one

image

@mickaelistria
Copy link
Contributor

mickaelistria commented Apr 25, 2025

I'm seeing an issue with the given patch: the MessageDialog now tends to become too large:

Before
Screenshot From 2025-04-25 13-18-19

After
Screenshot From 2025-04-25 13-16-31

@SougandhS
Copy link
Author

I'm seeing an issue with the given patch: the MessageDialog now tends to become too large:

Made minor adjustment for these cases

Removed unnecessary spacing in the message dialog to improve visual
alignment and create a more compact, cleaner layout.

Fixes : eclipse-platform#2929
Copy link
Contributor

@merks merks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think changing the horizontalSpan is a bad idea. I'm not even sure why it's needed.

@@ -328,7 +328,6 @@ protected Control createDialogArea(Composite parent) {
layout.marginWidth = 0;
composite.setLayout(layout);
GridData data = new GridData(GridData.FILL_BOTH);
data.horizontalSpan = 2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought there was previously already feedback about this change affecting all subclasses. There are a great many so this seems not a good idea at all.

image

@@ -100,13 +100,14 @@ protected Control createMessageArea(Composite composite) {
if (message != null) {
messageLabel = new Label(composite, getMessageLabelStyle());
messageLabel.setText(message);
int minWidthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH - 50);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's odd to compute this in advance and then only use it conditionally later.

convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH),
SWT.DEFAULT).applyTo(messageLabel);
.indent(5, 0)
.hint(message.length() > 40 ? minWidthHint : SWT.DEFAULT, SWT.DEFAULT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The number 40 is quite magic. I wonder how things like font size and scaling might affect what this number should be?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Center text/save space on message dialogs?
3 participants