mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IntroduceVariableBase: cleanup
This commit is contained in:
+6
-6
@@ -185,9 +185,9 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isChooserNeeded(List<? extends PsiExpression> exprs) {
|
||||
if (exprs.size() == 1) {
|
||||
final PsiExpression expression = exprs.get(0);
|
||||
public static boolean isChooserNeeded(List<? extends PsiExpression> expressions) {
|
||||
if (expressions.size() == 1) {
|
||||
final PsiExpression expression = expressions.get(0);
|
||||
return expression instanceof PsiNewExpression && ((PsiNewExpression)expression).getAnonymousClass() != null;
|
||||
}
|
||||
return true;
|
||||
@@ -816,7 +816,7 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase {
|
||||
}
|
||||
if (containerParent instanceof PsiLambdaExpression) {
|
||||
PsiParameter[] parameters = ((PsiLambdaExpression)containerParent).getParameterList().getParameters();
|
||||
if (Arrays.stream(parameters).anyMatch(parameter -> vars.contains(parameter))) {
|
||||
if (Arrays.stream(parameters).anyMatch(vars::contains)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1115,12 +1115,12 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase {
|
||||
LOG.assertTrue(parentRange.getStartOffset() <= rangeMarker.getStartOffset(), parent + "; prefix:" + prefix + "; suffix:" + suffix);
|
||||
String beg = allText.substring(parentRange.getStartOffset(), rangeMarker.getStartOffset());
|
||||
//noinspection SSBasedInspection (suggested replacement breaks behavior)
|
||||
if (StringUtil.stripQuotesAroundValue(beg).trim().length() == 0 && prefix == null) beg = "";
|
||||
if (StringUtil.stripQuotesAroundValue(beg).trim().isEmpty() && prefix == null) beg = "";
|
||||
|
||||
LOG.assertTrue(rangeMarker.getEndOffset() <= parentRange.getEndOffset(), parent + "; prefix:" + prefix + "; suffix:" + suffix);
|
||||
String end = allText.substring(rangeMarker.getEndOffset(), parentRange.getEndOffset());
|
||||
//noinspection SSBasedInspection (suggested replacement breaks behavior)
|
||||
if (StringUtil.stripQuotesAroundValue(end).trim().length() == 0 && suffix == null) end = "";
|
||||
if (StringUtil.stripQuotesAroundValue(end).trim().isEmpty() && suffix == null) end = "";
|
||||
|
||||
final String start = beg + (prefix != null ? prefix : "");
|
||||
refIdx[0] = start.length();
|
||||
|
||||
Reference in New Issue
Block a user