Provide more options to configure the NotificationPopup
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Start in the org.eclipse.jface.notifications package, reading AbstractNotificationPopup for the hardcoded MIN_HEIGHT, MAX_WIDTH and PADDING_EDGE constants and NotificationPopup for the builder. Before writing code, check the three comments for whether maintainers agree on the builder API and on making the popup follow its parent shell by default. Done means the new options are configurable and the popup repositions on parent Move and Resize, which needs SWT knowledge and likely a test in the UI test bundle.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Java
- Stelle
- 124
- Fork
- 269
- Merge medio
- 2g 2h
- PR unite (30g)
- 70
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di eclipse-platform/eclipse.platform.ui
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
eclipse-platform/eclipse.platform.ui#4125 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
eclipse-platform/eclipse.platform.ui#4016 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
eclipse-platform/eclipse.platform.ui#3892 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
eclipse-platform/eclipse.platform.ui#2687 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Provide a shared color blend helper in JFaceForse già presa @vogella l’ha presa 1 giorno fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 18/100
eclipse-platform/eclipse.platform.ui#4486 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di eclipse-platform/eclipse.platform.ui
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug new windows
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
iOS podspec depends on `React-Codegen`, which resolves to an unrelated pod on CocoaPods trunkAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
GantMan/jail-monkey#380 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
objectionary/jucs#145 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
objectionary/lints#1559 ·
I maintainer di solito rispondono entro 2 giorni