return (IJavaElement)parent.getAdapter(IJavaElement.class);
return parent.getAdapter(IJavaElement.class);
	protected final Object getSingleElementFromSelection(ISelection selection) {		if (!(selection instanceof StructuredSelection) || selection.isEmpty())			return null;		Iterator iter= ((StructuredSelection)selection).iterator();		Object firstElement= iter.next();		if (!(firstElement instanceof IJavaElement)) {			if (firstElement instanceof IMarker)				firstElement= ((IMarker)firstElement).getResource();			if (firstElement instanceof IAdaptable) {				IJavaElement je= (IJavaElement)((IAdaptable)firstElement).getAdapter(IJavaElement.class);				if (je == null && firstElement instanceof IFile) {					IContainer parent= ((IFile)firstElement).getParent();					if (parent != null)						return (IJavaElement)parent.getAdapter(IJavaElement.class);					else return null;				} else					return je;			} else				return firstElement;		}		Object currentInput= getViewer().getInput();		if (currentInput == null || !currentInput.equals(findInputForJavaElement((IJavaElement)firstElement)))			if (iter.hasNext())				// multi-selection and view is empty				return null;			else				// OK: single selection and view is empty				return firstElement;		// be nice to multi-selection		while (iter.hasNext()) {			Object element= iter.next();			if (!(element instanceof IJavaElement))				return null;			if (!currentInput.equals(findInputForJavaElement((IJavaElement)element)))				return null;		}		return firstElement;	}