private static void doPerformAction(DockingActionIf action, ActionContext context,
			boolean waitForCompletion) {

		assertNotNull("Action cannot be null", action);
		assertNotNull("Action context cannot be null", context);

		runSwing(() -> {

			action.isAddToPopup(context);
			action.isEnabledForContext(context);

			if (action instanceof ToggleDockingActionIf) {
				ToggleDockingActionIf toggleAction = ((ToggleDockingActionIf) action);
				toggleAction.setSelected(!toggleAction.isSelected());
			}

			action.actionPerformed(context);

		}, waitForCompletion);

		if (!Swing.isSwingThread()) {
			waitForSwing();
		}
	}
Performs the specified action within the Swing Thread.  If the action results
in a modal dialog, waitForCompletion must be false.

@param action action to be performed
@param waitForCompletion if true wait for action to complete before returning,
otherwise schedule action to be performed and return immediately.
Ghidra/Framework/Docking/src/main/java/docking/test/AbstractDockingTest.java