當前位置: 首頁>>代碼示例>>Java>>正文


Java IAnnotationModel.getAnnotationIterator方法代碼示例

本文整理匯總了Java中org.eclipse.jface.text.source.IAnnotationModel.getAnnotationIterator方法的典型用法代碼示例。如果您正苦於以下問題:Java IAnnotationModel.getAnnotationIterator方法的具體用法?Java IAnnotationModel.getAnnotationIterator怎麽用?Java IAnnotationModel.getAnnotationIterator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jface.text.source.IAnnotationModel的用法示例。


在下文中一共展示了IAnnotationModel.getAnnotationIterator方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: hasProblem

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
/***
 * Returns true if it exists a marker annotation in the given offset and false
 * otherwise.
 *
 * @param textViewer
 * @param offset
 * @return true if it exists a marker annotation in the given offset and false
 *         otherwise.
 */
private static boolean hasProblem(ITextViewer textViewer, int offset) {
	if (!(textViewer instanceof ISourceViewer)) {
		return false;
	}

	IAnnotationModel annotationModel = ((ISourceViewer) textViewer).getAnnotationModel();
	Iterator<Annotation> iter = (annotationModel instanceof IAnnotationModelExtension2)
			? ((IAnnotationModelExtension2) annotationModel).getAnnotationIterator(offset, 1, true, true)
			: annotationModel.getAnnotationIterator();
	while (iter.hasNext()) {
		Annotation ann = iter.next();
		if (ann instanceof MarkerAnnotation) {
			return true;
		}
	}
	return false;
}
 
開發者ID:angelozerr,項目名稱:ec4e,代碼行數:27,代碼來源:EditorConfigTextHover.java

示例2: getHoverInfo

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
@SuppressWarnings("rawtypes")
@Override
public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
	IAnnotationModel model = sourceViewer.getAnnotationModel();
	Iterator iterator = model.getAnnotationIterator();
	while (iterator.hasNext()) {
		Annotation annotation = (Annotation) iterator.next();
		Position position = model.getPosition(annotation);
		try {
			int lineOfAnnotation = sourceViewer.getDocument().
					getLineOfOffset(position.getOffset());
			if (lineNumber == lineOfAnnotation) {
				return annotation.getText();
			}
		} catch (BadLocationException e) {
			// TODO: handle exception
		}
		
	}
	return null;
}
 
開發者ID:Imhotup,項目名稱:LibertyEiffel-Eclipse-Plugin,代碼行數:22,代碼來源:EiffelAnnotationHOver.java

示例3: getQuickFixes

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
private List<de.darwinspl.preferences.resource.dwprofile.IDwprofileQuickFix> getQuickFixes(ISourceViewer sourceViewer, int offset, int length) {
	List<de.darwinspl.preferences.resource.dwprofile.IDwprofileQuickFix> foundFixes = new ArrayList<de.darwinspl.preferences.resource.dwprofile.IDwprofileQuickFix>();
	IAnnotationModel model = annotationModelProvider.getAnnotationModel();
	
	if (model == null) {
		return foundFixes;
	}
	
	Iterator<?> iter = model.getAnnotationIterator();
	while (iter.hasNext()) {
		Annotation annotation = (Annotation) iter.next();
		Position position = model.getPosition(annotation);
		if (offset >= 0) {
			if (!position.overlapsWith(offset, length)) {
				continue;
			}
		}
		Collection<de.darwinspl.preferences.resource.dwprofile.IDwprofileQuickFix> quickFixes = getQuickFixes(annotation);
		if (quickFixes != null) {
			foundFixes.addAll(quickFixes);
		}
	}
	return foundFixes;
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:25,代碼來源:DwprofileQuickAssistProcessor.java

示例4: getQuickFixes

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
private List<eu.hyvar.feature.expression.resource.hyexpression.IHyexpressionQuickFix> getQuickFixes(ISourceViewer sourceViewer, int offset, int length) {
	List<eu.hyvar.feature.expression.resource.hyexpression.IHyexpressionQuickFix> foundFixes = new ArrayList<eu.hyvar.feature.expression.resource.hyexpression.IHyexpressionQuickFix>();
	IAnnotationModel model = annotationModelProvider.getAnnotationModel();
	
	if (model == null) {
		return foundFixes;
	}
	
	Iterator<?> iter = model.getAnnotationIterator();
	while (iter.hasNext()) {
		Annotation annotation = (Annotation) iter.next();
		Position position = model.getPosition(annotation);
		if (offset >= 0) {
			if (!position.overlapsWith(offset, length)) {
				continue;
			}
		}
		Collection<eu.hyvar.feature.expression.resource.hyexpression.IHyexpressionQuickFix> quickFixes = getQuickFixes(annotation);
		if (quickFixes != null) {
			foundFixes.addAll(quickFixes);
		}
	}
	return foundFixes;
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:25,代碼來源:HyexpressionQuickAssistProcessor.java

示例5: getQuickFixes

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
private List<eu.hyvar.context.contextValidity.resource.hyvalidityformula.IHyvalidityformulaQuickFix> getQuickFixes(ISourceViewer sourceViewer, int offset, int length) {
	List<eu.hyvar.context.contextValidity.resource.hyvalidityformula.IHyvalidityformulaQuickFix> foundFixes = new ArrayList<eu.hyvar.context.contextValidity.resource.hyvalidityformula.IHyvalidityformulaQuickFix>();
	IAnnotationModel model = annotationModelProvider.getAnnotationModel();
	
	if (model == null) {
		return foundFixes;
	}
	
	Iterator<?> iter = model.getAnnotationIterator();
	while (iter.hasNext()) {
		Annotation annotation = (Annotation) iter.next();
		Position position = model.getPosition(annotation);
		if (offset >= 0) {
			if (!position.overlapsWith(offset, length)) {
				continue;
			}
		}
		Collection<eu.hyvar.context.contextValidity.resource.hyvalidityformula.IHyvalidityformulaQuickFix> quickFixes = getQuickFixes(annotation);
		if (quickFixes != null) {
			foundFixes.addAll(quickFixes);
		}
	}
	return foundFixes;
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:25,代碼來源:HyvalidityformulaQuickAssistProcessor.java

示例6: getQuickFixes

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
private List<eu.hyvar.dataValues.resource.hydatavalue.IHydatavalueQuickFix> getQuickFixes(ISourceViewer sourceViewer, int offset, int length) {
	List<eu.hyvar.dataValues.resource.hydatavalue.IHydatavalueQuickFix> foundFixes = new ArrayList<eu.hyvar.dataValues.resource.hydatavalue.IHydatavalueQuickFix>();
	IAnnotationModel model = annotationModelProvider.getAnnotationModel();
	
	if (model == null) {
		return foundFixes;
	}
	
	Iterator<?> iter = model.getAnnotationIterator();
	while (iter.hasNext()) {
		Annotation annotation = (Annotation) iter.next();
		Position position = model.getPosition(annotation);
		if (offset >= 0) {
			if (!position.overlapsWith(offset, length)) {
				continue;
			}
		}
		Collection<eu.hyvar.dataValues.resource.hydatavalue.IHydatavalueQuickFix> quickFixes = getQuickFixes(annotation);
		if (quickFixes != null) {
			foundFixes.addAll(quickFixes);
		}
	}
	return foundFixes;
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:25,代碼來源:HydatavalueQuickAssistProcessor.java

示例7: getQuickFixes

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
private List<eu.hyvar.feature.mapping.resource.hymapping.IHymappingQuickFix> getQuickFixes(ISourceViewer sourceViewer, int offset, int length) {
	List<eu.hyvar.feature.mapping.resource.hymapping.IHymappingQuickFix> foundFixes = new ArrayList<eu.hyvar.feature.mapping.resource.hymapping.IHymappingQuickFix>();
	IAnnotationModel model = annotationModelProvider.getAnnotationModel();
	
	if (model == null) {
		return foundFixes;
	}
	
	Iterator<?> iter = model.getAnnotationIterator();
	while (iter.hasNext()) {
		Annotation annotation = (Annotation) iter.next();
		Position position = model.getPosition(annotation);
		if (offset >= 0) {
			if (!position.overlapsWith(offset, length)) {
				continue;
			}
		}
		Collection<eu.hyvar.feature.mapping.resource.hymapping.IHymappingQuickFix> quickFixes = getQuickFixes(annotation);
		if (quickFixes != null) {
			foundFixes.addAll(quickFixes);
		}
	}
	return foundFixes;
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:25,代碼來源:HymappingQuickAssistProcessor.java

示例8: getQuickFixes

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
private List<eu.hyvar.feature.constraint.resource.hyconstraints.IHyconstraintsQuickFix> getQuickFixes(ISourceViewer sourceViewer, int offset, int length) {
	List<eu.hyvar.feature.constraint.resource.hyconstraints.IHyconstraintsQuickFix> foundFixes = new ArrayList<eu.hyvar.feature.constraint.resource.hyconstraints.IHyconstraintsQuickFix>();
	IAnnotationModel model = annotationModelProvider.getAnnotationModel();
	
	if (model == null) {
		return foundFixes;
	}
	
	Iterator<?> iter = model.getAnnotationIterator();
	while (iter.hasNext()) {
		Annotation annotation = (Annotation) iter.next();
		Position position = model.getPosition(annotation);
		if (offset >= 0) {
			if (!position.overlapsWith(offset, length)) {
				continue;
			}
		}
		Collection<eu.hyvar.feature.constraint.resource.hyconstraints.IHyconstraintsQuickFix> quickFixes = getQuickFixes(annotation);
		if (quickFixes != null) {
			foundFixes.addAll(quickFixes);
		}
	}
	return foundFixes;
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:25,代碼來源:HyconstraintsQuickAssistProcessor.java

示例9: getQuickFixes

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
private List<eu.hyvar.mspl.manifest.resource.hymanifest.IHymanifestQuickFix> getQuickFixes(ISourceViewer sourceViewer, int offset, int length) {
	List<eu.hyvar.mspl.manifest.resource.hymanifest.IHymanifestQuickFix> foundFixes = new ArrayList<eu.hyvar.mspl.manifest.resource.hymanifest.IHymanifestQuickFix>();
	IAnnotationModel model = annotationModelProvider.getAnnotationModel();
	
	if (model == null) {
		return foundFixes;
	}
	
	Iterator<?> iter = model.getAnnotationIterator();
	while (iter.hasNext()) {
		Annotation annotation = (Annotation) iter.next();
		Position position = model.getPosition(annotation);
		if (offset >= 0) {
			if (!position.overlapsWith(offset, length)) {
				continue;
			}
		}
		Collection<eu.hyvar.mspl.manifest.resource.hymanifest.IHymanifestQuickFix> quickFixes = getQuickFixes(annotation);
		if (quickFixes != null) {
			foundFixes.addAll(quickFixes);
		}
	}
	return foundFixes;
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:25,代碼來源:HymanifestQuickAssistProcessor.java

示例10: addProposals

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
private void addProposals(final SubMenuManager quickFixMenu) {
	IAnnotationModel sourceModel = sourceViewer.getAnnotationModel();
	Iterator annotationIterator = sourceModel.getAnnotationIterator();
	while (annotationIterator.hasNext()) {
		Annotation annotation = (Annotation) annotationIterator.next();
		boolean isDeleted = annotation.isMarkedDeleted();
		boolean isIncluded = includes(sourceModel.getPosition(annotation),
				getTextWidget().getCaretOffset());
		boolean isFixable = sourceViewer.getQuickAssistAssistant().canFix(
				annotation);
		if (!isDeleted && isIncluded && isFixable) {
			IQuickAssistProcessor processor = sourceViewer
			.getQuickAssistAssistant()
			.getQuickAssistProcessor();
			IQuickAssistInvocationContext context = sourceViewer
			.getQuickAssistInvocationContext();
			ICompletionProposal[] proposals = processor
			.computeQuickAssistProposals(context);

			for (ICompletionProposal proposal : proposals)
				quickFixMenu.add(createQuickFixAction(proposal));
		}
	}
}
 
開發者ID:cchabanois,項目名稱:mesfavoris,代碼行數:25,代碼來源:SpellcheckableMessageArea.java

示例11: findAnnotations

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
private List<AnnotationWithPosition> findAnnotations() {
  List<AnnotationWithPosition> annos = new ArrayList<AnnotationWithPosition>();
  try {
    IAnnotationModel model = infoControl.getEditor().getViewer().getAnnotationModel();
    for (Iterator iterator = model.getAnnotationIterator(); iterator.hasNext();) {
      Annotation anno = (Annotation) iterator.next();
      if (containsAnnotationType(anno)) {
        Position position = model.getPosition(anno);
        AnnotationWithPosition newAnno = new AnnotationWithPosition(anno, position);
        if (!containsAnnotation(annos, newAnno)) {
          annos.add(newAnno);
        }
      }
    }
  } catch (Exception e) {
    QuickAnnotationInformationControl.logError(e);
  }
  return annos;
}
 
開發者ID:nblix,項目名稱:overviewruler,代碼行數:20,代碼來源:AnnotationContentProvider.java

示例12: getAnnotation

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
@SuppressWarnings("rawtypes")
private Annotation getAnnotation(final int offset, final int length) {
	final IAnnotationModel model = getDocumentProvider().getAnnotationModel(getEditorInput());
	if (model == null)
		return null;

	Iterator iterator;
	if (model instanceof IAnnotationModelExtension2) {
		iterator = ((IAnnotationModelExtension2) model).getAnnotationIterator(offset, length, true, true);
	} else {
		iterator = model.getAnnotationIterator();
	}

	while (iterator.hasNext()) {
		final Annotation a = (Annotation) iterator.next();
		final Position p = model.getPosition(a);
		if (p != null && p.overlapsWith(offset, length))
			return a;
	}
	return null;
}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:22,代碼來源:XtextEditor.java

示例13: loadAnnotations2Editor

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
/**
 * Load annotations2 editor.
 *
 * @param editorModel the editor model
 * @param model the model
 * @param monitor 
 */
@SuppressWarnings("rawtypes")
private void loadAnnotations2Editor(IAnnotationModel editorModel,
		IAnnotationModel model, IProgressMonitor monitor) {
	Iterator i = model.getAnnotationIterator();
	Issue issue;
	issue = new Issue.IssueImpl();
	if (monitor != null)
	{
		if (monitor.isCanceled()) return;
		monitor.beginTask("Load visible annotations to Text-Editor", IProgressMonitor.UNKNOWN);
	}
	while (i.hasNext()) {
		Object a = i.next();
		Position pos = model.getPosition((Annotation) a);
		loadSingleAnnotation2Editor(editorModel, (BTSModelAnnotation)a, pos, issue);
		if (monitor != null)
		{
			monitor.worked(1);
		}
	}

}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:30,代碼來源:EgyTextEditorPart.java

示例14: getGWTProblemsInEditor

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的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

示例15: getMarkerForLine

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
/**
 * Returns one marker which includes the ruler's line of activity.
 */
protected IMarker getMarkerForLine(ISourceViewer aViewer, int aLine)
{
    IMarker marker = null;
    IAnnotationModel model = aViewer.getAnnotationModel();
    if (model != null)
    {
        Iterator e = model.getAnnotationIterator();
        while (e.hasNext())
        {
            Object o = e.next();
            if (o instanceof MarkerAnnotation)
            {
                MarkerAnnotation a = (MarkerAnnotation) o;
                if (compareRulerLine(model.getPosition(a), aViewer.getDocument(), aLine) != 0)
                {
                    marker = a.getMarker();
                }
            }
        }
    }
    return marker;
}
 
開發者ID:ninneko,項目名稱:velocity-edit,代碼行數:26,代碼來源:VelocityAnnotationHover.java


注:本文中的org.eclipse.jface.text.source.IAnnotationModel.getAnnotationIterator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。