Browse Source

[CodeAction] NegateRelationalExpressionAction: fixed title

newNRvisualizers
Mansheng Yang 14 years ago
parent
commit
5c4a2da559
  1. 6
      ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/NegateRelationalExpressionAction.cs

6
ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/NegateRelationalExpressionAction.cs

@ -33,12 +33,14 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring @@ -33,12 +33,14 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
protected override CodeAction GetAction (RefactoringContext context, BinaryOperatorExpression node)
{
var newOp = CSharpUtil.NegateRelationalOperator (node.Operator);
if (newOp != BinaryOperatorType.Any && node.OperatorToken.Contains (context.Location))
return new CodeAction (string.Format (context.TranslateString ("Negate {0}"), node.Operator),
if (newOp != BinaryOperatorType.Any && node.OperatorToken.Contains (context.Location)) {
var operatorToken = BinaryOperatorExpression.GetOperatorRole (node.Operator).Token;
return new CodeAction (string.Format (context.TranslateString ("Negate '{0}'"), operatorToken),
script => {
var expr = new BinaryOperatorExpression (node.Left.Clone (), newOp, node.Right.Clone ());
script.Replace (node, expr);
});
}
return null;
}

Loading…
Cancel
Save