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

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

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

origin: org.eclipse.platform/org.eclipse.debug.ui

@Override
public Control createControl(Composite parent) {
  fTextViewer = new TextViewer(parent, SWT.READ_ONLY);
  fTextViewer.setDocument(new Document());
  StyledText styleText = fTextViewer.getTextWidget();
  styleText.setText("\r\n\r\n" + DebugUIMessages.EmptyViewTab_Unable_to_create + "\n" + getRenderingName() + "\n\n" + DebugUIMessages.ErrorRendering_0 + fException.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
  return fTextViewer.getControl();
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

  /**
   * Selects all in the viewer.
   */
  @Override
  public void run() {
    fTextViewer.doOperation(ITextOperationTarget.SELECT_ALL);
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * Returns whether the marked region of this viewer is empty.
 *
 * @return <code>true</code> if the marked region of this viewer is empty, otherwise <code>false</code>
 * @since 2.0
 */
private boolean isMarkedRegionEmpty() {
  return
    fTextWidget == null ||
    fMarkPosition == null ||
    fMarkPosition.isDeleted() ||
    modelRange2WidgetRange(fMarkPosition) == null;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

@Override
public void refresh() {
  setDocument(getDocument());
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

  @Override
  public void widgetDisposed(DisposeEvent e) {
    fDisposedControl= getControl();
    handleDispose();
  }
}
origin: org.eclipse.platform/org.eclipse.jface.text

@Override
public void setTopIndex(int index) {
  if (fTextWidget != null) {
    int widgetLine= modelLine2WidgetLine(index);
    if (widgetLine == -1)
      widgetLine= getClosestWidgetLineForModelLine(index);
    if (widgetLine > -1) {
      fTextWidget.setTopIndex(widgetLine);
        updateViewportListeners(INTERNAL);
    }
  }
}
origin: org.eclipse/org.eclipse.jdt.debug.ui

fTextViewer= new TextViewer(parent, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
fTextViewer.setDocument(new Document());
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.widthHint= 300;
gridData.heightHint= 150;
fTextViewer.getTextWidget().setLayoutData(gridData);
try {
  String valueString = fVariable.getValue().getValueString();
  fTextViewer.getDocument().set(valueString);
  fTextViewer.setSelectedRange(0, valueString.length());
} catch (DebugException e) {
  JDIDebugUIPlugin.log(e);
fTextViewer.getControl().setFocus();
fWrapText= new Button(parent, SWT.CHECK);
fWrapText.setText(ActionMessages.StringValueInputDialog_4); 
origin: org.eclipse.platform/org.eclipse.jface.text

@Override
public void setSelection(ISelection selection, boolean reveal) {
  if (selection instanceof IBlockTextSelection && getTextWidget().getBlockSelection()) {
    IBlockTextSelection s= (IBlockTextSelection) selection;
      int startOffset= modelRange2ClosestWidgetRange(startRegion).getOffset();
      IRegion endRegion= new Region(endLineInfo.getOffset() + s.getEndColumn() - endVirtuals, 0);
      int endOffset= modelRange2ClosestWidgetRange(endRegion).getOffset();
      Point clientAreaOrigin= new Point(fTextWidget.getHorizontalPixel(), fTextWidget.getTopPixel());
      Point startLocation= Geometry.add(clientAreaOrigin, fTextWidget.getLocationAtOffset(startOffset));
      int averageCharWidth= getAverageCharWidth();
      startLocation.x += startVirtuals * averageCharWidth;
      Point endLocation= Geometry.add(clientAreaOrigin, fTextWidget.getLocationAtOffset(endOffset));
      validateSelectionRange(widgetSelection);
      if (widgetSelection[0] >= 0) {
        fTextWidget.setBlockSelectionBounds(Geometry.createRectangle(startLocation, Geometry.subtract(endLocation, startLocation)));
        selectionChanged(startOffset, widgetLength);
      setSelectedRange(s.getOffset(), s.getLength());
      revealRange(s.getOffset(), s.getLength());
  } else if (selection instanceof ITextSelection) {
    ITextSelection s= (ITextSelection) selection;
    setSelectedRange(s.getOffset(), s.getLength());
    if (reveal)
      revealRange(s.getOffset(), s.getLength());
origin: org.eclipse.platform/org.eclipse.compare

private void doFocusChanged(Widget control) {
  for (int i= 0; i < fViewers.length; i++) {
    if (fViewers[i].getTextWidget() == control) {
      propagateFocusChanged(fViewers[i]);
      return;
    }
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

fUpdaterDocument.addPositionUpdater(fUpdater);
ISelection selection= TextViewer.this.getSelection();
if (selection instanceof IBlockTextSelection) {
  IBlockTextSelection bts= (IBlockTextSelection) selection;
  int caretOffset= fTextWidget.getCaretOffset();
  fReverseSelection= caretOffset == range.x;
  Point selectionRange= getSelectedRange();
  fSelection= new Position(selectionRange.x, selectionRange.y);
int stableWidgetLine= modelLine2WidgetLine(stableLine);
fStablePixel= getTextWidget().getLinePixel(stableWidgetLine);
IRegion stableLineInfo= fUpdaterDocument.getLineInformation(stableLine);
fStableLine= new Position(stableLineInfo.getOffset(), stableLineInfo.getLength());
origin: org.eclipse.platform/org.eclipse.debug.ui

/**
 * Create the error page of this rendering
 *
 * @param parent the parent to add the page to
 */
private void createMessagePage(Composite parent) {
  if (fTextViewer == null) {
    fTextViewer = new TextViewer(parent, SWT.WRAP);
    fTextViewer.setDocument(new Document());
    StyledText styleText = fTextViewer.getTextWidget();
    styleText.setEditable(false);
    styleText.setEnabled(false);
  }
}
origin: org.eclipse.platform/org.eclipse.debug.ui

/**
 * Displays an error message for the given exception.
 *
 * @param e exception to display
 */
public void displayError(DebugException e)
{
  StyledText styleText = null;
  fIsShowingErrorPage = true;
  styleText = fTextViewer.getTextWidget();
  if (styleText != null) {
    styleText.setText(DebugUIMessages.AbstractTableRendering_3 + e.getMessage());
  }
  fPageBook.showPage(fTextViewer.getControl());
  // clear content cache if we need to display error
  fContentProvider.clearContentCache();
}
origin: org.eclipse.platform/org.eclipse.jface.text

  int endLine= document.getLineOfOffset(selectionEnd);
  int endLineOffset= document.getLineOffset(endLine);
  int tabs= getTextWidget().getTabs();
  int startColumn= fSelection.getOffset() - startLineOffset + cp.fStartColumn;
  int endColumn= selectionEnd - endLineOffset + cp.fEndColumn;
  setSelection(new BlockTextSelection(document, startLine, startColumn, endLine, endColumn, tabs));
} catch (BadLocationException e) {
  setSelectedRange(cp.getOffset(), cp.getLength());
  length= -length;
setSelectedRange(offset, length);
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

int widgetOffset= (startPosition == -1 ? startPosition : modelOffset2WidgetOffset(startPosition));
FindReplaceDocumentAdapter adapter= getFindReplaceDocumentAdapter();
IRegion matchRegion= adapter.find(widgetOffset, findString, forwardSearch, caseSensitive, wholeWord, regExSearch);
if (matchRegion != null) {
  char endChar= adapter.charAt(widgetPos+length-1);
  boolean borderHasLineDelimiter= startChar == '\n' || startChar == '\r' || endChar == '\n' || endChar == '\r';
  boolean redraws= redraws();
  if (borderHasLineDelimiter && redraws)
    setRedraw(false);
  if (redraws()) {
    fTextWidget.setSelectionRange(widgetPos, length);
    internalRevealRange(widgetPos, widgetPos + length);
    selectionChanged(widgetPos, length);
  } else {
    setSelectedRange(widgetOffset2ModelOffset(widgetPos), length);
    if (redraws)
      setRedraw(true);
  return widgetOffset2ModelOffset(widgetPos);
origin: org.eclipse.platform/org.eclipse.jface.text

fTextWidget= createTextWidget(parent, styles);
    fTextWidget.setTopIndex(bottomIndex);
  updateViewportListeners(INTERNAL);
});
      fDisposedControl= getControl();
      handleDispose();
fCursorListener.install();
initializeViewportUpdate();
origin: org.eclipse.platform/org.eclipse.jface.text

@Override
public void setInput(Object input) {
  IDocument document= null;
  if (input instanceof IDocument)
    document= (IDocument) input;
  setDocument(document);
}
origin: org.eclipse.platform/org.eclipse.jface.text

@Override
public Control getControl() {
  if (fComposite != null)
    return fComposite;
  return super.getControl();
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private void beginChange() {
  ITextViewer viewer= fViewer;
  if (viewer instanceof TextViewer) {
    TextViewer v= (TextViewer) viewer;
    v.getRewriteTarget().beginCompoundChange();
  }
}
origin: org.eclipse.platform/org.eclipse.jface.text

  @Override
  public void dispose() {
    if (fTextViewer != null) {
      fTextViewer.removeViewportListener(fViewportListener);
      fViewportListener= null;

      StyledText st= fTextViewer.getTextWidget();
      if (st != null && !st.isDisposed())
        st.removeMouseMoveListener(fMouseMoveListener);
      fMouseMoveListener= null;
    }
    super.dispose();
  }
}
origin: anb0s/LogViewer

public ISelection getSelection() {
  return txtViewer.getSelection();
}
org.eclipse.jface.textTextViewer

Javadoc

SWT based implementation of ITextViewer and its extension interfaces. Once the viewer and its SWT control have been created the viewer can only indirectly be disposed by disposing its SWT control.

Clients are supposed to instantiate a text viewer and subsequently to communicate with it exclusively using the org.eclipse.jface.text.ITextViewer interface or any of the implemented extension interfaces.

A text viewer serves as text operation target. It only partially supports the external control of the enable state of its text operations. A text viewer is also a widget token owner. Anything that wants to display an overlay window on top of a text viewer should implement the org.eclipse.jface.text.IWidgetTokenKeeper interface and participate in the widget token negotiation between the text viewer and all its potential widget token keepers.

This class is not intended to be subclassed outside the JFace Text component.

Most used methods

  • 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

  • Making http post requests using okhttp
  • startActivity (Activity)
  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • String (java.lang)
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Best plugins for Eclipse
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