Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Provide more options to configure the NotificationPopup

オープン
#4,487 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
java
領域
desktop

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.
主要言語
Java
スター
124
フォーク
269
平均マージ
2日 2時間
マージ済み PR(30日)
70

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

eclipse-platform/eclipse.platform.ui のほかの issue

eclipse-platform/eclipse.platform.ui の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。