@@ -1100,15 +1100,15 @@ public LibraryList getUserLibs() {
11001100 return libraries .filterLibrariesInSubfolder (getSketchbookFolder ());
11011101 }
11021102
1103- public void rebuildImportMenu (JMenu importMenu , final Editor editor ) {
1103+ public void rebuildImportMenu (JMenu importMenu ) {
11041104 importMenu .removeAll ();
11051105
11061106 JMenuItem addLibraryMenuItem = new JMenuItem (_ ("Add Library..." ));
11071107 addLibraryMenuItem .addActionListener (new ActionListener () {
11081108 public void actionPerformed (ActionEvent e ) {
1109- Base .this .handleAddLibrary (editor );
1109+ Base .this .handleAddLibrary ();
11101110 Base .this .onBoardOrPortChange ();
1111- Base .this .rebuildImportMenu (Editor .importMenu , editor );
1111+ Base .this .rebuildImportMenu (Editor .importMenu );
11121112 Base .this .rebuildExamplesMenu (Editor .examplesMenu );
11131113 }
11141114 });
@@ -1370,7 +1370,7 @@ public void actionPerformed(ActionEvent e) {
13701370
13711371 onBoardOrPortChange ();
13721372 Sketch .buildSettingChanged ();
1373- rebuildImportMenu (Editor .importMenu , editor );
1373+ rebuildImportMenu (Editor .importMenu );
13741374 rebuildExamplesMenu (Editor .examplesMenu );
13751375 }
13761376 };
@@ -1486,7 +1486,7 @@ private void selectBoard(String selectBoard, Editor editor) {
14861486
14871487 onBoardOrPortChange ();
14881488 Sketch .buildSettingChanged ();
1489- rebuildImportMenu (Editor .importMenu , editor );
1489+ rebuildImportMenu (Editor .importMenu );
14901490 rebuildExamplesMenu (Editor .examplesMenu );
14911491 }
14921492
@@ -2848,7 +2848,7 @@ static protected void listFiles(String basePath,
28482848 }
28492849 }
28502850
2851- public void handleAddLibrary (Editor editor ) {
2851+ public void handleAddLibrary () {
28522852 JFileChooser fileChooser = new JFileChooser (System .getProperty ("user.home" ));
28532853 fileChooser .setDialogTitle (_ ("Select a zip file or a folder containing the library you'd like to add" ));
28542854 fileChooser .setFileSelectionMode (JFileChooser .FILES_AND_DIRECTORIES );
@@ -2857,7 +2857,7 @@ public void handleAddLibrary(Editor editor) {
28572857 Dimension preferredSize = fileChooser .getPreferredSize ();
28582858 fileChooser .setPreferredSize (new Dimension (preferredSize .width + 200 , preferredSize .height + 200 ));
28592859
2860- int returnVal = fileChooser .showOpenDialog (editor );
2860+ int returnVal = fileChooser .showOpenDialog (activeEditor );
28612861
28622862 if (returnVal != JFileChooser .APPROVE_OPTION ) {
28632863 return ;
@@ -2879,7 +2879,7 @@ public void handleAddLibrary(Editor editor) {
28792879 }
28802880 sourceFile = foldersInTmpFolder [0 ];
28812881 } catch (IOException e ) {
2882- editor .statusError (e );
2882+ activeEditor .statusError (e );
28832883 return ;
28842884 }
28852885 }
@@ -2892,23 +2892,23 @@ public void handleAddLibrary(Editor editor) {
28922892 + "Library names must contain only basic letters and numbers.\n "
28932893 + "(ASCII only and no spaces, and it cannot start with a number)" ),
28942894 libName );
2895- editor .statusError (mess );
2895+ activeEditor .statusError (mess );
28962896 return ;
28972897 }
28982898
28992899 // copy folder
29002900 File destinationFolder = new File (getSketchbookLibrariesFolder (), sourceFile .getName ());
29012901 if (!destinationFolder .mkdir ()) {
2902- editor .statusError (I18n .format (_ ("A library named {0} already exists" ), sourceFile .getName ()));
2902+ activeEditor .statusError (I18n .format (_ ("A library named {0} already exists" ), sourceFile .getName ()));
29032903 return ;
29042904 }
29052905 try {
29062906 FileUtils .copy (sourceFile , destinationFolder );
29072907 } catch (IOException e ) {
2908- editor .statusError (e );
2908+ activeEditor .statusError (e );
29092909 return ;
29102910 }
2911- editor .statusNotice (_ ("Library added to your libraries. Check \" Import library\" menu" ));
2911+ activeEditor .statusNotice (_ ("Library added to your libraries. Check \" Import library\" menu" ));
29122912 } finally {
29132913 // delete zip created temp folder, if exists
29142914 FileUtils .recursiveDelete (tmpFolder );
0 commit comments