From 51fc5dd60405a42508c95e8fbf5b28ae6acc0e27 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Fri, 6 Apr 2018 18:20:18 +0200 Subject: [PATCH] default impl of addConfiguration(rc, isShared) --- .../src/com/intellij/execution/RunManager.kt | 23 +++++-------------- .../intellij/execution/RunManagerConfig.java | 19 +++------------ .../src/com/intellij/mock/MockRunManager.kt | 22 +----------------- 3 files changed, 10 insertions(+), 54 deletions(-) diff --git a/platform/lang-api/src/com/intellij/execution/RunManager.kt b/platform/lang-api/src/com/intellij/execution/RunManager.kt index dc6712069881..f2cf474cf222 100644 --- a/platform/lang-api/src/com/intellij/execution/RunManager.kt +++ b/platform/lang-api/src/com/intellij/execution/RunManager.kt @@ -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-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. package com.intellij.execution import com.intellij.execution.configurations.ConfigurationFactory @@ -172,7 +158,10 @@ abstract class RunManager { * @param isShared true if the configuration is marked as shared (stored in the versioned part of the project files), false if it's local * * (stored in the workspace file). */ - abstract fun addConfiguration(settings: RunnerAndConfigurationSettings, isShared: Boolean) + fun addConfiguration(settings: RunnerAndConfigurationSettings, isShared: Boolean) { + settings.isShared = isShared + addConfiguration(settings) + } /** * Marks the specified run configuration as recently used (the temporary run configurations are deleted in LRU order). @@ -220,7 +209,7 @@ abstract class RunManager { abstract fun setTemporaryConfiguration(tempConfiguration: RunnerAndConfigurationSettings?) } -private val UNNAMED = "Unnamed" +private const val UNNAMED = "Unnamed" val IS_RUN_MANAGER_INITIALIZED = Key.create("RunManagerInitialized") private val LOG = Logger.getInstance(RunManager::class.java) \ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/execution/RunManagerConfig.java b/platform/lang-impl/src/com/intellij/execution/RunManagerConfig.java index 19276b205753..ed7138df1e28 100644 --- a/platform/lang-impl/src/com/intellij/execution/RunManagerConfig.java +++ b/platform/lang-impl/src/com/intellij/execution/RunManagerConfig.java @@ -1,24 +1,11 @@ -/* - * 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-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. package com.intellij.execution; import com.intellij.ide.util.PropertiesComponent; import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; public class RunManagerConfig { public static final String MAKE = ExecutionBundle.message("before.run.property.make"); @@ -32,7 +19,7 @@ public class RunManagerConfig { @NonNls private static final String RESTART_REQUIRES_CONFIRMATION = "restartRequiresConfirmation"; @NonNls private static final String STOP_INCOMPATIBLE_REQUIRES_CONFIRMATION = "stopIncompatibleRequiresConfirmation"; - public RunManagerConfig(PropertiesComponent propertiesComponent) { + public RunManagerConfig(@NotNull PropertiesComponent propertiesComponent) { myPropertiesComponent = propertiesComponent; } diff --git a/platform/testFramework/src/com/intellij/mock/MockRunManager.kt b/platform/testFramework/src/com/intellij/mock/MockRunManager.kt index 6254fb5e7087..8b9f612bab41 100644 --- a/platform/testFramework/src/com/intellij/mock/MockRunManager.kt +++ b/platform/testFramework/src/com/intellij/mock/MockRunManager.kt @@ -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-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. package com.intellij.mock import com.intellij.execution.BeforeRunTask @@ -26,15 +12,9 @@ import com.intellij.execution.configurations.RunProfile import com.intellij.openapi.util.Key import javax.swing.Icon -/** - * @author gregsh - */ class MockRunManager : RunManagerEx() { override fun getConfigurationType(typeName: String) = TODO("not implemented") - override fun addConfiguration(settings: RunnerAndConfigurationSettings, isShared: Boolean) { - } - override fun hasSettings(settings: RunnerAndConfigurationSettings) = false override fun getConfigurationsList(type: ConfigurationType) = emptyList()