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


Java TextInvocationContext.getOffset方法代码示例

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


在下文中一共展示了TextInvocationContext.getOffset方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: computeQuickAssistProposals

import org.eclipse.jface.text.source.TextInvocationContext; //导入方法依赖的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;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:17,代码来源:DwprofileQuickAssistProcessor.java

示例2: computeQuickAssistProposals

import org.eclipse.jface.text.source.TextInvocationContext; //导入方法依赖的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;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:17,代码来源:HyexpressionQuickAssistProcessor.java

示例3: computeQuickAssistProposals

import org.eclipse.jface.text.source.TextInvocationContext; //导入方法依赖的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;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:17,代码来源:HyvalidityformulaQuickAssistProcessor.java

示例4: computeQuickAssistProposals

import org.eclipse.jface.text.source.TextInvocationContext; //导入方法依赖的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;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:17,代码来源:HydatavalueQuickAssistProcessor.java

示例5: computeQuickAssistProposals

import org.eclipse.jface.text.source.TextInvocationContext; //导入方法依赖的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;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:17,代码来源:HymappingQuickAssistProcessor.java

示例6: computeQuickAssistProposals

import org.eclipse.jface.text.source.TextInvocationContext; //导入方法依赖的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.constraint.resource.hyconstraints.IHyconstraintsQuickFix> 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;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:17,代码来源:HyconstraintsQuickAssistProcessor.java

示例7: computeQuickAssistProposals

import org.eclipse.jface.text.source.TextInvocationContext; //导入方法依赖的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.mspl.manifest.resource.hymanifest.IHymanifestQuickFix> 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;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:17,代码来源:HymanifestQuickAssistProcessor.java

示例8: computeQuickAssistProposals

import org.eclipse.jface.text.source.TextInvocationContext; //导入方法依赖的package包/类
/** See: SpellingCorrectionProcessor (before was, XtextQuickAssistProcessor) */
	@Override
	public ICompletionProposal[] computeQuickAssistProposals(
			IQuickAssistInvocationContext invocationContext) {

		ISourceViewer viewer= invocationContext.getSourceViewer();
		int documentOffset= invocationContext.getOffset();

		int length= viewer != null ? viewer.getSelectedRange().y : -1;
		TextInvocationContext context= new TextInvocationContext(viewer, documentOffset, length);
		
		IAnnotationModel model = viewer.getAnnotationModel();
		if (model == null)
			return new ICompletionProposal[0]; 
		
		// From computeProposals
		int offset= context.getOffset();
		ArrayList<IMarker> annotationMarkers = new ArrayList<IMarker>();
		Iterator iter= model.getAnnotationIterator();
		while (iter.hasNext()) {
			Annotation annotation = (Annotation)iter.next();
			if (canFix(annotation)) {
				Position pos= model.getPosition(annotation);
				if (isAtPosition(offset, pos)) {
					collectMarkers(annotation, annotationMarkers);
				}
			}
		}

		List<ICompletionProposal> allProposals = new ArrayList<ICompletionProposal>();
		LinkedList<List<ICompletionProposal>> sortedProposals = new LinkedList<List<ICompletionProposal>>();
		
		for (IMarker iMarker : annotationMarkers) {
			ICompletionProposal[] qfixes = getQuickfixes(iMarker);
			
//			if ( qfixes.length > 0 && annotationMarkers.size() > 1 ) {
//				// There are quick fixes for several kinds of errors
//				allProposals.add(new ProposalCategory(iMarker));
//			}
			List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>(qfixes.length);

			if ( qfixes.length > 0 ) {
				proposals.add(new ProposalCategory(iMarker));
			}
			
			for (ICompletionProposal iCompletionProposal : qfixes) {
				proposals.add(iCompletionProposal);
			}
			
			sortedProposals.add(proposals);
		}
		sortedProposals.sort((l1, l2) -> -1 * Integer.compare(l1.size(), l2.size()));

		allProposals = sortedProposals.stream().flatMap(l -> l.stream()).collect(Collectors.toList());
		
		if ( allProposals.isEmpty() ) {
			// If there are no errors, then try the quick assist
			return computeQuickAssist(invocationContext, invocationContext.getOffset());
		} else {		
			return (ICompletionProposal[]) allProposals.toArray(new ICompletionProposal[allProposals.size()]);
		}
	}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:63,代码来源:AnalysisQuickfixProcessor.java


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