49
49
public class Sketch {
50
50
static private File tempBuildFolder ;
51
51
52
- private Editor editor ;
52
+ private final Editor editor ;
53
53
54
54
/** true if any of the files have been modified. */
55
55
private boolean modified ;
56
56
57
57
private SketchCodeDocument current ;
58
58
private int currentIndex ;
59
59
60
- private SketchData data ;
60
+ private final SketchData data ;
61
61
62
- /** Class name for the PApplet, as determined by the preprocessor. */
63
- private String appletClassName ;
64
-
65
62
/**
66
63
* path is location of the main .pde file, because this is also
67
64
* simplest to use when opening the file from the finder/explorer.
@@ -126,7 +123,7 @@ protected void load(boolean forceUpdate) throws IOException {
126
123
}
127
124
128
125
129
- boolean renamingCode ;
126
+ private boolean renamingCode ;
130
127
131
128
/**
132
129
* Handler for the New Code menu option.
@@ -523,7 +520,7 @@ public void setModified(boolean state) {
523
520
}
524
521
525
522
526
- protected void calcModified () {
523
+ private void calcModified () {
527
524
modified = false ;
528
525
for (SketchCode code : data .getCodes ()) {
529
526
if (code .isModified ()) {
@@ -615,7 +612,7 @@ public boolean accept(File dir, String name) {
615
612
}
616
613
617
614
618
- protected boolean renameCodeToInoExtension (File pdeFile ) {
615
+ private boolean renameCodeToInoExtension (File pdeFile ) {
619
616
for (SketchCode c : data .getCodes ()) {
620
617
if (!c .getFile ().equals (pdeFile ))
621
618
continue ;
@@ -640,9 +637,6 @@ protected boolean renameCodeToInoExtension(File pdeFile) {
640
637
* because they can cause trouble.
641
638
*/
642
639
protected boolean saveAs () throws IOException {
643
- String newParentDir = null ;
644
- String newName = null ;
645
-
646
640
// get new name for folder
647
641
FileDialog fd = new FileDialog (editor , _ ("Save sketch folder as..." ), FileDialog .SAVE );
648
642
if (isReadOnly () || isUntitled ()) {
@@ -658,8 +652,8 @@ protected boolean saveAs() throws IOException {
658
652
fd .setFile (oldName );
659
653
660
654
fd .setVisible (true );
661
- newParentDir = fd .getDirectory ();
662
- newName = fd .getFile ();
655
+ String newParentDir = fd .getDirectory ();
656
+ String newName = fd .getFile ();
663
657
664
658
// user canceled selection
665
659
if (newName == null ) return false ;
@@ -960,10 +954,10 @@ public void importLibrary(File jarPath) throws IOException {
960
954
// could also scan the text in the file to see if each import
961
955
// statement is already in there, but if the user has the import
962
956
// commented out, then this will be a problem.
963
- StringBuffer buffer = new StringBuffer ();
964
- for (int i = 0 ; i < list . length ; i ++ ) {
957
+ StringBuilder buffer = new StringBuilder ();
958
+ for (String aList : list ) {
965
959
buffer .append ("#include <" );
966
- buffer .append (list [ i ] );
960
+ buffer .append (aList );
967
961
buffer .append (">\n " );
968
962
}
969
963
buffer .append ('\n' );
@@ -1240,29 +1234,6 @@ protected boolean upload(String buildPath, String suggestedClassName, boolean us
1240
1234
return success ;
1241
1235
}
1242
1236
1243
-
1244
- public boolean exportApplicationPrompt () throws IOException , RunnerException {
1245
- return false ;
1246
- }
1247
-
1248
-
1249
- /**
1250
- * Export to application via GUI.
1251
- */
1252
- protected boolean exportApplication () throws IOException , RunnerException {
1253
- return false ;
1254
- }
1255
-
1256
-
1257
- /**
1258
- * Export to application without GUI.
1259
- */
1260
- public boolean exportApplication (String destPath ,
1261
- int exportPlatform ) throws IOException , RunnerException {
1262
- return false ;
1263
- }
1264
-
1265
-
1266
1237
/**
1267
1238
* Make sure the sketch hasn't been moved or deleted by some
1268
1239
* nefarious user. If they did, try to re-create it and save.
@@ -1361,7 +1332,7 @@ public String getDefaultExtension() {
1361
1332
return data .getDefaultExtension ();
1362
1333
}
1363
1334
1364
- static private List <String > hiddenExtensions = Arrays .asList ("ino" , "pde" );
1335
+ static private final List <String > hiddenExtensions = Arrays .asList ("ino" , "pde" );
1365
1336
1366
1337
public List <String > getHiddenExtensions () {
1367
1338
return hiddenExtensions ;
@@ -1457,11 +1428,6 @@ public boolean isUntitled() {
1457
1428
}
1458
1429
1459
1430
1460
- public String getAppletClassName2 () {
1461
- return appletClassName ;
1462
- }
1463
-
1464
-
1465
1431
// .................................................................
1466
1432
1467
1433
0 commit comments