@@ -143,7 +143,7 @@ static public void guardedMain(String args[]) throws Exception {
143143
144144 BaseNoGui .initParameters (args );
145145
146- System .setProperty ("swing.aatext" , Preferences .get ("editor.antialias" , "true" ));
146+ System .setProperty ("swing.aatext" , PreferencesData .get ("editor.antialias" , "true" ));
147147
148148 BaseNoGui .initVersion ();
149149
@@ -257,9 +257,9 @@ public Base(String[] args) throws Exception {
257257 if (sketchbookPath == null ) {
258258 File defaultFolder = getDefaultSketchbookFolderOrPromptForIt ();
259259 if (BaseNoGui .getPortableFolder () != null )
260- Preferences .set ("sketchbook.path" , BaseNoGui .getPortableSketchbookFolder ());
260+ PreferencesData .set ("sketchbook.path" , BaseNoGui .getPortableSketchbookFolder ());
261261 else
262- Preferences .set ("sketchbook.path" , defaultFolder .getAbsolutePath ());
262+ PreferencesData .set ("sketchbook.path" , defaultFolder .getAbsolutePath ());
263263 if (!defaultFolder .exists ()) {
264264 defaultFolder .mkdirs ();
265265 }
@@ -293,7 +293,7 @@ public Base(String[] args) throws Exception {
293293
294294 boolean showEditor = parser .isGuiMode ();
295295 if (!parser .isForceSavePrefs ())
296- Preferences .setDoSave (showEditor );
296+ PreferencesData .setDoSave (showEditor );
297297 if (handleOpen (file , nextEditorLocation (), showEditor ) == null ) {
298298 String mess = I18n .format (_ ("Failed to open sketch: \" {0}\" " ), path );
299299 // Open failure is fatal in upload/verify mode
@@ -406,13 +406,13 @@ protected void onProgress(Progress progress) {
406406 } else if (parser .isVerifyOrUploadMode ()) {
407407 splashScreenHelper .close ();
408408 // Set verbosity for command line build
409- Preferences .set ("build.verbose" , "" + parser .isDoVerboseBuild ());
410- Preferences .set ("upload.verbose" , "" + parser .isDoVerboseUpload ());
411- Preferences .set ("runtime.preserve.temp.files" , Boolean .toString (parser .isPreserveTempFiles ()));
409+ PreferencesData .set ("build.verbose" , "" + parser .isDoVerboseBuild ());
410+ PreferencesData .set ("upload.verbose" , "" + parser .isDoVerboseUpload ());
411+ PreferencesData .set ("runtime.preserve.temp.files" , Boolean .toString (parser .isPreserveTempFiles ()));
412412
413413 // Make sure these verbosity preferences are only for the
414414 // current session
415- Preferences .setDoSave (false );
415+ PreferencesData .setDoSave (false );
416416
417417 Editor editor = editors .get (0 );
418418
@@ -443,14 +443,14 @@ protected void onProgress(Progress progress) {
443443 }
444444
445445 // Check for updates
446- if (Preferences .getBoolean ("update.check" )) {
446+ if (PreferencesData .getBoolean ("update.check" )) {
447447 new UpdateCheck (this );
448448 }
449449 } else if (parser .isNoOpMode ()) {
450450 // Do nothing (intended for only changing preferences)
451451 System .exit (0 );
452452 } else if (parser .isGetPrefMode ()) {
453- String value = Preferences .get (parser .getGetPref (), null );
453+ String value = PreferencesData .get (parser .getGetPref (), null );
454454 if (value != null ) {
455455 System .out .println (value );
456456 System .exit (0 );
@@ -474,11 +474,11 @@ protected boolean restoreSketches() throws Exception {
474474 Dimension screen = Toolkit .getDefaultToolkit ().getScreenSize ();
475475 boolean windowPositionValid = true ;
476476
477- if (Preferences .get ("last.screen.height" ) != null ) {
477+ if (PreferencesData .get ("last.screen.height" ) != null ) {
478478 // if screen size has changed, the window coordinates no longer
479479 // make sense, so don't use them unless they're identical
480- int screenW = Preferences .getInteger ("last.screen.width" );
481- int screenH = Preferences .getInteger ("last.screen.height" );
480+ int screenW = PreferencesData .getInteger ("last.screen.width" );
481+ int screenH = PreferencesData .getInteger ("last.screen.height" );
482482
483483 if ((screen .width != screenW ) || (screen .height != screenH )) {
484484 windowPositionValid = false ;
@@ -499,10 +499,10 @@ protected boolean restoreSketches() throws Exception {
499499 // If !windowPositionValid, then ignore the coordinates found for each.
500500
501501 // Save the sketch path and window placement for each open sketch
502- int count = Preferences .getInteger ("last.sketch.count" );
502+ int count = PreferencesData .getInteger ("last.sketch.count" );
503503 int opened = 0 ;
504504 for (int i = 0 ; i < count ; i ++) {
505- String path = Preferences .get ("last.sketch" + i + ".path" );
505+ String path = PreferencesData .get ("last.sketch" + i + ".path" );
506506 if (BaseNoGui .getPortableFolder () != null ) {
507507 File absolute = new File (BaseNoGui .getPortableFolder (), path );
508508 try {
@@ -513,7 +513,7 @@ protected boolean restoreSketches() throws Exception {
513513 }
514514 int [] location ;
515515 if (windowPositionValid ) {
516- String locationStr = Preferences .get ("last.sketch" + i + ".location" );
516+ String locationStr = PreferencesData .get ("last.sketch" + i + ".location" );
517517 location = PApplet .parseInt (PApplet .split (locationStr , ',' ));
518518 } else {
519519 location = nextEditorLocation ();
@@ -534,8 +534,8 @@ protected boolean restoreSketches() throws Exception {
534534 protected void storeSketches () {
535535 // Save the width and height of the screen
536536 Dimension screen = Toolkit .getDefaultToolkit ().getScreenSize ();
537- Preferences .setInteger ("last.screen.width" , screen .width );
538- Preferences .setInteger ("last.screen.height" , screen .height );
537+ PreferencesData .setInteger ("last.screen.width" , screen .width );
538+ PreferencesData .setInteger ("last.screen.height" , screen .height );
539539
540540 String untitledPath = untitledFolder .getAbsolutePath ();
541541
@@ -554,14 +554,14 @@ protected void storeSketches() {
554554 if (path == null )
555555 continue ;
556556 }
557- Preferences .set ("last.sketch" + index + ".path" , path );
557+ PreferencesData .set ("last.sketch" + index + ".path" , path );
558558
559559 int [] location = editor .getPlacement ();
560560 String locationStr = PApplet .join (PApplet .str (location ), "," );
561- Preferences .set ("last.sketch" + index + ".location" , locationStr );
561+ PreferencesData .set ("last.sketch" + index + ".location" , locationStr );
562562 index ++;
563563 }
564- Preferences .setInteger ("last.sketch.count" , index );
564+ PreferencesData .setInteger ("last.sketch.count" , index );
565565 }
566566
567567
@@ -577,7 +577,7 @@ protected void storeSketchPath(Editor editor, int index) {
577577 if (path == null )
578578 path = "" ;
579579 }
580- Preferences .set ("last.sketch" + index + ".path" , path );
580+ PreferencesData .set ("last.sketch" + index + ".path" , path );
581581 }
582582
583583
@@ -616,8 +616,8 @@ protected void handleActivated(Editor whichEditor) {
616616
617617
618618 protected int [] nextEditorLocation () {
619- int defaultWidth = Preferences .getInteger ("editor.window.width.default" );
620- int defaultHeight = Preferences .getInteger ("editor.window.height.default" );
619+ int defaultWidth = PreferencesData .getInteger ("editor.window.width.default" );
620+ int defaultHeight = PreferencesData .getInteger ("editor.window.height.default" );
621621
622622 if (activeEditor == null ) {
623623 Rectangle screen = GraphicsEnvironment .getLocalGraphicsEnvironment ().getDefaultScreenDevice ().getDefaultConfiguration ().getBounds ();
@@ -808,7 +808,7 @@ public void handleOpenReplace(File file) {
808808 public void handleOpenPrompt () throws Exception {
809809 // get the frontmost window frame for placing file dialog
810810 FileDialog fd = new FileDialog (activeEditor , _ ("Open an Arduino sketch..." ), FileDialog .LOAD );
811- File lastFolder = new File (Preferences .get ("last.folder" , getSketchbookFolder ().getAbsolutePath ()));
811+ File lastFolder = new File (PreferencesData .get ("last.folder" , getSketchbookFolder ().getAbsolutePath ()));
812812 if (lastFolder .exists () && lastFolder .isFile ()) {
813813 lastFolder = lastFolder .getParentFile ();
814814 }
@@ -832,7 +832,7 @@ public boolean accept(File dir, String name) {
832832
833833 File inputFile = new File (directory , filename );
834834
835- Preferences .set ("last.folder" , inputFile .getAbsolutePath ());
835+ PreferencesData .set ("last.folder" , inputFile .getAbsolutePath ());
836836 handleOpen (inputFile );
837837 }
838838
@@ -1378,9 +1378,9 @@ private JRadioButtonMenuItem createBoardMenusAndCustomMenus(
13781378 Map <String , ButtonGroup > buttonGroupsMap ,
13791379 TargetBoard board , TargetPlatform targetPlatform , TargetPackage targetPackage )
13801380 throws Exception {
1381- String selPackage = Preferences .get ("target_package" );
1382- String selPlatform = Preferences .get ("target_platform" );
1383- String selBoard = Preferences .get ("board" );
1381+ String selPackage = PreferencesData .get ("target_package" );
1382+ String selPlatform = PreferencesData .get ("target_platform" );
1383+ String selBoard = PreferencesData .get ("board" );
13841384
13851385 String boardId = board .getId ();
13861386 String packageName = targetPackage .getId ();
@@ -1418,7 +1418,7 @@ public void actionPerformed(ActionEvent actionevent) {
14181418 @ SuppressWarnings ("serial" )
14191419 Action subAction = new AbstractAction (_ (boardCustomMenu .get (customMenuOption ))) {
14201420 public void actionPerformed (ActionEvent e ) {
1421- Preferences .set ("custom_" + menuId , ((TargetBoard ) getValue ("board" )).getId () + "_" + getValue ("custom_menu_option" ));
1421+ PreferencesData .set ("custom_" + menuId , ((TargetBoard ) getValue ("board" )).getId () + "_" + getValue ("custom_menu_option" ));
14221422 onBoardOrPortChange ();
14231423 }
14241424 };
@@ -1433,7 +1433,7 @@ public void actionPerformed(ActionEvent e) {
14331433 menu .add (subItem );
14341434 buttonGroupsMap .get (menuId ).add (subItem );
14351435
1436- String selectedCustomMenuEntry = Preferences .get ("custom_" + menuId );
1436+ String selectedCustomMenuEntry = PreferencesData .get ("custom_" + menuId );
14371437 if (selBoard .equals (boardId ) && (boardId + "_" + customMenuOption ).equals (selectedCustomMenuEntry )) {
14381438 menuItemsToClickAfterStartup .add (subItem );
14391439 }
@@ -1534,12 +1534,12 @@ public void rebuildProgrammerMenu(JMenu menu) {
15341534 AbstractAction action = new AbstractAction (targetPlatform
15351535 .getProgrammer (programmer ).get ("name" )) {
15361536 public void actionPerformed (ActionEvent actionevent ) {
1537- Preferences .set ("programmer" , "" + getValue ("id" ));
1537+ PreferencesData .set ("programmer" , "" + getValue ("id" ));
15381538 }
15391539 };
15401540 action .putValue ("id" , id );
15411541 JMenuItem item = new JRadioButtonMenuItem (action );
1542- if (Preferences .get ("programmer" ).equals (id ))
1542+ if (PreferencesData .get ("programmer" ).equals (id ))
15431543 item .setSelected (true );
15441544 group .add (item );
15451545 menu .add (item );
0 commit comments