Table of Contents

Interface IController

Namespace
NDepend.CodeQuery
Assembly
NDepend.API.dll

Changes to a hierarchy of code query objects are made through an instance of IController.

public interface IController
Extension Methods

Remarks

The interfaces IQuery, IGroup and IGroupOfGroups implement the interface IControllerChild, because they all depend from a IController object.
A hierarchy of queries can be gathered from IProjectCodeQueries.CodeQueriesSet or IAnalysisResult.RulesExtractedFromCode.

Property (1)

RootParent

Gets the root parent on which the controller does changes.

IGroupOfGroups RootParent { get; }

Property Value

IGroupOfGroups

Methods (24)

AskUserForGroupDeletion(IGroup, IntPtr, SoundPlayerState)

Ask the user through a dialog, if he really wishes to delete groupToDelete.

bool AskUserForGroupDeletion(IGroup groupToDelete, IntPtr ownerWindowHandle, SoundPlayerState soundPlayerState)

Parameters

groupToDelete IGroup

The group to delete.

ownerWindowHandle IntPtr

The window handle of the parent window that shows the dialog.

soundPlayerState SoundPlayerState

Determine if a ding is played when showing the dialog.

Returns

bool

true if the user wishes to delete the group, otherwise returns false.

AskUserForQueryDeletion(IQuery, IntPtr, SoundPlayerState)

Ask the user through a dialog, if he really wishes to delete queryToDelete.

bool AskUserForQueryDeletion(IQuery queryToDelete, IntPtr ownerWindowHandle, SoundPlayerState soundPlayerState)

Parameters

queryToDelete IQuery

The query to delete.

ownerWindowHandle IntPtr

The window handle of the parent window that shows the dialog.

soundPlayerState SoundPlayerState

Determine if a ding is played when showing the dialog.

Returns

bool

true if the user wishes to delete the query, otherwise returns false.

CanChangeGroupActivation(IGroup, out string)

Gets a value indicating whether group.IsActive can be changed.

bool CanChangeGroupActivation(IGroup group, out string failureReason)

Parameters

group IGroup

The group on which to change the activation.

failureReason string

If false is returned, contains the plain-english explanation of the failure.

Returns

bool

Remarks

If group IsExtractedFromCode or IsGroupOfImportedRules its activation cannot be changed.

CanChangeGroupName(IGroup, out string)

Gets a value indicating whether group.Name can be changed.

bool CanChangeGroupName(IGroup group, out string failureReason)

Parameters

group IGroup

The group on which to change the name.

failureReason string

If false is returned, contains the plain-english explanation of the failure.

Returns

bool

Remarks

If group IsExtractedFromCode or IsGroupOfImportedRules its name cannot be changed.

CanChangeGroupShownInReport(IGroup, out string)

Gets a value indicating whether group.ShownInReport can be changed.

bool CanChangeGroupShownInReport(IGroup group, out string failureReason)

Parameters

group IGroup

The group on which to change the flag ShownInReport.

failureReason string

If false is returned, contains the plain-english explanation of the failure.

Returns

bool

Remarks

If group IsExtractedFromCode or IsGroupOfImportedRules its value ShownInReport cannot be changed.

CanChangeQueryActivation(IQuery, out string)

Gets a value indicating whether query.IsActive can be changed.

bool CanChangeQueryActivation(IQuery query, out string failureReason)

Parameters

query IQuery

The query on which to change the activation.

failureReason string

If false is returned, contains the plain-english explanation of the failure.

Returns

bool

Remarks

If query IsExtractedFromCode or IsImportedRule its activation cannot be changed.

CanDeleteGroup(IGroup, out string)

Gets a value indicating whether groupToDelete can be deleted.

bool CanDeleteGroup(IGroup groupToDelete, out string failureReason)

Parameters

groupToDelete IGroup

The group to delete.

failureReason string

If false is returned, contains the plain-english explanation of the failure.

Returns

bool

Remarks

If groupToDelete IsExtractedFromCode or IsGroupOfImportedRules, the group cannot be deleted.

CanDeleteQuery(IQuery, out string)

Gets a value indicating whether queryToDelete can be deleted.

bool CanDeleteQuery(IQuery queryToDelete, out string failureReason)

Parameters

queryToDelete IQuery

The query to delete.

failureReason string

If false is returned, contains the plain-english explanation of the failure.

Returns

bool

Remarks

If queryToDelete.IsExtractedFromCode or IsImportedRule the query cannot be deleted.

CanInsertGroupUnder(IGroupOfGroups, out string)

Gets a value indicating whether a group can be inserted under setParent.

bool CanInsertGroupUnder(IGroupOfGroups setParent, out string failureReason)

Parameters

setParent IGroupOfGroups

The parent set under which a group might be inserted.

failureReason string

If false is returned, contains the plain-english explanation of the failure.

Returns

bool

Remarks

If setParent IsExtractedFromCode or IsGroupOfImportedRules a group cannot be inserted under it.

CanInsertQueryUnder(IGroup, out string)

Gets a value indicating whether a query can be inserted under groupParent.

bool CanInsertQueryUnder(IGroup groupParent, out string failureReason)

Parameters

groupParent IGroup

The parent group under which a query might be inserted.

failureReason string

If false is returned, contains the plain-english explanation of the failure.

Returns

bool

Remarks

If groupParent.IsExtractedFromCode or IsGroupOfImportedRules a query cannot be inserted under it.

CanSetGroupName(IGroup, string, out string)

Gets a value indicating whether group name can be changed to newName.

bool CanSetGroupName(IGroup group, string newName, out string failureReason)

Parameters

group IGroup

The group on which to change the name.

newName string

The new name to assign to the group.

failureReason string

If false is returned, contains the plain-english explanation of the failure.

Returns

bool

Remarks

An empty newName is not accepted and if another group already has the name newName, it is not accepted neither.

CreateGroup(string, bool, bool, ICollection<IQuery>, ICollection<IGroup>)

Creates a new group object.

IGroup CreateGroup(string name, bool isActive, bool shownInReport, ICollection<IQuery> childQueries, ICollection<IGroup> childGroups)

Parameters

name string

The group name.

isActive bool

The group activation.

shownInReport bool

A boolean value that indicates whether all child rules and queries of this group are shown in report. In Queries Explorer panel, such group is highlighted in a orange box.

childQueries ICollection<IQuery>

A collection of child queries.

childGroups ICollection<IGroup>

A collection of child groups.

Returns

IGroup

CreateQuery(bool, string, bool, bool, bool, bool)

Create a new query object.

IQuery CreateQuery(bool isActive, string queryString, bool displayStatInReport, bool displayListInReport, bool displaySelectionViewInReport, bool isCriticalRule)

Parameters

isActive bool

The new query activation.

queryString string

The query string.

displayStatInReport bool

A boolean value that indicates whether the code rule is violated, the code rule matched code elements are listed into the report.

displayListInReport bool

A boolean value that indicates whether the code rule is violated, the code rule matched code elements statistics are shown into the report.

displaySelectionViewInReport bool

A boolean value that indicates whether the code rule is violated, the code rule matched code elements are shown in a treemap picture embedded into the report.

isCriticalRule bool

A boolean value that indicates whether the code rule is critical or not.

Returns

IQuery

DoAddGroup(IGroup, IGroupOfGroups)

Add groupToAdd under oldSetParent.

void DoAddGroup(IGroup groupToAdd, IGroupOfGroups oldSetParent)

Parameters

groupToAdd IGroup

The group to add.

oldSetParent IGroupOfGroups

The parent set under which the group is added.

Exceptions

ArgumentException

Can't perform the insertion operation on these arguments.
Please check oldSetParent with the method CanInsertGroupUnder(IGroupOfGroups, out string) before calling this method.

ArgumentException

oldSetParent doesn't have this as controller.

DoAddQuery(IQuery, IGroup)

Add queryToAdd under groupParentOldObj.

void DoAddQuery(IQuery queryToAdd, IGroup groupParentOldObj)

Parameters

queryToAdd IQuery

The query to add.

groupParentOldObj IGroup

The group under which the query is added.

Exceptions

ArgumentException

Can't perform the insertion operation on these arguments.
Please check queryToAdd with the method CanInsertQueryUnder(IGroup, out string) before calling this method.

DoChangeGroupActivation(IGroup, bool)

Change group.IsActive to active.

IGroup DoChangeGroupActivation(IGroup group, bool active)

Parameters

group IGroup

The group on which to change the name.

active bool

The new activation boolean state of the group.

Returns

IGroup

The new group object with the activation boolean state.

Exceptions

ArgumentException

Can't perform the group activation changing operation on these arguments.
Please check arguments with the method CanChangeGroupActivation(IGroup, out string) before calling this method.

DoChangeGroupName(IGroup, string)

Change group.Name to newName.

IGroup DoChangeGroupName(IGroup group, string newName)

Parameters

group IGroup

The group on which to change the name.

newName string

The new name to assign to the group.

Returns

IGroup

The new group object with the new name.

Exceptions

ArgumentException

Can't perform the group renaming operation on these arguments.
Please check arguments with the method CanSetGroupName(IGroup, string, out string) before calling this method.

DoChangeGroupShownInReport(IGroup, bool)

Change group.ShownInReport to shownInReport.

void DoChangeGroupShownInReport(IGroup group, bool shownInReport)

Parameters

group IGroup

The group on which to change the flag ShownInReport.

shownInReport bool

The new ShownInReport boolean state of the group.

Exceptions

ArgumentException

Can't perform the group flag changing operation on these arguments.
Please check arguments with the method CanChangeGroupShownInReport(IGroup, out string) before calling this method.

DoChangeQueryActivation(IQuery, bool)

Change query.IsActive to active.

void DoChangeQueryActivation(IQuery query, bool active)

Parameters

query IQuery

The query on which to change the name.

active bool

The new activation boolean state of the query.

Exceptions

ArgumentException

Can't perform the query activation changing operation on these arguments.
Please check arguments with the method CanChangeQueryActivation(IQuery, out string) before calling this method.

DoDeleteGroup(IGroup)

Do delete groupToDelete.

void DoDeleteGroup(IGroup groupToDelete)

Parameters

groupToDelete IGroup

The group to delete.

Exceptions

ArgumentException

Can't perform the deletion operation on these arguments.
Please check groupToDelete with the method CanDeleteGroup(IGroup, out string) before calling this method.

DoDeleteQuery(IQuery)

Do delete queryToDelete.

void DoDeleteQuery(IQuery queryToDelete)

Parameters

queryToDelete IQuery

The query to delete.

Exceptions

ArgumentException

Can't perform the deletion operation on these arguments.
Please check queryToDelete with the method CanDeleteQuery(IQuery, out string) before calling this method.

DoInsertGroup(IGroup, IGroupOfGroups, int)

Insert groupToInsert under oldSetParent.

void DoInsertGroup(IGroup groupToInsert, IGroupOfGroups oldSetParent, int index)

Parameters

groupToInsert IGroup

The group to insert.

oldSetParent IGroupOfGroups

The parent set under which the group is inserted.

index int

The index in oldSetParent children groups, at which groupToInsert is inserted.

Exceptions

ArgumentException

Can't perform the insertion operation on these arguments.
Please check oldSetParent with the method CanInsertGroupUnder(IGroupOfGroups, out string) before calling this method.

ArgumentOutOfRangeException

index must be a positive or zero integer, lower or equals to oldSetParent.ChildGroupsCount.

DoInsertQuery(IQuery, IGroup, int)

Insert queryToInsert under groupParentOldObj.

void DoInsertQuery(IQuery queryToInsert, IGroup groupParentOldObj, int index)

Parameters

queryToInsert IQuery

The query to insert.

groupParentOldObj IGroup

The parent group under which the query is inserted.

index int

The index in groupParentOldObj children queries, at which queryToInsert is inserted.

Exceptions

ArgumentException

Can't perform the insertion operation on these arguments.
Please check queryToInsert with the method CanInsertQueryUnder(IGroup, out string) before calling this method.

ArgumentOutOfRangeException

index must be a positive or zero integer, lower or equals to groupParentOldObj.ChildQueriesCount.

DoUpdateQueryObject(IQuery, IQuery)

Update oldQuery object with newQuery object.

void DoUpdateQueryObject(IQuery oldQuery, IQuery newQuery)

Parameters

oldQuery IQuery

The old object representing the query.

newQuery IQuery

The new object representing the query.

Exceptions

ArgumentException

Can't perform the query update operation on these arguments.
The exception message contains a plain-english description of the problem.