• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CompletionProposalComparator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.jdt.ui.text.java.CompletionProposalComparator的典型用法代码示例。如果您正苦于以下问题:Java CompletionProposalComparator类的具体用法?Java CompletionProposalComparator怎么用?Java CompletionProposalComparator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CompletionProposalComparator类属于org.eclipse.jdt.ui.text.java包,在下文中一共展示了CompletionProposalComparator类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getJavaAnnotationFixes

import org.eclipse.jdt.ui.text.java.CompletionProposalComparator; //导入依赖的package包/类
private ICompletionProposal[] getJavaAnnotationFixes(IJavaAnnotation javaAnnotation) {
	ProblemLocation location= new ProblemLocation(position.getOffset(), position.getLength(), javaAnnotation);
	ICompilationUnit cu= javaAnnotation.getCompilationUnit();
	if (cu == null)
		return NO_PROPOSALS;

	ISourceViewer sourceViewer= null;
	if (viewer instanceof ISourceViewer)
		sourceViewer= (ISourceViewer) viewer;

	IInvocationContext context= new AssistContext(cu, sourceViewer, location.getOffset(), location.getLength(), SharedASTProvider.WAIT_ACTIVE_ONLY);
	if (!SpellingAnnotation.TYPE.equals(javaAnnotation.getType()) && !hasProblem(context.getASTRoot().getProblems(), location))
		return NO_PROPOSALS;

	ArrayList<IJavaCompletionProposal> proposals= new ArrayList<IJavaCompletionProposal>();
	JavaCorrectionProcessor.collectCorrections(context, new IProblemLocation[] { location }, proposals);
	Collections.sort(proposals, new CompletionProposalComparator());

	return proposals.toArray(new ICompletionProposal[proposals.size()]);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:ProblemHover.java


示例2: computeCompletionProposals

import org.eclipse.jdt.ui.text.java.CompletionProposalComparator; //导入依赖的package包/类
@Override
public ICompletionProposal[] computeCompletionProposals(
    ITextViewer textViewer, int documentPosition) {

  rememberJavaProject(textViewer.getDocument());
  addedDynamicWidgetProposals = false;

  DtdRemover dtdRemover = DtdRemover.create(textViewer, documentPosition);
  try {
    if (dtdRemover != null) {
      textViewer = dtdRemover.textViewer;
    }

    List<ICompletionProposal> proposals = getWstCompletionProposals(
        textViewer, documentPosition);
    if (proposals == null) {
      return null;
    }

    // Sort all of the proposals based on relevance and alphabet
    Collections.sort(proposals, new CompletionProposalComparator());

    if (addedDynamicWidgetProposals) {
      removeSchemaWidgetProposals(proposals, textViewer.getDocument());
    }

    removeSchemaUiBinderElementProposal(
        (IStructuredDocument) textViewer.getDocument(), proposals);

    return proposals.toArray(new ICompletionProposal[proposals.size()]);

  } finally {
    if (dtdRemover != null) {
      dtdRemover.release();
    }
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:38,代码来源:UiBinderXmlCompletionProcessor.java


示例3: StrutsTaglibCompletionProposalComputer

import org.eclipse.jdt.ui.text.java.CompletionProposalComparator; //导入依赖的package包/类
public StrutsTaglibCompletionProposalComputer() {
	strutsTaglibParser = new StrutsTaglibParser();
	strutsXmlParser = new StrutsXmlParser();
	annotationParser = new AnnotationParser();
	proposalComparator = new CompletionProposalComparator();
	proposalComparator.setOrderAlphabetically(true);
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:8,代码来源:StrutsTaglibCompletionProposalComputer.java


示例4: StrutsXmlCompletionProposalComputer

import org.eclipse.jdt.ui.text.java.CompletionProposalComparator; //导入依赖的package包/类
public StrutsXmlCompletionProposalComputer() {
	strutsXmlParser = new StrutsXmlParser();
	tilesXmlParser = new TilesXmlParser();
	proposalComparator = new CompletionProposalComparator();
	proposalComparator.setOrderAlphabetically(true);
	methodProposalComparator = new ActionMethodProposalComparator();
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:8,代码来源:StrutsXmlCompletionProposalComputer.java


示例5: JavaSourcePackageFragmentRootCompletionProcessor

import org.eclipse.jdt.ui.text.java.CompletionProposalComparator; //导入依赖的package包/类
public JavaSourcePackageFragmentRootCompletionProcessor() {
	fRoot= JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
	IPreferenceStore preferenceStore= JavaPlugin.getDefault().getPreferenceStore();
	String triggers= preferenceStore.getString(PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA);
	fProposalAutoActivationSet= triggers.toCharArray();
	fComparator= new CompletionProposalComparator();
	fLabelProvider= new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_SMALL_ICONS);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:JavaSourcePackageFragmentRootCompletionProcessor.java


示例6: JavaPackageFragmentRootCompletionProcessor

import org.eclipse.jdt.ui.text.java.CompletionProposalComparator; //导入依赖的package包/类
/**
 * Creates a <code>JavaPackageCompletionProcessor</code> to complete existing packages
 * in the context of <code>packageFragmentRoot</code>.
 *
 * @param packageFragmentRoot the context for package completion
 */
public JavaPackageFragmentRootCompletionProcessor(IPackageFragmentRoot packageFragmentRoot) {
	fPackageFragmentRoot= packageFragmentRoot;
	fComparator= new CompletionProposalComparator();

	IPreferenceStore preferenceStore= JavaPlugin.getDefault().getPreferenceStore();
	String triggers= preferenceStore.getString(PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA);
	fProposalAutoActivationSet = triggers.toCharArray();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:15,代码来源:JavaPackageFragmentRootCompletionProcessor.java


示例7: JavaPackageCompletionProcessor

import org.eclipse.jdt.ui.text.java.CompletionProposalComparator; //导入依赖的package包/类
/**
    * Creates a <code>JavaPackageCompletionProcessor</code>.
    * The Processor uses the given <code>ILabelProvider</code> to show text and icons for the
    * possible completions.
    * @param labelProvider Used for the popups.
    */
public JavaPackageCompletionProcessor(ILabelProvider labelProvider) {
	fComparator= new CompletionProposalComparator();
	fLabelProvider= labelProvider;

	IPreferenceStore preferenceStore= JavaPlugin.getDefault().getPreferenceStore();
	String triggers= preferenceStore.getString(PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA);
	fProposalAutoActivationSet = triggers.toCharArray();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:15,代码来源:JavaPackageCompletionProcessor.java


示例8: CUPositionCompletionProcessor

import org.eclipse.jdt.ui.text.java.CompletionProposalComparator; //导入依赖的package包/类
/**
 * Creates a <code>CUPositionCompletionProcessor</code>.
 * The completion context must be set via {@link #setCompletionContext(ICompilationUnit,String,String)}.
 * @param completionRequestor the completion requestor
 */
public CUPositionCompletionProcessor(CUPositionCompletionRequestor completionRequestor) {
	fCompletionRequestor= completionRequestor;

	fComparator= new CompletionProposalComparator();
	IPreferenceStore preferenceStore= JavaPlugin.getDefault().getPreferenceStore();
	String triggers= preferenceStore.getString(PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA);
	fProposalAutoActivationSet = triggers.toCharArray();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:CUPositionCompletionProcessor.java


示例9: computeQuickAssistProposals

import org.eclipse.jdt.ui.text.java.CompletionProposalComparator; //导入依赖的package包/类
public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext quickAssistContext) {
	ISourceViewer viewer= quickAssistContext.getSourceViewer();
	int documentOffset= quickAssistContext.getOffset();

	IEditorPart part= fAssistant.getEditor();

	ICompilationUnit cu= JavaUI.getWorkingCopyManager().getWorkingCopy(part.getEditorInput());
	IAnnotationModel model= JavaUI.getDocumentProvider().getAnnotationModel(part.getEditorInput());

	AssistContext context= null;
	if (cu != null) {
		int length= viewer != null ? viewer.getSelectedRange().y : 0;
		context= new AssistContext(cu, viewer, part, documentOffset, length);
	}
	
	Annotation[] annotations= fAssistant.getAnnotationsAtOffset();

	fErrorMessage= null;

	ICompletionProposal[] res= null;
	if (model != null && context != null && annotations != null) {
		ArrayList<IJavaCompletionProposal> proposals= new ArrayList<IJavaCompletionProposal>(10);
		IStatus status= collectProposals(context, model, annotations, true, !fAssistant.isUpdatedOffset(), proposals);
		res= proposals.toArray(new ICompletionProposal[proposals.size()]);
		if (!status.isOK()) {
			fErrorMessage= status.getMessage();
			JavaPlugin.log(status);
		}
	}

	if (res == null || res.length == 0) {
		return new ICompletionProposal[] { new ChangeCorrectionProposal(CorrectionMessages.NoCorrectionProposal_description, new NullChange(""), IProposalRelevance.NO_SUGGESSTIONS_AVAILABLE, null) }; //$NON-NLS-1$
	}
	if (res.length > 1) {
		Arrays.sort(res, new CompletionProposalComparator());
	}
	return res;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:39,代码来源:JavaCorrectionProcessor.java


示例10: internalGetResolutions

import org.eclipse.jdt.ui.text.java.CompletionProposalComparator; //导入依赖的package包/类
private static IMarkerResolution[] internalGetResolutions(IMarker marker) {
	if (!internalHasResolutions(marker)) {
		return NO_RESOLUTIONS;
	}

	ICompilationUnit cu= getCompilationUnit(marker);
	if (cu != null) {
		IEditorInput input= EditorUtility.getEditorInput(cu);
		if (input != null) {
			IProblemLocation location= findProblemLocation(input, marker);
			if (location != null) {

				IInvocationContext context= new AssistContext(cu,  location.getOffset(), location.getLength());
				if (!hasProblem (context.getASTRoot().getProblems(), location))
					return NO_RESOLUTIONS;

				ArrayList<IJavaCompletionProposal> proposals= new ArrayList<IJavaCompletionProposal>();
				JavaCorrectionProcessor.collectCorrections(context, new IProblemLocation[] { location }, proposals);
				Collections.sort(proposals, new CompletionProposalComparator());

				int nProposals= proposals.size();
				IMarkerResolution[] resolutions= new IMarkerResolution[nProposals];
				for (int i= 0; i < nProposals; i++) {
					resolutions[i]= new CorrectionMarkerResolution(context.getCompilationUnit(), location.getOffset(), location.getLength(), proposals.get(i), marker);
				}
				return resolutions;
			}
		}
	}
	return NO_RESOLUTIONS;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:32,代码来源:CorrectionMarkerResolutionGenerator.java


示例11: computeQuickAssistProposals

import org.eclipse.jdt.ui.text.java.CompletionProposalComparator; //导入依赖的package包/类
public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext quickAssistContext) {
	ISourceViewer viewer= quickAssistContext.getSourceViewer();
	int documentOffset= quickAssistContext.getOffset();

	IEditorPart part= fAssistant.getEditor();

	ICompilationUnit cu= JavaUI.getWorkingCopyManager().getWorkingCopy(part.getEditorInput());
	IAnnotationModel model= JavaUI.getDocumentProvider().getAnnotationModel(part.getEditorInput());

	AssistContext context= null;
	if (cu != null) {
		int length= viewer != null ? viewer.getSelectedRange().y : 0;
		context= new AssistContext(cu, viewer, part, documentOffset, length);
	}
	
	Annotation[] annotations= fAssistant.getAnnotationsAtOffset();

	fErrorMessage= null;

	ICompletionProposal[] res= null;
	if (model != null && context != null && annotations != null) {
		ArrayList<IJavaCompletionProposal> proposals= new ArrayList<IJavaCompletionProposal>(10);
		IStatus status= collectProposals(context, model, annotations, true, !fAssistant.isUpdatedOffset(), proposals);
		res= proposals.toArray(new ICompletionProposal[proposals.size()]);
		if (!status.isOK()) {
			fErrorMessage= status.getMessage();
			JavaPlugin.log(status);
		}
	}

	if (res == null || res.length == 0) {
		return new ICompletionProposal[] { new ChangeCorrectionProposal(CorrectionMessages.NoCorrectionProposal_description, new NullChange(""), 0, null) }; //$NON-NLS-1$
	}
	if (res.length > 1) {
		Arrays.sort(res, new CompletionProposalComparator());
	}
	return res;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:39,代码来源:JavaCorrectionProcessor.java


示例12: createAttrCompletionProposals

import org.eclipse.jdt.ui.text.java.CompletionProposalComparator; //导入依赖的package包/类
public static List<ICompletionProposal> createAttrCompletionProposals(
		String[][] proposalsData, String prefix, IRegion region,
		String valueSeparator, String attrvalue,
		CompletionProposalComparator proposalComparator) {
	List<ICompletionProposal> list = new ArrayList<ICompletionProposal>();
	if (proposalsData != null && region != null) {
		ElementRegion parsedValue = ParseUtil.parseElementValue(attrvalue,
				prefix, valueSeparator, region.getOffset());

		List<String> excludes = new ArrayList<String>();
		// multivalue
		if (valueSeparator != null && !valueSeparator.isEmpty()
				&& attrvalue.contains(valueSeparator)) {
			// exclude already defined values except current value
			String[] valArr = attrvalue.split(valueSeparator);
			for (String val : valArr) {
				if (!parsedValue.getValue().equalsIgnoreCase(val.trim())) {
					excludes.add(val.trim());
				}
			}
		}

		// if first contains '/' assume all proposals are paths
		boolean pathLike = proposalsData[0][0].contains("/");

		String prefixLowCase = parsedValue.getName().toLowerCase(
				Locale.ROOT);
		if (pathLike && !prefixLowCase.isEmpty()
				&& prefixLowCase.charAt(0) != '/') {
			prefixLowCase = "/" + prefixLowCase;
		}

		for (String[] proposal : proposalsData) {
			String propLowCase = proposal[0].toLowerCase(Locale.ROOT);
			if (!excludes.contains(proposal[0])
					&& (propLowCase.startsWith(prefixLowCase) || (pathLike && propLowCase
							.contains(prefixLowCase)))) {
				list.add(new CompletionProposal(proposal[0], parsedValue
						.getValueRegion().getOffset(), parsedValue
						.getValueRegion().getLength(),
						proposal[0].length(), null, null, null, proposal[1]));
			}
		}
	}

	if (proposalComparator != null) {
		Collections.sort(list, proposalComparator);
	}

	return list;
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:52,代码来源:CompletionProposalHelper.java


示例13: StrutsValidatorsXmlCompletionProposalComputer

import org.eclipse.jdt.ui.text.java.CompletionProposalComparator; //导入依赖的package包/类
public StrutsValidatorsXmlCompletionProposalComputer() {
	strutsValidatorsXmlParser = new StrutsValidatorsXmlParser();
	proposalComparator = new CompletionProposalComparator();
	proposalComparator.setOrderAlphabetically(true);
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:6,代码来源:StrutsValidatorsXmlCompletionProposalComputer.java


示例14: TilesXmlCompletionProposalComputer

import org.eclipse.jdt.ui.text.java.CompletionProposalComparator; //导入依赖的package包/类
public TilesXmlCompletionProposalComputer() {
	tilesXmlParser = new TilesXmlParser();
	proposalComparator = new CompletionProposalComparator();
	proposalComparator.setOrderAlphabetically(true);
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:6,代码来源:TilesXmlCompletionProposalComputer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ParametersWithSalt类代码示例发布时间:2022-05-23
下一篇:
Java JSONException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap