mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-30 19:52:13 +01:00
Autoclose notification popup after 10 seconds.
This commit is contained in:
parent
1a7eaaf8b2
commit
8d7ee63c70
@ -102,7 +102,7 @@ public class ContributionsSelfCheck extends TimerTask {
|
||||
Editor ed = base.getActiveEditor();
|
||||
notificationPopup = new NotificationPopup(ed, hyperlinkListener, text);
|
||||
if (ed.isFocused()) {
|
||||
notificationPopup.setVisible(true);
|
||||
notificationPopup.begin();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ public class ContributionsSelfCheck extends TimerTask {
|
||||
|
||||
@Override
|
||||
public void windowGainedFocus(WindowEvent evt) {
|
||||
notificationPopup.setVisible(true);
|
||||
notificationPopup.begin();
|
||||
for (Editor e : base.getEditors())
|
||||
e.removeWindowFocusListener(this);
|
||||
}
|
||||
|
@ -42,6 +42,8 @@ import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
@ -52,10 +54,13 @@ import javax.swing.WindowConstants;
|
||||
import javax.swing.border.LineBorder;
|
||||
import javax.swing.event.HyperlinkListener;
|
||||
|
||||
import cc.arduino.Constants;
|
||||
import processing.app.Theme;
|
||||
|
||||
public class NotificationPopup extends JDialog {
|
||||
|
||||
private Timer autoCloseTimer = new Timer(false);
|
||||
|
||||
public NotificationPopup(Frame parent, HyperlinkListener hyperlinkListener,
|
||||
String message) {
|
||||
super(parent, false);
|
||||
@ -130,6 +135,17 @@ public class NotificationPopup extends JDialog {
|
||||
}
|
||||
|
||||
public void close() {
|
||||
autoCloseTimer.cancel();
|
||||
dispatchEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING));
|
||||
}
|
||||
|
||||
public void begin() {
|
||||
autoCloseTimer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
close();
|
||||
}
|
||||
}, Constants.NOTIFICATION_POPUP_AUTOCLOSE_DELAY);
|
||||
setVisible(true);
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class Constants {
|
||||
public static final String LIBRARY_DEVELOPMENT_FLAG_FILE = ".development";
|
||||
|
||||
public static final long BOARDS_LIBS_UPDATABLE_CHECK_START_PERIOD = 60000;
|
||||
public static final int NOTIFICATION_POPUP_AUTOCLOSE_DELAY = 10000;
|
||||
public static final long NOTIFICATION_POPUP_AUTOCLOSE_DELAY = 10000;
|
||||
|
||||
public static final String PROXY_TYPE_NONE = "none";
|
||||
public static final String PROXY_TYPE_AUTO = "auto";
|
||||
|
Loading…
x
Reference in New Issue
Block a user