本文整理汇总了Java中org.eclipse.jface.text.contentassist.ICompletionProposal类的典型用法代码示例。如果您正苦于以下问题:Java ICompletionProposal类的具体用法?Java ICompletionProposal怎么用?Java ICompletionProposal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICompletionProposal类属于org.eclipse.jface.text.contentassist包,在下文中一共展示了ICompletionProposal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLineTagProposal
import org.eclipse.jface.text.contentassist.ICompletionProposal; //导入依赖的package包/类
private void createLineTagProposal(String prefix, N4JSDocletParser docletParser,
ArrayList<ICompletionProposal> proposals) {
int replacementOffset = offset - prefix.length();
// create line tag proposals
for (ITagDefinition td : docletParser.getLineTagDictionary().getTagDefinitions()) {
String tagString = '@' + td.getTitle() + ' ';
if (tagString.startsWith(prefix)) {
int replacementLength = prefix.length();
int cursorPosition = tagString.length();
ICompletionProposal proposal = new CompletionProposal(tagString, replacementOffset,
replacementLength, cursorPosition);
proposals.add(proposal);
}
}
}
示例2: getProposal
import org.eclipse.jface.text.contentassist.ICompletionProposal; //导入依赖的package包/类
/**
* Creates initial proposal adjusted for the N4JS imports. Then passes that proposal to the provided delegate
* proposal factory. Obtained ICompletionProposal is configured with a FQNImporter as custom text. applier.
*
* @param candidate
* for which proposal is created
* @param delegateProposalFactory
* delegate proposal factory
* @return code completion proposal
*/
private ICompletionProposal getProposal(IEObjectDescription candidate, EObject model,
IScope scope,
EReference reference,
ContentAssistContext context,
Predicate<IEObjectDescription> filter,
Function<IEObjectDescription, ICompletionProposal> delegateProposalFactory) {
final IEObjectDescription inputToUse = getAliasedDescription(candidate, reference, context);
final ICompletionProposal result = delegateProposalFactory.apply(inputToUse);
if (result instanceof ConfigurableCompletionProposal) {
final FQNImporter importer = fqnImporterFactory.create(
model.eResource(),
scope,
valueConverter,
filter,
context.getViewer());
((ConfigurableCompletionProposal) result).setTextApplier(importer);
}
return result;
}
示例3: computeCompletionProposals
import org.eclipse.jface.text.contentassist.ICompletionProposal; //导入依赖的package包/类
public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor monitor) {
List<ICompletionProposal> propList = new ArrayList<ICompletionProposal>();
List<ICompletionProposal> newpropList = new ArrayList<ICompletionProposal>();
List<IContextInformation> propList2 = new ArrayList<IContextInformation>();
ICompletionProposal first;
DataManager datamanger = new DataManager(context,monitor);
Activator.applyoperationlist.add(new ApplyOperation(ConsoleOperationListener2.ope.getStart(), ConsoleOperationListener2.ope.getAuthor(), ConsoleOperationListener2.ope.getFilePath(), propList));
List<String> list = new ArrayList();
CompletionProposal proposal;
propList = datamanger.JavaDefaultProposal();
propList2 = datamanger.ContextInformation();
ApplyOperation ao = new ApplyOperation(ConsoleOperationListener2.ope.getStart(), ConsoleOperationListener2.ope.getAuthor(), ConsoleOperationListener2.ope.getFilePath(), propList);
System.out.println(ao.toString());
return newpropList;
}
示例4: computeCompletionProposals
import org.eclipse.jface.text.contentassist.ICompletionProposal; //导入依赖的package包/类
@Override
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
IDocument document = viewer.getDocument();
if (document == null) {
return null;
}
String source = document.get();
Set<String> words = simpleWordCompletion.calculate(source, offset);
ICompletionProposal[] result = new ICompletionProposal[words.size()];
int i = 0;
for (String word : words) {
result[i++] = new SimpleWordProposal(document, offset, word);
}
return result;
}
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:19,代码来源:BatchEditorSimpleWordContentAssistProcessor.java
示例5: filterProposalsOnPrefix
import org.eclipse.jface.text.contentassist.ICompletionProposal; //导入依赖的package包/类
private void filterProposalsOnPrefix(String prefix, List<ICompletionProposal> props) {
if (prefix != null && prefix.trim().length() > 0) {
Iterator<ICompletionProposal> iterator = props.iterator();
String prefixLc = prefix.toLowerCase();
{
while (iterator.hasNext()) {
ICompletionProposal item = (ICompletionProposal) iterator.next();
String content = item.getDisplayString().toLowerCase(Locale.ENGLISH);
if (!content.toLowerCase(Locale.ENGLISH).startsWith(prefixLc)) {
iterator.remove();
}
}
}
}
}
示例6: buildProposals
import org.eclipse.jface.text.contentassist.ICompletionProposal; //导入依赖的package包/类
/**
* Constuit les propositions d'aucomplétion.
*
* @param suggestions Suggestionsà proposer.
* @param currentWordSelection Mot courant à remplacer dans le document.
* @return Propositions d'autocomplétion.
*/
private ICompletionProposal[] buildProposals(List<CompletionCandidate> suggestions, ITextSelection currentWordSelection) {
/* Calcul l'offset et la longueur du mot à remplacer dans le document. */
int replacementLength = currentWordSelection.getLength();
int replacementOffset = currentWordSelection.getOffset();
/* Construit les propositions en parcourant les suggestions. */
List<ICompletionProposal> proposals = new ArrayList<>();
for (CompletionCandidate suggestion : suggestions) {
/* String qui remplacera le mot courant. */
String replacementString = suggestion.getDisplayString();
/* String affiché comme libellé de la proposition. */
String displayString = replacementString;
/* String affiché comme description de la proposition (dans la boîte jaune). */
String additionalProposalInfo = suggestion.getAdditionalProposalInfo();
CompletionProposal proposal = new CompletionProposal(replacementString, replacementOffset, replacementLength, replacementString.length(), null,
displayString, null, additionalProposalInfo);
proposals.add(proposal);
}
return proposals.toArray(new ICompletionProposal[0]);
}
示例7: addProposals
import org.eclipse.jface.text.contentassist.ICompletionProposal; //导入依赖的package包/类
private void addProposals(List<ICompletionProposal> proposals, String prefix,
int replacementOffset, String type) {
Collection<IFile> files = null;
if (MetaModelPartitionScanner.META_MODEL_LOADMODEL.equals(type)) {
files = allEcoreFiles.values();
} else if (MetaModelPartitionScanner.META_MODEL_LOADINSTANCE.equals(type)) {
files = allFiles.values();
}
if (files == null)
return;
for (IFile iFile : files) {
String path = iFile.getFullPath().toString();
if (path.toLowerCase().startsWith(prefix.toLowerCase())
|| iFile.getName().toLowerCase().startsWith(prefix.toLowerCase())) {
proposals.add(new CompletionProposal(path, replacementOffset, prefix.length(),
path.length(), null, iFile.getName() + " - " + path, null, null));
}
}
}
示例8: adjustPriority
import org.eclipse.jface.text.contentassist.ICompletionProposal; //导入依赖的package包/类
@Override
protected void adjustPriority(ICompletionProposal proposal, String prefix, int priority) {
if (proposal == null || !(proposal instanceof ConfigurableCompletionProposal))
return;
ConfigurableCompletionProposal castedProposal = (ConfigurableCompletionProposal) proposal;
if (castedProposal.getPriority() != getDefaultPriority())
return;
int adjustedPriority = priority;
if (!Strings.isEmpty(prefix)) {
if (castedProposal.getReplacementString().equals(prefix))
adjustedPriority = (int) (adjustedPriority * sameTextMultiplier);
else if (castedProposal.getReplacementString().startsWith(prefix))
adjustedPriority = adjustedPriority * proposalWithPrefixMultiplier;
}
castedProposal.setPriority(adjustedPriority);
}
示例9: applied
import org.eclipse.jface.text.contentassist.ICompletionProposal; //导入依赖的package包/类
@Override
public void applied(ICompletionProposal proposal) {
if (DEBUG) {
debugCacheState("applied proposal-1");
}
/*
* after apply the model must be changed and cursor position
* normally changes as well! This often made problems
*/
IEditorPart activeEditor = EclipseUtil.getActiveEditor();
if (activeEditor instanceof AbstractGroovyBasedEditor) {
GradleEditor ge = (GradleEditor) activeEditor;
if (DEBUG) {
debugCacheState("applied proposal-2");
}
ge.rebuildOutline();
if (DEBUG) {
debugCacheState("applied proposal-3");
}
}
}
示例10: computeCompletionProposals
import org.eclipse.jface.text.contentassist.ICompletionProposal; //导入依赖的package包/类
@Override
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
try {
List<ICompletionProposal> completionProposals = new ArrayList<ICompletionProposal>();
IDocument document = viewer.getDocument();
String prefix = lastWord(document, offset);
String indent = lastIndent(document, offset);
// EiffelModel model = EiffelModel.getModel(document, null);
// model.getContentProposals(prefix, indent, offset, completionProposals);
return completionProposals.toArray(new ICompletionProposal[completionProposals.size()]);
} catch (Exception e) {
return NO_COMPLETIONS;
}
}
示例11: computeQuickAssistProposals
import org.eclipse.jface.text.contentassist.ICompletionProposal; //导入依赖的package包/类
public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext) {
ISourceViewer sourceViewer = invocationContext.getSourceViewer();
int offset = -1;
int length = 0;
if (invocationContext instanceof TextInvocationContext) {
TextInvocationContext textContext = (TextInvocationContext) invocationContext;
offset = textContext.getOffset();
length = textContext.getLength();
}
List<de.darwinspl.preferences.resource.dwprofile.IDwprofileQuickFix> quickFixes = getQuickFixes(sourceViewer, offset, length);
ICompletionProposal[] proposals = new ICompletionProposal[quickFixes.size()];
for (int i = 0; i < proposals.length; i++) {
proposals[i] = createCompletionProposal(sourceViewer, quickFixes.get(i));
}
return proposals;
}
示例12: computeQuickAssistProposals
import org.eclipse.jface.text.contentassist.ICompletionProposal; //导入依赖的package包/类
public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext) {
ISourceViewer sourceViewer = invocationContext.getSourceViewer();
int offset = -1;
int length = 0;
if (invocationContext instanceof TextInvocationContext) {
TextInvocationContext textContext = (TextInvocationContext) invocationContext;
offset = textContext.getOffset();
length = textContext.getLength();
}
List<eu.hyvar.feature.expression.resource.hyexpression.IHyexpressionQuickFix> quickFixes = getQuickFixes(sourceViewer, offset, length);
ICompletionProposal[] proposals = new ICompletionProposal[quickFixes.size()];
for (int i = 0; i < proposals.length; i++) {
proposals[i] = createCompletionProposal(sourceViewer, quickFixes.get(i));
}
return proposals;
}
示例13: computeQuickAssistProposals
import org.eclipse.jface.text.contentassist.ICompletionProposal; //导入依赖的package包/类
public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext) {
ISourceViewer sourceViewer = invocationContext.getSourceViewer();
int offset = -1;
int length = 0;
if (invocationContext instanceof TextInvocationContext) {
TextInvocationContext textContext = (TextInvocationContext) invocationContext;
offset = textContext.getOffset();
length = textContext.getLength();
}
List<eu.hyvar.context.contextValidity.resource.hyvalidityformula.IHyvalidityformulaQuickFix> quickFixes = getQuickFixes(sourceViewer, offset, length);
ICompletionProposal[] proposals = new ICompletionProposal[quickFixes.size()];
for (int i = 0; i < proposals.length; i++) {
proposals[i] = createCompletionProposal(sourceViewer, quickFixes.get(i));
}
return proposals;
}
示例14: computeQuickAssistProposals
import org.eclipse.jface.text.contentassist.ICompletionProposal; //导入依赖的package包/类
public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext) {
ISourceViewer sourceViewer = invocationContext.getSourceViewer();
int offset = -1;
int length = 0;
if (invocationContext instanceof TextInvocationContext) {
TextInvocationContext textContext = (TextInvocationContext) invocationContext;
offset = textContext.getOffset();
length = textContext.getLength();
}
List<eu.hyvar.dataValues.resource.hydatavalue.IHydatavalueQuickFix> quickFixes = getQuickFixes(sourceViewer, offset, length);
ICompletionProposal[] proposals = new ICompletionProposal[quickFixes.size()];
for (int i = 0; i < proposals.length; i++) {
proposals[i] = createCompletionProposal(sourceViewer, quickFixes.get(i));
}
return proposals;
}
示例15: computeQuickAssistProposals
import org.eclipse.jface.text.contentassist.ICompletionProposal; //导入依赖的package包/类
public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext) {
ISourceViewer sourceViewer = invocationContext.getSourceViewer();
int offset = -1;
int length = 0;
if (invocationContext instanceof TextInvocationContext) {
TextInvocationContext textContext = (TextInvocationContext) invocationContext;
offset = textContext.getOffset();
length = textContext.getLength();
}
List<eu.hyvar.feature.mapping.resource.hymapping.IHymappingQuickFix> quickFixes = getQuickFixes(sourceViewer, offset, length);
ICompletionProposal[] proposals = new ICompletionProposal[quickFixes.size()];
for (int i = 0; i < proposals.length; i++) {
proposals[i] = createCompletionProposal(sourceViewer, quickFixes.get(i));
}
return proposals;
}