From 0dcc09afab9d585ac264567cea5efc3f0eb9305d Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Tue, 5 May 2015 14:25:47 +0200 Subject: [PATCH] Restored Preferences static delegate methods and marking them as @Deprecated --- app/src/processing/app/Base.java | 6 +-- app/src/processing/app/Editor.java | 2 +- app/src/processing/app/Preferences.java | 64 +++++++++++++++++++++++-- 3 files changed, 65 insertions(+), 7 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index da5185c00..2af1c5086 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -309,7 +309,7 @@ public class Base { // Save the preferences. For GUI mode, this happens in the quit // handler, but for other modes we should also make sure to save // them. - Preferences.save(); + PreferencesData.save(); if (parser.isInstallBoard()) { ContributionsIndexer indexer = new ContributionsIndexer(BaseNoGui.getSettingsFolder()); @@ -988,7 +988,7 @@ public class Base { storeSketches(); // Save out the current prefs state - Preferences.save(); + PreferencesData.save(); // Since this wasn't an actual Quit event, call System.exit() System.exit(0); @@ -1035,7 +1035,7 @@ public class Base { editor.internalCloseRunner(); } // Save out the current prefs state - Preferences.save(); + PreferencesData.save(); if (!OSUtils.isMacOS()) { // If this was fired from the menu or an AppleEvent (the Finder), diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index 5547d80f1..c211ef5f9 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -2309,7 +2309,7 @@ public class Editor extends JFrame implements RunnerListener { // Store information on who's open and running // (in case there's a crash or something that can't be recovered) base.storeSketches(); - Preferences.save(); + PreferencesData.save(); // opening was successful return true; diff --git a/app/src/processing/app/Preferences.java b/app/src/processing/app/Preferences.java index 21d7be859..e951f3e46 100644 --- a/app/src/processing/app/Preferences.java +++ b/app/src/processing/app/Preferences.java @@ -24,6 +24,7 @@ package processing.app; import processing.app.helpers.FileUtils; import processing.app.helpers.OSUtils; import processing.app.helpers.PreferencesHelper; +import processing.app.helpers.PreferencesMap; import processing.app.legacy.PApplet; import javax.swing.*; @@ -854,12 +855,69 @@ public class Preferences { dialog.setVisible(true); } - - static protected void save() { + @Deprecated + protected static void save() { PreferencesData.save(); } + @Deprecated + public static String get(String attribute) { + return PreferencesData.get(attribute); + } - // ................................................................. + @Deprecated + public static String get(String attribute, String defaultValue) { + return PreferencesData.get(attribute, defaultValue); + } + + @Deprecated + public static boolean has(String key) { + return PreferencesData.has(key); + } + + @Deprecated + public static void remove(String key) { + PreferencesData.remove(key); + } + + @Deprecated + public static void set(String attribute, String value) { + PreferencesData.set(attribute, value); + } + + @Deprecated + public static boolean getBoolean(String attribute) { + return PreferencesData.getBoolean(attribute); + } + + @Deprecated + public static void setBoolean(String attribute, boolean value) { + PreferencesData.setBoolean(attribute, value); + } + + @Deprecated + public static int getInteger(String attribute) { + return PreferencesData.getInteger(attribute); + } + + @Deprecated + public static int getInteger(String attribute, int defaultValue) { + return PreferencesData.getInteger(attribute, defaultValue); + } + + @Deprecated + public static void setInteger(String key, int value) { + PreferencesData.setInteger(key, value); + } + + @Deprecated + public static PreferencesMap getMap() { + return PreferencesData.getMap(); + } + + @Deprecated + public static void setDoSave(boolean value) { + PreferencesData.setDoSave(value); + } }