In This Article

HighlightingStyleRegistry Class

Represents a registry of IClassificationType to IHighlightingStyle mapping data.

public class HighlightingStyleRegistry : IHighlightingStyleRegistry, IClassificationTypeRegistry, IEnumerable<IClassificationType>, IEnumerable<KeyValuePair<IClassificationType, IHighlightingStyle>>, IEnumerable
Inheritance:
System.Object Object
Derived:
AmbientHighlightingStyleRegistry
Implements:
IHighlightingStyleRegistry IClassificationTypeRegistry

Constructors

HighlightingStyleRegistry()

public HighlightingStyleRegistry()

Properties

ClassificationTypes

Gets the collection of IClassificationType objects that have been registered.

public ICollection<IClassificationType> ClassificationTypes { get; }

Property Value

System.Collections.Generic.ICollection<IClassificationType>:

The collection of IClassificationType objects that have been registered.

Count

Gets the number of entries in the registry.

public int Count { get; }

Property Value

System.Int32:

The number of entries in the registry.

Description

Gets or sets the description of the registry.

public string Description { get; set; }

Property Value

System.String:

The description of the registry.

HighlightingStyles

Gets the collection of IHighlightingStyle objects that have been registered.

public ICollection<IHighlightingStyle> HighlightingStyles { get; }

Property Value

System.Collections.Generic.ICollection<IHighlightingStyle>:

The collection of IHighlightingStyle objects that have been registered.

Item[IClassificationType]

Gets the IHighlightingStyle registered with the specified IClassificationType.

[C#] In C#, this property is the indexer for the IHighlightingStyleRegistry interface.

public IHighlightingStyle this[IClassificationType classificationType] { get; }
Parameter Type Description
classificationType IClassificationType

The IClassificationType for which to search.

Property Value

IHighlightingStyle:

The IHighlightingStyle registered with the specified IClassificationType.

UnusedRegionForegroundOpacity

Gets or sets the opacity to use for unused region foregrounds.

public double UnusedRegionForegroundOpacity { get; set; }

Property Value

System.Double:

The opacity to use for unused region foregrounds. The default value is 0.7.

Methods

GetClassificationType(String)

Returns the IClassificationType, if any, that has been registered with the specified key.

public IClassificationType GetClassificationType(string key)
Parameter Type Description
key System.String

The key for which to search.

Returns

IClassificationType:

The IClassificationType, if any, that has been registered with the specified key.

GetEnumerator()

Retrieves an IEnumerator object for the entire collection.

public IEnumerator<KeyValuePair<IClassificationType, IHighlightingStyle>> GetEnumerator()

Returns

System.Collections.Generic.IEnumerator<KeyValuePair<IClassificationType, IHighlightingStyle>>:

An IEnumerator object for the entire collection

Remarks

Enumerators are intended to be used only to read data in the collection. Enumerators cannot be used to modify the underlying collection.

The enumerator does not have exclusive access to the collection.

When an enumerator is instantiated, it takes a snapshot of the current state of the collection. If changes are made to the collection, such as adding, modifying or deleting elements, the snapshot gets out of sync and the enumerator throws an InvalidOperationException. Two enumerators instantiated from the same collection at the same time can have different snapshots of the collection.

ImportHighlightingStyles(Stream)

Imports style settings from the specified System.IO.Stream, containing XML.

public bool ImportHighlightingStyles(Stream stream)
Parameter Type Description
stream System.IO.Stream

The System.IO.Stream from which to import.

Returns

System.Boolean:

true if settings were imported; otherwise, false.

OnChanged(EventArgs)

Raises the Changed event.

protected virtual void OnChanged(EventArgs e)
Parameter Type Description
e System.EventArgs

An EventArgs that contains the event data.

Register(IClassificationType, IHighlightingStyle)

Attempts to adds an IHighlightingStyle for the specified IClassificationType into the registry, as long as there is no existing IHighlightingStyle registered with the same IClassificationType.

public bool Register(IClassificationType classificationType, IHighlightingStyle style)
Parameter Type Description
classificationType IClassificationType

The IClassificationType with which to register the IHighlightingStyle.

style IHighlightingStyle

The IHighlightingStyle to register.

Returns

System.Boolean:

true if the IHighlightingStyle was added; otherwise, false.

Remarks

This method only returns false if there is already an IHighlightingStyle registered with the same IClassificationType.

Register(IClassificationType, IHighlightingStyle, Boolean)

Adds an IHighlightingStyle into the registry, optionally overwriting any existing IHighlightingStyle registered with the same IClassificationType.

public bool Register(IClassificationType classificationType, IHighlightingStyle style, bool overwriteExisting)
Parameter Type Description
classificationType IClassificationType

The IClassificationType with which to register the IHighlightingStyle.

style IHighlightingStyle

The IHighlightingStyle to register.

overwriteExisting System.Boolean

Whether to overwrite existing highlighting styles with the same IClassificationType.

Returns

System.Boolean:

true if the IHighlightingStyle was added; otherwise, false.

Remarks

This method only returns false if overwriteExisting is false and there is already an IHighlightingStyle registered with the same IClassificationType.

Unregister(IClassificationType)

Removes a registry entry with the specified IClassificationType from the registry.

public bool Unregister(IClassificationType classificationType)
Parameter Type Description
classificationType IClassificationType

The IClassificationType to unregister.

Returns

System.Boolean:

true if the registry entry was removed; otherwise, false.

Events

Changed

Occurs after a change has occurred to the items in the registry.

public event EventHandler Changed

Event Type

System.EventHandler

Explicit Interface Implementations

IClassificationTypeRegistry.get_Item(String)

IClassificationType IClassificationTypeRegistry.get_Item(string key)
Parameter Type Description
key System.String

Returns

IClassificationType

IClassificationTypeRegistry.Item[String]

Gets the IClassificationType with the specified key.

[C#] In C#, this property is the indexer for the IClassificationTypeRegistry interface.

IClassificationType IClassificationTypeRegistry.this[] { get; }
Parameter Type Description
key System.String

The key of the IClassificationType to return.

Returns

IClassificationType:

The IClassificationType with the specified key.

Inherited Members

  • System.Object.ToString()
  • System.Object.Equals(System.Object)
  • System.Object.Equals(System.Object, System.Object)
  • System.Object.ReferenceEquals(System.Object, System.Object)
  • System.Object.GetHashCode()
  • System.Object.GetType()
  • System.Object.MemberwiseClone()