private static DomainFolder getFolderFromContext(ActionContext context) {
		Object contextObj = context.getContextObject();
		if (contextObj instanceof DomainFolderNode) {
			DomainFolderNode node = (DomainFolderNode) contextObj;
			return node.getDomainFolder();
		}
		if (contextObj instanceof DomainFileNode) {
			DomainFileNode node = (DomainFileNode) contextObj;
			DomainFile domainFile = node.getDomainFile();
			return domainFile != null ? domainFile.getParent() : null;
		}

		return AppInfo.getActiveProject().getProjectData().getRootFolder();
	}
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