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

The following examples show how to use ghidra.program.model.listing.Program#setTemporary() . 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: MultiTabPluginTest.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@Test
public void testTabUpdatesOnProgramChange() throws Exception {
	ProgramBuilder builder = new ProgramBuilder("notepad", ProgramBuilder._TOY);
	builder.createMemory("test", "0x0", 100);
	Program p = doOpenProgram(builder.getProgram(), true);
	p.setTemporary(false); // we need to be notified of changes 

	// select notepad
	panel.setSelectedProgram(p);
	int transactionID = p.startTransaction("test");
	try {
		SymbolTable symTable = p.getSymbolTable();
		symTable.createLabel(builder.addr("0x10"), "fred", SourceType.USER_DEFINED);
	}
	finally {
		p.endTransaction(transactionID, true);
	}
	p.flushEvents();
	runSwing(() -> panel.refresh(p));

	JPanel tab = panel.getTab(p);
	JLabel label = (JLabel) findComponentByName(tab, "objectName");
	assertTrue(label.getText().startsWith("*"));
}
 
Example 2
Source File: MultiTabPluginTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private Program openDummyProgram(String name, boolean makeCurrent) throws Exception {

		ProgramBuilder builder = new ProgramBuilder(name, ProgramBuilder._TOY);
		builder.createMemory(".text", "0x01000000", 0x100);
		Program program = builder.getProgram();
		program.setTemporary(false); // some tests want to be notified of changes
		return doOpenProgram(program, makeCurrent);
	}
 
Example 3
Source File: TestProgramManager.java    From ghidra with Apache License 2.0 4 votes vote down vote up
public void markAllProgramsAsUnchanged() {
	for (Program program : openTestPrograms) {
		program.setTemporary(true);
	}
}