Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Provide more options to configure the NotificationPopup

Abierto
#4,487 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
java
Área
desktop

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement

Let's make sure issue is not already fixed in latest builds first.

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.
Lenguaje dominante
Java
Estrellas
124
Forks
269
Merge medio
2 d 7 h
PR fusionados (30 d)
68

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de eclipse-platform/eclipse.platform.ui

Todos los issues de eclipse-platform/eclipse.platform.ui

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.