This plugin implements the File/Save As/Text command, which saves the contents of Editor windows and TextWindows (e.g., "Log" and "Results").
| 9 | /** This plugin implements the File/Save As/Text command, which saves the |
| 10 | contents of Editor windows and TextWindows (e.g., "Log" and "Results"). */ |
| 11 | public class TextWriter implements PlugIn { |
| 12 | |
| 13 | public void run(String arg) { |
| 14 | saveText(); |
| 15 | } |
| 16 | |
| 17 | void saveText() { |
| 18 | Frame frame = WindowManager.getFrontWindow(); |
| 19 | if (frame!=null && (frame instanceof TextWindow)) { |
| 20 | TextPanel tp = ((TextWindow)frame).getTextPanel(); |
| 21 | tp.saveAs(""); |
| 22 | } else if (frame!=null && (frame instanceof Editor)) { |
| 23 | Editor ed = (Editor)frame; |
| 24 | ed.saveAs(); |
| 25 | } else { |
| 26 | IJ.error("Save As Text", |
| 27 | "This command requires a TextWindow, such\n" |
| 28 | + "as the \"Log\" window, or an Editor window. Use\n" |
| 29 | + "File>Save>Text Image to save an image as text."); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | } |
| 34 |
nothing calls this directly
no outgoing calls
no test coverage detected