Tabnine Logo
TextViewer.redraws
Code IndexAdd Tabnine to your IDE (free)

How to use
redraws
method
in
org.eclipse.jface.text.TextViewer

Best Java code snippets using org.eclipse.jface.text.TextViewer.redraws (Showing top 20 results out of 315)

origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

@Override
public Point getSelectedRange() {
  if (!redraws() && fViewerState != null)
    return fViewerState.getSelection();
  if (fTextWidget != null) {
    Point p= fTextWidget.getSelectionRange();
    p= widgetSelection2ModelSelection(p);
    if (p != null)
      return p;
  }
  return new Point(-1, -1);
}
origin: org.eclipse.platform/org.eclipse.jface.text

@Override
public Point getSelectedRange() {
  if (!redraws() && fViewerState != null)
    return fViewerState.getSelection();
  if (fTextWidget != null) {
    Point p= fTextWidget.getSelectionRange();
    p= widgetSelection2ModelSelection(p);
    if (p != null)
      return p;
  }
  return new Point(-1, -1);
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * Checks whether the view port changed and if so informs all registered
 * listeners about the change.
 *
 * @param origin describes under which circumstances this method has been called.
 *
 * @see IViewportListener
 */
protected void updateViewportListeners(int origin) {
  if (redraws()) {
    int topPixel= fTextWidget.getTopPixel();
    if (topPixel >= 0 && topPixel != fLastTopPixel) {
      if (fViewportListeners != null) {
        for (int i= 0; i < fViewportListeners.size(); i++) {
          IViewportListener l= fViewportListeners.get(i);
          l.viewportChanged(topPixel);
        }
      }
      fLastTopPixel= topPixel;
    }
  }
}
origin: org.eclipse.platform/org.eclipse.jface.text

/**
 * Checks whether the view port changed and if so informs all registered
 * listeners about the change.
 *
 * @param origin describes under which circumstances this method has been called.
 *
 * @see IViewportListener
 */
protected void updateViewportListeners(int origin) {
  if (redraws()) {
    int topPixel= fTextWidget.getTopPixel();
    if (topPixel >= 0 && topPixel != fLastTopPixel) {
      if (fViewportListeners != null) {
        for (int i= 0; i < fViewportListeners.size(); i++) {
          IViewportListener l= fViewportListeners.get(i);
          l.viewportChanged(topPixel);
        }
      }
      fLastTopPixel= topPixel;
    }
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * Informs all registered text listeners about the change specified by the
 * widget command. This method does not use a robust iterator.
 *
 * @param cmd the widget command translated into a text event sent to all text listeners
 */
protected void updateTextListeners(WidgetCommand cmd) {
  List<ITextListener> textListeners= fTextListeners;
  if (textListeners != null) {
    textListeners= new ArrayList<>(textListeners);
    DocumentEvent event= cmd.event;
    if (event instanceof SlaveDocumentEvent)
      event= ((SlaveDocumentEvent) event).getMasterEvent();
    TextEvent e= new TextEvent(cmd.start, cmd.length, cmd.text, cmd.preservedText, event, redraws());
    for (int i= 0; i < textListeners.size(); i++) {
      ITextListener l= textListeners.get(i);
      l.textChanged(e);
    }
  }
}
origin: org.eclipse.platform/org.eclipse.jface.text

/**
 * Informs all registered text listeners about the change specified by the
 * widget command. This method does not use a robust iterator.
 *
 * @param cmd the widget command translated into a text event sent to all text listeners
 */
protected void updateTextListeners(WidgetCommand cmd) {
  List<ITextListener> textListeners= fTextListeners;
  if (textListeners != null) {
    textListeners= new ArrayList<>(textListeners);
    DocumentEvent event= cmd.event;
    if (event instanceof SlaveDocumentEvent)
      event= ((SlaveDocumentEvent) event).getMasterEvent();
    TextEvent e= new TextEvent(cmd.start, cmd.length, cmd.text, cmd.preservedText, event, redraws());
    for (int i= 0; i < textListeners.size(); i++) {
      ITextListener l= textListeners.get(i);
      l.textChanged(e);
    }
  }
}
origin: org.eclipse.platform/org.eclipse.jface.text

@Override
public void changeTextPresentation(TextPresentation presentation, boolean controlRedraw) {
  if (presentation == null || !redraws())
    return;
  if (fTextWidget == null)
    return;
  /*
   * Call registered text presentation listeners
   * and let them apply their presentation.
   */
  if (fTextPresentationListeners != null) {
    ArrayList<ITextPresentationListener> listeners= new ArrayList<>(fTextPresentationListeners);
    for (int i= 0, size= listeners.size(); i < size; i++) {
      ITextPresentationListener listener= listeners.get(i);
      listener.applyTextPresentation(presentation);
    }
  }
  if (presentation.isEmpty())
    return;
  if (controlRedraw)
    fTextWidget.setRedraw(false);
  if (fReplaceTextPresentation)
    applyTextPresentation(presentation);
  else
    addPresentation(presentation);
  if (controlRedraw)
    fTextWidget.setRedraw(true);
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

@Override
public void changeTextPresentation(TextPresentation presentation, boolean controlRedraw) {
  if (presentation == null || !redraws())
    return;
  if (fTextWidget == null)
    return;
  /*
   * Call registered text presentation listeners
   * and let them apply their presentation.
   */
  if (fTextPresentationListeners != null) {
    ArrayList<ITextPresentationListener> listeners= new ArrayList<>(fTextPresentationListeners);
    for (int i= 0, size= listeners.size(); i < size; i++) {
      ITextPresentationListener listener= listeners.get(i);
      listener.applyTextPresentation(presentation);
    }
  }
  if (presentation.isEmpty())
    return;
  if (controlRedraw)
    fTextWidget.setRedraw(false);
  if (fReplaceTextPresentation)
    applyTextPresentation(presentation);
  else
    addPresentation(presentation);
  if (controlRedraw)
    fTextWidget.setRedraw(true);
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * Sends out a text selection changed event to all registered 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 fireSelectionChanged(int offset, int length) {
  if (redraws()) {
    if (length < 0) {
      length= -length;
      offset= offset + length;
    }
    IRegion r= widgetRange2ModelRange(new Region(offset, length));
    if ((r != null && !r.equals(fLastSentSelectionChange)) || r == null)  {
      fLastSentSelectionChange= r;
      ISelection selection= r != null ? new TextSelection(getDocument(), r.getOffset(), r.getLength()) : TextSelection.emptySelection();
      SelectionChangedEvent event= new SelectionChangedEvent(this, selection);
      fireSelectionChanged(event);
    }
  }
}
origin: org.eclipse.platform/org.eclipse.jface.text

/**
 * Sends out a text selection changed event to all registered 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 fireSelectionChanged(int offset, int length) {
  if (redraws()) {
    if (length < 0) {
      length= -length;
      offset= offset + length;
    }
    IRegion r= widgetRange2ModelRange(new Region(offset, length));
    if ((r != null && !r.equals(fLastSentSelectionChange)) || r == null)  {
      fLastSentSelectionChange= r;
      ISelection selection= r != null ? new TextSelection(getDocument(), r.getOffset(), r.getLength()) : TextSelection.emptySelection();
      SelectionChangedEvent event= new SelectionChangedEvent(this, selection);
      fireSelectionChanged(event);
    }
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * Sends out a mark selection changed event to all registered listeners.
 *
 * @param offset the offset of the mark selection in the visible document, the offset is <code>-1</code> if the mark was cleared
 * @param length the length of the mark selection, may be negative if the caret is before the mark.
 * @since 2.0
 */
protected void markChanged(int offset, int length) {
  if (redraws()) {
    if (offset != -1) {
      IRegion r= widgetRange2ModelRange(new Region(offset, length));
      offset= r.getOffset();
      length= r.getLength();
    }
    ISelection selection= new MarkSelection(getDocument(), offset, length);
    SelectionChangedEvent event= new SelectionChangedEvent(this, selection);
    fireSelectionChanged(event);
  }
}
origin: org.eclipse.platform/org.eclipse.jface.text

@Override
public void setSelectedRange(int selectionOffset, int selectionLength) {
  if (!redraws()) {
    if (fViewerState != null)
      fViewerState.updateSelection(selectionOffset, selectionLength);
    return;
  }
  if (fTextWidget == null)
    return;
  IRegion widgetSelection= modelRange2ClosestWidgetRange(new Region(selectionOffset, selectionLength));
  if (widgetSelection != null) {
    int[] selectionRange= new int[] { widgetSelection.getOffset(), widgetSelection.getLength() };
    validateSelectionRange(selectionRange);
    if (selectionRange[0] >= 0) {
      fTextWidget.setSelectionRange(selectionRange[0], selectionRange[1]);
      selectionChanged(selectionRange[0], selectionRange[1]);
    }
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

@Override
public void setSelectedRange(int selectionOffset, int selectionLength) {
  if (!redraws()) {
    if (fViewerState != null)
      fViewerState.updateSelection(selectionOffset, selectionLength);
    return;
  }
  if (fTextWidget == null)
    return;
  IRegion widgetSelection= modelRange2ClosestWidgetRange(new Region(selectionOffset, selectionLength));
  if (widgetSelection != null) {
    int[] selectionRange= new int[] { widgetSelection.getOffset(), widgetSelection.getLength() };
    validateSelectionRange(selectionRange);
    if (selectionRange[0] >= 0) {
      fTextWidget.setSelectionRange(selectionRange[0], selectionRange[1]);
      selectionChanged(selectionRange[0], selectionRange[1]);
    }
  }
}
origin: org.eclipse.platform/org.eclipse.jface.text

/**
 * 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);
  }
}
origin: org.eclipse.platform/org.eclipse.jface.text

/**
 * Sends out a mark selection changed event to all registered listeners.
 *
 * @param offset the offset of the mark selection in the visible document, the offset is <code>-1</code> if the mark was cleared
 * @param length the length of the mark selection, may be negative if the caret is before the mark.
 * @since 2.0
 */
protected void markChanged(int offset, int length) {
  if (redraws()) {
    if (offset != -1) {
      IRegion r= widgetRange2ModelRange(new Region(offset, length));
      offset= r.getOffset();
      length= r.getLength();
    }
    ISelection selection= new MarkSelection(getDocument(), offset, length);
    SelectionChangedEvent event= new SelectionChangedEvent(this, selection);
    fireSelectionChanged(event);
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * 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);
  }
}
origin: org.eclipse.platform/org.eclipse.jface.text

@Override
public void revealRange(int start, int length) {
  if (fTextWidget == null || !redraws())
    return;
  IRegion modelRange= new Region(start, length);
  IRegion widgetRange= modelRange2ClosestWidgetRange(modelRange);
  if (widgetRange != null) {
    int[] range= new int[] { widgetRange.getOffset(), widgetRange.getLength() };
    validateSelectionRange(range);
    if (range[0] >= 0)
      internalRevealRangeWithWorkaround(range[0], range[0] + range[1]);
  } else {
    IRegion coverage= getModelCoverage();
    int cursor= (coverage == null || start < coverage.getOffset()) ? 0 : getVisibleDocument().getLength();
    internalRevealRangeWithWorkaround(cursor, cursor);
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

@Override
public void revealRange(int start, int length) {
  if (fTextWidget == null || !redraws())
    return;
  IRegion modelRange= new Region(start, length);
  IRegion widgetRange= modelRange2ClosestWidgetRange(modelRange);
  if (widgetRange != null) {
    int[] range= new int[] { widgetRange.getOffset(), widgetRange.getLength() };
    validateSelectionRange(range);
    if (range[0] >= 0)
      internalRevealRangeWithWorkaround(range[0], range[0] + range[1]);
  } else {
    IRegion coverage= getModelCoverage();
    int cursor= (coverage == null || start < coverage.getOffset()) ? 0 : getVisibleDocument().getLength();
    internalRevealRangeWithWorkaround(cursor, cursor);
  }
}
origin: org.eclipse.platform/org.eclipse.jface.text

@Override
public boolean canDoOperation(int operation) {
  if (fTextWidget == null || !redraws())
    return false;
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

@Override
public boolean canDoOperation(int operation) {
  if (fTextWidget == null || !redraws())
    return false;
org.eclipse.jface.textTextViewerredraws

Javadoc

Returns whether this viewer redraws itself.

Popular methods of TextViewer

  • getTextWidget
  • getControl
  • doOperation
  • setDocument
  • modelRange2WidgetRange
    Same as #modelRange2WidgetRange(IRegion) just for a org.eclipse.jface.text.Position.
  • getRewriteTarget
  • getSelection
  • modelLine2WidgetLine
    Implements the contract of ITextViewerExtension5#modelLine2WidgetLine(int).
  • getDocument
  • setSelectedRange
  • setSelection
  • <init>
    Create a new text viewer with the given SWT style bits. The viewer is ready to use but does not have
  • setSelection,
  • <init>,
  • canDoOperation,
  • getVisibleRegion,
  • handleDispose,
  • invalidateTextPresentation,
  • setTopIndex,
  • _getVisibleRegionOffset,
  • activatePlugins,
  • addPresentation

Popular in Java

  • Reactive rest calls using spring rest template
  • addToBackStack (FragmentTransaction)
  • setContentView (Activity)
  • setScale (BigDecimal)
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Notification (javax.management)
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now