()
| 1386 | } |
| 1387 | |
| 1388 | public void saveAs() { |
| 1389 | String name1 = getTitle(); |
| 1390 | if (name1.indexOf(".")==-1) name1 += ".txt"; |
| 1391 | if (defaultDir!=null && name1.endsWith(".java") && !defaultDir.startsWith(Menus.getPlugInsPath())) { |
| 1392 | defaultDir = null; |
| 1393 | } |
| 1394 | if (defaultDir==null) { |
| 1395 | if (name1.endsWith(".txt")||name1.endsWith(".ijm")) |
| 1396 | defaultDir = Menus.getMacrosPath(); |
| 1397 | else |
| 1398 | defaultDir = Menus.getPlugInsPath(); |
| 1399 | } |
| 1400 | SaveDialog sd = new SaveDialog("Save As...", defaultDir, name1, null); |
| 1401 | String name2 = sd.getFileName(); |
| 1402 | String dir = sd.getDirectory(); |
| 1403 | if (name2!=null) { |
| 1404 | if (name2.endsWith(".java")) |
| 1405 | updateClassName(name1, name2); |
| 1406 | path = dir+name2; |
| 1407 | save(); |
| 1408 | changes = false; |
| 1409 | setWindowTitle(name2); |
| 1410 | setDefaultDirectory(dir); |
| 1411 | if (defaultDir!=null) |
| 1412 | Prefs.set(DEFAULT_DIR, defaultDir); |
| 1413 | if (IJ.recording()) |
| 1414 | Recorder.record("saveAs", "Text", path); |
| 1415 | } |
| 1416 | } |
| 1417 | |
| 1418 | protected void revert() { |
| 1419 | if (!changes) |
no test coverage detected