()
| 268 | |
| 269 | |
| 270 | protected void sortCode() { |
| 271 | // cheap-ass sort of the rest of the files |
| 272 | // it's a dumb, slow sort, but there shouldn't be more than ~5 files |
| 273 | for (int i = 1; i < codeCount; i++) { |
| 274 | int who = i; |
| 275 | for (int j = i + 1; j < codeCount; j++) { |
| 276 | if (code[j].getFileName().compareTo(code[who].getFileName()) < 0) { |
| 277 | who = j; // this guy is earlier in the alphabet |
| 278 | } |
| 279 | } |
| 280 | if (who != i) { // swap with someone if changes made |
| 281 | SketchCode temp = code[who]; |
| 282 | code[who] = code[i]; |
| 283 | code[i] = temp; |
| 284 | |
| 285 | // We also need to update the current tab |
| 286 | if (currentIndex == i) { |
| 287 | currentIndex = who; |
| 288 | } else if (currentIndex == who) { |
| 289 | currentIndex = i; |
| 290 | } |
| 291 | } |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | |
| 296 | boolean renamingCode; |
no test coverage detected