mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
parent
b5c7e7104c
commit
6e77720f7f
4 changed files with 26 additions and 4 deletions
|
@ -48,8 +48,10 @@ public abstract class AbstractErrDialog extends DialogComponentProvider {
|
|||
|
||||
abstract int getExceptionCount();
|
||||
|
||||
abstract String getBaseTitle();
|
||||
|
||||
void updateTitle() {
|
||||
setTitle(getTitle() + ERRORS_PREFIX + getExceptionCount() + ERRORS_SUFFIX);
|
||||
setTitle(getBaseTitle() + ERRORS_PREFIX + getExceptionCount() + ERRORS_SUFFIX);
|
||||
}
|
||||
|
||||
void setClosedCallback(Callback callback) {
|
||||
|
|
|
@ -71,6 +71,7 @@ public class ErrLogDialog extends AbstractErrDialog {
|
|||
private static ErrorReporter errorReporter;
|
||||
|
||||
private List<ErrorEntry> errors = new ArrayList<>();
|
||||
private String baseTitle;
|
||||
|
||||
public static ErrLogDialog createExceptionDialog(String title, String message, Throwable t) {
|
||||
return new ErrLogDialog(title, message, t);
|
||||
|
@ -79,6 +80,8 @@ public class ErrLogDialog extends AbstractErrDialog {
|
|||
private ErrLogDialog(String title, String message, Throwable throwable) {
|
||||
super(title != null ? title : "Error");
|
||||
|
||||
baseTitle = getTitle();
|
||||
|
||||
ErrorEntry error = new ErrorEntry(message, throwable);
|
||||
errors.add(error);
|
||||
|
||||
|
@ -246,6 +249,11 @@ public class ErrLogDialog extends AbstractErrDialog {
|
|||
return errors.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
String getBaseTitle() {
|
||||
return baseTitle;
|
||||
}
|
||||
|
||||
private class ErrorDetailsSplitPane extends JSplitPane {
|
||||
|
||||
private final double TOP_PREFERRED_RESIZE_WEIGHT = .80;
|
||||
|
@ -323,7 +331,7 @@ public class ErrLogDialog extends AbstractErrDialog {
|
|||
setLayout(new BorderLayout());
|
||||
model = new ErrEntryTableModel();
|
||||
errorsTable = new GTable(model);
|
||||
tableFilterPanel = new GTableFilterPanel<ErrorEntry>(errorsTable, model);
|
||||
tableFilterPanel = new GTableFilterPanel<>(errorsTable, model);
|
||||
|
||||
errorsTable.getSelectionManager().addListSelectionListener(e -> {
|
||||
if (e.getValueIsAdjusting()) {
|
||||
|
@ -458,7 +466,7 @@ public class ErrLogDialog extends AbstractErrDialog {
|
|||
|
||||
@Override
|
||||
protected TableColumnDescriptor<ErrorEntry> createTableColumnDescriptor() {
|
||||
TableColumnDescriptor<ErrorEntry> descriptor = new TableColumnDescriptor<ErrorEntry>();
|
||||
TableColumnDescriptor<ErrorEntry> descriptor = new TableColumnDescriptor<>();
|
||||
descriptor.addVisibleColumn(new IdColumn(), 1, true);
|
||||
descriptor.addVisibleColumn(new MessageColumn());
|
||||
descriptor.addHiddenColumn(new DetailsColumn());
|
||||
|
|
|
@ -55,6 +55,7 @@ public class ErrLogExpandableDialog extends AbstractErrDialog {
|
|||
protected ReportRootNode root;
|
||||
protected GTree tree;
|
||||
private List<Throwable> errors = new ArrayList<>();
|
||||
private String baseTitle;
|
||||
|
||||
/** This spacer addresses the optical impression that the message panel changes size when showing details */
|
||||
protected Component horizontalSpacer;
|
||||
|
@ -66,6 +67,7 @@ public class ErrLogExpandableDialog extends AbstractErrDialog {
|
|||
protected ErrLogExpandableDialog(String title, String msg, Throwable throwable) {
|
||||
super(title);
|
||||
|
||||
baseTitle = title;
|
||||
errors.add(throwable);
|
||||
|
||||
popup = new JPopupMenu();
|
||||
|
@ -272,6 +274,11 @@ public class ErrLogExpandableDialog extends AbstractErrDialog {
|
|||
return root.getChildCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
String getBaseTitle() {
|
||||
return baseTitle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return root.getReportText();
|
||||
|
@ -389,7 +396,7 @@ public class ErrLogExpandableDialog extends AbstractErrDialog {
|
|||
|
||||
@Override
|
||||
protected List<GTreeNode> generateChildren() {
|
||||
List<GTreeNode> list = new ArrayList<GTreeNode>();
|
||||
List<GTreeNode> list = new ArrayList<>();
|
||||
list.add(new ReportStackTraceNode(exc));
|
||||
Throwable c = exc.getCause();
|
||||
if (c != null) {
|
||||
|
|
|
@ -66,6 +66,11 @@ public class DockingErrorDisplayTest extends AbstractDockingTest {
|
|||
reportException(display, logger, new NullPointerException("It is null!"));
|
||||
assertExceptionCount(dialog, 2);
|
||||
|
||||
reportException(display, logger, new NullPointerException("It is null!"));
|
||||
assertExceptionCount(dialog, 3);
|
||||
|
||||
assertEquals("Test Title (3 Errors)", dialog.getTitle());
|
||||
|
||||
close(dialog);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue