@Override
	public void actionPerformed(ActionContext context) {
		codeUnit = getCodeUnit(context);
		if (codeUnit == null || !isApplicableToUnit(codeUnit)) {
			return;
		}

		ListingActionContext lac = (ListingActionContext) context;
		prepareLayout(lac);

		ProgramLocation cur = lac.getLocation();
		program = cur.getProgram();
		address = cur.getAddress();
		if (address == null) {
			return;
		}
		MemoryBlock block = program.getMemory().getBlock(address);
		if (block == null || !block.isInitialized()) {
			return;
		}

		prepare();

		ToolOptions displayOptions = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_DISPLAY);
		Font font = displayOptions.getFont(GhidraOptions.OPTION_BASE_FONT, null);
		if (font != null) {
			setInputFont(font);
		}

		fieldPanel.removeAll();
		if (!showInputs(fieldPanel)) {
			return;
		}
		fillInputs();

		fieldLayoutManager.layoutContainer(fieldPanel);
	}
Pre-fill the input fields and place the caret appropriately (usually at the end)
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/assembler/AbstractPatchAction.java