IDEA-135612 Git clone dialog: create parent dir automatically

Warn only if it can't be created or is not writeable
This commit is contained in:
Kirill Likhodedov
2016-07-02 18:35:39 +03:00
parent f0bb0c69d6
commit 3a4eee91e6
@@ -94,6 +94,17 @@ public abstract class CloneDvcsDialog extends DialogWrapper {
setOKButtonText(DvcsBundle.getString("clone.button"));
}
@Override
protected void doOKAction() {
File parent = new File(getParentDirectory());
if (parent.exists() && parent.isDirectory() && parent.canWrite() || parent.mkdirs()) {
super.doOKAction();
return;
}
setErrorText("Couldn't create " + parent + "<br/>Check your access rights");
setOKActionEnabled(false);
}
@NotNull
public String getSourceRepositoryURL() {
return getCurrentUrlText();
@@ -215,11 +226,6 @@ public abstract class CloneDvcsDialog extends DialogWrapper {
setOKActionEnabled(false);
return false;
}
else if (!file.getParentFile().exists()) {
setErrorText(DvcsBundle.message("clone.parent.missing.error", file.getParent()));
setOKActionEnabled(false);
return false;
}
return true;
}