MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / save

Method save

ij/src/main/java/ij/text/TextPanel.java:1037–1055  ·  view source on GitHub ↗

Writes all the text in this TextPanel to a file.

(PrintWriter pw)

Source from the content-addressed store, hash-verified

1035
1036 /** Writes all the text in this TextPanel to a file. */
1037 public void save(PrintWriter pw) {
1038 resetSelection();
1039 if (labels!=null && !labels.equals("")) {
1040 String labels2 = labels;
1041 if (saveAsCSV)
1042 labels2 = labels2.replaceAll("\t",",");
1043 pw.println(labels2);
1044 }
1045 for (int i=0; i<iRowCount; i++) {
1046 char[] chars = (char[])(vData.elementAt(i));
1047 String s = new String(chars);
1048 if (s.endsWith("\t"))
1049 s = s.substring(0, s.length()-1);
1050 if (saveAsCSV)
1051 s = s.replaceAll("\t",",");
1052 pw.println(s);
1053 }
1054 unsavedLines = false;
1055 }
1056
1057 /** Saves the text in this TextPanel to a file. Set 'path' to "" to
1058 * display a "save as" dialog. Returns 'false' if the user cancels

Callers 1

saveAsMethod · 0.95

Calls 6

resetSelectionMethod · 0.95
replaceAllMethod · 0.80
printlnMethod · 0.80
substringMethod · 0.80
lengthMethod · 0.65
equalsMethod · 0.45

Tested by

no test coverage detected