22
22
23
23
package processing .app ;
24
24
25
- import cc .arduino .DefaultUncaughtExceptionHandler ;
25
+ import cc .arduino .contributions . BuiltInCoreIsNewerCheck ;
26
26
import cc .arduino .contributions .DownloadableContributionVersionComparator ;
27
27
import cc .arduino .contributions .VersionHelper ;
28
28
import cc .arduino .contributions .libraries .ContributedLibrary ;
36
36
import cc .arduino .files .DeleteFilesOnShutdown ;
37
37
import cc .arduino .packages .DiscoveryManager ;
38
38
import cc .arduino .utils .Progress ;
39
- import cc .arduino .view .SplashScreenHelper ;
39
+ import cc .arduino .view .*;
40
+ import cc .arduino .view .Event ;
40
41
import com .google .common .base .Predicate ;
41
42
import com .google .common .base .Predicates ;
42
43
import com .google .common .collect .Collections2 ;
@@ -111,6 +112,7 @@ public boolean apply(UserLibrary library) {
111
112
// are the same for all windows (since the board and serial port that are
112
113
// actually used are determined by the preferences, which are shared)
113
114
private List <JMenu > boardsCustomMenus ;
115
+ private volatile Action openBoardsManager ;
114
116
115
117
static public void main (String args []) throws Exception {
116
118
System .setProperty ("awt.useSystemAAFontSettings" , "on" );
@@ -446,6 +448,9 @@ protected void onProgress(Progress progress) {
446
448
if (PreferencesData .getBoolean ("update.check" )) {
447
449
new UpdateCheck (this );
448
450
}
451
+
452
+ new Thread (new BuiltInCoreIsNewerCheck (this )).start ();
453
+
449
454
} else if (parser .isNoOpMode ()) {
450
455
// Do nothing (intended for only changing preferences)
451
456
System .exit (0 );
@@ -1265,7 +1270,7 @@ protected void onIndexesUpdated() throws Exception {
1265
1270
rebuildExamplesMenu (Editor .examplesMenu );
1266
1271
}
1267
1272
1268
- private void openInstallBoardDialog () throws Exception {
1273
+ private void openInstallBoardDialog (final String filterText ) throws Exception {
1269
1274
// Create dialog for contribution manager
1270
1275
@ SuppressWarnings ("serial" )
1271
1276
ContributionManagerUI managerUI = new ContributionManagerUI (activeEditor ) {
@@ -1274,6 +1279,10 @@ protected void onIndexesUpdated() throws Exception {
1274
1279
BaseNoGui .initPackages ();
1275
1280
rebuildBoardsMenu ();
1276
1281
setIndexer (BaseNoGui .indexer );
1282
+ if (StringUtils .isNotEmpty (filterText )) {
1283
+ setFilterText (filterText );
1284
+ }
1285
+
1277
1286
}
1278
1287
};
1279
1288
managerUI .setLocationRelativeTo (activeEditor );
@@ -1294,18 +1303,22 @@ public void rebuildBoardsMenu() throws Exception {
1294
1303
JMenu boardMenu = new JMenu (_ ("Board" ));
1295
1304
boardMenu .putClientProperty ("removeOnWindowDeactivation" , true );
1296
1305
MenuScroller .setScrollerFor (boardMenu );
1297
- @ SuppressWarnings ( "serial" )
1298
- Action runInstaller = new AbstractAction (_ ("Boards Manager..." )) {
1306
+
1307
+ openBoardsManager = new AbstractAction (_ ("Boards Manager..." )) {
1299
1308
public void actionPerformed (ActionEvent actionevent ) {
1309
+ String filterText = "" ;
1310
+ if (actionevent instanceof cc .arduino .view .Event ) {
1311
+ filterText = ((Event ) actionevent ).getPayload ().get ("filterText" ).toString ();
1312
+ }
1300
1313
try {
1301
- openInstallBoardDialog ();
1314
+ openInstallBoardDialog (filterText );
1302
1315
} catch (Exception e ) {
1303
1316
//TODO show error
1304
1317
e .printStackTrace ();
1305
1318
}
1306
1319
}
1307
1320
};
1308
- boardMenu .add (new JMenuItem (runInstaller ));
1321
+ boardMenu .add (new JMenuItem (openBoardsManager ));
1309
1322
boardsCustomMenus .add (boardMenu );
1310
1323
1311
1324
// If there are no platforms installed we are done
@@ -2700,7 +2713,15 @@ public Editor getActiveEditor() {
2700
2713
return activeEditor ;
2701
2714
}
2702
2715
2716
+ public boolean hasActiveEditor () {
2717
+ return activeEditor != null ;
2718
+ }
2719
+
2703
2720
public List <Editor > getEditors () {
2704
2721
return new LinkedList <Editor >(editors );
2705
2722
}
2723
+
2724
+ public Action getOpenBoardsManager () {
2725
+ return openBoardsManager ;
2726
+ }
2706
2727
}
0 commit comments