当前位置: 首页>>代码示例>>Java>>正文


Java CompletionResultSet类代码示例

本文整理汇总了Java中org.netbeans.spi.editor.completion.CompletionResultSet的典型用法代码示例。如果您正苦于以下问题:Java CompletionResultSet类的具体用法?Java CompletionResultSet怎么用?Java CompletionResultSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CompletionResultSet类属于org.netbeans.spi.editor.completion包,在下文中一共展示了CompletionResultSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: query

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入依赖的package包/类
@Override
protected void query(CompletionResultSet resultSet, Document doc, int caretOffset) {
    CompletionContext context = new CompletionContext(doc, caretOffset, queryType);
    if (context.getCompletionType() == CompletionType.NONE) {
        resultSet.finish();
        return;
    }
    SpringXMLConfigDocumentListener listener = SpringXMLConfigDocumentListener.getListener(context.getDocumentContext());
    doc.removeDocumentListener(listener);
    doc.addDocumentListener(listener);

    completor = CompletorRegistry.getDefault().getCompletor(context);
    if(completor != null) {
        SpringCompletionResult springCompletionResult = completor.complete(context);
        populateResultSet(resultSet, springCompletionResult);
    }

    resultSet.finish();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:SpringXMLConfigCompletionProvider.java

示例2: filter

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入依赖的package包/类
@Override
protected void filter(CompletionResultSet resultSet) {
    try {
        if ((queryType & COMPLETION_QUERY_TYPE) != 0) {
            if (results != null) {
                if (filterPrefix != null) {
                    resultSet.addAllItems(getFilteredData(results, filterPrefix));
                } else {
                    Completion.get().hideDocumentation();
                    Completion.get().hideCompletion();
                }
            }
        } else if (queryType == TOOLTIP_QUERY_TYPE) {
            resultSet.setToolTip(toolTip);
        }

        resultSet.setAnchorOffset(anchorOffset);
    } catch (Exception ex) {
        Exceptions.printStackTrace(ex);
    }

    resultSet.finish();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:GsfCompletionProvider.java

示例3: query

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入依赖的package包/类
@Override
public void query(CompletionResultSet resultSet, Document doc, int caretOffset) {
    try {
        ClasspathInfo cpInfo = ClasspathInfo.create(doc);
        ParserManager.parse(Collections.singleton(Source.create(doc)), 
                createTask(cpInfo, 
                    component, 
                    resultSet, 
                    doc, caretOffset, queryType)
        );
        resultSet.setHasAdditionalItems(additionalItems);
        resultSet.addAllItems(items);
        resultSet.finish();
    } catch (ParseException ex) {
        Exceptions.printStackTrace(ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:FXMLCompletion2.java

示例4: queryImpl

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入依赖的package包/类
private void queryImpl(CompletionResultSet resultSet, Document doc, int caretOffset) throws InterruptedException, ExecutionException {
    JavadocContext jdctx = new JavadocContext();
    items = new  ArrayList<CompletionItem>();
    this.caretOffset = caretOffset;
    runInJavac(JavaSource.forDocument(doc), jdctx);
    
    if (!ignoreCancel && isTaskCancelled()) {
        return;
    }
    
    if ((queryType & CompletionProvider.COMPLETION_QUERY_TYPE) != 0) {
        if (!items.isEmpty()) {
            resultSet.addAllItems(items);
        }
        resultSet.setHasAdditionalItems(hasAdditionalItems);
    }
    
    if (jdctx.anchorOffset >= 0) {
        resultSet.setAnchorOffset(jdctx.anchorOffset);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:JavadocCompletionQuery.java

示例5: testPlainContent

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入依赖的package包/类
public void testPlainContent() throws Exception {
    MockGrammarResult r = new MockGrammarResult();
    
    r.setDescription(PLAIN_DESCRIPTION_TEXT);
    ElementResultItem item = new ElementResultItem(0, r);
    CompletionTask task = item.doCreateDocumentationTask(r);

    CompletionResultSet rs = resultSetFor(task, CompletionProvider.DOCUMENTATION_QUERY_TYPE);
    task.query(rs);
    
    assertTrue(rs.isFinished());
    
    assertEquals(PLAIN_DESCRIPTION_TEXT, rsImpl.getDocumentation().getText());
 
    // should return null from the url.
    assertNull(rsImpl.getDocumentation().getURL());
    
    // should not be able to resolve links
    assertNull(rsImpl.getDocumentation().resolveLink("link"));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:ElementResultItemDocumentationTest.java

示例6: createDocResourceResultSet

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入依赖的package包/类
private CompletionDocumentation createDocResourceResultSet(MockUrlGrammarResult r) throws Exception {
    if (r == null) {
        r = new MockUrlGrammarResult();
        r.setContentURL(createResourceName("res/docResource.html"));
        r.setExternal(true);
    }
    
    ElementResultItem item = new ElementResultItem(0, r);
    CompletionTask task = item.doCreateDocumentationTask(r);
    CompletionResultSet rs = resultSetFor(task, CompletionProvider.DOCUMENTATION_QUERY_TYPE);
    task.query(rs);

    assertTrue(rs.isFinished());
    
    return rsImpl.getDocumentation();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ElementResultItemDocumentationTest.java

示例7: query

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入依赖的package包/类
protected void query(CompletionResultSet resultSet, Document doc, int caretOffset) {
    StringBuffer sb = new StringBuffer(); // NOI18N

    sb.append("<html><pre>"); //NOI18N
    ParametrizedTextParser.parseToHtml(sb, codeTemplate.getParametrizedText());
    sb.append("</pre>"); // NOI18N

    String desc = codeTemplate.getDescription();
    if (desc != null && desc.length() > 0) {
        sb.append("<p>").append(desc).append("</p>"); //NOI18N
    }
    
    // Append abbreviation
    CodeTemplateManagerOperation operation = CodeTemplateApiPackageAccessor.get().getOperation(codeTemplate);
    sb.append("<p>"); //NOI18N
    sb.append(NbBundle.getMessage(CodeTemplateCompletionItem.class, 
        "DOC_ITEM_Abbreviation", //NOI18N
        ParametrizedTextParser.toHtmlText(codeTemplate.getAbbreviation()), 
        operation.getExpandKeyStrokeText()
    ));
    sb.append("<p>"); //NOI18N
    
    resultSet.setDocumentation(new DocItem(sb.toString()));
    resultSet.finish();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:CodeTemplateCompletionItem.java

示例8: completePropName

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入依赖的package包/类
private void completePropName(SpringBootService sbs, CompletionResultSet completionResultSet, String filter, int startOffset,
        int caretOffset) {
    final Preferences prefs = NbPreferences.forModule(PrefConstants.class);
    final boolean bDeprLast = prefs.getBoolean(PREF_DEPR_SORT_LAST, true);
    final boolean bErrorShow = prefs.getBoolean(PREF_DEPR_ERROR_SHOW, true);
    long mark = System.currentTimeMillis();
    logger.log(FINER, "Completing property name: {0}", filter);
    for (ConfigurationMetadataProperty propMeta : sbs.queryPropertyMetadata(filter)) {
        if (Utils.isErrorDeprecated(propMeta)) {
            // show error level deprecated props based on pref
            if (bErrorShow) {
                completionResultSet.addItem(new CfgPropCompletionItem(propMeta, sbs, startOffset, caretOffset, bDeprLast));
            }
        } else {
            completionResultSet.addItem(new CfgPropCompletionItem(propMeta, sbs, startOffset, caretOffset, bDeprLast));
        }
    }
    final long elapsed = System.currentTimeMillis() - mark;
    logger.log(FINER, "Property completion of ''{0}'' took: {1} msecs", new Object[]{filter, elapsed});
}
 
开发者ID:AlexFalappa,项目名称:nb-springboot,代码行数:21,代码来源:CfgPropsCompletionProvider.java

示例9: createDocumentationTask

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入依赖的package包/类
@Override
public CompletionTask createDocumentationTask() {
    if (type != null) {
        return new AsyncCompletionTask(new AsyncCompletionQuery() {

            @Override
            protected void query(CompletionResultSet result, Document doc, int i) {
                if (type == Type.DIRECTIVE) {
                    result.setDocumentation(FTLCompletionItem.getDocForDirective(text));
                } else if (type == Type.BUILTIN) {
                    result.setDocumentation(FTLCompletionItem.getDocForBuiltin(text));
                }
                result.finish();
            }
        });
    }
    return null;
}
 
开发者ID:rostanek,项目名称:freemarker-support-for-netbeans,代码行数:19,代码来源:FTLCompletionItem.java

示例10: createTask

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入依赖的package包/类
@Override
public CompletionTask createTask(int queryType, JTextComponent component) {
    if (queryType != CompletionProvider.COMPLETION_QUERY_TYPE) {
        return null;
    }
    return new AsyncCompletionTask(new AsyncCompletionQuery() {

        @Override
        protected void query(CompletionResultSet resultSet, Document doc, int caretOffset) {
            //Iterate through the available locales
            //and assign each country display name
            //to a CompletionResultSet:
            String text = DocumentHelper.getWordBeforeCaret(doc, caretOffset);
            CompletionProposals[] words = CompletionProposals.values();
            Arrays.sort(words);
            for (CompletionProposals word : words) {
                final String name = word.name().toLowerCase();
                if (name.startsWith(text)) {
                    resultSet.addItem(new RTCompletionItem(name, caretOffset));
                }
            }
            resultSet.finish();
        }
    }, component);
}
 
开发者ID:iti-luebeck,项目名称:RTeasy2,代码行数:26,代码来源:RTCompletionProvider.java

示例11: query

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入依赖的package包/类
@Override
protected void query(CompletionResultSet resultSet, Document doc, int caretOffset) {
    List<JPACompletionItem> completionItems = new ArrayList<JPACompletionItem>();

    int anchorOffset = getCompletionItems(doc, caretOffset, completionItems);
    resultSet.addAllItems(completionItems);
    if (anchorOffset != -1) {
        resultSet.setAnchorOffset(anchorOffset);
    }

    resultSet.finish();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:PUCompletionProvider.java

示例12: filter

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入依赖的package包/类
@Override
protected void filter(CompletionResultSet resultSet) {
    try {
        resultSet.setAnchorOffset(anchorOffset);
    } catch (Exception ex) {
        Exceptions.printStackTrace(ex);
    }
    resultSet.finish();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:PUCompletionProvider.java

示例13: query

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入依赖的package包/类
@Override
protected void query(CompletionResultSet resultSet, Document doc, int caretOffset) {
    XMLSyntaxSupport support = XMLSyntaxSupport.getSyntaxSupport(doc);
    if (support == null) {
        resultSet.finish();
        return;
    }

    CompletionResultItem endTagResultItem = CompletionUtil.getEndTagCompletionItem(
        component, (BaseDocument) doc);
    List<CompletionResultItem> completionItems = null;
    if (!CompletionUtil.noCompletion(component) &&
       (CompletionUtil.canProvideCompletion((BaseDocument) doc))) {
        
        resultSet.setWaitText(NbBundle.getMessage(CompletionQuery.class, "MSG_PreparingXmlSchemas")); // NOI18N
        
        PreparedResults res = createResultsAndTimedWait(doc, caretOffset);
        
        if (res.isRunning()) {
            resultSet.addItem(new FinishDownloadItem());
        } else {
            completionItems = res.items;
        }
    } else {
        clearPreparedItems(doc);
    }
    
    if (isTaskCancelled()) {
        resultSet.finish();
        return;
    }
    if (endTagResultItem != null) resultSet.addItem(endTagResultItem);
    if ((completionItems != null) && (completionItems.size() > 0)) {
        resultSet.addAllItems(completionItems);
    } else if ((endTagResultItem != null) &&
               (! (endTagResultItem instanceof TagLastCharResultItem))) {
        endTagResultItem.setExtraPaintGap(-CompletionPaintComponent.DEFAULT_ICON_TEXT_GAP);
    }
    resultSet.finish();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:CompletionQuery.java

示例14: CompletionUserTask

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入依赖的package包/类
private CompletionUserTask(CompletionResultSet resultSet, ClasspathInfo cpi, String prefix, int caretOffset) {
    this.resultSet = resultSet;
    this.cpi = cpi;
    this.prefix = prefix;
    this.lastPrefixDot = prefix.lastIndexOf('.');
    this.caretOffset = caretOffset;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:ExceptionCompletionProvider.java

示例15: createDocumentationTask

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入依赖的package包/类
@Override
public CompletionTask createDocumentationTask() {
    return new AsyncCompletionTask(new AsyncCompletionQuery() {
        @Override
        protected void query(CompletionResultSet resultSet, Document doc, int caretOffset) {
            CompletionDocumentation docItem = SpringXMLConfigCompletionDoc.createBeanRefDoc(beanId,
                    beanNames, beanClass, beanLocFile, goToBeanAction);
            resultSet.setDocumentation(docItem);
            resultSet.finish();
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:SpringXMLConfigCompletionItem.java


注:本文中的org.netbeans.spi.editor.completion.CompletionResultSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。