diff --git a/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java b/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java index ec910ed2abd7e9b5c54199e55921eca4bc25b4d3..b6fc14a9a83cbb5410f97c7eea52232447c748b3 100644 --- a/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java +++ b/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java @@ -778,12 +778,12 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase { return null; } - protected static PsiElement chooseAnchor(boolean allOccurences, + protected static PsiElement chooseAnchor(boolean allOccurrences, boolean hasWriteAccess, List<PsiExpression> nonWrite, PsiElement anchorStatementIfAll, PsiElement anchorStatement) { - if (allOccurences) { + if (allOccurrences) { if (hasWriteAccess) { return RefactoringUtil.getAnchorElementForMultipleExpressions(nonWrite.toArray(new PsiExpression[nonWrite.size()]), null); } @@ -965,8 +965,8 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase { } if (editor != null) { - final PsiElement[] replacedOccurences = PsiUtilCore.toPsiElementArray(array); - highlightReplacedOccurences(project, editor, replacedOccurences); + final PsiElement[] replacedOccurrences = PsiUtilCore.toPsiElementArray(array); + highlightReplacedOccurrences(project, editor, replacedOccurrences); } } else { if (!deleteSelf && replaceSelf) { @@ -1116,11 +1116,11 @@ 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()); - if (StringUtil.stripQuotesAroundValue(beg).trim().length() == 0 && prefix == null) beg = ""; + if (StringUtil.unquoteString(beg).trim().length() == 0 && prefix == null) beg = ""; LOG.assertTrue(rangeMarker.getEndOffset() <= parentRange.getEndOffset(), parent + "; prefix:" + prefix + "; suffix:" + suffix); String end = allText.substring(rangeMarker.getEndOffset(), parentRange.getEndOffset()); - if (StringUtil.stripQuotesAroundValue(end).trim().length() == 0 && suffix == null) end = ""; + if (StringUtil.unquoteString(end).trim().length() == 0 && suffix == null) end = ""; final String start = beg + (prefix != null ? prefix : ""); refIdx[0] = start.length(); @@ -1150,13 +1150,13 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase { return child; } - protected static void highlightReplacedOccurences(Project project, Editor editor, PsiElement[] replacedOccurences){ + protected static void highlightReplacedOccurrences(Project project, Editor editor, PsiElement[] replacedOccurrences){ if (editor == null) return; if (ApplicationManager.getApplication().isUnitTestMode()) return; HighlightManager highlightManager = HighlightManager.getInstance(project); EditorColorsManager colorsManager = EditorColorsManager.getInstance(); TextAttributes attributes = colorsManager.getGlobalScheme().getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES); - highlightManager.addOccurrenceHighlights(editor, replacedOccurences, attributes, true, null); + highlightManager.addOccurrenceHighlights(editor, replacedOccurrences, attributes, true, null); WindowManager.getInstance().getStatusBar(project).setInfo(RefactoringBundle.message("press.escape.to.remove.the.highlighting")); } @@ -1231,7 +1231,7 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase { if (enclosingExpr instanceof PsiMethodCallExpression) { PsiMethod method = ((PsiMethodCallExpression)enclosingExpr).resolveMethod(); if (method != null && method.isConstructor()) { - //This is either 'this' or 'super', both must be the first in the respective contructor + //This is either 'this' or 'super', both must be the first in the respective constructor String message = RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("invalid.expression.context")); CommonRefactoringUtil.showErrorHint(project, editor, message, refactoringName, helpID); return true; diff --git a/java/java-impl/src/com/intellij/refactoring/introduceVariable/JavaVariableInplaceIntroducer.java b/java/java-impl/src/com/intellij/refactoring/introduceVariable/JavaVariableInplaceIntroducer.java index 7d86a7b4b8e15bfd5deab5e5f67ebe80ee7786d0..6480a155657b9c672e806d4d5df94c898a682b72 100644 --- a/java/java-impl/src/com/intellij/refactoring/introduceVariable/JavaVariableInplaceIntroducer.java +++ b/java/java-impl/src/com/intellij/refactoring/introduceVariable/JavaVariableInplaceIntroducer.java @@ -245,7 +245,7 @@ public class JavaVariableInplaceIntroducer extends AbstractJavaInplaceIntroducer public void actionPerformed(ActionEvent e) { new WriteCommandAction(myProject, getCommandName(), getCommandName()) { @Override - protected void run(@NotNull Result result) throws Throwable { + protected void run(@NotNull Result result) { PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument()); final PsiVariable variable = getVariable(); if (variable != null) {