Merge remote-tracking branch 'origin/GP-0-dragonmacher-minor-test-timing-fixes'

This commit is contained in:
Ryan Kurtz 2024-06-11 09:34:29 -04:00
commit 03991bb318
3 changed files with 11 additions and 37 deletions

View File

@ -16,8 +16,6 @@
package ghidra.app.util.dialog; package ghidra.app.util.dialog;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*; import javax.swing.*;
@ -31,6 +29,7 @@ import ghidra.app.util.HelpTopics;
import ghidra.framework.model.DomainFile; import ghidra.framework.model.DomainFile;
import ghidra.framework.remote.User; import ghidra.framework.remote.User;
import ghidra.util.HelpLocation; import ghidra.util.HelpLocation;
import ghidra.util.Swing;
/** /**
* *
@ -50,22 +49,16 @@ public class CheckoutDialog extends DialogComponentProvider {
setHelpLocation(new HelpLocation(HelpTopics.PROGRAM, "FileNotCheckedOut")); setHelpLocation(new HelpLocation(HelpTopics.PROGRAM, "FileNotCheckedOut"));
JButton checkoutButton = new JButton("Yes"); JButton checkoutButton = new JButton("Yes");
checkoutButton.addActionListener(new ActionListener() { checkoutButton.addActionListener(e -> {
@Override actionID = CHECKOUT;
public void actionPerformed(ActionEvent e) { close();
actionID = CHECKOUT;
close();
}
}); });
addButton(checkoutButton); addButton(checkoutButton);
JButton noCheckoutButton = new JButton("No"); JButton noCheckoutButton = new JButton("No");
noCheckoutButton.addActionListener(new ActionListener() { noCheckoutButton.addActionListener(e -> {
@Override actionID = DO_NOT_CHECKOUT;
public void actionPerformed(ActionEvent e) { close();
actionID = DO_NOT_CHECKOUT;
close();
}
}); });
addButton(noCheckoutButton); addButton(noCheckoutButton);
@ -76,21 +69,7 @@ public class CheckoutDialog extends DialogComponentProvider {
* @return OK, or CANCEL * @return OK, or CANCEL
*/ */
public int showDialog() { public int showDialog() {
if (SwingUtilities.isEventDispatchThread()) { Swing.runNow(() -> DockingWindowManager.showDialog(null, CheckoutDialog.this));
DockingWindowManager.showDialog(null, CheckoutDialog.this);
}
else {
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
DockingWindowManager.showDialog(null, CheckoutDialog.this);
}
});
}
catch (Exception e) {
}
}
return actionID; return actionID;
} }
@ -123,12 +102,7 @@ public class CheckoutDialog extends DialogComponentProvider {
if (user.hasWritePermission()) { if (user.hasWritePermission()) {
final JCheckBox exclusiveCB = new GCheckBox("Request exclusive check out"); final JCheckBox exclusiveCB = new GCheckBox("Request exclusive check out");
exclusiveCB.setSelected(false); exclusiveCB.setSelected(false);
exclusiveCB.addActionListener(new ActionListener() { exclusiveCB.addActionListener(e -> exclusiveCheckout = exclusiveCB.isSelected());
@Override
public void actionPerformed(ActionEvent e) {
exclusiveCheckout = exclusiveCB.isSelected();
}
});
JPanel cbPanel = new JPanel(new BorderLayout()); JPanel cbPanel = new JPanel(new BorderLayout());
cbPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); cbPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
cbPanel.add(exclusiveCB); cbPanel.add(exclusiveCB);

View File

@ -216,7 +216,7 @@ public class ProgramOpener {
User user = domainFile.getParent().getProjectData().getUser(); User user = domainFile.getParent().getProjectData().getUser();
CheckoutDialog dialog = new CheckoutDialog(domainFile, user); CheckoutDialog dialog = Swing.runNow(() -> new CheckoutDialog(domainFile, user));
if (dialog.showDialog() == CheckoutDialog.CHECKOUT) { if (dialog.showDialog() == CheckoutDialog.CHECKOUT) {
try { try {
monitor.setMessage("Checking Out " + domainFile.getName()); monitor.setMessage("Checking Out " + domainFile.getName());

View File

@ -865,7 +865,7 @@ public class GTree extends JPanel implements BusyListener {
void swingRestoreNonFilteredRootNode() { void swingRestoreNonFilteredRootNode() {
realViewRootNode = realModelRootNode; realViewRootNode = realModelRootNode;
GTreeNode currentRoot = swingSetModelRootNode(realModelRootNode); GTreeNode currentRoot = swingSetModelRootNode(realModelRootNode);
if (currentRoot != realModelRootNode) { if (currentRoot != realModelRootNode && currentRoot != null) {
currentRoot.disposeClones(); currentRoot.disposeClones();
} }
} }