private boolean isMasked(int offset) { IDocument document= getSourceViewer().getDocument(); try { return fEscapeCharacter == document.getChar(offset - 1); } catch (BadLocationException e) { } return false; } }
private boolean isMasked(int offset) { IDocument document= getSourceViewer().getDocument(); try { return fEscapeCharacter == document.getChar(offset - 1); } catch (BadLocationException e) { } return false; } }
private boolean isMasked(int offset) { IDocument document= getSourceViewer().getDocument(); try { return fEscapeCharacter == document.getChar(offset - 1); } catch (BadLocationException e) { } return false; } }
public void setSourceViewer(ISourceViewer sourceViewer) { this.sourceViewer = sourceViewer; IDocument document = sourceViewer.getDocument(); xtextDocument = XtextDocumentUtil.get(document); Assert.isNotNull(xtextDocument); configureTextInputListener(); }
public void run() { try { getSourceViewer().getDocument().replace(fSnippetEnd, 0, message); selectAndReveal(fSnippetEnd, message.length()); } catch (BadLocationException e) { } } };
public void run() { try { getSourceViewer().getDocument().replace(fSnippetStart, 0, errorString.toString()); selectAndReveal(fSnippetStart, errorString.length()); } catch (BadLocationException e) { } } };
@Override public ILineRange getHoverLineRange(ISourceViewer viewer, int lineNumber) { IDocument document= viewer.getDocument(); if (document != null) { Point range= computeLineRange(viewer, lineNumber, 0, Math.max(0, document.getNumberOfLines() - 1)); if (range.x != -1 && range.y != -1) return new LineRange(range.x, range.y - range.x + 1); } return null; }
@Override public ILineRange getHoverLineRange(ISourceViewer viewer, int lineNumber) { IDocument document= viewer.getDocument(); if (document != null) { Point range= computeLineRange(viewer, lineNumber, 0, Math.max(0, document.getNumberOfLines() - 1)); if (range.x != -1 && range.y != -1) return new LineRange(range.x, range.y - range.x + 1); } return null; }
private void restorePosition() { if (storedPosition != null && !storedPosition.isDeleted() && viewer.getDocument() != null) { viewer.setSelectedRange(storedPosition.offset, storedPosition.length); viewer.revealRange(storedPosition.offset, storedPosition.length); } storedPosition = null; }
public void install() { ISourceViewer sourceViewer= getSourceViewer(); if (sourceViewer == null) return; StyledText text= sourceViewer.getTextWidget(); if (text == null || text.isDisposed()) return; sourceViewer.addTextInputListener(this); IDocument document= sourceViewer.getDocument(); if (document != null) document.addDocumentListener(this); }
public void install() { ISourceViewer sourceViewer= getSourceViewer(); if (sourceViewer == null) return; StyledText text= sourceViewer.getTextWidget(); if (text == null || text.isDisposed()) return; sourceViewer.addTextInputListener(this); IDocument document= sourceViewer.getDocument(); if (document != null) document.addDocumentListener(this); }
protected List<IMarker> getMarkersFor(ISourceViewer sourceViewer, int offset) throws BadLocationException { final IDocument document = sourceViewer.getDocument(); int line = document.getLineOfOffset(offset); int lineOffset = document.getLineOffset(line); String delim = document.getLineDelimiter(line); int delimLength = delim != null ? delim.length() : 0; int lineLength = document.getLineLength(line) - delimLength; return getMarkersFor(sourceViewer, lineOffset, lineLength); }
public void install() { ISourceViewer sourceViewer = getSourceViewer(); if (sourceViewer == null) return; StyledText text = sourceViewer.getTextWidget(); if (text == null || text.isDisposed()) return; sourceViewer.addTextInputListener(this); IDocument document = sourceViewer.getDocument(); if (document != null) document.addDocumentListener(this); }
public void install() { ISourceViewer sourceViewer= getSourceViewer(); if (sourceViewer == null) return; StyledText text= sourceViewer.getTextWidget(); if (text == null || text.isDisposed()) return; sourceViewer.addTextInputListener(this); IDocument document= sourceViewer.getDocument(); if (document != null) document.addDocumentListener(this); }
void install() { fViewer.addViewportListener(this); fViewer.getDocument().addDocumentListener(this); fViewer.getTextWidget().addControlListener(this); } }
public void perform(AbstractDocumentCommand command) throws CoreException { disableReveal = true; try { command.execute(((ITextViewerExtension6) getViewer()).getUndoManager(), getViewer().getDocument()); } finally { disableReveal = false; } updateOutlineSelection(); }
/** * Converts a given character region into a line range. * * @param region the character region * @return the corresponding line range * @throws BadLocationException in case the given region in invalid */ private ILineRange convertToLineRange(IRegion region) throws BadLocationException { IDocument document= fSourceViewer.getDocument(); int startLine= document.getLineOfOffset(region.getOffset()); int endLine= document.getLineOfOffset(region.getOffset() + region.getLength()); return new LineRange(startLine, endLine - startLine + 1); }
protected void codeComplete(CompletionRequestor requestor) throws JavaModelException { ITextSelection selection= (ITextSelection)getSelectionProvider().getSelection(); int start= selection.getOffset(); String snippet= getSourceViewer().getDocument().get(); IEvaluationContext e= getEvaluationContext(); if (e != null) { e.codeComplete(snippet, start, requestor); } }
private PropertiesAssistContext createAssistContext(IQuickAssistInvocationContext invocationContext) { IEditorPart editorPart= fAssistant.getEditor(); IFile file= editorPart.getEditorInput().getAdapter(IFile.class); ISourceViewer sourceViewer= invocationContext.getSourceViewer(); IType accessorType= ((PropertiesFileEditor) editorPart).getAccessorType(); return new PropertiesAssistContext(sourceViewer, invocationContext.getOffset(), invocationContext.getLength(), file, sourceViewer.getDocument(), accessorType); } }
private PropertiesAssistContext createAssistContext(IQuickAssistInvocationContext invocationContext) { IEditorPart editorPart= fAssistant.getEditor(); IFile file= editorPart.getEditorInput().getAdapter(IFile.class); ISourceViewer sourceViewer= invocationContext.getSourceViewer(); IType accessorType= ((PropertiesFileEditor) editorPart).getAccessorType(); return new PropertiesAssistContext(sourceViewer, invocationContext.getOffset(), invocationContext.getLength(), file, sourceViewer.getDocument(), accessorType); } }