Permalink
Browse files

dialog update and add jison files

  • Loading branch information...
1 parent aa90d26 commit 7f7b83db12e6188a7334da650005c3eaa2fe1d84 @niklauslee niklauslee committed Jun 9, 2014
Showing with 32,491 additions and 1 deletion.
  1. +11 −0 .gitignore
  2. +79 −0 CodeGenUtils.js
  3. +108 −0 ConfigDialog.js
  4. +479 −0 JavaCodeGenerator.js
  5. +39 −0 JavaReverseEngineer.js
  6. +3 −0 build.sh
  7. +17 −0 htmlContent/config-dialog.html
  8. +1,179 −0 java7.jison
  9. +323 −0 java7.jisonlex
  10. +927 −0 java7.js
  11. +29,167 −0 jisonOutput.txt
  12. +119 −1 main.js
  13. +1 −0 samples/TestModel.umlj
  14. +39 −0 styles/style.less
View
@@ -0,0 +1,11 @@
+Thumbs.db
+
+# ignore node_modules created by grunt, but not more deeply-nested node_modules
+/node_modules
+/npm-debug.log
+
+#OSX .DS_Store files
+.DS_Store
+
+#Java Test Sources
+/java-testset
View
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2014 MKLab. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+define(function (require, exports, module) {
+ "use strict";
+
+ /**
+ * CodeWriter
+ * @constructor
+ */
+ function CodeWriter(indentString) {
+
+ /** @member {Array.<string>} lines */
+ this.lines = [];
+
+ /** @member {string} indentString */
+ this.indentString = (indentString ? indentString : " "); // default 4 spaces
+
+ /** @member {Array.<string>} indentations */
+ this.indentations = [];
+ }
+
+ /**
+ * Indent
+ */
+ CodeWriter.prototype.indent = function () {
+ this.indentations.push(this.indentString);
+ };
+
+ /**
+ * Outdent
+ */
+ CodeWriter.prototype.outdent = function () {
+ this.indentations.splice(this.indentations.length-1, 1);
+ };
+
+ /**
+ * Write a line
+ * @param {string} line
+ */
+ CodeWriter.prototype.writeLine = function (line) {
+ if (line) {
+ this.lines.push(this.indentations.join("") + line);
+ } else {
+ this.lines.push("");
+ }
+ };
+
+ /**
+ * Return as all string data
+ * @return {string}
+ */
+ CodeWriter.prototype.getData = function () {
+ return this.lines.join("\n");
+ };
+
+ exports.CodeWriter = CodeWriter;
+
+});
View
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2014 MKLab. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+define(function (require, exports, module) {
+ "use strict";
+
+ var Repository = staruml.getModule("engine/Repository"),
+ Engine = staruml.getModule("engine/Engine"),
+ Commands = staruml.getModule("menu/Commands"),
+ MenuManager = staruml.getModule("menu/MenuManager"),
+ Strings = staruml.getModule("strings"),
+ Dialogs = staruml.getModule("widgets/Dialogs"),
+ ElementPicker = staruml.getModule("dialogs/ElementPicker"),
+ FileSystem = staruml.getModule("utils/FileSystem"),
+ ExtensionUtils = staruml.getModule("utils/ExtensionUtils"),
+ UML = staruml.getModule("uml/UML");
+
+ // Load Stylesheet
+ ExtensionUtils.loadStyleSheet(module, "styles/style.less");
+
+ /**
+ * Configuration Dialog Template
+ */
+ var JavaCodeGenerator = require("JavaCodeGenerator"),
+ configDialogTemplate = require("text!htmlContent/config-dialog.html");
+
+ /**
+ * Update Configuration Dialog
+ */
+ function updateDialog($dlg) {
+ var baseModel = JavaCodeGenerator.getBaseModel(),
+ targetDir = JavaCodeGenerator.getTargetDirectory(),
+ $baseModel = $dlg.data("base-model"),
+ $targetDirectory = $dlg.data("target-directory");
+ if (baseModel) {
+ var baseModelTemplate = "<span class='k-sprite {{getNodeIcon}}'></span>{{getPathname}}";
+ $baseModel.html(Mustache.render(baseModelTemplate, baseModel));
+ } else {
+ $baseModel.html("(UNSPECIFIED)");
+ }
+ if (targetDir) {
+ $targetDirectory.val(targetDir);
+ }
+ }
+
+ /**
+ * Show Configuration Dialog
+ */
+ function showDialog() {
+ var context = { Strings: Strings };
+ var dialog = Dialogs.showModalDialogUsingTemplate(Mustache.render(configDialogTemplate, context), true, function ($dlg) {
+
+ });
+ var $dlg = dialog.getElement(),
+ $findElement = $dlg.find(".find-element"),
+ $findDirectory = $dlg.find(".find-directory"),
+ $baseModel = $dlg.find(".base-model"),
+ $targetDirectory = $dlg.find(".target-directory");
+
+ $dlg.data("base-model", $baseModel);
+ $dlg.data("target-directory", $targetDirectory);
+
+ // Find Base Model Button
+ $findElement.click(function () {
+ ElementPicker.showModal("Select Base Model", type.UMLPackage).done(function (buttonId, selected) {
+ if (buttonId === Dialogs.DIALOG_BTN_OK) {
+ JavaCodeGenerator.setBaseModel(selected);
+ updateDialog($dlg);
+ }
+ });
+ });
+ // Find Target Directory Button
+ $findDirectory.click(function () {
+ FileSystem.showOpenDialog(false, true, "Select Target Directory", null, null, function (err, files) {
+ if (err === FileSystem.NO_ERROR) {
+ if (files && files.length > 0) {
+ JavaCodeGenerator.setTargetDirectory(files[0]);
+ }
+ }
+ updateDialog($dlg);
+ });
+ });
+ updateDialog($dlg);
+ }
+
+ exports.showDialog = showDialog;
+
+});
Oops, something went wrong.

0 comments on commit 7f7b83d

Please sign in to comment.