@@ -1212,34 +1212,17 @@ public void actionPerformed(ActionEvent event) {
12121212
12131213 for (String potentialName : list ) {
12141214 File libFolder = new File (folder , potentialName );
1215- // File libraryFolder = new File(subfolder, "library");
1216- // File libraryJar = new File(libraryFolder, potentialName + ".jar");
1217- // // If a .jar file of the same prefix as the folder exists
1218- // // inside the 'library' subfolder of the sketch
1219- // if (libraryJar.exists()) {
1220- String sanityCheck = Sketch .sanitizeName (potentialName );
1221- if (!sanityCheck .equals (potentialName )) {
1222- String mess = I18n .format (
1223- _ ("The library \" {0}\" cannot be used.\n " +
1224- "Library names must contain only basic letters and numbers.\n " +
1225- "(ASCII only and no spaces, and it cannot start with a number)" ),
1226- potentialName
1227- );
1228- Base .showMessage (_ ("Ignoring bad library name" ), mess );
1229- continue ;
1230- }
1215+ String sanityCheck = Sketch .sanitizeName (potentialName );
1216+ if (!sanityCheck .equals (potentialName )) {
1217+ String mess = I18n .format (_ ("The library \" {0}\" cannot be used.\n "
1218+ + "Library names must contain only basic letters and numbers.\n "
1219+ + "(ASCII only and no spaces, and it cannot start with a number)" ),
1220+ potentialName );
1221+ Base .showMessage (_ ("Ignoring bad library name" ), mess );
1222+ continue ;
1223+ }
12311224
1232- String libraryName = potentialName ;
1233- // // get the path for all .jar files in this code folder
1234- // String libraryClassPath =
1235- // Compiler.contentsToClassPath(libraryFolder);
1236- // // grab all jars and classes from this folder,
1237- // // and append them to the library classpath
1238- // librariesClassPath +=
1239- // File.pathSeparatorChar + libraryClassPath;
1240- // // need to associate each import with a library folder
1241- // String packages[] =
1242- // Compiler.packageListFromClassPath(libraryClassPath);
1225+ String libraryName = potentialName ;
12431226 libraries .add (libFolder );
12441227 String libFolderPath = libFolder .getAbsolutePath ();
12451228 try {
@@ -1268,22 +1251,11 @@ public void actionPerformed(ActionEvent event) {
12681251 "Unable to list header files in {0}" , libFolder ), e );
12691252 }
12701253
1271- JMenuItem item = new JMenuItem (libraryName );
1272- item .addActionListener (listener );
1273- item .setActionCommand (libFolderPath );
1274- menu .add (item );
1275- ifound = true ;
1276-
1277- // XXX: DAM: should recurse here so that library folders can be nested
1278- // } else { // not a library, but is still a folder, so recurse
1279- // JMenu submenu = new JMenu(libraryName);
1280- // // needs to be separate var, otherwise would set ifound to false
1281- // boolean found = addLibraries(submenu, subfolder);
1282- // if (found) {
1283- // menu.add(submenu);
1284- // ifound = true;
1285- // }
1286- // }
1254+ JMenuItem item = new JMenuItem (libraryName );
1255+ item .addActionListener (listener );
1256+ item .setActionCommand (libFolderPath );
1257+ menu .add (item );
1258+ ifound = true ;
12871259 }
12881260 return ifound ;
12891261 }
0 commit comments