execute tests outside write action by default

This commit is contained in:
Alexey Kudravtsev
2016-02-12 15:18:39 +03:00
parent 9a49afe38d
commit 1d1025401f
26 changed files with 568 additions and 181 deletions
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* 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.intellij.codeInsight;
import com.intellij.JavaTestUtil;
@@ -5,6 +20,8 @@ import com.intellij.codeInsight.generation.GenerateMembersUtil;
import com.intellij.codeInsight.generation.GenerationInfo;
import com.intellij.codeInsight.generation.PsiGenerationInfo;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.Computable;
import com.intellij.psi.*;
import com.intellij.testFramework.LightCodeInsightTestCase;
import org.jetbrains.annotations.NonNls;
@@ -47,7 +64,12 @@ public class GenerateMembersUtilTest extends LightCodeInsightTestCase {
PsiMethod method = factory.createMethod("foo", PsiType.VOID);
int offset = getEditor().getCaretModel().getOffset();
List<GenerationInfo> list = Collections.<GenerationInfo>singletonList(new PsiGenerationInfo<PsiMethod>(method));
List<GenerationInfo> members = GenerateMembersUtil.insertMembersAtOffset(getFile(), offset, list);
List<GenerationInfo> members = ApplicationManager.getApplication().runWriteAction(new Computable<List<GenerationInfo>>() {
@Override
public List<GenerationInfo> compute() {
return GenerateMembersUtil.insertMembersAtOffset(getFile(), offset, list);
}
});
members.get(0).positionCaret(myEditor, true);
checkResultByFile(null, BASE_PATH + getTestName(false) + "_after.java", true);
}
@@ -63,10 +85,16 @@ public class GenerateMembersUtilTest extends LightCodeInsightTestCase {
PsiJavaFile file = (PsiJavaFile)PsiFileFactory.getInstance(getProject())
.createFileFromText(JavaLanguage.INSTANCE, "class A {void foo() {}}\n class B extends A {void foo() {}\n}");
method = file.getClasses()[1].getMethods()[0];
GenerateMembersUtil.setupGeneratedMethod(method);
assertEquals("@Override void foo() {\n" +
" super.foo();\n" +
" }", method.getText());
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
PsiMethod newMethod = file.getClasses()[1].getMethods()[0];
GenerateMembersUtil.setupGeneratedMethod(newMethod);
assertEquals("@Override void foo() {\n" +
" super.foo();\n" +
" }", newMethod.getText());
}
});
}
}
@@ -1,7 +1,23 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* 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.intellij.codeInsight;
import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.generation.actions.GenerateSuperMethodCallAction;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiFile;
@@ -43,7 +59,13 @@ public class GenerateSuperMethodCallTest extends LightCodeInsightTestCase {
return super.getHandler();
}
}.getHandler();
handler.invoke(getProject(), getEditor(), getFile());
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
handler.invoke(getProject(), getEditor(), getFile());
}
});
checkResultByFile(after);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import com.intellij.codeInsight.generation.OverrideImplementUtil;
import com.intellij.codeInsight.generation.PsiMethodMember;
import com.intellij.codeInsight.intention.impl.ImplementAbstractMethodHandler;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleSettings;
@@ -163,19 +164,27 @@ public class OverrideImplement15Test extends LightCodeInsightTestCase {
PsiElement context = getFile().findElementAt(offset);
PsiClass psiClass = PsiTreeUtil.getParentOfType(context, PsiClass.class);
assert psiClass != null;
if (toImplement == null) {
PsiClassType[] implement = psiClass.getImplementsListTypes();
final PsiClass superClass = implement.length == 0 ? psiClass.getSuperClass() : implement[0].resolve();
assert superClass != null;
PsiMethod method = superClass.getMethods()[0];
final PsiSubstitutor substitutor = TypeConversionUtil.getSuperClassSubstitutor(superClass, psiClass, PsiSubstitutor.EMPTY);
final List<PsiMethodMember> candidates = Collections.singletonList(new PsiMethodMember(method,
OverrideImplementExploreUtil.correctSubstitutor(method, substitutor)));
OverrideImplementUtil.overrideOrImplementMethodsInRightPlace(getEditor(), psiClass, candidates, copyJavadoc, true);
}
else {
OverrideImplementUtil.chooseAndOverrideOrImplementMethods(getProject(), getEditor(), psiClass, toImplement);
}
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
if (toImplement == null) {
PsiClassType[] implement = psiClass.getImplementsListTypes();
final PsiClass superClass = implement.length == 0 ? psiClass.getSuperClass() : implement[0].resolve();
assert superClass != null;
PsiMethod method = superClass.getMethods()[0];
final PsiSubstitutor substitutor = TypeConversionUtil.getSuperClassSubstitutor(superClass, psiClass, PsiSubstitutor.EMPTY);
final List<PsiMethodMember> candidates = Collections.singletonList(new PsiMethodMember(method,
OverrideImplementExploreUtil
.correctSubstitutor(method,
substitutor)));
OverrideImplementUtil.overrideOrImplementMethodsInRightPlace(getEditor(), psiClass, candidates, copyJavadoc, true);
}
else {
OverrideImplementUtil.chooseAndOverrideOrImplementMethods(getProject(), getEditor(), psiClass, toImplement);
}
}
});
checkResultByFile(BASE_DIR + "after" + name + ".java");
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@ import com.intellij.ide.DataManager;
import com.intellij.lang.properties.psi.PropertiesFile;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.psi.PsiExpression;
import com.intellij.psi.PsiLiteralExpression;
@@ -61,8 +62,15 @@ public class I18nizeTest extends LightCodeInsightTestCase {
if (afterFileExists) {
PsiLiteralExpression literalExpression = I18nizeAction.getEnclosingStringLiteral(getFile(), getEditor());
assertNotNull(handler);
handler.performI18nization(getFile(), getEditor(), literalExpression, Collections.<PropertiesFile>emptyList(), "key1", "value1", "i18nizedExpr",
PsiExpression.EMPTY_ARRAY, JavaI18nUtil.DEFAULT_PROPERTY_CREATION_HANDLER);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
handler.performI18nization(getFile(), getEditor(), literalExpression, Collections.<PropertiesFile>emptyList(), "key1", "value1",
"i18nizedExpr",
PsiExpression.EMPTY_ARRAY, JavaI18nUtil.DEFAULT_PROPERTY_CREATION_HANDLER);
}
});
checkResultByFile(afterFile);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@ import com.intellij.lang.LanguageSurrounders;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.lang.surroundWith.SurroundDescriptor;
import com.intellij.lang.surroundWith.Surrounder;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.SelectionModel;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
@@ -216,14 +217,26 @@ public class JavaSurroundWithTest extends LightCodeInsightTestCase {
PsiElement[] elements = item.getElementsToSurround(getFile(), selectionModel.getSelectionStart(), selectionModel.getSelectionEnd());
assertTrue(surrounder.isApplicable(elements));
SurroundWithHandler.invoke(getProject(), getEditor(), getFile(), surrounder);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
SurroundWithHandler.invoke(getProject(), getEditor(), getFile(), surrounder);
}
});
checkResultByFile(BASE_PATH + fileName + "_after.java");
}
private void doTestWithTemplateFinish(@NotNull String fileName, Surrounder surrounder, @Nullable String textToType) {
TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
configureByFile(BASE_PATH + fileName + ".java");
SurroundWithHandler.invoke(getProject(), getEditor(), getFile(), surrounder);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
SurroundWithHandler.invoke(getProject(), getEditor(), getFile(), surrounder);
}
});
if (textToType != null) {
type(textToType);
}
@@ -1,6 +1,22 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* 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.intellij.codeInsight.intention;
import com.intellij.codeInsight.intention.impl.SplitIfAction;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import com.intellij.testFramework.LightCodeInsightTestCase;
@@ -61,6 +77,11 @@ public class SplitIfActionTest extends LightCodeInsightTestCase {
private void perform() throws Exception {
SplitIfAction action = new SplitIfAction();
assertTrue(action.isAvailable(getProject(), getEditor(), getFile()));
action.invoke(getProject(), getEditor(), getFile());
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
action.invoke(getProject(), getEditor(), getFile());
}
});
}
}
@@ -1,3 +1,19 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* 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.
*/
/*
* Created by IntelliJ IDEA.
* User: Maxim.Mossienko
@@ -6,6 +22,7 @@
*/
package com.intellij.editor;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.impl.LineSet;
import com.intellij.testFramework.LightCodeInsightTestCase;
@@ -55,46 +72,56 @@ public class LineSetIncrementalUpdateTest extends LightCodeInsightTestCase {
}
private static void doInsert() {
Document document = myEditor.getDocument();
document.insertString(myEditor.getCaretModel().getOffset(), STRING6);
document.insertString(myEditor.getCaretModel().getOffset(), STRING5);
document.insertString(myEditor.getCaretModel().getOffset(), STRING4);
document.insertString(myEditor.getCaretModel().getOffset(), STRING3);
document.insertString(myEditor.getCaretModel().getOffset(), STRING2);
document.insertString(myEditor.getCaretModel().getOffset(), STRING1);
new WriteCommandAction.Simple(getProject()) {
@Override
protected void run() throws Throwable {
Document document = myEditor.getDocument();
document.insertString(myEditor.getCaretModel().getOffset(), STRING6);
document.insertString(myEditor.getCaretModel().getOffset(), STRING5);
document.insertString(myEditor.getCaretModel().getOffset(), STRING4);
document.insertString(myEditor.getCaretModel().getOffset(), STRING3);
document.insertString(myEditor.getCaretModel().getOffset(), STRING2);
document.insertString(myEditor.getCaretModel().getOffset(), STRING1);
}
}.execute().throwException();
}
private static void doDelete() {
Document document = myEditor.getDocument();
new WriteCommandAction.Simple(getProject()) {
@Override
protected void run() throws Throwable {
Document document = myEditor.getDocument();
document.deleteString(
myEditor.getCaretModel().getOffset(),
myEditor.getCaretModel().getOffset() + STRING1.length()
);
document.deleteString(
myEditor.getCaretModel().getOffset(),
myEditor.getCaretModel().getOffset() + STRING1.length()
);
document.deleteString(
myEditor.getCaretModel().getOffset(),
myEditor.getCaretModel().getOffset() + STRING2.length()
);
document.deleteString(
myEditor.getCaretModel().getOffset(),
myEditor.getCaretModel().getOffset() + STRING2.length()
);
document.deleteString(
myEditor.getCaretModel().getOffset(),
myEditor.getCaretModel().getOffset() + STRING3.length()
);
document.deleteString(
myEditor.getCaretModel().getOffset(),
myEditor.getCaretModel().getOffset() + STRING3.length()
);
document.deleteString(
myEditor.getCaretModel().getOffset(),
myEditor.getCaretModel().getOffset() + STRING4.length()
);
document.deleteString(
myEditor.getCaretModel().getOffset(),
myEditor.getCaretModel().getOffset() + STRING4.length()
);
document.deleteString(
myEditor.getCaretModel().getOffset(),
myEditor.getCaretModel().getOffset() + STRING5.length()
);
document.deleteString(
myEditor.getCaretModel().getOffset(),
myEditor.getCaretModel().getOffset() + STRING5.length()
);
document.deleteString(
myEditor.getCaretModel().getOffset(),
myEditor.getCaretModel().getOffset() + STRING6.length()
);
document.deleteString(
myEditor.getCaretModel().getOffset(),
myEditor.getCaretModel().getOffset() + STRING6.length()
);
}
}.execute().throwException();
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,9 +43,4 @@ public class FoldingExceptionTest extends LightCodeInsightTestCase {
PsiDocumentManager.getInstance(ourProject).commitAllDocuments();
CodeInsightTestFixtureImpl.instantiateAndRun(myFile, myEditor, new int[]{Pass.UPDATE_ALL, Pass.LOCAL_INSPECTIONS}, false);
}
@Override
protected boolean isRunInWriteAction() {
return false;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@ package com.intellij.openapi.editor.impl;
import com.intellij.codeInsight.folding.CodeFoldingManager;
import com.intellij.openapi.actionSystem.IdeActions;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.editor.CaretModel;
import com.intellij.openapi.editor.FoldRegion;
import com.intellij.psi.PsiDocumentManager;
@@ -80,11 +81,24 @@ public class FoldingProcessingOnDocumentModificationTest extends AbstractEditorT
"}");
executeAction(IdeActions.ACTION_COLLAPSE_ALL_REGIONS);
checkFoldingState("[FoldRegion +(25:33), placeholder='{...}']");
myEditor.getDocument().insertString(0, "/*");
new WriteCommandAction.Simple(getProject()) {
@Override
protected void run() throws Throwable {
myEditor.getDocument().insertString(0, "/*");
}
}.execute().throwException();
checkFoldingState("[FoldRegion -(0:37), placeholder='/.../', FoldRegion +(27:35), placeholder='{...}']");
myEditor.getDocument().deleteString(0, 2);
WriteCommandAction.runWriteCommandAction(getProject(),
new Runnable() {
@Override
public void run() {
myEditor.getDocument().deleteString(0, 2);
}
});
checkFoldingState("[FoldRegion +(25:33), placeholder='{...}']");
}
@@ -97,7 +111,13 @@ public class FoldingProcessingOnDocumentModificationTest extends AbstractEditorT
executeAction(IdeActions.ACTION_COLLAPSE_ALL_REGIONS);
checkFoldingState("[FoldRegion +(25:33), placeholder='{...}']");
myEditor.getDocument().insertString(0, "/*");
new WriteCommandAction.Simple(getProject()) {
@Override
protected void run() throws Throwable {
myEditor.getDocument().insertString(0, "/*");
}
}.execute().throwException();
checkFoldingState("[FoldRegion -(0:37), placeholder='/.../', FoldRegion +(27:35), placeholder='{...}']");
executeAction(IdeActions.ACTION_EXPAND_ALL_REGIONS);
@@ -1,8 +1,25 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* 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.
*/
/*
* @author max
*/
package com.intellij.psi;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.editor.Document;
import com.intellij.psi.impl.DebugUtil;
import com.intellij.testFramework.LightCodeInsightTestCase;
@@ -1084,7 +1101,13 @@ public class TreeIsCorrectAfterDiffReparseTest extends LightCodeInsightTestCase
final PsiDocumentManager docManager = PsiDocumentManager.getInstance(ourProject);
final Document doc = docManager.getDocument(myFile);
doc.insertString(part1.length(), "/**");
WriteCommandAction.runWriteCommandAction(getProject(), new Runnable() {
@Override
public void run() {
doc.insertString(part1.length(), "/**");
}
});
boolean old = DebugUtil.CHECK;
DebugUtil.CHECK = true;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
package com.intellij.psi.formatter.java;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
@@ -168,7 +169,13 @@ public class JavaFormatterInEditorTest extends LightPlatformCodeInsightTestCase
public void doTest(@NotNull String before, @NotNull String after) throws IOException {
configureFromFileText(getTestName(false) + ".java", before);
CodeStyleManager.getInstance(getProject()).reformatText(getFile(), 0, getEditor().getDocument().getTextLength());
WriteCommandAction.runWriteCommandAction(getProject(), new Runnable() {
@Override
public void run() {
CodeStyleManager.getInstance(getProject()).reformatText(getFile(), 0, getEditor().getDocument().getTextLength());
}
});
checkResultByText(after);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,7 +66,13 @@ public class ExtendsBoundListTest extends LightCodeInsightTestCase {
final PsiClass cloneableClass = getJavaFacade().findClass("java.lang.Cloneable");
assertNotNull(cloneableClass);
final PsiJavaCodeReferenceElement reference = getJavaFacade().getElementFactory().createClassReferenceElement(cloneableClass);
extendsList.addAfter(reference, extendsList.getReferenceElements()[0]);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
extendsList.addAfter(reference, extendsList.getReferenceElements()[0]);
}
});
check();
}
@@ -76,7 +82,13 @@ public class ExtendsBoundListTest extends LightCodeInsightTestCase {
final PsiClass cloneableClass = getJavaFacade().findClass("java.lang.Cloneable");
assertNotNull(cloneableClass);
final PsiJavaCodeReferenceElement reference = getJavaFacade().getElementFactory().createClassReferenceElement(cloneableClass);
extendsList.addBefore(reference, extendsList.getReferenceElements()[0]);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
extendsList.addBefore(reference, extendsList.getReferenceElements()[0]);
}
});
check();
}
@@ -86,7 +98,13 @@ public class ExtendsBoundListTest extends LightCodeInsightTestCase {
final PsiClass cloneableClass = getJavaFacade().findClass("java.lang.Cloneable");
assertNotNull(cloneableClass);
final PsiJavaCodeReferenceElement reference = getJavaFacade().getElementFactory().createClassReferenceElement(cloneableClass);
extendsList.addBefore(reference, null);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
extendsList.addBefore(reference, null);
}
});
check();
}
@@ -96,7 +114,13 @@ public class ExtendsBoundListTest extends LightCodeInsightTestCase {
final PsiClass cloneableClass = getJavaFacade().findClass(CommonClassNames.JAVA_LANG_RUNNABLE);
assertNotNull(cloneableClass);
final PsiJavaCodeReferenceElement reference = getJavaFacade().getElementFactory().createClassReferenceElement(cloneableClass);
extendsList.add(reference);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
extendsList.add(reference);
}
});
check();
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package com.intellij.refactoring;
import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.CodeInsightUtil;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
@@ -919,7 +920,12 @@ public class ExtractMethodTest extends LightCodeInsightTestCase {
for (final Match match : duplicates) {
if (!match.getMatchStart().isValid() || !match.getMatchEnd().isValid()) continue;
PsiDocumentManager.getInstance(project).commitAllDocuments();
processor.processMatch(match);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
processor.processMatch(match);
}
});
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -215,8 +215,4 @@ public class InplaceIntroduceParameterTest extends AbstractJavaInplaceIntroduceT
return super.invokeImpl(project, localVariable, editor);
}
}
@Override
protected boolean isRunInWriteAction() {
return false;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,4 @@ package com.intellij.refactoring;
import com.intellij.testFramework.LightCodeInsightTestCase;
public abstract class LightRefactoringTestCase extends LightCodeInsightTestCase{
@Override
protected boolean isRunInWriteAction() {
return false;
}
}