Merge remote-tracking branch 'origin/GT-2886-dragonmacher-beep-npe'

Conflicts:
	Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/PluginTool.java
This commit is contained in:
Ryan Kurtz 2019-05-23 12:08:34 -04:00
commit f9a1652974
8 changed files with 51 additions and 33 deletions

View file

@ -173,8 +173,7 @@ public class CodeBrowserClipboardProvider extends ByteCopier
return pasteByteString(string);
}
tool.setStatusInfo("Paste failed: unsupported data type");
tool.getToolFrame().getToolkit().beep();
tool.setStatusInfo("Paste failed: unsupported data type", true);
}
catch (Exception e) {
String msg = e.getMessage();
@ -182,8 +181,7 @@ public class CodeBrowserClipboardProvider extends ByteCopier
msg = e.toString();
Msg.error(this, "Unexpected Exception: " + e.getMessage(), e);
}
tool.setStatusInfo("Paste failed: " + msg);
tool.getToolFrame().getToolkit().beep();
tool.setStatusInfo("Paste failed: " + msg, true);
}
return false;
}
@ -405,8 +403,7 @@ public class CodeBrowserClipboardProvider extends ByteCopier
String message = "Copy failed: " + msg;
Msg.error(this, message, e);
tool.setStatusInfo(message);
tool.getToolFrame().getToolkit().beep();
tool.setStatusInfo(message, true);
}
return null;
@ -440,8 +437,7 @@ public class CodeBrowserClipboardProvider extends ByteCopier
if (msg == null) {
msg = e.toString();
}
tool.setStatusInfo("Paste failed: " + msg);
tool.getToolFrame().getToolkit().beep();
tool.setStatusInfo("Paste failed: " + msg, true);
}
return false;

View file

@ -125,8 +125,7 @@ public abstract class ByteCopier {
String string = (String) object;
if (!isOnlyAsciiBytes(string)) {
tool.setStatusInfo("Paste string contains non-text ascii bytes. " +
"Only the ascii text will be pasted.");
tool.getToolFrame().getToolkit().beep();
"Only the ascii text will be pasted.", true);
string = keepOnlyAsciiBytes(string);
}
@ -219,8 +218,7 @@ public abstract class ByteCopier {
protected boolean pasteBytes(Transferable pasteData)
throws UnsupportedFlavorException, IOException {
if (!supportsPasteTransferable(pasteData)) {
tool.setStatusInfo("Paste failed: No valid data on clipboard");
tool.getToolFrame().getToolkit().beep();
tool.setStatusInfo("Paste failed: No valid data on clipboard", true);
return false;
}
@ -249,8 +247,7 @@ public abstract class ByteCopier {
String validString = string;
if (!isOnlyAsciiBytes(string)) {
tool.setStatusInfo("Pasted string contained non-text ascii bytes. " +
"Only the ascii text was pasted.");
tool.getToolFrame().getToolkit().beep();
"Only the ascii text was pasted.", true);
validString = keepOnlyAsciiBytes(string);
}
@ -258,7 +255,7 @@ public abstract class ByteCopier {
byte[] bytes = getBytes(validString);
if (bytes == null) {
status = "Improper data format (expected sequence of hex bytes)";
tool.getToolFrame().getToolkit().beep();
tool.beep();
return false;
}
@ -270,13 +267,13 @@ public abstract class ByteCopier {
for (int i = 0; i < byteCount;) {
if (curAddr == null) {
status = "Not enough addresses to paste bytes";
tool.getToolFrame().getToolkit().beep();
tool.beep();
return false;
}
CodeUnit curCodeUnit = listing.getCodeUnitContaining(curAddr);
if (!(curCodeUnit instanceof Data) || ((Data) curCodeUnit).isDefined()) {
status = "Cannot paste on top of defined instructions/data";
tool.getToolFrame().getToolkit().beep();
tool.beep();
return false;
}
int length = curCodeUnit.getLength();