/** * Returns the invocation context. If none has been set via * {@link #setInvocationContext(JavaContentAssistInvocationContext)}, a new one is created. * * @return invocationContext the invocation context * @since 3.2 */ protected final JavaContentAssistInvocationContext getInvocationContext() { if (fInvocationContext == null) setInvocationContext(new JavaContentAssistInvocationContext(getCompilationUnit())); return fInvocationContext; }
/** * Returns a label provider that can be used to compute proposal labels. * * @return a label provider that can be used to compute proposal labels */ public CompletionProposalLabelProvider getLabelProvider() { if (fLabelProvider == null) { if (fCollector != null) fLabelProvider= fCollector.getLabelProvider(); else fLabelProvider= new CompletionProposalLabelProvider(); } return fLabelProvider; }
@Override public boolean canFix(ICompilationUnit compilationUnit, IProblemLocation problem) { int id= problem.getProblemId(); if (id == this.handledProblemID) { // FIXME search specifically: return param (which??) // if (QuickFixes.hasExplicitNullnessAnnotation(compilationUnit, problem.getOffset())) // return false; return true; } return false; }
public ImportCompletionProposal(CompletionProposal proposal, JavaContentAssistInvocationContext context, int parentProposalKind) { super(context); fProposal= proposal; fParentProposalKind= parentProposalKind; fCompilationUnit= context.getCompilationUnit(); }
@Override public int getRelevance() { if (fResolution instanceof IJavaCompletionProposal) { return ((IJavaCompletionProposal) fResolution).getRelevance(); } return IProposalRelevance.MARKER_RESOLUTION; }
private CompletionProposalCollector(IJavaProject project, ICompilationUnit cu, boolean ignoreAll) { super(ignoreAll); fJavaProject= project; fCompilationUnit= cu; fUserReplacementLength= -1; if (!ignoreAll) { setRequireExtendedContext(true); } }
@Override public Point getSelection(IDocument document) { if (fResolution instanceof IJavaCompletionProposal) { return ((IJavaCompletionProposal) fResolution).getSelection(document); } return null; }
/** * Creates the context that is passed to the completion proposal * computers. * * @param viewer the viewer that content assist is invoked on * @param offset the content assist offset * @return the context to be passed to the computers */ protected ContentAssistInvocationContext createContext(ITextViewer viewer, int offset) { return new ContentAssistInvocationContext(viewer, offset); }
private static boolean noErrorsAtLocation(IProblemLocation[] locations) { if (locations != null) { for (int i = 0; i < locations.length; i++) { if (locations[i].isError()) { return false; } } } return true; } private static boolean getIfReturnIntoIfElseAtEndOfVoidMethodProposals(IInvocationContext context, ASTNode covering,
public boolean equals(Object obj) { if (!super.equals(obj)) return false; return fFlags == ((JavadocContentAssistInvocationContext) obj).fFlags; }
@Override public Image getImage(Object element) { if (element instanceof ClasspathFixProposal) { ClasspathFixProposal classpathFixProposal= (ClasspathFixProposal) element; return classpathFixProposal.getImage(); } return null; }
@Override public String getText(Object element) { if (element instanceof ClasspathFixProposal) { ClasspathFixProposal classpathFixProposal= (ClasspathFixProposal) element; return classpathFixProposal.getDisplayString(); } return null; } }
@Override public boolean canFix(ICompilationUnit compilationUnit, IProblemLocation problem) { int id= problem.getProblemId(); if (id == this.handledProblemID) { // FIXME search specifically: return param (which??) // if (QuickFixes.hasExplicitNullnessAnnotation(compilationUnit, problem.getOffset())) // return false; return true; } return false; }
public ImportCompletionProposal(CompletionProposal proposal, JavaContentAssistInvocationContext context, int parentProposalKind) { super(context); fProposal= proposal; fParentProposalKind= parentProposalKind; fCompilationUnit= context.getCompilationUnit(); }
public int getRelevance() { if (fResolution instanceof IJavaCompletionProposal) { return ((IJavaCompletionProposal) fResolution).getRelevance(); } return 10; }
@Override public Image getImage(Object element) { if (element instanceof ClasspathFixProposal) { ClasspathFixProposal classpathFixProposal= (ClasspathFixProposal) element; return classpathFixProposal.getImage(); } return null; }
@Override public String getText(Object element) { if (element instanceof ClasspathFixProposal) { ClasspathFixProposal classpathFixProposal= (ClasspathFixProposal) element; return classpathFixProposal.getDisplayString(); } return null; } }
public static boolean isNonStaticAccess(IProblemLocation problem) { return (problem.getProblemId() == IProblem.NonStaticAccessToStaticField || problem.getProblemId() == IProblem.NonStaticAccessToStaticMethod || problem.getProblemId() == IProblem.NonStaticOrAlienTypeReceiver); }
public boolean requiresExplicitAnnotation() { switch (fProblem.getProblemId()) { case IProblem.ConflictingInheritedNullAnnotations: case IProblem.ConflictingNullAnnotations: return fChangeKind != ChangeKind.OVERRIDDEN; default: return false; } }
public static boolean isNonStaticAccess(IProblemLocation problem) { return (problem.getProblemId() == IProblem.NonStaticAccessToStaticField || problem.getProblemId() == IProblem.NonStaticAccessToStaticMethod || problem.getProblemId() == IProblem.NonStaticOrAlienTypeReceiver); }