@Override
	protected void locationChanged(ProgramLocation loc) {
		if (connectedProvider != null) {
			connectedProvider.setAddress(loc == null ? null : loc.getAddress());
		}
		if (loc == null || loc.getAddress() == null) {
			addressLabel.setText("");
			functionLabel.setText("");
			return;
		}
		addressLabel.setText(loc.getAddress().toString(false));

		Function currentFunction =
			currentProgram.getListing().getFunctionContaining(currentLocation.getAddress());
		boolean insideFunction = currentFunction != null;
		if (insideFunction) {
			functionLabel.setText(" " + currentFunction.getName() + " ");
			functionLabel.setToolTipText(
				currentFunction.getName() + CURRENT_FUNCTION_APPEND_STRING);
		}
		else {
			functionLabel.setText("");
			functionLabel.setToolTipText("");
		}

		// update instruction/Data field
		CodeUnit codeUnit = getCodeUnitForCurrentProgram();
		if (codeUnit == null) {
			codeUnitLabel.setText("");
			codeUnitLabel.setToolTipText("");
			return;
		}
		if (codeUnit instanceof Instruction) {
			String representation = codeUnit.toString();
			codeUnitLabel.setText(" " + representation + " ");
			codeUnitLabel.setToolTipText(CURRENT_INSTRUCTION_PREPEND_STRING + representation);
		}
		else {
			Data data = (Data) codeUnit;
			String dataTypeName = data.getDataType().getName();
			int size = data.getLength();
			String displayText = dataTypeName + "  (" + size + ")";
			String toolTipText = CURRENT_DATA_PREPEND_STRING + dataTypeName + "  Size = " + size;
			codeUnitLabel.setText(displayText);
			codeUnitLabel.setToolTipText(toolTipText);
		}
	}
Subclass should override this method if it is interested in
program location events.
@param loc location could be null
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/processors/ShowInstructionInfoPlugin.java