Skip to content

Commit

Permalink
Merge pull request #11 from sdiemert/feature/testGeneration
Browse files Browse the repository at this point in the history
fixed minor formatting for comments in the functional class generatio…
  • Loading branch information
sdiemert committed Feb 18, 2016
2 parents 7d75a03 + c360217 commit 7624674
Showing 1 changed file with 35 additions and 37 deletions.
72 changes: 35 additions & 37 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,38 @@ define(function (require, exports, module) {
var FileSystem = app.getModule("filesystem/FileSystem");
var Dialogs = app.getModule("dialogs/Dialogs");

var JSGen = require("JSCodeGenerator");
var JSGen = require("JSCodeGenerator");
var JavaScriptConfigure = require("JavaScriptConfigure");

function selectFolder(result, base, path, opts) {

// If path is not assigned, popup Open Dialog to select a folder
if (!path) {

FileSystem.showOpenDialog(false, true, "Select a folder where generated codes to be located", null, null,
function (err, files) {
if (!err) {
if (files.length > 0) {
path = files[0];
JSGen.generate(base, path, opts).then(result.resolve, result.reject);
} else {
result.reject(FileSystem.USER_CANCELED);
}
} else {
result.reject(err);
}
}
);

} else {

JSGen.generate(base, path, opts).then(result.resolve, result.reject);

}

}


function handleGenerate(base, path, opts) {

var result = new $.Deferred();
Expand All @@ -29,49 +58,18 @@ define(function (require, exports, module) {
if (buttonId === Dialogs.DIALOG_BTN_OK && selected) {
base = selected;

selectFolder(result, base, path, opts);

// If path is not assigned, popup Open Dialog to select a folder
if (!path) {

FileSystem.showOpenDialog(false, true, "Select a folder where generated codes to be located", null, null, function (err, files) {
if (!err) {
if (files.length > 0) {
path = files[0];
console.log("path: " + path);
JSGen.generate(base, path, opts).then(result.resolve, result.reject);
} else {
result.reject(FileSystem.USER_CANCELED);
}
} else {
result.reject(err);
}
});
} else {
JSGen.generate(base, path, opts).then(result.resolve, result.reject);
}
} else {
result.reject();
}
});
} else {
// If path is not assigned, popup Open Dialog to select a folder
if (!path) {
FileSystem.showOpenDialog(false, true, "Select a folder where generated codes to be located", null, null, function (err, files) {
if (!err) {
if (files.length > 0) {
path = files[0];
JSGen.generate(base, path, opts).then(result.resolve, result.reject);
} else {
result.reject(FileSystem.USER_CANCELED);
}
} else {
result.reject(err);
}
});
} else {
JSGen.generate(base, path, opts).then(result.resolve, result.reject);
}

selectFolder(result, base, path, opts);

}

return result.promise();

}
Expand Down

0 comments on commit 7624674

Please sign in to comment.