Skip to content

Commit 0dcc09a

Browse files
author
Federico Fissore
committed
Restored Preferences static delegate methods and marking them as @deprecated
1 parent 85b2298 commit 0dcc09a

File tree

3 files changed

+65
-7
lines changed

3 files changed

+65
-7
lines changed

app/src/processing/app/Base.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ public Base(String[] args) throws Exception {
309309
// Save the preferences. For GUI mode, this happens in the quit
310310
// handler, but for other modes we should also make sure to save
311311
// them.
312-
Preferences.save();
312+
PreferencesData.save();
313313

314314
if (parser.isInstallBoard()) {
315315
ContributionsIndexer indexer = new ContributionsIndexer(BaseNoGui.getSettingsFolder());
@@ -988,7 +988,7 @@ public boolean handleClose(Editor editor) {
988988
storeSketches();
989989

990990
// Save out the current prefs state
991-
Preferences.save();
991+
PreferencesData.save();
992992

993993
// Since this wasn't an actual Quit event, call System.exit()
994994
System.exit(0);
@@ -1035,7 +1035,7 @@ public boolean handleQuit() {
10351035
editor.internalCloseRunner();
10361036
}
10371037
// Save out the current prefs state
1038-
Preferences.save();
1038+
PreferencesData.save();
10391039

10401040
if (!OSUtils.isMacOS()) {
10411041
// If this was fired from the menu or an AppleEvent (the Finder),

app/src/processing/app/Editor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2309,7 +2309,7 @@ protected boolean handleOpenInternal(File sketchFile) {
23092309
// Store information on who's open and running
23102310
// (in case there's a crash or something that can't be recovered)
23112311
base.storeSketches();
2312-
Preferences.save();
2312+
PreferencesData.save();
23132313

23142314
// opening was successful
23152315
return true;

app/src/processing/app/Preferences.java

+61-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import processing.app.helpers.FileUtils;
2525
import processing.app.helpers.OSUtils;
2626
import processing.app.helpers.PreferencesHelper;
27+
import processing.app.helpers.PreferencesMap;
2728
import processing.app.legacy.PApplet;
2829

2930
import javax.swing.*;
@@ -854,12 +855,69 @@ protected void showFrame(Editor editor) {
854855
dialog.setVisible(true);
855856
}
856857

857-
858-
static protected void save() {
858+
@Deprecated
859+
protected static void save() {
859860
PreferencesData.save();
860861
}
861862

863+
@Deprecated
864+
public static String get(String attribute) {
865+
return PreferencesData.get(attribute);
866+
}
862867

863-
// .................................................................
868+
@Deprecated
869+
public static String get(String attribute, String defaultValue) {
870+
return PreferencesData.get(attribute, defaultValue);
871+
}
872+
873+
@Deprecated
874+
public static boolean has(String key) {
875+
return PreferencesData.has(key);
876+
}
877+
878+
@Deprecated
879+
public static void remove(String key) {
880+
PreferencesData.remove(key);
881+
}
882+
883+
@Deprecated
884+
public static void set(String attribute, String value) {
885+
PreferencesData.set(attribute, value);
886+
}
887+
888+
@Deprecated
889+
public static boolean getBoolean(String attribute) {
890+
return PreferencesData.getBoolean(attribute);
891+
}
892+
893+
@Deprecated
894+
public static void setBoolean(String attribute, boolean value) {
895+
PreferencesData.setBoolean(attribute, value);
896+
}
897+
898+
@Deprecated
899+
public static int getInteger(String attribute) {
900+
return PreferencesData.getInteger(attribute);
901+
}
902+
903+
@Deprecated
904+
public static int getInteger(String attribute, int defaultValue) {
905+
return PreferencesData.getInteger(attribute, defaultValue);
906+
}
907+
908+
@Deprecated
909+
public static void setInteger(String key, int value) {
910+
PreferencesData.setInteger(key, value);
911+
}
912+
913+
@Deprecated
914+
public static PreferencesMap getMap() {
915+
return PreferencesData.getMap();
916+
}
917+
918+
@Deprecated
919+
public static void setDoSave(boolean value) {
920+
PreferencesData.setDoSave(value);
921+
}
864922

865923
}

0 commit comments

Comments
 (0)