本文整理匯總了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;
}
}
示例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;
}
}
示例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 );
}
}
}
}
示例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();
}
示例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);
}
}
}
示例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;
}
示例7: removeLightBulb
import org.eclipse.jface.text.source.IAnnotationModel; //導入方法依賴的package包/類
private void removeLightBulb(IAnnotationModel model) {
synchronized (this) {
if (fIsAnnotationShown) {
model.removeAnnotation(fAnnotation);
fIsAnnotationShown= false;
}
}
}
示例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);
}
}
}
示例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;
}
示例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;
}
}