Repository navigation
Provide more options to configure the NotificationPopup #4487
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Let's make sure issue is not already fixed in latest builds first.
- I verified latest Integration Build of Eclipse SDK doesn't provide the feature.
Suggestion
The NotificationPopup (org.eclipse.jface.notifications) has some minor flaws, where some workarounds are necessary.
- The MIN_HEIGHT, MAX_WIDTH and PADDING_EDGE of the popup cannot be configured as desired, as it is hardcoded in the AbstractNotificationPopup.
To shrink the height of the popup, I needed to create a workaround like this:
Point size = popup.getShell().getSize();
Point location = popup.getShell().getLocation();
popup.getShell().pack();
popup.getShell().setLocation(location.x, location.y + (size.y - popup.getShell().getSize().y));It would be nice to have these options in the builder like this:
NotificationPopup.forDisplay(Display.getDefault())
.text("A problem occurred.")
.title("Warning", true)
.minHeight(0)
.maxWidth(500)
.paddingEdge(10)
.open();- The Popup does not follow its parent shell, when it is moved or resized. It would be nice to have an option for this when creating the popup (or maybe as default behavior)
The listener could look like this:
static void attachPopupFollower(Shell parentShell, Shell popupShell, int padding) {
Listener moveListener = e -> {
if (parentShell == null || parentShell.isDisposed()) {
return;
}
if (popupShell == null || popupShell.isDisposed()) {
return;
}
Rectangle clientArea = parentShell.getClientArea();
Point clientOriginOnDisplay = parentShell.toDisplay(clientArea.x, clientArea.y);
Point popupSize = popupShell.getSize();
int x = clientOriginOnDisplay.x + clientArea.width - popupSize.x - padding; //use the configured paddingEdge here
int y = clientOriginOnDisplay.y + clientArea.height - popupSize.y - padding;
popupShell.setLocation(x, y);
};
parentShell.addListener(SWT.Move, moveListener);
parentShell.addListener(SWT.Resize, moveListener);
popupShell.addListener(SWT.Dispose, e -> {
if (!parentShell.isDisposed()) {
parentShell.removeListener(SWT.Move, moveListener);
parentShell.removeListener(SWT.Resize, moveListener);
}
});
}I attached the whole example as a file here.
Community
- I understand suggesting an enhancement doesn't mandate anyone to implement it. Other contributors may consider this suggestion, or not, at their own convenience. The most efficient way to get it fixed is that I implement it myself and contribute it back as a good quality patch to the project.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity
plumstone commentedon Oct 13, 2026
NotificationExample.java
BeckerWdf commentedon Oct 13, 2026
Your proposal sounds reasonable. Could you provide a PR for that?
vogella commentedon Oct 13, 2026
See also #4472 and #4473 for recent changes