private void setupActions() {
		validateAction = new ProgramContextAction(ACTION_NAME, PLUGIN_NAME) {
			@Override
			public void actionPerformed(ProgramActionContext context) {
				Program program = context.getProgram();
				validate(program);
			}

			@Override
			public boolean isEnabledForContext(ActionContext context) {
				if (!super.isEnabledForContext(context)) {
					getMenuBarData().setMenuItemName(ACTION_NAME);
					return false;
				}
				return true;
			}

			@Override
			public boolean isEnabledForContext(ProgramActionContext context) {
				Program program = context.getProgram();
				String menuName = "Validate " + program.getDomainFile().getName();
				getMenuBarData().setMenuItemName(menuName);
				return true;
			}
		};
		validateAction.addToWindowWhen(ListingActionContext.class);
		validateAction.setMenuBarData(new MenuData(new String[] { ToolConstants.MENU_ANALYSIS,
			ACTION_NAME }, null, "ZZZ"));

		validateAction.setEnabled(false);

		validateAction.setHelpLocation(new HelpLocation("ValidateProgram", "top_of_page"));
		validateAction.setDescription(getPluginDescription().getDescription());
		tool.addAction(validateAction);
	}
Display a pop-up dialog to run PostAnalysisValidator tests on the Program
that is currently open in the tool.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/validator/ValidateProgramPlugin.java