IDEA-97723 Gradle: 'Import Project From Gradle' wizard: nothing happens on pressing Browse buttons

This commit is contained in:
Denis.Zhdanov
2012-12-18 15:51:54 +04:00
parent e289bb0f72
commit de5765316f
3 changed files with 17 additions and 6 deletions
@@ -57,7 +57,7 @@ public abstract class AbstractGradleLinkedProjectAction extends AnAction {
}
final String path = GradleSettings.getInstance(project).getLinkedProjectPath();
return new Pair<Project, String>(project, path);
return path == null ? null : new Pair<Project, String>(project, path);
}
protected abstract void doUpdate(@NotNull AnActionEvent event, @NotNull Project project, @NotNull String linkedProjectPath);
@@ -22,6 +22,7 @@ import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.ui.TextComponentAccessor;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.text.StringUtil;
@@ -260,7 +261,10 @@ public class GradleConfigurable implements SearchableConfigurable, Configurable.
myLinkedGradleProjectPathField.addBrowseFolderListener(
"",
GradleBundle.message("gradle.settings.label.select.project"),
myProject, GradleUtil.getGradleProjectFileChooserDescriptor()
myProject,
GradleUtil.getGradleProjectFileChooserDescriptor(),
TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT,
false
);
myLinkedGradleProjectPathField.getTextField().getDocument().addDocumentListener(new DocumentListener() {
@Override
@@ -331,7 +335,9 @@ public class GradleConfigurable implements SearchableConfigurable, Configurable.
"",
GradleBundle.message("gradle.settings.text.home.path"),
null,
GradleUtil.getGradleHomeFileChooserDescriptor()
GradleUtil.getGradleHomeFileChooserDescriptor(),
TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT,
false
);
myGradleHomePathField.getTextField().getDocument().addDocumentListener(new DocumentListener() {
@Override
@@ -358,7 +364,9 @@ public class GradleConfigurable implements SearchableConfigurable, Configurable.
"",
GradleBundle.message("gradle.settings.title.service.dir.path"),
myProject,
new FileChooserDescriptor(false, true, false, false, false, false)
new FileChooserDescriptor(false, true, false, false, false, false),
TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT,
false
);
myServiceDirectoryPathField.getTextField().getDocument().addDocumentListener(new DocumentListener() {
@Override
@@ -153,6 +153,11 @@ public class GradleProjectImportBuilder extends ProjectImportBuilder<GradleProje
});
}
});
final String linkedProjectPath = myConfigurable.getLinkedProjectPath();
assert linkedProjectPath != null;
myConfigurable = null;
myGradleProject = null;
final Runnable resolveDependenciesTask = new Runnable() {
@Override
@@ -161,8 +166,6 @@ public class GradleProjectImportBuilder extends ProjectImportBuilder<GradleProje
new Task.Backgroundable(project, GradleBundle.message("gradle.library.resolve.progress.text"), false) {
@Override
public void run(@NotNull final ProgressIndicator indicator) {
String linkedProjectPath = myConfigurable.getLinkedProjectPath();
assert linkedProjectPath != null;
GradleResolveProjectTask task = new GradleResolveProjectTask(project, linkedProjectPath, true);
task.execute(indicator);
GradleProject projectWithResolvedLibraries = task.getGradleProject();