Java Code Examples for ghidra.framework.plugintool.PluginTool#firePluginEvent()

The following examples show how to use ghidra.framework.plugintool.PluginTool#firePluginEvent() . 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: ToolServicesImpl.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@Override
public void displaySimilarTool(PluginTool tool, DomainFile domainFile, PluginEvent event) {

	PluginTool[] similarTools = getSameNamedRunningTools(tool);
	PluginTool matchingTool = findToolUsingFile(similarTools, domainFile);
	if (matchingTool != null) {
		// Bring the matching tool forward.
		matchingTool.toFront();
	}
	else {
		// Create a new tool and pop it up.
		Workspace workspace = toolManager.getActiveWorkspace();
		matchingTool = workspace.runTool(tool.getToolTemplate(true));
		matchingTool.setVisible(true);
		matchingTool.acceptDomainFiles(new DomainFile[] { domainFile });
	}

	// Fire the indicated event in the tool.
	matchingTool.firePluginEvent(event);
}
 
Example 2
Source File: AbstractGhidraHeadlessIntegrationTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public void goTo(PluginTool tool, Program p, String addrString) {
	AddressFactory factory = p.getAddressFactory();
	Address addr = factory.getAddress(addrString);
	tool.firePluginEvent(
		new ProgramLocationPluginEvent("Test", new ProgramLocation(p, addr), p));
	waitForSwing();
}
 
Example 3
Source File: CopyPasteFunctionInfoTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void goToAddr(PluginTool tool, Address addr) {
	Program p = programOne;
	if (tool == toolTwo) {
		p = programTwo;
	}
	tool.firePluginEvent(
		new ProgramLocationPluginEvent("test", new AddressFieldLocation(p, addr), p));

	waitForSwing();
}
 
Example 4
Source File: CopyPasteCommentsTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void goTo(PluginTool pTool, long offset) {
	Program p = programOne;
	if (pTool == toolTwo) {
		p = programTwo;
	}
	pTool.firePluginEvent(new ProgramLocationPluginEvent("test",
		new AddressFieldLocation(p, addr(p, offset)), p));

	waitForSwing();
}
 
Example 5
Source File: AbstractGhidraHeadlessIntegrationTest.java    From ghidra with Apache License 2.0 4 votes vote down vote up
public void makeSelection(PluginTool tool, Program p, Address from, Address to) {
	ProgramSelection selection = new ProgramSelection(from, to);
	tool.firePluginEvent(new ProgramSelectionPluginEvent("Test", selection, p));
	waitForSwing();
}
 
Example 6
Source File: AbstractGhidraHeadlessIntegrationTest.java    From ghidra with Apache License 2.0 4 votes vote down vote up
public void makeSelection(PluginTool tool, Program p, AddressSetView addresses) {
	ProgramSelection selection = new ProgramSelection(addresses);
	tool.firePluginEvent(new ProgramSelectionPluginEvent("Test", selection, p));
	waitForSwing();
}