diff --git a/ConversationCompiler/build.xml b/ConversationCompiler/build.xml
deleted file mode 100644
index ea549b7..0000000
--- a/ConversationCompiler/build.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
- Builds, tests, and runs the project com.projectswg.tools.csc.compiler.
-
-
diff --git a/ConversationCompiler/manifest.mf b/ConversationCompiler/manifest.mf
deleted file mode 100644
index c928f8f..0000000
--- a/ConversationCompiler/manifest.mf
+++ /dev/null
@@ -1,5 +0,0 @@
-Manifest-Version: 1.0
-OpenIDE-Module: com.projectswg.tools.csc.compiler
-OpenIDE-Module-Localizing-Bundle: com/projectswg/tools/csc/compiler/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.0
-
diff --git a/ConversationCompiler/nbproject/build-impl.xml b/ConversationCompiler/nbproject/build-impl.xml
deleted file mode 100644
index 6e6aa5e..0000000
--- a/ConversationCompiler/nbproject/build-impl.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- You must set 'suite.dir' to point to your containing module suite
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ConversationCompiler/nbproject/genfiles.properties b/ConversationCompiler/nbproject/genfiles.properties
deleted file mode 100644
index 29e95dc..0000000
--- a/ConversationCompiler/nbproject/genfiles.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-build.xml.data.CRC32=beb6af21
-build.xml.script.CRC32=16594606
-build.xml.stylesheet.CRC32=a56c6a5b@2.66.1
-# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
-# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=beb6af21
-nbproject/build-impl.xml.script.CRC32=bd99f65f
-nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.66.1
diff --git a/ConversationCompiler/nbproject/project.properties b/ConversationCompiler/nbproject/project.properties
deleted file mode 100644
index 8377ca3..0000000
--- a/ConversationCompiler/nbproject/project.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-javac.source=1.7
-javac.compilerargs=-Xlint -Xlint:-serial
-license.file=../LICENSE
-nbm.homepage=http://www.projectswg.com
-nbm.module.author=Waverunner
diff --git a/ConversationCompiler/nbproject/project.xml b/ConversationCompiler/nbproject/project.xml
deleted file mode 100644
index b082702..0000000
--- a/ConversationCompiler/nbproject/project.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
- org.netbeans.modules.apisupport.project
-
-
- com.projectswg.tools.csc.compiler
-
-
-
- com.projectswg.tools.csc.conversationeditor
-
-
-
- 1.0
-
-
-
- org.netbeans.api.visual
-
-
-
- 2.42.1
-
-
-
- org.openide.awt
-
-
-
- 7.61.2
-
-
-
- org.openide.dialogs
-
-
-
- 7.36.1
-
-
-
- org.openide.nodes
-
-
-
- 7.38.1
-
-
-
- org.openide.util
-
-
-
- 8.37.1
-
-
-
- org.openide.windows
-
-
-
- 6.70.1
-
-
-
-
-
-
-
diff --git a/ConversationCompiler/nbproject/suite.properties b/ConversationCompiler/nbproject/suite.properties
deleted file mode 100644
index 29d7cc9..0000000
--- a/ConversationCompiler/nbproject/suite.properties
+++ /dev/null
@@ -1 +0,0 @@
-suite.dir=${basedir}/..
diff --git a/ConversationCompiler/src/com/projectswg/tools/csc/compiler/Bundle.properties b/ConversationCompiler/src/com/projectswg/tools/csc/compiler/Bundle.properties
deleted file mode 100644
index 99a6c2f..0000000
--- a/ConversationCompiler/src/com/projectswg/tools/csc/compiler/Bundle.properties
+++ /dev/null
@@ -1 +0,0 @@
-OpenIDE-Module-Name=Conversation Compiler
diff --git a/ConversationCompiler/src/com/projectswg/tools/csc/compiler/wizard/Bundle.properties b/ConversationCompiler/src/com/projectswg/tools/csc/compiler/wizard/Bundle.properties
deleted file mode 100644
index 21a26e1..0000000
--- a/ConversationCompiler/src/com/projectswg/tools/csc/compiler/wizard/Bundle.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-CompileVisualPanel1.jLabel1.text=Location
-CompileVisualPanel1.jLabel2.text=Please select the location where you wish to build the script to.
-CompileVisualPanel1.btnBrowse.text=Browse
-CompileVisualPanel1.txtLocation.text=
-CompileVisualPanel1.jLabel3.text=Script Name
-CompileVisualPanel1.txtName.text=conversation_script
-CompileVisualPanel1.jLabel4.text=Enter a name for the compiled script. This should not include any extensions (ex: .py)
-CompileVisualPanel1.jLabel5.text=Script will be built to:
-CompileVisualPanel1.txtBuildLoc.text=
diff --git a/ConversationCompiler/src/com/projectswg/tools/csc/compiler/wizard/CompileVisualPanel1.form b/ConversationCompiler/src/com/projectswg/tools/csc/compiler/wizard/CompileVisualPanel1.form
deleted file mode 100644
index b8e3267..0000000
--- a/ConversationCompiler/src/com/projectswg/tools/csc/compiler/wizard/CompileVisualPanel1.form
+++ /dev/null
@@ -1,158 +0,0 @@
-
-
-
diff --git a/ConversationCompiler/src/com/projectswg/tools/csc/compiler/wizard/CompileVisualPanel1.java b/ConversationCompiler/src/com/projectswg/tools/csc/compiler/wizard/CompileVisualPanel1.java
deleted file mode 100644
index 27c3692..0000000
--- a/ConversationCompiler/src/com/projectswg/tools/csc/compiler/wizard/CompileVisualPanel1.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.projectswg.tools.csc.compiler.wizard;
-
-import javax.swing.JFileChooser;
-import javax.swing.JPanel;
-
-public final class CompileVisualPanel1 extends JPanel {
-
- /**
- * Creates new form CompileVisualPanel1
- */
- public CompileVisualPanel1() {
- initComponents();
- }
-
- @Override
- public String getName() {
- return "Select Location";
- }
-
- /**
- * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
- */
- // //GEN-BEGIN:initComponents
- private void initComponents() {
-
- jLabel1 = new javax.swing.JLabel();
- txtLocation = new javax.swing.JTextField();
- btnBrowse = new javax.swing.JButton();
- jLabel2 = new javax.swing.JLabel();
- jLabel3 = new javax.swing.JLabel();
- txtName = new javax.swing.JTextField();
- jLabel4 = new javax.swing.JLabel();
- jLabel5 = new javax.swing.JLabel();
- txtBuildLoc = new javax.swing.JTextField();
-
- org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(CompileVisualPanel1.class, "CompileVisualPanel1.jLabel1.text")); // NOI18N
-
- txtLocation.setEditable(false);
- txtLocation.setText(org.openide.util.NbBundle.getMessage(CompileVisualPanel1.class, "CompileVisualPanel1.txtLocation.text")); // NOI18N
-
- org.openide.awt.Mnemonics.setLocalizedText(btnBrowse, org.openide.util.NbBundle.getMessage(CompileVisualPanel1.class, "CompileVisualPanel1.btnBrowse.text")); // NOI18N
- btnBrowse.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- btnBrowseActionPerformed(evt);
- }
- });
-
- jLabel2.setLabelFor(txtLocation);
- org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(CompileVisualPanel1.class, "CompileVisualPanel1.jLabel2.text")); // NOI18N
-
- org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(CompileVisualPanel1.class, "CompileVisualPanel1.jLabel3.text")); // NOI18N
-
- txtName.setText(org.openide.util.NbBundle.getMessage(CompileVisualPanel1.class, "CompileVisualPanel1.txtName.text")); // NOI18N
- txtName.addKeyListener(new java.awt.event.KeyAdapter() {
- public void keyTyped(java.awt.event.KeyEvent evt) {
- txtNameKeyTyped(evt);
- }
- });
-
- jLabel4.setLabelFor(txtName);
- org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(CompileVisualPanel1.class, "CompileVisualPanel1.jLabel4.text")); // NOI18N
-
- org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(CompileVisualPanel1.class, "CompileVisualPanel1.jLabel5.text")); // NOI18N
-
- txtBuildLoc.setEditable(false);
- txtBuildLoc.setText(org.openide.util.NbBundle.getMessage(CompileVisualPanel1.class, "CompileVisualPanel1.txtBuildLoc.text")); // NOI18N
-
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
- this.setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jLabel3)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(txtName))
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jLabel5)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(txtBuildLoc))
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jLabel1)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(txtLocation, javax.swing.GroupLayout.PREFERRED_SIZE, 266, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(btnBrowse, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addComponent(jLabel2)
- .addComponent(jLabel4))
- .addGap(0, 0, Short.MAX_VALUE))))
- .addContainerGap())
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jLabel2)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(btnBrowse)
- .addComponent(txtLocation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel1))
- .addGap(14, 14, 14)
- .addComponent(jLabel4)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel3)
- .addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(48, 48, 48)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel5)
- .addComponent(txtBuildLoc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addContainerGap(124, Short.MAX_VALUE))
- );
- }// //GEN-END:initComponents
-
- private void btnBrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBrowseActionPerformed
- JFileChooser chooser = new JFileChooser();
- chooser.setDialogTitle("Select Location");
- chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- int returnVal = chooser.showDialog(this, "Select");
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- txtLocation.setText(chooser.getSelectedFile().getPath());
- txtBuildLoc.setText(txtLocation.getText() + "\\" + txtName.getText() + ".py");
- }
- }//GEN-LAST:event_btnBrowseActionPerformed
-
- private void txtNameKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNameKeyTyped
- txtBuildLoc.setText(txtLocation.getText() + "\\" + txtName.getText() + ".py");
- }//GEN-LAST:event_txtNameKeyTyped
-
- public String getBuildLocation() {
- return txtBuildLoc.getText();
- }
- // Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.JButton btnBrowse;
- private javax.swing.JLabel jLabel1;
- private javax.swing.JLabel jLabel2;
- private javax.swing.JLabel jLabel3;
- private javax.swing.JLabel jLabel4;
- private javax.swing.JLabel jLabel5;
- private javax.swing.JTextField txtBuildLoc;
- private javax.swing.JTextField txtLocation;
- private javax.swing.JTextField txtName;
- // End of variables declaration//GEN-END:variables
-}
diff --git a/ConversationCompiler/src/com/projectswg/tools/csc/compiler/wizard/CompileWizardAction.java b/ConversationCompiler/src/com/projectswg/tools/csc/compiler/wizard/CompileWizardAction.java
deleted file mode 100644
index 9ee66cc..0000000
--- a/ConversationCompiler/src/com/projectswg/tools/csc/compiler/wizard/CompileWizardAction.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.projectswg.tools.csc.compiler.wizard;
-
-import com.projectswg.tools.csc.compiler.Compiler;
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-import javax.swing.JComponent;
-import org.openide.DialogDisplayer;
-import org.openide.NotifyDescriptor;
-import org.openide.WizardDescriptor;
-import org.openide.awt.ActionID;
-import org.openide.awt.ActionReference;
-import org.openide.awt.ActionRegistration;
-import org.openide.util.Exceptions;
-import org.openide.util.ImageUtilities;
-
-@ActionID(category="...", id="com.projectswg.tools.csc.compiler.wizard.CompileWizardAction")
-@ActionRegistration(displayName="Create Script")
-@ActionReference(path="Menu/File")
-public final class CompileWizardAction implements ActionListener {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- List> panels = new ArrayList<>();
- CompileWizardPanel1 compilePanel = new CompileWizardPanel1();
- panels.add(compilePanel);
- String[] steps = new String[panels.size()];
- for (int i = 0; i < panels.size(); i++) {
- Component c = panels.get(i).getComponent();
- // Default step name to component name of panel.
- steps[i] = c.getName();
- if (c instanceof JComponent) { // assume Swing components
- JComponent jc = (JComponent) c;
- jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
- jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
- jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, true);
- jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, true);
- jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, true);
- }
- }
- WizardDescriptor wiz = new WizardDescriptor(new WizardDescriptor.ArrayIterator<>(panels));
- // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
- wiz.setTitleFormat(new MessageFormat("{0}"));
- wiz.setTitle("Compile Conversation Script");
- wiz.putProperty(WizardDescriptor.PROP_IMAGE, ImageUtilities.loadImage("com/projectswg/tools/csc/compiler/wizard/csc_wizard_bg.png"));
-
- if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
- File file = new File(compilePanel.getComponent().getBuildLocation());
-
- if (file.exists()) {
- DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message("Script already exists: " + file.getAbsolutePath(), NotifyDescriptor.ERROR_MESSAGE));
- } else {
- Compiler compiler = new Compiler(file);
- try {
- compiler.compile();
- } catch (IOException ex) {
- Exceptions.printStackTrace(ex);
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/ConversationCompiler/src/com/projectswg/tools/csc/compiler/wizard/CompileWizardPanel1.java b/ConversationCompiler/src/com/projectswg/tools/csc/compiler/wizard/CompileWizardPanel1.java
deleted file mode 100644
index f755e24..0000000
--- a/ConversationCompiler/src/com/projectswg/tools/csc/compiler/wizard/CompileWizardPanel1.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.projectswg.tools.csc.compiler.wizard;
-
-import javax.swing.event.ChangeListener;
-import org.openide.WizardDescriptor;
-import org.openide.util.HelpCtx;
-
-public class CompileWizardPanel1 implements WizardDescriptor.Panel {
-
- private CompileVisualPanel1 component;
-
- // Get the visual component for the panel. In this template, the component
- // is kept separate. This can be more efficient: if the wizard is created
- // but never displayed, or not all panels are displayed, it is better to
- // create only those which really need to be visible.
- @Override
- public CompileVisualPanel1 getComponent() {
- if (component == null) {
- component = new CompileVisualPanel1();
- }
- return component;
- }
-
- @Override
- public HelpCtx getHelp() {
- // Show no Help button for this panel:
- return HelpCtx.DEFAULT_HELP;
- // If you have context help:
- // return new HelpCtx("help.key.here");
- }
-
- @Override
- public boolean isValid() {
- // If it is always OK to press Next or Finish, then:
- return true;
- // If it depends on some condition (form filled out...) and
- // this condition changes (last form field filled in...) then
- // use ChangeSupport to implement add/removeChangeListener below.
- // WizardDescriptor.ERROR/WARNING/INFORMATION_MESSAGE will also be useful.
- }
-
- @Override
- public void addChangeListener(ChangeListener l) {
- }
-
- @Override
- public void removeChangeListener(ChangeListener l) {
- }
-
- @Override
- public void readSettings(WizardDescriptor wiz) {
- // use wiz.getProperty to retrieve previous panel state
- }
-
- @Override
- public void storeSettings(WizardDescriptor wiz) {
- // use wiz.putProperty to remember current panel state
- }
-}
diff --git a/ConversationCompiler/src/com/projectswg/tools/csc/compiler/wizard/csc_wizard_bg.png b/ConversationCompiler/src/com/projectswg/tools/csc/compiler/wizard/csc_wizard_bg.png
deleted file mode 100644
index 75c76d6..0000000
Binary files a/ConversationCompiler/src/com/projectswg/tools/csc/compiler/wizard/csc_wizard_bg.png and /dev/null differ
diff --git a/ConversationCompiler/src/com/projectswg/tools/csc/compiler/Compiler.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/Compiler.java
similarity index 61%
rename from ConversationCompiler/src/com/projectswg/tools/csc/compiler/Compiler.java
rename to ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/Compiler.java
index 68a4f02..a067f1f 100644
--- a/ConversationCompiler/src/com/projectswg/tools/csc/compiler/Compiler.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/Compiler.java
@@ -1,4 +1,4 @@
-package com.projectswg.tools.csc.compiler;
+package com.projectswg.tools.csc.conversationeditor;
import com.projectswg.tools.csc.conversationeditor.ConversationNode;
import com.projectswg.tools.csc.conversationeditor.EditorTopComponent;
@@ -16,16 +16,22 @@ import org.openide.windows.TopComponent;
public class Compiler {
private final File file;
+ private boolean comments = true;
+ private boolean tabs = true;
+ private String header = "";
- public Compiler(File file) {
+ public Compiler(File file, boolean comments, String header, boolean tabs) {
this.file = file;
+ this.comments = comments;
+ this.header = header;
+ this.tabs = tabs;
}
- public void compile() throws IOException {
+ public boolean compile() throws IOException {
TopComponent component = TopComponent.getRegistry().getActivated();
if (component == null || !(component instanceof EditorTopComponent))
- return;
+ return false;
EditorTopComponent editor = (EditorTopComponent) component;
SceneView scene = editor.getScene();
@@ -33,7 +39,7 @@ public class Compiler {
if (scene == null) {
JOptionPane.showMessageDialog(null, "The scene was null! You must restart the editor in order to compile :(",
"Conversation Script Creator", JOptionPane.ERROR_MESSAGE);
- return;
+ return false;
}
try (BufferedWriter bw = new BufferedWriter(new FileWriter(file.getAbsolutePath()))) {
@@ -42,20 +48,17 @@ public class Compiler {
LinkedHashMap> conversationLinks = scene.getConversationLinks();
for (Map.Entry> entry : conversationLinks.entrySet()) {
- /*System.out.println("Handling for node " + entry.getKey().getStf());
- for (ConversationNode node : entry.getValue()) {
- System.out.println("Node: " + node.getStf());
- }*/
if (entry.getKey().isStartNode()) {
createOptionsAndHandler(bw, entry.getKey(), entry.getValue(), 1, conversationLinks);
break;
}
}
}
+ return true;
}
private void createBaseFile(BufferedWriter bw) throws IOException {
- bw.write("# Base file generated using Conversation Script Creator for ProjectSWG\n");
+ if (comments && !header.isEmpty()) bw.write("#" + header + "\n");
bw.write("from resources.common import ConversationOption\n" +
"from resources.common import OutOfBand\n" +
@@ -71,36 +74,47 @@ public class Compiler {
LinkedHashMap> conversationLinks) throws IOException {
LinkedHashMap> handleFuncs = new LinkedHashMap<>();
-
+
bw.write("def handleOptionScreen" + handleNum + "(core, actor, npc, selection):\n");
bw.newLine();
+ String indent4 = getIndent(4);
+ String indent8 = getIndent(8);
+
int count = handleNum + 1;
for (ConversationNode selectedOption : options) {
- bw.write(" " + (options.indexOf(selectedOption) > 0 ? "elif" : "if") + " selection == " + options.indexOf(selectedOption) + ":\n");
+ bw.write(indent4 + (options.indexOf(selectedOption) > 0 ? "elif" : "if") + " selection == " + options.indexOf(selectedOption) + ":\n");
if (conversationLinks.containsKey(selectedOption)) {
- bw.write(" #Handler for Option Node " + selectedOption.getId() + "\n");
+ if (comments) bw.write(indent8 + "# " + (selectedOption.getDisplayText().equals("") ? selectedOption.getStf() : selectedOption.getDisplayText()) + "\n");
for (ConversationNode handleNode : conversationLinks.get(selectedOption)) {
- if (!handleNode.isOption()) {
+ if (!handleNode.isOption() && !handleNode.isEndNode()) {
if (conversationLinks.get(handleNode) == null) {
- bw.write(" core.conversationService.sendStopConversation(actor, npc, 'conversation/c_newbie_secondchance', 's_136')\n");
+ bw.write(indent8 + "# NULL Error printing out handle for " + handleNode.getStf());
} else {
- createOptions(bw, conversationLinks.get(handleNode), count++, " ");
- bw.write(" core.conversationService.sendConversationMessage(actor, npc, OutOfBand.ProsePackage('@conversation/"
+ createOptions(bw, conversationLinks.get(handleNode), count++, indent8);
+ bw.write(indent8 + "core.conversationService.sendConversationMessage(actor, npc, OutOfBand.ProsePackage('@conversation/"
+ handleNode.getStf() + "')\n");
handleFuncs.put(handleNode, conversationLinks.get(handleNode)); // Put these nodes in list so we can create the handlers later.
}
+ } else if (handleNode.isEndNode()) {
+ if (handleNode.getStf().contains(":")) {
+ String[] split = handleNode.getStf().split(":");
+ bw.write(indent8 + "core.conversationService.sendStopConversation(actor, npc, 'conversation/" + split[0] + "', '" + split[1] + "')\n");
+ } else {
+ bw.write(indent8 + "# Couldn't write end response because of bad format!");
+ }
}
}
}
- bw.write(" return\n");
+ bw.write(indent8 + "return\n");
bw.newLine();
}
- bw.write(" return\n");
+ bw.write(indent4 + "return\n");
bw.newLine();
int currentHandler = handleNum + 1;
for (Map.Entry> handleNode : handleFuncs.entrySet()) {
+ bw.write("# Handle Response for " + handleNode.getKey().getStf());
createResponseHandler(bw, handleNode.getValue(), currentHandler++, conversationLinks);
}
}
@@ -108,26 +122,26 @@ public class Compiler {
private void createOptionsAndHandler(BufferedWriter bw, ConversationNode response, ArrayList options, int handleScreenNum,
LinkedHashMap> conversationLinks) throws IOException {
- bw.write(" options = new Vector()\n");
+ String indent4 = getIndent(4);
+
+ bw.write(indent4 + "options = new Vector()\n");
if (options.size() > 1) {
- ArrayList orderedOptions = new ArrayList<>();
- for (ConversationNode unOrdered : options) {
- orderedOptions.add(unOrdered.getOptionId(), unOrdered);
+ for (ConversationNode option : options) {
+ bw.write(indent4 + "options.add(ConversationOption(OutOfBand.ProsePackage('@conversation/" + option.getStf() +"'), "
+ + String.valueOf(option.getOptionId()) + ")\n");
}
- for (ConversationNode option : orderedOptions) {
- bw.write(" options.add(ConversationOption(OutOfBand.ProsePackage('@conversation/" + option.getStf() +"'), " + options.indexOf(option) + ")\n");
- }
} else {
for (ConversationNode option : options) {
- bw.write(" options.add(ConversationOption(OutOfBand.ProsePackage('@conversation/" + option.getStf() +"'), " + options.indexOf(option) + ")\n");
+ bw.write(indent4 + "options.add(ConversationOption(OutOfBand.ProsePackage('@conversation/" + option.getStf() +"'), " + options.indexOf(option) + ")\n");
}
}
- bw.write(" core.conversationService.sendConversationOptions(actor, npc, handleOptionScreen" + String.valueOf(handleScreenNum) + ")\n");
- bw.write(" core.conversationService.sendConversationMessage(actor, npc, OutOfBand.ProsePackage('@conversation/" + response.getStf() + "'))\n");
- bw.write(" return\n");
+ bw.write(indent4 + "core.conversationService.sendConversationOptions(actor, npc, handleOptionScreen" + String.valueOf(handleScreenNum) + ")\n");
+ bw.write(indent4 + "core.conversationService.sendConversationMessage(actor, npc, OutOfBand.ProsePackage('@conversation/" + response.getStf() + "'))\n");
+ bw.write(indent4 + "return\n");
bw.newLine();
+ bw.write("# Handle Response for " + response.getStf());
createResponseHandler(bw, options, handleScreenNum, conversationLinks);
}
@@ -149,4 +163,25 @@ public class Compiler {
}
bw.write(space + "core.conversationService.sendConversationOptions(actor, npc, handleOptionScreen" + String.valueOf(handleScreenNum) + ")\n");
}
+
+ private String getIndent(int length) {
+ String rtn = "";
+
+ if (!tabs) {
+ int i = 0;
+ while (i < length) {
+ rtn = rtn + " ";
+ }
+ } else {
+ switch(length) {
+ case 4:
+ rtn = "\t";
+ break;
+ case 8:
+ rtn = "\t\t";
+ break;
+ }
+ }
+ return rtn;
+ }
}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/EditorTopComponent.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/EditorTopComponent.java
index fcf0cb9..243ad3e 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/EditorTopComponent.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/EditorTopComponent.java
@@ -38,7 +38,6 @@ public final class EditorTopComponent extends TopComponent implements ExplorerMa
private final SceneView scene;
private String activePath = "";
- // New Conversation
public EditorTopComponent() {
initComponents();
@@ -47,8 +46,9 @@ public final class EditorTopComponent extends TopComponent implements ExplorerMa
this.scene = new SceneView(mgr);
scrollPane.setViewportView(scene.createView());
- associateLookup(ExplorerUtils.createLookup(mgr, getActionMap()));
+ associateLookup(ExplorerUtils.createLookup(mgr, getActionMap()));
+ //SystemAction.get(CompileWizardAction.class).setEnabled(true);
}
/**
@@ -79,21 +79,22 @@ public final class EditorTopComponent extends TopComponent implements ExplorerMa
@Override
public void componentOpened() {
- if (activePath.equals("")) {
- // blankSlate();
- // scene.validate();
+ if (activePath.isEmpty() && scene.getScenePath().isEmpty()) {
+ blankSlate();
return;
}
- File file = new File(activePath);
+ if (!scene.isLoaded()) {
+ File file = new File(activePath);
- if (!file.exists()) {
- JOptionPane.showMessageDialog(null, "Couldn't open conversation file " + file.getAbsolutePath()
- + " because it no longer exists.", "Conversation Script Editor", JOptionPane.INFORMATION_MESSAGE);
- blankSlate();
- scene.validate();
- } else {
- OpenConversation.open(file, this);
+ if (!file.exists()) {
+ JOptionPane.showMessageDialog(null, "Couldn't open conversation file " + file.getAbsolutePath()
+ + " because it no longer exists.", "Conversation Script Editor", JOptionPane.INFORMATION_MESSAGE);
+ blankSlate();
+ scene.validate();
+ } else {
+ OpenConversation.open(file, this);
+ }
}
}
@@ -103,12 +104,10 @@ public final class EditorTopComponent extends TopComponent implements ExplorerMa
}
void writeProperties(java.util.Properties p) {
- //p.setProperty("version", "1.0");
p.setProperty("activePath", scene.getScenePath());
}
void readProperties(java.util.Properties p) {
- //String version = p.getProperty("version");
this.activePath = p.getProperty("activePath");
}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/SceneSaver.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/SceneSaver.java
index 9bb751a..f007a3b 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/SceneSaver.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/SceneSaver.java
@@ -105,7 +105,6 @@ public class SceneSaver {
@Override
public void run() {
deserializeNodeDataVersion1(scene, sceneXMLNode);
- scene.validate ();
}
});
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/SceneView.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/SceneView.java
index 1fd2609..87c504a 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/SceneView.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/SceneView.java
@@ -23,6 +23,7 @@ public class SceneView extends GraphScene{
private String name = "";
private String scenePath = "";
+ private boolean loaded = false;
private int id = 1;
@@ -35,11 +36,11 @@ public class SceneView extends GraphScene{
mainLayer = new LayerWidget(this);
addChild(mainLayer);
- getActions().addAction(ActionFactory.createZoomAction());
- getActions().addAction(ActionFactory.createWheelPanAction());
connectionLayer = new LayerWidget(this);
addChild(connectionLayer);
+ getActions().addAction(ActionFactory.createZoomAction());
+ getActions().addAction(ActionFactory.createWheelPanAction());
this.mgr = mgr;
}
@@ -130,6 +131,14 @@ public class SceneView extends GraphScene{
this.id = id;
}
+ public void setLoaded(boolean loaded) {
+ this.loaded = loaded;
+ }
+
+ public boolean isLoaded() {
+ return loaded;
+ }
+
public LinkedHashMap> getConversationLinks() {
List connectedNodes = connectionLayer.getChildren();
LinkedHashMap> conversationLinks = new LinkedHashMap<>();
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConversation.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConversation.java
index 120a717..032b8af 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConversation.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConversation.java
@@ -23,7 +23,7 @@ import org.openide.util.NbBundle.Messages;
displayName = "New Conversation"
)
@ActionReferences({
- @ActionReference(path = "Menu/File", position = -115),
+ @ActionReference(path = "Menu/File", position = 2),
@ActionReference(path = "Toolbars/File", position = 400),
@ActionReference(path = "Shortcuts", name = "D-N")
})
@@ -33,8 +33,6 @@ public final class NewConversation implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
EditorTopComponent newEditor = new EditorTopComponent();
- newEditor.blankSlate();
- newEditor.getScene().validate();
newEditor.open();
newEditor.requestActive();
}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/OpenConversation.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/OpenConversation.java
index 98504d9..f401a06 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/OpenConversation.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/OpenConversation.java
@@ -3,6 +3,7 @@ package com.projectswg.tools.csc.conversationeditor.actions;
import com.projectswg.tools.csc.conversationeditor.EditorTopComponent;
import com.projectswg.tools.csc.conversationeditor.SceneSaver;
import com.projectswg.tools.csc.conversationeditor.SceneView;
+import com.projectswg.tools.csc.conversationeditor.wizard.CompileWizardAction;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
@@ -17,9 +18,9 @@ import org.openide.awt.ActionRegistration;
import org.openide.filesystems.FileChooserBuilder;
import org.openide.util.Exceptions;
import org.openide.util.NbBundle.Messages;
+import org.openide.util.actions.SystemAction;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
@ActionID(category = "File", id = "org.mycore.OpenFileAction")
@@ -44,10 +45,14 @@ public final class OpenConversation implements ActionListener {
open(toAdd, editor);
editor.open();
editor.requestActive();
+
}
}
public static void open(File openFile, EditorTopComponent editor) {
+ if (editor.getScene().isLoaded())
+ return;
+
try {
if (!openFile.getName().endsWith(".xml")) {
System.out.println("Not a valid Conversation Editor file!");
@@ -78,10 +83,11 @@ public final class OpenConversation implements ActionListener {
}
scene.setSceneName(openFile.getName().split(".xml")[0]);
scene.setScenePath(openFile.getAbsolutePath());
-
+
saver.deserializeData(scene, sceneNode);
editor.setName(scene.getSceneName());
+ scene.setLoaded(true);
} catch (ParserConfigurationException | SAXException | IOException ex) {
Exceptions.printStackTrace(ex);
}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/SaveConversation.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/SaveConversation.java
index ce96d27..26d2450 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/SaveConversation.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/SaveConversation.java
@@ -46,7 +46,7 @@ import org.xml.sax.SAXException;
displayName = "Save"
)
@ActionReferences({
- @ActionReference(path = "Menu/File", position = -90, separatorBefore = -140),
+ @ActionReference(path = "Menu/File", position = 3, separatorBefore = -140),
@ActionReference(path = "Toolbars/File", position = 500),
@ActionReference(path = "Shortcuts", name = "D-S")
})
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/layer.xml b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/layer.xml
index 18b4b7f..bcb685c 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/layer.xml
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/layer.xml
@@ -9,11 +9,22 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/Bundle.properties b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/Bundle.properties
new file mode 100644
index 0000000..b7d1519
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/Bundle.properties
@@ -0,0 +1,15 @@
+CompileVisualPanel1.jLabel1.text=Select the directory to export to. If this is your first time running the wizard, you'll have to select the location of the scripts/conversation folder
+CompileVisualPanel1.jLabel2.text=Export Directory:
+CompileVisualPanel1.tbExportDirectory.text=None Selected
+CompileVisualPanel1.btnChngScriptsLoc.text=Change Scripts Location
+CompileVisualPanel1.btnChngScriptsLoc.toolTipText=
+CompileVisualPanel2.jLabel1.text=Select any additional options for compiling the script.
+CompileVisualPanel2.jLabel2.text=Indentation type:
+CompileVisualPanel2.radioSpaces.text=Spaces
+CompileVisualPanel2.radioTabs.text=Tabs
+CompileVisualPanel2.chkbxComments.text=Generate Comments
+CompileVisualPanel2.jLabel4.text=Script name
+CompileVisualPanel2.tbScriptName.text=
+CompileVisualPanel2.jLabel3.text=Header:
+CompileVisualPanel2.txtAreaHeader.text=Base file generated using Conversation Script Creator for ProjectSWG
+CompileVisualPanel2.jLabel5.text=Note: Must end in .py!
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileVisualPanel1.form b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileVisualPanel1.form
new file mode 100644
index 0000000..a05f06c
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileVisualPanel1.form
@@ -0,0 +1,112 @@
+
+
+
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileVisualPanel1.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileVisualPanel1.java
new file mode 100644
index 0000000..e74ed75
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileVisualPanel1.java
@@ -0,0 +1,152 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.projectswg.tools.csc.conversationeditor.wizard;
+
+import java.io.File;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTree;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import org.openide.filesystems.FileChooserBuilder;
+
+public final class CompileVisualPanel1 extends JPanel {
+
+ public CompileVisualPanel1() {
+ initComponents();
+ }
+
+ @Override
+ public String getName() {
+ return "Location";
+ }
+
+ /**
+ * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
+ */
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jLabel1 = new javax.swing.JLabel();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ scriptsTree = new javax.swing.JTree();
+ btnChngScriptsLoc = new javax.swing.JButton();
+ jLabel2 = new javax.swing.JLabel();
+ tbExportDirectory = new javax.swing.JTextField();
+
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(CompileVisualPanel1.class, "CompileVisualPanel1.jLabel1.text")); // NOI18N
+
+ javax.swing.tree.DefaultMutableTreeNode treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("scripts/conversation");
+ scriptsTree.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
+ jScrollPane1.setViewportView(scriptsTree);
+
+ org.openide.awt.Mnemonics.setLocalizedText(btnChngScriptsLoc, org.openide.util.NbBundle.getMessage(CompileVisualPanel1.class, "CompileVisualPanel1.btnChngScriptsLoc.text")); // NOI18N
+ btnChngScriptsLoc.setToolTipText(org.openide.util.NbBundle.getMessage(CompileVisualPanel1.class, "CompileVisualPanel1.btnChngScriptsLoc.toolTipText")); // NOI18N
+ btnChngScriptsLoc.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnChngScriptsLocActionPerformed(evt);
+ }
+ });
+
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(CompileVisualPanel1.class, "CompileVisualPanel1.jLabel2.text")); // NOI18N
+
+ tbExportDirectory.setEditable(false);
+ tbExportDirectory.setText(org.openide.util.NbBundle.getMessage(CompileVisualPanel1.class, "CompileVisualPanel1.tbExportDirectory.text")); // NOI18N
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jLabel2)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(tbExportDirectory))
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel1)
+ .addComponent(btnChngScriptsLoc))
+ .addGap(0, 0, Short.MAX_VALUE)))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jLabel1)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel2)
+ .addComponent(tbExportDirectory, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 286, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnChngScriptsLoc)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ }// //GEN-END:initComponents
+
+ private void btnChngScriptsLocActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnChngScriptsLocActionPerformed
+ File home = new File(System.getProperty("user.home"));
+
+ File selection = new FileChooserBuilder("user-dir").setTitle("Select Directory").
+ setDefaultWorkingDirectory(home).setApproveText("Select").setDirectoriesOnly(true).showOpenDialog();
+
+ if (selection != null) {
+ String path = selection.getAbsolutePath();
+
+ if (!path.endsWith("scripts\\conversation")) {
+ JOptionPane.showConfirmDialog(null, path + " is not a valid scripts/conversation directory", "Error", JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+ populateScriptsTree(selection);
+ }
+ }//GEN-LAST:event_btnChngScriptsLocActionPerformed
+
+ public void populateScriptsTree(File base) {
+ DefaultMutableTreeNode root = new DefaultMutableTreeNode("scripts/conversation");
+
+ populateTree(root, base);
+
+ scriptsTree.setModel(new DefaultTreeModel(root));
+
+ tbExportDirectory.setText(base.getAbsolutePath());
+ }
+
+ private void populateTree(DefaultMutableTreeNode root, File dir) {
+ for (File f : dir.listFiles()) {
+ if (f.isDirectory()) {
+ DefaultMutableTreeNode dirNode = new DefaultMutableTreeNode(f.getName());
+ populateTree(dirNode, f);
+ root.add(dirNode);
+ }
+ }
+ }
+
+ public javax.swing.JTextField getExportDirectory() {
+ return tbExportDirectory;
+ }
+
+ public javax.swing.JTree getScriptFolderTree() {
+ return scriptsTree;
+ }
+
+ public void setScriptsTree(JTree scriptsTree) {
+ this.scriptsTree = scriptsTree;
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnChngScriptsLoc;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JTree scriptsTree;
+ private javax.swing.JTextField tbExportDirectory;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileVisualPanel2.form b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileVisualPanel2.form
new file mode 100644
index 0000000..629ed05
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileVisualPanel2.form
@@ -0,0 +1,188 @@
+
+
+
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileVisualPanel2.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileVisualPanel2.java
new file mode 100644
index 0000000..1c98707
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileVisualPanel2.java
@@ -0,0 +1,193 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.projectswg.tools.csc.conversationeditor.wizard;
+
+import java.awt.event.ItemEvent;
+import javax.swing.ButtonGroup;
+import javax.swing.JCheckBox;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+public final class CompileVisualPanel2 extends JPanel {
+
+ /**
+ * Creates new form CompileVisualPanel2
+ */
+ public CompileVisualPanel2() {
+ initComponents();
+ }
+
+ @Override
+ public String getName() {
+ return "Set Options";
+ }
+
+ /**
+ * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
+ */
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ radialIndentation = new javax.swing.ButtonGroup();
+ jLabel1 = new javax.swing.JLabel();
+ jLabel2 = new javax.swing.JLabel();
+ radioSpaces = new javax.swing.JRadioButton();
+ radioTabs = new javax.swing.JRadioButton();
+ chkbxComments = new javax.swing.JCheckBox();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ txtAreaHeader = new javax.swing.JTextArea();
+ jLabel3 = new javax.swing.JLabel();
+ jLabel4 = new javax.swing.JLabel();
+ tbScriptName = new javax.swing.JTextField();
+ jLabel5 = new javax.swing.JLabel();
+
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(CompileVisualPanel2.class, "CompileVisualPanel2.jLabel1.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(CompileVisualPanel2.class, "CompileVisualPanel2.jLabel2.text")); // NOI18N
+
+ radialIndentation.add(radioSpaces);
+ org.openide.awt.Mnemonics.setLocalizedText(radioSpaces, org.openide.util.NbBundle.getMessage(CompileVisualPanel2.class, "CompileVisualPanel2.radioSpaces.text")); // NOI18N
+
+ radialIndentation.add(radioTabs);
+ radioTabs.setSelected(true);
+ org.openide.awt.Mnemonics.setLocalizedText(radioTabs, org.openide.util.NbBundle.getMessage(CompileVisualPanel2.class, "CompileVisualPanel2.radioTabs.text")); // NOI18N
+
+ chkbxComments.setSelected(true);
+ org.openide.awt.Mnemonics.setLocalizedText(chkbxComments, org.openide.util.NbBundle.getMessage(CompileVisualPanel2.class, "CompileVisualPanel2.chkbxComments.text")); // NOI18N
+ chkbxComments.addItemListener(new java.awt.event.ItemListener() {
+ public void itemStateChanged(java.awt.event.ItemEvent evt) {
+ chkbxCommentsItemStateChanged(evt);
+ }
+ });
+
+ txtAreaHeader.setColumns(20);
+ txtAreaHeader.setRows(5);
+ txtAreaHeader.setText(org.openide.util.NbBundle.getMessage(CompileVisualPanel2.class, "CompileVisualPanel2.txtAreaHeader.text")); // NOI18N
+ jScrollPane1.setViewportView(txtAreaHeader);
+
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(CompileVisualPanel2.class, "CompileVisualPanel2.jLabel3.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(CompileVisualPanel2.class, "CompileVisualPanel2.jLabel4.text")); // NOI18N
+
+ tbScriptName.setText(org.openide.util.NbBundle.getMessage(CompileVisualPanel2.class, "CompileVisualPanel2.tbScriptName.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(CompileVisualPanel2.class, "CompileVisualPanel2.jLabel5.text")); // NOI18N
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel1)
+ .addComponent(jLabel2)))
+ .addGroup(layout.createSequentialGroup()
+ .addGap(36, 36, 36)
+ .addComponent(radioSpaces)
+ .addGap(18, 18, 18)
+ .addComponent(radioTabs))
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(chkbxComments))
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jLabel3)))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jLabel4)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(tbScriptName, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(jLabel5)
+ .addGap(0, 144, Short.MAX_VALUE))))
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jLabel1)
+ .addGap(31, 31, 31)
+ .addComponent(jLabel2)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(radioSpaces)
+ .addComponent(radioTabs))
+ .addGap(18, 18, 18)
+ .addComponent(chkbxComments)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel4)
+ .addComponent(tbScriptName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jLabel5))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jLabel3)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap())
+ );
+ }// //GEN-END:initComponents
+
+ private void chkbxCommentsItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_chkbxCommentsItemStateChanged
+ switch(evt.getStateChange()) {
+ case ItemEvent.DESELECTED:
+ txtAreaHeader.setEditable(false);
+ txtAreaHeader.setEnabled(false);
+ break;
+ case ItemEvent.SELECTED:
+ txtAreaHeader.setEditable(true);
+ txtAreaHeader.setEnabled(true);
+ break;
+ }
+ }//GEN-LAST:event_chkbxCommentsItemStateChanged
+
+ public JRadioButton getRadioSpaces() {
+ return radioSpaces;
+ }
+
+ public JRadioButton getRadioTabs() {
+ return radioTabs;
+ }
+
+ public JCheckBox getChkbxComments() {
+ return chkbxComments;
+ }
+
+ public ButtonGroup getRadioGroupIndentation() {
+ return radialIndentation;
+ }
+
+ public JTextArea getTxtAreaHeader() {
+ return txtAreaHeader;
+ }
+
+ public JTextField getTbScriptName() {
+ return tbScriptName;
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JCheckBox chkbxComments;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
+ private javax.swing.JLabel jLabel5;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.ButtonGroup radialIndentation;
+ private javax.swing.JRadioButton radioSpaces;
+ private javax.swing.JRadioButton radioTabs;
+ private javax.swing.JTextField tbScriptName;
+ private javax.swing.JTextArea txtAreaHeader;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileWizardAction.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileWizardAction.java
new file mode 100644
index 0000000..2e456f7
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileWizardAction.java
@@ -0,0 +1,98 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.projectswg.tools.csc.conversationeditor.wizard;
+
+import com.projectswg.tools.csc.conversationeditor.Compiler;
+import com.projectswg.tools.csc.conversationeditor.EditorTopComponent;
+import java.awt.Component;
+import java.awt.Desktop;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+import javax.swing.JComponent;
+import javax.swing.JOptionPane;
+import org.openide.DialogDisplayer;
+import org.openide.WizardDescriptor;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionReference;
+import org.openide.awt.ActionRegistration;
+import org.openide.util.Exceptions;
+import org.openide.windows.TopComponent;
+
+// An example action demonstrating how the wizard could be called from within
+// your code. You can move the code below wherever you need, or register an action:
+@ActionID(category="File", id="com.projectswg.tools.csc.conversationeditor.wizard.CompileWizardAction")
+@ActionRegistration(displayName="Compile Script")
+@ActionReference(path="Menu/File", position=0, separatorAfter=1)
+public final class CompileWizardAction implements ActionListener {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ TopComponent component = TopComponent.getRegistry().getActivated();
+ if (component == null || !(component instanceof EditorTopComponent)) {
+ JOptionPane.showConfirmDialog(component, "No active scene to compile!", "Conversation Script Creator", JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
+ return;
+ }
+
+ List> panels = new ArrayList<>();
+ panels.add(new CompileWizardPanel1());
+ panels.add(new CompileWizardPanel2());
+ String[] steps = new String[panels.size()];
+ for (int i = 0; i < panels.size(); i++) {
+ Component c = panels.get(i).getComponent();
+ // Default step name to component name of panel.
+ steps[i] = c.getName();
+ if (c instanceof JComponent) { // assume Swing components
+ JComponent jc = (JComponent) c;
+ jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
+ jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
+ jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, true);
+ jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, true);
+ jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, true);
+ }
+ }
+ WizardDescriptor wiz = new WizardDescriptor(new WizardDescriptor.ArrayIterator<>(panels));
+ // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
+ wiz.setTitleFormat(new MessageFormat("{0}"));
+ wiz.setTitle("Compile Wizard");
+
+ if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
+ String directory = (String) wiz.getProperty("directory");
+ boolean comments = (Boolean) wiz.getProperty("comments");
+ String header = (String) wiz.getProperty("header");
+ boolean tabs = (((String) wiz.getProperty("indent")).equals("tabs"));
+ String script = (String) wiz.getProperty("script");
+
+ File file = new File(directory + "\\" + script);
+ if (file.exists()) {
+ JOptionPane.showConfirmDialog(null, "The directory " + file.getAbsolutePath() +
+ " already exists!", "Conversation Script Creator", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+ Compiler compiler = new Compiler(file, comments, header, tabs);
+ try {
+ if (compiler.compile()) {
+ if (JOptionPane.showConfirmDialog(null, "Script created at " + file.getAbsolutePath() + " successfully. Would you like to open it?",
+ "Conversation Script Creator", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION) {
+ Desktop dt = Desktop.getDesktop();
+ if (dt != null)
+ dt.open(file);
+ }
+ } else {
+ JOptionPane.showConfirmDialog(null, "Failed to create script at " + file.getAbsolutePath()
+ + " !", "Conversation Script Creator", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
+ }
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+
+ }
+}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileWizardPanel1.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileWizardPanel1.java
new file mode 100644
index 0000000..3deb593
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileWizardPanel1.java
@@ -0,0 +1,132 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.projectswg.tools.csc.conversationeditor.wizard;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+import javax.swing.JTree;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import org.openide.WizardDescriptor;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbPreferences;
+
+public class CompileWizardPanel1 implements WizardDescriptor.Panel, TreeSelectionListener {
+
+ private CompileVisualPanel1 component;
+
+ private boolean valid = true;
+
+ private final Set listeners = new HashSet<>(1);
+
+ public CompileWizardPanel1() {
+ valid = false;
+ }
+
+ @Override
+ public CompileVisualPanel1 getComponent() {
+ if (component == null) {
+ component = new CompileVisualPanel1();
+ component.getScriptFolderTree().addTreeSelectionListener(this);
+ }
+ return component;
+ }
+
+ @Override
+ public HelpCtx getHelp() {
+ // Show no Help button for this panel:
+ return HelpCtx.DEFAULT_HELP;
+ // If you have context help:
+ // return new HelpCtx("help.key.here");
+ }
+
+ @Override
+ public boolean isValid() {
+ System.out.println("dafd" + valid);
+ return valid;
+ }
+
+ private void setValid(boolean val) {
+ if (val == valid)
+ return;
+
+ valid = val;
+ fireChangeEvent();
+ }
+
+ @Override
+ public void addChangeListener(ChangeListener l) {
+ listeners.add(l);
+ }
+
+ @Override
+ public void removeChangeListener(ChangeListener l) {
+ listeners.remove(l);
+ }
+
+ protected final void fireChangeEvent() {
+ ChangeEvent event = new ChangeEvent(this);
+
+ for (ChangeListener l : listeners) {
+ l.stateChanged(event);
+ }
+ }
+
+ @Override
+ public void readSettings(WizardDescriptor wiz) {
+ Object tree = wiz.getProperty("tree");
+
+ if (tree != null) {
+ component.setScriptsTree((JTree) tree);
+ } else {
+
+ Object scripts = wiz.getProperty("directory");
+
+ if (scripts == null) {
+ scripts = NbPreferences.forModule(CompileWizardPanel1.class).get("directory", "");
+
+ if (scripts == "") {
+ return;
+ }
+ }
+
+ File dir = new File(scripts.toString().split("conversation")[0] + "\\conversation");
+ if (!dir.exists()) {
+ return;
+ }
+
+ component.populateScriptsTree(dir);
+ }
+ }
+
+ @Override
+ public void storeSettings(WizardDescriptor wiz) {
+ wiz.putProperty("directory", component.getExportDirectory().getText());
+ NbPreferences.forModule(CompileWizardPanel1.class).put("directory", component.getExportDirectory().getText()); // persist across reloads
+
+ wiz.putProperty("tree", component.getScriptFolderTree());
+ }
+
+ @Override
+ public void valueChanged(TreeSelectionEvent e) {
+ if (e.getNewLeadSelectionPath() == null)
+ return;
+
+ Object[] path = e.getNewLeadSelectionPath().getPath();
+ String dir = component.getExportDirectory().getText().split("conversation")[0] + "conversation";
+
+ for (Object p : path) {
+ if (!p.toString().equals("scripts/conversation") && !dir.contains(p.toString()))
+ dir += "\\" +p.toString();
+ }
+ component.getExportDirectory().setText(dir);
+
+ setValid(true);
+ }
+}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileWizardPanel2.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileWizardPanel2.java
new file mode 100644
index 0000000..8523dbf
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/wizard/CompileWizardPanel2.java
@@ -0,0 +1,154 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.projectswg.tools.csc.conversationeditor.wizard;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import org.openide.WizardDescriptor;
+import org.openide.WizardValidationException;
+import org.openide.util.HelpCtx;
+
+public class CompileWizardPanel2 implements WizardDescriptor.ValidatingPanel, DocumentListener {
+
+ /**
+ * The visual component that displays this panel. If you need to access the component from this class, just use getComponent().
+ */
+ private CompileVisualPanel2 component;
+ private boolean valid = false;
+ private final Set listeners = new HashSet<>(1);
+
+ // Get the visual component for the panel. In this template, the component
+ // is kept separate. This can be more efficient: if the wizard is created
+ // but never displayed, or not all panels are displayed, it is better to
+ // create only those which really need to be visible.
+ @Override
+ public CompileVisualPanel2 getComponent() {
+ if (component == null) {
+ component = new CompileVisualPanel2();
+ component.getTbScriptName().getDocument().addDocumentListener(this);
+ }
+ return component;
+ }
+
+ @Override
+ public HelpCtx getHelp() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ @Override
+ public boolean isValid() {
+ System.out.println(valid);
+ return valid;
+ }
+
+ public void setValid(boolean val) {
+
+ if (valid == val)
+ return;
+
+ this.valid = val;
+ fireChangeEvent();
+ }
+
+ protected final void fireChangeEvent() {
+ ChangeEvent event = new ChangeEvent(this);
+
+ for (ChangeListener l : listeners) {
+ l.stateChanged(event);
+ }
+ }
+
+ @Override
+ public void addChangeListener(ChangeListener l) {
+ listeners.add(l);
+ }
+
+ @Override
+ public void removeChangeListener(ChangeListener l) {
+ listeners.remove(l);
+ }
+
+ @Override
+ public void readSettings(WizardDescriptor wiz) {
+ Object indents = wiz.getProperty("indent");
+ if (indents == null || indents.toString().equals("tabs"))
+ component.getRadioTabs().setSelected(true);
+ else
+ component.getRadioSpaces().setSelected(true);
+
+ Object comments = wiz.getProperty("comments");
+ if (comments == null) {
+
+ } else {
+ component.getChkbxComments().setSelected(Boolean.valueOf(comments.toString()));
+ }
+
+ Object header = wiz.getProperty("header");
+ if (header == null) {
+
+ } else {
+ component.getTxtAreaHeader().setText(header.toString());
+ }
+
+ Object sName = wiz.getProperty("script");
+
+ if (sName == null) {
+ // TODO: Use scene name
+ } else {
+ component.getTbScriptName().setText(sName.toString());
+ valid = true;
+ }
+ }
+
+ @Override
+ public void storeSettings(WizardDescriptor wiz) {
+
+ if (component.getRadioTabs().isSelected())
+ wiz.putProperty("indent", "tabs");
+ else
+ wiz.putProperty("indent", "spaces");
+
+ wiz.putProperty("comments", component.getChkbxComments().isSelected());
+ wiz.putProperty("header", component.getTxtAreaHeader().getText());
+ wiz.putProperty("script", component.getTbScriptName().getText());
+ }
+
+ private void checkText() {
+ if (!component.getTbScriptName().getText().endsWith(".py")) {
+ setValid(false);
+ } else {
+ setValid(true);
+ }
+ }
+
+ @Override
+ public void insertUpdate(DocumentEvent e) {
+ checkText();
+ }
+
+ @Override
+ public void removeUpdate(DocumentEvent e) {
+ checkText();
+ }
+
+ @Override
+ public void changedUpdate(DocumentEvent e) {
+ checkText();
+ }
+
+ @Override
+ public void validate() throws WizardValidationException {
+ if (!component.getTbScriptName().getText().endsWith(".py")) {
+ valid = false;
+ throw new WizardValidationException(null, "The script name must end with the .py extension.", null);
+ }
+ }
+
+}
diff --git a/nbproject/project.properties b/nbproject/project.properties
index bf83641..782fb1d 100644
--- a/nbproject/project.properties
+++ b/nbproject/project.properties
@@ -9,7 +9,5 @@ auxiliary.org-netbeans-modules-apisupport-installer.os-windows=true
auxiliary.org-netbeans-modules-apisupport-installer.pack200-enabled=false
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
modules=\
- ${project.com.projectswg.tools.csc.conversationeditor}:\
- ${project.com.projectswg.tools.csc.compiler}
-project.com.projectswg.tools.csc.compiler=ConversationCompiler
+ ${project.com.projectswg.tools.csc.conversationeditor}
project.com.projectswg.tools.csc.conversationeditor=ConversationEditor