@@ -104,7 +104,7 @@ public Sketch(Editor _editor, File file) throws IOException {
104
104
* Another exception is when an external editor is in use,
105
105
* in which case the load happens each time "run" is hit.
106
106
*/
107
- protected void load () throws IOException {
107
+ private void load () throws IOException {
108
108
load (false );
109
109
}
110
110
@@ -569,10 +569,8 @@ public boolean save() throws IOException {
569
569
// rename .pde files to .ino
570
570
File mainFile = new File (getMainFilePath ());
571
571
File mainFolder = mainFile .getParentFile ();
572
- File [] pdeFiles = mainFolder .listFiles (new FilenameFilter () {
573
- public boolean accept (File dir , String name ) {
574
- return name .toLowerCase ().endsWith (".pde" );
575
- }
572
+ File [] pdeFiles = mainFolder .listFiles ((dir , name ) -> {
573
+ return name .toLowerCase ().endsWith (".pde" );
576
574
});
577
575
578
576
if (pdeFiles != null && pdeFiles .length > 0 ) {
@@ -695,6 +693,7 @@ protected boolean saveAs() throws IOException {
695
693
return false ;
696
694
}
697
695
} catch (IOException e ) {
696
+ //ignore
698
697
}
699
698
700
699
// if the new folder already exists, then need to remove
@@ -939,7 +938,7 @@ public void importLibrary(UserLibrary lib) throws IOException {
939
938
* Add import statements to the current tab for all of packages inside
940
939
* the specified jar file.
941
940
*/
942
- public void importLibrary (File jarPath ) throws IOException {
941
+ private void importLibrary (File jarPath ) throws IOException {
943
942
// make sure the user didn't hide the sketch folder
944
943
ensureExistence ();
945
944
@@ -983,7 +982,7 @@ public void setCurrentCode(int which) {
983
982
setCurrentCode (which , false );
984
983
}
985
984
986
- public void setCurrentCode (int which , boolean forceUpdate ) {
985
+ private void setCurrentCode (int which , boolean forceUpdate ) {
987
986
// if current is null, then this is the first setCurrent(0)
988
987
if (!forceUpdate && (currentIndex == which ) && (current != null )) {
989
988
return ;
@@ -1096,18 +1095,13 @@ public String build(boolean verbose, boolean save) throws RunnerException, Prefe
1096
1095
*
1097
1096
* @return null if compilation failed, main class name if not
1098
1097
*/
1099
- public String build (String buildPath , boolean verbose , boolean save ) throws RunnerException , PreferencesMapException {
1098
+ private String build (String buildPath , boolean verbose , boolean save ) throws RunnerException , PreferencesMapException {
1100
1099
// run the preprocessor
1101
1100
editor .status .progressUpdate (20 );
1102
1101
1103
1102
ensureExistence ();
1104
1103
1105
- ProgressListener pl = new ProgressListener () {
1106
- @ Override
1107
- public void progress (int percent ) {
1108
- editor .status .progressUpdate (percent );
1109
- }
1110
- };
1104
+ ProgressListener pl = editor .status ::progressUpdate ;
1111
1105
1112
1106
return Compiler .build (data , buildPath , tempBuildFolder , pl , verbose , save );
1113
1107
}
@@ -1120,7 +1114,7 @@ protected boolean exportApplet(boolean usingProgrammer) throws Exception {
1120
1114
/**
1121
1115
* Handle export to applet.
1122
1116
*/
1123
- public boolean exportApplet (String appletPath , boolean usingProgrammer )
1117
+ private boolean exportApplet (String appletPath , boolean usingProgrammer )
1124
1118
throws Exception {
1125
1119
1126
1120
prepare ();
@@ -1146,7 +1140,7 @@ public boolean exportApplet(String appletPath, boolean usingProgrammer)
1146
1140
return success ;
1147
1141
}
1148
1142
1149
- protected boolean upload (String buildPath , String suggestedClassName , boolean usingProgrammer ) throws Exception {
1143
+ private boolean upload (String buildPath , String suggestedClassName , boolean usingProgrammer ) throws Exception {
1150
1144
1151
1145
Uploader uploader = Compiler .getUploaderByPreferences (false );
1152
1146
@@ -1165,7 +1159,7 @@ protected boolean upload(String buildPath, String suggestedClassName, boolean us
1165
1159
PreferencesData .set (uploader .getAuthorizationKey (), dialog .getPassword ());
1166
1160
}
1167
1161
1168
- List <String > warningsAccumulator = new LinkedList <String >();
1162
+ List <String > warningsAccumulator = new LinkedList <>();
1169
1163
try {
1170
1164
success = Compiler .upload (data , uploader , buildPath , suggestedClassName , usingProgrammer , false , warningsAccumulator );
1171
1165
} finally {
@@ -1191,7 +1185,7 @@ protected boolean upload(String buildPath, String suggestedClassName, boolean us
1191
1185
* Only checks to see if the main folder is still around,
1192
1186
* but not its contents.
1193
1187
*/
1194
- protected void ensureExistence () {
1188
+ private void ensureExistence () {
1195
1189
if (data .getFolder ().exists ()) return ;
1196
1190
1197
1191
Base .showWarning (_ ("Sketch Disappeared" ),
@@ -1254,15 +1248,15 @@ public boolean isReadOnly() {
1254
1248
/**
1255
1249
* True if the specified code has the default file extension.
1256
1250
*/
1257
- public boolean hasDefaultExtension (SketchCode code ) {
1251
+ private boolean hasDefaultExtension (SketchCode code ) {
1258
1252
return code .isExtension (getDefaultExtension ());
1259
1253
}
1260
1254
1261
1255
1262
1256
/**
1263
1257
* True if the specified extension is the default file extension.
1264
1258
*/
1265
- public boolean isDefaultExtension (String what ) {
1259
+ private boolean isDefaultExtension (String what ) {
1266
1260
return what .equals (getDefaultExtension ());
1267
1261
}
1268
1262
@@ -1271,7 +1265,7 @@ public boolean isDefaultExtension(String what) {
1271
1265
* Check this extension (no dots, please) against the list of valid
1272
1266
* extensions.
1273
1267
*/
1274
- public boolean validExtension (String what ) {
1268
+ private boolean validExtension (String what ) {
1275
1269
return SketchData .EXTENSIONS .contains (what );
1276
1270
}
1277
1271
@@ -1324,7 +1318,7 @@ public File getFolder() {
1324
1318
* Create the data folder if it does not exist already. As a convenience,
1325
1319
* it also returns the data folder, since it's likely about to be used.
1326
1320
*/
1327
- public File prepareDataFolder () {
1321
+ private File prepareDataFolder () {
1328
1322
if (!data .getDataFolder ().exists ()) {
1329
1323
data .getDataFolder ().mkdirs ();
1330
1324
}
@@ -1336,7 +1330,7 @@ public File prepareDataFolder() {
1336
1330
* Create the code folder if it does not exist already. As a convenience,
1337
1331
* it also returns the code folder, since it's likely about to be used.
1338
1332
*/
1339
- public File prepareCodeFolder () {
1333
+ private File prepareCodeFolder () {
1340
1334
if (!data .getCodeFolder ().exists ()) {
1341
1335
data .getCodeFolder ().mkdirs ();
1342
1336
}
@@ -1369,7 +1363,7 @@ public SketchCode getCurrentCode() {
1369
1363
}
1370
1364
1371
1365
1372
- public void setUntitled (boolean u ) {
1366
+ private void setUntitled (boolean u ) {
1373
1367
editor .untitled = u ;
1374
1368
}
1375
1369
@@ -1386,7 +1380,7 @@ public boolean isUntitled() {
1386
1380
* Convert to sanitized name and alert the user
1387
1381
* if changes were made.
1388
1382
*/
1389
- static public String checkName (String origName ) {
1383
+ private static String checkName (String origName ) {
1390
1384
String newName = BaseNoGui .sanitizeName (origName );
1391
1385
1392
1386
if (!newName .equals (origName )) {
0 commit comments