|
| 1 | +package consulo.java.compiler.impl.javaCompiler.ui; |
| 2 | + |
| 3 | +import com.intellij.compiler.impl.javaCompiler.javac.JavacCompilerConfiguration; |
| 4 | +import com.intellij.compiler.impl.javaCompiler.javac.JpsJavaCompilerOptions; |
| 5 | +import com.intellij.openapi.options.Configurable; |
| 6 | +import com.intellij.util.execution.ParametersListUtil; |
| 7 | +import consulo.disposer.Disposable; |
| 8 | +import consulo.localize.LocalizeValue; |
| 9 | +import consulo.options.SimpleConfigurableByProperties; |
| 10 | +import consulo.ui.CheckBox; |
| 11 | +import consulo.ui.Component; |
| 12 | +import consulo.ui.IntBox; |
| 13 | +import consulo.ui.TextBoxWithExpandAction; |
| 14 | +import consulo.ui.annotation.RequiredUIAccess; |
| 15 | +import consulo.ui.layout.VerticalLayout; |
| 16 | +import consulo.ui.util.LabeledBuilder; |
| 17 | +import jakarta.inject.Provider; |
| 18 | + |
| 19 | +import javax.annotation.Nonnull; |
| 20 | + |
| 21 | +/** |
| 22 | + * @author VISTALL |
| 23 | + * @since 01/12/2021 |
| 24 | + */ |
| 25 | +public class JavacConfigurable extends SimpleConfigurableByProperties implements Configurable |
| 26 | +{ |
| 27 | + private final Provider<JavacCompilerConfiguration> myJavacCompilerConfigurationProvider; |
| 28 | + |
| 29 | + public JavacConfigurable(Provider<JavacCompilerConfiguration> javacCompilerConfigurationProvider) |
| 30 | + { |
| 31 | + myJavacCompilerConfigurationProvider = javacCompilerConfigurationProvider; |
| 32 | + } |
| 33 | + |
| 34 | + @RequiredUIAccess |
| 35 | + @Nonnull |
| 36 | + @Override |
| 37 | + protected Component createLayout(@Nonnull PropertyBuilder propertyBuilder, @Nonnull Disposable disposable) |
| 38 | + { |
| 39 | + JavacCompilerConfiguration configuration = myJavacCompilerConfigurationProvider.get(); |
| 40 | + |
| 41 | + JpsJavaCompilerOptions state = configuration.getState(); |
| 42 | + |
| 43 | + VerticalLayout verticalLayout = VerticalLayout.create(); |
| 44 | + |
| 45 | + CheckBox generateDebugInfo = CheckBox.create(LocalizeValue.localizeTODO("Generate debugging info")); |
| 46 | + verticalLayout.add(generateDebugInfo); |
| 47 | + propertyBuilder.add(generateDebugInfo, () -> state.DEBUGGING_INFO, (v) -> state.DEBUGGING_INFO = v); |
| 48 | + |
| 49 | + CheckBox reportDeprecated = CheckBox.create(LocalizeValue.localizeTODO("Report use of deprecated features")); |
| 50 | + verticalLayout.add(reportDeprecated); |
| 51 | + propertyBuilder.add(reportDeprecated, () -> state.DEPRECATION, (v) -> state.DEPRECATION = v); |
| 52 | + |
| 53 | + CheckBox generateNoWarning = CheckBox.create(LocalizeValue.localizeTODO("Generate no warnings")); |
| 54 | + verticalLayout.add(generateNoWarning); |
| 55 | + propertyBuilder.add(generateNoWarning, () -> state.GENERATE_NO_WARNINGS, (v) -> state.GENERATE_NO_WARNINGS = v); |
| 56 | + |
| 57 | + TextBoxWithExpandAction additionalArguments = TextBoxWithExpandAction.create(null, "Edit Arguments", ParametersListUtil.DEFAULT_LINE_PARSER, ParametersListUtil.DEFAULT_LINE_JOINER); |
| 58 | + propertyBuilder.add(additionalArguments, () -> state.ADDITIONAL_OPTIONS_STRING, (v) -> state.ADDITIONAL_OPTIONS_STRING = v); |
| 59 | + |
| 60 | + verticalLayout.add(LabeledBuilder.filled(LocalizeValue.localizeTODO("Additional command line parameters:"), additionalArguments)); |
| 61 | + |
| 62 | + IntBox memoryTextBox = IntBox.create(); |
| 63 | + verticalLayout.add(LabeledBuilder.sided(LocalizeValue.localizeTODO("Maximum heap size (MB):"), memoryTextBox)); |
| 64 | + propertyBuilder.add(memoryTextBox, () -> state.MAXIMUM_HEAP_SIZE, (v) -> state.MAXIMUM_HEAP_SIZE = v); |
| 65 | + return verticalLayout; |
| 66 | + } |
| 67 | +} |
0 commit comments