GP-2623: Improve connect dialog and factory descriptions

This commit is contained in:
Dan
2023-01-18 16:53:01 -05:00
parent 5195aaebc1
commit 8dbf2341b2
30 changed files with 565 additions and 333 deletions

View File

@@ -16,22 +16,52 @@
package ghidra.dbg;
import ghidra.dbg.util.ConfigurableFactory;
import ghidra.program.model.listing.Program;
import ghidra.util.classfinder.ExtensionPoint;
/**
* A factory for a debugger model
*
* <p>
* This provides a discoverable means of creating a debug model.
* This provides a discoverable means of configuring and creating a debug model.
*/
public interface DebuggerModelFactory
extends ExtensionPoint, ConfigurableFactory<DebuggerObjectModel> {
/**
* Check if this factory is compatible with the local system.
* Get the priority for selecting this factory by default for the given program
*
* <p>
* A default factory is selected when the current factory and the last successful factory are
* incompatible with the current program, or if this is the very first time connecting. Of those
* factories compatible with the current program, the one with the highest priority (larger
* numerical value) is selected. If none are compatible, then the current selection is left as
* is.
*
* <p>
* Note that negative priorities imply the factory is not compatible with the given program or
* local system.
*
* @param program the current program, or null
* @return the priority, higher values mean higher priority
*/
default int getPriority(Program program) {
return 0;
}
/**
* Check if this factory is compatible with the local system and given program.
*
* <p>
* <b>WARNING:</b> Implementations should not likely override this method. If one does, it must
* behave in the same manner as given in this default implementation: If
* {@link #getPriority(Program)} would return a non-negative result for the program, then this
* factory is compatible with that program. If negative, this factory is not compatible.
*
* @param program the current program, or null
* @return true if compatible
*/
default boolean isCompatible() {
return true;
default boolean isCompatible(Program program) {
return getPriority(program) >= 0;
}
}

View File

@@ -27,7 +27,7 @@ import ghidra.dbg.util.ConfigurableFactory.FactoryDescription;
public class TestDebuggerModelFactory implements DebuggerModelFactory {
public static final String FAKE_DETAILS = "A 'connection' to a fake debugger";
public static final String FAKE_DETAILS_HTML =
"<html><b>Description:</b> A&nbsp;'connection'&nbsp;to&nbsp;a&nbsp;fake&nbsp;debugger";
"<html><b>Description:</b> A 'connection' to a fake debugger";
public static final String FAKE_OPTION_NAME = "Test String";
public static final String FAKE_DEFAULT = "Default test string";