@Override
	public void processEvent(PluginEvent event) {
		super.processEvent(event);

		if (event instanceof ProgramActivatedPluginEvent) {
			ProgramActivatedPluginEvent pape = (ProgramActivatedPluginEvent) event;
			Program currentProgram = pape.getActiveProgram();
			importSelectionAction.setEnabled(currentProgram != null);
			addToProgramAction.setEnabled(currentProgram != null);
			loadLibrariesAction.setEnabled(shouldEnableLoadLibraries(currentProgram));
		}
	}
A {@link Plugin} that supplies menu items and tasks to import files into Ghidra.
Ghidra/Features/Base/src/main/java/ghidra/plugin/importer/ImporterPlugin.java