mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java inspection: Removed the "Add Braces" intention, because it can be replaced with "Control flow statement without braces" inspection (IDEA-157727)
This commit is contained in:
@@ -351,11 +351,6 @@
|
||||
<bundleName>com.siyeh.IntentionPowerPackBundle</bundleName>
|
||||
<categoryKey>intention.category.control.flow</categoryKey>
|
||||
</intentionAction>
|
||||
<intentionAction>
|
||||
<className>com.siyeh.ipp.braces.AddBracesIntention</className>
|
||||
<bundleName>com.siyeh.IntentionPowerPackBundle</bundleName>
|
||||
<categoryKey>intention.category.control.flow</categoryKey>
|
||||
</intentionAction>
|
||||
<intentionAction>
|
||||
<className>com.siyeh.ipp.braces.RemoveBracesIntention</className>
|
||||
<bundleName>com.siyeh.IntentionPowerPackBundle</bundleName>
|
||||
|
||||
@@ -90,7 +90,6 @@ flip.comparison.intention.family.name=Flip Comparison
|
||||
flip.conjunction.intention.family.name=Flip Conjunction Operands
|
||||
negate.comparison.intention.family.name=Negate Comparison
|
||||
remove.braces.intention.family.name=Remove Braces
|
||||
add.braces.intention.family.name=Add Braces
|
||||
flip.commutative.method.call.intention.family.name=Flip Commutative Method Call
|
||||
constant.subexpression.intention.family.name=Compute Constant Value for Subexpression
|
||||
extract.increment.intention.family.name=Extract Increment
|
||||
@@ -172,7 +171,6 @@ flip.smth.intention.name1=Flip ''{0}'' (changes semantics)
|
||||
flip.comparison.intention.name=Flip ''{0}'' to ''{1}''
|
||||
negate.comparison.intention.name=Negate ''{0}''
|
||||
negate.comparison.intention.name1=Negate ''{0}'' to ''{1}''
|
||||
add.braces.intention.name=Add braces to ''{0}'' statement
|
||||
remove.braces.intention.name=Remove braces from ''{0}'' statement
|
||||
flip.commutative.method.call.intention.name=Flip ''.{0}()''
|
||||
flip.commutative.method.call.intention.name1=Flip ''.{0}()'' (may change semantics)
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright 2003-2006 Dave Griffith, Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.siyeh.ipp.braces;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.siyeh.ig.PsiReplacementUtil;
|
||||
import com.siyeh.ipp.base.PsiElementPredicate;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class AddBracesIntention extends BaseBracesIntention {
|
||||
|
||||
@NotNull
|
||||
protected PsiElementPredicate getElementPredicate() {
|
||||
return new PsiElementPredicate() {
|
||||
@Override
|
||||
public boolean satisfiedBy(PsiElement element) {
|
||||
final PsiStatement statement = getSurroundingStatement(element);
|
||||
return statement != null && !(statement instanceof PsiBlockStatement);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getMessageKey() {
|
||||
return "add.braces.intention.name";
|
||||
}
|
||||
|
||||
protected void processIntention(@NotNull PsiElement element) throws IncorrectOperationException {
|
||||
final PsiStatement statement = getSurroundingStatement(element);
|
||||
if (statement == null) {
|
||||
return;
|
||||
}
|
||||
final String newStatement = "{\n" + statement.getText() + "\n}";
|
||||
PsiReplacementUtil.replaceStatement(statement, newStatement);
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
public class X {
|
||||
int f(boolean b) {
|
||||
if (b) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
public class X {
|
||||
int f(boolean b) {
|
||||
if (b) <spot>return 1</spot>;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention adds braces to control flow statements without
|
||||
braces.
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user