From 9fbcf982945eade870439deb00d1bf223a25eb14 Mon Sep 17 00:00:00 2001 From: Serhii Akulov Date: Wed, 17 Nov 2021 15:45:43 +0200 Subject: [PATCH] Automatically detect version and platform --- .../magento2plugin/project/SettingsForm.java | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/src/com/magento/idea/magento2plugin/project/SettingsForm.java b/src/com/magento/idea/magento2plugin/project/SettingsForm.java index 7d7eca560..6bd5386c3 100644 --- a/src/com/magento/idea/magento2plugin/project/SettingsForm.java +++ b/src/com/magento/idea/magento2plugin/project/SettingsForm.java @@ -52,7 +52,6 @@ public class SettingsForm implements PhpFrameworkConfigurable { private JCheckBox mftfSupportEnabled; private TextFieldWithBrowseButton magentoPath; private final SettingsFormValidator validator = new SettingsFormValidator(this); - private String magentoEdition; private JLabel magentoVersionLabel;//NOPMD private JLabel magentoPathLabel;//NOPMD @@ -99,12 +98,7 @@ public void mouseClicked(final MouseEvent event) { addPathListener(); addMagentoVersionListener(); - - final String storedMagentoEdition = getSettings().magentoEdition; - - magentoVersionLabel.setText( - storedMagentoEdition == null ? DEFAULT_MAGENTO_EDITION_LABEL : storedMagentoEdition - ); + updateMagentoVersion(); return (JComponent) panel; } @@ -141,11 +135,9 @@ public boolean isModified() { } private void resolveMagentoVersion() { - if (getSettings().magentoVersion == null) { + if (getSettings().magentoVersion == null || getSettings().magentoEdition == null) { this.updateMagentoVersion(); - return; } - magentoVersion.setText(getSettings().magentoVersion); } private boolean isMagentoPathChanged() { @@ -169,8 +161,6 @@ private void saveSettings() { getSettings().defaultLicense = moduleDefaultLicenseName.getText(); getSettings().mftfSupportEnabled = mftfSupportEnabled.isSelected(); getSettings().magentoPath = getMagentoPath(); - getSettings().magentoVersion = getMagentoVersion(); - getSettings().magentoEdition = getMagentoEdition(); buttonReindex.setEnabled(getSettings().pluginEnabled); regenerateUrnMapButton.setEnabled(getSettings().pluginEnabled); } @@ -180,10 +170,6 @@ public String getMagentoVersion() { return magentoVersion.getText().trim(); } - public @NotNull String getMagentoEdition() { - return magentoEdition == null ? DEFAULT_MAGENTO_EDITION_LABEL : magentoEdition; - } - @NotNull public String getMagentoPath() { return magentoPath.getTextField().getText().trim(); @@ -260,8 +246,8 @@ public void updateMagentoVersion() { magentoVersion.setText(resolvedVersion); magentoVersionLabel.setText(resolvedEdition); - magentoEdition = resolvedEdition; - getSettings().magentoEdition = getMagentoEdition(); + getSettings().magentoVersion = resolvedVersion; + getSettings().magentoEdition = resolvedEdition; } @Override