/** * Returns the {@link StyledText} widget where the annotation must be drawn. * * @return the {@link StyledText} widget where the annotation must be drawn. */ public StyledText getTextWidget() { return fViewer.getTextWidget(); }
/** * Creates a new next sub-word action. * * @param code Action code for the default operation. Must be an action code from @see org.eclipse.swt.custom.ST. */ protected NextSubWordAction(int code) { super(getSourceViewer().getTextWidget(), code); }
/** * Creates a new previous sub-word action. * * @param code Action code for the default operation. Must be an action code from @see org.eclipse.swt.custom.ST. */ protected PreviousSubWordAction(final int code) { super(getSourceViewer().getTextWidget(), code); }
/** * Creates a new previous sub-word action. * * @param code Action code for the default operation. Must be an action code from @see org.eclipse.swt.custom.ST. */ protected PreviousSubWordAction(final int code) { super(getSourceViewer().getTextWidget(), code); }
/** * Creates a new previous sub-word action. * * @param code Action code for the default operation. Must be an action code from @see org.eclipse.swt.custom.ST. */ protected PreviousSubWordAction(final int code) { super(getSourceViewer().getTextWidget(), code); }
@Override public void setFocus() { if (fSourceViewer != null && fSourceViewer.getTextWidget() != null) fSourceViewer.getTextWidget().setFocus(); }
private void toggleOverwriteMode() { if (fIsOverwriteModeEnabled) { fIsOverwriting= !fIsOverwriting; fSourceViewer.getTextWidget().invokeAction(ST.TOGGLE_OVERWRITE); handleInsertModeChanged(); } }
@Override public void run() { fJavaEditor.getViewer().getTextWidget().setFocus(); } }
/** * Returns the number of the currently visible lines. * * @return the number of the currently visible lines */ private int computeNumberOfVisibleLines() { StyledText textWidget= fSourceViewer.getTextWidget(); int lineHeight= textWidget.getLineHeight(); int clientAreaHeight= textWidget.getClientArea().height; return clientAreaHeight / lineHeight; }
@Override public Object getHoverInfo(ISourceViewer sourceViewer, ILineRange lineRange, int visibleLines) { fLastScrollIndex= sourceViewer.getTextWidget().getHorizontalPixel(); return super.getHoverInfo(sourceViewer, lineRange, visibleLines); }
/** * Returns the caret position relative to the start of the text. * * @return the caret position relative to the start of the text */ public int getCaretOffset() { return getSourceViewer().getTextWidget().getCaretOffset(); }
private void toggleOverwriteMode() { if (fIsOverwriteModeEnabled) { fIsOverwriting= !fIsOverwriting; fSourceViewer.getTextWidget().invokeAction(ST.TOGGLE_OVERWRITE); handleInsertModeChanged(); } }
public void addVerifyListener(VerifyListener listener) { ISourceViewer sourceViewer = currentEditor.getInternalSourceViewer(); StyledText widget = sourceViewer.getTextWidget(); widget.addVerifyListener(listener); }
public VisibleLines() { install(); fViewer.getTextWidget().getDisplay().asyncExec(() -> { compute(); }); }
protected XtextEditor openEditor(String string) throws Exception { int cursor = string.indexOf('|'); String fileExtension = getFileExtension(); IFile file = createFile("foo/myfile" + files.size() + "." + fileExtension, string.replace("|", "")); files.add(file); XtextEditor editor = openEditor(file); editor.getInternalSourceViewer().setSelectedRange(cursor, 0); editor.getInternalSourceViewer().getTextWidget().setFocus(); return editor; }
protected void pressKey(XtextEditor editor, char c) throws Exception { StyledText textWidget = editor.getInternalSourceViewer().getTextWidget(); Event e = new Event(); e.character = c; e.type = SWT.KeyDown; e.doit = true; //XXX Hack! if (c == SWT.ESC) { e.keyCode = 27; } textWidget.notifyListeners(SWT.KeyDown, e); }
@Override protected Point computeMenuLocation(StyledText text) { if (fEditor == null || text != fEditor.getViewer().getTextWidget()) return super.computeMenuLocation(text); return computeWordStart(); }
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); }
@Override public void saveState(IMemento memento) { ISelection selection= doGetSelection(); if (selection instanceof ITextSelection) { memento.putInteger(TAG_SELECTION_OFFSET, ((ITextSelection)selection).getOffset()); memento.putInteger(TAG_SELECTION_LENGTH, ((ITextSelection)selection).getLength()); } final StyledText textWidget= fSourceViewer.getTextWidget(); memento.putInteger(TAG_SELECTION_TOP_PIXEL, textWidget.getTopPixel()); memento.putInteger(TAG_SELECTION_HORIZONTAL_PIXEL, textWidget.getHorizontalPixel()); }