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

Java SimpleMarkerAnnotation类代码示例

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

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



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

示例1: hasCorrections

import org.eclipse.ui.texteditor.SimpleMarkerAnnotation; //导入依赖的package包/类
public static boolean hasCorrections(Annotation annotation) {
	if (annotation instanceof IJavaAnnotation) {
		IJavaAnnotation javaAnnotation= (IJavaAnnotation) annotation;
		int problemId= javaAnnotation.getId();
		if (problemId != -1) {
			ICompilationUnit cu= javaAnnotation.getCompilationUnit();
			if (cu != null) {
				return hasCorrections(cu, problemId, javaAnnotation.getMarkerType());
			}
		}
	}
	if (annotation instanceof SimpleMarkerAnnotation) {
		return hasCorrections(((SimpleMarkerAnnotation) annotation).getMarker());
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:JavaCorrectionProcessor.java


示例2: addAnnotation

import org.eclipse.ui.texteditor.SimpleMarkerAnnotation; //导入依赖的package包/类
public static void addAnnotation(IMarker marker, ITextEditor editor,
		String annotation, int offset, int length) {
	// The DocumentProvider enables to get the document currently loaded in
	// the editor
	IDocumentProvider idp = editor.getDocumentProvider();

	// This is the document we want to connect to. This is taken from the
	// current editor input.
	IDocument document = idp.getDocument(editor.getEditorInput());

	// The IannotationModel enables to add/remove/change annotation to a
	// Document loaded in an Editor
	IAnnotationModel iamf = idp.getAnnotationModel(editor.getEditorInput());

	// Note: The annotation type id specify that you want to create one of
	// your annotations
	String an = "";
	if (annotation.equals("1")) {
		an = ANNOTATION_COLOR1;
	} else if (annotation.equals("2")) {
		an = ANNOTATION_COLOR2;
	} else if (annotation.equals("3")) {
		an = ANNOTATION_COLOR3;
	}
	SimpleMarkerAnnotation ma = new SimpleMarkerAnnotation(an, marker);

	// Finally add the new annotation to the model
	iamf.connect(document);
	iamf.addAnnotation(ma, new Position(offset, length));
	iamf.disconnect(document);
}
 
开发者ID:1Tristan,项目名称:VariantSync,代码行数:32,代码来源:CodeMarkerFactory.java


示例3: compare

import org.eclipse.ui.texteditor.SimpleMarkerAnnotation; //导入依赖的package包/类
public int compare(Annotation o1, Annotation o2)
{
	if (o1 instanceof SimpleMarkerAnnotation && o2 instanceof SimpleMarkerAnnotation)
	{
		// Compare the marker offset first. In case it was not set with an offset, compare via the line numbers.
		IMarker m1 = ((SimpleMarkerAnnotation) o1).getMarker();
		IMarker m2 = ((SimpleMarkerAnnotation) o2).getMarker();
		if (m1 != null && m2 != null)
		{
			// try comparing by offset
			int pos1 = m1.getAttribute(IMarker.CHAR_START, -1);
			int pos2 = m2.getAttribute(IMarker.CHAR_START, -1);
			if (pos1 > -1 && pos2 > -1)
			{
				return pos1 - pos2;
			}
			// in case one of the char-start values was not set, try comparing using the line number
			pos1 = m1.getAttribute(IMarker.LINE_NUMBER, -1);
			pos2 = m2.getAttribute(IMarker.LINE_NUMBER, -1);
			if (pos1 > -1 && pos2 > -1)
			{
				return pos1 - pos2;
			}
		}
	}
	// just return 0, as we can't really compare those.
	return 0;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:29,代码来源:CommonAnnotationHover.java


示例4: collectMarkerProposals

import org.eclipse.ui.texteditor.SimpleMarkerAnnotation; //导入依赖的package包/类
private static void collectMarkerProposals(SimpleMarkerAnnotation annotation, Collection<IJavaCompletionProposal> proposals) {
	IMarker marker= annotation.getMarker();
	IMarkerResolution[] res= IDE.getMarkerHelpRegistry().getResolutions(marker);
	if (res.length > 0) {
		for (int i= 0; i < res.length; i++) {
			proposals.add(new MarkerResolutionProposal(res[i], marker));
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:JavaCorrectionProcessor.java


示例5: createLocationAnnotation

import org.eclipse.ui.texteditor.SimpleMarkerAnnotation; //导入依赖的package包/类
/**
 * Create a new source location annotation.
 *
 * @param marker
 *            The marker to assign to the annotation.
 * @param selection
 *            The selection to highlight.
 * @param editor
 *            The editor to set the annotations in.
 * @param variant
 *            The variant to decide about the marker presentation.
 */
private void createLocationAnnotation(IMarker marker, ITextSelection selection, ITextEditor editor, Variant variant) {

    IDocumentProvider idp = editor.getDocumentProvider();
    IEditorInput editorInput = editor.getEditorInput();
    
    IDocument document = idp.getDocument(editorInput);
    IAnnotationModel annotationModel = idp.getAnnotationModel(editorInput);

    String annotationType = getAnnotationType(variant);
    SimpleMarkerAnnotation annotation = new SimpleMarkerAnnotation(annotationType, marker);
    annotationModel.connect(document);
    annotationModel.addAnnotation(annotation, new Position(selection.getOffset(), selection.getLength()));
    annotationModel.disconnect(document);        
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:27,代码来源:JavaEditorConnector.java


示例6: createAnnotation

import org.eclipse.ui.texteditor.SimpleMarkerAnnotation; //导入依赖的package包/类
/**
 * Creates the corresponding annotation for a given marker according to the given marker type.
 * 
 * @param marker the given marker.
 * @param selection the selection to highlight.
 * @param editor the underlying editor.
 * @param markerType the given marker type.
 */
private void createAnnotation(IMarker marker, ITextSelection selection, ITextEditor editor, MarkerType markerType) {
    IDocumentProvider idp = editor.getDocumentProvider();
    IDocument document = idp.getDocument(editorInput);
    IAnnotationModel annotationModel = idp.getAnnotationModel(editorInput);
    String annotationType = UIConstants.ANNOTATION_TO_ID.get(markerType);
    SimpleMarkerAnnotation annotation = new SimpleMarkerAnnotation(annotationType, marker);
    annotationModel.connect(document);
    annotationModel.addAnnotation(annotation, new Position(selection.getOffset(), selection.getLength()));
    annotationModel.disconnect(document);        
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:19,代码来源:UnifiedDiffHighlighter.java


示例7: isIncluded

import org.eclipse.ui.texteditor.SimpleMarkerAnnotation; //导入依赖的package包/类
private boolean isIncluded(Annotation annotation) {
	if(annotation instanceof SimpleMarkerAnnotation){
		SimpleMarkerAnnotation markerannotation = (SimpleMarkerAnnotation)annotation;
		return markerannotation.getMarker().exists() 
				&& RustBuilder.isRustMarker(markerannotation.getMarker());
	}
	return false;
}
 
开发者ID:peq,项目名称:rustyeclipse,代码行数:9,代码来源:RustTextHover.java


示例8: addAnnotation

import org.eclipse.ui.texteditor.SimpleMarkerAnnotation; //导入依赖的package包/类
/*******************************************************
 * Adds an annotation of the specified type to the specified marker in the
 * specified editor.
 * 
 * @param editor
 *            The text editor in which text will be annotated.
 * @param marker
 *            The marker that will be used for annotation.
 * @param annotationType
 *            The type of the annotation as specified in the Manifest file.
 * @param startPos
 *            The starting position of the text to annotate.
 * @param length
 *            The length of the text to annotate
 *******************************************************/
public static void addAnnotation(ITextEditor editor, IMarker marker, String annotationType, int startPos, int length)
{
	if (editor == null || marker == null || annotationType == null)
		throw new IllegalArgumentException();

	if (startPos < 0 || length <= 0)
		throw new IllegalArgumentException("Invalid marker positions!");

	// The DocumentProvider enables to get the document currently loaded in
	// the editor
	IDocumentProvider docProvider = editor.getDocumentProvider();

	// This is the document we want to connect to. This is taken from
	// the current editor input.
	IDocument document = docProvider.getDocument(editor.getEditorInput());

	// The IannotationModel enables to add/remove/change annotation to a
	// Document loaded in an Editor
	IAnnotationModel annotationModel = docProvider.getAnnotationModel(editor.getEditorInput());

	// Note: The annotation type id specify that you want to create one of
	// your annotations
	SimpleMarkerAnnotation markerAnnotation = new SimpleMarkerAnnotation(annotationType, marker);

	// Finally add the new annotation to the model
	annotationModel.connect(document);
	annotationModel.addAnnotation(markerAnnotation, new Position(startPos, length));
	annotationModel.disconnect(document);
}
 
开发者ID:ArchieProject,项目名称:Archie-Smart-IDE,代码行数:45,代码来源:EclipsePlatformUtils.java


示例9: isQuickFixableType

import org.eclipse.ui.texteditor.SimpleMarkerAnnotation; //导入依赖的package包/类
public static boolean isQuickFixableType(Annotation annotation) {
	return (annotation instanceof IJavaAnnotation || annotation instanceof SimpleMarkerAnnotation) && !annotation.isMarkedDeleted();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:4,代码来源:JavaCorrectionProcessor.java


示例10: MarkerAnnotationAndPosition

import org.eclipse.ui.texteditor.SimpleMarkerAnnotation; //导入依赖的package包/类
public MarkerAnnotationAndPosition(SimpleMarkerAnnotation markerAnnotation, Position position) {
    this.markerAnnotation = markerAnnotation;
    this.position = position;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:5,代码来源:MarkerAnnotationAndPosition.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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