@@ -1100,15 +1100,15 @@ public LibraryList getUserLibs() {
1100
1100
return libraries .filterLibrariesInSubfolder (getSketchbookFolder ());
1101
1101
}
1102
1102
1103
- public void rebuildImportMenu (JMenu importMenu , final Editor editor ) {
1103
+ public void rebuildImportMenu (JMenu importMenu ) {
1104
1104
importMenu .removeAll ();
1105
1105
1106
1106
JMenuItem addLibraryMenuItem = new JMenuItem (_ ("Add Library..." ));
1107
1107
addLibraryMenuItem .addActionListener (new ActionListener () {
1108
1108
public void actionPerformed (ActionEvent e ) {
1109
- Base .this .handleAddLibrary (editor );
1109
+ Base .this .handleAddLibrary ();
1110
1110
Base .this .onBoardOrPortChange ();
1111
- Base .this .rebuildImportMenu (Editor .importMenu , editor );
1111
+ Base .this .rebuildImportMenu (Editor .importMenu );
1112
1112
Base .this .rebuildExamplesMenu (Editor .examplesMenu );
1113
1113
}
1114
1114
});
@@ -1370,7 +1370,7 @@ public void actionPerformed(ActionEvent e) {
1370
1370
1371
1371
onBoardOrPortChange ();
1372
1372
Sketch .buildSettingChanged ();
1373
- rebuildImportMenu (Editor .importMenu , editor );
1373
+ rebuildImportMenu (Editor .importMenu );
1374
1374
rebuildExamplesMenu (Editor .examplesMenu );
1375
1375
}
1376
1376
};
@@ -1486,7 +1486,7 @@ private void selectBoard(String selectBoard, Editor editor) {
1486
1486
1487
1487
onBoardOrPortChange ();
1488
1488
Sketch .buildSettingChanged ();
1489
- rebuildImportMenu (Editor .importMenu , editor );
1489
+ rebuildImportMenu (Editor .importMenu );
1490
1490
rebuildExamplesMenu (Editor .examplesMenu );
1491
1491
}
1492
1492
@@ -2848,7 +2848,7 @@ static protected void listFiles(String basePath,
2848
2848
}
2849
2849
}
2850
2850
2851
- public void handleAddLibrary (Editor editor ) {
2851
+ public void handleAddLibrary () {
2852
2852
JFileChooser fileChooser = new JFileChooser (System .getProperty ("user.home" ));
2853
2853
fileChooser .setDialogTitle (_ ("Select a zip file or a folder containing the library you'd like to add" ));
2854
2854
fileChooser .setFileSelectionMode (JFileChooser .FILES_AND_DIRECTORIES );
@@ -2857,7 +2857,7 @@ public void handleAddLibrary(Editor editor) {
2857
2857
Dimension preferredSize = fileChooser .getPreferredSize ();
2858
2858
fileChooser .setPreferredSize (new Dimension (preferredSize .width + 200 , preferredSize .height + 200 ));
2859
2859
2860
- int returnVal = fileChooser .showOpenDialog (editor );
2860
+ int returnVal = fileChooser .showOpenDialog (activeEditor );
2861
2861
2862
2862
if (returnVal != JFileChooser .APPROVE_OPTION ) {
2863
2863
return ;
@@ -2879,7 +2879,7 @@ public void handleAddLibrary(Editor editor) {
2879
2879
}
2880
2880
sourceFile = foldersInTmpFolder [0 ];
2881
2881
} catch (IOException e ) {
2882
- editor .statusError (e );
2882
+ activeEditor .statusError (e );
2883
2883
return ;
2884
2884
}
2885
2885
}
@@ -2892,23 +2892,23 @@ public void handleAddLibrary(Editor editor) {
2892
2892
+ "Library names must contain only basic letters and numbers.\n "
2893
2893
+ "(ASCII only and no spaces, and it cannot start with a number)" ),
2894
2894
libName );
2895
- editor .statusError (mess );
2895
+ activeEditor .statusError (mess );
2896
2896
return ;
2897
2897
}
2898
2898
2899
2899
// copy folder
2900
2900
File destinationFolder = new File (getSketchbookLibrariesFolder (), sourceFile .getName ());
2901
2901
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 ()));
2903
2903
return ;
2904
2904
}
2905
2905
try {
2906
2906
FileUtils .copy (sourceFile , destinationFolder );
2907
2907
} catch (IOException e ) {
2908
- editor .statusError (e );
2908
+ activeEditor .statusError (e );
2909
2909
return ;
2910
2910
}
2911
- editor .statusNotice (_ ("Library added to your libraries. Check \" Import library\" menu" ));
2911
+ activeEditor .statusNotice (_ ("Library added to your libraries. Check \" Import library\" menu" ));
2912
2912
} finally {
2913
2913
// delete zip created temp folder, if exists
2914
2914
FileUtils .recursiveDelete (tmpFolder );
0 commit comments