mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-28 12:56:02 +08:00
Merge remote-tracking branch 'origin/GP-2264_ghidragon_filter_options_dialog_keyboard_nav_broken--SQUASHED'
This commit is contained in:
+34
-15
@@ -53,7 +53,7 @@ public class FilterOptionsEditorDialog extends DialogComponentProvider {
|
|||||||
private InvertPanel invertPanel;
|
private InvertPanel invertPanel;
|
||||||
private PathPanel pathPanel;
|
private PathPanel pathPanel;
|
||||||
private MultiTermPanel multiTermPanel;
|
private MultiTermPanel multiTermPanel;
|
||||||
private JLayer<?> multiTermDisabledPanel;
|
private JLayer<?> multiTermDisabledLayer;
|
||||||
|
|
||||||
public FilterOptionsEditorDialog(FilterOptions filterOptions) {
|
public FilterOptionsEditorDialog(FilterOptions filterOptions) {
|
||||||
super("Text Filter Options");
|
super("Text Filter Options");
|
||||||
@@ -65,7 +65,7 @@ public class FilterOptionsEditorDialog extends DialogComponentProvider {
|
|||||||
multiTermPanel.setEvalMode(filterOptions.getMultitermEvaluationMode());
|
multiTermPanel.setEvalMode(filterOptions.getMultitermEvaluationMode());
|
||||||
multiTermPanel.setDelimiter(filterOptions.getDelimitingCharacter());
|
multiTermPanel.setDelimiter(filterOptions.getDelimitingCharacter());
|
||||||
|
|
||||||
updatedEnablementForNonRegularExpressionOptions(
|
enableStandardOptions(
|
||||||
filterStrategyPanel.getFilterStrategy() != TextFilterStrategy.REGULAR_EXPRESSION);
|
filterStrategyPanel.getFilterStrategy() != TextFilterStrategy.REGULAR_EXPRESSION);
|
||||||
|
|
||||||
multiTermPanel.setMultitermEnabled(filterOptions.isMultiterm());
|
multiTermPanel.setMultitermEnabled(filterOptions.isMultiterm());
|
||||||
@@ -110,17 +110,18 @@ public class FilterOptionsEditorDialog extends DialogComponentProvider {
|
|||||||
multiTermPanel = new MultiTermPanel();
|
multiTermPanel = new MultiTermPanel();
|
||||||
panel.add(multiTermPanel);
|
panel.add(multiTermPanel);
|
||||||
|
|
||||||
multiTermDisabledPanel = DisabledComponentLayerFactory.getDisabledLayer(multiTermPanel);
|
multiTermDisabledLayer = DisabledComponentLayerFactory.getDisabledLayer(multiTermPanel);
|
||||||
panel.add(multiTermDisabledPanel);
|
panel.add(multiTermDisabledLayer);
|
||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updatedEnablementForNonRegularExpressionOptions(boolean b) {
|
// standard options are those that don't apply to regexes
|
||||||
booleanPanel.setCaseSensitiveCBEnabled(b);
|
private void enableStandardOptions(boolean enable) {
|
||||||
booleanPanel.setGlobbingCBEnabled(b);
|
booleanPanel.setCaseSensitiveCBEnabled(enable);
|
||||||
|
booleanPanel.setGlobbingCBEnabled(enable);
|
||||||
multiTermDisabledPanel.setEnabled(b);
|
multiTermPanel.setEnabled(enable);
|
||||||
|
multiTermDisabledLayer.setEnabled(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -151,8 +152,8 @@ public class FilterOptionsEditorDialog extends DialogComponentProvider {
|
|||||||
setLayout(new PairLayout(2, 2));
|
setLayout(new PairLayout(2, 2));
|
||||||
setBorder(BorderFactory.createTitledBorder("Text Filter Strategy"));
|
setBorder(BorderFactory.createTitledBorder("Text Filter Strategy"));
|
||||||
ButtonGroup buttonGroup = new ButtonGroup();
|
ButtonGroup buttonGroup = new ButtonGroup();
|
||||||
GRadioButton startsWithButton = new GRadioButton("Starts With");
|
|
||||||
GRadioButton containsButton = new GRadioButton("Contains");
|
GRadioButton containsButton = new GRadioButton("Contains");
|
||||||
|
GRadioButton startsWithButton = new GRadioButton("Starts With");
|
||||||
GRadioButton matchesExactlyButton = new GRadioButton("Matches Exactly");
|
GRadioButton matchesExactlyButton = new GRadioButton("Matches Exactly");
|
||||||
GRadioButton regularExpressionButton = new GRadioButton("Regular Expression");
|
GRadioButton regularExpressionButton = new GRadioButton("Regular Expression");
|
||||||
|
|
||||||
@@ -165,27 +166,27 @@ public class FilterOptionsEditorDialog extends DialogComponentProvider {
|
|||||||
regularExpressionButton.setToolTipText(
|
regularExpressionButton.setToolTipText(
|
||||||
"The filter will match all entries that match a regular expression generated from the filter text.");
|
"The filter will match all entries that match a regular expression generated from the filter text.");
|
||||||
|
|
||||||
buttonGroup.add(startsWithButton);
|
|
||||||
buttonGroup.add(containsButton);
|
buttonGroup.add(containsButton);
|
||||||
|
buttonGroup.add(startsWithButton);
|
||||||
buttonGroup.add(matchesExactlyButton);
|
buttonGroup.add(matchesExactlyButton);
|
||||||
buttonGroup.add(regularExpressionButton);
|
buttonGroup.add(regularExpressionButton);
|
||||||
|
|
||||||
startsWithButton.addActionListener(ev -> {
|
startsWithButton.addActionListener(ev -> {
|
||||||
filterStrategy = TextFilterStrategy.STARTS_WITH;
|
filterStrategy = TextFilterStrategy.STARTS_WITH;
|
||||||
updatedEnablementForNonRegularExpressionOptions(true);
|
enableStandardOptions(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
containsButton.addActionListener(ev -> {
|
containsButton.addActionListener(ev -> {
|
||||||
filterStrategy = TextFilterStrategy.CONTAINS;
|
filterStrategy = TextFilterStrategy.CONTAINS;
|
||||||
updatedEnablementForNonRegularExpressionOptions(true);
|
enableStandardOptions(true);
|
||||||
});
|
});
|
||||||
matchesExactlyButton.addActionListener(ev -> {
|
matchesExactlyButton.addActionListener(ev -> {
|
||||||
filterStrategy = TextFilterStrategy.MATCHES_EXACTLY;
|
filterStrategy = TextFilterStrategy.MATCHES_EXACTLY;
|
||||||
updatedEnablementForNonRegularExpressionOptions(true);
|
enableStandardOptions(true);
|
||||||
});
|
});
|
||||||
regularExpressionButton.addActionListener(ev -> {
|
regularExpressionButton.addActionListener(ev -> {
|
||||||
filterStrategy = TextFilterStrategy.REGULAR_EXPRESSION;
|
filterStrategy = TextFilterStrategy.REGULAR_EXPRESSION;
|
||||||
updatedEnablementForNonRegularExpressionOptions(false);
|
enableStandardOptions(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
switch (initialFilterOptions.getTextFilterStrategy()) {
|
switch (initialFilterOptions.getTextFilterStrategy()) {
|
||||||
@@ -372,6 +373,20 @@ public class FilterOptionsEditorDialog extends DialogComponentProvider {
|
|||||||
return evalMode;
|
return evalMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setEnabled(boolean enable) {
|
||||||
|
super.setEnabled(enable);
|
||||||
|
enableCheckbox.setEnabled(enable);
|
||||||
|
|
||||||
|
// When we disable this options panel, uncheck the panel so that its internal options
|
||||||
|
// are disabled as well. When we become enabled, the user is required to recheck the
|
||||||
|
// box.
|
||||||
|
if (!enable) {
|
||||||
|
enableCheckbox.setSelected(false);
|
||||||
|
setOptionsEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the evaluation mode to what is given. This is done by activating the
|
* Sets the evaluation mode to what is given. This is done by activating the
|
||||||
* appropriate radio button associated with that mode.
|
* appropriate radio button associated with that mode.
|
||||||
@@ -397,6 +412,10 @@ public class FilterOptionsEditorDialog extends DialogComponentProvider {
|
|||||||
|
|
||||||
public void setOptionsEnabled(boolean enabled) {
|
public void setOptionsEnabled(boolean enabled) {
|
||||||
optionsPaneDisableLayer.setEnabled(enabled);
|
optionsPaneDisableLayer.setEnabled(enabled);
|
||||||
|
delimiterCharacterCB.setEnabled(enabled);
|
||||||
|
for (JRadioButton button : modeButtons) {
|
||||||
|
button.setEnabled(enabled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMultitermEnabled() {
|
public boolean isMultitermEnabled() {
|
||||||
|
|||||||
Reference in New Issue
Block a user