private String getText(Object clickedObject) {
		if (clickedObject instanceof TextField) {
			TextField textField = (TextField) clickedObject;
			return textField.getText();
		}
		else if (clickedObject instanceof FieldElement) {
			FieldElement fieldElement = (FieldElement) clickedObject;
			return fieldElement.getText();
		}
		return clickedObject.toString();
	}
A handler to process {@link XRefFieldMouseHandler} clicks
Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/XRefFieldMouseHandler.java