/** * {@inheritDoc} */ public ISelection getSelection() { return new TextSelection(0, 0); }
@Override ISelection makeReplaceSelection(ISelection selection, String replacement) { ITextSelection ts= (ITextSelection)selection; return new TextSelection(fDocument, ts.getOffset() + replacement.length(), 0); } };
@Override ISelection makeReplaceSelection(ISelection selection, String replacement) { ITextSelection ts= (ITextSelection)selection; return new TextSelection(fDocument, ts.getOffset() + replacement.length(), 0); } };
@Override public void deleteLine(IDocument document, int offset, int length, int type, boolean copyToClipboard) throws BadLocationException { deleteLine(document, new TextSelection(offset, length), type, copyToClipboard); }
@Override public void deleteLine(IDocument document, int offset, int length, int type, boolean copyToClipboard) throws BadLocationException { deleteLine(document, new TextSelection(offset, length), type, copyToClipboard); }
@Override ISelection makeEmpty(ISelection selection, boolean beginning) { ITextSelection ts= (ITextSelection)selection; return beginning ? new TextSelection(fDocument, ts.getOffset(), 0) : new TextSelection(fDocument, ts.getOffset() + ts.getLength(), 0); }
@Override ISelection makeEmpty(ISelection selection, boolean beginning) { ITextSelection ts= (ITextSelection)selection; return beginning ? new TextSelection(fDocument, ts.getOffset(), 0) : new TextSelection(fDocument, ts.getOffset() + ts.getLength(), 0); }
public ISelection getSelection() { if (fControl instanceof StyledText) { IDocument document= new Document(((StyledText)fControl).getSelectionText()); return new TextSelection(document, 0, document.getLength()); } else { // FIXME: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=63022 return StructuredSelection.EMPTY; } }
@Override public ISelection getSelection() { if (fControl instanceof StyledText) { IDocument document= new Document(((StyledText)fControl).getSelectionText()); return new TextSelection(document, 0, document.getLength()); } else { // FIXME: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=63022 return StructuredSelection.EMPTY; } }
@Override public ISelection getSelection() { if (fControl instanceof StyledText) { IDocument document= new Document(((StyledText)fControl).getSelectionText()); return new TextSelection(document, 0, document.getLength()); } else { // FIXME: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=63022 return StructuredSelection.EMPTY; } }
@Override public void selectionChanged(FormEntry entry) { ITextSelection selection = new TextSelection(1, 1); contextPart.getPage().getPDEEditor().getContributor().updateSelectableActions(selection); } }
@Override public void focusGained(FocusEvent e) { ITextSelection selection = new TextSelection(1, 1); part.getPage().getPDEEditor().getContributor().updateSelectableActions(selection); } });
@Override public IVariable getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) { if (textViewer == null || hoverRegion == null) { return null; } TextSelection sel = new TextSelection(textViewer.getDocument(), hoverRegion.getOffset(), hoverRegion.getLength()); return Adapters.adapt(sel, IVariable.class); }
@Override public void focusGained(FormEntry entry) { ITextSelection selection = new TextSelection(1, 1); contextPart.getPage().getPDEEditor().getContributor().updateSelectableActions(selection); }
@Override public void open() { if (fElement != null) fOpenAction.run(new StructuredSelection(fElement)); else fOpenAction.run(new TextSelection(fRegion.getOffset(), fRegion.getLength())); }
@Override public void open() { if (fElement != null) fOpenAction.run(new StructuredSelection(fElement)); else fOpenAction.run(new TextSelection(fRegion.getOffset(), fRegion.getLength())); }
@Override protected void copyMarkedRegion(boolean delete) { IRegion markedRegion= getMarkedRegion(); if (markedRegion != null) copyToClipboard(new TextSelection(getDocument(), markedRegion.getOffset(), markedRegion.getLength()), delete, getTextWidget()); }
@Override protected void copyMarkedRegion(boolean delete) { IRegion markedRegion= getMarkedRegion(); if (markedRegion != null) copyToClipboard(new TextSelection(getDocument(), markedRegion.getOffset(), markedRegion.getLength()), delete, getTextWidget()); }
protected void setSelection(ITextRegion textSelection, boolean reveal) { StyledText text = getSourceViewer().getTextWidget(); if (text.getText().length() >= textSelection.getOffset() + textSelection.getLength()) { getSourceViewer().setSelection(new TextSelection(textSelection.getOffset(), textSelection.getLength()), reveal); } }
/** * 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); } }