do not get PostprocessReformattingAspect as component

GitOrigin-RevId: 0fa698b35192e54930e2a54e5f5975b67408f0b4
This commit is contained in:
Vladimir Krivosheev
2020-02-21 17:31:28 +00:00
committed by intellij-monorepo-bot
parent c5542c8a58
commit c028919af9
7 changed files with 17 additions and 46 deletions
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.java.refactoring;
import com.intellij.JavaTestUtil;
@@ -32,7 +32,7 @@ public class CopyClassTest extends LightMultiFileTestCase {
public void testPrivateMethodsInInterfaces() throws Exception {
doTest("Foo", "Bar");
}
public void testReplaceAllOccurrences1() throws Exception {
doTest("Foo", "Bar");
}
@@ -50,7 +50,7 @@ public class CopyClassTest extends LightMultiFileTestCase {
private void doTest(final String oldName, final String copyName) throws Exception {
myFixture.copyDirectoryToProject(getTestName(true), "");
performAction(oldName, copyName);
VirtualFile fileAfter = myFixture.findFileInTempDir(copyName + ".java");
VirtualFile fileExpected = myFixture.findFileInTempDir(copyName + ".expected.java");
@@ -68,7 +68,7 @@ public class CopyClassTest extends LightMultiFileTestCase {
Collections.singletonMap(oldClass.getNavigationElement().getContainingFile(),
new PsiClass[]{oldClass});
CopyClassesHandler.doCopyClasses(sourceClasses, copyName, targetDirectory, getProject());
getProject().getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting();
});
}
@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.psi.impl.file.impl;
import com.intellij.openapi.application.ApplicationManager;
@@ -371,7 +371,7 @@ public class FileManagerTest extends JavaPsiTestCase {
try {
ApplicationManager.getApplication().runWriteAction(() -> {
CodeStyleManager.getInstance(myProject).reformat(psiFile);
getProject().getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting();
myPsiManager.reloadFromDisk(psiFile);
});
}
@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
@@ -416,7 +416,7 @@ public abstract class JavaCodeInsightTestCase extends JavaPsiTestCase {
protected void checkResultByFile(@NotNull final String filePath, final boolean stripTrailingSpaces) throws Exception {
WriteCommandAction.writeCommandAction(getProject()).run(() -> {
getProject().getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting();
if (stripTrailingSpaces) {
((DocumentImpl)myEditor.getDocument()).stripTrailingSpaces(getProject());
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 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.
*/
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring;
import com.intellij.codeInsight.JavaCodeInsightTestCase;
@@ -56,7 +42,7 @@ public abstract class MultiFileTestCase extends JavaCodeInsightTestCase {
final VirtualFile rootAfter = LocalFileSystem.getInstance().findFileByPath(pathAfter.replace(File.separatorChar, '/'));
performAction.performAction(rootDir, rootAfter);
WriteCommandAction.runWriteCommandAction(getProject(), () -> myProject.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting());
WriteCommandAction.runWriteCommandAction(getProject(), () -> PostprocessReformattingAspect.getInstance(myProject).doPostponedFormatting());
FileDocumentManager.getInstance().saveAllDocuments();
@@ -1,6 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o.
// Use of this source code is governed by the Apache 2.0 license that can be
// found in the LICENSE file.
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring;
import com.intellij.openapi.command.WriteCommandAction;
@@ -151,7 +149,7 @@ public abstract class TypeMigrationTestBase extends LightMultiFileTestCase {
WriteCommandAction.runWriteCommandAction(null, () -> pr.performRefactoring(usages));
WriteCommandAction.runWriteCommandAction(getProject(), () -> getProject().getComponent(PostprocessReformattingAspect.class).doPostponedFormatting());
WriteCommandAction.runWriteCommandAction(getProject(), () -> PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting());
myFixture.getTempDirFixture().createFile(className + ".items", report);
}
@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.psi.impl.source.codeStyle;
@@ -230,7 +230,8 @@ public class CodeFormatterFacade {
i++;
}
}
final PostprocessReformattingAspect component = file.getProject().getComponent(PostprocessReformattingAspect.class);
PostprocessReformattingAspect component = PostprocessReformattingAspect.getInstance(file.getProject());
FormattingProgressTask.FORMATTING_CANCELLED_FLAG.set(false);
component.doPostponedFormatting(file.getViewProvider());
i = 0;
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2012 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.
*/
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.refactoring.move;
@@ -105,7 +91,7 @@ public class GroovyMoveScriptTest extends LightJavaCodeInsightFixtureTestCase {
final VirtualFile expectedRoot = LocalFileSystem.getInstance().findFileByPath(getTestDataPath() + getTestName(true) + "/after");
//File expectedRoot = new File(getTestDataPath() + testName + "/after");
getProject().getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting();
VirtualFileManager.getInstance().syncRefresh();
try {