Bug 40291 javadoc / declaration views: should update when shown
Tests 20030716 1. Open the declaration view 2. Select a reference in code -> declaration shows in view (ok) 3. Open (or bring to front when in a tabbed view) javadoc view 4. Newly opened view is empty -> should fill with content for current selection when shown / opened
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/AbstractInfoView.java
/**
	 * Finds and returns the Java element selected in the given part.
	 * 
	 * @param part the workbench part for which to find the selected Java element
	 * @return the selected Java element
	 */
	private IJavaElement findSelectedJavaElement(IWorkbenchPart part) {
		Object element;
		try {
			IStructuredSelection sel= SelectionConverter.getStructuredSelection(part);
			element= SelectionUtil.getSingleElement(sel);
		} catch (JavaModelException e) {
			return null;
		}
			
		if (SearchUtil.isISearchResultViewEntry(element)) {
			IJavaElement je= SearchUtil.getJavaElement(element);
			if (je != null)
				return je;
			element= SearchUtil.getResource(element);
		}
		IJavaElement je= null;
		if (element instanceof IAdaptable)
			je= (IJavaElement)((IAdaptable)element).getAdapter(IJavaElement.class);
		
		if (je != null && je.getElementType() == IJavaElement.COMPILATION_UNIT)
			je= WorkingCopyUtil.getWorkingCopyIfExists((ICompilationUnit)je);
		
		return je;
	}