@Override public IDocument getDocument() { return TextViewer.this.getDocument(); }
@Override public Object getInput() { return getDocument(); }
@Override public IDocument getDocument() { return TextViewer.this.getDocument(); }
@Override public Object getInput() { return getDocument(); }
/** * Creates a new viewer state instance and connects it to the current document. */ public ViewerState() { IDocument document= getDocument(); if (document != null) connect(document); }
@Override public void refresh() { setDocument(getDocument()); }
/** * Creates a new viewer state instance and connects it to the current document. */ public ViewerState() { IDocument document= getDocument(); if (document != null) connect(document); }
@Override public void refresh() { setDocument(getDocument()); }
/** * Sets the sequential rewrite mode of the viewer's document. * * @since 2.0 * @deprecated since 3.1 use {@link IDocumentExtension4#stopRewriteSession(DocumentRewriteSession)} instead */ @Deprecated protected final void stopSequentialRewriteMode() { IDocument document= getDocument(); if (document instanceof IDocumentExtension) { IDocumentExtension extension= (IDocumentExtension) document; extension.stopSequentialRewrite(); } }
/** * Sets the sequential rewrite mode of the viewer's document. * * @since 2.0 * @deprecated since 3.1 use {@link IDocumentExtension4#stopRewriteSession(DocumentRewriteSession)} instead */ @Deprecated protected final void stopSequentialRewriteMode() { IDocument document= getDocument(); if (document instanceof IDocumentExtension) { IDocumentExtension extension= (IDocumentExtension) document; extension.stopSequentialRewrite(); } }
/** * Starts the sequential rewrite mode of the viewer's document. * * @param normalized <code>true</code> if the rewrite is performed from the start to the end of the document * @since 2.0 * @deprecated since 3.1 use {@link IDocumentExtension4#startRewriteSession(DocumentRewriteSessionType)} instead */ @Deprecated protected final void startSequentialRewriteMode(boolean normalized) { IDocument document= getDocument(); if (document instanceof IDocumentExtension) { IDocumentExtension extension= (IDocumentExtension) document; extension.startSequentialRewrite(normalized); } }
/** * Override superclass method to return text from the simple text * viewer if appropriate. * @see ExpressionInputDialog#getText() */ protected String getText() { if (fTextButton.getSelection()) { return fTextViewer.getDocument().get(); } return super.getText(); }
@Override public void setTextColor(Color color) { if (color != null) setTextColor(color, 0, getDocument().getLength(), true); }
@Override public String getSelectionText() { Point s= TextViewer.this.getSelectedRange(); if (s.x > -1 && s.y > -1) { try { IDocument document= TextViewer.this.getDocument(); return document.get(s.x, s.y); } catch (BadLocationException x) { } } return ""; //$NON-NLS-1$ }
@Override public void setTextColor(Color color) { if (color != null) setTextColor(color, 0, getDocument().getLength(), true); }
@Override public String getSelectionText() { Point s= TextViewer.this.getSelectedRange(); if (s.x > -1 && s.y > -1) { try { IDocument document= TextViewer.this.getDocument(); return document.get(s.x, s.y); } catch (BadLocationException x) { } } return ""; //$NON-NLS-1$ }
/** * Resets the visible region for all text viewers of this selection provider. * * @since 3.6 */ private void resetVisibleRegion() { if (fViewers == null) return; for (int i= 0; i < fViewers.length; i++) fViewers[i].setVisibleRegion(0, fViewers[i].getDocument().getLength()); }
/** * Implements the contract of {@link ITextViewerExtension5#getModelCoverage()}. * * @return the model coverage * @since 2.1 */ public IRegion getModelCoverage() { if (fInformationMapping == null) { IDocument document= getDocument(); if (document == null) return null; return new Region(0, document.getLength()); } return fInformationMapping.getCoverage(); }
/** * Sends out a text selection changed event to all registered post selection changed listeners. * * @param offset the offset of the newly selected range in the visible document * @param length the length of the newly selected range in the visible document * @since 3.0 */ protected void firePostSelectionChanged(int offset, int length) { if (redraws()) { IRegion r= widgetRange2ModelRange(new Region(offset, length)); ISelection selection= r != null ? new TextSelection(getDocument(), r.getOffset(), r.getLength()) : TextSelection.emptySelection(); SelectionChangedEvent event= new SelectionChangedEvent(this, selection); firePostSelectionChanged(event); } }
/** * Sends out a text selection changed event to all registered post selection changed listeners. * * @param offset the offset of the newly selected range in the visible document * @param length the length of the newly selected range in the visible document * @since 3.0 */ protected void firePostSelectionChanged(int offset, int length) { if (redraws()) { IRegion r= widgetRange2ModelRange(new Region(offset, length)); ISelection selection= r != null ? new TextSelection(getDocument(), r.getOffset(), r.getLength()) : TextSelection.emptySelection(); SelectionChangedEvent event= new SelectionChangedEvent(this, selection); firePostSelectionChanged(event); } }