testng/junit: <no module> choice when all in project selected (IDEA-88524)

This commit is contained in:
Anna Kozlova
2014-04-09 19:27:15 +02:00
parent 6ab05a269b
commit 258af30a8d
2 changed files with 11 additions and 10 deletions
@@ -436,7 +436,7 @@ public class JUnitConfigurable extends SettingsEditor<JUnitConfiguration> implem
getTestLocation(i).setEnabled(enabledFields.contains(i));
/*if (newType == JUnitConfigurationModel.PATTERN) {
myModule.setEnabled(false);
} else */if (newType != JUnitConfigurationModel.ALL_IN_PACKAGE) {
} else */if (newType != JUnitConfigurationModel.ALL_IN_PACKAGE && newType != JUnitConfigurationModel.PATTERN) {
myModule.setEnabled(true);
}
else {
@@ -486,7 +486,8 @@ public class JUnitConfigurable extends SettingsEditor<JUnitConfiguration> implem
}
private void onScopeChanged() {
final boolean allInPackageAllInProject = ((Integer)myTypeChooser.getSelectedItem()) == JUnitConfigurationModel.ALL_IN_PACKAGE && myWholeProjectScope.isSelected();
final Integer selectedItem = (Integer)myTypeChooser.getSelectedItem();
final boolean allInPackageAllInProject = (selectedItem == JUnitConfigurationModel.ALL_IN_PACKAGE || selectedItem == JUnitConfigurationModel.PATTERN) && myWholeProjectScope.isSelected();
myModule.setEnabled(!allInPackageAllInProject);
if (allInPackageAllInProject) {
myModule.getComponent().setSelectedItem(null);
@@ -179,7 +179,6 @@ public class TestNGConfigurationEditor extends SettingsEditor<TestNGConfiguratio
else if (buttonModel == patternTest.getModel()) {
model.setType(TestType.PATTERN);
}
redisplay();
}
}
});
@@ -224,7 +223,11 @@ public class TestNGConfigurationEditor extends SettingsEditor<TestNGConfiguratio
}
private void evaluateModuleClassPath() {
moduleClasspath.setEnabled(!packagesInProject.isSelected());
final boolean allPackagesInProject = packagesInProject.isSelected() && packagePanel.isVisible();
moduleClasspath.setEnabled(!allPackagesInProject);
if (allPackagesInProject) {
moduleClasspath.getComponent().setSelectedItem(null);
}
}
private void redisplay() {
@@ -304,6 +307,7 @@ public class TestNGConfigurationEditor extends SettingsEditor<TestNGConfiguratio
else {
packagesInProject.setSelected(true);
}
evaluateModuleClassPath();
alternateJDK.init(config.ALTERNATIVE_JRE_PATH, config.ALTERNATIVE_JRE_PATH_ENABLED);
propertiesList.clear();
propertiesList.addAll(data.TEST_PROPERTIES.entrySet());
@@ -509,12 +513,6 @@ public class TestNGConfigurationEditor extends SettingsEditor<TestNGConfiguratio
public void onTypeChanged(TestType type) {
//LOGGER.info("onTypeChanged with " + type);
if (type != TestType.PACKAGE && type != TestType.SUITE) {
moduleClasspath.setEnabled(true);
}
else {
evaluateModuleClassPath();
}
if (type == TestType.PACKAGE) {
packageTest.setSelected(true);
packageField.setEnabled(true);
@@ -569,6 +567,8 @@ public class TestNGConfigurationEditor extends SettingsEditor<TestNGConfiguratio
methodField.setEnabled(false);
groupField.setEnabled(false);
}
redisplay();
evaluateModuleClassPath();
}
private class AddActionButtonRunnable implements AnActionButtonRunnable {