private boolean canEditField(ListingActionContext context) {
		ProgramLocation location = context.getLocation();
		int[] path = location.getComponentPath();
		if (path == null || path.length == 0) {
			return false;
		}

		Program program = context.getProgram();
		Address address = location.getAddress();
		DataTypeComponent dtc = DataTypeUtils.getDataTypeComponent(program, address, path);
		return dtc != null;
	}
Callback for edit data type action
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/data/DataPlugin.java