mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
simplify implementations, getConfiguration returns UnknownConfiguration if null (actually, it is already so)
(cherry picked from commit bcf2738f96752062442b14eabd933d11425d5d35)
This commit is contained in:
@@ -13,25 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
package com.jetbrains.python.testing
|
||||
|
||||
import com.intellij.execution.RunManager
|
||||
import com.intellij.execution.RunnerAndConfigurationSettings
|
||||
import com.intellij.execution.actions.ConfigurationContext
|
||||
import com.intellij.execution.actions.ConfigurationFromContext
|
||||
import com.intellij.execution.actions.RunConfigurationProducer
|
||||
@@ -57,16 +43,11 @@ abstract class AbstractPythonTestConfigurationProducer<T : AbstractPythonTestRun
|
||||
|
||||
// Some configurations have same type but produces different class
|
||||
// to prevent ClassCastException we only allow our configurations
|
||||
override fun getConfigurationSettingsList(runManager: RunManager): List<RunnerAndConfigurationSettings> =
|
||||
override fun getConfigurationSettingsList(runManager: RunManager) =
|
||||
super.getConfigurationSettingsList(runManager).filter { configurationClass.isAssignableFrom(it.configuration.javaClass) }
|
||||
|
||||
override fun createConfigurationFromContext(context: ConfigurationContext?): ConfigurationFromContext? {
|
||||
if (context == null) {
|
||||
return null
|
||||
}
|
||||
val configuration = cloneTemplateConfiguration(context).configuration ?: return null
|
||||
|
||||
if (!configurationClass.isAssignableFrom(configuration.javaClass)) {
|
||||
if (context == null || !configurationClass.isAssignableFrom(cloneTemplateConfiguration(context).configuration.javaClass)) {
|
||||
return null
|
||||
}
|
||||
return super.createConfigurationFromContext(context)
|
||||
|
||||
Reference in New Issue
Block a user