mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
GP-3 - Updated Navigatable to have a notion of selected text; updated
the SearchTextPlugin to use this feature
This commit is contained in:
parent
3cc2bc5b06
commit
15a78011e3
19 changed files with 162 additions and 40 deletions
|
@ -1193,6 +1193,22 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
|
|||
return new ProgramSelection(intersection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextSelection() {
|
||||
|
||||
FGData currentData = controller.getFunctionGraphData();
|
||||
if (!currentData.hasResults()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
FGVertex focusedVertex = controller.getFocusedVertex();
|
||||
if (focusedVertex == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return focusedVertex.getTextSelection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsHighlight() {
|
||||
return true;
|
||||
|
|
|
@ -390,6 +390,11 @@ public abstract class AbstractFunctionGraphVertex implements FGVertex {
|
|||
return doGetComponent().getProgramSelection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextSelection() {
|
||||
return doGetComponent().getTextSelection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProgramHighlight(ProgramSelection highlight) {
|
||||
doGetComponent().setProgramHighlight(highlight);
|
||||
|
|
|
@ -121,6 +121,8 @@ public abstract class AbstractGraphComponentPanel extends JPanel {
|
|||
|
||||
abstract ProgramSelection getProgramSelection();
|
||||
|
||||
abstract String getTextSelection();
|
||||
|
||||
abstract void setProgramHighlight(ProgramSelection highlight);
|
||||
|
||||
void setProgramLocation(ProgramLocation location) {
|
||||
|
|
|
@ -134,6 +134,12 @@ public interface FGVertex extends VisualVertex {
|
|||
|
||||
public ProgramSelection getProgramSelection();
|
||||
|
||||
/**
|
||||
* Returns any selected text within the vertex that does not span multiple fields
|
||||
* @return the text
|
||||
*/
|
||||
public String getTextSelection();
|
||||
|
||||
public void setProgramHighlight(ProgramSelection highlight);
|
||||
|
||||
public ProgramLocation getProgramLocation();
|
||||
|
|
|
@ -539,6 +539,11 @@ public class GroupedFunctionGraphComponentPanel extends AbstractGraphComponentPa
|
|||
return new ProgramSelection(addresses);
|
||||
}
|
||||
|
||||
@Override
|
||||
String getTextSelection() {
|
||||
return null; // can't select text in a group vertex
|
||||
}
|
||||
|
||||
@Override
|
||||
void setProgramHighlight(ProgramSelection highlight) {
|
||||
Set<FGVertex> vertices = groupVertex.getVertices();
|
||||
|
|
|
@ -404,6 +404,11 @@ public class ListingGraphComponentPanel extends AbstractGraphComponentPanel {
|
|||
return listingPanel.getProgramSelection();
|
||||
}
|
||||
|
||||
@Override
|
||||
String getTextSelection() {
|
||||
return listingPanel.getTextSelection();
|
||||
}
|
||||
|
||||
@Override
|
||||
ProgramLocation getProgramLocation() {
|
||||
return listingPanel.getProgramLocation();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue