mirror of
https://github.com/NationalSecurityAgency/ghidra
synced 2024-09-13 21:56:19 +00:00
GP-4543 fixed some accesibility issues with bsim dialog
This commit is contained in:
parent
9abfa3da86
commit
861f7fe578
|
@ -21,6 +21,7 @@ import java.awt.event.ItemListener;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.accessibility.AccessibleContext;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import docking.DialogComponentProvider;
|
import docking.DialogComponentProvider;
|
||||||
|
@ -118,9 +119,14 @@ public abstract class AbstractBSimSearchDialog extends DialogComponentProvider {
|
||||||
confidenceField.setValue(0);
|
confidenceField.setValue(0);
|
||||||
confidenceField.setMinValue(0.0);
|
confidenceField.setMinValue(0.0);
|
||||||
|
|
||||||
panel.add(new JLabel("Similarity Threshold (0-1):"));
|
JLabel similarityLabel = new JLabel("Similarity Threshold (0-1):");
|
||||||
|
JLabel confidenceLabel = new JLabel("Confidence Threshold:");
|
||||||
|
similarityLabel.setLabelFor(similarityField);
|
||||||
|
confidenceLabel.setLabelFor(confidenceField);
|
||||||
|
|
||||||
|
panel.add(similarityLabel);
|
||||||
panel.add(similarityField);
|
panel.add(similarityField);
|
||||||
panel.add(new JLabel("Confidence Threshold:"));
|
panel.add(confidenceLabel);
|
||||||
panel.add(confidenceField);
|
panel.add(confidenceField);
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
@ -223,6 +229,10 @@ public abstract class AbstractBSimSearchDialog extends DialogComponentProvider {
|
||||||
comboPanel.add(serverCombo, BorderLayout.CENTER);
|
comboPanel.add(serverCombo, BorderLayout.CENTER);
|
||||||
panel.add(comboPanel, BorderLayout.CENTER);
|
panel.add(comboPanel, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
AccessibleContext context = serverCombo.getAccessibleContext();
|
||||||
|
context.setAccessibleName("BSim Server");
|
||||||
|
context.setAccessibleDescription("Select a predefined Bsim Server");
|
||||||
|
|
||||||
JButton button = new EmptyBorderButton(Icons.CONFIGURE_FILTER_ICON);
|
JButton button = new EmptyBorderButton(Icons.CONFIGURE_FILTER_ICON);
|
||||||
button.setToolTipText("Show Server Manager Dialog");
|
button.setToolTipText("Show Server Manager Dialog");
|
||||||
button.addActionListener(e -> managerServers());
|
button.addActionListener(e -> managerServers());
|
||||||
|
|
|
@ -128,8 +128,13 @@ public class BSimSearchDialog extends AbstractBSimSearchDialog {
|
||||||
maxResultsField.setAllowsHexPrefix(false);
|
maxResultsField.setAllowsHexPrefix(false);
|
||||||
maxResultsField.setShowNumberMode(false);
|
maxResultsField.setShowNumberMode(false);
|
||||||
|
|
||||||
panel.add(new JLabel("Max Matches Per Function:"));
|
JComponent maxResultsComponent = maxResultsField.getComponent();
|
||||||
panel.add(maxResultsField.getComponent());
|
|
||||||
|
JLabel maxLabel = new JLabel("Max Matches Per Function:");
|
||||||
|
maxLabel.setLabelFor(maxResultsComponent);
|
||||||
|
|
||||||
|
panel.add(maxLabel);
|
||||||
|
panel.add(maxResultsComponent);
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,8 @@ public class CreateBsimServerInfoDialog extends DialogComponentProvider {
|
||||||
|
|
||||||
private JPanel cardPanel;
|
private JPanel cardPanel;
|
||||||
|
|
||||||
private PostgresPanel postgresPanel;
|
private DbPanel postgresPanel;
|
||||||
private ElasticPanel elasticPanel;
|
private DbPanel elasticPanel;
|
||||||
private FilePanel filePanel;
|
private FilePanel filePanel;
|
||||||
|
|
||||||
private ServerPanel activePanel;
|
private ServerPanel activePanel;
|
||||||
|
@ -65,12 +65,13 @@ public class CreateBsimServerInfoDialog extends DialogComponentProvider {
|
||||||
addOKButton();
|
addOKButton();
|
||||||
addCancelButton();
|
addCancelButton();
|
||||||
setOkEnabled(false);
|
setOkEnabled(false);
|
||||||
setHelpLocation(new HelpLocation("BSimSearchPlugin","Add_Server_Definition_Dialog" ));
|
setHelpLocation(new HelpLocation("BSimSearchPlugin", "Add_Server_Definition_Dialog"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public BSimServerInfo getBsimServerInfo() {
|
public BSimServerInfo getBsimServerInfo() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHelpLocation(HelpLocation helpLocation) {
|
public void setHelpLocation(HelpLocation helpLocation) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
@ -101,7 +102,8 @@ public class CreateBsimServerInfoDialog extends DialogComponentProvider {
|
||||||
errorMessage = e.getMessage();
|
errorMessage = e.getMessage();
|
||||||
}
|
}
|
||||||
int answer = OptionDialog.showYesNoDialog(null, "Connection Test Failed!",
|
int answer = OptionDialog.showYesNoDialog(null, "Connection Test Failed!",
|
||||||
"Can't connect to server: " + errorMessage + "\nDo you want to proceed with creation anyway?");
|
"Can't connect to server: " + errorMessage +
|
||||||
|
"\nDo you want to proceed with creation anyway?");
|
||||||
return answer == OptionDialog.YES_OPTION;
|
return answer == OptionDialog.YES_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,8 +115,8 @@ public class CreateBsimServerInfoDialog extends DialogComponentProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Component buildCardPanel() {
|
private Component buildCardPanel() {
|
||||||
postgresPanel = new PostgresPanel();
|
postgresPanel = new DbPanel(DBType.postgres);
|
||||||
elasticPanel = new ElasticPanel();
|
elasticPanel = new DbPanel(DBType.elastic);
|
||||||
filePanel = new FilePanel();
|
filePanel = new FilePanel();
|
||||||
|
|
||||||
cardPanel = new JPanel(new CardLayout());
|
cardPanel = new JPanel(new CardLayout());
|
||||||
|
@ -193,23 +195,33 @@ public class CreateBsimServerInfoDialog extends DialogComponentProvider {
|
||||||
setOkEnabled(serverInfo != null);
|
setOkEnabled(serverInfo != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PostgresPanel extends ServerPanel {
|
private class DbPanel extends ServerPanel {
|
||||||
|
|
||||||
private JTextField nameField;
|
private JTextField nameField;
|
||||||
private JTextField hostField;
|
private JTextField hostField;
|
||||||
private JTextField portField;
|
private JTextField portField;
|
||||||
|
private DBType type;
|
||||||
|
|
||||||
PostgresPanel() {
|
private DbPanel(DBType type) {
|
||||||
super(new PairLayout(10, 10));
|
super(new PairLayout(10, 10));
|
||||||
|
this.type = type;
|
||||||
|
|
||||||
nameField = new NotifyingTextField();
|
nameField = new NotifyingTextField();
|
||||||
hostField = new NotifyingTextField();
|
hostField = new NotifyingTextField();
|
||||||
portField =
|
portField =
|
||||||
new NotifyingTextField(Integer.toString(BSimServerInfo.DEFAULT_POSTGRES_PORT));
|
new NotifyingTextField(Integer.toString(BSimServerInfo.DEFAULT_POSTGRES_PORT));
|
||||||
add(new JLabel("DB Name:", SwingConstants.RIGHT));
|
|
||||||
|
JLabel nameLabel = new JLabel("DB Name:", SwingConstants.RIGHT);
|
||||||
|
JLabel hostLabel = new JLabel("Host:", SwingConstants.RIGHT);
|
||||||
|
JLabel portLabel = new JLabel("Port:", SwingConstants.RIGHT);
|
||||||
|
nameLabel.setLabelFor(nameField);
|
||||||
|
hostLabel.setLabelFor(hostField);
|
||||||
|
portLabel.setLabelFor(portField);
|
||||||
|
|
||||||
|
add(nameLabel);
|
||||||
add(nameField);
|
add(nameField);
|
||||||
add(new JLabel("Host:", SwingConstants.RIGHT));
|
add(hostLabel);
|
||||||
add(hostField);
|
add(hostField);
|
||||||
add(new JLabel("Port:", SwingConstants.RIGHT));
|
add(portLabel);
|
||||||
add(portField);
|
add(portField);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,43 +233,10 @@ public class CreateBsimServerInfoDialog extends DialogComponentProvider {
|
||||||
if (name.isBlank() || host.isBlank() || port < 0) {
|
if (name.isBlank() || host.isBlank() || port < 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new BSimServerInfo(DBType.postgres, host, port, name);
|
return new BSimServerInfo(type, host, port, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ElasticPanel extends ServerPanel {
|
|
||||||
|
|
||||||
private JTextField nameField;
|
|
||||||
private JTextField hostField;
|
|
||||||
private JTextField portField;
|
|
||||||
|
|
||||||
ElasticPanel() {
|
|
||||||
super(new PairLayout(10, 10));
|
|
||||||
nameField = new NotifyingTextField();
|
|
||||||
hostField = new NotifyingTextField();
|
|
||||||
portField =
|
|
||||||
new NotifyingTextField(Integer.toString(BSimServerInfo.DEFAULT_ELASTIC_PORT));
|
|
||||||
add(new JLabel("DB Name:", SwingConstants.RIGHT));
|
|
||||||
add(nameField);
|
|
||||||
add(new JLabel("Host:", SwingConstants.RIGHT));
|
|
||||||
add(hostField);
|
|
||||||
add(new JLabel("Port:", SwingConstants.RIGHT));
|
|
||||||
add(portField);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
BSimServerInfo getServerInfo() {
|
|
||||||
String name = nameField.getText().trim();
|
|
||||||
String host = hostField.getText().trim();
|
|
||||||
int port = getPort(portField.getText().trim());
|
|
||||||
if (name.isBlank() || host.isBlank() || port < 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new BSimServerInfo(DBType.elastic, host, port, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private class FilePanel extends ServerPanel {
|
private class FilePanel extends ServerPanel {
|
||||||
private JTextField fileField;
|
private JTextField fileField;
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,9 @@ public class FilterWidget extends JPanel {
|
||||||
editor = createEditor(filterType, null);
|
editor = createEditor(filterType, null);
|
||||||
contentPanel = new JPanel(new BorderLayout());
|
contentPanel = new JPanel(new BorderLayout());
|
||||||
contentPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
|
contentPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
|
||||||
contentPanel.add(editor.getComponent());
|
JComponent editorComponent = editor.getComponent();
|
||||||
|
editorComponent.getAccessibleContext().setAccessibleName("Filter Value");
|
||||||
|
contentPanel.add(editorComponent);
|
||||||
return contentPanel;
|
return contentPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -551,7 +551,6 @@ class MemSearchDialog extends ReusableDialogComponentProvider {
|
||||||
|
|
||||||
setAdvancedPanelVisible(advancedButton.isSelected());
|
setAdvancedPanelVisible(advancedButton.isSelected());
|
||||||
});
|
});
|
||||||
advancedButton.setFocusable(false);
|
|
||||||
JPanel advancedButtonPanel = new JPanel();
|
JPanel advancedButtonPanel = new JPanel();
|
||||||
advancedButtonPanel.setLayout(new BoxLayout(advancedButtonPanel, BoxLayout.X_AXIS));
|
advancedButtonPanel.setLayout(new BoxLayout(advancedButtonPanel, BoxLayout.X_AXIS));
|
||||||
advancedButtonPanel.add(Box.createHorizontalGlue());
|
advancedButtonPanel.add(Box.createHorizontalGlue());
|
||||||
|
|
Loading…
Reference in a new issue