Merge remote-tracking branch 'origin/patch'

This commit is contained in:
ghidra1 2019-12-05 11:48:31 -05:00
commit e07c83334d
11 changed files with 43 additions and 50 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before After
Before After

View file

@ -735,13 +735,14 @@ public class UserManager {
getDNLog().println(username + "; " + principal);
}
catch (IOException e) {
// ignore
}
}
/*
* Regex: matches if the entire string is alpha, digit, ".", "-", "_", fwd or back slash.
*/
private static final Pattern VALID_USERNAME_REGEX = Pattern.compile("[a-zA-Z0-9.-_/\\\\]+");
private static final Pattern VALID_USERNAME_REGEX = Pattern.compile("[a-zA-Z0-9.\\-_/\\\\]+");
/**
* Ensures a name only contains valid characters and meets length limitations.

View file

@ -152,7 +152,7 @@ public abstract class AbstractDockingTool implements DockingTool {
@Override
public void showDialog(DialogComponentProvider dialogComponent) {
DockingWindowManager.showDialog(getToolFrame(), dialogComponent);
DockingWindowManager.showDialog(null, dialogComponent);
}
public JFrame getToolFrame() {

View file

@ -62,7 +62,7 @@ public class AboutDomainObjectUtils {
if (helpLocation != null) {
dialog.setHelpLocation(helpLocation);
}
tool.showDialog(dialog, (Component) null);
tool.showDialog(dialog);
}
private static void addInfo(JPanel panel, String name, String value) {

View file

@ -128,7 +128,8 @@ public class FindCheckoutsDialog extends DialogComponentProvider {
@Override
public ActionContext getActionContext(MouseEvent event) {
return new ProjectDataActionContext(null, null, null, null, getFileList(), null, true);
return new ProjectDataActionContext(null, folder.getProjectData(), null, null,
getFileList(), null, true);
}
private class MyCellRenderer extends GTableCellRenderer {

View file

@ -75,7 +75,7 @@ public class VersionControlShowHistoryAction extends VersionControlAction {
}
VersionHistoryDialog dialog = new VersionHistoryDialog(domainFiles.get(0));
tool.showDialog(dialog, tool.getToolFrame());
tool.showDialog(dialog);
}
}

View file

@ -15,7 +15,7 @@
*/
package help.screenshot;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.*;
import java.io.IOException;
@ -58,9 +58,9 @@ public class VersionControlSlowScreenShots extends GhidraScreenShotGenerator {
public void tearDown() throws Exception {
// super.tearDown(); don't do this; use our tool instead
frontEnd.dispose();
if (frontEnd != null) {
frontEnd.dispose();
}
showResults();
}

View file

@ -27,6 +27,7 @@ import javax.swing.*;
import org.junit.Assert;
import org.junit.Test;
import docking.ActionContext;
import docking.DialogComponentProvider;
import docking.action.DockingActionIf;
import docking.widgets.table.*;
@ -212,16 +213,18 @@ public class VersionControlAction1Test extends AbstractVersionControlActionTest
waitForTasks();
// make some changes to check in
Program program = (Program) ((DomainFileNode) node).getDomainFile().getDomainObject(this,
true, false, TaskMonitor.DUMMY);
Program program = (Program) ((DomainFileNode) node).getDomainFile()
.getDomainObject(this,
true, false, TaskMonitor.DUMMY);
editProgram(program, (p) -> {
SymbolTable symTable = p.getSymbolTable();
symTable.createLabel(p.getMinAddress().getNewAddress(0x010001000), "fred",
SourceType.USER_DEFINED);
});
program = (Program) ((DomainFileNode) xnode).getDomainFile().getDomainObject(this, true,
false, TaskMonitor.DUMMY);
program = (Program) ((DomainFileNode) xnode).getDomainFile()
.getDomainObject(this, true,
false, TaskMonitor.DUMMY);
editProgram(program, (p) -> {
SymbolTable symTable = p.getSymbolTable();
symTable.createLabel(p.getMinAddress(), "bob", SourceType.USER_DEFINED);
@ -250,8 +253,9 @@ public class VersionControlAction1Test extends AbstractVersionControlActionTest
checkout(programNode);
Program program =
(Program) ((DomainFileNode) programNode).getDomainFile().getDomainObject(this, true,
false, TaskMonitor.DUMMY);
(Program) ((DomainFileNode) programNode).getDomainFile()
.getDomainObject(this, true,
false, TaskMonitor.DUMMY);
createHistoryEntry(program, "Symbol1");
frontEnd.checkIn(programNode, "This is checkin 1");
@ -559,25 +563,17 @@ public class VersionControlAction1Test extends AbstractVersionControlActionTest
FindCheckoutsTableModel model = (FindCheckoutsTableModel) table.getModel();
assertEquals(2, model.getRowCount());
assertEquals(4, model.getColumnCount());
JButton checkInButton =
findButtonByIcon(dialog, ResourceManager.loadImage("images/vcCheckIn.png"));
assertNotNull(checkInButton);
JButton undoCheckoutButton =
findButtonByIcon(dialog, ResourceManager.loadImage("images/vcUndoCheckOut.png"));
assertNotNull(undoCheckoutButton);
assertTrue(!checkInButton.isEnabled());
assertTrue(!undoCheckoutButton.isEnabled());
DockingActionIf undoCheckoutAction = getAction("UndoCheckOut");
DockingActionIf checkInAction = getAction("CheckIn");
assertFalse(checkInAction.isEnabledForContext(dialog.getActionContext(null)));
assertFalse(undoCheckoutAction.isEnabledForContext(dialog.getActionContext(null)));
// make a selection in the table
selectInTable(table, node);
assertTrue(checkInButton.isEnabled());
assertTrue(undoCheckoutButton.isEnabled());
assertFalse(checkInAction.isEnabledForContext(dialog.getActionContext(null)));
assertTrue(undoCheckoutAction.isEnabledForContext(dialog.getActionContext(null)));
CheckoutInfo checkoutInfo = model.getRowObject(0);
DomainFile file = checkoutInfo.getFile();
@ -611,11 +607,9 @@ public class VersionControlAction1Test extends AbstractVersionControlActionTest
selectInTable(table, node);
JButton undoCheckoutButton =
findButtonByIcon(dialog, ResourceManager.loadImage("images/vcUndoCheckOut.png"));
assertNotNull(undoCheckoutButton);
assertTrue(undoCheckoutButton.isEnabled());
pressButton(undoCheckoutButton);
DockingActionIf undoCheckoutAction = getAction("UndoCheckOut");
assertTrue(undoCheckoutAction.isEnabledForContext(dialog.getActionContext(null)));
performAction(undoCheckoutAction);
waitForBusyTable(table);
assertEquals(1, model.getRowCount());
@ -651,11 +645,10 @@ public class VersionControlAction1Test extends AbstractVersionControlActionTest
selectionModel.setSelectionInterval(0, 1); // both rows
});
JButton undoCheckoutButton =
findButtonByIcon(dialog, ResourceManager.loadImage("images/vcUndoCheckOut.png"));
assertNotNull(undoCheckoutButton);
assertTrue(undoCheckoutButton.isEnabled());
pressButton(undoCheckoutButton);
DockingActionIf undoCheckoutAction = getAction("UndoCheckOut");
ActionContext context = dialog.getActionContext(null);
assertTrue(undoCheckoutAction.isEnabledForContext(context));
performAction(undoCheckoutAction, context, true);
waitForBusyTable(table);
assertEquals(0, model.getRowCount());

View file

@ -213,8 +213,9 @@ public class VersionControlAction2Test extends AbstractVersionControlActionTest
waitForSwing();
waitForTasks();
Program program = (Program) ((DomainFileNode) node).getDomainFile().getDomainObject(this,
true, false, TaskMonitor.DUMMY);
Program program = (Program) ((DomainFileNode) node).getDomainFile()
.getDomainObject(this,
true, false, TaskMonitor.DUMMY);
int transactionID = program.startTransaction("test");
try {
SymbolTable symTable = program.getSymbolTable();
@ -410,7 +411,7 @@ public class VersionControlAction2Test extends AbstractVersionControlActionTest
assertNotNull(dialog);
final GTable table = findComponent(dialog.getComponent(), GTable.class);
GTable table = findComponent(dialog.getComponent(), GTable.class);
assertNotNull(table);
waitForBusyTable(table);
@ -419,14 +420,11 @@ public class VersionControlAction2Test extends AbstractVersionControlActionTest
selectInTable(table, node);
JButton checkInButton =
findButtonByIcon(dialog, ResourceManager.loadImage("images/vcCheckIn.png"));
assertNotNull(checkInButton);
assertTrue(checkInButton.isEnabled());
pressButton(checkInButton, false);
DockingActionIf checkInAction = getAction("CheckIn");
ActionContext context = dialog.getActionContext(null);
assertTrue(checkInAction.isEnabledForContext(context));
performAction(checkInAction, context, false);
VersionControlDialog d = waitForDialogComponent(VersionControlDialog.class);
assertNotNull(d);
pressButtonByText(d, "Cancel");

View file

@ -117,7 +117,7 @@ public class ServerTestUtil {
private static class ShutdownHook extends Thread {
@Override
public void run() {
Msg.debug(ServerTestUtil.class, "\n\n\n\n\tSHUTDONW HOOK RUNNING");
Msg.debug(ServerTestUtil.class, "\n\n\n\n\tSHUTDOWN HOOK RUNNING");
disposeServer();
}
}