-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52145 from Cosifne/dev/shech/inheritanceMarginUI
Inheritance Margin UI
- Loading branch information
Showing
34 changed files
with
1,141 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/EditorFeatures/Core.Wpf/InheritanceMargin/InheritanceMarginHelpers.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Microsoft.CodeAnalysis.InheritanceMargin; | ||
using Microsoft.VisualStudio.Imaging; | ||
using Microsoft.VisualStudio.Imaging.Interop; | ||
using Roslyn.Utilities; | ||
|
||
namespace Microsoft.CodeAnalysis.Editor.InheritanceMargin | ||
{ | ||
internal static class InheritanceMarginHelpers | ||
{ | ||
/// <summary> | ||
/// Decide which moniker should be shown. | ||
/// </summary> | ||
public static ImageMoniker GetMoniker(InheritanceRelationship inheritanceRelationship) | ||
{ | ||
// If there are multiple targets and we have the corresponding compound image, use it | ||
if (inheritanceRelationship.HasFlag(InheritanceRelationship.ImplementingOverriding)) | ||
{ | ||
return KnownMonikers.ImplementingOverriding; | ||
} | ||
|
||
if (inheritanceRelationship.HasFlag(InheritanceRelationship.ImplementingOverridden)) | ||
{ | ||
return KnownMonikers.ImplementingOverridden; | ||
} | ||
|
||
// Otherwise, show the image based on this preference | ||
if (inheritanceRelationship.HasFlag(InheritanceRelationship.Implemented)) | ||
{ | ||
return KnownMonikers.Implemented; | ||
} | ||
|
||
if (inheritanceRelationship.HasFlag(InheritanceRelationship.Implementing)) | ||
{ | ||
return KnownMonikers.Implementing; | ||
} | ||
|
||
if (inheritanceRelationship.HasFlag(InheritanceRelationship.Overridden)) | ||
{ | ||
return KnownMonikers.Overridden; | ||
} | ||
|
||
if (inheritanceRelationship.HasFlag(InheritanceRelationship.Overriding)) | ||
{ | ||
return KnownMonikers.Overriding; | ||
} | ||
|
||
// The relationship is None. Don't know what image should be shown, throws | ||
throw ExceptionUtilities.UnexpectedValue(inheritanceRelationship); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...torFeatures/Core.Wpf/InheritanceMargin/MarginGlyph/InheritanceContextMenuItemViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Microsoft.VisualStudio.Imaging.Interop; | ||
|
||
namespace Microsoft.CodeAnalysis.Editor.InheritanceMargin.MarginGlyph | ||
{ | ||
internal abstract class InheritanceContextMenuItemViewModel | ||
{ | ||
/// <summary> | ||
/// Display content for the target. | ||
/// </summary> | ||
public string DisplayContent { get; } | ||
|
||
/// <summary> | ||
/// ImageMoniker shown before the display name. | ||
/// </summary> | ||
public ImageMoniker ImageMoniker { get; } | ||
|
||
/// <summary> | ||
/// AutomationName for the MenuItem. | ||
/// </summary> | ||
public string AutomationName { get; } | ||
|
||
protected InheritanceContextMenuItemViewModel(string displayContent, ImageMoniker imageMoniker, string automationName) | ||
{ | ||
DisplayContent = displayContent; | ||
ImageMoniker = imageMoniker; | ||
AutomationName = automationName; | ||
} | ||
} | ||
} |
Oops, something went wrong.