File tree 3 files changed +19
-3
lines changed
arduino-core/src/cc/arduino
3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ public void run() {
102
102
Editor ed = base .getActiveEditor ();
103
103
notificationPopup = new NotificationPopup (ed , hyperlinkListener , text );
104
104
if (ed .isFocused ()) {
105
- notificationPopup .setVisible ( true );
105
+ notificationPopup .begin ( );
106
106
return ;
107
107
}
108
108
@@ -116,7 +116,7 @@ public void windowLostFocus(WindowEvent evt) {
116
116
117
117
@ Override
118
118
public void windowGainedFocus (WindowEvent evt ) {
119
- notificationPopup .setVisible ( true );
119
+ notificationPopup .begin ( );
120
120
for (Editor e : base .getEditors ())
121
121
e .removeWindowFocusListener (this );
122
122
}
Original file line number Diff line number Diff line change 42
42
import java .awt .event .MouseEvent ;
43
43
import java .awt .event .WindowAdapter ;
44
44
import java .awt .event .WindowEvent ;
45
+ import java .util .Timer ;
46
+ import java .util .TimerTask ;
45
47
46
48
import javax .swing .ImageIcon ;
47
49
import javax .swing .JButton ;
52
54
import javax .swing .border .LineBorder ;
53
55
import javax .swing .event .HyperlinkListener ;
54
56
57
+ import cc .arduino .Constants ;
55
58
import processing .app .Theme ;
56
59
57
60
public class NotificationPopup extends JDialog {
58
61
62
+ private Timer autoCloseTimer = new Timer (false );
63
+
59
64
public NotificationPopup (Frame parent , HyperlinkListener hyperlinkListener ,
60
65
String message ) {
61
66
super (parent , false );
@@ -130,6 +135,17 @@ private void updateLocation(Frame parent) {
130
135
}
131
136
132
137
public void close () {
138
+ autoCloseTimer .cancel ();
133
139
dispatchEvent (new WindowEvent (this , WindowEvent .WINDOW_CLOSING ));
134
140
}
141
+
142
+ public void begin () {
143
+ autoCloseTimer .schedule (new TimerTask () {
144
+ @ Override
145
+ public void run () {
146
+ close ();
147
+ }
148
+ }, Constants .NOTIFICATION_POPUP_AUTOCLOSE_DELAY );
149
+ setVisible (true );
150
+ }
135
151
}
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ public class Constants {
44
44
public static final String LIBRARY_DEVELOPMENT_FLAG_FILE = ".development" ;
45
45
46
46
public static final long BOARDS_LIBS_UPDATABLE_CHECK_START_PERIOD = 60000 ;
47
- public static final int NOTIFICATION_POPUP_AUTOCLOSE_DELAY = 10000 ;
47
+ public static final long NOTIFICATION_POPUP_AUTOCLOSE_DELAY = 10000 ;
48
48
49
49
public static final String PROXY_TYPE_NONE = "none" ;
50
50
public static final String PROXY_TYPE_AUTO = "auto" ;
You can’t perform that action at this time.
0 commit comments