In This Article

TaggerBase<T> Class

Provides an abstract base class for an ITagger<T> implementation.

public abstract class TaggerBase<T> : ITagger<T>, ITaggerBase, IOrderable, IKeyedObject where T : ITag
Type Parameters:
T -

The type of tag associated with this tagger.

Inheritance:
Object Object
Derived:
CollectionTagger<T> TokenTagger
Implements:
ITagger<T> ITaggerBase IOrderable IKeyedObject

Constructors

TaggerBase(String, IEnumerable<Ordering>, ICodeDocument)

Initializes a new instance of the TaggerBase class.

protected TaggerBase(string key, IEnumerable<Ordering> orderings, ICodeDocument document)
Parameter Type Description
key String

The string-based key that identifies the object.

orderings IEnumerable<Ordering>

The collection of Ordering objects, used to determine how this object is positioned relative to other objects.

document ICodeDocument

The document to which this manager is attached.

TaggerBase(String, IEnumerable<Ordering>, ICodeDocument, Boolean)

Initializes a new instance of the TaggerBase class.

protected TaggerBase(string key, IEnumerable<Ordering> orderings, ICodeDocument document, bool isForLanguage)
Parameter Type Description
key String

The string-based key that identifies the object.

orderings IEnumerable<Ordering>

The collection of Ordering objects, used to determine how this object is positioned relative to other objects.

document ICodeDocument

The document to which this manager is attached.

isForLanguage Boolean

Indicates whether this tagger is for a language.
If true, the tagger is closed when the document's language changes.

Properties

Document

Gets the document to which this tagger is attached.

public ICodeDocument Document { get; }

Property Value

ICodeDocument:

The document to which this tagger is attached.

Key

Gets the string-based key that identifies the object.

public string Key { get; }

Property Value

String:

The string-based key that identifies the object.

Orderings

Gets the collection of Ordering objects, used to determine how this object is positioned relative to other objects.

public IEnumerable<Ordering> Orderings { get; }

Property Value

IEnumerable<Ordering>:

The collection of Ordering objects, used to determine how this object is positioned relative to other objects.

Methods

ChangeDocument(ICodeDocument)

Changes the document associated with the tagger.

protected void ChangeDocument(ICodeDocument newDocument)
Parameter Type Description
newDocument ICodeDocument

The new ICodeDocument.

Remarks

This method is used when a view-based tagger needs to update the associated document.

Close()

Closes the tagger and detaches it from the document.

public void Close()

GetTags(NormalizedTextSnapshotRangeCollection, Object)

Returns the tag ranges that intersect with the specified normalized snapshot ranges.

public abstract IEnumerable<TagSnapshotRange<T>> GetTags(NormalizedTextSnapshotRangeCollection snapshotRanges, object parameter)
Parameter Type Description
snapshotRanges NormalizedTextSnapshotRangeCollection

The collection of normalized snapshot ranges.

parameter Object

An optional parameter that provides contextual information about the tag request.

Returns

IEnumerable<TagSnapshotRange<T>>:

The tag ranges that intersect with the specified normalized snapshot ranges.

OnClosed()

Occurs when the tagger is closed.

protected virtual void OnClosed()

Remarks

The default implementation of this method does nothing. Overrides should release any event handlers set up in the tagger's constructor.

OnTagAggregatorAttached(ITagAggregatorBase)

Called when the tagger is attached to an ITagAggregatorBase.

protected virtual void OnTagAggregatorAttached(ITagAggregatorBase tagAggregator)
Parameter Type Description
tagAggregator ITagAggregatorBase

The aggregator being attached.

Remarks

The default implementation of this method does nothing.

See Also

OnTagAggregatorDetached(ITagAggregatorBase)

Called when the tagger is detached from an ITagAggregatorBase.

protected virtual void OnTagAggregatorDetached(ITagAggregatorBase tagAggregator)
Parameter Type Description
tagAggregator ITagAggregatorBase

The aggregator being detached.

Remarks

The default implementation of this method does nothing.

See Also

OnTagsChanged(TagsChangedEventArgs)

Raises the TagsChanged event.

protected virtual void OnTagsChanged(TagsChangedEventArgs e)
Parameter Type Description
e TagsChangedEventArgs

A TagsChangedEventArgs that contains the event data.

Events

Closed

Occurs when the tagger is closed.

public event EventHandler Closed

Event Type

EventHandler

TagsChanged

Occurs after a range of tags have changed.

public event EventHandler<TagsChangedEventArgs> TagsChanged

Event Type

EventHandler<TagsChangedEventArgs>

Explicit Interface Implementations

ITaggerBase.NotifyTagAggregatorAttached(ITagAggregatorBase)

void ITaggerBase.NotifyTagAggregatorAttached(ITagAggregatorBase tagAggregator)
Parameter Type Description
tagAggregator ITagAggregatorBase

ITaggerBase.NotifyTagAggregatorDetached(ITagAggregatorBase)

void ITaggerBase.NotifyTagAggregatorDetached(ITagAggregatorBase tagAggregator)
Parameter Type Description
tagAggregator ITagAggregatorBase

Inherited Members