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