public static IProject getSelectedProject(ISelection selection) {
		IProject project = null;

		if (selection instanceof IStructuredSelection) {
			IStructuredSelection structuredSelection = (IStructuredSelection) selection;
			Object firstElement = structuredSelection.getFirstElement();
			if (firstElement instanceof IResource) {
				project = ((IResource) (firstElement)).getProject();
			}
			else if (firstElement instanceof IJavaElement) {
				project = ((IJavaElement) (firstElement)).getResource().getProject();
			}
		}
		return project;
	}
Gets the selected project, or null if a project is not selected.  If multiple things
are selected, only the first selected item is considered.

@param selection A selection from which to get a project.
@return The selected project, or null if a project is not selected.
GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/utils/GhidraProjectUtils.java