private Scalar grabMatchingScalar(Instruction instruction, int opIndex, int subOpIndex) {
		Scalar scalarAtCursor = action.plugin.getScalar(context);
		Scalar scalar = action.plugin.getScalar(instruction, opIndex, subOpIndex);

		if (scalarAtCursor.equals(scalar)) {
			return scalar;
		}

		if (scalar == null) {
			// Checks the sub-operands for any scalars.
			List<?> opObjects = instruction.getDefaultOperandRepresentationList(opIndex);
			//@formatter:off
			Optional<Scalar> match = opObjects.stream()
				.filter(Scalar.class::isInstance)
				.map(Scalar.class::cast)
				.filter(s -> s.equals(scalarAtCursor))
				.findAny()
				;
			//@formatter:on

			if (match.isPresent()) {
				return match.get();
			}
		}

		return null;
	}
Gets a scalar that matches the value of the scalar at the cursor location.
@param instruction The instruction to search
@param opIndex The operand index to look at
@param subOpIndex the sub operand index
@return A scalar that matches the value of the scalar at the cursor location, or null if no
such scalar can be found.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/ConvertCommand.java