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


Java IAnnotationModel.removeAnnotation方法代碼示例

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


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

示例1: removeOccurrenceAnnotations

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

示例2: removeOccurrenceAnnotations

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

示例3: clearAnnotations

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
/**
 * Clears all annotations.
 */
private void clearAnnotations( )
{
	IAnnotationModel annotationModel = scriptViewer.getAnnotationModel( );

	if ( annotationModel != null )
	{
		for ( Iterator iterator = annotationModel.getAnnotationIterator( ); iterator.hasNext( ); )
		{
			Annotation annotation = (Annotation) iterator.next( );

			if ( annotation != null &&
					IReportGraphicConstants.ANNOTATION_ERROR.equals( annotation.getType( ) ) )
			{
				annotationModel.removeAnnotation( annotation );
			}
		}
	}
}
 
開發者ID:eclipse,項目名稱:birt,代碼行數:22,代碼來源:ScriptValidator.java

示例4: removeOldAnnotations

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
/**
 * Removes all existing annotations
 * @param model AnnotationModel
 */
private void removeOldAnnotations(IAnnotationModel model) {

    for (Iterator<Annotation> it= fOldAnnotations.iterator(); it.hasNext();) {
        Annotation annotation= (Annotation) it.next();
        model.removeAnnotation(annotation);
    }

    fOldAnnotations.clear();
}
 
開發者ID:eclipse,項目名稱:texlipse,代碼行數:14,代碼來源:TexlipseAnnotationUpdater.java

示例5: clearCompilerExceptions

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
private void clearCompilerExceptions() {
  for (TextEditor editor : editors.values()) {
    IAnnotationModel annotationModel = editor.getSourceViewer().getAnnotationModel();
    for (Annotation annotation : (Iterable<Annotation>) annotationModel::getAnnotationIterator) {
      annotationModel.removeAnnotation(annotation);
    }
  }
}
 
開發者ID:Adrodoc55,項目名稱:MPL,代碼行數:9,代碼來源:MplIdeController.java

示例6: calculateLightBulb

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
private void calculateLightBulb(IAnnotationModel model, IInvocationContext context) {
	boolean needsAnnotation= JavaCorrectionProcessor.hasAssists(context);
	if (fIsAnnotationShown) {
		model.removeAnnotation(fAnnotation);
	}
	if (needsAnnotation) {
		model.addAnnotation(fAnnotation, new Position(context.getSelectionOffset(), context.getSelectionLength()));
	}
	fIsAnnotationShown= needsAnnotation;
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:11,代碼來源:QuickAssistLightBulbUpdater.java

示例7: removeLightBulb

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
private void removeLightBulb(IAnnotationModel model) {
	synchronized (this) {
		if (fIsAnnotationShown) {
			model.removeAnnotation(fAnnotation);
			fIsAnnotationShown= false;
		}
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:9,代碼來源:QuickAssistLightBulbUpdater.java

示例8: resetLocationHighlighting

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
/**
 * Remove all existing location highlighting for the file currently opened in an editor.
 *
 * To gain access to an editor, use {@link JavaEditorConnector#openEditor(JavaSoftwareElement)}.
 *
 * @param editor
 *            The editor to reset the annotations in.
 */
@SuppressWarnings("unchecked")
public void resetLocationHighlighting(ITextEditor editor) {

    IDocumentProvider idp = editor.getDocumentProvider();
    IAnnotationModel annotationModel = idp.getAnnotationModel(editor.getEditorInput());

    Iterator<Annotation> annotationIterator = annotationModel.getAnnotationIterator();
    for (Annotation annotation : Lists.newArrayList(annotationIterator)) {
        if (isCodeLocationAnnotation(annotation)) {
            annotationModel.removeAnnotation(annotation);
        }
    }
}
 
開發者ID:kopl,項目名稱:SPLevo,代碼行數:22,代碼來源:JavaEditorConnector.java

示例9: highlightTagPair

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
/**
 * Given the offset, tries to determine if we're on an HTML close/start tag, and if so it will find the matching
 * open/close and highlight the pair.
 * 
 * @param offset
 */
private void highlightTagPair(int offset)
{
	IDocumentProvider documentProvider = getDocumentProvider();
	if (documentProvider == null)
	{
		return;
	}
	IAnnotationModel annotationModel = documentProvider.getAnnotationModel(getEditorInput());
	if (annotationModel == null)
	{
		return;
	}

	if (fTagPairOccurrences != null)
	{
		// if the offset is included by one of these two positions, we don't need to wipe and re-calculate!
		for (Position pos : fTagPairOccurrences.values())
		{
			if (pos.includes(offset))
			{
				return;
			}
		}
		// New position, wipe the existing annotations in preparation for re-calculating...
		for (Annotation a : fTagPairOccurrences.keySet())
		{
			annotationModel.removeAnnotation(a);
		}
		fTagPairOccurrences = null;
	}

	// Calculate current pair
	Map<Annotation, Position> occurrences = new HashMap<Annotation, Position>();
	IDocument document = getSourceViewer().getDocument();

	IParseNode node = getASTNodeAt(offset, getAST());
	if (node instanceof XMLElementNode)
	{
		XMLElementNode en = (XMLElementNode) node;
		if (!en.isSelfClosing())
		{
			IRegion match = TagUtil.findMatchingTag(document, offset, tagPartitions);
			if (match != null)
			{
				// TODO Compare versus last positions, if they're the same don't wipe out the old ones and add new
				// ones!
				occurrences.put(new Annotation(IXMLEditorConstants.TAG_PAIR_OCCURRENCE_ID, false, null),
						new Position(match.getOffset(), match.getLength()));

				try
				{
					// The current tag we're in!
					ITypedRegion partition = document.getPartition(offset);
					occurrences.put(new Annotation(IXMLEditorConstants.TAG_PAIR_OCCURRENCE_ID, false, null),
							new Position(partition.getOffset(), partition.getLength()));
				}
				catch (BadLocationException e)
				{
					IdeLog.logError(XMLPlugin.getDefault(), e);
				}
				for (Map.Entry<Annotation, Position> entry : occurrences.entrySet())
				{
					annotationModel.addAnnotation(entry.getKey(), entry.getValue());
				}
				fTagPairOccurrences = occurrences;
				return;
			}
		}
	}
	// no new pair, so don't highlight anything
	fTagPairOccurrences = null;
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:79,代碼來源:XMLEditor.java

示例10: highlightTagPair

import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
/**
 * Given the offset, tries to determine if we're on an HTML close/start tag, and if so it will find the matching
 * open/close and highlight the pair.
 * 
 * @param offset
 */
private void highlightTagPair(int offset)
{
	IDocumentProvider documentProvider = getDocumentProvider();
	if (documentProvider == null)
	{
		return;
	}
	IAnnotationModel annotationModel = documentProvider.getAnnotationModel(getEditorInput());
	if (annotationModel == null)
	{
		return;
	}

	if (fTagPairOccurrences != null)
	{
		// if the offset is included by one of these two positions, we don't need to wipe and re-calculate!
		for (Position pos : fTagPairOccurrences.values())
		{
			if (pos.includes(offset))
			{
				return;
			}
		}
		// New position, wipe the existing annotations in preparation for re-calculating...
		for (Annotation a : fTagPairOccurrences.keySet())
		{
			annotationModel.removeAnnotation(a);
		}
		fTagPairOccurrences = null;
	}

	// Calculate current pair
	Map<Annotation, Position> occurrences = new HashMap<Annotation, Position>();
	IDocument document = getSourceViewer().getDocument();
	IRegion match = TagUtil.findMatchingTag(document, offset, tagPartitions);
	if (match != null)
	{
		// TODO Compare versus last positions, if they're the same don't wipe out the old ones and add new ones!
		occurrences.put(new Annotation(IHTMLConstants.TAG_PAIR_OCCURRENCE_ID, false, null),
				new Position(match.getOffset(), match.getLength()));

		try
		{
			// The current tag we're in!
			ITypedRegion partition = document.getPartition(offset);
			occurrences.put(new Annotation(IHTMLConstants.TAG_PAIR_OCCURRENCE_ID, false, null), new Position(
					partition.getOffset(), partition.getLength()));
		}
		catch (BadLocationException e)
		{
			IdeLog.logError(HTMLPlugin.getDefault(), e);
		}
		for (Map.Entry<Annotation, Position> entry : occurrences.entrySet())
		{
			annotationModel.addAnnotation(entry.getKey(), entry.getValue());
		}
		fTagPairOccurrences = occurrences;
	}
	else
	{
		// no new pair, so don't highlight anything
		fTagPairOccurrences = null;
	}
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:71,代碼來源:HTMLEditor.java


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