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


Java IAnnotationModel.getPosition方法代碼示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: getAnnotation

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
/**
 * Returns the annotation overlapping with the given range or <code>null</code>.
 *
 * @param offset the region offset
 * @param length the region length
 * @return the found annotation or <code>null</code>
 */
private Annotation getAnnotation(int offset, int length) {
	IAnnotationModel model = getDocumentProvider().getAnnotationModel(getEditorInput());
	if (model == null) {
		return null;
	}

	Iterator<Annotation> e = new AnnotationIterator(model, true, false);
	while (e.hasNext()) {
		Annotation a = e.next();
		Position p = model.getPosition(a);
		if (p != null && p.overlapsWith(offset, length)) {
			return a;
		}
	}
	return null;
}
 
開發者ID:grosenberg,項目名稱:fluentmark,代碼行數:24,代碼來源:FluentMkEditor.java

示例10: 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

示例11: 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

示例12: createQuickfixes

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
/**
 * @since 2.3
 */
protected List<ICompletionProposal> createQuickfixes(IQuickAssistInvocationContext invocationContext, Set<Annotation> applicableAnnotations) {
   	List<ICompletionProposal> result = Lists.newArrayList();
   	ISourceViewer sourceViewer = invocationContext.getSourceViewer();
	IAnnotationModel annotationModel = sourceViewer.getAnnotationModel();
	IXtextDocument xtextDocument = XtextDocumentUtil.get(sourceViewer);
   	for(Annotation annotation : applicableAnnotations) {
		if (annotation instanceof SpellingAnnotation) {
			SpellingProblem spellingProblem = ((SpellingAnnotation) annotation).getSpellingProblem();
			result.addAll(asList(spellingProblem.getProposals()));
		} else {
			final Issue issue = issueUtil.getIssueFromAnnotation(annotation);
			if (issue != null) {
				Iterable<IssueResolution> resolutions = getResolutions(issue, xtextDocument);
				if (resolutions.iterator().hasNext()) {
					Position pos = annotationModel.getPosition(annotation);
					for (IssueResolution resolution : resolutions) {
						result.add(create(pos, resolution));
					}
				}
			}
		}
	}
   	return result;
   }
 
開發者ID:cplutte,項目名稱:bts,代碼行數:28,代碼來源:XtextQuickAssistProcessor.java

示例13: selectAndRevealQuickfix

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
/**
 * @since 2.3
 */
protected void selectAndRevealQuickfix(IQuickAssistInvocationContext invocationContext, Set<Annotation> applicableAnnotations, List<ICompletionProposal> completionProposals) {
       if (completionProposals.isEmpty()) {
       	return;
       }
	if (invocationContext instanceof QuickAssistInvocationContext && !((QuickAssistInvocationContext) invocationContext).isSuppressSelection()) {
		ISourceViewer sourceViewer = invocationContext.getSourceViewer();
		IAnnotationModel annotationModel = sourceViewer.getAnnotationModel();
		Iterator<Annotation> iterator = applicableAnnotations.iterator();
		while(iterator.hasNext()){
			Position pos = annotationModel.getPosition(iterator.next());
			if (pos != null) {
				sourceViewer.setSelectedRange(pos.getOffset(), pos.getLength());
				sourceViewer.revealRange(pos.getOffset(), pos.getLength());
				break;
			}
		}
	}
}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:22,代碼來源:XtextQuickAssistProcessor.java

示例14: 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

示例15: getMarkersFor

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
protected List<IMarker> getMarkersFor(ISourceViewer sourceViewer, int lineOffset, int lineLength) {
    List<IMarker> result = Lists.newArrayList();
    IAnnotationModel annotationModel = sourceViewer.getAnnotationModel();
    Iterator annotationIter = annotationModel.getAnnotationIterator();
    while (annotationIter.hasNext()) {
        Object annotation = annotationIter.next();
        if (annotation instanceof MarkerAnnotation) {
            MarkerAnnotation markerAnnotation = (MarkerAnnotation) annotation;
            IMarker marker = markerAnnotation.getMarker();
            Position markerPosition = annotationModel.getPosition(markerAnnotation);
            if (markerPosition != null && markerPosition.overlapsWith(lineOffset, lineLength)) {
                result.add(marker);
            }
        }
    }
    return result;
}
 
開發者ID:RepreZen,項目名稱:KaiZen-OpenAPI-Editor,代碼行數:18,代碼來源:JsonQuickAssistProcessor.java


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