Merge remote-tracking branch 'origin/GP-65-dragonmacher-error-dialog'

This commit is contained in:
ghidravore 2020-09-02 14:37:55 -04:00
commit fc994cda95
44 changed files with 1784 additions and 1662 deletions

View file

@ -1094,8 +1094,24 @@ public abstract class AbstractGenericTest extends AbstractGTest {
return ref.get();
}
public static void runSwing(Runnable runnable) {
runSwing(runnable, true);
/**
* Run the given code snippet on the Swing thread and wait for it to finish
* @param r the runnable code snippet
*/
public static void runSwing(Runnable r) {
runSwing(r, true);
}
/**
* Run the given code snippet on the Swing thread later, not blocking the current thread. Use
* this if the code snippet causes a blocking operation.
*
* <P>This is a shortcut for <code>runSwing(r, false);</code>.
*
* @param r the runnable code snippet
*/
public void runSwingLater(Runnable r) {
runSwing(r, false);
}
/**
@ -1103,7 +1119,7 @@ public abstract class AbstractGenericTest extends AbstractGTest {
* an exception
* @param runnable the runnable
* @param wait true signals to wait for the Swing operation to finish
* @throws Throwable any excption that is thrown on the Swing thread
* @throws Throwable any exception that is thrown on the Swing thread
*/
public static void runSwingWithExceptions(Runnable runnable, boolean wait) throws Throwable {

View file

@ -1,36 +0,0 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.util.exception;
import java.util.Arrays;
import org.apache.commons.lang3.StringUtils;
public interface CausesImportant {
public static class Util {
public static String getMessages(Throwable exc) {
if (exc instanceof CausesImportant) {
StringBuilder result = new StringBuilder(exc.getMessage());
for (Throwable cause : MultipleCauses.Util.iterCauses(exc)) {
result.append(
StringUtils.join(Arrays.asList(cause.getMessage().split("\n")), "\n\t"));
}
return result.toString();
}
return exc.getMessage();
}
}
}

View file

@ -1,30 +0,0 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.util.exception;
public interface HasConsoleText {
public String getConsoleText();
public static class Util {
public static String get(Throwable exc) {
if (exc instanceof HasConsoleText) {
return ((HasConsoleText) exc).getConsoleText();
}
return null;
}
}
}