mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
GP-2076 domain object event refactor
This commit is contained in:
parent
daca354c47
commit
856aa904aa
143 changed files with 3621 additions and 3652 deletions
|
@ -15,6 +15,9 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.functiongraph;
|
||||
|
||||
import static ghidra.framework.model.DomainObjectEvent.*;
|
||||
import static ghidra.program.util.ProgramEvent.*;
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.*;
|
||||
import java.util.function.Supplier;
|
||||
|
@ -605,30 +608,26 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
|
|||
// Note: since we are not looping and we are using 'else if's, order is important!
|
||||
//
|
||||
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_FUNCTION_BODY_CHANGED)) {
|
||||
if (ev.contains(RESTORED, FUNCTION_BODY_CHANGED)) {
|
||||
if (graphDataMissing()) {
|
||||
controller.clear();
|
||||
return; // something really destructive has happened--give up!
|
||||
}
|
||||
|
||||
graphChangedButNotRebuilt = !handleObjectRestored(ev, rebuildGraphOnChanges);
|
||||
}
|
||||
else if (ev.containsEvent(ChangeManager.DOCR_SYMBOL_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_SYMBOL_REMOVED)) {
|
||||
else if (ev.contains(SYMBOL_ADDED, SYMBOL_REMOVED)) {
|
||||
|
||||
if (currentGraphContainsEventAddress(ev)) {
|
||||
graphChangedButNotRebuilt = !handleSymbolAddedRemoved(ev, rebuildGraphOnChanges);
|
||||
}
|
||||
}
|
||||
else if (ev.containsEvent(ChangeManager.DOCR_MEM_REFERENCE_ADDED) ||
|
||||
ev.containsEvent(ChangeManager.DOCR_MEM_REFERENCE_REMOVED)) {
|
||||
else if (ev.contains(REFERENCE_ADDED, REFERENCE_REMOVED)) {
|
||||
|
||||
if (currentGraphContainsReferenceChangedEvent(ev)) {
|
||||
graphChangedButNotRebuilt = !handleReferenceAddedRemoved(ev, rebuildGraphOnChanges);
|
||||
}
|
||||
}
|
||||
else if (ev.containsEvent(ChangeManager.DOCR_SYMBOL_RENAMED)) {
|
||||
else if (ev.contains(SYMBOL_RENAMED)) {
|
||||
handleSymbolRenamed(ev);
|
||||
}
|
||||
|
||||
|
@ -664,7 +663,7 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
|
|||
}
|
||||
|
||||
private void updateGraphForAffectedAddresses(DomainObjectChangedEvent ev) {
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
if (ev.contains(DomainObjectEvent.RESTORED)) {
|
||||
controller.invalidateAllCacheForProgram(currentProgram);
|
||||
return;
|
||||
}
|
||||
|
@ -709,11 +708,11 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
|
|||
// Do we need to modify the affected vertex?
|
||||
//
|
||||
for (DomainObjectChangeRecord record : ev) {
|
||||
int eventType = record.getEventType();
|
||||
if (eventType == ChangeManager.DOCR_MEM_REFERENCE_ADDED) {
|
||||
EventType eventType = record.getEventType();
|
||||
if (eventType == ProgramEvent.REFERENCE_ADDED) {
|
||||
handleReferenceAdded(record);
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_MEM_REFERENCE_REMOVED) {
|
||||
else if (eventType == ProgramEvent.REFERENCE_REMOVED) {
|
||||
handleReferenceRemoved(record);
|
||||
}
|
||||
}
|
||||
|
@ -817,11 +816,11 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
|
|||
// Do we need to modify the affected vertex?
|
||||
//
|
||||
for (DomainObjectChangeRecord record : ev) {
|
||||
int eventType = record.getEventType();
|
||||
if (eventType == ChangeManager.DOCR_SYMBOL_ADDED) {
|
||||
EventType eventType = record.getEventType();
|
||||
if (eventType == ProgramEvent.SYMBOL_ADDED) {
|
||||
handleSymbolAdded(record);
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_SYMBOL_REMOVED) {
|
||||
else if (eventType == ProgramEvent.SYMBOL_REMOVED) {
|
||||
handleSymbolRemoved(record);
|
||||
}
|
||||
}
|
||||
|
@ -930,8 +929,8 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
|
|||
private void handleSymbolRenamed(DomainObjectChangedEvent ev) {
|
||||
for (int i = 0; i < ev.numRecords(); i++) {
|
||||
DomainObjectChangeRecord record = ev.getChangeRecord(i);
|
||||
int eventType = record.getEventType();
|
||||
if (eventType == ChangeManager.DOCR_SYMBOL_RENAMED) {
|
||||
EventType eventType = record.getEventType();
|
||||
if (eventType == ProgramEvent.SYMBOL_RENAMED) {
|
||||
Address address = getChangedAddress(record);
|
||||
if (address != null) {
|
||||
controller.refreshDisplayForAddress(address);
|
||||
|
@ -982,15 +981,15 @@ public class FGProvider extends VisualGraphComponentProvider<FGVertex, FGEdge, F
|
|||
FunctionGraph graph = functionGraphData.getFunctionGraph();
|
||||
|
||||
for (DomainObjectChangeRecord record : ev) {
|
||||
int eventType = record.getEventType();
|
||||
if (eventType == ChangeManager.DOCR_MEM_REFERENCE_ADDED) {
|
||||
EventType eventType = record.getEventType();
|
||||
if (eventType == ProgramEvent.REFERENCE_ADDED) {
|
||||
Reference reference = (Reference) record.getNewValue();
|
||||
Address toAddress = reference.getToAddress();
|
||||
if (graph.getVertexForAddress(toAddress) != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (eventType == ChangeManager.DOCR_MEM_REFERENCE_REMOVED) {
|
||||
else if (eventType == ProgramEvent.REFERENCE_REMOVED) {
|
||||
Reference reference = (Reference) record.getOldValue();
|
||||
Address toAddress = reference.getToAddress();
|
||||
if (graph.getVertexForAddress(toAddress) != null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue