Cleanup 192 patchset files (KTI-315)

This commit is contained in:
Yunir Salimzyanov
2020-08-13 19:00:06 +03:00
parent 73aa21aab6
commit 42da9e62db
126 changed files with 0 additions and 11671 deletions
@@ -1,63 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.testFramework
import com.intellij.openapi.Disposable
import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId
import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationEvent
import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationListener
import com.intellij.testFramework.PlatformTestUtil.maskExtensions
import org.jetbrains.kotlin.idea.framework.GRADLE_SYSTEM_ID
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
import kotlin.test.assertNull
import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationListener.EP_NAME as EP
interface GradleProcessOutputInterceptor {
companion object {
fun getInstance(): GradleProcessOutputInterceptor? = EP.extensions.firstIsInstanceOrNull()
fun install(parentDisposable: Disposable) {
val installedExtensions = EP.extensions
assertNull(
installedExtensions.firstIsInstanceOrNull<GradleProcessOutputInterceptor>(),
"Another ${GradleProcessOutputInterceptor::class.java.simpleName} is already installed"
)
maskExtensions(
EP,
listOf(GradleProcessOutputInterceptorImpl()) + installedExtensions,
parentDisposable
)
}
}
fun reset()
fun getOutput(): String
}
private class GradleProcessOutputInterceptorImpl : GradleProcessOutputInterceptor, ExternalSystemTaskNotificationListener {
private val buffer = StringBuilder()
override fun onTaskOutput(id: ExternalSystemTaskId, text: String, stdOut: Boolean) {
if (id.projectSystemId == GRADLE_SYSTEM_ID && text.isNotEmpty())
buffer.append(text)
}
override fun reset() = buffer.setLength(0)
override fun getOutput() = buffer.toString()
override fun onSuccess(id: ExternalSystemTaskId) = Unit
override fun onFailure(id: ExternalSystemTaskId, e: Exception) = Unit
override fun onStatusChange(event: ExternalSystemTaskNotificationEvent) = Unit
override fun onCancel(id: ExternalSystemTaskId) = Unit
override fun onEnd(id: ExternalSystemTaskId) = Unit
override fun beforeCancel(id: ExternalSystemTaskId) = Unit
override fun onQueued(id: ExternalSystemTaskId, workingDir: String?) = Unit
@Suppress("UnstableApiUsage")
override fun onStart(id: ExternalSystemTaskId) = Unit
}
@@ -1,104 +0,0 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.testFramework
import com.intellij.ide.startup.impl.StartupManagerImpl
import com.intellij.lang.LanguageAnnotators
import com.intellij.lang.LanguageExtensionPoint
import com.intellij.lang.annotation.Annotator
import com.intellij.openapi.Disposable
import com.intellij.openapi.editor.Document
import com.intellij.openapi.extensions.ExtensionPointName
import com.intellij.openapi.fileEditor.FileDocumentManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.ex.ProjectManagerEx
import com.intellij.openapi.startup.StartupManager
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.impl.PsiDocumentManagerBase
import com.intellij.testFramework.PlatformTestUtil
import com.intellij.testFramework.runInEdtAndWait
import com.intellij.util.ui.UIUtil
import org.jetbrains.kotlin.idea.codeInsight.hints.HintType
import org.jetbrains.kotlin.idea.test.runPostStartupActivitiesOnce
fun commitAllDocuments() {
val fileDocumentManager = FileDocumentManager.getInstance()
runInEdtAndWait {
fileDocumentManager.saveAllDocuments()
}
ProjectManagerEx.getInstanceEx().openProjects.forEach { project ->
val psiDocumentManagerBase = PsiDocumentManager.getInstance(project) as PsiDocumentManagerBase
runInEdtAndWait {
psiDocumentManagerBase.clearUncommittedDocuments()
psiDocumentManagerBase.commitAllDocuments()
}
}
}
fun commitDocument(project: Project, document: Document) {
val psiDocumentManagerBase = PsiDocumentManager.getInstance(project) as PsiDocumentManagerBase
runInEdtAndWait {
psiDocumentManagerBase.commitDocument(document)
}
}
fun saveDocument(document: Document) {
val fileDocumentManager = FileDocumentManager.getInstance()
runInEdtAndWait {
fileDocumentManager.saveDocument(document)
}
}
fun enableHints(enable: Boolean) =
HintType.values().forEach { it.option.set(enable) }
fun dispatchAllInvocationEvents() {
runInEdtAndWait {
UIUtil.dispatchAllInvocationEvents()
}
}
fun loadProjectWithName(path: String, name: String): Project? =
ProjectManagerEx.getInstanceEx().loadProject(name, path)
fun TestApplicationManager.closeProject(project: Project) {
dispatchAllInvocationEvents()
val projectManagerEx = ProjectManagerEx.getInstanceEx()
projectManagerEx.forceCloseProjectEx(project, true)
}
fun runStartupActivities(project: Project) {
with(StartupManager.getInstance(project) as StartupManagerImpl) {
scheduleInitialVfsRefresh()
runStartupActivities()
}
runPostStartupActivitiesOnce(project)
}
fun waitForAllEditorsFinallyLoaded(project: Project) {
// routing is obsolete in 192
}
fun replaceWithCustomHighlighter(parentDisposable: Disposable, fromImplementationClass: String, toImplementationClass: String) {
val pointName = ExtensionPointName.create<LanguageExtensionPoint<Annotator>>(LanguageAnnotators.EP_NAME)
val extensionPoint = pointName.getPoint(null)
val point = LanguageExtensionPoint<Annotator>()
point.language = "kotlin"
point.implementationClass = toImplementationClass
val extensions = extensionPoint.extensions
val filteredExtensions =
extensions.filter { it.language != "kotlin" || it.implementationClass != fromImplementationClass }
.toList()
// custom highlighter is already registered if filteredExtensions has the same size as extensions
if (filteredExtensions.size < extensions.size) {
PlatformTestUtil.maskExtensions(pointName, filteredExtensions + listOf(point), parentDisposable)
}
}