IJavaElement corresponding= getCorrespondingElement(element); if (corresponding instanceof ISourceReference) { ISourceReference reference= (ISourceReference) corresponding;  setSelection(reference, true);  if (fOutlinePage != null) { fOutlineSelectionChangedListener.uninstall(fOutlinePage); fOutlinePage.select(reference); fOutlineSelectionChangedListener.install(fOutlinePage);
if (reference != null) {  StyledText  textWidget= null;  ISourceViewer sourceViewer= getSourceViewer(); if (sourceViewer != null) textWidget= sourceViewer.getTextWidget();  if (textWidget == null) return;  try { ISourceRange range= null; if (reference instanceof ILocalVariable) { IJavaElement je= ((ILocalVariable)reference).getParent(); if (je instanceof ISourceReference) range= ((ISourceReference)je).getSourceRange(); } else range= reference.getSourceRange();  if (range == null) return;  int offset= range.getOffset(); int length= range.getLength();  if (offset < 0 || length < 0) return;  setHighlightRange(offset, length, moveCursor);  if (!moveCursor) return;  offset= -1; length= -1;  if (reference instanceof IMember) { range= ((IMember) reference).getNameRange(); if (range != null) { offset= range.getOffset(); length= range.getLength(); } } else if (reference instanceof ILocalVariable) { range= ((ILocalVariable)reference).getNameRange(); if (range != null) { offset= range.getOffset(); length= range.getLength(); } } else if (reference instanceof IImportDeclaration) { String name= ((IImportDeclaration) reference).getElementName(); if (name != null && name.length() > 0) { String content= reference.getSource(); if (content != null) { offset= range.getOffset() + content.indexOf(name); length= name.length(); } } } else if (reference instanceof IPackageDeclaration) { String name= ((IPackageDeclaration) reference).getElementName(); if (name != null && name.length() > 0) { String content= reference.getSource(); if (content != null) { offset= range.getOffset() + content.indexOf(name); length= name.length(); } } }  if (offset > -1 && length > 0) {  try  { textWidget.setRedraw(false); sourceViewer.revealRange(offset, length); sourceViewer.setSelectedRange(offset, length); } finally { textWidget.setRedraw(true); }  markInNavigationHistory(); }  } catch (JavaModelException x) { } catch (IllegalArgumentException x) {
	public void setSelection(IJavaElement element) {				if (element == null || element instanceof ICompilationUnit || element instanceof IClassFile) {			/*			 * If the element is an ICompilationUnit this unit is either the input			 * of this editor or not being displayed. In both cases, nothing should			 * happened. (http://dev.eclipse.org/bugs/show_bug.cgi?id=5128)			 */			return;		}				IJavaElement corresponding= getCorrespondingElement(element);		if (corresponding instanceof ISourceReference) {			ISourceReference reference= (ISourceReference) corresponding;			// set highlight range			setSelection(reference, true);			// set outliner selection			if (fOutlinePage != null) {				fOutlineSelectionChangedListener.uninstall(fOutlinePage);				fOutlinePage.select(reference);				fOutlineSelectionChangedListener.install(fOutlinePage);			}		}	}