ISelection selection= getSite().getPage().getSelection();
IWorkbenchPage page= getSite().getPage(); ISelection selection= null; if (page != null) selection= page.getSelection(); if (selection instanceof ITextSelection) { Object part= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart(); if (part instanceof IEditorPart) { setSelectionFromEditor((IEditorPart)part); if (fViewer.getSelection() != null) return; } }   if (selection == null || selection.isEmpty()) selection= restoreSelectionState(fMemento);
	protected void setInitialSelection() {		// Use the selection, if any		Object input;		ISelection selection= getSite().getPage().getSelection();		if (selection != null && !selection.isEmpty())			input= getSingleElementFromSelection(selection);		else {			// Use the input of the page			input= getSite().getPage().getInput();			if (!(input instanceof IJavaElement)) {				if (input instanceof IAdaptable)					input= ((IAdaptable)input).getAdapter(IJavaElement.class);				else					return;			}		}		if (findElementToSelect((IJavaElement)input) != null)			adjustInputAndSetSelection((IJavaElement)input);	}