mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-2623: Improve connect dialog and factory descriptions
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 'connection' to a fake 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";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user