Java Code Examples for ghidra.program.model.listing.Data#getComponentPath()

The following examples show how to use ghidra.program.model.listing.Data#getComponentPath() . 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: FieldFactory.java    From ghidra with Apache License 2.0 6 votes vote down vote up
protected boolean hasSamePath(ListingField bf, ProgramLocation loc) {
	Object obj = bf.getProxy().getObject();
	if (obj instanceof Data) {
		Data data = (Data) obj;
		int[] path1 = data.getComponentPath();
		int[] path2 = loc.getComponentPath();
		if (path1 == null) {
			return path2 == null || path2.length == 0;
		}
		if (path2 == null) {
			return path1.length == 0;
		}
		if (path1.length != path2.length) {
			return false;
		}
		for (int i = 0; i < path2.length; i++) {
			if (path1[i] != path2[i]) {
				return false;
			}
		}
	}
	return true;
}
 
Example 2
Source File: FieldNameFieldFactory.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
public ProgramLocation getProgramLocation(int row, int col, ListingField bf) {
	Object obj = bf.getProxy().getObject();
	if (!(obj instanceof Data)) {
		return null;
	}
	Data data = (Data) obj;
	return new FieldNameFieldLocation(data.getProgram(), data.getMinAddress(),
		data.getComponentPath(), getFieldName(data), col);
}
 
Example 3
Source File: OpenCloseFieldFactory.java    From ghidra with Apache License 2.0 5 votes vote down vote up
/**
 * @see ghidra.app.util.viewer.field.FieldFactory#getProgramLocation(int, int, ghidra.app.util.viewer.field.ListingField)
 */
@Override
public ProgramLocation getProgramLocation(int row, int col, ListingField bf) {
	Object obj = bf.getProxy().getObject();
	if (!(obj instanceof Data)) {
		return null;
	}
	Data data = (Data) obj;
	return new IndentFieldLocation(data.getProgram(), data.getMinAddress(),
		data.getComponentPath());
}
 
Example 4
Source File: DataProxy.java    From ghidra with Apache License 2.0 5 votes vote down vote up
/**
 * Construct a proxy for the given Data object.
 * @param program the program containing the data object.
 * @param data the Data object to proxy.
 */
public DataProxy(ListingModel model, Program program, Data data) {
	super(model);
	this.program = program;
	this.data = data;
	this.addr = data.getMinAddress();
	this.path = data.getComponentPath();
}