Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9a3fd98

Browse files
committed
Merge remote-tracking branch 'origin/GP-4543_ghidragon_bsim_accessibility'
2 parents 9c413ca + 861f7fe commit 9a3fd98

File tree

5 files changed

+45
-50
lines changed

5 files changed

+45
-50
lines changed

Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/gui/search/dialog/AbstractBSimSearchDialog.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.*;
2222
import java.util.List;
2323

24+
import javax.accessibility.AccessibleContext;
2425
import javax.swing.*;
2526

2627
import docking.DialogComponentProvider;
@@ -118,9 +119,14 @@ protected JPanel buildOptionsPanel() {
118119
confidenceField.setValue(0);
119120
confidenceField.setMinValue(0.0);
120121

121-
panel.add(new JLabel("Similarity Threshold (0-1):"));
122+
JLabel similarityLabel = new JLabel("Similarity Threshold (0-1):");
123+
JLabel confidenceLabel = new JLabel("Confidence Threshold:");
124+
similarityLabel.setLabelFor(similarityField);
125+
confidenceLabel.setLabelFor(confidenceField);
126+
127+
panel.add(similarityLabel);
122128
panel.add(similarityField);
123-
panel.add(new JLabel("Confidence Threshold:"));
129+
panel.add(confidenceLabel);
124130
panel.add(confidenceField);
125131
return panel;
126132
}
@@ -223,6 +229,10 @@ private JPanel buildServerComponent() {
223229
comboPanel.add(serverCombo, BorderLayout.CENTER);
224230
panel.add(comboPanel, BorderLayout.CENTER);
225231

232+
AccessibleContext context = serverCombo.getAccessibleContext();
233+
context.setAccessibleName("BSim Server");
234+
context.setAccessibleDescription("Select a predefined Bsim Server");
235+
226236
JButton button = new EmptyBorderButton(Icons.CONFIGURE_FILTER_ICON);
227237
button.setToolTipText("Show Server Manager Dialog");
228238
button.addActionListener(e -> managerServers());

Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/gui/search/dialog/BSimSearchDialog.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,13 @@ protected JPanel buildOptionsPanel() {
128128
maxResultsField.setAllowsHexPrefix(false);
129129
maxResultsField.setShowNumberMode(false);
130130

131-
panel.add(new JLabel("Max Matches Per Function:"));
132-
panel.add(maxResultsField.getComponent());
131+
JComponent maxResultsComponent = maxResultsField.getComponent();
132+
133+
JLabel maxLabel = new JLabel("Max Matches Per Function:");
134+
maxLabel.setLabelFor(maxResultsComponent);
135+
136+
panel.add(maxLabel);
137+
panel.add(maxResultsComponent);
133138
return panel;
134139
}
135140

Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/gui/search/dialog/CreateBsimServerInfoDialog.java

Lines changed: 23 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ public class CreateBsimServerInfoDialog extends DialogComponentProvider {
5151

5252
private JPanel cardPanel;
5353

54-
private PostgresPanel postgresPanel;
55-
private ElasticPanel elasticPanel;
54+
private DbPanel postgresPanel;
55+
private DbPanel elasticPanel;
5656
private FilePanel filePanel;
5757

5858
private ServerPanel activePanel;
@@ -65,12 +65,13 @@ public CreateBsimServerInfoDialog() {
6565
addOKButton();
6666
addCancelButton();
6767
setOkEnabled(false);
68-
setHelpLocation(new HelpLocation("BSimSearchPlugin","Add_Server_Definition_Dialog" ));
68+
setHelpLocation(new HelpLocation("BSimSearchPlugin", "Add_Server_Definition_Dialog"));
6969
}
7070

7171
public BSimServerInfo getBsimServerInfo() {
7272
return result;
7373
}
74+
7475
@Override
7576
public void setHelpLocation(HelpLocation helpLocation) {
7677
// TODO Auto-generated method stub
@@ -101,7 +102,8 @@ public boolean acceptServer(BSimServerInfo serverInfo) {
101102
errorMessage = e.getMessage();
102103
}
103104
int answer = OptionDialog.showYesNoDialog(null, "Connection Test Failed!",
104-
"Can't connect to server: " + errorMessage + "\nDo you want to proceed with creation anyway?");
105+
"Can't connect to server: " + errorMessage +
106+
"\nDo you want to proceed with creation anyway?");
105107
return answer == OptionDialog.YES_OPTION;
106108
}
107109

@@ -113,8 +115,8 @@ private JComponent buildMainPanel() {
113115
}
114116

115117
private Component buildCardPanel() {
116-
postgresPanel = new PostgresPanel();
117-
elasticPanel = new ElasticPanel();
118+
postgresPanel = new DbPanel(DBType.postgres);
119+
elasticPanel = new DbPanel(DBType.elastic);
118120
filePanel = new FilePanel();
119121

120122
cardPanel = new JPanel(new CardLayout());
@@ -193,55 +195,33 @@ private void checkForValidDialog() {
193195
setOkEnabled(serverInfo != null);
194196
}
195197

196-
private class PostgresPanel extends ServerPanel {
197-
198+
private class DbPanel extends ServerPanel {
198199
private JTextField nameField;
199200
private JTextField hostField;
200201
private JTextField portField;
202+
private DBType type;
201203

202-
PostgresPanel() {
204+
private DbPanel(DBType type) {
203205
super(new PairLayout(10, 10));
206+
this.type = type;
207+
204208
nameField = new NotifyingTextField();
205209
hostField = new NotifyingTextField();
206210
portField =
207211
new NotifyingTextField(Integer.toString(BSimServerInfo.DEFAULT_POSTGRES_PORT));
208-
add(new JLabel("DB Name:", SwingConstants.RIGHT));
209-
add(nameField);
210-
add(new JLabel("Host:", SwingConstants.RIGHT));
211-
add(hostField);
212-
add(new JLabel("Port:", SwingConstants.RIGHT));
213-
add(portField);
214-
}
215212

216-
@Override
217-
BSimServerInfo getServerInfo() {
218-
String name = nameField.getText().trim();
219-
String host = hostField.getText().trim();
220-
int port = getPort(portField.getText().trim());
221-
if (name.isBlank() || host.isBlank() || port < 0) {
222-
return null;
223-
}
224-
return new BSimServerInfo(DBType.postgres, host, port, name);
225-
}
226-
}
227-
228-
private class ElasticPanel extends ServerPanel {
213+
JLabel nameLabel = new JLabel("DB Name:", SwingConstants.RIGHT);
214+
JLabel hostLabel = new JLabel("Host:", SwingConstants.RIGHT);
215+
JLabel portLabel = new JLabel("Port:", SwingConstants.RIGHT);
216+
nameLabel.setLabelFor(nameField);
217+
hostLabel.setLabelFor(hostField);
218+
portLabel.setLabelFor(portField);
229219

230-
private JTextField nameField;
231-
private JTextField hostField;
232-
private JTextField portField;
233-
234-
ElasticPanel() {
235-
super(new PairLayout(10, 10));
236-
nameField = new NotifyingTextField();
237-
hostField = new NotifyingTextField();
238-
portField =
239-
new NotifyingTextField(Integer.toString(BSimServerInfo.DEFAULT_ELASTIC_PORT));
240-
add(new JLabel("DB Name:", SwingConstants.RIGHT));
220+
add(nameLabel);
241221
add(nameField);
242-
add(new JLabel("Host:", SwingConstants.RIGHT));
222+
add(hostLabel);
243223
add(hostField);
244-
add(new JLabel("Port:", SwingConstants.RIGHT));
224+
add(portLabel);
245225
add(portField);
246226
}
247227

@@ -253,9 +233,8 @@ BSimServerInfo getServerInfo() {
253233
if (name.isBlank() || host.isBlank() || port < 0) {
254234
return null;
255235
}
256-
return new BSimServerInfo(DBType.elastic, host, port, name);
236+
return new BSimServerInfo(type, host, port, name);
257237
}
258-
259238
}
260239

261240
private class FilePanel extends ServerPanel {

Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/gui/search/dialog/FilterWidget.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ private Component buildFilterContentPanel() {
155155
editor = createEditor(filterType, null);
156156
contentPanel = new JPanel(new BorderLayout());
157157
contentPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
158-
contentPanel.add(editor.getComponent());
158+
JComponent editorComponent = editor.getComponent();
159+
editorComponent.getAccessibleContext().setAccessibleName("Filter Value");
160+
contentPanel.add(editorComponent);
159161
return contentPanel;
160162
}
161163

Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchmem/MemSearchDialog.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,6 @@ private JPanel buildOptionsPanel() {
551551

552552
setAdvancedPanelVisible(advancedButton.isSelected());
553553
});
554-
advancedButton.setFocusable(false);
555554
JPanel advancedButtonPanel = new JPanel();
556555
advancedButtonPanel.setLayout(new BoxLayout(advancedButtonPanel, BoxLayout.X_AXIS));
557556
advancedButtonPanel.add(Box.createHorizontalGlue());

0 commit comments

Comments
 (0)