@Override public IQuickAssistInvocationContext getQuickAssistInvocationContext() { Point selection= getSelectedRange(); return new TextInvocationContext(this, selection.x, selection.y); }
@Override public IQuickAssistInvocationContext getQuickAssistInvocationContext() { Point selection= getSelectedRange(); return new TextInvocationContext(this, selection.x, selection.y); }
private void handleSelectionChanged(MergeSourceViewer tw) { Point p= tw.getSourceViewer().getSelectedRange(); Diff d= findDiff(tw, p.x, p.x+p.y); updateStatus(d); setCurrentDiff(d, false); // don't select or reveal }
private Diff getNextVisibleDiff(boolean down, boolean deep) { Diff diff= null; MergeSourceViewer part= getNavigationPart(); if (part == null) return null; Point s = part.getSourceViewer().getSelectedRange(); char leg = getLeg(part); for (;;) { diff = null; diff = internalGetNextDiff(down, deep, part, s); if (diff != null && diff.getKind() == RangeDifference.ANCESTOR && !isAncestorVisible()) { Position position = diff.getPosition(leg); s = new Point(position.getOffset(), position.getLength()); diff= null; continue; } break; } return diff; }
/** * Restores a previously saved selection in the document. * <p> * If no selection was previously saved, nothing happens. * * @since 3.0 */ protected void restoreSelection() { if (!fSelections.isEmpty()) { final IDocument document= getDocument(); final Position position= fSelections.pop(); try { document.removePosition(fSelectionCategory, position); Point currentSelection= getSelectedRange(); if (currentSelection == null || currentSelection.x != position.getOffset() || currentSelection.y != position.getLength()) { if (position instanceof ColumnPosition && getTextWidget().getBlockSelection()) { setSelection(new BlockTextSelection(document, document.getLineOfOffset(position.getOffset()), ((ColumnPosition) position).fStartColumn, document.getLineOfOffset(position.getOffset() + position.getLength()), ((ColumnPosition) position).fEndColumn, getTextWidget().getTabs())); } else { setSelectedRange(position.getOffset(), position.getLength()); } } if (fSelections.isEmpty()) clearRememberedSelection(); } catch (BadPositionCategoryException exception) { // Should not happen } catch (BadLocationException x) { // Should not happen } } }
/** * Restores a previously saved selection in the document. * <p> * If no selection was previously saved, nothing happens. * * @since 3.0 */ protected void restoreSelection() { if (!fSelections.isEmpty()) { final IDocument document= getDocument(); final Position position= fSelections.pop(); try { document.removePosition(fSelectionCategory, position); Point currentSelection= getSelectedRange(); if (currentSelection == null || currentSelection.x != position.getOffset() || currentSelection.y != position.getLength()) { if (position instanceof ColumnPosition && getTextWidget().getBlockSelection()) { setSelection(new BlockTextSelection(document, document.getLineOfOffset(position.getOffset()), ((ColumnPosition) position).fStartColumn, document.getLineOfOffset(position.getOffset() + position.getLength()), ((ColumnPosition) position).fEndColumn, getTextWidget().getTabs())); } else { setSelectedRange(position.getOffset(), position.getLength()); } } if (fSelections.isEmpty()) clearRememberedSelection(); } catch (BadPositionCategoryException exception) { // Should not happen } catch (BadLocationException x) { // Should not happen } } }
/** * Sets the font for this viewer sustaining selection and scroll position. */ private void setViewerFont() { Font font= JFaceResources.getFont(SYMBOLIC_FONT_NAME); if (fViewer.getDocument() != null) { Point selection= fViewer.getSelectedRange(); int topIndex= fViewer.getTopIndex(); StyledText styledText= fViewer.getTextWidget(); Control parent= fViewer.getControl(); parent.setRedraw(false); styledText.setFont(font); fViewer.setSelectedRange(selection.x , selection.y); fViewer.setTopIndex(topIndex); if (parent instanceof Composite) { Composite composite= (Composite) parent; composite.layout(true); } parent.setRedraw(true); } else { StyledText styledText= fViewer.getTextWidget(); styledText.setFont(font); } }
/** * Sets the font for this viewer sustaining selection and scroll position. */ private void setViewerFont() { Font font= JFaceResources.getFont(SYMBOLIC_FONT_NAME); if (fViewer.getDocument() != null) { Point selection= fViewer.getSelectedRange(); int topIndex= fViewer.getTopIndex(); StyledText styledText= fViewer.getTextWidget(); Control parent= fViewer.getControl(); parent.setRedraw(false); styledText.setFont(font); fViewer.setSelectedRange(selection.x , selection.y); fViewer.setTopIndex(topIndex); if (parent instanceof Composite) { Composite composite= (Composite) parent; composite.layout(true); } parent.setRedraw(true); } else { StyledText styledText= fViewer.getTextWidget(); styledText.setFont(font); } }
/** * Sets the font for this viewer sustaining selection and scroll position. */ private void setViewerFont() { Font font= JFaceResources.getFont(SYMBOLIC_FONT_NAME); if (fViewer.getDocument() != null) { Point selection= fViewer.getSelectedRange(); int topIndex= fViewer.getTopIndex(); StyledText styledText= fViewer.getTextWidget(); Control parent= fViewer.getControl(); parent.setRedraw(false); styledText.setFont(font); fViewer.setSelectedRange(selection.x , selection.y); fViewer.setTopIndex(topIndex); if (parent instanceof Composite) { Composite composite= (Composite) parent; composite.layout(true); } parent.setRedraw(true); } else { StyledText styledText= fViewer.getTextWidget(); styledText.setFont(font); } }
private void setViewerFont() { Font font = getFont(getViewerFontName()); SourceViewer viewer = getSourceViewer(); if (viewer.getDocument() != null) { Point selection = viewer.getSelectedRange(); int topIndex = viewer.getTopIndex(); StyledText styledText = viewer.getTextWidget(); Control parent = viewer.getControl(); parent.setRedraw(false); styledText.setFont(font); viewer.setSelectedRange(selection.x, selection.y); viewer.setTopIndex(topIndex); if (parent instanceof Composite) { Composite composite = (Composite) parent; composite.layout(true); } parent.setRedraw(true); } else { StyledText styledText = viewer.getTextWidget(); styledText.setFont(font); } }