Skip to content

Commit 261ec80

Browse files
Merge pull request #777 from Iamwade/automatically-detect-version-and-platform-type
Automatically detect version and platform
2 parents 2bf50ba + f9173c0 commit 261ec80

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

src/com/magento/idea/magento2plugin/project/SettingsForm.java

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public class SettingsForm implements PhpFrameworkConfigurable {
5252
private JCheckBox mftfSupportEnabled;
5353
private TextFieldWithBrowseButton magentoPath;
5454
private final SettingsFormValidator validator = new SettingsFormValidator(this);
55-
private String magentoEdition;
5655
private JLabel magentoVersionLabel;//NOPMD
5756
private JLabel magentoPathLabel;//NOPMD
5857

@@ -99,12 +98,7 @@ public void mouseClicked(final MouseEvent event) {
9998

10099
addPathListener();
101100
addMagentoVersionListener();
102-
103-
final String storedMagentoEdition = getSettings().magentoEdition;
104-
105-
magentoVersionLabel.setText(
106-
storedMagentoEdition == null ? DEFAULT_MAGENTO_EDITION_LABEL : storedMagentoEdition
107-
);
101+
updateMagentoVersion();
108102

109103
return (JComponent) panel;
110104
}
@@ -141,11 +135,9 @@ public boolean isModified() {
141135
}
142136

143137
private void resolveMagentoVersion() {
144-
if (getSettings().magentoVersion == null) {
138+
if (getSettings().magentoVersion == null || getSettings().magentoEdition == null) {
145139
this.updateMagentoVersion();
146-
return;
147140
}
148-
magentoVersion.setText(getSettings().magentoVersion);
149141
}
150142

151143
private boolean isMagentoPathChanged() {
@@ -169,8 +161,6 @@ private void saveSettings() {
169161
getSettings().defaultLicense = moduleDefaultLicenseName.getText();
170162
getSettings().mftfSupportEnabled = mftfSupportEnabled.isSelected();
171163
getSettings().magentoPath = getMagentoPath();
172-
getSettings().magentoVersion = getMagentoVersion();
173-
getSettings().magentoEdition = getMagentoEdition();
174164
buttonReindex.setEnabled(getSettings().pluginEnabled);
175165
regenerateUrnMapButton.setEnabled(getSettings().pluginEnabled);
176166
}
@@ -180,10 +170,6 @@ public String getMagentoVersion() {
180170
return magentoVersion.getText().trim();
181171
}
182172

183-
public @NotNull String getMagentoEdition() {
184-
return magentoEdition == null ? DEFAULT_MAGENTO_EDITION_LABEL : magentoEdition;
185-
}
186-
187173
@NotNull
188174
public String getMagentoPath() {
189175
return magentoPath.getTextField().getText().trim();
@@ -260,8 +246,8 @@ public void updateMagentoVersion() {
260246
magentoVersion.setText(resolvedVersion);
261247
magentoVersionLabel.setText(resolvedEdition);
262248

263-
magentoEdition = resolvedEdition;
264-
getSettings().magentoEdition = getMagentoEdition();
249+
getSettings().magentoVersion = resolvedVersion;
250+
getSettings().magentoEdition = resolvedEdition;
265251
}
266252

267253
@Override

0 commit comments

Comments
 (0)