本文整理汇总了Java中org.eclipse.jface.text.contentassist.ContextInformation类的典型用法代码示例。如果您正苦于以下问题:Java ContextInformation类的具体用法?Java ContextInformation怎么用?Java ContextInformation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContextInformation类属于org.eclipse.jface.text.contentassist包,在下文中一共展示了ContextInformation类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: computeContextInformation
import org.eclipse.jface.text.contentassist.ContextInformation; //导入依赖的package包/类
public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset)
{
// Retrieve selected range
Point selectedRange = viewer.getSelectedRange();
if (selectedRange.y > 0)
{
// Text is selected. Create a context information array.
ContextInformation[] contextInfos = new ContextInformation[ITLAReserveredWords.ALL_WORDS_ARRAY.length];
// Create one context information item for each style
for (int i = 0; i < ITLAReserveredWords.ALL_WORDS_ARRAY.length; i++)
contextInfos[i] = new ContextInformation(null, ITLAReserveredWords.ALL_WORDS_ARRAY[i] + " Style");
return contextInfos;
}
return new ContextInformation[0];
}
开发者ID:tlaplus,项目名称:tlaplus,代码行数:17,代码来源:TLACompletionProcessor.java
示例2: computeCompletionProposals
import org.eclipse.jface.text.contentassist.ContextInformation; //导入依赖的package包/类
@Override
public ICompletionProposal[] computeCompletionProposals(
ITextViewer viewer, int offset) {
List<ICompletionProposal> proposals = new ArrayList<>();
for (String[] texts : PROPOSAL_TEXTS) {
String replacement = texts[0];
String text = texts[1];
CompletionProposal proposal =
new CompletionProposal(replacement,
offset,
replacement.length(),
replacement.length(),
null,
text,
new ContextInformation(replacement, text),
null);
proposals.add(proposal);
}
return proposals.toArray(new ICompletionProposal[proposals.size()]);
}
开发者ID:RichardBirenheide,项目名称:brainfuck,代码行数:21,代码来源:BfKeywordCompletionProposal.java
示例3: computeContextInformation
import org.eclipse.jface.text.contentassist.ContextInformation; //导入依赖的package包/类
public IContextInformation[] computeContextInformation( ITextViewer viewer, int documentOffset){
// viewer.getSelectedRange();
// if (selectedRange.y > 0) Text is selected. Create a context information array.
// ContextInformation[] contextInfos = new
// ContextInformation[STYLELABELS.length];
// // Create one context information item for each style
// for (int i = 0; i < STYLELABELS.length; i++)
// contextInfos[i] = new ContextInformation("<" + STYLETAGS[i] + ">",
// STYLELABELS[i] + " Style");
// return contextInfos;
// }
return new ContextInformation[0];
}
开发者ID:nextinterfaces,项目名称:http4e,代码行数:14,代码来源:HContentAssistProcessor.java
示例4: getStyleContext
import org.eclipse.jface.text.contentassist.ContextInformation; //导入依赖的package包/类
/**
* Returns the style context.
*
* @return Array of style contexts
*/
public IContextInformation[] getStyleContext() {
ContextInformation[] contextInfos = new ContextInformation[STYLELABELS.length];
// Create one context information item for each style
for (int i = 0; i < STYLELABELS.length; i++) {
contextInfos[i] = new ContextInformation(null, STYLELABELS[i]+" Style");
}
return contextInfos;
}
开发者ID:eclipse,项目名称:texlipse,代码行数:15,代码来源:TexStyleCompletionManager.java
示例5: computeContextInformation
import org.eclipse.jface.text.contentassist.ContextInformation; //导入依赖的package包/类
public IContextInformation[] computeContextInformation(ITextViewer viewer,
int offset) {
// FIXME -- for testing
// Retrieve selected range
Point selectedRange = viewer.getSelectedRange();
if (selectedRange.y > 0) {
if (styleManager == null) {
styleManager = TexStyleCompletionManager.getInstance();
}
return styleManager.getStyleContext();
}
return new ContextInformation[0];
}
开发者ID:eclipse,项目名称:texlipse,代码行数:16,代码来源:TexCompletionProcessor.java
示例6: createContextInformation
import org.eclipse.jface.text.contentassist.ContextInformation; //导入依赖的package包/类
private IContextInformation createContextInformation() {
try {
String information = null;
List<CompletionEntryDetails> entryDetails = super.getEntryDetails();
if (entryDetails == null || entryDetails.size() < 1) {
return null;
}
if (isFunction()) {
information = TypeScriptHelper.extractFunctionParameters(entryDetails.get(0).getDisplayParts());
}
return information != null ? new ContextInformation("", information) : null;
} catch (TypeScriptException e) {
}
return null;
}
开发者ID:angelozerr,项目名称:typescript.java,代码行数:16,代码来源:TypeScriptCompletionProposal.java
示例7: newCompletionProposal
import org.eclipse.jface.text.contentassist.ContextInformation; //导入依赖的package包/类
private CompletionProposal newCompletionProposal(final String proposal, final String displayName, final int documentOffset, final int qlen, final String imageID, final int offset, final String description)
{
final Image image = JavaUI.getSharedImages().getImage(imageID);
final IContextInformation contextInformation = new ContextInformation(proposal, description);
return new CompletionProposal(proposal, documentOffset - qlen, qlen, proposal.length() - (-offset), image, displayName, contextInformation, description);
}
开发者ID:nullquery,项目名称:BYONDclipse,代码行数:8,代码来源:DMContentAssistProcessor.java
示例8: computeCompletionProposals
import org.eclipse.jface.text.contentassist.ContextInformation; //导入依赖的package包/类
@Override
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
int offset) {
String part;
try {
part = viewer.getDocument().get(0, offset);
} catch (BadLocationException ex) {
Log.log(Log.LOG_ERROR, "Document doesn't contain such offset", ex); //$NON-NLS-1$
return null;
}
int nonid = offset - 1;
while (nonid > 0 && PgDiffUtils.isValidIdChar(part.charAt(nonid))) {
--nonid;
}
String text = part.substring(nonid + 1, offset);
List<ICompletionProposal> result = new LinkedList<>();
List<ICompletionProposal> partResult = new LinkedList<>();
PgDbParser parser = editor.getParser();
Stream<PgObjLocation> loc = parser.getAllObjDefinitions();
loc
.filter(o -> text.isEmpty() || o.getObjName().startsWith(text))
.filter(o -> o.getObjType() != DbObjType.SEQUENCE && o.getObjType() != DbObjType.INDEX)
.sorted((o1, o2) -> o1.getFilePath().compareTo(o2.getFilePath()))
.forEach(obj -> {
Image img = Activator.getDbObjImage(obj.getObjType());
String displayText = obj.getObjName();
if (!obj.getComment().isEmpty()) {
displayText += " - " + obj.getComment(); //$NON-NLS-1$
}
IContextInformation info = new ContextInformation(
obj.getObjName(), obj.getComment());
if (!text.isEmpty()) {
result.add(new CompletionProposal(obj.getObjName(), offset - text.length(),
text.length(), obj.getObjLength(), img, displayText, info,
obj.getObjName()));
} else {
result.add(new CompletionProposal(obj.getObjName(), offset, 0,
obj.getObjLength(), img, displayText, info, obj.getObjName()));
}
});
// SQL Templates + Keywords
if (text.isEmpty()) {
keywords.forEach(k -> result.add(new CompletionProposal(k, offset, 0, k.length())));
result.addAll(new SQLEditorTemplateAssistProcessor().getAllTemplates(viewer, offset));
} else {
String textUpper = text.toUpperCase();
for (String keyword : keywords) {
int location = keyword.indexOf(textUpper);
if (location != -1) {
CompletionProposal proposal = new CompletionProposal(keyword + ' ',
offset - text.length(), text.length(), keyword.length() + 1);
if (location == 0) {
result.add(proposal);
} else {
partResult.add(proposal);
}
}
}
result.addAll(partResult);
ICompletionProposal[] templates = new SQLEditorTemplateAssistProcessor()
.computeCompletionProposals(viewer, offset);
if (templates != null) {
result.addAll(Arrays.asList(templates));
}
}
return result.toArray(new ICompletionProposal[result.size()]);
}
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:74,代码来源:SQLEditorCompletionProcessor.java
示例9: getStyleCompletions
import org.eclipse.jface.text.contentassist.ContextInformation; //导入依赖的package包/类
/**
* Returns the style completion proposals
*
* @param selectedText The selected text
* @param selectedRange The selected range
* @return An array of completion proposals
*/
public ICompletionProposal[] getStyleCompletions(String selectedText, Point selectedRange) {
/*
ICompletionProposal[] result = new ICompletionProposal[keyValue.size()];
int i=0;
for (Iterator iter = keyValue.keySet().iterator(); iter.hasNext();) {
String key = (String) iter.next();
String value = (String) keyValue.get(key);
String replacement = "{" + key + " " + selectedText + "}";
int cursor = key.length() + 2;
IContextInformation contextInfo = new ContextInformation(null, value+" Style");
result[i] = new CompletionProposal(replacement,
selectedRange.x, selectedRange.y,
cursor, null, value,
contextInfo, replacement);
i++;
}
*/
ICompletionProposal[] result = new ICompletionProposal[STYLELABELS.length];
// Loop through all styles
for (int i = 0; i < STYLETAGS.length; i++) {
String tag = STYLETAGS[i];
// Compute replacement text
String replacement = tag + selectedText + "}";
// Derive cursor position
int cursor = tag.length() + selectedText.length() + 1;
// Compute a suitable context information
IContextInformation contextInfo =
new ContextInformation(null, STYLELABELS[i]+" Style");
// Construct proposal
result[i] = new CompletionProposal(replacement,
selectedRange.x, selectedRange.y,
cursor, null, STYLELABELS[i],
contextInfo, replacement);
}
return result;
}
开发者ID:eclipse,项目名称:texlipse,代码行数:52,代码来源:TexStyleCompletionManager.java
示例10: computeContextInformation
import org.eclipse.jface.text.contentassist.ContextInformation; //导入依赖的package包/类
@Override public IContextInformation[] computeContextInformation(final ITextViewer viewer,
final int documentOffset) {
ContextInformation[] info = new ContextInformation[0];
return info;
}
开发者ID:apache,项目名称:syncope,代码行数:6,代码来源:HTMLCompletionProcessor.java
示例11: computeContextInformation
import org.eclipse.jface.text.contentassist.ContextInformation; //导入依赖的package包/类
@Override public IContextInformation[] computeContextInformation(final ITextViewer viewer, final int documentOffset) { return new ContextInformation[0]; }
开发者ID:nullquery,项目名称:BYONDclipse,代码行数:2,代码来源:DMContentAssistProcessor.java
注:本文中的org.eclipse.jface.text.contentassist.ContextInformation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论