public void assistSessionStarted(ContentAssistEvent event) { Point selectedRange = viewer.getSelectedRange(); storePosition(selectedRange.x, selectedRange.y); }
/** * Triggered by toggling the 'Link with Editor' button in the outline * view */ public void synchronizeOutlinePage() { // Get the current position of the cursor in this page int current_offset = getSourceViewer().getSelectedRange().x; synchronizeOutlinePage(current_offset); }
@Override protected void handleCursorPositionChanged() { super.handleCursorPositionChanged(); fCachedSelectedRange= getViewer().getSelectedRange(); }
/** * get the outline item nearest matching the selection in the source viewer */ private OutlineItem getNearestMatchingOutlineItem() { Point selectedRange = getSourceViewer().getSelectedRange(); if (selectedRange != null) { return outlineModel.findNearestMatchingOffset(selectedRange.x); } return null; }
@Override protected void handleCursorPositionChanged() { super.handleCursorPositionChanged(); fCachedSelectedRange= getViewer().getSelectedRange(); }
protected void handleCursorPositionChanged() { super.handleCursorPositionChanged(); fCachedSelectedRange= getViewer().getSelectedRange(); }
@Override public void verifyKey(VerifyEvent event) { if (matched && event.keyCode == 27) { Point range = sourceViewer.getSelectedRange(); try { sourceViewer.getDocument().replace(range.x - longForm.length(), longForm.length(), shortcut); sourceViewer.setSelectedRange(range.x - longForm.length() + shortcut.length(), 0); matched = false; } catch (BadLocationException e) { handleBadLocationException(e); } } }
@Override public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext quickAssistContext) { ISourceViewer viewer= quickAssistContext.getSourceViewer(); int documentOffset= quickAssistContext.getOffset(); int length= viewer != null ? viewer.getSelectedRange().y : -1; TextInvocationContext context= new TextInvocationContext(viewer, documentOffset, length); IAnnotationModel model= viewer.getAnnotationModel(); if (model == null) return fgNoSuggestionsProposal; List<ICompletionProposal> proposals= computeProposals(context, model); if (proposals.isEmpty()) return fgNoSuggestionsProposal; return proposals.toArray(new ICompletionProposal[proposals.size()]); }
public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext quickAssistContext) { ISourceViewer viewer= quickAssistContext.getSourceViewer(); int documentOffset= quickAssistContext.getOffset(); int length= viewer != null ? viewer.getSelectedRange().y : 0; TextInvocationContext context= new TextInvocationContext(viewer, documentOffset, length); IAnnotationModel model= viewer.getAnnotationModel(); if (model == null) return fgNoSuggestionsProposal; List proposals= computeProposals(context, model); if (proposals.isEmpty()) return fgNoSuggestionsProposal; return (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[proposals.size()]); }
/** * get the outline item nearest matching the selection in the source viewer */ private OutlineItem getNearestMatchingOutlineItem() { Point selectedRange = getSourceViewer().getSelectedRange(); if (selectedRange != null) { return getOutlineModel().findNearestMatchingOffset(selectedRange.x); } return null; }
protected LdifContainer[] getSelectedLdifContainers() { LdifContainer[] containers = null; ISourceViewer sourceViewer = ( ISourceViewer ) editor.getAdapter( ISourceViewer.class ); if ( sourceViewer != null ) { LdifFile model = editor.getLdifModel(); Point selection = sourceViewer.getSelectedRange(); containers = LdifFile.getContainers( model, selection.x, selection.y ); } return containers != null ? containers : new LdifContainer[0]; }
protected LdifPart[] getSelectedLdifParts() { LdifPart[] parts = null; ISourceViewer sourceViewer = ( ISourceViewer ) editor.getAdapter( ISourceViewer.class ); if ( sourceViewer != null ) { LdifFile model = editor.getLdifModel(); Point selection = sourceViewer.getSelectedRange(); parts = LdifFile.getParts( model, selection.x, selection.y ); } return parts != null ? parts : new LdifPart[0]; }
public LinkedPosition getCurrentLinkedPosition() { Point selection= fEditor.getViewer().getSelectedRange(); int start= selection.x; int end= start + selection.y; LinkedPosition[] positions= fLinkedPositionGroup.getPositions(); for (int i= 0; i < positions.length; i++) { LinkedPosition position= positions[i]; if (position.includes(start) && position.includes(end)) return position; } return null; }
private static final IRegion getSignedSelection(ISourceViewer sourceViewer) { Point viewerSelection= sourceViewer.getSelectedRange(); StyledText text= sourceViewer.getTextWidget(); Point selection= text.getSelectionRange(); if (text.getCaretOffset() == selection.x) { viewerSelection.x= viewerSelection.x + viewerSelection.y; viewerSelection.y= -viewerSelection.y; } return new Region(viewerSelection.x, viewerSelection.y); }
public LinkedPosition getCurrentLinkedPosition() { Point selection= fEditor.getViewer().getSelectedRange(); int start= selection.x; int end= start + selection.y; LinkedPosition[] positions= fLinkedPositionGroup.getPositions(); for (int i= 0; i < positions.length; i++) { LinkedPosition position= positions[i]; if (position.includes(start) && position.includes(end)) return position; } return null; }
public LinkedPosition getCurrentLinkedPosition() { Point selection= fEditor.getViewer().getSelectedRange(); int start= selection.x; int end= start + selection.y; LinkedPosition[] positions= fLinkedPositionGroup.getPositions(); for (int i= 0; i < positions.length; i++) { LinkedPosition position= positions[i]; if (position.includes(start) && position.includes(end)) return position; } return null; }
/** * Returns the context type ids supported at the current * caret position of the editor. * * @return an array with the the supported context type ids */ private String[] getEditorContextTypeIds() { Point selectedRange=fViewer.getSelectedRange(); int offset= selectedRange.x + selectedRange.y; IDocument document= fTextEditor.getDocumentProvider().getDocument(fTextEditor.getEditorInput()); return getContextTypeIds(document, offset); }
/** * Returns the context type ids supported at the current * caret position of the editor. * * @return an array with the the supported context type ids */ private String[] getEditorContextTypeIds() { Point selectedRange=fViewer.getSelectedRange(); int offset= selectedRange.x + selectedRange.y; IDocument document= fTextEditor.getDocumentProvider().getDocument(fTextEditor.getEditorInput()); return getContextTypeIds(document, offset); }
public LinkedPosition getCurrentLinkedPosition() { Point selection = editor.getInternalSourceViewer().getSelectedRange(); int start = selection.x; int end = start + selection.y; LinkedPosition[] positions = linkedPositionGroup.getPositions(); for (int i = 0; i < positions.length; i++) { LinkedPosition position = positions[i]; if (position.includes(start) && position.includes(end)) return position; } return null; }
private static final IRegion getSignedSelection(ISourceViewer sourceViewer) { Point viewerSelection= sourceViewer.getSelectedRange(); StyledText text= sourceViewer.getTextWidget(); Point selection= text.getSelectionRange(); if (text.getCaretOffset() == selection.x) { viewerSelection.x= viewerSelection.x + viewerSelection.y; viewerSelection.y= -viewerSelection.y; } return new Region(viewerSelection.x, viewerSelection.y); }