-
Notifications
You must be signed in to change notification settings - Fork 299
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 #4693 from MDoerner/StopRewritingDirtyModules
Stop rewriting dirty modules
- Loading branch information
Showing
15 changed files
with
406 additions
and
81 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
Rubberduck.CodeAnalysis/QuickFixes/IQuickFixFailureNotifier.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,9 @@ | ||
using Rubberduck.Parsing.Rewriter; | ||
|
||
namespace Rubberduck.Inspections.QuickFixes | ||
{ | ||
public interface IQuickFixFailureNotifier | ||
{ | ||
void NotifyQuickFixExecutionFailure(RewriteSessionState sessionState); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
Rubberduck.CodeAnalysis/QuickFixes/QuickFixFailureNotifier.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,45 @@ | ||
using System; | ||
using Rubberduck.Interaction; | ||
using Rubberduck.Parsing.Rewriter; | ||
|
||
namespace Rubberduck.Inspections.QuickFixes | ||
{ | ||
public class QuickFixFailureNotifier : IQuickFixFailureNotifier | ||
{ | ||
private readonly IMessageBox _messageBox; | ||
|
||
public QuickFixFailureNotifier(IMessageBox messageBox) | ||
{ | ||
_messageBox = messageBox; | ||
} | ||
|
||
public void NotifyQuickFixExecutionFailure(RewriteSessionState sessionState) | ||
{ | ||
var message = FailureMessage(sessionState); | ||
var caption = Resources.Inspections.QuickFixes.ApplyQuickFixFailedCaption; | ||
|
||
_messageBox.NotifyWarn(message, caption); | ||
} | ||
|
||
private static string FailureMessage(RewriteSessionState sessionState) | ||
{ | ||
var baseFailureMessage = Resources.Inspections.QuickFixes.ApplyQuickFixesFailedMessage; | ||
var failureReasonMessage = FailureReasonMessage(sessionState); | ||
var message = string.IsNullOrEmpty(failureReasonMessage) | ||
? baseFailureMessage | ||
: $"{baseFailureMessage}{Environment.NewLine}{Environment.NewLine}{failureReasonMessage}"; | ||
return message; | ||
} | ||
|
||
private static string FailureReasonMessage(RewriteSessionState sessionState) | ||
{ | ||
switch (sessionState) | ||
{ | ||
case RewriteSessionState.StaleParseTree: | ||
return Resources.Inspections.QuickFixes.StaleModuleFailureReason; | ||
default: | ||
return string.Empty; | ||
} | ||
} | ||
} | ||
} |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.