private void setEquate(ListingActionContext context) {

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

		// 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);
		if (dialog.showSetDialog() == SetEquateDialog.CANCELED) {
			return;
		}

		// Define an iterator for the task.  We're using a CodeUnitIterator to make sure we inspect
		// all Data and Instruction instances.
		CodeUnitIterator iter = null;
		Listing listing = context.getProgram().getListing();
		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);
		}

		CreateEquateCmd cmd = new CreateEquateCmd(scalar, iter, dialog.getEquateName(),
			dialog.getOverwriteExisting(), context);
		tool.executeBackgroundCommand(cmd, context.getProgram());

		dialog.dispose();
	}
Called in response to the user activating the Set Equate action from the menu.  This will
ultimately create the background tasks that will create the proper equate(s) for
the selected addresses.

@param context the action context
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/EquatePlugin.java