mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
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 |
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
@ -735,13 +735,14 @@ public class UserManager {
|
||||||
getDNLog().println(username + "; " + principal);
|
getDNLog().println(username + "; " + principal);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
|
// ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Regex: matches if the entire string is alpha, digit, ".", "-", "_", fwd or back slash.
|
* 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.
|
* Ensures a name only contains valid characters and meets length limitations.
|
||||||
|
|
|
@ -152,7 +152,7 @@ public abstract class AbstractDockingTool implements DockingTool {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showDialog(DialogComponentProvider dialogComponent) {
|
public void showDialog(DialogComponentProvider dialogComponent) {
|
||||||
DockingWindowManager.showDialog(getToolFrame(), dialogComponent);
|
DockingWindowManager.showDialog(null, dialogComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JFrame getToolFrame() {
|
public JFrame getToolFrame() {
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class AboutDomainObjectUtils {
|
||||||
if (helpLocation != null) {
|
if (helpLocation != null) {
|
||||||
dialog.setHelpLocation(helpLocation);
|
dialog.setHelpLocation(helpLocation);
|
||||||
}
|
}
|
||||||
tool.showDialog(dialog, (Component) null);
|
tool.showDialog(dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addInfo(JPanel panel, String name, String value) {
|
private static void addInfo(JPanel panel, String name, String value) {
|
||||||
|
|
|
@ -128,7 +128,8 @@ public class FindCheckoutsDialog extends DialogComponentProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionContext getActionContext(MouseEvent event) {
|
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 {
|
private class MyCellRenderer extends GTableCellRenderer {
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class VersionControlShowHistoryAction extends VersionControlAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
VersionHistoryDialog dialog = new VersionHistoryDialog(domainFiles.get(0));
|
VersionHistoryDialog dialog = new VersionHistoryDialog(domainFiles.get(0));
|
||||||
tool.showDialog(dialog, tool.getToolFrame());
|
tool.showDialog(dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package help.screenshot;
|
package help.screenshot;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -58,9 +58,9 @@ public class VersionControlSlowScreenShots extends GhidraScreenShotGenerator {
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
|
|
||||||
// super.tearDown(); don't do this; use our tool instead
|
// super.tearDown(); don't do this; use our tool instead
|
||||||
|
if (frontEnd != null) {
|
||||||
frontEnd.dispose();
|
frontEnd.dispose();
|
||||||
|
}
|
||||||
showResults();
|
showResults();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import javax.swing.*;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import docking.ActionContext;
|
||||||
import docking.DialogComponentProvider;
|
import docking.DialogComponentProvider;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.widgets.table.*;
|
import docking.widgets.table.*;
|
||||||
|
@ -212,7 +213,8 @@ public class VersionControlAction1Test extends AbstractVersionControlActionTest
|
||||||
waitForTasks();
|
waitForTasks();
|
||||||
|
|
||||||
// make some changes to check in
|
// make some changes to check in
|
||||||
Program program = (Program) ((DomainFileNode) node).getDomainFile().getDomainObject(this,
|
Program program = (Program) ((DomainFileNode) node).getDomainFile()
|
||||||
|
.getDomainObject(this,
|
||||||
true, false, TaskMonitor.DUMMY);
|
true, false, TaskMonitor.DUMMY);
|
||||||
editProgram(program, (p) -> {
|
editProgram(program, (p) -> {
|
||||||
SymbolTable symTable = p.getSymbolTable();
|
SymbolTable symTable = p.getSymbolTable();
|
||||||
|
@ -220,7 +222,8 @@ public class VersionControlAction1Test extends AbstractVersionControlActionTest
|
||||||
SourceType.USER_DEFINED);
|
SourceType.USER_DEFINED);
|
||||||
});
|
});
|
||||||
|
|
||||||
program = (Program) ((DomainFileNode) xnode).getDomainFile().getDomainObject(this, true,
|
program = (Program) ((DomainFileNode) xnode).getDomainFile()
|
||||||
|
.getDomainObject(this, true,
|
||||||
false, TaskMonitor.DUMMY);
|
false, TaskMonitor.DUMMY);
|
||||||
editProgram(program, (p) -> {
|
editProgram(program, (p) -> {
|
||||||
SymbolTable symTable = p.getSymbolTable();
|
SymbolTable symTable = p.getSymbolTable();
|
||||||
|
@ -250,7 +253,8 @@ public class VersionControlAction1Test extends AbstractVersionControlActionTest
|
||||||
checkout(programNode);
|
checkout(programNode);
|
||||||
|
|
||||||
Program program =
|
Program program =
|
||||||
(Program) ((DomainFileNode) programNode).getDomainFile().getDomainObject(this, true,
|
(Program) ((DomainFileNode) programNode).getDomainFile()
|
||||||
|
.getDomainObject(this, true,
|
||||||
false, TaskMonitor.DUMMY);
|
false, TaskMonitor.DUMMY);
|
||||||
|
|
||||||
createHistoryEntry(program, "Symbol1");
|
createHistoryEntry(program, "Symbol1");
|
||||||
|
@ -559,25 +563,17 @@ public class VersionControlAction1Test extends AbstractVersionControlActionTest
|
||||||
FindCheckoutsTableModel model = (FindCheckoutsTableModel) table.getModel();
|
FindCheckoutsTableModel model = (FindCheckoutsTableModel) table.getModel();
|
||||||
|
|
||||||
assertEquals(2, model.getRowCount());
|
assertEquals(2, model.getRowCount());
|
||||||
|
|
||||||
assertEquals(4, model.getColumnCount());
|
assertEquals(4, model.getColumnCount());
|
||||||
|
|
||||||
JButton checkInButton =
|
DockingActionIf undoCheckoutAction = getAction("UndoCheckOut");
|
||||||
findButtonByIcon(dialog, ResourceManager.loadImage("images/vcCheckIn.png"));
|
DockingActionIf checkInAction = getAction("CheckIn");
|
||||||
|
assertFalse(checkInAction.isEnabledForContext(dialog.getActionContext(null)));
|
||||||
assertNotNull(checkInButton);
|
assertFalse(undoCheckoutAction.isEnabledForContext(dialog.getActionContext(null)));
|
||||||
|
|
||||||
JButton undoCheckoutButton =
|
|
||||||
findButtonByIcon(dialog, ResourceManager.loadImage("images/vcUndoCheckOut.png"));
|
|
||||||
assertNotNull(undoCheckoutButton);
|
|
||||||
|
|
||||||
assertTrue(!checkInButton.isEnabled());
|
|
||||||
assertTrue(!undoCheckoutButton.isEnabled());
|
|
||||||
|
|
||||||
// make a selection in the table
|
// make a selection in the table
|
||||||
selectInTable(table, node);
|
selectInTable(table, node);
|
||||||
assertTrue(checkInButton.isEnabled());
|
assertFalse(checkInAction.isEnabledForContext(dialog.getActionContext(null)));
|
||||||
assertTrue(undoCheckoutButton.isEnabled());
|
assertTrue(undoCheckoutAction.isEnabledForContext(dialog.getActionContext(null)));
|
||||||
|
|
||||||
CheckoutInfo checkoutInfo = model.getRowObject(0);
|
CheckoutInfo checkoutInfo = model.getRowObject(0);
|
||||||
DomainFile file = checkoutInfo.getFile();
|
DomainFile file = checkoutInfo.getFile();
|
||||||
|
@ -611,11 +607,9 @@ public class VersionControlAction1Test extends AbstractVersionControlActionTest
|
||||||
|
|
||||||
selectInTable(table, node);
|
selectInTable(table, node);
|
||||||
|
|
||||||
JButton undoCheckoutButton =
|
DockingActionIf undoCheckoutAction = getAction("UndoCheckOut");
|
||||||
findButtonByIcon(dialog, ResourceManager.loadImage("images/vcUndoCheckOut.png"));
|
assertTrue(undoCheckoutAction.isEnabledForContext(dialog.getActionContext(null)));
|
||||||
assertNotNull(undoCheckoutButton);
|
performAction(undoCheckoutAction);
|
||||||
assertTrue(undoCheckoutButton.isEnabled());
|
|
||||||
pressButton(undoCheckoutButton);
|
|
||||||
|
|
||||||
waitForBusyTable(table);
|
waitForBusyTable(table);
|
||||||
assertEquals(1, model.getRowCount());
|
assertEquals(1, model.getRowCount());
|
||||||
|
@ -651,11 +645,10 @@ public class VersionControlAction1Test extends AbstractVersionControlActionTest
|
||||||
selectionModel.setSelectionInterval(0, 1); // both rows
|
selectionModel.setSelectionInterval(0, 1); // both rows
|
||||||
});
|
});
|
||||||
|
|
||||||
JButton undoCheckoutButton =
|
DockingActionIf undoCheckoutAction = getAction("UndoCheckOut");
|
||||||
findButtonByIcon(dialog, ResourceManager.loadImage("images/vcUndoCheckOut.png"));
|
ActionContext context = dialog.getActionContext(null);
|
||||||
assertNotNull(undoCheckoutButton);
|
assertTrue(undoCheckoutAction.isEnabledForContext(context));
|
||||||
assertTrue(undoCheckoutButton.isEnabled());
|
performAction(undoCheckoutAction, context, true);
|
||||||
pressButton(undoCheckoutButton);
|
|
||||||
|
|
||||||
waitForBusyTable(table);
|
waitForBusyTable(table);
|
||||||
assertEquals(0, model.getRowCount());
|
assertEquals(0, model.getRowCount());
|
||||||
|
|
|
@ -213,7 +213,8 @@ public class VersionControlAction2Test extends AbstractVersionControlActionTest
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
waitForTasks();
|
waitForTasks();
|
||||||
|
|
||||||
Program program = (Program) ((DomainFileNode) node).getDomainFile().getDomainObject(this,
|
Program program = (Program) ((DomainFileNode) node).getDomainFile()
|
||||||
|
.getDomainObject(this,
|
||||||
true, false, TaskMonitor.DUMMY);
|
true, false, TaskMonitor.DUMMY);
|
||||||
int transactionID = program.startTransaction("test");
|
int transactionID = program.startTransaction("test");
|
||||||
try {
|
try {
|
||||||
|
@ -410,7 +411,7 @@ public class VersionControlAction2Test extends AbstractVersionControlActionTest
|
||||||
|
|
||||||
assertNotNull(dialog);
|
assertNotNull(dialog);
|
||||||
|
|
||||||
final GTable table = findComponent(dialog.getComponent(), GTable.class);
|
GTable table = findComponent(dialog.getComponent(), GTable.class);
|
||||||
assertNotNull(table);
|
assertNotNull(table);
|
||||||
waitForBusyTable(table);
|
waitForBusyTable(table);
|
||||||
|
|
||||||
|
@ -419,14 +420,11 @@ public class VersionControlAction2Test extends AbstractVersionControlActionTest
|
||||||
|
|
||||||
selectInTable(table, node);
|
selectInTable(table, node);
|
||||||
|
|
||||||
JButton checkInButton =
|
DockingActionIf checkInAction = getAction("CheckIn");
|
||||||
findButtonByIcon(dialog, ResourceManager.loadImage("images/vcCheckIn.png"));
|
ActionContext context = dialog.getActionContext(null);
|
||||||
|
assertTrue(checkInAction.isEnabledForContext(context));
|
||||||
assertNotNull(checkInButton);
|
performAction(checkInAction, context, false);
|
||||||
assertTrue(checkInButton.isEnabled());
|
|
||||||
pressButton(checkInButton, false);
|
|
||||||
VersionControlDialog d = waitForDialogComponent(VersionControlDialog.class);
|
VersionControlDialog d = waitForDialogComponent(VersionControlDialog.class);
|
||||||
assertNotNull(d);
|
|
||||||
|
|
||||||
pressButtonByText(d, "Cancel");
|
pressButtonByText(d, "Cancel");
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class ServerTestUtil {
|
||||||
private static class ShutdownHook extends Thread {
|
private static class ShutdownHook extends Thread {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
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();
|
disposeServer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue