@@ -538,21 +538,21 @@ public void actionPerformed(ActionEvent e) {
538
538
});
539
539
fileMenu .add (saveAsMenuItem );
540
540
541
- item = newJMenuItem ("Upload" , 'U' );
541
+ item = newJMenuItem ("Upload to I/O Board " , 'U' );
542
542
item .addActionListener (new ActionListener () {
543
543
public void actionPerformed (ActionEvent e ) {
544
544
handleExport (false );
545
545
}
546
546
});
547
547
fileMenu .add (item );
548
548
549
- item = newJMenuItemShift ("Upload Using Programmer " , 'U' );
550
- item .addActionListener (new ActionListener () {
551
- public void actionPerformed (ActionEvent e ) {
552
- handleExport (true );
553
- }
554
- });
555
- fileMenu .add (item );
549
+ // item = newJMenuItemShift("Upload to I/O Board (verbose) ", 'U');
550
+ // item.addActionListener(new ActionListener() {
551
+ // public void actionPerformed(ActionEvent e) {
552
+ // handleExport(true);
553
+ // }
554
+ // });
555
+ // fileMenu.add(item);
556
556
557
557
fileMenu .addSeparator ();
558
558
@@ -618,13 +618,13 @@ public void actionPerformed(ActionEvent e) {
618
618
// });
619
619
// sketchMenu.add(item);
620
620
621
- // item = new JMenuItem("Stop");
622
- // item.addActionListener(new ActionListener() {
623
- // public void actionPerformed(ActionEvent e) {
624
- // handleStop();
625
- // }
626
- // });
627
- // sketchMenu.add(item);
621
+ item = new JMenuItem ("Stop" );
622
+ item .addActionListener (new ActionListener () {
623
+ public void actionPerformed (ActionEvent e ) {
624
+ handleStop ();
625
+ }
626
+ });
627
+ sketchMenu .add (item );
628
628
629
629
sketchMenu .addSeparator ();
630
630
@@ -693,20 +693,12 @@ public void actionPerformed(ActionEvent e) {
693
693
serialMenu = new JMenu ("Serial Port" );
694
694
populateSerialMenu ();
695
695
menu .add (serialMenu );
696
-
696
+
697
697
menu .addSeparator ();
698
-
699
- JMenu programmerMenu = new JMenu ("Programmer" );
700
- base .rebuildProgrammerMenu (programmerMenu );
701
- menu .add (programmerMenu );
702
698
703
- item = new JMenuItem ("Burn Bootloader" );
704
- item .addActionListener (new ActionListener () {
705
- public void actionPerformed (ActionEvent e ) {
706
- handleBurnBootloader ();
707
- }
708
- });
709
- menu .add (item );
699
+ JMenu bootloaderMenu = new JMenu ("Burn Bootloader" );
700
+ base .rebuildBurnBootloaderMenu (bootloaderMenu );
701
+ menu .add (bootloaderMenu );
710
702
711
703
menu .addMenuListener (new MenuListener () {
712
704
public void menuCanceled (MenuEvent e ) {}
@@ -997,8 +989,8 @@ protected void populateSerialMenu() {
997
989
//serialMenu.addSeparator();
998
990
//serialMenu.add(item);
999
991
}
1000
-
1001
-
992
+
993
+
1002
994
protected JMenu buildHelpMenu () {
1003
995
// To deal with a Mac OS X 10.5 bug, add an extra space after the name
1004
996
// so that the OS doesn't try to insert its slow help menu.
@@ -1895,12 +1887,12 @@ public Point getSketchLocation() {
1895
1887
* Implements Sketch → Stop, or pressing Stop on the toolbar.
1896
1888
*/
1897
1889
public void handleStop () { // called by menu or buttons
1898
- // toolbar.activate(EditorToolbar.STOP);
1890
+ toolbar .activate (EditorToolbar .STOP );
1899
1891
1900
1892
internalCloseRunner ();
1901
1893
1902
1894
toolbar .deactivate (EditorToolbar .RUN );
1903
- // toolbar.deactivate(EditorToolbar.STOP);
1895
+ toolbar .deactivate (EditorToolbar .STOP );
1904
1896
1905
1897
// focus the PDE again after quitting presentation mode [toxi 030903]
1906
1898
toFront ();
@@ -2040,65 +2032,14 @@ protected void handleOpenUnchecked(String path, int codeIndex,
2040
2032
* modifications (if any) to the previous sketch need to be saved.
2041
2033
*/
2042
2034
protected boolean handleOpenInternal (String path ) {
2043
- // rename .pde files to .ino
2044
- File [] oldFiles = (new File (path )).getParentFile ().listFiles (new FilenameFilter () {
2045
- public boolean accept (File dir , String name ) {
2046
- return (name .toLowerCase ().endsWith (".pde" ));
2047
- }
2048
- });
2049
-
2050
- if (oldFiles != null && oldFiles .length > 0 ) {
2051
- if (!Preferences .getBoolean ("editor.update_extension" )) {
2052
- Object [] options = { "OK" , "Cancel" };
2053
- String prompt =
2054
- "In Arduino 1.0, the file extension for sketches changed\n " +
2055
- "from \" .pde\" to \" .ino\" . This version of the software only\n " +
2056
- "supports the new extension. Rename the files in this sketch\n " +
2057
- "(and future sketches) and continue?" ;
2058
-
2059
- int result = JOptionPane .showOptionDialog (this ,
2060
- prompt ,
2061
- "New extension" ,
2062
- JOptionPane .YES_NO_OPTION ,
2063
- JOptionPane .QUESTION_MESSAGE ,
2064
- null ,
2065
- options ,
2066
- options [0 ]);
2067
- if (result != JOptionPane .YES_OPTION ) {
2068
- return false ;
2069
- }
2070
-
2071
- Preferences .setBoolean ("editor.update_extension" , true );
2072
- }
2073
-
2074
- for (int i = 0 ; i < oldFiles .length ; i ++) {
2075
- String oldPath = oldFiles [i ].getPath ();
2076
- File newFile = new File (oldPath .substring (0 , oldPath .length () - 4 ) + ".ino" );
2077
- try {
2078
- Base .copyFile (oldFiles [i ], newFile );
2079
- } catch (IOException e ) {
2080
- Base .showWarning ("Error" , "Could not copy to a proper location." , e );
2081
- return false ;
2082
- }
2083
-
2084
- // remove the original file, so user doesn't get confused
2085
- oldFiles [i ].delete ();
2086
-
2087
- // update with the new path
2088
- if (oldFiles [i ].compareTo (new File (path )) == 0 ) {
2089
- path = newFile .getAbsolutePath ();
2090
- }
2091
- }
2092
- }
2093
-
2094
2035
// check to make sure that this .pde file is
2095
2036
// in a folder of the same name
2096
2037
File file = new File (path );
2097
2038
File parentFile = new File (file .getParent ());
2098
2039
String parentName = parentFile .getName ();
2099
- String pdeName = parentName + ".ino " ;
2040
+ String pdeName = parentName + ".pde " ;
2100
2041
File altFile = new File (file .getParent (), pdeName );
2101
-
2042
+
2102
2043
if (pdeName .equals (file .getName ())) {
2103
2044
// no beef with this guy
2104
2045
@@ -2108,10 +2049,10 @@ public boolean accept(File dir, String name) {
2108
2049
path = altFile .getAbsolutePath ();
2109
2050
//System.out.println("found alt file in same folder");
2110
2051
2111
- } else if (!path .endsWith (".ino " )) {
2052
+ } else if (!path .endsWith (".pde " )) {
2112
2053
Base .showWarning ("Bad file selected" ,
2113
2054
"Processing can only open its own sketches\n " +
2114
- "and other files ending in .ino " , null );
2055
+ "and other files ending in .pde " , null );
2115
2056
return false ;
2116
2057
2117
2058
} else {
@@ -2330,13 +2271,13 @@ public boolean serialPrompt() {
2330
2271
* Made synchronized to (hopefully) avoid problems of people
2331
2272
* hitting export twice, quickly, and horking things up.
2332
2273
*/
2333
- synchronized public void handleExport (final boolean usingProgrammer ) {
2274
+ synchronized public void handleExport (final boolean verbose ) {
2334
2275
//if (!handleExportCheckModified()) return;
2335
2276
toolbar .activate (EditorToolbar .EXPORT );
2336
2277
console .clear ();
2337
2278
statusNotice ("Uploading to I/O Board..." );
2338
2279
2339
- new Thread (usingProgrammer ? exportAppHandler : exportHandler ).start ();
2280
+ new Thread (verbose ? exportAppHandler : exportHandler ).start ();
2340
2281
}
2341
2282
2342
2283
// DAM: in Arduino, this is upload
@@ -2454,14 +2395,14 @@ public void handleSerial() {
2454
2395
}
2455
2396
2456
2397
2457
- protected void handleBurnBootloader () {
2398
+ protected void handleBurnBootloader (final String target , final String programmer ) {
2458
2399
console .clear ();
2459
2400
statusNotice ("Burning bootloader to I/O Board (this may take a minute)..." );
2460
2401
SwingUtilities .invokeLater (new Runnable () {
2461
2402
public void run () {
2462
2403
try {
2463
2404
Uploader uploader = new AvrdudeUploader ();
2464
- if (uploader .burnBootloader ()) {
2405
+ if (uploader .burnBootloader (target , programmer )) {
2465
2406
statusNotice ("Done burning bootloader." );
2466
2407
} else {
2467
2408
statusError ("Error while burning bootloader." );
0 commit comments