diff --git a/plugins/devfile-plugin/src/main/kotlin/che/incubator/devfile/DevfileComponentSettings.kt b/plugins/devfile-plugin/src/main/kotlin/che/incubator/devfile/DevfileComponentSettings.kt deleted file mode 100644 index 00b508d8..00000000 --- a/plugins/devfile-plugin/src/main/kotlin/che/incubator/devfile/DevfileComponentSettings.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2022 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package che.incubator.devfile - -import com.intellij.openapi.components.PersistentStateComponent -import com.intellij.openapi.components.ServiceManager -import com.intellij.openapi.components.State -import com.intellij.openapi.components.Storage - -@State(name = "Devfile Settings", storages = [Storage("devfile.xml")]) -class DevfileComponentSettings : PersistentStateComponent { - - companion object { - const val DEFAULT_FLATTENED_DEVFILE_ENV_VARIABLE = "DEVWORKSPACE_FLATTENED_DEVFILE" - val instance: DevfileComponentSettings - get() = ServiceManager.getService(DevfileComponentSettings::class.java) - } - - data class State(var flattenedDevfileEnvVariable: String = DEFAULT_FLATTENED_DEVFILE_ENV_VARIABLE) - - private var state = State() - - override fun getState(): State { - return state - } - - override fun loadState(state: State) { - this.state = state - } - - var flattenedDevfileEnvVariable: String - get() = state.flattenedDevfileEnvVariable - set(flattenedDevfileEnvVariable) { - state.flattenedDevfileEnvVariable = flattenedDevfileEnvVariable - } -} diff --git a/plugins/devfile-plugin/src/main/kotlin/che/incubator/devfile/DevfileConfigurable.kt b/plugins/devfile-plugin/src/main/kotlin/che/incubator/devfile/DevfileConfigurable.kt deleted file mode 100644 index 30a14fab..00000000 --- a/plugins/devfile-plugin/src/main/kotlin/che/incubator/devfile/DevfileConfigurable.kt +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2022 Red Hat, Inc. - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Red Hat, Inc. - initial API and implementation - */ -package che.incubator.devfile - -import com.intellij.openapi.options.Configurable -import com.intellij.openapi.ui.LabeledComponent -import com.intellij.openapi.ui.VerticalFlowLayout -import com.intellij.ui.components.JBTextField -import java.awt.BorderLayout -import java.awt.Dimension -import javax.swing.JComponent -import javax.swing.JPanel - -class DevfileConfigurable : Configurable { - - private val settingsPanel = JPanel() - - private val flattenedDevfileEnvVariableTextField = LabeledComponent.create( - JBTextField(), - "Flattened Devfile environment variable" - ) - - override fun createComponent(): JComponent { - settingsPanel.layout = VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 5, true, false) - settingsPanel.preferredSize = Dimension(500, 0) - - flattenedDevfileEnvVariableTextField.labelLocation = BorderLayout.WEST - settingsPanel.add(flattenedDevfileEnvVariableTextField) - - settingsPanel.updateUI() - - return settingsPanel - } - - override fun isModified(): Boolean { - val settings = DevfileComponentSettings.instance - - return flattenedDevfileEnvVariableTextField.component.text !== settings.flattenedDevfileEnvVariable - } - - override fun apply() { - val settings = DevfileComponentSettings.instance - - settings.flattenedDevfileEnvVariable = flattenedDevfileEnvVariableTextField.component.text - } - - override fun reset() { - val settings = DevfileComponentSettings.instance - - flattenedDevfileEnvVariableTextField.component.text = settings.flattenedDevfileEnvVariable - } - - override fun getDisplayName(): String { - return "Devfile" - } -} diff --git a/plugins/devfile-plugin/src/main/kotlin/che/incubator/devfile/DevfileRunConfigurationService.kt b/plugins/devfile-plugin/src/main/kotlin/che/incubator/devfile/DevfileRunConfigurationService.kt index 7930a9cf..029d7033 100644 --- a/plugins/devfile-plugin/src/main/kotlin/che/incubator/devfile/DevfileRunConfigurationService.kt +++ b/plugins/devfile-plugin/src/main/kotlin/che/incubator/devfile/DevfileRunConfigurationService.kt @@ -52,10 +52,12 @@ data class ExecCommand( ) class DevfileRunConfigurationService : StartupActivity { + companion object { + const val DEFAULT_FLATTENED_DEVFILE_ENV_VARIABLE = "DEVWORKSPACE_FLATTENED_DEVFILE" + } override fun runActivity(project: Project) { - val settings = DevfileComponentSettings.instance - val flattenedDevfileRawPath = System.getenv(settings.flattenedDevfileEnvVariable) ?: return + val flattenedDevfileRawPath = System.getenv(DEFAULT_FLATTENED_DEVFILE_ENV_VARIABLE) ?: return val flattenedDevfile = Paths.get(flattenedDevfileRawPath).toFile() if (!flattenedDevfile.exists()) return diff --git a/plugins/devfile-plugin/src/main/resources/META-INF/plugin.xml b/plugins/devfile-plugin/src/main/resources/META-INF/plugin.xml index c27b9ecf..27831ac8 100644 --- a/plugins/devfile-plugin/src/main/resources/META-INF/plugin.xml +++ b/plugins/devfile-plugin/src/main/resources/META-INF/plugin.xml @@ -16,10 +16,5 @@ - -