Merge remote-tracking branch 'origin/GP-3756-dragonmacher-plate-comment-annotations'

This commit is contained in:
Ryan Kurtz 2025-06-17 10:56:45 -04:00
commit 69872037e5
2 changed files with 11 additions and 20 deletions

View file

@ -64,7 +64,6 @@ public class EolCommentFieldFactory extends FieldFactory {
private int repeatableCommentStyle; private int repeatableCommentStyle;
private int automaticCommentStyle; private int automaticCommentStyle;
private int refRepeatableCommentStyle; private int refRepeatableCommentStyle;
private int offcutCommentStyle;
private EolExtraCommentsOption extraCommentsOption = new EolExtraCommentsOption(); private EolExtraCommentsOption extraCommentsOption = new EolExtraCommentsOption();

View file

@ -17,8 +17,9 @@ package ghidra.app.util.viewer.field;
import java.awt.Color; import java.awt.Color;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.ArrayList; import java.util.*;
import java.util.List; import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -209,25 +210,16 @@ public class PlateFieldFactory extends FieldFactory {
} }
private String getCommentText(CodeUnit cu, List<String> offcutComments) { private String getCommentText(CodeUnit cu, List<String> offcutComments) {
String[] comments = cu.getCommentAsArray(CommentType.PLATE); Stream<String> commentsStream = Stream.empty();
if (comments == null) { String[] plateComments = cu.getCommentAsArray(CommentType.PLATE);
return null; if (plateComments != null) {
commentsStream = Arrays.stream(plateComments);
} }
StringBuilder buffy = new StringBuilder(); Program program = cu.getProgram();
for (String comment : comments) { Stream<String> comments = Stream.concat(commentsStream, offcutComments.stream());
if (buffy.length() != 0) { return comments.map(c -> CommentUtils.getDisplayString(c, program))
buffy.append('\n'); .collect(Collectors.joining("\n"));
}
buffy.append(comment);
}
for (String offcut : offcutComments) {
if (buffy.length() != 0) {
buffy.append('\n');
}
buffy.append(offcut);
}
return buffy.toString();
} }
/* /*