Created
April 30, 2023 19:33
-
-
Save controlflow/9f313dbcdda779e8ad8ba518caf4c7d8 to your computer and use it in GitHub Desktop.
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
#nullable enable | |
using System; | |
using JetBrains.Application.Progress; | |
using JetBrains.DocumentManagers.Transactions; | |
using JetBrains.ProjectModel; | |
using JetBrains.ReSharper.Feature.Services.Bulbs; | |
using JetBrains.ReSharper.Feature.Services.Daemon; | |
using JetBrains.ReSharper.Feature.Services.Intentions.Scoped.Scopes; | |
using JetBrains.TextControl; | |
namespace JetBrains.ReSharper.Feature.Services.QuickFixes.Scoped.Popups; | |
public sealed class FileScopedPopupAction : BulbActionBase | |
{ | |
private readonly IScopedPopupBulbAction myScopedPopup; | |
private readonly IBulbAction myBulbAction; | |
private readonly IProjectFile myProjectFile; | |
private readonly IHighlighting myHighlighting; | |
public FileScopedPopupAction(IScopedPopupBulbAction scopedPopup, IBulbAction bulbAction, IProjectFile projectFile, IHighlighting highlighting) | |
{ | |
myScopedPopup = scopedPopup; | |
myBulbAction = bulbAction; | |
myProjectFile = projectFile; | |
myHighlighting = highlighting; | |
} | |
public override /*Localized*/ string Text => myScopedPopup.GetScopedPopupText(myBulbAction); | |
protected override Action<ITextControl>? ExecutePsiTransaction(ISolution solution, IProgressIndicator progress) => null; | |
protected override Action<ITextControl>? ExecuteAfterPsiTransaction( | |
ISolution solution, IProjectModelTransactionCookie cookie, IProgressIndicator progress) | |
{ | |
var fileScope = new ProjectFileScope(myProjectFile); | |
return myScopedPopup.ExecuteAction(solution, fileScope, myHighlighting, progress); | |
} | |
} |
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
#nullable enable | |
using System; | |
using JetBrains.Application.Progress; | |
using JetBrains.DocumentManagers.Transactions; | |
using JetBrains.ProjectModel; | |
using JetBrains.ReSharper.Feature.Services.Bulbs; | |
using JetBrains.ReSharper.Feature.Services.Daemon; | |
using JetBrains.ReSharper.Feature.Services.Intentions.Scoped.Scopes; | |
using JetBrains.TextControl; | |
namespace JetBrains.ReSharper.Feature.Services.QuickFixes.Scoped.Popups; | |
public sealed class FileScopedPopupAction( | |
IScopedPopupBulbAction scopedPopup, IBulbAction bulbAction, IProjectFile projectFile, IHighlighting highlighting) | |
: BulbActionBase | |
{ | |
public override /*Localized*/ string Text => scopedPopup.GetScopedPopupText(bulbAction); | |
protected override Action<ITextControl>? ExecutePsiTransaction(ISolution solution, IProgressIndicator progress) => null; | |
protected override Action<ITextControl>? ExecuteAfterPsiTransaction( | |
ISolution solution, IProjectModelTransactionCookie cookie, IProgressIndicator progress) | |
{ | |
var fileScope = new ProjectFileScope(projectFile); | |
return myScopedPopup.ExecuteAction(solution, fileScope, highlighting, progress); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment