summaryrefslogtreecommitdiff
path: root/java/execution/impl/src/com/intellij/execution/application/JvmMainMethodRunConfigurationOptions.kt
blob: ba3c45c2ec19155f890601cf70f144db9be881a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2000-2020 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.application

import com.intellij.configurationStore.Property
import com.intellij.execution.InputRedirectAware
import com.intellij.execution.JvmConfigurationOptions
import com.intellij.execution.ShortenCommandLine
import com.intellij.util.xmlb.annotations.OptionTag
import com.intellij.util.xmlb.annotations.XMap

open class JvmMainMethodRunConfigurationOptions : JvmConfigurationOptions() {
  @get:OptionTag("PROGRAM_PARAMETERS")
  open var programParameters by string()

  @get:OptionTag("WORKING_DIRECTORY")
  open var workingDirectory by string()

  @get:OptionTag("INCLUDE_PROVIDED_SCOPE")
  var isIncludeProvidedScope by property(false)

  @get:OptionTag("PASS_PARENT_ENVS")
  var isPassParentEnv by property(true)

  @Property(description = "Environment variables")
  @get:XMap(propertyElementName = "envs", entryTagName = "env", keyAttributeName = "name")
  var env by linkedMap<String, String>()

  // see ConfigurationWithCommandLineShortener - "null if option was not selected explicitly, legacy user-local options to be used"
  // so, we cannot use NONE as default value
  @get:OptionTag(nameAttribute = "", valueAttribute = "name")
  var shortenClasspath by enum<ShortenCommandLine>()

  @get:OptionTag(InputRedirectAware.InputRedirectOptionsImpl.REDIRECT_INPUT)
  var isRedirectInput by property(false)
  @get:OptionTag(InputRedirectAware.InputRedirectOptionsImpl.INPUT_FILE)
  var redirectInputPath by string()

  @Transient
  val redirectOptions = object : InputRedirectAware.InputRedirectOptions {
    override fun isRedirectInput() = this@JvmMainMethodRunConfigurationOptions.isRedirectInput

    override fun setRedirectInput(value: Boolean) {
      this@JvmMainMethodRunConfigurationOptions.isRedirectInput = value
    }

    override fun getRedirectInputPath() = this@JvmMainMethodRunConfigurationOptions.redirectInputPath

    override fun setRedirectInputPath(value: String?) {
      this@JvmMainMethodRunConfigurationOptions.redirectInputPath = value
    }
  }
}