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


Java CompletionResultSet.finish方法代码示例

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


在下文中一共展示了CompletionResultSet.finish方法的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: 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

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

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

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

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

示例8: 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) {
            if(docText != null) {
                CompletionDocumentation documentation = SpringXMLConfigCompletionDoc.getAttribValueDoc(docText);
                resultSet.setDocumentation(documentation);
            }
            resultSet.finish();
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:SpringXMLConfigCompletionItem.java

示例9: filter

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入方法依赖的package包/类
@Override
protected void filter(CompletionResultSet resultSet) {
    CompletionContext context = new CompletionContext(component.getDocument(), 
            component.getCaretPosition(), queryType);
    SpringCompletionResult springCompletionResult = completor.filter(context);
    populateResultSet(resultSet, springCompletionResult);
    resultSet.finish();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:SpringXMLConfigCompletionProvider.java

示例10: query

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入方法依赖的package包/类
@Override
protected void query(CompletionResultSet resultSet, Document doc, int caretOffset) {
    List<HibernateCompletionItem> completionItems = new ArrayList<HibernateCompletionItem>();
    int anchorOffset = getCompletionItems(doc, caretOffset, completionItems);
    resultSet.addAllItems(completionItems);
    if(anchorOffset != -1) {
        resultSet.setAnchorOffset(anchorOffset);
    }
    
    resultSet.finish();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:HibernateRevengCompletionQuery.java

示例11: query

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入方法依赖的package包/类
@Override
protected void query(CompletionResultSet resultSet, final Document doc, final int caretOffset) {
    doQuery(SQLCompletionEnv.forDocument(doc, caretOffset));
    if (items != null) {
        items.fill(resultSet);
    }
    if (anchorOffset != -1) {
        resultSet.setAnchorOffset(env.getStatementOffset() + anchorOffset);
    }
    resultSet.finish();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:SQLCompletionQuery.java

示例12: 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) {
            if (docText != null) {
                CompletionDocumentation documentation = HibernateCompletionDocumentation.getAttribValueDoc(docText);
                resultSet.setDocumentation(documentation);
            }
            resultSet.finish();
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:HibernateCompletionItem.java

示例13: query

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入方法依赖的package包/类
@Override
        public void query(CompletionResultSet resultSet) {
            String cmd = "/" + command + " ";
            String doc = shellTool.commandDocumentation(cmd, cmd.length(), false);
////COMMENTED BY MERGE
//=======
//            String doc = session.getJShellTool().commandDocumentation(cmd, cmd.length(), false);
//>>>>>>> merge rev
            if (doc == null) {
                resultSet.finish();
                return;
            }
            String[] lines = doc.split("\n");   // NOI18N
            StringBuilder htmlStringContents = new StringBuilder();
            String match = "^/" + command;
            Pattern p = Pattern.compile(match);
            boolean paragraph = false;
            for (String l : lines) {
                String l2 = l.trim();
                if (l2.isEmpty() && !paragraph) {
                    htmlStringContents.append("<p/>"); // NOI18N
                    paragraph = true;
                } else {
                    paragraph = false;
                }
                if (p.matcher(l).find()) {
                    htmlStringContents.append("<code><pre><b>").append(l).append("</b></pre></code><br/>"); // NOI18N
                } else {
                    String emphasis = l.replaceAll("(/\\p{Alpha}+)", "<code><i><u>$1</u></i><code>");
                    htmlStringContents.append(emphasis).append(" "); // NOI18N
                }
            }
            this.htmlText = htmlStringContents.toString();
            
            resultSet.setDocumentation(this);
            resultSet.finish();
        }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:CommandCompletionProvider.java

示例14: query

import org.netbeans.spi.editor.completion.CompletionResultSet; //导入方法依赖的package包/类
@Override
protected void query(CompletionResultSet resultSet, Document doc, int caretOffset) {
    if (model.getDocument() != doc) {
        resultSet.finish();
        return;
    }
    int b = input.getPartBegin();
    if (caretOffset < b) {
        resultSet.finish();
        return;
    }
    String prefix = "";
    try {
        prefix = doc.getText(b, (caretOffset - b));
    } catch (BadLocationException ex) {
    }
    final String fPrefix = prefix;
    ShellHistory  h = session.getEnv().getLookup().lookup(ShellHistory.class);
    resultSet.addAllItems(
            session.historyItems().stream().
                    filter(i -> i.getContents().startsWith(fPrefix)).
                    map(this::createCurrentItem).
                    collect(Collectors.toList())
    );
    if (h != null) {
        final Set<String> commands = new HashSet<>();
        resultSet.addAllItems(
                h.getHistory().stream().
                filter(i -> 
                        i.getContents().startsWith(fPrefix) &&
                        commands.add(i.getContents())
                ).
                map(this::createHistoryItem).
                collect(Collectors.toList()));
    }
    resultSet.finish();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:HistoryCompletionProvider.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 completionResultSet, Document document, int i) {
            completionResultSet
                    .setDocumentation(new CfgPropCompletionDocumentation(CfgPropCompletionItem.this, bootService));
            completionResultSet.finish();
        }
    });
}
 
开发者ID:AlexFalappa,项目名称:nb-springboot,代码行数:12,代码来源:CfgPropCompletionItem.java


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