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


Java IDocumentProvider.getAnnotationModel方法代码示例

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


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

示例1: attach

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
/**
 * Attaches a coverage annotation model for the given editor if the editor can
 * be annotated. Does nothing if the model is already attached.
 *
 * @param editor
 *          Editor to attach a annotation model to
 */
public static void attach(ITextEditor editor) {
  IDocumentProvider provider = editor.getDocumentProvider();
  // there may be text editors without document providers (SF #1725100)
  if (provider == null)
    return;
  IAnnotationModel model = provider.getAnnotationModel(editor
      .getEditorInput());
  if (!(model instanceof IAnnotationModelExtension))
    return;
  IAnnotationModelExtension modelex = (IAnnotationModelExtension) model;

  IDocument document = provider.getDocument(editor.getEditorInput());

  CoverageAnnotationModel coveragemodel = (CoverageAnnotationModel) modelex
      .getAnnotationModel(KEY);
  if (coveragemodel == null) {
    coveragemodel = new CoverageAnnotationModel(editor, document);
    modelex.addAnnotationModel(KEY, coveragemodel);
  }
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:28,代码来源:CoverageAnnotationModel.java

示例2: initializeSourceViewer

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
private void initializeSourceViewer(final IEditorInput input) {

        final IDocumentProvider documentProvider = getDocumentProvider();
        final IAnnotationModel model = documentProvider.getAnnotationModel(input);
        final IDocument document = documentProvider.getDocument(input);

        if (document != null) {
            fSourceViewer.setDocument(document, model);
            fSourceViewer.setEditable(isEditable());
            fSourceViewer.showAnnotations(model != null);
        }

        if (fElementStateListener instanceof IElementStateListenerExtension) {
            boolean isStateValidated = false;
            if (documentProvider instanceof IDocumentProviderExtension)
                isStateValidated = ((IDocumentProviderExtension) documentProvider).isStateValidated(input);

            final IElementStateListenerExtension extension = (IElementStateListenerExtension) fElementStateListener;
            extension.elementStateValidationChanged(input, isStateValidated);
        }

    }
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:23,代码来源:TestEditor.java

示例3: initializeSourceViewer

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
private void initializeSourceViewer(IEditorInput input) {

		IDocumentProvider documentProvider = getDocumentProvider();
		IAnnotationModel model = documentProvider.getAnnotationModel(input);
		IDocument document = documentProvider.getDocument(input);

		if (document != null) {
			fSourceViewer.setDocument(document, model);
			fSourceViewer.setEditable(isEditable());
			fSourceViewer.showAnnotations(model != null);
		}

		if (fElementStateListener instanceof IElementStateListenerExtension) {
			boolean isStateValidated = false;
			if (documentProvider instanceof IDocumentProviderExtension)
				isStateValidated = ((IDocumentProviderExtension) documentProvider)
						.isStateValidated(input);

			IElementStateListenerExtension extension = (IElementStateListenerExtension) fElementStateListener;
			extension.elementStateValidationChanged(input, isStateValidated);
		}

	}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:24,代码来源:TestEditor.java

示例4: removeOccurrenceAnnotations

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
private void removeOccurrenceAnnotations() {
	// fMarkOccurrenceModificationStamp=
	// IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP;
	// fMarkOccurrenceTargetRegion= null;

	IDocumentProvider documentProvider = getDocumentProvider();
	if (documentProvider == null)
		return;

	IAnnotationModel annotationModel = documentProvider.getAnnotationModel(getEditorInput());
	if (annotationModel == null || fOccurrenceAnnotations == null)
		return;

	synchronized (getLockObject(annotationModel)) {
		if (annotationModel instanceof IAnnotationModelExtension) {
			((IAnnotationModelExtension) annotationModel).replaceAnnotations(fOccurrenceAnnotations, null);
		} else {
			for (int i = 0, length = fOccurrenceAnnotations.length; i < length; i++)
				annotationModel.removeAnnotation(fOccurrenceAnnotations[i]);
		}
		fOccurrenceAnnotations = null;
	}
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:24,代码来源:TypeScriptEditor.java

示例5: getGWTProblemsInEditor

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
private List<GWTJavaProblem> getGWTProblemsInEditor(CompilationUnitEditor editor)
    throws Exception {
  List<GWTJavaProblem> problems = new ArrayList<GWTJavaProblem>();

  Field annotationProblemField = CompilationUnitDocumentProvider.ProblemAnnotation.class.getDeclaredField("fProblem");
  annotationProblemField.setAccessible(true);

  IEditorInput editorInput = editor.getEditorInput();
  IDocumentProvider documentProvider = editor.getDocumentProvider();
  IAnnotationModel annotationModel = documentProvider.getAnnotationModel(editorInput);
  Iterator<?> iter = annotationModel.getAnnotationIterator();
  while (iter.hasNext()) {
    Object annotation = iter.next();
    if (annotation instanceof CompilationUnitDocumentProvider.ProblemAnnotation) {
      CompilationUnitDocumentProvider.ProblemAnnotation problemAnnotation = (ProblemAnnotation) annotation;
      if (problemAnnotation.getMarkerType().equals(GWTJavaProblem.MARKER_ID)) {
        GWTJavaProblem problem = (GWTJavaProblem) annotationProblemField.get(problemAnnotation);
        problems.add(problem);
      }
    }
  }

  return problems;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:25,代码来源:JavaCompilationParticipantTest.java

示例6: removeOccurrenceAnnotations

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
void removeOccurrenceAnnotations() {
	fMarkOccurrenceModificationStamp= IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP;
	fMarkOccurrenceTargetRegion= null;

	IDocumentProvider documentProvider= getDocumentProvider();
	if (documentProvider == null)
		return;

	IAnnotationModel annotationModel= documentProvider.getAnnotationModel(getEditorInput());
	if (annotationModel == null || fOccurrenceAnnotations == null)
		return;

	synchronized (getLockObject(annotationModel)) {
		if (annotationModel instanceof IAnnotationModelExtension) {
			((IAnnotationModelExtension)annotationModel).replaceAnnotations(fOccurrenceAnnotations, null);
		} else {
			for (int i= 0, length= fOccurrenceAnnotations.length; i < length; i++)
				annotationModel.removeAnnotation(fOccurrenceAnnotations[i]);
		}
		fOccurrenceAnnotations= null;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:JavaEditor.java

示例7: detach

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
/**
 * Detaches the coverage annotation model from the given editor. If the editor
 * does not have a model attached, this method does nothing.
 *
 * @param editor
 *          Editor to detach the annotation model from
 */
public static void detach(ITextEditor editor) {
  IDocumentProvider provider = editor.getDocumentProvider();
  // there may be text editors without document providers (SF #1725100)
  if (provider == null)
    return;
  IAnnotationModel model = provider.getAnnotationModel(editor
      .getEditorInput());
  if (!(model instanceof IAnnotationModelExtension))
    return;
  IAnnotationModelExtension modelex = (IAnnotationModelExtension) model;
  modelex.removeAnnotationModel(KEY);
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:20,代码来源:CoverageAnnotationModel.java

示例8: getAnnotationModel

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
private AbstractMarkerAnnotationModel getAnnotationModel(ITextEditor editor) {
	IDocumentProvider provider = editor.getDocumentProvider();
	IAnnotationModel model = provider.getAnnotationModel(editor.getEditorInput());
	if (model instanceof AbstractMarkerAnnotationModel)
		return (AbstractMarkerAnnotationModel) model;
	return null;
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:8,代码来源:GetLinkedBookmarksOperation.java

示例9: getProblemRequestorExtension

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
/**
 * Returns the problem requestor for the editor's input element.
 * 
 * @return the problem requestor for the editor's input element
 */
private IProblemRequestorExtension getProblemRequestorExtension() {
	IDocumentProvider p = editor.getDocumentProvider();
	if (p == null) return null;

	IAnnotationModel m = p.getAnnotationModel(editor.getEditorInput());
	if (m instanceof IProblemRequestorExtension) {
		return (IProblemRequestorExtension) m;
	}
	return null;
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:16,代码来源:MkReconcilingStrategy.java

示例10: getAnnotationModel

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
private IAnnotationModel getAnnotationModel() {
	IDocumentProvider documentProvider = getDocumentProvider();
	if (documentProvider == null) {
		return null;
	}
	return documentProvider.getAnnotationModel(getEditorInput());
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:8,代码来源:TypeScriptEditor.java

示例11: getAnnotationModel

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
protected IAnnotationModel getAnnotationModel(XtextEditor editor) {
	if(editor != null) {
		IEditorInput editorInput = editor.getEditorInput();
		if(editorInput != null)  {
			IDocumentProvider documentProvider = editor.getDocumentProvider();
			if(documentProvider != null) {
				return documentProvider.getAnnotationModel(editorInput);
			}
		}
	}
	return null;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:13,代码来源:OccurrenceMarker.java

示例12: addAnnotation

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的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

示例13: reportProblems

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
/**
 * Reports problems found in reconcile to the annotation model so we can draw them on the editor without creating
 * markers on the underlying resource.
 * 
 * @param context
 * @param monitor
 */
private void reportProblems(ReconcileContext context, IProgressMonitor monitor)
{
	AbstractThemeableEditor editor = fEditor;
	if (editor == null)
	{
		return;
	}

	IDocumentProvider docProvider = editor.getDocumentProvider();
	if (docProvider == null)
	{
		return;
	}

	IEditorInput editorInput = editor.getEditorInput();
	if (editorInput == null)
	{
		return;
	}

	IAnnotationModel model = docProvider.getAnnotationModel(editorInput);
	if (!(model instanceof ICommonAnnotationModel))
	{
		return;
	}

	ICommonAnnotationModel caModel = (ICommonAnnotationModel) model;
	// Now report them all to the annotation model!
	caModel.reportProblems(context.getProblems(), monitor);
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:38,代码来源:CommonReconcilingStrategy.java

示例14: getAnnotationModel

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
/**
 * getAnnotationModel
 * 
 * @return
 */
protected IAnnotationModel getAnnotationModel() {
	IDocumentProvider documentProvider = getDocumentProvider();
	IEditorInput editorInput = getEditorInput();
	IAnnotationModel result = null;

	if (documentProvider != null && editorInput != null) {
		result = documentProvider.getAnnotationModel(editorInput);
	}

	return result;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:17,代码来源:CommonOccurrencesUpdater.java

示例15: getAnnotationModel

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
@Override
protected IAnnotationModel getAnnotationModel() {
	final IDocumentProvider documentProvider= fEditor.getDocumentProvider();
	if (documentProvider == null)
		return null;
	return documentProvider.getAnnotationModel(fEditor.getEditorInput());
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:JavaSpellingReconcileStrategy.java


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