Skip to content

Commit 25b6a44

Browse files
committed
Rename AppPreferences and AppMessages Classes back to it's original name
1 parent be2886b commit 25b6a44

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+547
-551
lines changed

app/src/processing/app/Base.java

Lines changed: 68 additions & 68 deletions
Large diffs are not rendered by default.

app/src/processing/app/Console.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static public void startup() {
123123

124124
static public void cleanTempFiles() {
125125
final File consoleDir = Base.getSettingsFile("console");
126-
final int days = AppPreferences.getInteger("console.temp.days");
126+
final int days = Preferences.getInteger("console.temp.days");
127127

128128
if (days > 0) {
129129
final long now = new Date().getTime();

app/src/processing/app/Language.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static private String[] listSupported() {
126126
throw new IOException("Could not read list of files inside " + baseFolder);
127127
}
128128
} catch (IOException e) {
129-
AppMessages.showError("Translation Trouble",
129+
Messages.showError("Translation Trouble",
130130
"There was a problem reading the language translations folder.\n" +
131131
"You may need to reinstall, or report if the problem persists.", e);
132132
}
@@ -295,7 +295,7 @@ static public void addModeStrings(Mode mode) {
295295
}
296296

297297

298-
// /** Set new language (called by AppPreferences) */
298+
// /** Set new language (called by Preferences) */
299299
// static public void setLanguage(String language) {
300300
// this.language = language;
301301
//
@@ -353,7 +353,7 @@ static class LanguageBundle {
353353
table = new HashMap<>();
354354

355355
// Disabling load from sketchbook in 4.2.1, because the path
356-
// is not yet loaded from AppPreferences when languages are loaded.
356+
// is not yet loaded from Preferences when languages are loaded.
357357
// Fixing that (i.e. reloading languages) makes the code a lot
358358
// more complicated for dubious benefit over simply editing the
359359
// language files in the download (i.e. still would not help

app/src/processing/app/Library.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ private void handleExports() {
198198
if (oldName != null) {
199199
variantFolder = new File(libraryFolder, variant);
200200
if (variantFolder.exists()) {
201-
AppMessages.log("Please update " + getName() + " for Processing 4. " +
201+
Messages.log("Please update " + getName() + " for Processing 4. " +
202202
variantFolder + " is the older naming scheme.");
203203
}
204204
}
@@ -345,18 +345,18 @@ public void addPackageList(Map<String, List<Library>> importToLibraryTable) {
345345
} else {
346346
if(!instructed) {
347347
instructed = true;
348-
AppMessages.err("The library found in");
349-
AppMessages.err(getPath());
350-
AppMessages.err("conflicts with");
348+
Messages.err("The library found in");
349+
Messages.err(getPath());
350+
Messages.err("conflicts with");
351351
for (Library library : libraries) {
352-
AppMessages.err(library.getPath());
352+
Messages.err(library.getPath());
353353
}
354-
AppMessages.err("which already define(s) the package " + pkg);
355-
AppMessages.err("If you have a line in your sketch that reads");
356-
AppMessages.err("import " + pkg + ".*;");
357-
AppMessages.err("Then you'll need to first remove one of those libraries.");
354+
Messages.err("which already define(s) the package " + pkg);
355+
Messages.err("If you have a line in your sketch that reads");
356+
Messages.err("import " + pkg + ".*;");
357+
Messages.err("Then you'll need to first remove one of those libraries.");
358358
}else{
359-
AppMessages.err("\tPackage ("+pkg+")\t conflict found in [" + name + "] with libraries: " + libraries.stream().map(Library::getName).reduce((a, b) -> a + ", " + b).orElse(""));
359+
Messages.err("\tPackage ("+pkg+")\t conflict found in [" + name + "] with libraries: " + libraries.stream().map(Library::getName).reduce((a, b) -> a + ", " + b).orElse(""));
360360
}
361361
}
362362
libraries.add(this);
@@ -585,7 +585,7 @@ static public List<File> discover(File folder) {
585585
"The library \"" + potentialName + "\" cannot be used.\n" +
586586
"Library names must contain only basic letters and numbers.\n" +
587587
"(ASCII only and no spaces, and it cannot start with a number)";
588-
AppMessages.showMessage("Ignoring bad library name", mess);
588+
Messages.showMessage("Ignoring bad library name", mess);
589589

590590
} else {
591591
String pkg = findCollision(libraryFolder);
@@ -594,7 +594,7 @@ static public List<File> discover(File folder) {
594594
"The library \"" + potentialName + "\" cannot be used\n" +
595595
"because it contains the " + pkg + " libraries.\n" +
596596
"Please contact the library author for an update.";
597-
AppMessages.showMessage("Ignoring bad library", mess);
597+
Messages.showMessage("Ignoring bad library", mess);
598598

599599
// Move the folder out of the way
600600
File badFolder = new File(baseFolder.getParentFile(), "disabled");
@@ -637,7 +637,7 @@ static public List<Library> list(File folder) {
637637
if (foundEarlier != null) {
638638
// Warn the user about this duplication (later, on the EDT)
639639
if (!duplicateLibraries.contains(name)) {
640-
AppMessages.showWarningTiered("Duplicate Library Found",
640+
Messages.showWarningTiered("Duplicate Library Found",
641641
"There are multiple libraries named “" + name + "”",
642642
"Please remove either “" + foundEarlier.getName() +
643643
" or “" + lib.getName() + "”\n" +

app/src/processing/app/AppMessages.kt renamed to app/src/processing/app/Messages.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,14 @@
1919
package processing.app
2020

2121
import processing.app.ui.Toolkit
22-
import processing.utils.Messages
23-
2422
import java.awt.EventQueue
2523
import java.awt.Frame
2624
import java.io.PrintWriter
2725
import java.io.StringWriter
2826
import javax.swing.JFrame
2927
import javax.swing.JOptionPane
3028

31-
class AppMessages : Messages() {
29+
class Messages : processing.utils.Messages() {
3230
companion object {
3331
/**
3432
* Non-fatal error message with two levels of formatting.

app/src/processing/app/Mode.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public Mode(Base base, File folder) {
107107
loadKeywords(file);
108108
}
109109
} catch (IOException e) {
110-
AppMessages.showWarning("Problem loading keywords",
110+
Messages.showWarning("Problem loading keywords",
111111
"Could not load keywords file for " + getTitle() + " mode.", e);
112112
}
113113
}
@@ -371,7 +371,7 @@ public Library getLibrary(String pkgName) throws SketchException {
371371
secondary += "<b>" + library.getName() + "</b> (" + location + ")<br>";
372372
}
373373
secondary += "Extra libraries need to be removed before this sketch can be used.";
374-
AppMessages.showWarningTiered("Duplicate Library Problem", primary, secondary, null);
374+
Messages.showWarningTiered("Duplicate Library Problem", primary, secondary, null);
375375
throw new SketchException("Duplicate libraries found for " + pkgName + ".");
376376

377377
} else {
@@ -820,7 +820,7 @@ public Library findLibraryByName(String libName) {
820820
public void prepareExportFolder(File targetFolder) {
821821
if (targetFolder != null) {
822822
// Nuke the old application folder because it can cause trouble
823-
if (AppPreferences.getBoolean("export.delete_target_folder")) {
823+
if (Preferences.getBoolean("export.delete_target_folder")) {
824824
if (targetFolder.exists()) {
825825
try {
826826
Platform.deleteFile(targetFolder);
@@ -833,7 +833,7 @@ public void prepareExportFolder(File targetFolder) {
833833
// Create a fresh output folder (needed before preproc is run next)
834834
if (!targetFolder.exists()) {
835835
if (!targetFolder.mkdirs()) {
836-
AppMessages.err("Could not create " + targetFolder);
836+
Messages.err("Could not create " + targetFolder);
837837
}
838838
}
839839
}

app/src/processing/app/Platform.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static public void init() {
103103
inst = (DefaultPlatform) platformClass.getDeclaredConstructor().newInstance();
104104

105105
} catch (Exception e) {
106-
AppMessages.showError("Problem Setting the Platform",
106+
Messages.showError("Problem Setting the Platform",
107107
"An unknown error occurred while trying to load\n" +
108108
"platform-specific code for your machine.", e);
109109
}
@@ -163,7 +163,7 @@ static public void openURL(String url) {
163163
inst.openURL(url);
164164

165165
} catch (Exception e) {
166-
AppMessages.showWarning("Problem Opening URL",
166+
Messages.showWarning("Problem Opening URL",
167167
"Could not open the URL\n" + url, e);
168168
}
169169
}
@@ -187,7 +187,7 @@ static public void openFolder(File file) {
187187
inst.openFolder(file);
188188

189189
} catch (Exception e) {
190-
AppMessages.showWarning("Problem Opening Folder",
190+
Messages.showWarning("Problem Opening Folder",
191191
"Could not open the folder\n" + file.getAbsolutePath(), e);
192192
}
193193
}
@@ -355,7 +355,7 @@ static public File getContentFile(String name) {
355355
try {
356356
decodedPath = pathURL.toURI().getSchemeSpecificPart();
357357
} catch (URISyntaxException e) {
358-
AppMessages.showError("Missing File",
358+
Messages.showError("Missing File",
359359
"Could not access a required file:\n" +
360360
"<b>" + name + "</b>\n" +
361361
"You may need to reinstall Processing.", e);
@@ -582,7 +582,7 @@ static public boolean deleteFile(File file) throws IOException {
582582
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
583583

584584
/**
585-
* These methods were refactored to use the AppPreferences system instead of
585+
* These methods were refactored to use the Preferences system instead of
586586
* actual environment variables, since modifying environment variables at runtime
587587
* proved problematic. This approach provides similar functionality
588588
* while being compatible with various platforms and execution environments.
@@ -592,11 +592,11 @@ static public boolean deleteFile(File file) throws IOException {
592592
*/
593593

594594
static public void setenv(String variable, String value) {
595-
AppPreferences.set(variable, value);
595+
Preferences.set(variable, value);
596596
}
597597

598598
static public String getenv(String variable) {
599-
return AppPreferences.get(variable);
599+
return Preferences.get(variable);
600600
}
601601

602602
static public int unsetenv(String variable) {

app/src/processing/app/AppPreferences.java renamed to app/src/processing/app/Preferences.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
package processing.app;
22

3-
import processing.utils.Preferences;
43
import processing.app.ui.Toolkit;
54

65
import java.awt.*;
76

8-
public class AppPreferences extends Preferences {
7+
public class Preferences extends processing.utils.Preferences {
98

109
static public void init() {
11-
Preferences.init();
10+
processing.utils.Preferences.init();
1211

1312
// For CJK users, enable IM support by default
1413
if (Language.useInputMethod() && !getBoolean("editor.input_method_support")) {

app/src/processing/app/Schema.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ class Schema {
162162
}
163163
?: emptyMap()
164164
for ((key, value) in options){
165-
AppPreferences.set(key, value)
165+
Preferences.set(key, value)
166166
}
167-
AppPreferences.save()
167+
Preferences.save()
168168

169169
return null
170170
}

app/src/processing/app/Settings.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333

3434
/**
35-
* Storage class for theme settings. This was separated from the AppPreferences
35+
* Storage class for theme settings. This was separated from the Preferences
3636
* class for 1.0 so that the coloring wouldn't conflict with previous releases
3737
* and to make way for future ability to customize.
3838
*/
@@ -88,7 +88,7 @@ public void load(File additions) {
8888
}
8989
}
9090
} else {
91-
AppMessages.err(additions + " could not be read");
91+
Messages.err(additions + " could not be read");
9292
}
9393

9494
// check for platform-specific properties in the defaults
@@ -201,7 +201,7 @@ public void setColor(String attr, Color what) {
201201
}
202202

203203

204-
// identical version found in AppPreferences.java
204+
// identical version found in Preferences.java
205205
public Font getFont(String attr) {
206206
try {
207207
boolean replace = false;
@@ -250,7 +250,7 @@ public Font getFont(String attr) {
250250
} catch (Exception e) {
251251
// Adding try/catch block because this may be where
252252
// a lot of startup crashes are happening.
253-
AppMessages.log("Error with font " + get(attr) + " for attribute " + attr);
253+
Messages.log("Error with font " + get(attr) + " for attribute " + attr);
254254
}
255255
return new Font("Dialog", Font.PLAIN, 12);
256256
}

0 commit comments

Comments
 (0)