IDEA-210281 Cleanup Gradle settings: Module per source set setting is deprecated

GitOrigin-RevId: 821c9da03b55b776bb8a3b507ec95f917b98034f
This commit is contained in:
Anton Makeev
2019-05-17 19:13:46 +03:00
committed by intellij-monorepo-bot
parent c105e26db3
commit 939209cf81
3 changed files with 22 additions and 11 deletions
@@ -120,6 +120,9 @@
<statistics.counterUsagesCollector groupId="build.gradle.actions" version="1"/>
<externalSystem.runConfigurationImporter
implementation="org.jetbrains.plugins.gradle.service.execution.GradleRunConfigurationImporter"/>
<registryKey key="gradle.settings.showModulePerSourceSetSetting" defaultValue="false"
description="Enables 'Generate module per source set' setting for troubleshooting"/>
</extensions>
<actions>
@@ -115,6 +115,7 @@ public class IdeaGradleProjectSettingsControlBuilder implements GradleProjectSet
@Nullable
private JBCheckBox myResolveModulePerSourceSetCheckBox;
private JBLabel myResolveModulePerSourceSetHintLabel;
private boolean dropResolveModulePerSourceSetCheckBox;
@Nullable
@@ -301,18 +302,21 @@ public class IdeaGradleProjectSettingsControlBuilder implements GradleProjectSet
myImportPanel = addComponentsGroup(null, content, indentLevel, panel -> {
if (!dropResolveModulePerSourceSetCheckBox) {
panel.add(
myResolveModulePerSourceSetCheckBox = new JBCheckBox("Generate separate " + getIDEName() + " module per Gradle source set"),
myResolveModulePerSourceSetCheckBox = new JBCheckBox("Generate " + getIDEName() + " module per Gradle source set"),
ExternalSystemUiUtil.getFillLineConstraints(indentLevel));
JBLabel label = new JBLabel(
XmlStringUtil.wrapInHtml("Disable to ???"),
myResolveModulePerSourceSetHintLabel = new JBLabel(
XmlStringUtil.wrapInHtml("This setting is deprecated and remains only for troubleshooting since it's not fully compatible with the Gradle's model.<br>" +
"Please consider restoring it to the default (checked)"),
UIUtil.ComponentStyle.SMALL);
label.setForeground(UIUtil.getLabelFontColor(UIUtil.FontColor.BRIGHTER));
myResolveModulePerSourceSetHintLabel.setIcon(AllIcons.General.BalloonWarning12);
myResolveModulePerSourceSetHintLabel.setVerticalTextPosition(SwingConstants.TOP);
myResolveModulePerSourceSetHintLabel.setForeground(UIUtil.getLabelFontColor(UIUtil.FontColor.BRIGHTER));
GridBag constraints = ExternalSystemUiUtil.getFillLineConstraints(indentLevel);
constraints.insets.top = 0;
constraints.insets.left += UIUtil.getCheckBoxTextHorizontalOffset(myResolveModulePerSourceSetCheckBox);
panel.add(label, constraints);
panel.add(myResolveModulePerSourceSetHintLabel, constraints);
}
if (!dropResolveExternalAnnotationsCheckBox) {
@@ -631,12 +635,7 @@ public class IdeaGradleProjectSettingsControlBuilder implements GradleProjectSet
myGradleHomePathField.setText(gradleHome == null ? "" : gradleHome);
myGradleHomePathField.getTextField().setForeground(LocationSettingType.EXPLICIT_CORRECT.getColor());
}
if (myResolveModulePerSourceSetCheckBox != null) {
myResolveModulePerSourceSetCheckBox.setSelected(settings.isResolveModulePerSourceSet());
}
if (myResolveExternalAnnotationsCheckBox != null) {
myResolveExternalAnnotationsCheckBox.setSelected(settings.isResolveExternalAnnotations());
}
resetImportControls(settings);
resetGradleJdkComboBox(project, settings, wizardContext);
resetWrapperControls(settings.getExternalProjectPath(), settings, isDefaultModuleCreation);
@@ -661,8 +660,16 @@ public class IdeaGradleProjectSettingsControlBuilder implements GradleProjectSet
@Override
public void update(String linkedProjectPath, GradleProjectSettings settings, boolean isDefaultModuleCreation) {
resetWrapperControls(linkedProjectPath, settings, isDefaultModuleCreation);
resetImportControls(settings);
}
private void resetImportControls(GradleProjectSettings settings) {
if (myResolveModulePerSourceSetCheckBox != null) {
myResolveModulePerSourceSetCheckBox.setSelected(settings.isResolveModulePerSourceSet());
boolean showSetting = !settings.isResolveModulePerSourceSet()
|| Registry.is("gradle.settings.showModulePerSourceSetSetting", false);
myResolveModulePerSourceSetCheckBox.setVisible(showSetting);
myResolveModulePerSourceSetHintLabel.setVisible(showSetting);
}
if (myResolveExternalAnnotationsCheckBox != null) {
myResolveExternalAnnotationsCheckBox.setSelected(settings.isResolveExternalAnnotations());
@@ -248,6 +248,7 @@ public class IdeaGradleSystemSettingsControlBuilder implements GradleSystemSetti
fixLabel.setFontSize(UIUtil.FontSize.SMALL);
fixLabel.setForeground(UIUtil.getLabelFontColor(UIUtil.FontColor.BRIGHTER));
fixLabel.setIcon(AllIcons.General.BalloonWarning12);
label.setVerticalTextPosition(SwingConstants.TOP);
GridBag constraints = ExternalSystemUiUtil.getFillLineConstraints(indentLevel);
constraints.insets.top = 0;
canvas.add(fixLabel, constraints);