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