if (jElementToSelect.getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
if (jElementToSelect != null && jElementToSelect.getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
	void adjustInputAndSetSelection(IJavaElement je) {		IJavaElement jElementToSelect= getSuitableJavaElement(findElementToSelect(je));		LogicalPackgesContentProvider p= (LogicalPackgesContentProvider) fWrappedViewer.getContentProvider();		Object elementToSelect= jElementToSelect;		if (jElementToSelect.getElementType() == IJavaElement.PACKAGE_FRAGMENT) {			IPackageFragment pkgFragment= (IPackageFragment)jElementToSelect;			elementToSelect= p.findLogicalPackage(pkgFragment);			if (elementToSelect == null)				elementToSelect= pkgFragment;		}		IJavaElement newInput= findInputForJavaElement(je);		if (elementToSelect == null && !isValidInput(newInput))			setInput(null);		// XXX: to use testFindItem needs to be reworked		else if (elementToSelect == null || getViewer().testFindItem(elementToSelect) == null) {			//optimization, if you are in the same project but expansion hasn't happened			Object input= getViewer().getInput();			if (elementToSelect != null && newInput != null) {				if (newInput.equals(input)) {					getViewer().reveal(elementToSelect);				// Adjust input to selection				} else {					setInput(newInput);					getViewer().reveal(elementToSelect);				}			} else				setInput(newInput);			// Recompute suitable element since it depends on the viewer's input			jElementToSelect= getSuitableJavaElement(elementToSelect);			if (jElementToSelect.getElementType() == IJavaElement.PACKAGE_FRAGMENT) {				IPackageFragment pkgFragment= (IPackageFragment)jElementToSelect;				elementToSelect= p.findLogicalPackage(pkgFragment);				if (elementToSelect == null)					elementToSelect= pkgFragment;			}		}		ISelection selection;		if (elementToSelect != null)			selection= new StructuredSelection(elementToSelect);		else			selection= StructuredSelection.EMPTY;		setSelection(selection, true);	}