@Override public IInformationControlCreator getHoverControlCreator() { if (fUpwardShiftInLines > 0) return createInformationControlCreator(false, fBracketHoverStatus, true); else return createInformationControlCreator(false, EditorsUI.getTooltipAffordanceString(), true); }
@Override @Deprecated public String getHoverInfo(ITextViewer textViewer, IRegion region) { IJavaElement[] result= getJavaElementsAt(textViewer, region); fUpwardShiftInLines= 0; fBracketHoverStatus= null; if (result == null || result.length == 0) { return getBracketHoverInfo(textViewer, region); } if (result.length > 1) return null; IJavaElement curr= result[0]; if ((curr instanceof IMember || curr instanceof ILocalVariable || curr instanceof ITypeParameter) && curr instanceof ISourceReference) { try { String source= ((ISourceReference) curr).getSource(); String[] sourceLines= getTrimmedSource(source, curr); if (sourceLines == null) return null; String delim= StubUtility.getLineDelimiterUsed(curr); source= Strings.concatenate(sourceLines, delim); return source; } catch (JavaModelException ex) { //do nothing } } return null; }
@Override public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) { String hoverInfoString= getHoverInfo(textViewer, hoverRegion); if (hoverInfoString == null) { return null; } if (fJavaElement == null) { return hoverInfoString; } return new JavaSourceInformationInput(fJavaElement, hoverInfoString); }
private String getBracketHoverInfo(final ITextViewer textViewer, IRegion region) { boolean isElsePart= false; IEditorPart editor= getEditor(); ITypeRoot editorInput= getEditorInputJavaElement(); if (!(editor instanceof JavaEditor) || editorInput == null) { return null; return getBracketHoverInfo((IfStatement) node, bracketNode, document, editorInput, delim); // see bug 377141, 410650 String[] sourceLines= getTrimmedSource(source, editorInput); if (sourceLines == null) return null;
public IInformationControl createInformationControl(Shell parent) { int style= SWT.V_SCROLL | SWT.H_SCROLL; int shellStyle= SWT.RESIZE | SWT.TOOL; IEditorPart editor= getEditor(); if (editor instanceof IWorkbenchPartOrientation) shellStyle |= ((IWorkbenchPartOrientation)editor).getOrientation(); return new SourceViewerInformationControl(parent, shellStyle, style); } };
int line3= line2; if (currentStatement != bracketNode && ifNode != null && ifNode.getElseStatement() != null) { int elseStartOffset= getNextElseOffset(ifNode.getThenStatement(), editorInput); if (elseStartOffset != -1) { int sourceLength= (endLine.getOffset() + endLine.getLength()) - sourceOffset; String source= document.get(sourceOffset, sourceLength); String[] sourceLines= getTrimmedSource(source, editorInput); if (sourceLines == null) return null; int nextStartOffset= getNextElseOffset(thenStatement, editorInput); if (nextStartOffset != -1) { nodeStart= nextStartOffset;
/** * Returns the trimmed source lines. * * @param source the source string, could be <code>null</code> * @param javaElement the java element * @return the trimmed source lines or <code>null</code> */ private String[] getTrimmedSource(String source, IJavaElement javaElement) { if (source == null) return null; source= removeLeadingComments(source); String[] sourceLines= Strings.convertIntoLines(source); Strings.trimIndentation(sourceLines, javaElement.getJavaProject()); return sourceLines; }
private String getBracketHoverInfo(final ITextViewer textViewer, IRegion region) { boolean isElsePart= false; IEditorPart editor= getEditor(); ITypeRoot editorInput= getEditorInputJavaElement(); if (!(editor instanceof JavaEditor) || editorInput == null) { return null; return getBracketHoverInfo((IfStatement) node, bracketNode, document, editorInput, delim); // see bug 377141, 201850 String[] sourceLines= getTrimmedSource(source, editorInput); if (sourceLines == null) return null;
@Override public IInformationControl createInformationControl(final Shell parent) { final IEditorPart editor= getEditor(); int orientation= SWT.NONE; if (editor instanceof IWorkbenchPartOrientation)
int line3= line2; if (currentStatement != bracketNode && ifNode != null && ifNode.getElseStatement() != null) { int elseStartOffset= getNextElseOffset(ifNode.getThenStatement(), editorInput); if (elseStartOffset != -1) { int sourceLength= (endLine.getOffset() + endLine.getLength()) - sourceOffset; String source= document.get(sourceOffset, sourceLength); String[] sourceLines= getTrimmedSource(source, editorInput); if (sourceLines == null) return null; int nextStartOffset= getNextElseOffset(thenStatement, editorInput); if (nextStartOffset != -1) { nodeStart= nextStartOffset;
/** * Returns the trimmed source lines. * * @param source the source string, could be <code>null</code> * @param javaElement the java element * @return the trimmed source lines or <code>null</code> */ private String[] getTrimmedSource(String source, IJavaElement javaElement) { if (source == null) return null; source= removeLeadingComments(source); String[] sourceLines= Strings.convertIntoLines(source); Strings.trimIndentation(sourceLines, javaElement.getJavaProject()); return sourceLines; }
@Override @Deprecated public String getHoverInfo(ITextViewer textViewer, IRegion region) { IJavaElement[] result= getJavaElementsAt(textViewer, region); fJavaElement= null; fUpwardShiftInLines= 0; fBracketHoverStatus= null; if (result == null || result.length == 0) { return getBracketHoverInfo(textViewer, region); } if (result.length > 1) return null; fJavaElement= result[0]; if ((fJavaElement instanceof IMember || fJavaElement instanceof ILocalVariable || fJavaElement instanceof ITypeParameter) && fJavaElement instanceof ISourceReference) { try { String source= ((ISourceReference) fJavaElement).getSource(); String[] sourceLines= getTrimmedSource(source, fJavaElement); if (sourceLines == null) return null; String delim= StubUtility.getLineDelimiterUsed(fJavaElement); source= Strings.concatenate(sourceLines, delim); return source; } catch (JavaModelException ex) { //do nothing } } return null; }
@Override public IInformationControl createInformationControl(final Shell parent) { final IEditorPart editor= getEditor(); int orientation= SWT.NONE; if (editor instanceof IWorkbenchPartOrientation)
protected String getHoverInfo(IJavaElement[] result) { int nResults= result.length; if (nResults > 1) return null; IJavaElement curr= result[0]; if ((curr instanceof IMember || curr instanceof ILocalVariable || curr instanceof ITypeParameter) && curr instanceof ISourceReference) { try { String source= ((ISourceReference) curr).getSource(); if (source == null) return null; source= removeLeadingComments(source); String delim= StubUtility.getLineDelimiterUsed(result[0]); String[] sourceLines= Strings.convertIntoLines(source); String firstLine= sourceLines[0]; if (!Character.isWhitespace(firstLine.charAt(0))) sourceLines[0]= ""; //$NON-NLS-1$ Strings.trimIndentation(sourceLines, curr.getJavaProject()); if (!Character.isWhitespace(firstLine.charAt(0))) sourceLines[0]= firstLine; source= Strings.concatenate(sourceLines, delim); return source; } catch (JavaModelException ex) { } } return null; }
@Override public IInformationControlCreator getHoverControlCreator() { if (fUpwardShiftInLines > 0) return createInformationControlCreator(false, fBracketHoverStatus, true); else return createInformationControlCreator(false, EditorsUI.getTooltipAffordanceString(), true); }
public IInformationControl createInformationControl(Shell parent) { IEditorPart editor= getEditor(); int shellStyle= SWT.TOOL | SWT.NO_TRIM; if (editor instanceof IWorkbenchPartOrientation) shellStyle |= ((IWorkbenchPartOrientation)editor).getOrientation(); return new SourceViewerInformationControl(parent, shellStyle, SWT.NONE, EditorsUI.getTooltipAffordanceString()); } };
@Override public IInformationControlCreator getInformationPresenterControlCreator() { if (fUpwardShiftInLines > 0) return createInformationControlCreator(false, fBracketHoverStatus, true); else return createInformationControlCreator(true, EditorsUI.getTooltipAffordanceString(), true); }
@Override public IInformationControlCreator getInformationPresenterControlCreator() { if (fUpwardShiftInLines > 0) return createInformationControlCreator(false, fBracketHoverStatus, true); else return createInformationControlCreator(true, EditorsUI.getTooltipAffordanceString(), true); }