Java Code Examples for ghidra.program.model.listing.Program#addListener()

The following examples show how to use ghidra.program.model.listing.Program#addListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultiProgramManager.java    From ghidra with Apache License 2.0 6 votes vote down vote up
void addProgram(Program p, URL ghidraURL, int state) {
	ProgramInfo oldInfo = programMap.get(p);
	if (oldInfo == null) {
		p.addConsumer(tool);
		ProgramInfo info = new ProgramInfo(p, state != ProgramManager.OPEN_HIDDEN);
		info.ghidraURL = ghidraURL;
		openProgramList.add(info);
		Collections.sort(openProgramList);
		programMap.put(p, info);

		fireOpenEvents(p);

		p.addListener(this);
		p.addTransactionListener(this);
	}
	else {
		if (!oldInfo.visible && state != ProgramManager.OPEN_HIDDEN) {
			oldInfo.setVisible(true);
		}
	}
	if (state == ProgramManager.OPEN_CURRENT) {
		saveLocation();
		setCurrentProgram(p);
	}
}
 
Example 2
Source File: EquateTablePlugin.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
protected void programActivated(Program program) {
	if (tool.isVisible(provider)) {
		program.addListener(this);
	}
	provider.programOpened(program);
}
 
Example 3
Source File: DomainEventDisplayPlugin.java    From ghidra with Apache License 2.0 5 votes vote down vote up
/**
 * Put event processing code here.
 */
@Override
public void processEvent(PluginEvent event) {
	if (event instanceof ProgramActivatedPluginEvent) {
		ProgramActivatedPluginEvent ev = (ProgramActivatedPluginEvent) event;
		Program newProg = ev.getActiveProgram();
		if (currentProgram != null) {
			currentProgram.removeListener(this);
		}
		if (newProg != null) {
			newProg.addListener(this);
		}
	}
}
 
Example 4
Source File: PropertyBasedBackgroundColorModel.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void updateListener(Program newProgram) {
	if (newProgram == program) {
		return;
	}
	if (program != null) {
		program.removeListener(this);
	}
	if (newProgram != null) {
		newProgram.addListener(this);
	}

}
 
Example 5
Source File: DataWindowPlugin.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
protected void programActivated(Program program) {
	program.addListener(this);
	provider.programOpened(program);
	filterAction.programOpened(program);
	resetTypes();
}
 
Example 6
Source File: MyProgramChangesDisplayPlugin.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
protected void programActivated(Program program) {

	program.addListener(this);
	program.addTransactionListener(transactionListener);
	updateForDomainFileChanged();

	createMarkerSets(program);
	intializeChangeMarkers();
}
 
Example 7
Source File: AddressBasedGraphDisplayListener.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public AddressBasedGraphDisplayListener(PluginTool tool, Program program,
		GraphDisplay display) {
	this.tool = tool;
	this.program = program;
	this.symbolTable = program.getSymbolTable();
	this.graphDisplay = display;
	name = getClass().getSimpleName() + instanceCount.getAndAdd(1);
	tool.addListenerForAllPluginEvents(this);
	program.addListener(this);
}
 
Example 8
Source File: ScalarSearchPlugin.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Override
protected void programActivated(Program program) {
	program.addListener(this);
}
 
Example 9
Source File: DataTypeManagerPlugin.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Override
protected void programActivated(Program program) {
	program.addListener(this);
	dataTypeManagerHandler.programOpened(program);
	dataTypePropertyManager.programOpened(program);
}
 
Example 10
Source File: FunctionWindowPlugin.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Override
protected void programActivated(Program program) {
	program.addListener(this);
	provider.programOpened(program);
}
 
Example 11
Source File: ViewStringsPlugin.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Override
protected void programActivated(Program program) {
	program.addListener(this);
	provider.setProgram(program);
}
 
Example 12
Source File: CommentWindowPlugin.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Override
protected void programActivated(Program program) {
	program.addListener(this);
	provider.programOpened(program);
}
 
Example 13
Source File: TableServicePlugin.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Override
protected void programActivated(Program program) {
	program.addListener(this);
}
 
Example 14
Source File: RelocationTablePlugin.java    From ghidra with Apache License 2.0 4 votes vote down vote up
private void programOpened(Program p) {
	p.addListener(this);
	currentProgram = p;
	provider.setProgram(p);
}
 
Example 15
Source File: RelocationFixupPlugin.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Override
protected void programActivated(Program program) {
	program.addListener(this);
}
 
Example 16
Source File: TemplateProgramPlugin.java    From ghidra with Apache License 2.0 4 votes vote down vote up
/**
 * Called when the program is opened.
 */
@Override
protected void programActivated(Program program) {
	program.addListener(this);
}
 
Example 17
Source File: MoveBlockModel.java    From ghidra with Apache License 2.0 4 votes vote down vote up
/**
 * Constructor
 * 
 */
MoveBlockModel(Program program) {
	this.program = program;
	message = "";
	program.addListener(this);
}
 
Example 18
Source File: ExpandBlockModel.java    From ghidra with Apache License 2.0 4 votes vote down vote up
ExpandBlockModel(PluginTool tool, Program program) {
	this.tool = tool;
	this.program = program;
	program.addListener(this);
}
 
Example 19
Source File: AutoTableDisassemblerPlugin.java    From ghidra with Apache License 2.0 4 votes vote down vote up
/**
 * @see ghidra.app.plugin.ProgramPlugin#programActivated(Program)
 */
@Override
protected void programActivated(Program program) {
	program.addListener(this);
}
 
Example 20
Source File: PropertyManagerPlugin.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Override
   protected void programActivated(Program program) {
	program.addListener(this);
	propertyViewProvider.programActivated(program);
}