Search in sources :

Example 1 with IContextInformation

use of org.eclipse.che.jface.text.contentassist.IContextInformation in project che by eclipse.

the class JavaCompletionProposalComputer method addContextInformations.

private List<IContextInformation> addContextInformations(JavaContentAssistInvocationContext context, int offset) {
    List<ICompletionProposal> proposals = internalComputeCompletionProposals(offset, context);
    List<IContextInformation> result = new ArrayList<IContextInformation>(proposals.size());
    List<IContextInformation> anonymousResult = new ArrayList<IContextInformation>(proposals.size());
    for (Iterator<ICompletionProposal> it = proposals.iterator(); it.hasNext(); ) {
        ICompletionProposal proposal = it.next();
        IContextInformation contextInformation = proposal.getContextInformation();
        if (contextInformation != null) {
            ContextInformationWrapper wrapper = new ContextInformationWrapper(contextInformation);
            wrapper.setContextInformationPosition(offset);
            if (proposal instanceof AnonymousTypeCompletionProposal)
                anonymousResult.add(wrapper);
            else
                result.add(wrapper);
        }
    }
    if (result.size() == 0)
        return anonymousResult;
    return result;
}
Also used : ICompletionProposal(org.eclipse.che.jface.text.contentassist.ICompletionProposal) ArrayList(java.util.ArrayList) IContextInformation(org.eclipse.che.jface.text.contentassist.IContextInformation)

Example 2 with IContextInformation

use of org.eclipse.che.jface.text.contentassist.IContextInformation in project che by eclipse.

the class JavaCompletionProposalComputer method computeContextInformation.

/*
     * @see org.eclipse.jface.text.contentassist.ICompletionProposalComputer#computeContextInformation(org.eclipse.jface.text
     * .contentassist.TextContentAssistInvocationContext, org.eclipse.core.runtime.IProgressMonitor)
     */
public List<IContextInformation> computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) {
    if (context instanceof JavaContentAssistInvocationContext) {
        JavaContentAssistInvocationContext javaContext = (JavaContentAssistInvocationContext) context;
        int contextInformationPosition = guessContextInformationPosition(javaContext);
        List<IContextInformation> result = addContextInformations(javaContext, contextInformationPosition);
        return result;
    }
    return Collections.emptyList();
}
Also used : JavaContentAssistInvocationContext(org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext) IContextInformation(org.eclipse.che.jface.text.contentassist.IContextInformation) Point(org.eclipse.swt.graphics.Point)

Example 3 with IContextInformation

use of org.eclipse.che.jface.text.contentassist.IContextInformation in project che by eclipse.

the class ProposalContextInformation method equals.

/*
	 * @see IContextInformation#equals
	 */
@Override
public boolean equals(Object object) {
    if (object instanceof IContextInformation) {
        IContextInformation contextInformation = (IContextInformation) object;
        boolean equals = getInformationDisplayString().equalsIgnoreCase(contextInformation.getInformationDisplayString());
        if (getContextDisplayString() != null)
            equals = equals && getContextDisplayString().equalsIgnoreCase(contextInformation.getContextDisplayString());
        return equals;
    }
    return false;
}
Also used : IContextInformation(org.eclipse.che.jface.text.contentassist.IContextInformation)

Aggregations

IContextInformation (org.eclipse.che.jface.text.contentassist.IContextInformation)3 ArrayList (java.util.ArrayList)1 ICompletionProposal (org.eclipse.che.jface.text.contentassist.ICompletionProposal)1 JavaContentAssistInvocationContext (org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext)1 Point (org.eclipse.swt.graphics.Point)1