Skip to content

Commit

Permalink
new project dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
buggins committed Dec 7, 2015
1 parent 3cf0e9d commit d6c7aa0
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/dlangide/ui/newproject.d
Expand Up @@ -93,28 +93,23 @@ class NewProjectDlg : Dialog {
TextWidget { text: "" }
CheckBox { id: cbCreateWorkspace; text: "Create new solution"; checked: true }
TextWidget { text: "Workspace name" }
EditLine {
id: edWorkspaceName; text: "newworkspace"
}
EditLine { id: edWorkspaceName; text: "newworkspace"; layoutWidth: fill }
TextWidget { text: "Project name" }
EditLine {
id: edProjectName; text: "newproject"
}
EditLine { id: edProjectName; text: "newproject"; layoutWidth: fill }
TextWidget { text: "" }
CheckBox { id: cbCreateSubdir; text: "Create subdirectory for project"; checked: true }
TextWidget { text: "Location" }
DirEditLine {
id: edLocation
}
DirEditLine { id: edLocation; layoutWidth: fill }
}
TextWidget { id: statusText; text: "" }
TextWidget { id: statusText; text: ""; layoutWidth: fill }
}
});
} catch (Exception e) {
Log.e("Exceptin while parsing DML", e);
throw e;
}


_projectTemplateList = content.childById!StringListWidget("projectTemplateList");
_templateDescription = content.childById!EditBox("templateDescription");
_directoryLayout = content.childById!EditBox("directoryLayout");
Expand All @@ -129,6 +124,9 @@ class NewProjectDlg : Dialog {
if (_currentWorkspace) {
_workspaceName = toUTF8(_currentWorkspace.name);
_edWorkspaceName.text = toUTF32(_workspaceName);
} else {
_cbCreateWorkspace.checked = true;
_cbCreateWorkspace.enabled = false;
}
if (!_newWorkspace) {
_cbCreateWorkspace.checked = false;
Expand Down Expand Up @@ -180,7 +178,6 @@ class NewProjectDlg : Dialog {

addChild(content);
addChild(createButtonsPanel([_newWorkspace ? ACTION_FILE_NEW_WORKSPACE : ACTION_FILE_NEW_PROJECT, ACTION_CANCEL], 0, 0));

}

bool _newWorkspace;
Expand Down Expand Up @@ -257,7 +254,7 @@ class NewProjectDlg : Dialog {

override void close(const Action action) {
Action newaction = action.clone();
if (action == ACTION_FILE_NEW_WORKSPACE || action == ACTION_FILE_NEW_PROJECT) {
if (action.id == IDEActions.FileNewWorkspace || action.id == IDEActions.FileNewProject) {
if (!validate()) {
window.showMessageBox(UIString("Cannot create project"d), UIString("Invalid parameters"));
return;
Expand Down Expand Up @@ -306,6 +303,8 @@ class NewProjectDlg : Dialog {
string pfile = buildNormalizedPath(pdir, "dub.json");
Project project = new Project(ws, pfile);
project.name = toUTF32(_projectName);
if (!project.save())
return setError("Cannot save project");
project.content.setString("targetName", _projectName);
if (_currentTemplate.isLibrary) {
project.content.setString("targetType", "staticLibrary");
Expand Down

0 comments on commit d6c7aa0

Please sign in to comment.