@Override public final Point getSelection(final IDocument document) { return new Point(fContext.getOffset(), fContext.getLength()); } }
@Override public final Point getSelection(final IDocument document) { return new Point(fContext.getOffset(), fContext.getLength()); } }
@Override public final Point getSelection(final IDocument document) { return new Point(fContext.getOffset(), fContext.getLength()); } }
@Override public final Point getSelection(final IDocument document) { return new Point(fContext.getOffset(), fContext.getLength()); } }
@Override public final Point getSelection(final IDocument document) { return new Point(fContext.getOffset(), fContext.getLength()); } }
@Override public final Point getSelection(final IDocument document) { return new Point(fContext.getOffset(), fContext.getLength()); } }
@Override public final Point getSelection(final IDocument document) { int offset= fContext.getOffset(); int length= fContext.getLength(); final int delta= fWord.length() - fLength; if (offset <= fOffset && offset + length >= fOffset) length += delta; else if (offset > fOffset && offset + length > fOffset + fLength) { offset += delta; length -= delta; } else length += delta; return new Point(offset, length); } }
@Override public final Point getSelection(final IDocument document) { int offset= fContext.getOffset(); int length= fContext.getLength(); final int delta= fWord.length() - fLength; if (offset <= fOffset && offset + length >= fOffset) length += delta; else if (offset > fOffset && offset + length > fOffset + fLength) { offset += delta; length -= delta; } else length += delta; return new Point(offset, length); } }
public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext) { List proposals = new ArrayList(); getLocalRenameQuickAssistProposal(proposals, invocationContext.getSourceViewer(), invocationContext.getOffset()); getSurroundWithNewElementQuickAssistProposal(proposals, invocationContext.getSourceViewer(), invocationContext.getOffset()); getInsertRequiredAttrs(proposals, invocationContext.getSourceViewer(), invocationContext.getOffset()); return (ICompletionProposal[]) 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()]); }
@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()]); }
private List<ICompletionProposal> computeProposals(IQuickAssistInvocationContext context, IAnnotationModel model) { int offset= context.getOffset(); ArrayList<SpellingProblem> annotationList= new ArrayList<>(); Iterator<Annotation> iter= model.getAnnotationIterator(); while (iter.hasNext()) { Annotation annotation= iter.next(); if (canFix(annotation)) { Position pos= model.getPosition(annotation); if (isAtPosition(offset, pos)) { collectSpellingProblems(annotation, annotationList); } } } SpellingProblem[] spellingProblems= annotationList.toArray(new SpellingProblem[annotationList.size()]); return computeProposals(context, spellingProblems); }
@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()]); }
private List computeProposals(IQuickAssistInvocationContext context, IAnnotationModel model) { int offset= context.getOffset(); ArrayList annotationList= new ArrayList(); Iterator iter= model.getAnnotationIterator(); while (iter.hasNext()) { Annotation annotation= (Annotation)iter.next(); if (canFix(annotation)) { Position pos= model.getPosition(annotation); if (isAtPosition(offset, pos)) { collectSpellingProblems(annotation, pos, annotationList); } } } SpellingProblem[] spellingProblems= (SpellingProblem[]) annotationList.toArray(new SpellingProblem[annotationList.size()]); return computeProposals(context, spellingProblems); }
private List<ICompletionProposal> computeProposals(IQuickAssistInvocationContext context, IAnnotationModel model) { int offset= context.getOffset(); ArrayList<SpellingProblem> annotationList= new ArrayList<>(); Iterator<Annotation> iter= model.getAnnotationIterator(); while (iter.hasNext()) { Annotation annotation= iter.next(); if (canFix(annotation)) { Position pos= model.getPosition(annotation); if (isAtPosition(offset, pos)) { collectSpellingProblems(annotation, annotationList); } } } SpellingProblem[] spellingProblems= annotationList.toArray(new SpellingProblem[annotationList.size()]); return computeProposals(context, spellingProblems); }
@Override public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext) { List<IMarker> markers; try { markers = getMarkersFor(invocationContext.getSourceViewer(), invocationContext.getOffset()); } catch (BadLocationException e) { errorMessage = e.getMessage(); return new ICompletionProposal[0]; } List<ICompletionProposal> result = new ArrayList<>(); for (IMarker marker : markers) { for (IMarkerResolution markerResolution : quickFixer.getResolutions(marker)) { result.add(new MarkerResolutionProposal(marker, markerResolution, invocationContext.getSourceViewer())); } } return result.toArray(new ICompletionProposal[0]); }
public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext) { ISourceViewer sourceViewer = invocationContext.getSourceViewer(); if (sourceViewer == null) return new ICompletionProposal[0]; final IDocument document = sourceViewer.getDocument(); if (!(document instanceof IXtextDocument)) return new ICompletionProposal[0]; final IXtextDocument xtextDocument = (IXtextDocument) document; final IAnnotationModel annotationModel = sourceViewer.getAnnotationModel(); List<ICompletionProposal> result = Lists.newArrayList(); try { Set<Annotation> applicableAnnotations = getApplicableAnnotations(xtextDocument, annotationModel, invocationContext.getOffset()); result = createQuickfixes(invocationContext, applicableAnnotations); selectAndRevealQuickfix(invocationContext, applicableAnnotations, result); } catch (BadLocationException e) { errorMessage = e.getMessage(); } sortQuickfixes(result); return result.toArray(new ICompletionProposal[result.size()]); }
private PropertiesAssistContext createAssistContext(IQuickAssistInvocationContext invocationContext) { IEditorPart editorPart= fAssistant.getEditor(); IFile file= editorPart.getEditorInput().getAdapter(IFile.class); ISourceViewer sourceViewer= invocationContext.getSourceViewer(); IType accessorType= ((PropertiesFileEditor) editorPart).getAccessorType(); return new PropertiesAssistContext(sourceViewer, invocationContext.getOffset(), invocationContext.getLength(), file, sourceViewer.getDocument(), accessorType); } }
private PropertiesAssistContext createAssistContext(IQuickAssistInvocationContext invocationContext) { IEditorPart editorPart= fAssistant.getEditor(); IFile file= editorPart.getEditorInput().getAdapter(IFile.class); ISourceViewer sourceViewer= invocationContext.getSourceViewer(); IType accessorType= ((PropertiesFileEditor) editorPart).getAccessorType(); return new PropertiesAssistContext(sourceViewer, invocationContext.getOffset(), invocationContext.getLength(), file, sourceViewer.getDocument(), accessorType); } }
public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext quickAssistContext) { ITextViewer viewer= quickAssistContext.getSourceViewer(); int documentOffset= quickAssistContext.getOffset();