private void renameEquate(ListingActionContext context) {

		Scalar scalar = getScalar(context);
		if (scalar == null) {
			return;
		}

		// Now get the equate (one should exist) for this item.  If one doesn't exist, it shouldn't
		// even be an option on the context menu.
		Equate equate = getEquate(context);
		Listing listing = context.getProgram().getListing();

		// Create the dialog that will allow the user to select options.
		SetEquateDialog dialog = createEquateDialog(context, scalar);

		// Set the state of the some buttons on the dialog.  ie: if the user has selected a range
		// of addresses we should automatically set the "selection" radio button to the selected
		// state.
		dialog.setHasSelection(context);
		int result = dialog.showRenameDialog();
		if (result == SetEquateDialog.CANCELED) {
			return;
		}

		// Retrieve the name we want to change the equate(s) to.  If the name is null, it means
		// it's not a name that's already in the table, so just remove the equate.
		String equateName = dialog.getEquateName();

		// Define an iterator for the task.  We're using a CodeUnitIterator to make sure we inspect
		// all Data and Instruction instances.
		CodeUnitIterator iter = null;

		SelectionType selectionType = dialog.getSelectionType();
		if (selectionType == SelectionType.CURRENT_ADDRESS) {
			AddressSet addrSet = new AddressSet(context.getAddress());
			iter = listing.getCodeUnits(addrSet, false);
		}
		else if (selectionType == SelectionType.SELECTION) {
			iter = listing.getCodeUnits(context.getSelection(), true);
		}
		else if (selectionType == SelectionType.ENTIRE_PROGRAM) {
			iter = listing.getCodeUnits(context.getProgram().getMemory(), true);
		}

		// Determine if this is a remove or rename. If the user has left the "new equate name"
		// field blank in the dialog, then remove the equate entirely.
		Enum enoom = dialog.getEnumDataType();
		if (equateName == null) {
			removeEquateOverRange(context, equate, iter);
		}
		else {
			renameEquate(context, enoom, equate, equateName, iter);
		}

		dialog.dispose();
	}
Called in response to the user selecting the Apply Enum action from the popup menu. This
action will apply enum values to scalars in a selection.
@param context the action context
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/EquatePlugin.java