@Override
	public MultiStateDockingAction<T> build() {
		validate();
		MultiStateDockingAction<T> action =
			new MultiStateDockingAction<>(name, owner) {

				@Override
				public void actionStateChanged(ActionState<T> newActionState,
						EventTrigger trigger) {
					actionStateChangedCallback.accept(newActionState, trigger);
				}

				@Override
				public void actionPerformed(ActionContext context) {
					if (actionCallback != null) {
						actionCallback.accept(context);
					}
					else {
						super.actionPerformed(context);
					}
				}

				@Override
				protected List<ActionState<T>> getStates() {
					if (generator == null) {
						return super.getStates();
					}
					else {
						return generator.get();
					}
				}
			};

		for (ActionState<T> actionState : states) {
			action.addActionState(actionState);
		}

		decorateAction(action);
		action.setUseCheckboxForIcons(useCheckboxForIcons);
		return action;
	}
Generate the states dynamically upon the user clicking the button

<p>
It is highly recommended that the current state is included in the list of available states.
Otherwise, the user could become confused or frustrated.

@param generator a function from action context to available states
@return this MultiActionDockingActionBuilder (for chaining)
Ghidra/Framework/Docking/src/main/java/docking/action/builder/MultiStateActionBuilder.java