本文整理汇总了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();
}
示例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();
}
示例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;
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
});
}
示例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();
}
});
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
});
}
示例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();
}
示例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();
}
示例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();
}
});
}