IDEA-115660 Fix Spock library in Create test dialog does not work

This commit is contained in:
Sergey Evdokimov
2013-10-30 14:49:45 +04:00
parent d0c058448f
commit fe6fda395d
4 changed files with 12 additions and 12 deletions
@@ -232,9 +232,16 @@ public class CreateTestDialog extends DialogWrapper {
}
private void onLibrarySelected(TestFramework descriptor) {
String text = CodeInsightBundle.message("intention.create.test.dialog.library.not.found", descriptor.getName());
myFixLibraryLabel.setText(text);
myFixLibraryPanel.setVisible(!descriptor.isLibraryAttached(myTargetModule));
if (descriptor.isLibraryAttached(myTargetModule)) {
myFixLibraryPanel.setVisible(false);
}
else {
myFixLibraryPanel.setVisible(true);
String text = CodeInsightBundle.message("intention.create.test.dialog.library.not.found", descriptor.getName());
myFixLibraryLabel.setText(text);
myFixLibraryButton.setVisible(descriptor.getLibraryPath() != null);
}
String superClass = descriptor.getDefaultSuperClass();
@@ -38,7 +38,7 @@ public interface TestFramework {
boolean isLibraryAttached(@NotNull Module module);
@NotNull
@Nullable
String getLibraryPath();
@Nullable
@@ -37,15 +37,9 @@ public class SpockTestFramework extends GroovyTestFramework {
return "Spock";
}
@NotNull
@Override
public String getLibraryPath() {
try {
return PathUtil.getJarPathForClass(Class.forName(getMarkerClassFQName()));
}
catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
return null;
}
@Nullable
@@ -122,7 +122,6 @@ public class GroovyTestFramework extends JavaTestFramework {
return JetgroovyIcons.Groovy.Groovy_16x16;
}
@NotNull
@Override
public String getLibraryPath() {
return GroovyUtils.getBundledGroovyJar().getAbsolutePath();