Java 类org.eclipse.jface.text.quickassist.IQuickAssistProcessor 实例源码

项目:mesfavoris    文件:SpellcheckableMessageArea.java   
private void addProposals(final SubMenuManager quickFixMenu) {
    IAnnotationModel sourceModel = sourceViewer.getAnnotationModel();
    Iterator annotationIterator = sourceModel.getAnnotationIterator();
    while (annotationIterator.hasNext()) {
        Annotation annotation = (Annotation) annotationIterator.next();
        boolean isDeleted = annotation.isMarkedDeleted();
        boolean isIncluded = includes(sourceModel.getPosition(annotation),
                getTextWidget().getCaretOffset());
        boolean isFixable = sourceViewer.getQuickAssistAssistant().canFix(
                annotation);
        if (!isDeleted && isIncluded && isFixable) {
            IQuickAssistProcessor processor = sourceViewer
            .getQuickAssistAssistant()
            .getQuickAssistProcessor();
            IQuickAssistInvocationContext context = sourceViewer
            .getQuickAssistInvocationContext();
            ICompletionProposal[] proposals = processor
            .computeQuickAssistProposals(context);

            for (ICompletionProposal proposal : proposals)
                quickFixMenu.add(createQuickFixAction(proposal));
        }
    }
}
项目:Pydev    文件:PyEditConfiguration.java   
@Override
public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) {
    // create a content assistant:
    PyCorrectionAssistant assistant = new PyCorrectionAssistant();

    // next create a content assistant processor to populate the completions window
    IQuickAssistProcessor processor = new PythonCorrectionProcessor(this.getEdit());

    // Correction assist works on all
    assistant.setQuickAssistProcessor(processor);
    assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));

    //delay and auto activate set on PyContentAssistant constructor.

    return assistant;
}
项目:Pydev    文件:PydevConsole.java   
@Override
public SourceViewerConfiguration createSourceViewerConfiguration() {
    PyContentAssistant contentAssist = new PyContentAssistant();
    IContentAssistProcessor processor = createConsoleCompletionProcessor(contentAssist);
    contentAssist.setContentAssistProcessor(processor, PydevScriptConsoleSourceViewerConfiguration.PARTITION_TYPE);

    contentAssist.enableAutoActivation(true);
    contentAssist.enableAutoInsert(false);
    contentAssist.setAutoActivationDelay(PyCodeCompletionPreferencesPage.getAutocompleteDelay());

    PyCorrectionAssistant quickAssist = new PyCorrectionAssistant();
    // next create a content assistant processor to populate the completions window
    IQuickAssistProcessor quickAssistProcessor = createConsoleQuickAssistProcessor(quickAssist);

    // Correction assist works on all
    quickAssist.setQuickAssistProcessor(quickAssistProcessor);

    SourceViewerConfiguration cfg = new PydevScriptConsoleSourceViewerConfiguration(createHover(), contentAssist,
            quickAssist);
    return cfg;
}
项目:google-cloud-eclipse    文件:BannedElement.java   
/**
 * @param length the length of the marker underline. Length == 0 results in a
 *        marker in the vertical ruler and no underline
 */
BannedElement(String message, String markerId, int iMarkerSeverity, int iMessageSeverity,
    DocumentLocation start, int length, IQuickAssistProcessor processor) {
  Preconditions.checkNotNull(message, "element name is null");
  Preconditions.checkNotNull(markerId, "markerId is null");
  Preconditions.checkNotNull(start, "start is null");
  Preconditions.checkArgument(length >= 0, "length < 0");
  this.message = message;
  this.start = start;
  this.length = length;
  this.markerId = markerId;
  this.iMarkerSeverity = iMarkerSeverity;
  this.iMessageSeverity = iMessageSeverity;
  this.processor = processor;
}
项目:google-cloud-eclipse    文件:XmlSourceValidator.java   
/**
 * Creates a message from a given {@link BannedElement}.
 */
void createMessage(IReporter reporter, BannedElement element, int elementOffset) {
  IMessage message = new LocalizedMessage(element.getIMessageSeverity(), element.getMessage());
  message.setTargetObject(this);
  message.setMarkerId(element.getMarkerId());
  message.setLineNo(element.getStart().getLineNumber());
  message.setOffset(elementOffset);
  message.setLength(element.getLength());
  message.setAttribute(IQuickAssistProcessor.class.getName(), element.getQuickAssistProcessor());
  reporter.addMessage(this, message);
}
项目:eclipse-wtp-webresources    文件:UIMessageFactory.java   
@Override
protected void addMessage(IMessage message, WebResourcesFinderType type) {

    IReporter reporter = getReporter();
    IQuickAssistProcessor processor = getQuickAssistProcessor(type);
    if (reporter instanceof IncrementalReporter && processor != null) {
        AnnotationInfo info = new AnnotationInfo(message,
                AnnotationInfo.NO_PROBLEM_ID, processor);
        ((IncrementalReporter) reporter).addAnnotationInfo(getValidator(),
                info);

    } else {
        super.addMessage(message, type);
    }
}
项目:eclipse-wtp-webresources    文件:UIMessageFactory.java   
private IQuickAssistProcessor getQuickAssistProcessor(
        WebResourcesFinderType type) {
    switch (type) {
    case LINK_HREF:
    case SCRIPT_SRC:
        return new WebResourceQuickFixProcessor();
    default:
        return null;
    }
}
项目:google-cloud-eclipse    文件:BannedElement.java   
IQuickAssistProcessor getQuickAssistProcessor() {
  return processor;
}
项目:Pydev    文件:PydevConsole.java   
@Override
protected IQuickAssistProcessor createConsoleQuickAssistProcessor(QuickAssistAssistant quickAssist) {
    return new PydevConsoleQuickAssistProcessor((PyCorrectionAssistant) quickAssist);
}
项目:Pydev    文件:ScriptConsole.java   
/**
 * @return the assistant that should handle quick assist requests (quick fixes)
 */
protected abstract IQuickAssistProcessor createConsoleQuickAssistProcessor(QuickAssistAssistant quickAssist);