mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
no need to use PlatformTestUtil.registerExtension() anymore (EP now supports parent disposable directly)
This commit is contained in:
@@ -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-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.
|
||||
package com.intellij.java.codeInsight
|
||||
|
||||
import com.intellij.codeInsight.documentation.DocumentationManager
|
||||
@@ -9,11 +9,9 @@ import com.intellij.psi.JavaPsiFacade
|
||||
import com.intellij.psi.PsiExpressionList
|
||||
import com.intellij.psi.PsiMethod
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import groovy.transform.CompileStatic
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
@@ -174,7 +172,7 @@ class JavaDocumentationTest extends LightCodeInsightFixtureTestCase {
|
||||
JavaPsiFacade.getInstance(project).findClass('Foo', it.resolveScope)?.findMethodBySignature(it, false)
|
||||
}
|
||||
}
|
||||
PlatformTestUtil.registerExtension DocumentationDelegateProvider.EP_NAME, provider, myFixture.testRootDisposable
|
||||
DocumentationDelegateProvider.EP_NAME.getPoint(null).registerExtension(provider, myFixture.testRootDisposable)
|
||||
|
||||
configure '''\
|
||||
class Foo {
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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-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.
|
||||
package com.intellij.java.codeInsight
|
||||
|
||||
import com.intellij.JavaTestUtil
|
||||
@@ -216,7 +202,7 @@ class Test implements A {
|
||||
|
||||
void testTypeAnnotationsInImplementedMethod() {
|
||||
def handler = new OverrideImplementsAnnotationsHandler() { @Override String[] getAnnotations(Project project) { return ["TA"] } }
|
||||
PlatformTestUtil.registerExtension(OverrideImplementsAnnotationsHandler.EP_NAME, handler, testRootDisposable)
|
||||
OverrideImplementsAnnotationsHandler.EP_NAME.getPoint(null).registerExtension(handler, testRootDisposable)
|
||||
|
||||
myFixture.addClass """\
|
||||
import java.lang.annotation.*;
|
||||
|
||||
+2
-17
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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-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.
|
||||
package com.intellij.java.codeInsight.daemon;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -24,7 +10,6 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiField;
|
||||
import com.intellij.psi.PsiNamedElement;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -34,7 +19,7 @@ public class LightUnusedHighlightingFixtureTest extends LightCodeInsightFixtureT
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
myFixture.enableInspections(new UnusedDeclarationInspection(true));
|
||||
PlatformTestUtil.registerExtension(ImplicitUsageProvider.EP_NAME, new ImplicitUsageProvider() {
|
||||
ImplicitUsageProvider.EP_NAME.getPoint(null).registerExtension(new ImplicitUsageProvider() {
|
||||
@Override
|
||||
public boolean isImplicitUsage(PsiElement element) {
|
||||
return false;
|
||||
|
||||
+2
-17
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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-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.
|
||||
package com.intellij.java.codeInsight.daemon;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -21,7 +7,6 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.augment.PsiAugmentProvider;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import gnu.trove.THashSet;
|
||||
@@ -39,7 +24,7 @@ public class PsiAugmentProviderTest extends LightCodeInsightFixtureTestCase {
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
PlatformTestUtil.registerExtension(PsiAugmentProvider.EP_NAME, new TestAugmentProvider(), myFixture.getTestRootDisposable());
|
||||
PsiAugmentProvider.EP_NAME.getPoint(null).registerExtension(new TestAugmentProvider(), myFixture.getTestRootDisposable());
|
||||
myFixture.addClass("package lombok;\npublic @interface val { }");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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-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.
|
||||
|
||||
package com.intellij.java.codeInspection;
|
||||
|
||||
@@ -23,7 +9,6 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiField;
|
||||
import com.intellij.psi.PsiNamedElement;
|
||||
import com.intellij.testFramework.InspectionTestCase;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
|
||||
public class CanBeFinalTest extends InspectionTestCase {
|
||||
@Override
|
||||
@@ -50,7 +35,7 @@ public class CanBeFinalTest extends InspectionTestCase {
|
||||
public void testassignedFromLambda() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
|
||||
public void testassignedFromLambdaInClassInitializer() {
|
||||
doTest();
|
||||
}
|
||||
@@ -143,7 +128,7 @@ public class CanBeFinalTest extends InspectionTestCase {
|
||||
}
|
||||
|
||||
public void testfieldImplicitWrite() {
|
||||
PlatformTestUtil.registerExtension(ImplicitUsageProvider.EP_NAME, new ImplicitUsageProvider() {
|
||||
ImplicitUsageProvider.EP_NAME.getPoint(null).registerExtension(new ImplicitUsageProvider() {
|
||||
@Override
|
||||
public boolean isImplicitUsage(PsiElement element) {
|
||||
return isImplicitWrite(element);
|
||||
|
||||
+12
-27
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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-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.
|
||||
package com.intellij.java.codeInspection;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -23,7 +9,6 @@ import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiField;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -211,7 +196,7 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase {
|
||||
public void testBoxedNaN() { doTest(); }
|
||||
public void testFloatEquality() { doTest(); }
|
||||
public void testLastConstantConditionInAnd() { doTest(); }
|
||||
|
||||
|
||||
public void testCompileTimeConstant() { doTest(); }
|
||||
public void testNoParenthesesWarnings() { doTest(); }
|
||||
|
||||
@@ -286,8 +271,8 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase {
|
||||
public void testFinalGetter() { doTest(); }
|
||||
public void testGetterResultsNotSame() { doTest(); }
|
||||
public void testIntersectionTypeInstanceof() { doTest(); }
|
||||
|
||||
public void testKeepComments() {
|
||||
|
||||
public void testKeepComments() {
|
||||
doTest();
|
||||
checkIntentionResult("Simplify");
|
||||
}
|
||||
@@ -324,7 +309,7 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase {
|
||||
public void testDontMakeUnrelatedVariableNotNullWhenMerging() { doTest(); }
|
||||
public void testDontMakeUnrelatedVariableFalseWhenMerging() { doTest(); }
|
||||
public void testDontLoseInequalityInformation() { doTest(); }
|
||||
|
||||
|
||||
public void testNotEqualsTypo() { doTest(); }
|
||||
public void testAndEquals() { doTest(); }
|
||||
public void testXor() { doTest(); }
|
||||
@@ -333,7 +318,7 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase {
|
||||
public void testEmptyCallDoesNotMakeNullable() { doTest(); }
|
||||
public void testGettersAndPureNoFlushing() { doTest(); }
|
||||
public void testFalseGetters() { doTest(); }
|
||||
|
||||
|
||||
public void testNotNullAfterDereference() { doTest(); }
|
||||
|
||||
public void testNullableBoolean() { doTest(); }
|
||||
@@ -363,22 +348,22 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase {
|
||||
public void testParametersAreNonnullByDefault() {
|
||||
addJavaxNullabilityAnnotations(myFixture);
|
||||
addJavaxDefaultNullabilityAnnotations(myFixture);
|
||||
|
||||
|
||||
myFixture.addClass("package foo; public class AnotherPackageNotNull { public static void foo(String s) {}}");
|
||||
myFixture.addFileToProject("foo/package-info.java", "@javax.annotation.ParametersAreNonnullByDefault package foo;");
|
||||
|
||||
doTest();
|
||||
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNullabilityDefaultVsMethodImplementing() {
|
||||
addJavaxDefaultNullabilityAnnotations(myFixture);
|
||||
|
||||
|
||||
DataFlowInspection inspection = new DataFlowInspection();
|
||||
inspection.TREAT_UNKNOWN_MEMBERS_AS_NULLABLE = true;
|
||||
myFixture.enableInspections(inspection);
|
||||
myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
|
||||
}
|
||||
|
||||
|
||||
public void testTypeQualifierNickname() {
|
||||
myFixture.addClass("package javax.annotation.meta; public @interface TypeQualifierNickname {}");
|
||||
addJavaxNullabilityAnnotations(myFixture);
|
||||
@@ -550,7 +535,7 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase {
|
||||
public void testFieldUsedBeforeInitialization() { doTest(); }
|
||||
|
||||
public void testImplicitlyInitializedField() {
|
||||
PlatformTestUtil.registerExtension(ImplicitUsageProvider.EP_NAME, new ImplicitUsageProvider() {
|
||||
ImplicitUsageProvider.EP_NAME.getPoint(null).registerExtension(new ImplicitUsageProvider() {
|
||||
@Override
|
||||
public boolean isImplicitUsage(PsiElement element) {
|
||||
return false;
|
||||
|
||||
+10
-25
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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-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.
|
||||
package com.intellij.openapi.roots.impl;
|
||||
|
||||
import com.intellij.ide.projectView.actions.MarkRootActionBase;
|
||||
@@ -25,7 +11,6 @@ import com.intellij.openapi.roots.ex.ProjectRootManagerEx;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -211,14 +196,14 @@ public class DirectoryIndexForExcludePatternsTest extends DirectoryIndexTestCase
|
||||
|
||||
private void registerLibrary(@NotNull VirtualFile root, @Nullable Condition<VirtualFile> excludePattern) {
|
||||
WriteAction.run(() -> ProjectRootManagerEx.getInstanceEx(myProject).makeRootsChange(
|
||||
() -> PlatformTestUtil.registerExtension(AdditionalLibraryRootsProvider.EP_NAME, new AdditionalLibraryRootsProvider() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<SyntheticLibrary> getAdditionalProjectLibraries(@NotNull Project project) {
|
||||
return myProject == project ? Collections.singletonList(
|
||||
SyntheticLibrary.newImmutableLibrary(Collections.singleton(root), Collections.emptySet(), Collections.emptySet(), excludePattern)
|
||||
) : Collections.emptyList();
|
||||
}
|
||||
}, getTestRootDisposable()), false, true));
|
||||
() -> AdditionalLibraryRootsProvider.EP_NAME.getPoint(null).registerExtension(new AdditionalLibraryRootsProvider() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<SyntheticLibrary> getAdditionalProjectLibraries(@NotNull Project project) {
|
||||
return myProject == project ? Collections.singletonList(
|
||||
SyntheticLibrary.newImmutableLibrary(Collections.singleton(root), Collections.emptySet(), Collections.emptySet(), excludePattern)
|
||||
) : Collections.emptyList();
|
||||
}
|
||||
}, getTestRootDisposable()), false, true));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -407,7 +407,7 @@ public class ConsoleViewImplTest extends LightPlatformTestCase {
|
||||
return Collections.singletonList(Pair.create("+!" + text + "-!", contentType));
|
||||
}
|
||||
};
|
||||
PlatformTestUtil.registerExtension(ConsoleInputFilterProvider.INPUT_FILTER_PROVIDERS, crazyProvider, getTestRootDisposable());
|
||||
ConsoleInputFilterProvider.INPUT_FILTER_PROVIDERS.getPoint(null).registerExtension(crazyProvider, getTestRootDisposable());
|
||||
myConsole = createConsole();
|
||||
StringBuilder expectedText = new StringBuilder();
|
||||
List<Pair<String, ConsoleViewContentType>> expectedRegisteredTokens = new ArrayList<>();
|
||||
|
||||
+3
-17
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
// 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.
|
||||
package com.intellij.openapi.editor.impl;
|
||||
|
||||
import com.intellij.lang.LanguageAnnotators;
|
||||
@@ -34,7 +20,6 @@ import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.fileTypes.PlainTextFileType;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -50,7 +35,8 @@ public class DocumentMarkupModelTest extends LightPlatformCodeInsightFixtureTest
|
||||
LanguageExtensionPoint<Annotator> extension = new LanguageExtensionPoint<>();
|
||||
extension.language="TEXT";
|
||||
extension.implementationClass = TestAnnotator.class.getName();
|
||||
PlatformTestUtil.registerExtension(ExtensionPointName.create(LanguageAnnotators.EP_NAME), extension, myFixture.getTestRootDisposable());
|
||||
ExtensionPointName.<LanguageExtensionPoint<Annotator>>create(LanguageAnnotators.EP_NAME)
|
||||
.getPoint(null).registerExtension(extension, myFixture.getTestRootDisposable());
|
||||
myFixture.configureByText(PlainTextFileType.INSTANCE, "foo");
|
||||
EditorColorsScheme scheme = new EditorColorsSchemeImpl(new DefaultColorsScheme()){{initFonts();}};
|
||||
scheme.setAttributes(HighlighterColors.TEXT, new TextAttributes(Color.black, Color.white, null, null, Font.PLAIN));
|
||||
|
||||
+8
-9
@@ -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-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.
|
||||
package com.intellij.openapi.fileEditor;
|
||||
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
@@ -114,8 +114,8 @@ public class FileEditorManagerTest extends FileEditorManagerTestCase {
|
||||
}
|
||||
|
||||
public void testOpenRecentEditorTab() throws Exception {
|
||||
PlatformTestUtil
|
||||
.registerExtension(FileEditorProvider.EP_FILE_EDITOR_PROVIDER, new MyFileEditorProvider(), myFixture.getTestRootDisposable());
|
||||
FileEditorProvider.EP_FILE_EDITOR_PROVIDER
|
||||
.getPoint(null).registerExtension(new MyFileEditorProvider(), myFixture.getTestRootDisposable());
|
||||
|
||||
openFiles(" <component name=\"FileEditorManager\">\n" +
|
||||
" <leaf>\n" +
|
||||
@@ -137,8 +137,8 @@ public class FileEditorManagerTest extends FileEditorManagerTestCase {
|
||||
}
|
||||
|
||||
public void testTrackSelectedEditor() {
|
||||
PlatformTestUtil
|
||||
.registerExtension(FileEditorProvider.EP_FILE_EDITOR_PROVIDER, new MyFileEditorProvider(), myFixture.getTestRootDisposable());
|
||||
FileEditorProvider.EP_FILE_EDITOR_PROVIDER
|
||||
.getPoint(null).registerExtension(new MyFileEditorProvider(), myFixture.getTestRootDisposable());
|
||||
VirtualFile file = getFile("/src/1.txt");
|
||||
assertNotNull(file);
|
||||
FileEditor[] editors = myManager.openFile(file, true);
|
||||
@@ -200,10 +200,9 @@ public class FileEditorManagerTest extends FileEditorManagerTestCase {
|
||||
}
|
||||
|
||||
public void testOpenInDumbMode() {
|
||||
PlatformTestUtil
|
||||
.registerExtension(FileEditorProvider.EP_FILE_EDITOR_PROVIDER, new MyFileEditorProvider(), myFixture.getTestRootDisposable());
|
||||
PlatformTestUtil
|
||||
.registerExtension(FileEditorProvider.EP_FILE_EDITOR_PROVIDER, new DumbAwareProvider(), myFixture.getTestRootDisposable());
|
||||
FileEditorProvider.EP_FILE_EDITOR_PROVIDER
|
||||
.getPoint(null).registerExtension(new MyFileEditorProvider(), myFixture.getTestRootDisposable());
|
||||
FileEditorProvider.EP_FILE_EDITOR_PROVIDER.getPoint(null).registerExtension(new DumbAwareProvider(), myFixture.getTestRootDisposable());
|
||||
try {
|
||||
DumbServiceImpl.getInstance(getProject()).setDumb(true);
|
||||
VirtualFile file = getFile("/src/foo.bar");
|
||||
|
||||
+3
-3
@@ -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-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.
|
||||
package com.intellij.openapi.fileEditor;
|
||||
|
||||
import com.intellij.codeInsight.navigation.NavigationUtil;
|
||||
@@ -7,7 +7,6 @@ import com.intellij.openapi.fileEditor.impl.IdeDocumentHistoryImpl;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import org.junit.Assert;
|
||||
|
||||
/**
|
||||
@@ -37,7 +36,8 @@ public class NewDocumentHistoryTest extends HeavyFileEditorManagerTestCase {
|
||||
}
|
||||
|
||||
public void testBackNavigationBetweenEditors() {
|
||||
PlatformTestUtil.registerExtension(FileEditorProvider.EP_FILE_EDITOR_PROVIDER, new FileEditorManagerTest.MyFileEditorProvider(), myFixture.getTestRootDisposable());
|
||||
FileEditorProvider.EP_FILE_EDITOR_PROVIDER
|
||||
.getPoint(null).registerExtension(new FileEditorManagerTest.MyFileEditorProvider(), myFixture.getTestRootDisposable());
|
||||
VirtualFile file = getFile("/src/1.txt");
|
||||
assertNotNull(file);
|
||||
FileEditor[] editors = myManager.openFile(file, true);
|
||||
|
||||
+1
-1
@@ -465,7 +465,7 @@ public class FileTypesTest extends PlatformTestCase {
|
||||
//String s = JDOMUtil.writeElement(element);
|
||||
|
||||
final AbstractFileType typeFromPlugin = new AbstractFileType(new SyntaxTable());
|
||||
PlatformTestUtil.registerExtension(FileTypeFactory.FILE_TYPE_FACTORY_EP, new FileTypeFactory() {
|
||||
FileTypeFactory.FILE_TYPE_FACTORY_EP.getPoint(null).registerExtension(new FileTypeFactory() {
|
||||
@Override
|
||||
public void createFileTypes(@NotNull FileTypeConsumer consumer) {
|
||||
consumer.consume(typeFromPlugin, "fromPlugin");
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ public class ProjectOpeningTest extends PlatformTestCase {
|
||||
File foo = createTempDir("foo");
|
||||
Project project = null;
|
||||
MyStartupActivity activity = new MyStartupActivity();
|
||||
PlatformTestUtil.registerExtension(POST_STARTUP_ACTIVITY, activity, getTestRootDisposable());
|
||||
POST_STARTUP_ACTIVITY.getPoint(null).registerExtension(activity, getTestRootDisposable());
|
||||
|
||||
try {
|
||||
ProjectManagerEx manager = ProjectManagerEx.getInstanceEx();
|
||||
|
||||
@@ -39,15 +39,15 @@ public class ProjectSetTest extends LightPlatformTestCase {
|
||||
|
||||
public void testProjectSetReader() throws IOException {
|
||||
final Ref<List<? extends Pair<String, String>>> ref = Ref.create();
|
||||
PlatformTestUtil.registerExtension(ProjectSetProcessor.EXTENSION_POINT_NAME, new ProjectSetProcessor() {
|
||||
ProjectSetProcessor.EXTENSION_POINT_NAME.getPoint(null).registerExtension(new ProjectSetProcessor() {
|
||||
@Override
|
||||
public String getId() {
|
||||
return "test";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processEntries(@NotNull List<? extends Pair<String, String>> entries, @NotNull Context context, @NotNull Runnable runNext) {
|
||||
ref.set(entries);
|
||||
public void processEntries(@NotNull List<? extends Pair<String, String>> entries1, @NotNull Context context1, @NotNull Runnable runNext) {
|
||||
ref.set(entries1);
|
||||
}
|
||||
}, getTestRootDisposable());
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ProjectSetTest extends LightPlatformTestCase {
|
||||
public void testVcsCheckoutProcessor() throws IOException {
|
||||
|
||||
final List<Pair<String, String>> pairs = new ArrayList<>();
|
||||
PlatformTestUtil.registerExtension(VcsCheckoutProcessor.EXTENSION_POINT_NAME, new VcsCheckoutProcessor() {
|
||||
VcsCheckoutProcessor.EXTENSION_POINT_NAME.getPoint(null).registerExtension(new VcsCheckoutProcessor() {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getId() {
|
||||
|
||||
@@ -130,14 +130,24 @@ public class PlatformTestUtil {
|
||||
return uppercaseChars >= 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ExtensionPointImpl#maskAll(List, Disposable)
|
||||
*/
|
||||
public static <T> void maskExtensions(@NotNull ExtensionPointName<T> pointName, @NotNull List<T> newExtensions, @NotNull Disposable parentDisposable) {
|
||||
((ExtensionPointImpl<T>)pointName.getPoint(null)).maskAll(newExtensions, parentDisposable);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ExtensionPointImpl#maskAll(List, Disposable)
|
||||
*/
|
||||
public static <T> void maskExtensions(@NotNull ProjectExtensionPointName<T> pointName, @NotNull Project project, @NotNull List<T> newExtensions, @NotNull Disposable parentDisposable) {
|
||||
((ExtensionPointImpl<T>)pointName.getPoint(project)).maskAll(newExtensions, parentDisposable);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link ExtensionPointName#getPoint(AreaInstance)} and {@link ExtensionPoint#registerExtension(Object, Disposable)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public static <T> void registerExtension(@NotNull ExtensionPointName<T> name, @NotNull T t, @NotNull Disposable parentDisposable) {
|
||||
registerExtension(Extensions.getRootArea(), name, t, parentDisposable);
|
||||
}
|
||||
|
||||
+2
-4
@@ -1,10 +1,9 @@
|
||||
// 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-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.
|
||||
package com.siyeh.ig.classlayout;
|
||||
|
||||
import com.intellij.codeInspection.inheritance.ImplicitSubclassProvider;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import com.siyeh.ig.LightInspectionTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -24,8 +23,7 @@ public class NonFinalUtilityClassInspectionTest extends LightCodeInsightFixtureT
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
PlatformTestUtil
|
||||
.registerExtension(ImplicitSubclassProvider.EP_NAME, myImplicitSubclassProvider, getTestRootDisposable());
|
||||
ImplicitSubclassProvider.EP_NAME.getPoint(null).registerExtension(myImplicitSubclassProvider, getTestRootDisposable());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+4
-19
@@ -1,25 +1,10 @@
|
||||
/*
|
||||
* 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-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.
|
||||
package com.siyeh.ig.inheritance;
|
||||
|
||||
import com.intellij.codeInspection.InspectionProfileEntry;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiClassOwner;
|
||||
import com.intellij.psi.search.searches.ClassInheritorsSearch;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.QueryExecutor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -36,15 +21,15 @@ public class AbstractMethodWithMissingImplementationsInspectionTest extends Ligh
|
||||
public void testDuplicateClass() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
|
||||
public void testSearchReturnsUnrelatedClass() {
|
||||
PlatformTestUtil.registerExtension(ClassInheritorsSearch.EP_NAME, new QueryExecutor<PsiClass, ClassInheritorsSearch.SearchParameters>() {
|
||||
ClassInheritorsSearch.EP_NAME.getPoint(null).registerExtension(new QueryExecutor<PsiClass, ClassInheritorsSearch.SearchParameters>() {
|
||||
@Override
|
||||
public boolean execute(@NotNull ClassInheritorsSearch.SearchParameters p, @NotNull Processor<? super PsiClass> consumer) {
|
||||
return ContainerUtil.process(((PsiClassOwner)p.getClassToProcess().getContainingFile()).getClasses(), consumer);
|
||||
}
|
||||
}, getTestRootDisposable());
|
||||
doTest();
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+2
-5
@@ -1,13 +1,10 @@
|
||||
// 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-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-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-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.
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfoType.ELEMENT_UNDER_CARET_READ
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfoType.ELEMENT_UNDER_CARET_WRITE
|
||||
import com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPassFactory.doWithHighlightingEnabled
|
||||
import com.intellij.codeInsight.daemon.impl.SeveritiesProvider
|
||||
import com.intellij.openapi.application.ex.PathManagerEx
|
||||
import com.intellij.testFramework.ExpectedHighlightingData
|
||||
import com.intellij.testFramework.PlatformTestUtil.registerExtension
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase
|
||||
|
||||
class EditorConfigHighlightUsagesTest : LightPlatformCodeInsightFixtureTestCase() {
|
||||
@@ -22,7 +19,7 @@ class EditorConfigHighlightUsagesTest : LightPlatformCodeInsightFixtureTestCase(
|
||||
fun testDeclarationWithoutReferences() = doTest()
|
||||
|
||||
private fun doTest() {
|
||||
registerExtension(SeveritiesProvider.EP_NAME, SEVERITIES_PROVIDER, testRootDisposable)
|
||||
SeveritiesProvider.EP_NAME.getPoint(null).registerExtension(SEVERITIES_PROVIDER, testRootDisposable)
|
||||
val name = getTestName(true)
|
||||
myFixture.configureByFile("${name}/.editorconfig")
|
||||
doWithHighlightingEnabled {
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.jetbrains.plugins.groovy.lang
|
||||
|
||||
import com.intellij.codeInsight.lookup.LookupElement
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||
import groovy.transform.CompileStatic
|
||||
import org.jetbrains.annotations.NotNull
|
||||
@@ -13,7 +12,6 @@ import org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyUncheckedAss
|
||||
import org.jetbrains.plugins.groovy.extensions.GroovyNamedArgumentProvider
|
||||
import org.jetbrains.plugins.groovy.extensions.NamedArgumentDescriptor
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrListOrMap
|
||||
|
||||
/**
|
||||
* @author Sergey Evdokimov
|
||||
*/
|
||||
@@ -439,13 +437,13 @@ class Test {
|
||||
}
|
||||
|
||||
private doTestCompletionWithinMap(String text, String text2 = null) {
|
||||
PlatformTestUtil.registerExtension GroovyNamedArgumentProvider.EP_NAME, new GroovyNamedArgumentProvider() {
|
||||
GroovyNamedArgumentProvider.EP_NAME.getPoint(null).registerExtension(new GroovyNamedArgumentProvider() {
|
||||
@NotNull
|
||||
@Override
|
||||
Map<String, NamedArgumentDescriptor> getNamedArguments(@NotNull GrListOrMap literal) {
|
||||
['foo': NamedArgumentDescriptor.SIMPLE_NORMAL, 'bar': NamedArgumentDescriptor.SIMPLE_NORMAL]
|
||||
}
|
||||
}, myFixture.testRootDisposable
|
||||
}, myFixture.testRootDisposable)
|
||||
|
||||
myFixture.with {
|
||||
configureByText '_.groovy', text
|
||||
|
||||
+2
-3
@@ -1,4 +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-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.
|
||||
package org.jetbrains.plugins.groovy.lang.highlighting
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfoType
|
||||
@@ -12,7 +12,6 @@ import org.jetbrains.plugins.groovy.util.TestUtils
|
||||
import static com.intellij.codeInsight.daemon.impl.HighlightInfoType.ELEMENT_UNDER_CARET_READ
|
||||
import static com.intellij.codeInsight.daemon.impl.HighlightInfoType.ELEMENT_UNDER_CARET_WRITE
|
||||
import static com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPassFactory.doWithHighlightingEnabled
|
||||
import static com.intellij.testFramework.PlatformTestUtil.registerExtension
|
||||
|
||||
@CompileStatic
|
||||
class GroovyHighlightUsagesTest extends LightGroovyTestCase {
|
||||
@@ -26,7 +25,7 @@ class GroovyHighlightUsagesTest extends LightGroovyTestCase {
|
||||
final String basePath = TestUtils.testDataPath + 'highlighting/usages/'
|
||||
|
||||
private void doTest(boolean directoryTest = false) {
|
||||
registerExtension(SeveritiesProvider.EP_NAME, SEVERITIES_PROVIDER, testRootDisposable)
|
||||
SeveritiesProvider.EP_NAME.getPoint(null).registerExtension(SEVERITIES_PROVIDER, testRootDisposable)
|
||||
def name = getTestName()
|
||||
if (directoryTest) {
|
||||
fixture.copyDirectoryToProject(name, "")
|
||||
|
||||
+6
-21
@@ -1,22 +1,7 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
// 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.
|
||||
package org.jetbrains.plugins.groovy.lang.resolve
|
||||
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
import groovy.transform.CompileStatic
|
||||
import org.jetbrains.plugins.groovy.GroovyLightProjectDescriptor
|
||||
import org.jetbrains.plugins.groovy.LightGroovyTestCase
|
||||
@@ -42,7 +27,7 @@ public class MyClass {
|
||||
}
|
||||
|
||||
void 'test regular import'() {
|
||||
PlatformTestUtil.registerExtension(GrImportContributor.EP_NAME, {
|
||||
GrImportContributor.EP_NAME.getPoint(null).registerExtension({
|
||||
[new Import("foo.bar.MyClass", ImportType.REGULAR)]
|
||||
} as GrImportContributor, myFixture.testRootDisposable)
|
||||
fixture.with {
|
||||
@@ -52,7 +37,7 @@ public class MyClass {
|
||||
}
|
||||
|
||||
void 'test static import method'() {
|
||||
PlatformTestUtil.registerExtension(GrImportContributor.EP_NAME, {
|
||||
GrImportContributor.EP_NAME.getPoint(null).registerExtension({
|
||||
[new Import("foo.bar.MyClass.foo", ImportType.STATIC)]
|
||||
} as GrImportContributor, myFixture.testRootDisposable)
|
||||
fixture.with {
|
||||
@@ -62,7 +47,7 @@ public class MyClass {
|
||||
}
|
||||
|
||||
void 'test static import field'() {
|
||||
PlatformTestUtil.registerExtension(GrImportContributor.EP_NAME, {
|
||||
GrImportContributor.EP_NAME.getPoint(null).registerExtension({
|
||||
[new Import("foo.bar.MyClass.BAR", ImportType.STATIC)]
|
||||
} as GrImportContributor, myFixture.testRootDisposable)
|
||||
fixture.with {
|
||||
@@ -72,7 +57,7 @@ public class MyClass {
|
||||
}
|
||||
|
||||
void 'test star import'() {
|
||||
PlatformTestUtil.registerExtension(GrImportContributor.EP_NAME, {
|
||||
GrImportContributor.EP_NAME.getPoint(null).registerExtension({
|
||||
[new Import("foo.bar", ImportType.STAR)]
|
||||
} as GrImportContributor, myFixture.testRootDisposable)
|
||||
fixture.with {
|
||||
@@ -82,7 +67,7 @@ public class MyClass {
|
||||
}
|
||||
|
||||
void 'test static star import'() {
|
||||
PlatformTestUtil.registerExtension(GrImportContributor.EP_NAME, {
|
||||
GrImportContributor.EP_NAME.getPoint(null).registerExtension({
|
||||
[new Import("foo.bar.MyClass", ImportType.STATIC_STAR)]
|
||||
} as GrImportContributor, myFixture.testRootDisposable)
|
||||
fixture.with {
|
||||
|
||||
+3
-18
@@ -1,24 +1,9 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
// 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.
|
||||
package org.jetbrains.plugins.groovy.lang.resolve
|
||||
|
||||
import com.intellij.openapi.command.WriteCommandAction
|
||||
import com.intellij.psi.PsiFileFactory
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
import groovy.transform.CompileStatic
|
||||
import org.jetbrains.plugins.groovy.GroovyFileType
|
||||
import org.jetbrains.plugins.groovy.GroovyLightProjectDescriptor
|
||||
@@ -38,7 +23,7 @@ class GroovyResolveCacheTest extends LightGroovyTestCase {
|
||||
|
||||
void 'test drop caches on out of code block change'() {
|
||||
int counter = 0
|
||||
PlatformTestUtil.registerExtension(AstTransformationSupport.EP_NAME, {
|
||||
AstTransformationSupport.EP_NAME.getPoint(null).registerExtension({
|
||||
counter++
|
||||
} as AstTransformationSupport, myFixture.testRootDisposable)
|
||||
def file = fixture.addFileToProject(
|
||||
@@ -61,7 +46,7 @@ class GroovyResolveCacheTest extends LightGroovyTestCase {
|
||||
|
||||
void 'test do not drop caches on code block change'() {
|
||||
int counter = 0
|
||||
PlatformTestUtil.registerExtension(AstTransformationSupport.EP_NAME, {
|
||||
AstTransformationSupport.EP_NAME.getPoint(null).registerExtension({
|
||||
counter++
|
||||
} as AstTransformationSupport, myFixture.testRootDisposable)
|
||||
def file = fixture.addFileToProject(
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
/*
|
||||
* 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-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.
|
||||
package org.jetbrains.plugins.groovy.util
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.compiled.ClassFileDecompilers
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
|
||||
object ThrowingDecompiler : ClassFileDecompilers.Light() {
|
||||
|
||||
@JvmStatic
|
||||
fun disableDecompilers(parentDisposable: Disposable) {
|
||||
PlatformTestUtil.registerExtension(ClassFileDecompilers.EP_NAME, this, parentDisposable)
|
||||
ClassFileDecompilers.EP_NAME.getPoint(null).registerExtension(this, parentDisposable)
|
||||
}
|
||||
|
||||
override fun accepts(file: VirtualFile): Boolean = true
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
/*
|
||||
* 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-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.
|
||||
package org.jetbrains.plugins.groovy.util
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.testFramework.PlatformTestUtil.registerExtension
|
||||
import org.jetbrains.plugins.groovy.transformations.AstTransformationSupport
|
||||
import org.jetbrains.plugins.groovy.transformations.TransformationContext
|
||||
|
||||
@@ -12,7 +9,7 @@ object ThrowingTransformation : AstTransformationSupport {
|
||||
|
||||
@JvmStatic
|
||||
fun disableTransformations(parentDisposable: Disposable) {
|
||||
registerExtension(AstTransformationSupport.EP_NAME, this, parentDisposable)
|
||||
AstTransformationSupport.EP_NAME.getPoint(null).registerExtension(this, parentDisposable)
|
||||
}
|
||||
|
||||
override fun applyTransformation(context: TransformationContext): Nothing {
|
||||
|
||||
@@ -1,4 +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-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.
|
||||
package com.jetbrains.python;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -8,7 +8,6 @@ import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.PsiFileImpl;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.jetbrains.python.codeInsight.PyCustomMember;
|
||||
import com.jetbrains.python.fixtures.PyMultiFileResolveTestCase;
|
||||
import com.jetbrains.python.fixtures.PyResolveTestCase;
|
||||
@@ -92,7 +91,7 @@ public class PyMultiFileResolveTest extends PyMultiFileResolveTestCase {
|
||||
}
|
||||
|
||||
public void testCustomPackageIdentifier() {
|
||||
PlatformTestUtil.registerExtension(PyCustomPackageIdentifier.EP_NAME, new PyCustomPackageIdentifier() {
|
||||
PyCustomPackageIdentifier.EP_NAME.getPoint(null).registerExtension(new PyCustomPackageIdentifier() {
|
||||
@Override
|
||||
public boolean isPackage(PsiDirectory directory) {
|
||||
return true;
|
||||
@@ -488,7 +487,7 @@ public class PyMultiFileResolveTest extends PyMultiFileResolveTestCase {
|
||||
runWithSourceRoots(Lists.newArrayList(myFixture.findFileInTempDir("root")), () -> {
|
||||
final PsiFile extSource = myFixture.getPsiManager().findFile(vf);
|
||||
PyImportResolver foreignResolver = (name, context, withRoots) -> name.toString().equals("m1") ? extSource : null;
|
||||
PlatformTestUtil.registerExtension(PyImportResolver.EP_NAME, foreignResolver, getTestRootDisposable());
|
||||
PyImportResolver.EP_NAME.getPoint(null).registerExtension(foreignResolver, getTestRootDisposable());
|
||||
|
||||
final PsiFile psiFile = myFixture.configureByFile("a.py");
|
||||
final PsiReference ref = PyResolveTestCase.findReferenceByMarker(psiFile);
|
||||
|
||||
Reference in New Issue
Block a user