Merge remote-tracking branch 'origin/master' into develar/is

This commit is contained in:
Vladimir Krivosheev
2016-07-19 13:56:04 +02:00
74 changed files with 385 additions and 252 deletions
@@ -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.
@@ -66,7 +66,7 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
myProject.getMessageBus().connect(myTestRootDisposable).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
myProject.getMessageBus().connect(getTestRootDisposable()).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
@Override
public void rootsChanged(ModuleRootEvent event) {
//todo[nik] projectOpened isn't called in tests so we need to add this listener manually
@@ -249,7 +249,7 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase {
public void fileGenerated(String outputRoot, String relativePath) {
generatedFilePaths.add(relativePath);
}
}, myTestRootDisposable);
}, getTestRootDisposable());
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
@@ -203,7 +203,7 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
InjectedLanguageUtil.hasInjections((PsiLanguageInjectionHost)child)) {
return new CommentWithInjectionBlock(child, wrap, alignment, indent, settings, javaSettings);
}
if (child instanceof LeafElement || childPsi instanceof PsiJavaModuleReference) {
if (child instanceof LeafElement || childPsi instanceof PsiJavaModuleReferenceElement) {
final LeafBlock block = new LeafBlock(child, wrap, alignment, actualIndent);
block.setStartOffset(startOffset);
return block;
@@ -391,7 +391,7 @@ public abstract class JavaElementVisitor extends PsiElementVisitor {
visitElement(module);
}
public void visitModuleReference(PsiJavaModuleReference moduleRef) {
public void visitModuleReference(PsiJavaModuleReferenceElement moduleRef) {
visitElement(moduleRef);
}
@@ -26,6 +26,7 @@ public interface PsiJavaModule extends NavigatablePsiElement {
String MODULE_INFO_CLASS = "module-info";
String MODULE_INFO_FILE = MODULE_INFO_CLASS + ".java";
@NotNull PsiJavaModuleReference getNameElement();
@NotNull
PsiJavaModuleReferenceElement getNameElement();
@NotNull String getModuleName();
}
@@ -22,6 +22,6 @@ import org.jetbrains.annotations.NotNull;
*
* @since 2016.3
*/
public interface PsiJavaModuleReference extends PsiElement {
public interface PsiJavaModuleReferenceElement extends PsiElement {
@NotNull String getReferenceText();
}
@@ -25,16 +25,16 @@ import com.intellij.psi.impl.source.tree.TreeElement;
import org.jetbrains.annotations.NotNull;
public class ClsJavaModuleImpl extends ClsRepositoryPsiElement<PsiJavaModuleStub> implements PsiJavaModule {
private PsiJavaModuleReference myReference;
private PsiJavaModuleReferenceElement myReference;
public ClsJavaModuleImpl(PsiJavaModuleStub stub) {
super(stub);
myReference = new ClsJavaModuleReferenceImpl(this, stub.getName());
myReference = new ClsJavaModuleReferenceElementImpl(this, stub.getName());
}
@NotNull
@Override
public PsiJavaModuleReference getNameElement() {
public PsiJavaModuleReferenceElement getNameElement() {
return myReference;
}
@@ -18,16 +18,16 @@ package com.intellij.psi.impl.compiled;
import com.intellij.psi.JavaElementVisitor;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.PsiJavaModuleReference;
import com.intellij.psi.PsiJavaModuleReferenceElement;
import com.intellij.psi.impl.source.tree.JavaElementType;
import com.intellij.psi.impl.source.tree.TreeElement;
import org.jetbrains.annotations.NotNull;
public class ClsJavaModuleReferenceImpl extends ClsElementImpl implements PsiJavaModuleReference {
public class ClsJavaModuleReferenceElementImpl extends ClsElementImpl implements PsiJavaModuleReferenceElement {
private final PsiElement myParent;
private final String myText;
public ClsJavaModuleReferenceImpl(PsiElement parent, String text) {
public ClsJavaModuleReferenceElementImpl(PsiElement parent, String text) {
myParent = parent;
myText = text;
}
@@ -35,8 +35,8 @@ public class PsiJavaModuleImpl extends JavaStubPsiElement<PsiJavaModuleStub> imp
@NotNull
@Override
public PsiJavaModuleReference getNameElement() {
return PsiTreeUtil.getRequiredChildOfType(this, PsiJavaModuleReference.class);
public PsiJavaModuleReferenceElement getNameElement() {
return PsiTreeUtil.getRequiredChildOfType(this, PsiJavaModuleReferenceElement.class);
}
@NotNull
@@ -20,8 +20,8 @@ import com.intellij.psi.impl.source.tree.CompositePsiElement;
import com.intellij.psi.impl.source.tree.JavaElementType;
import org.jetbrains.annotations.NotNull;
public class PsiJavaModuleReferenceImpl extends CompositePsiElement implements PsiJavaModuleReference {
public PsiJavaModuleReferenceImpl() {
public class PsiJavaModuleReferenceElementImpl extends CompositePsiElement implements PsiJavaModuleReferenceElement {
public PsiJavaModuleReferenceElementImpl() {
super(JavaElementType.MODULE_REFERENCE);
}
@@ -140,7 +140,7 @@ public interface JavaElementType {
IElementType ANNOTATION_ARRAY_INITIALIZER = new JavaCompositeElementType("ANNOTATION_ARRAY_INITIALIZER", PsiArrayInitializerMemberValueImpl.class);
IElementType RECEIVER_PARAMETER = new JavaCompositeElementType("RECEIVER", PsiReceiverParameterImpl.class);
IElementType MODULE_REFERENCE = new JavaCompositeElementType("MODULE_REFERENCE", PsiJavaModuleReferenceImpl.class);
IElementType MODULE_REFERENCE = new JavaCompositeElementType("MODULE_REFERENCE", PsiJavaModuleReferenceElementImpl.class);
IElementType REQUIRES_STATEMENT = new JavaCompositeElementType("REQUIRES_STATEMENT", PsiRequiresStatementImpl.class);
IElementType EXPORTS_STATEMENT = new JavaCompositeElementType("EXPORTS_STATEMENT", PsiExportsStatementImpl.class);
IElementType USES_STATEMENT = new JavaCompositeElementType("USES_STATEMENT", PsiUsesStatementImpl.class);
@@ -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.
@@ -81,7 +81,7 @@ public class GenerateConstructorTest extends LightCodeInsightFixtureTestCase {
myFixture.addClass("package foo;\n\nimport java.lang.annotation.*;\n\n@Target(ElementType.TYPE_USE) public @interface TestNotNull { }");
NullableNotNullManager manager = NullableNotNullManager.getInstance(getProject());
manager.setNotNulls("foo.TestNotNull");
Disposer.register(myTestRootDisposable, manager::setNotNulls);
Disposer.register(getTestRootDisposable(), manager::setNotNulls);
doTest();
}
@@ -1,9 +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.completion;
import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.CodeInsightSettings;
import com.intellij.codeInsight.lookup.Lookup;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupElementPresentation;
import com.intellij.codeInsight.template.SmartCompletionContextType;
import com.intellij.codeInsight.template.Template;
@@ -12,7 +26,6 @@ import com.intellij.codeInsight.template.TemplateManager;
import com.intellij.codeInsight.template.impl.TemplateImpl;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.util.Condition;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
@@ -656,7 +669,7 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase {
final SmartCompletionContextType completionContextType =
ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), SmartCompletionContextType.class);
((TemplateImpl)template).getTemplateContext().setEnabled(completionContextType, true);
CodeInsightTestUtil.addTemplate(template, myTestRootDisposable);
CodeInsightTestUtil.addTemplate(template, getTestRootDisposable());
doTest();
}
@@ -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,7 +18,6 @@ package com.intellij.codeInsight.daemon;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.defUse.DefUseInspection;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.IdeaTestUtil;
@@ -79,7 +78,7 @@ public class AdvHighlightingJdk7Test extends DaemonAnalyzerTestCase {
//ambiguous method calls
private void doTestAmbiguous(@NotNull JavaSdkVersion javaSdkVersion) throws Exception {
final String name = getTestName(true);
IdeaTestUtil.setTestVersion(javaSdkVersion, getModule(), myTestRootDisposable);
IdeaTestUtil.setTestVersion(javaSdkVersion, getModule(), getTestRootDisposable());
doTest(BASE_PATH + name + "/pck/AmbiguousMethodCall.java", BASE_PATH + "/" + name, false, false);
}
@@ -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.
@@ -55,7 +55,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
private void doTest(@NotNull LanguageLevel languageLevel, @NotNull JavaSdkVersion sdkVersion, boolean checkWarnings) {
LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).setLanguageLevel(languageLevel);
IdeaTestUtil.setTestVersion(sdkVersion, getModule(), myTestRootDisposable);
IdeaTestUtil.setTestVersion(sdkVersion, getModule(), getTestRootDisposable());
doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, false);
}
private void doTest5(boolean checkWarnings) { doTest(LanguageLevel.JDK_1_5, JavaSdkVersion.JDK_1_6, checkWarnings); }
@@ -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.
@@ -31,7 +31,7 @@ public class LightAdvHighlightingJdk6Test extends LightDaemonAnalyzerTestCase {
super.setUp();
enableInspectionTools(new UnusedDeclarationInspection(), new UncheckedWarningLocalInspection(), new JavacQuirksInspection(), new RedundantCastInspection());
setLanguageLevel(LanguageLevel.JDK_1_6);
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_6, getModule(), myTestRootDisposable);
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_6, getModule(), getTestRootDisposable());
}
private void doTest(boolean checkWarnings, boolean checkInfos) {
@@ -46,7 +46,7 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
super.setUp();
enableInspectionTools(new UnusedDeclarationInspection(), new UncheckedWarningLocalInspection(), new JavacQuirksInspection(), new RedundantCastInspection());
setLanguageLevel(LanguageLevel.JDK_1_7);
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_7, getModule(), myTestRootDisposable);
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_7, getModule(), getTestRootDisposable());
}
private void doTest(boolean checkWarnings, boolean checkInfos, InspectionProfileEntry... inspections) {
@@ -199,7 +199,7 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testUnused() { doTest(true, false); }
public void testQualifierBeforeClassName() { doTest(false, false); }
public void testQualifiedSuper() {
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_6, getModule(), myTestRootDisposable);
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_6, getModule(), getTestRootDisposable());
doTest(false, false);
}
@@ -39,7 +39,7 @@ public class PsiAugmentProviderTest extends LightCodeInsightFixtureTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
PlatformTestUtil.registerExtension(PsiAugmentProvider.EP_NAME, new TestAugmentProvider(), myTestRootDisposable);
PlatformTestUtil.registerExtension(PsiAugmentProvider.EP_NAME, new TestAugmentProvider(), getTestRootDisposable());
myFixture.addClass("package lombok;\npublic @interface val { }");
}
@@ -58,7 +58,10 @@ import com.intellij.lang.annotation.ExternalAnnotator;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.IdeActions;
import com.intellij.openapi.actionSystem.impl.SimpleDataContext;
import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.application.ApplicationManager;
@@ -883,7 +886,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
}
};
LineMarkerProviders.INSTANCE.addExplicitExtension(JavaLanguage.INSTANCE, provider);
Disposer.register(myTestRootDisposable, () -> LineMarkerProviders.INSTANCE.removeExplicitExtension(JavaLanguage.INSTANCE, provider));
Disposer.register(getTestRootDisposable(), () -> LineMarkerProviders.INSTANCE.removeExplicitExtension(JavaLanguage.INSTANCE, provider));
myDaemonCodeAnalyzer.restart();
try {
TextRange range = FileStatusMap.getDirtyTextRange(getEditor(), Pass.UPDATE_ALL);
@@ -2193,7 +2196,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
}
};
IntentionManager.getInstance().addAction(longLongUpdate);
Disposer.register(myTestRootDisposable, () -> IntentionManager.getInstance().unregisterIntention(longLongUpdate));
Disposer.register(getTestRootDisposable(), () -> IntentionManager.getInstance().unregisterIntention(longLongUpdate));
configureByText(JavaFileType.INSTANCE, "class X { <caret> }");
makeEditorWindowVisible(new Point(0, 0));
doHighlighting();
@@ -2220,7 +2223,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
((EditorImpl)myEditor).getScrollPane().getViewport().setSize(1000, 1000);
final Set<LightweightHint> visibleHints = ContainerUtil.newIdentityTroveSet();
getProject().getMessageBus().connect(myTestRootDisposable).subscribe(EditorHintListener.TOPIC, new EditorHintListener() {
getProject().getMessageBus().connect(getTestRootDisposable()).subscribe(EditorHintListener.TOPIC, new EditorHintListener() {
@Override
public void hintShown(final Project project, final LightweightHint hint, final int flags) {
visibleHints.add(hint);
@@ -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.
@@ -803,7 +803,7 @@ public class GenericsHighlighting8Test extends LightDaemonAnalyzerTestCase {
private void doTest(boolean warnings) {
LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), myTestRootDisposable);
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
}
@@ -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,7 +43,7 @@ public class GenericsHighlightingGenerated8Test extends LightDaemonAnalyzerTestC
private void doTest() {
LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), myTestRootDisposable);
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, 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.
@@ -45,7 +45,7 @@ public class ReplaceWithOfNullableFixTest extends LightQuickFixParameterizedTest
@Override
protected void beforeActionStarted(String testName, String contents) {
if (testName.contains("Guava")) {
ReplaceFromOfNullableFixTest.addGuavaOptional(myTestRootDisposable);
ReplaceFromOfNullableFixTest.addGuavaOptional(getTestRootDisposable());
}
super.beforeActionStarted(testName, contents);
}
@@ -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: max
@@ -11,7 +27,6 @@ package com.intellij.codeInspection;
import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.daemon.ImplicitUsageProvider;
import com.intellij.codeInspection.canBeFinal.CanBeFinalInspection;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiField;
import com.intellij.psi.PsiNamedElement;
@@ -143,7 +158,7 @@ public class CanBeFinalTest extends InspectionTestCase {
public boolean isImplicitWrite(PsiElement element) {
return element instanceof PsiField && "implicitWrite".equals(((PsiNamedElement)element).getName());
}
}, myTestRootDisposable);
}, getTestRootDisposable());
doTest();
}
@@ -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.
@@ -75,7 +75,7 @@ public class DataFlowInspection8Test extends DataFlowInspectionTestCase {
NullableNotNullManager nnnManager = NullableNotNullManager.getInstance(getProject());
nnnManager.setNotNulls("foo.NotNull");
nnnManager.setNullables("foo.Nullable");
Disposer.register(myTestRootDisposable, () -> {
Disposer.register(getTestRootDisposable(), () -> {
nnnManager.setNotNulls();
nnnManager.setNullables();
});
@@ -57,7 +57,7 @@ public class MagicConstantInspectionTest extends InspectionTestCase {
protected void setUp() throws Exception {
super.setUp();
myFilter = new FileTreeAccessFilter();
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(myFilter, myTestRootDisposable);
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(myFilter, getTestRootDisposable());
}
@Override
@@ -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: Alexey
@@ -127,7 +143,7 @@ public class NullableStuffInspectionTest extends LightCodeInsightFixtureTestCase
final NullableNotNullManager nnnManager = NullableNotNullManager.getInstance(getProject());
nnnManager.setNullables("custom.CheckForNull");
Disposer.register(myTestRootDisposable, new Disposable() {
Disposer.register(getTestRootDisposable(), new Disposable() {
@Override
public void dispose() {
nnnManager.setNullables();
@@ -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.
*/
package com.intellij.codeInspection;
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
import com.intellij.codeInspection.emptyMethod.EmptyMethodInspection;
import com.intellij.codeInspection.ex.*;
import com.intellij.codeInspection.ex.GlobalInspectionToolWrapper;
import com.intellij.codeInspection.ex.InspectionToolWrapper;
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
import com.intellij.codeInspection.i18n.I18nInspection;
import com.intellij.psi.PsiElement;
import com.intellij.psi.impl.source.tree.injected.MyTestInjector;
@@ -55,7 +72,7 @@ public class RedundantSuppressTest extends InspectionTestCase {
public void testInjections() throws Exception {
MyTestInjector testInjector = new MyTestInjector(getPsiManager());
testInjector.injectAll(myTestRootDisposable);
testInjector.injectAll(getTestRootDisposable());
doTest();
}
@@ -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.
*/
/*
* User: anna
* Date: 19-Apr-2010
@@ -10,8 +26,6 @@ import com.intellij.codeInspection.miscGenerics.RedundantTypeArgsInspection;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
import org.jetbrains.annotations.NotNull;
public class RedundantTypeArgsInspectionTest extends LightDaemonAnalyzerTestCase {
@@ -34,7 +48,7 @@ public class RedundantTypeArgsInspectionTest extends LightDaemonAnalyzerTestCase
}
private void doTest() throws Throwable {
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_6, getModule(), myTestRootDisposable);
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_6, getModule(), getTestRootDisposable());
doTest("/inspection/redundantTypeArgs/" + getTestName(false) + ".java", true, 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.
@@ -45,7 +45,7 @@ public class FindInEditorTest extends LightCodeInsightTestCase {
myOutputStream = new ByteArrayOutputStream();
LivePreview.ourTestOutput = new PrintStream(myOutputStream);
EditorHintListener listener = (project, hint, flags) -> LivePreview.processNotFound();
ApplicationManager.getApplication().getMessageBus().connect(myTestRootDisposable).subscribe(EditorHintListener.TOPIC, listener);
ApplicationManager.getApplication().getMessageBus().connect(getTestRootDisposable()).subscribe(EditorHintListener.TOPIC, listener);
}
private void initFind() {
@@ -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.projectView;
import com.intellij.openapi.module.Module;
@@ -127,7 +142,7 @@ public class ProjectTreeStructureTest extends BaseProjectViewTestCase {
ModuleManagerImpl.getInstanceImpl(myProject).setModuleGroupPath(module, new String[]{"modules"});
PsiTestUtil.addContentRoot(module, mainModuleRoot.findFileByRelativePath("src/com/package1/p2/p3"));
TestProjectTreeStructure structure = new TestProjectTreeStructure(myProject, myTestRootDisposable);
TestProjectTreeStructure structure = new TestProjectTreeStructure(myProject, getTestRootDisposable());
structure.setShowLibraryContents(false);
String structureContent = PlatformTestUtil.print(structure, structure.getRootElement(), 0, null, 10, ' ', myPrintInfo).toString();
@@ -41,7 +41,7 @@ public class ModifyAnnotationsTest extends PsiTestCase {
public void testReplaceAnnotation() throws Exception {
//be sure not to load tree
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, myTestRootDisposable);
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, getTestRootDisposable());
PsiClass aClass = myJavaFacade.findClass("Test", GlobalSearchScope.allScope(myProject));
assertNotNull(aClass);
final PsiAnnotation[] annotations = aClass.getModifierList().getAnnotations();
@@ -49,7 +49,7 @@ public class ModifyAnnotationsTest extends PsiTestCase {
assertEquals("A", annotations[0].getNameReferenceElement().getReferenceName());
final PsiAnnotation newAnnotation = myJavaFacade.getElementFactory().createAnnotationFromText("@B", null);
//here the tree is going to be loaded
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, myTestRootDisposable);
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, getTestRootDisposable());
CommandProcessor.getInstance().executeCommand(myProject, () -> WriteCommandAction.runWriteCommandAction(null, () -> {
try {
annotations[0].replace(newAnnotation);
@@ -299,7 +299,7 @@ public class Src15RepositoryUseTest extends PsiTestCase {
public boolean accept(final VirtualFile file) {
return !"package-info.java".equals(file.getName());
}
}, myTestRootDisposable);
}, getTestRootDisposable());
final PsiClass annotationTypeClass = findClass("annotations.AnnotationType");
assertTrue(annotationTypeClass.isAnnotationType());
@@ -321,11 +321,11 @@ public class Src15RepositoryUseTest extends PsiTestCase {
}
private void setupLoadingFilter() {
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, myTestRootDisposable);
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, getTestRootDisposable());
}
private void tearDownLoadingFilter() {
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, myTestRootDisposable);
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, getTestRootDisposable());
}
@NotNull
@@ -585,11 +585,11 @@ public class SrcRepositoryUseTest extends PsiTestCase{
}
private void teardownLoadingFilter() {
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, myTestRootDisposable);
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, getTestRootDisposable());
}
private void setupLoadingFilter() {
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, myTestRootDisposable);
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, getTestRootDisposable());
}
public void testAnonymousClass2() throws Exception {
@@ -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.
@@ -781,7 +781,7 @@ public class PsiEventsTest extends PsiTestCase {
public void propertyChanged(@NotNull PsiTreeChangeEvent event) {
checkCommitted(true, event);
}
}, myTestRootDisposable);
}, getTestRootDisposable());
PsiDocumentManager documentManager = PsiDocumentManager.getInstance(getProject());
Document document = documentManager.getDocument(getFile());
@@ -236,7 +236,7 @@ public class ResolveClassTest extends ResolveTestCase {
}
public void testQualifiedAnonymousClass() throws Exception {
RecursionManager.assertOnRecursionPrevention(myTestRootDisposable);
RecursionManager.assertOnRecursionPrevention(getTestRootDisposable());
PsiReference ref = configure();
VirtualFile file = ref.getElement().getContainingFile().getVirtualFile();
@@ -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.psi.resolve;
import com.intellij.navigation.NavigationItem;
@@ -243,7 +258,7 @@ public class ResolveMethod15Test extends Resolve15TestCase {
assertTrue(!((PsiMethod) element).isVarArgs());
}
public void testFilterFixedVsVarargs9() throws Exception {
RecursionManager.assertOnRecursionPrevention(myTestRootDisposable);
RecursionManager.assertOnRecursionPrevention(getTestRootDisposable());
final PsiReference ref = configureByFile();
assertThat(ref, instanceOf(PsiReferenceExpression.class));
@@ -488,7 +503,7 @@ public class ResolveMethod15Test extends Resolve15TestCase {
}
public void testInheritance4() throws Exception{
RecursionManager.assertOnRecursionPrevention(myTestRootDisposable);
RecursionManager.assertOnRecursionPrevention(getTestRootDisposable());
PsiReference ref = configureByFile();
PsiElement target = ref.resolve();
@@ -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.
@@ -26,7 +26,6 @@ import com.intellij.psi.PsiReferenceExpression;
import com.intellij.psi.impl.source.tree.injected.MyTestInjector;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.refactoring.introduce.inplace.AbstractInplaceIntroducer;
import com.intellij.testFramework.IdeaTestCase;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.LightPlatformTestCase;
import org.jetbrains.annotations.NotNull;
@@ -84,7 +83,7 @@ public abstract class AbstractJavaInplaceIntroduceTest extends AbstractInplaceIn
protected void doTestInsideInjection(final Pass<AbstractInplaceIntroducer> pass) {
MyTestInjector testInjector = new MyTestInjector(getPsiManager());
testInjector.injectAll(myTestRootDisposable);
testInjector.injectAll(getTestRootDisposable());
doTest(pass);
}
@@ -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.
@@ -49,7 +49,7 @@ public class RootsChangedTest extends ModuleTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
MessageBusConnection connection = myProject.getMessageBus().connect(myTestRootDisposable);
MessageBusConnection connection = myProject.getMessageBus().connect(getTestRootDisposable());
myModuleRootListener = new MyModuleRootListener();
connection.subscribe(ProjectTopics.PROJECT_ROOTS, myModuleRootListener);
}
@@ -50,7 +50,6 @@ import com.intellij.psi.impl.source.PostprocessReformattingAspect;
import com.intellij.psi.search.ProjectScope;
import com.intellij.testFramework.*;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -124,7 +123,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
}
private void allowRootAccess(final String filePath) {
VfsRootAccess.allowRootAccess(myTestRootDisposable, filePath);
VfsRootAccess.allowRootAccess(getTestRootDisposable(), filePath);
}
protected VirtualFile configureByFile(String filePath, @Nullable String projectRoot) throws Exception {
@@ -244,7 +244,7 @@ public abstract class DaemonAnalyzerTestCase extends CodeInsightTestCase {
data.init();
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(myVirtualFileFilter, myTestRootDisposable);
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(myVirtualFileFilter, getTestRootDisposable());
try {
Collection<HighlightInfo> infos = doHighlighting();
@@ -255,7 +255,7 @@ public abstract class DaemonAnalyzerTestCase extends CodeInsightTestCase {
return infos;
}
finally {
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, myTestRootDisposable);
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, getTestRootDisposable());
}
}
@@ -94,7 +94,7 @@ public abstract class LightDaemonAnalyzerTestCase extends LightCodeInsightTestCa
}
protected void doTestConfiguredFile(boolean checkWarnings, boolean checkWeakWarnings, boolean checkInfos, @Nullable String filePath) {
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, myTestRootDisposable);
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, getTestRootDisposable());
ExpectedHighlightingData data = getExpectedHighlightingData(checkWarnings, checkWeakWarnings, checkInfos);
checkHighlighting(data, composeLocalPath(filePath));
@@ -116,7 +116,7 @@ public abstract class LightDaemonAnalyzerTestCase extends LightCodeInsightTestCa
//noinspection ResultOfMethodCallIgnored
getFile().getText(); //to load text
myJavaFilesFilter.allowTreeAccessForFile(getVFile());
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(myJavaFilesFilter, myTestRootDisposable);
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(myJavaFilesFilter, getTestRootDisposable());
try {
Collection<HighlightInfo> infos = doHighlighting();
@@ -124,7 +124,7 @@ public abstract class LightDaemonAnalyzerTestCase extends LightCodeInsightTestCa
data.checkResult(infos, getEditor().getDocument().getText(), filePath);
}
finally {
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, myTestRootDisposable);
PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, getTestRootDisposable());
}
}
@@ -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.
@@ -20,16 +20,13 @@ import com.intellij.ide.projectView.impl.AbstractProjectTreeStructure;
import com.intellij.ide.projectView.impl.ClassesTreeStructureProvider;
import com.intellij.ide.projectView.impl.nodes.PackageElementNode;
import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.ide.util.treeView.AbstractTreeStructure;
import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.ui.Queryable;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDirectory;
import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.testFramework.ProjectViewTestUtil;
import com.intellij.testFramework.TestSourceBasedTestCase;
import com.intellij.util.Function;
import org.jetbrains.annotations.NonNls;
import javax.swing.*;
@@ -43,7 +40,7 @@ public abstract class BaseProjectViewTestCase extends TestSourceBasedTestCase {
protected void setUp() throws Exception {
super.setUp();
myStructure = new TestProjectTreeStructure(myProject, myTestRootDisposable);
myStructure = new TestProjectTreeStructure(myProject, getTestRootDisposable());
}
@Override
@@ -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.json;
import com.intellij.codeInsight.lookup.Lookup;
@@ -36,7 +51,7 @@ public class JsonLiveTemplateTest extends JsonTestCase {
assertNotNull(context);
((TemplateImpl)template).getTemplateContext().setEnabled(context, true);
CodeInsightTestUtil.addTemplate(template, myTestRootDisposable);
CodeInsightTestUtil.addTemplate(template, getTestRootDisposable());
return template;
}
@@ -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.jetbrains.jsonSchema;
import com.intellij.codeInsight.documentation.DocumentationManager;
@@ -43,7 +58,7 @@ public class JsonSchemaDocumentationTest extends LightPlatformCodeInsightFixture
JsonSchemaHighlightingTest.registerProvider(getProject(), schemaText);
final JsonSchemaDocumentationProvider provider = new JsonSchemaDocumentationProvider();
LanguageDocumentation.INSTANCE.addExplicitExtension(JsonLanguage.INSTANCE, provider);
Disposer.register(myTestRootDisposable, new Disposable() {
Disposer.register(getTestRootDisposable(), new Disposable() {
@Override
public void dispose() {
LanguageDocumentation.INSTANCE.removeExplicitExtension(JsonLanguage.INSTANCE, provider);
@@ -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.jetbrains.jsonSchema;
import com.intellij.codeInsight.daemon.DaemonAnalyzerTestCase;
@@ -291,7 +306,7 @@ public class JsonSchemaHighlightingTest extends DaemonAnalyzerTestCase {
registerProvider(getProject(), schema);
LanguageAnnotators.INSTANCE.addExplicitExtension(JsonLanguage.INSTANCE, annotator);
Disposer.register(myTestRootDisposable, new Disposable() {
Disposer.register(getTestRootDisposable(), new Disposable() {
@Override
public void dispose() {
LanguageAnnotators.INSTANCE.removeExplicitExtension(JsonLanguage.INSTANCE, annotator);
@@ -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.
@@ -205,7 +205,7 @@ public class ExternalProjectServiceTest extends AbstractExternalSystemTest {
List<String> allowedRoots = new ArrayList<String>();
allowedRoots.add(myJdkHome);
allowedRoots.addAll(collectRootsInside(myJdkHome));
VfsRootAccess.allowRootAccess(myTestRootDisposable, ArrayUtil.toStringArray(allowedRoots));
VfsRootAccess.allowRootAccess(testRootDisposable, ArrayUtil.toStringArray(allowedRoots));
new WriteAction() {
@Override
@@ -1,33 +1,3 @@
/*
* 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-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-2016 JetBrains s.r.o.
*
@@ -49,17 +49,19 @@ import com.intellij.pom.Navigatable;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.reference.SoftReference;
import com.intellij.ui.ColorUtil;
import com.intellij.ui.JBColor;
import com.intellij.ui.RetrievableIcon;
import com.intellij.util.NotNullProducer;
import com.intellij.util.PlatformIcons;
import com.intellij.util.Processor;
import com.intellij.util.containers.WeakHashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
public class Bookmark implements Navigatable, Comparable<Bookmark> {
public static final Icon DEFAULT_ICON = new MyCheckedIcon();
@@ -67,6 +69,7 @@ public class Bookmark implements Navigatable, Comparable<Bookmark> {
private final VirtualFile myFile;
@NotNull private OpenFileDescriptor myTarget;
private final Project myProject;
private WeakHashMap<Document, Reference<RangeHighlighterEx>> myHighlighterRefs;
private String myDescription;
private char myMnemonic = 0;
@@ -106,33 +109,37 @@ public class Bookmark implements Navigatable, Comparable<Bookmark> {
}
public RangeHighlighter createHighlighter(@NotNull MarkupModelEx markup) {
final RangeHighlighterEx myHighlighter;
final RangeHighlighterEx highlighter;
int line = getLine();
if (line >= 0) {
myHighlighter = markup.addPersistentLineHighlighter(line, HighlighterLayer.ERROR + 1, null);
if (myHighlighter != null) {
myHighlighter.setGutterIconRenderer(new MyGutterIconRenderer(this));
highlighter = markup.addPersistentLineHighlighter(line, HighlighterLayer.ERROR + 1, null);
if (highlighter != null) {
highlighter.setGutterIconRenderer(new MyGutterIconRenderer(this));
TextAttributes textAttributes =
EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.BOOKMARKS_ATTRIBUTES);
Color stripeColor = textAttributes.getErrorStripeColor();
myHighlighter.setErrorStripeMarkColor(stripeColor != null ? stripeColor : Color.black);
myHighlighter.setErrorStripeTooltip(getBookmarkTooltip());
highlighter.setErrorStripeMarkColor(stripeColor != null ? stripeColor : Color.black);
highlighter.setErrorStripeTooltip(getBookmarkTooltip());
TextAttributes attributes = myHighlighter.getTextAttributes();
TextAttributes attributes = highlighter.getTextAttributes();
if (attributes == null) {
attributes = new TextAttributes();
}
attributes.setBackgroundColor(textAttributes.getBackgroundColor());
attributes.setForegroundColor(textAttributes.getForegroundColor());
myHighlighter.setTextAttributes(attributes);
highlighter.setTextAttributes(attributes);
}
}
else {
myHighlighter = null;
highlighter = null;
}
return myHighlighter;
if (myHighlighterRefs == null) myHighlighterRefs = new WeakHashMap<>();
if (highlighter != null) {
myHighlighterRefs.put(markup.getDocument(), new WeakReference<RangeHighlighterEx>(highlighter));
}
return highlighter;
}
@Nullable
@@ -141,24 +148,33 @@ public class Bookmark implements Navigatable, Comparable<Bookmark> {
}
public void release() {
int line = getLine();
if (line < 0) {
return;
}
final Document document = getDocument();
if (document == null) return;
MarkupModelEx markup = (MarkupModelEx)DocumentMarkupModel.forDocument(document, myProject, true);
final Document markupDocument = markup.getDocument();
if (markupDocument.getLineCount() <= line) return;
RangeHighlighterEx highlighter = findMyHighlighter();
if (highlighter != null) {
highlighter.dispose();
try {
int line = getLine();
if (line < 0) {
return;
}
final Document document = getDocument();
if (document == null) return;
MarkupModelEx markup = (MarkupModelEx)DocumentMarkupModel.forDocument(document, myProject, true);
final Document markupDocument = markup.getDocument();
if (markupDocument.getLineCount() <= line) return;
RangeHighlighterEx highlighter = findMyHighlighter();
if (highlighter != null) {
highlighter.dispose();
}
} finally {
myHighlighterRefs = null;
}
}
private RangeHighlighterEx findMyHighlighter() {
final Document document = getDocument();
if (document == null) return null;
Reference<RangeHighlighterEx> reference = myHighlighterRefs != null ? myHighlighterRefs.get(document) : null;
RangeHighlighterEx result = SoftReference.dereference(reference);
if (result != null) {
return result;
}
MarkupModelEx markup = (MarkupModelEx)DocumentMarkupModel.forDocument(document, myProject, true);
final Document markupDocument = markup.getDocument();
final int startOffset = 0;
@@ -173,7 +189,12 @@ public class Bookmark implements Navigatable, Comparable<Bookmark> {
}
return true;
});
return found.get();
result = found.get();
if (result != null) {
if (myHighlighterRefs == null) myHighlighterRefs = new WeakHashMap<>();
myHighlighterRefs.put(document, new WeakReference<RangeHighlighterEx>(result));
}
return result;
}
public Icon getIcon() {
@@ -90,6 +90,11 @@ public class SwitchBootJdkAction extends AnAction implements DumbAware {
SwitchBootJdkDialog dialog = new SwitchBootJdkDialog();
if (dialog.showAndGet()) {
File selectedJdkBundleFile = dialog.getSelectedFile();
if (selectedJdkBundleFile == null) {
LOG.error("SwitchBootJdkDialog returns null selection");
return;
}
FileWriter fooWriter = null;
try {
//noinspection IOResourceOpenedButNotSafelyClosed
@@ -199,6 +204,7 @@ public class SwitchBootJdkAction extends AnAction implements DumbAware {
throw new Exception("Invalid JDK bundle!");
}
if (selectedBundle.getBitness() != JdkBundle.runtimeBitness) {
//noinspection SpellCheckingInspection
throw new Exception("JDK arch mismatch! Your IDE's arch is " + JdkBundle.runtimeBitness);
}
}
@@ -264,8 +270,14 @@ public class SwitchBootJdkAction extends AnAction implements DumbAware {
return myComboBox;
}
@Nullable
public File getSelectedFile() {
return ((JdkBundle)myComboBox.getSelectedItem()).getLocation();
final JdkBundleItem item = (JdkBundleItem)myComboBox.getSelectedItem();
if (item == null) return null;
final JdkBundle bundle = item.getBundle();
return bundle != null ? bundle.getLocation() : null;
}
}
@@ -131,17 +131,7 @@ public enum EffectPainter implements RegionPainter<Paint> {
WavePainter.forColor(g.getColor()).paint(g, x, x + width, y + height);
}
else if (width > 0 && height > 0) {
if (paint == null) paint = g.getPaint();
g = (Graphics2D)g.create(x, y, width, height);
g.setComposite(AlphaComposite.SrcOver);
g.clipRect(0, 0, width, height);
BufferedImage image = WAVE_FACTORY.get(g, paint, height);
int length = image.getWidth(); // the spatial period of the wave
int dx = -((x % length + length) % length); // normalize
for (; dx < width; dx += length) {
UIUtil.drawImage(g, image, dx, 0, null);
}
g.dispose();
WAVE_FACTORY.paint(g, x, y, width, height, paint);
}
}
},
@@ -191,67 +181,62 @@ public enum EffectPainter implements RegionPainter<Paint> {
height = thickness;
}
if (painter == BOLD_DOTTED_UNDERSCORE) {
int length = 2 * height; // the spatial period
int dx = -((x % length + length) % length); // normalize
if (-dx >= height) {
dx += length;
}
Composite old = g.getComposite();
g.setComposite(AlphaComposite.SrcOver);
BufferedImage image = BOLD_DOTTED_FACTORY.get(g, g.getPaint(), height);
for (; dx < width; dx += length) {
if (image != null) {
UIUtil.drawImage(g, image, x + dx, y, null);
}
else {
//noinspection SuspiciousNameCombination
RectanglePainter.FILL.paint(g, x + dx, y, height, height, null);
}
}
g.setComposite(old);
BOLD_DOTTED_FACTORY.paint(g, x, y, width, height, null);
}
else {
g.fillRect(x, y, width, height);
}
}
private static abstract class Factory {
private static abstract class Factory implements RegionPainter<Paint> {
private final ConcurrentHashMap<Long, BufferedImage> myCache = new ConcurrentHashMap<>();
abstract BufferedImage create(Graphics2D g, Paint paint, int height);
BufferedImage get(Graphics2D g, Paint paint, int height) {
@Override
public void paint(Graphics2D g, int x, int y, int width, int height, Paint paint) {
if (paint == null) paint = g.getPaint();
g = (Graphics2D)g.create(x, y, width, height);
g.setComposite(AlphaComposite.SrcOver);
BufferedImage image;
if (paint instanceof Color) {
Color color = (Color)paint;
Long key = color.getRGB() ^ ((long)height << 32);
BufferedImage image = myCache.get(key);
image = myCache.get(key);
boolean exists = image != null;
if (!exists || UIUtil.isRetina(g) != (image instanceof JBHiDPIScaledImage)) {
image = create(g, paint, height);
if (image != null) {
myCache.put(key, image);
}
else if (exists) {
myCache.remove(key);
}
myCache.put(key, image);
}
return image;
}
return create(g, paint, height);
else {
image = create(g, paint, height);
}
int length = image.getWidth();
int dx = -((x % length + length) % length); // normalize
for (; dx < width; dx += length) {
UIUtil.drawImage(g, image, dx, 0, null);
}
g.dispose();
}
}
private static final Factory BOLD_DOTTED_FACTORY = new Factory() {
@Override
BufferedImage create(Graphics2D graphics, Paint paint, int height) {
if (height <= 2 && !UIUtil.isRetina(graphics)) return null;
Integer round = height <= 2 && !UIUtil.isRetina(graphics) ? null : height;
//noinspection SuspiciousNameCombination
BufferedImage image = UIUtil.createImageForGraphics(graphics, height, height, BufferedImage.TYPE_INT_ARGB);
int width = height << 8;
BufferedImage image = UIUtil.createImageForGraphics(graphics, width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = image.createGraphics();
g.setPaint(paint);
try {
g.setPaint(paint);
//noinspection SuspiciousNameCombination
RectanglePainter.FILL.paint(g, 0, 0, height, height, height);
int dx = 0;
while (dx < width) {
//noinspection SuspiciousNameCombination
RectanglePainter.FILL.paint(g, dx, 0, height, height, round);
dx += height + height;
}
}
finally {
g.dispose();
@@ -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.
@@ -38,7 +38,7 @@ public class SelectUnselectOccurrenceActionsTest extends LightPlatformCodeInsigh
hintCount++;
}
};
ApplicationManager.getApplication().getMessageBus().connect(myTestRootDisposable).subscribe(EditorHintListener.TOPIC, listener);
ApplicationManager.getApplication().getMessageBus().connect(getTestRootDisposable()).subscribe(EditorHintListener.TOPIC, listener);
}
public void testAllWithoutInitialSelection() throws Exception {
@@ -375,7 +375,7 @@ public class EditorImplTest extends AbstractEditorTest {
}
}
};
getProject().getMessageBus().connect(myTestRootDisposable).subscribe(DocumentBulkUpdateListener.TOPIC, listener);
getProject().getMessageBus().connect(getTestRootDisposable()).subscribe(DocumentBulkUpdateListener.TOPIC, listener);
initText("abcdef");
DocumentEx document = (DocumentEx)myEditor.getDocument();
new WriteCommandAction.Simple(getProject()) {
@@ -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.
@@ -60,7 +60,7 @@ public class NonProjectFileAccessTest extends HeavyFileEditorManagerTestCase {
super.setUp();
EditorNotifications notifications = new EditorNotificationsImpl(getProject());
((ComponentManagerImpl)getProject()).registerComponentInstance(EditorNotifications.class, notifications);
NonProjectFileWritingAccessProvider.enableChecksInTests(myTestRootDisposable);
NonProjectFileWritingAccessProvider.enableChecksInTests(getTestRootDisposable());
ProjectManagerEx.getInstanceEx().blockReloadingProjectOnExternalChanges();
}
@@ -322,7 +322,7 @@ public class NonProjectFileAccessTest extends HeavyFileEditorManagerTestCase {
public boolean isPotentiallyWritable(@NotNull VirtualFile file) {
return true;
}
}, myTestRootDisposable);
}, getTestRootDisposable());
return requested;
}
@@ -339,7 +339,7 @@ public class NonProjectFileAccessTest extends HeavyFileEditorManagerTestCase {
return filesToDeny.contains(file);
}
},
myTestRootDisposable);
getTestRootDisposable());
}
@NotNull
@@ -596,7 +596,7 @@ public class FileTypesTest extends PlatformTestCase {
}
public void _testStressPlainTextFileWithEverIncreasingLength() throws IOException, InterruptedException {
FrequentEventDetector.disableUntil(myTestRootDisposable);
FrequentEventDetector.disableUntil(getTestRootDisposable());
File f = createTempFile("xx.lkjlkjlkjlj", "a");
VirtualFile virtualFile = getVirtualFile(f);
@@ -658,7 +658,7 @@ public class FileTypesTest extends PlatformTestCase {
}
public void _testStressPlainTextFileWithEverIncreasingLength2() throws IOException, InterruptedException {
FrequentEventDetector.disableUntil(myTestRootDisposable);
FrequentEventDetector.disableUntil(getTestRootDisposable());
File f = createTempFile("xx.asdkjfhlkasjdhf", StringUtil.repeatSymbol(' ', (int)PersistentFSConstants.FILE_LENGTH_TO_CACHE_THRESHOLD - 100));
VirtualFile virtualFile = getVirtualFile(f);
@@ -268,7 +268,7 @@ public class ProgressIndicatorTest extends LightPlatformTestCase {
private void ensureCheckCanceledCalled(@NotNull ProgressIndicator indicator) {
myFlag = false;
Alarm alarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, myTestRootDisposable);
Alarm alarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, getTestRootDisposable());
alarm.addRequest(() -> myFlag = true, 100);
final long start = System.currentTimeMillis();
try {
@@ -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.
@@ -20,7 +20,6 @@ import com.google.gson.JsonParser;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.ex.ProjectManagerEx;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.vcs.VcsCheckoutProcessor;
@@ -38,7 +37,10 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* @author Dmitry Avdeev
@@ -61,7 +63,7 @@ public class ProjectSetTest extends LightPlatformTestCase {
public void processEntries(@NotNull List<Pair<String, String>> entries, @NotNull Context context, @NotNull Runnable runNext) {
ref.set(entries);
}
}, myTestRootDisposable);
}, getTestRootDisposable());
ProjectSetProcessor.Context context = new ProjectSetProcessor.Context();
context.directory = getSourceRoot();
@@ -89,7 +91,7 @@ public class ProjectSetTest extends LightPlatformTestCase {
pairs.add(Pair.create(parameters.get("url"), directoryName));
return true;
}
}, myTestRootDisposable);
}, getTestRootDisposable());
ProjectSetProcessor.Context context = new ProjectSetProcessor.Context();
context.directoryName = "newDir";
@@ -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.
@@ -44,7 +44,7 @@ public class MetaRegistryTest extends LightPlatformTestCase {
public boolean isClassAcceptable(Class hintClass) {
return true;
}
}, MyTrueMetaData.class, myTestRootDisposable);
}, MyTrueMetaData.class, getTestRootDisposable());
MetaRegistry.addMetadataBinding(new ElementFilter() {
@Override
public boolean isAcceptable(Object element, PsiElement context) {
@@ -55,7 +55,7 @@ public class MetaRegistryTest extends LightPlatformTestCase {
public boolean isClassAcceptable(Class hintClass) {
return true;
}
}, MyFalseMetaData.class, myTestRootDisposable);
}, MyFalseMetaData.class, getTestRootDisposable());
final XmlTag tag = ((XmlFile)LightPlatformTestCase.createFile("a.xml", "<a/>")).getDocument().getRootTag();
UsefulTestCase.assertInstanceOf(tag.getMetaData(), MyFalseMetaData.class);
@@ -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.
@@ -24,8 +24,6 @@ import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.extensions.ExtensionsArea;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.fileTypes.FileTypeRegistry;
import com.intellij.openapi.util.Getter;
import com.intellij.openapi.vfs.encoding.EncodingManager;
import com.intellij.openapi.vfs.encoding.EncodingManagerImpl;
import org.jetbrains.annotations.NotNull;
@@ -73,7 +71,7 @@ public abstract class PlatformLiteFixture extends UsefulTestCase {
registerExtensionPoint(area, name, (Class<T>)t.getClass());
PlatformTestUtil.registerExtension(area, name, t, myTestRootDisposable);
PlatformTestUtil.registerExtension(area, name, t, getTestRootDisposable());
}
protected <T> void registerExtensionPoint(final ExtensionPointName<T> extensionPointName, final Class<T> aClass) {
@@ -92,7 +92,7 @@ public abstract class UsefulTestCase extends TestCase {
private static final Map<String, Long> TOTAL_TEARDOWN_COST_MILLIS = new HashMap<>();
@NotNull
protected final Disposable myTestRootDisposable = new Disposable() {
private final Disposable myTestRootDisposable = new Disposable() {
@Override
public void dispose() { }
@@ -152,7 +152,7 @@ public abstract class UsefulTestCase extends TestCase {
@Override
protected void tearDown() throws Exception {
try {
Disposer.dispose(myTestRootDisposable);
Disposer.dispose(getTestRootDisposable());
cleanupSwingDataStructures();
cleanupDeleteOnExitHookList();
}
@@ -716,7 +716,7 @@ public abstract class UsefulTestCase extends TestCase {
}
protected <T extends Disposable> T disposeOnTearDown(final T disposable) {
Disposer.register(myTestRootDisposable, disposable);
Disposer.register(getTestRootDisposable(), disposable);
return disposable;
}
@@ -151,7 +151,7 @@ editor.navigation.history.stack.size=25
editor.navigation.history.stack.size.description=Stack size limit for back/forward and last/next edit location navigation
editor.reformat.on.typing=false
smart.reformat.vcs.changes=false
smart.reformat.vcs.changes=true
ide.showIndexRebuildMessage=false
@@ -133,7 +133,7 @@ abstract class VcsPlatformTest : PlatformTestCase() {
}
private fun enableDebugLogging(): String {
TestLoggerFactory.enableDebugLogging(myTestRootDisposable, *ArrayUtil.toStringArray(getDebugLogCategories()))
TestLoggerFactory.enableDebugLogging(testRootDisposable, *ArrayUtil.toStringArray(getDebugLogCategories()))
val testStartedIndicator = createTestStartedIndicator()
LOG.info(testStartedIndicator)
return testStartedIndicator
@@ -57,7 +57,7 @@ class GroovyDebuggerTest extends GroovyCompilerTestCase implements DebuggerMetho
}
private void enableDebugLogging() {
TestLoggerFactory.enableDebugLogging(myTestRootDisposable,
TestLoggerFactory.enableDebugLogging(testRootDisposable,
"#com.intellij.debugger.engine.DebugProcessImpl",
"#com.intellij.debugger.engine.DebugProcessEvents",
"#org.jetbrains.plugins.groovy.compiler.GroovyDebuggerTest");
@@ -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.
@@ -30,7 +30,7 @@ public class PropertiesProjectViewTest extends LightPlatformCodeInsightFixtureTe
@Override
protected void setUp() throws Exception {
super.setUp();
myStructure = new TestProjectTreeStructure(getProject(), myTestRootDisposable);
myStructure = new TestProjectTreeStructure(getProject(), getTestRootDisposable());
}
@Override
@@ -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.
@@ -46,7 +46,7 @@ public class TaskManagerTest extends TaskManagerTestCase {
count.set(count.get() + 1);
}
};
myTaskManager.addTaskListener(listener, myTestRootDisposable);
myTaskManager.addTaskListener(listener, getTestRootDisposable());
LocalTask localTask = myTaskManager.createLocalTask("foo");
myTaskManager.activateTask(localTask, false);
assertEquals(1, count.get().intValue());
@@ -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.
@@ -146,7 +146,7 @@ public abstract class TaskBranchesTest extends PlatformTestCase {
String defaultBranchName = getDefaultBranchName();
LocalTaskImpl task = myTaskManager.createLocalTask("foo");
OpenTaskDialog dialog = new OpenTaskDialog(getProject(), task);
Disposer.register(myTestRootDisposable, dialog.getDisposable());
Disposer.register(getTestRootDisposable(), dialog.getDisposable());
dialog.createTask();
assertEquals("foo", myTaskManager.getActiveTask().getSummary());
List<BranchInfo> branches = task.getBranches(true);
@@ -20,7 +20,6 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileFilter;
import com.intellij.psi.*;
import com.intellij.psi.impl.PsiManagerEx;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.python.PythonFileType;
import com.jetbrains.python.PythonTestUtil;
@@ -50,7 +49,7 @@ public abstract class PyMultiFileResolveTestCase extends PyResolveTestCase {
FileType fileType = file.getFileType();
return fileType == PythonFileType.INSTANCE;
}
}, myTestRootDisposable);
}, getTestRootDisposable());
final PsiElement result;
if (ref instanceof PsiPolyVariantReference) {
final ResolveResult[] resolveResults = ((PsiPolyVariantReference)ref).multiResolve(false);
@@ -59,7 +58,7 @@ public abstract class PyMultiFileResolveTestCase extends PyResolveTestCase {
else {
result = ref.resolve();
}
psiManager.setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, myTestRootDisposable);
psiManager.setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, getTestRootDisposable());
return result;
}
@@ -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.
@@ -49,7 +49,7 @@ public class DomConcurrencyStressTest extends DomTestCase {
private static final int ITERATIONS = Timings.adjustAccordingToMySpeed(239, true);
public void testInternalDomLocksReadConsistency() throws Throwable {
getDomManager().registerFileDescription(new DomFileDescription(MyElement.class, "a"), myTestRootDisposable);
getDomManager().registerFileDescription(new DomFileDescription(MyElement.class, "a"), getTestRootDisposable());
registerExtender(MyElement.class, MyExtender.class);
@@ -111,7 +111,7 @@ public class DomConcurrencyStressTest extends DomTestCase {
final DomExtenderEP extenderEP = new DomExtenderEP();
extenderEP.domClassName = elementClass.getName();
extenderEP.extenderClassName = extenderClass.getName();
PlatformTestUtil.registerExtension(Extensions.getRootArea(), DomExtenderEP.EP_NAME, extenderEP, myTestRootDisposable);
PlatformTestUtil.registerExtension(Extensions.getRootArea(), DomExtenderEP.EP_NAME, extenderEP, getTestRootDisposable());
}
private static void runThreads(int threadCount, final Runnable runnable) throws Throwable {
@@ -187,7 +187,7 @@ public class DomConcurrencyStressTest extends DomTestCase {
}
public void testBigCustomFile() throws Throwable {
getDomManager().registerFileDescription(new DomFileDescription(MyAllCustomElement.class, "component"), myTestRootDisposable);
getDomManager().registerFileDescription(new DomFileDescription(MyAllCustomElement.class, "component"), getTestRootDisposable());
registerExtender(MyAllCustomElement.class, MyAllCustomExtender.class);
@@ -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.
@@ -17,9 +17,7 @@ package com.intellij.util.xml;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.util.Key;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.util.Consumer;
import com.intellij.util.ParameterizedTypeImpl;
import com.intellij.util.ReflectionUtil;
import com.intellij.util.xml.impl.DomTestCase;
@@ -192,7 +190,7 @@ public class DomExtensionsTest extends DomTestCase {
final DomExtenderEP extenderEP = new DomExtenderEP();
extenderEP.domClassName = domClass.getName();
extenderEP.extenderClassName = extenderClass.getName();
PlatformTestUtil.registerExtension(Extensions.getRootArea(), DomExtenderEP.EP_NAME, extenderEP, myTestRootDisposable);
PlatformTestUtil.registerExtension(Extensions.getRootArea(), DomExtenderEP.EP_NAME, extenderEP, getTestRootDisposable());
}
@@ -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.
@@ -49,7 +49,7 @@ public abstract class DomTestCase extends LightIdeaTestCase {
protected void setUp() throws Exception {
super.setUp();
myCallRegistry = new CallRegistry<DomEvent>();
getDomManager().addDomEventListener(myListener, myTestRootDisposable);
getDomManager().addDomEventListener(myListener, getTestRootDisposable());
}
protected void assertCached(final DomElement element, final XmlElement xmlElement) {
@@ -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.
@@ -81,7 +81,7 @@ public class DomStubBuilderTest extends DomStubTest {
DomExtenderEP ep = new DomExtenderEP();
ep.domClassName = Bar.class.getName();
ep.extenderClassName = TestExtender.class.getName();
PlatformTestUtil.registerExtension(Extensions.getRootArea(), DomExtenderEP.EP_NAME, ep, myTestRootDisposable);
PlatformTestUtil.registerExtension(Extensions.getRootArea(), DomExtenderEP.EP_NAME, ep, getTestRootDisposable());
doBuilderTest("extender.xml", "File:foo\n" +
" Element:foo\n" +
@@ -122,7 +122,7 @@ public class DomStubUsingTest extends DomStubTest {
public void testFileLoading() throws Exception {
XmlFile file = prepareFile("foo.xml");
((PsiManagerEx)getPsiManager()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, myTestRootDisposable);
((PsiManagerEx)getPsiManager()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, getTestRootDisposable());
DomFileElement<Foo> element = DomManager.getDomManager(getProject()).getFileElement(file, Foo.class);
assertNotNull(element);
GenericDomValue<String> id = element.getRootElement().getId();
@@ -40,18 +40,18 @@ public class RngXmlHighlightingTest extends HighlightingTestBase {
ApplicationManager.getApplication().runWriteAction(() -> {
final ExternalResourceManagerEx m = ExternalResourceManagerEx.getInstanceEx();
ExternalResourceManagerExImpl
.addTestResource("urn:test:simple.rng", toAbsolutePath("highlighting/simple.rng"), myTestRootDisposable);
.addTestResource("urn:test:simple.rng", toAbsolutePath("highlighting/simple.rng"), getTestRootDisposable());
ExternalResourceManagerExImpl.addTestResource("urn:test:addressBook", toAbsolutePath("highlighting/rnc/addressbook.rnc"),
myTestRootDisposable);
getTestRootDisposable());
//m.addResource("http://www.w3.org/1999/XSL/Transform", toAbsolutePath("highlighting/relaxng.rng"));
ExternalResourceManagerExImpl.addTestResource("http://www.w3.org/1999/XSL/Format", toAbsolutePath("highlighting/rnc/fo/main.rnc"),
myTestRootDisposable);
getTestRootDisposable());
ExternalResourceManagerExImpl.addTestResource("http://docbook.org/ns/docbook", toAbsolutePath("highlighting/docbook.rng"),
myTestRootDisposable);
getTestRootDisposable());
ExternalResourceManagerExImpl.addTestResource("urn:intelliForm:AttachmentFilter",
toAbsolutePath("highlighting/attachment-filter.rng"), myTestRootDisposable);
toAbsolutePath("highlighting/attachment-filter.rng"), getTestRootDisposable());
ExternalResourceManagerExImpl
.addTestResource("http://www.w3.org/1999/xhtml", toAbsolutePath("highlighting/html5/xhtml5.rnc"), myTestRootDisposable);
.addTestResource("http://www.w3.org/1999/xhtml", toAbsolutePath("highlighting/html5/xhtml5.rnc"), getTestRootDisposable());
m.addIgnoredResource("urn:intelliForm:Spaces");
m.addIgnoredResource("http://www.w3.org/1999/xlink");
@@ -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.
@@ -49,7 +49,7 @@ public class XmlEventsTest extends LightCodeInsightTestCase {
private Listener addPomListener() {
final PomModel model = PomManager.getModel(getProject());
final Listener listener = new Listener(model.getModelAspect(XmlAspect.class));
model.addModelListener(listener,myTestRootDisposable);
model.addModelListener(listener, getTestRootDisposable());
return listener;
}
@@ -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.
@@ -78,7 +78,7 @@ public class XmlCompletionTest extends LightCodeInsightFixtureTestCase {
return;
}
ExternalResourceManagerExImpl.addTestResource(url, location, myTestRootDisposable);
ExternalResourceManagerExImpl.addTestResource(url, location, getTestRootDisposable());
}
@Override