mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
Analysis Panel - fixed timing issue in analysis task test; fixed
renderer color bug
This commit is contained in:
@@ -68,6 +68,13 @@
|
||||
<B>Edit</B><IMG alt="" src="images/arrow.gif"> <B>Tool Options</B> menu and check
|
||||
or uncheck <I>Show Analysis Options</I>. When unchecked, the next time Auto Analysis is
|
||||
chosen, the options dialog is skipped, and analysis begins immediately.</P>
|
||||
|
||||
|
||||
|
||||
<P><IMG alt="" src="images/tip.png"> Any analyzer that is not in its default enablement
|
||||
state will show a yellowish color in the table of analyzer names.</P>
|
||||
|
||||
|
||||
</BLOCKQUOTE>
|
||||
</BLOCKQUOTE>
|
||||
|
||||
|
||||
@@ -35,8 +35,9 @@ import ghidra.util.table.column.GColumnRenderer;
|
||||
*/
|
||||
public class AnalysisEnablementTableModel
|
||||
extends GDynamicColumnTableModel<AnalyzerEnablementState, Object> {
|
||||
private static Color ALT_SELECTED_COLOR = Color.BLUE.brighter();
|
||||
private static Color ALT_NON_SELECTED__COLOR = new Color(255, 255, 175);
|
||||
|
||||
private static Color BG_COLOR_NOT_DEFAULT_ENABLEMENT = new Color(255, 255, 200);
|
||||
private static Color BG_COLOR_NOT_DEFAULT_ENABLEMENT_SELECTED = new Color(177, 212, 236);
|
||||
|
||||
private List<AnalyzerEnablementState> analyzerStates;
|
||||
private AnalysisPanel panel;
|
||||
@@ -100,6 +101,16 @@ public class AnalysisEnablementTableModel
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setToolTip(Component c, String text) {
|
||||
if (c instanceof JComponent) {
|
||||
((JComponent) c).setToolTipText(text);
|
||||
}
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
// Inner Classes
|
||||
//==================================================================================================
|
||||
|
||||
private class AnalyzerEnabledColumn
|
||||
extends AbstractDynamicTableColumn<AnalyzerEnablementState, Boolean, Object> {
|
||||
EnabledColumnTableCellRenderer renderer = new EnabledColumnTableCellRenderer();
|
||||
@@ -155,12 +166,22 @@ public class AnalysisEnablementTableModel
|
||||
Component component = booleanRenderer.getTableCellRendererComponent(table, value,
|
||||
isSelected, hasFocus, row, column);
|
||||
|
||||
if (!getRowObject(row).isDefaultEnablement()) {
|
||||
component.setBackground(isSelected ? ALT_SELECTED_COLOR : ALT_NON_SELECTED__COLOR);
|
||||
if (component instanceof JComponent) {
|
||||
((JComponent) component).setToolTipText("This option differs from the default");
|
||||
}
|
||||
AnalyzerEnablementState state = getRowObject(row);
|
||||
if (state.isDefaultEnablement()) {
|
||||
setToolTip(component, null);
|
||||
return component;
|
||||
}
|
||||
|
||||
// not the default enablement
|
||||
if (isSelected) {
|
||||
component.setBackground(BG_COLOR_NOT_DEFAULT_ENABLEMENT_SELECTED);
|
||||
}
|
||||
else {
|
||||
component.setBackground(BG_COLOR_NOT_DEFAULT_ENABLEMENT);
|
||||
}
|
||||
|
||||
setToolTip(component, "This option differs from the default");
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
@@ -168,7 +189,6 @@ public class AnalysisEnablementTableModel
|
||||
public String getFilterString(Boolean t, Settings settings) {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class AnalyzerNameTableCellRenderer extends AbstractGColumnRenderer<String> {
|
||||
@@ -188,14 +208,23 @@ public class AnalysisEnablementTableModel
|
||||
component.setForeground(
|
||||
ColorUtils.deriveForeground(component.getBackground(), ColorUtils.HUE_RED));
|
||||
}
|
||||
if (!((AnalyzerEnablementState) data.getRowObject()).isDefaultEnablement()) {
|
||||
component.setBackground(
|
||||
data.isSelected() ? ALT_SELECTED_COLOR : ALT_NON_SELECTED__COLOR);
|
||||
if (component instanceof JComponent) {
|
||||
((JComponent) component).setToolTipText("This option differs from the default");
|
||||
}
|
||||
|
||||
AnalyzerEnablementState state = (AnalyzerEnablementState) data.getRowObject();
|
||||
if (state.isDefaultEnablement()) {
|
||||
setToolTip(component, null);
|
||||
return component;
|
||||
}
|
||||
|
||||
// not the default enablement
|
||||
if (data.isSelected()) {
|
||||
component.setBackground(BG_COLOR_NOT_DEFAULT_ENABLEMENT_SELECTED);
|
||||
component.setForeground(Color.BLACK);
|
||||
}
|
||||
else {
|
||||
component.setBackground(BG_COLOR_NOT_DEFAULT_ENABLEMENT);
|
||||
}
|
||||
|
||||
setToolTip(component, "This option differs from the default");
|
||||
return component;
|
||||
}
|
||||
|
||||
|
||||
@@ -296,8 +296,8 @@ public class AnalyzeAllOpenProgramsTaskTest extends AbstractGhidraHeadedIntegrat
|
||||
AnalysisOptionsDialog optionsDialog = waitForDialogComponent(AnalysisOptionsDialog.class);
|
||||
AnalysisPanel panel =
|
||||
findComponent(optionsDialog.getComponent(), AnalysisPanel.class, false);
|
||||
invokeInstanceMethod("deselectAll", panel);
|
||||
waitForSwing();
|
||||
|
||||
runSwing(() -> invokeInstanceMethod("deselectAll", panel));
|
||||
|
||||
close(optionsDialog);
|
||||
}
|
||||
@@ -371,12 +371,7 @@ public class AnalyzeAllOpenProgramsTaskTest extends AbstractGhidraHeadedIntegrat
|
||||
}
|
||||
|
||||
final int analyzerRow = row;
|
||||
runSwing(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
model.setValueAt(Boolean.TRUE, analyzerRow, 0);
|
||||
}
|
||||
});
|
||||
runSwing(() -> model.setValueAt(Boolean.TRUE, analyzerRow, 0));
|
||||
}
|
||||
|
||||
private void runTask(final AnalyzeAllOpenProgramsTask task) {
|
||||
|
||||
Reference in New Issue
Block a user