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


Java CompletionResultSet.setToolTip方法代码示例

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


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

示例1: 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

示例2: createToolTipTask

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入方法依赖的package包/类
/**
 * Returns a task used to obtain a tooltip hint associated with the item if
 * there is any.
 *
 * @return CompletionTask
 */
@Override
public CompletionTask createToolTipTask() {
    return new AsyncCompletionTask(new AsyncCompletionQuery() {
        @Override
        protected void query(CompletionResultSet completionResultSet, Document document, int i) {
            JToolTip toolTip = new JToolTip();
            toolTip.setTipText("Press Enter to insert \"" + text + "\"");
            completionResultSet.setToolTip(toolTip);
            completionResultSet.finish();
        }
    });
}
 
开发者ID:ArturWisniewski,项目名称:NB-Thymeleaf-Code-Completion,代码行数:19,代码来源:ThymeleafCompletionItem.java

示例3: createToolTipTask

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入方法依赖的package包/类
@Override
public CompletionTask createToolTipTask() {
    return new AsyncCompletionTask(new AsyncCompletionQuery() {
        @Override
        protected void query(CompletionResultSet completionResultSet, Document document, int i) {
            JToolTip toolTip = new JToolTip();
            toolTip.setTipText("Press Enter to insert \"" + getText() + "\"");
            completionResultSet.setToolTip(toolTip);
            completionResultSet.finish();
        }
    });
}
 
开发者ID:AlexFalappa,项目名称:nb-springboot,代码行数:13,代码来源:CfgPropCompletionItem.java

示例4: query

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入方法依赖的package包/类
@Override
protected void query(CompletionResultSet resultSet, Document doc, final int caretOffset) {
    final CancelSupportImplementation cs = CompletionCancelSupportImpl.create(this);
    SpiSupportAccessor.getInstance().setCancelSupport(cs);
    try {
        this.caretOffset = caretOffset;
        if (queryType == TOOLTIP_QUERY_TYPE || queryType == DOCUMENTATION_QUERY_TYPE || isJavaContext(component, caretOffset)) {
            results = null;
            isTruncated = false;
            isFilterable = true;
            documentation = null;
            toolTip = null;
            anchorOffset = -1;
            Source source = Source.create (doc);
            if (source == null) {
                FileObject fo = null;
                if (element != null) {
                    fo = element.getFileObject();
                    if (fo != null) {
                        source = Source.create (fo);
                    }
                }
            }
            //if (queryType == DOCUMENTATION_QUERY_TYPE && element != null) {
            //    FileObject fo = SourceUtils.getFile(element, js.getClasspathInfo());
            //    if (fo != null)
            //        js = Source.forFileObject(fo);
            //}
            if (source != null) {
                final Collection<Source> sources = Collections.<Source> singleton (source);
                final UserTask task = new UserTask () {
                    public void run (ResultIterator resultIterator) throws Exception {
                        Parser.Result result = resultIterator.getParserResult (caretOffset);
                        if(!(result instanceof ParserResult)) {
                            return ;
                        }
                        ParserResult parserResult = (ParserResult) result;
                        if (parserResult == null) {
                            return;
                        }
                        if ((queryType & COMPLETION_QUERY_TYPE) != 0) {
                            resolveCompletion(parserResult);
                        } else if (queryType == TOOLTIP_QUERY_TYPE) {
                            resolveToolTip(parserResult);
                        } else if (queryType == DOCUMENTATION_QUERY_TYPE) {
                            resolveDocumentation(parserResult);
                        }
                        GsfCompletionItem.tipProposal = null;
                    }
                };
                ParserManager.parse(sources, task);
                if ((queryType & COMPLETION_QUERY_TYPE) != 0) {
                    if (results != null)
                        resultSet.addAllItems(results);
                } else if (queryType == TOOLTIP_QUERY_TYPE) {
                    if (toolTip != null)
                        resultSet.setToolTip(toolTip);
                } else if (queryType == DOCUMENTATION_QUERY_TYPE) {
                    if (documentation != null)
                        resultSet.setDocumentation(documentation);
                }

                if (results != null && results.size() == 0) {
                    isFilterable = false;
                }

                if (anchorOffset > -1)
                    resultSet.setAnchorOffset(anchorOffset);
            }
        }
    } catch (ParseException ioe) {
        Exceptions.printStackTrace(ioe);
    } finally {
        try {
            resultSet.finish();
        } finally {
            SpiSupportAccessor.getInstance().removeCancelSupport(cs);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:81,代码来源:GsfCompletionProvider.java


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