if (content == null) {
if (content != null) {
	protected void setSelection(ISourceReference reference, boolean moveCursor) {		if (getSelectionProvider() == null)			return;		ISelection selection= getSelectionProvider().getSelection();		if (selection instanceof ITextSelection) {			ITextSelection textSelection= (ITextSelection) selection;			// PR 39995: [navigation] Forward history cleared after going back in navigation history:			// mark only in navigation history if the cursor is being moved (which it isn't if			// this is called from a PostSelectionEvent that should only update the magnet)			if (moveCursor && (textSelection.getOffset() != 0 || textSelection.getLength() != 0))				markInNavigationHistory();		}		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 ITypeParameter) {					range= ((ITypeParameter) 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 content= reference.getSource();					if (content == null) {						int start= content.indexOf("import") + 6; //$NON-NLS-1$						while (start < content.length() && content.charAt(start) == ' ')							start++;												int end= content.indexOf(';');						do {							end--;						} while (end >= 0 && content.charAt(end) == ' ');												offset= range.getOffset() + start;						length= end - start + 1;					} else {						// fallback						offset= range.getOffset();						length= range.getLength();					}				} else if (reference instanceof IPackageDeclaration) {					String name= ((IPackageDeclaration) reference).getElementName();					if (name != null && name.length() > 0) {						String content= reference.getSource();						if (content != null) {							int packageKeyWordIndex = content.lastIndexOf("package"); //$NON-NLS-1$							if (packageKeyWordIndex != -1) {								offset= range.getOffset() + content.indexOf(name, packageKeyWordIndex + 7);								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) {			}		} else if (moveCursor) {			resetHighlightRange();			markInNavigationHistory();		}	}