mirror of
https://github.com/ProjectSWGCore/ConversationScriptCreator.git
synced 2026-01-16 23:05:01 -05:00
Fixed persistence issues when restarting the program, Improved the compile wizard allowing indent settings and comment settings, Fixed end conversations not being generated properly.
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
|
||||
<!-- for some information on what you could do (e.g. targets to override). -->
|
||||
<!-- If you delete this file and reopen the project it will be recreated. -->
|
||||
<project name="com.projectswg.tools.csc.compiler" default="netbeans" basedir=".">
|
||||
<description>Builds, tests, and runs the project com.projectswg.tools.csc.compiler.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
</project>
|
||||
@@ -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
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
*** GENERATED FROM project.xml - DO NOT EDIT ***
|
||||
*** EDIT ../build.xml INSTEAD ***
|
||||
-->
|
||||
<project name="com.projectswg.tools.csc.compiler-impl" basedir="..">
|
||||
<fail message="Please build using Ant 1.7.1 or higher.">
|
||||
<condition>
|
||||
<not>
|
||||
<antversion atleast="1.7.1"/>
|
||||
</not>
|
||||
</condition>
|
||||
</fail>
|
||||
<property file="nbproject/private/suite-private.properties"/>
|
||||
<property file="nbproject/suite.properties"/>
|
||||
<fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
|
||||
<property file="${suite.dir}/nbproject/private/platform-private.properties"/>
|
||||
<property file="${suite.dir}/nbproject/platform.properties"/>
|
||||
<macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
|
||||
<attribute name="name"/>
|
||||
<attribute name="value"/>
|
||||
<sequential>
|
||||
<property name="@{name}" value="${@{value}}"/>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
<macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
|
||||
<attribute name="property"/>
|
||||
<attribute name="value"/>
|
||||
<sequential>
|
||||
<property name="@{property}" value="@{value}"/>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
<property file="${user.properties.file}"/>
|
||||
<nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
|
||||
<nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
|
||||
<nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
|
||||
<fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
|
||||
<condition>
|
||||
<not>
|
||||
<contains string="${cluster.path.evaluated}" substring="platform"/>
|
||||
</not>
|
||||
</condition>
|
||||
</fail>
|
||||
<import file="${harness.dir}/build.xml"/>
|
||||
</project>
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -1,69 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.apisupport.project</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
|
||||
<code-name-base>com.projectswg.tools.csc.compiler</code-name-base>
|
||||
<suite-component/>
|
||||
<module-dependencies>
|
||||
<dependency>
|
||||
<code-name-base>com.projectswg.tools.csc.conversationeditor</code-name-base>
|
||||
<build-prerequisite/>
|
||||
<compile-dependency/>
|
||||
<run-dependency>
|
||||
<specification-version>1.0</specification-version>
|
||||
</run-dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<code-name-base>org.netbeans.api.visual</code-name-base>
|
||||
<build-prerequisite/>
|
||||
<compile-dependency/>
|
||||
<run-dependency>
|
||||
<specification-version>2.42.1</specification-version>
|
||||
</run-dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<code-name-base>org.openide.awt</code-name-base>
|
||||
<build-prerequisite/>
|
||||
<compile-dependency/>
|
||||
<run-dependency>
|
||||
<specification-version>7.61.2</specification-version>
|
||||
</run-dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<code-name-base>org.openide.dialogs</code-name-base>
|
||||
<build-prerequisite/>
|
||||
<compile-dependency/>
|
||||
<run-dependency>
|
||||
<specification-version>7.36.1</specification-version>
|
||||
</run-dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<code-name-base>org.openide.nodes</code-name-base>
|
||||
<build-prerequisite/>
|
||||
<compile-dependency/>
|
||||
<run-dependency>
|
||||
<specification-version>7.38.1</specification-version>
|
||||
</run-dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<code-name-base>org.openide.util</code-name-base>
|
||||
<build-prerequisite/>
|
||||
<compile-dependency/>
|
||||
<run-dependency>
|
||||
<specification-version>8.37.1</specification-version>
|
||||
</run-dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<code-name-base>org.openide.windows</code-name-base>
|
||||
<build-prerequisite/>
|
||||
<compile-dependency/>
|
||||
<run-dependency>
|
||||
<specification-version>6.70.1</specification-version>
|
||||
</run-dependency>
|
||||
</dependency>
|
||||
</module-dependencies>
|
||||
<public-packages/>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
||||
@@ -1 +0,0 @@
|
||||
suite.dir=${basedir}/..
|
||||
@@ -1 +0,0 @@
|
||||
OpenIDE-Module-Name=Conversation Compiler
|
||||
@@ -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=
|
||||
@@ -1,158 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.4" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="txtName" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtBuildLoc" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="txtLocation" min="-2" pref="266" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnBrowse" min="-2" pref="75" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel4" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="btnBrowse" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="txtLocation" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
|
||||
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="txtName" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="48" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="txtBuildLoc" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="124" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/compiler/wizard/Bundle.properties" key="CompileVisualPanel1.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="txtLocation">
|
||||
<Properties>
|
||||
<Property name="editable" type="boolean" value="false"/>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/compiler/wizard/Bundle.properties" key="CompileVisualPanel1.txtLocation.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnBrowse">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/compiler/wizard/Bundle.properties" key="CompileVisualPanel1.btnBrowse.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnBrowseActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
|
||||
<ComponentRef name="txtLocation"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/compiler/wizard/Bundle.properties" key="CompileVisualPanel1.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/compiler/wizard/Bundle.properties" key="CompileVisualPanel1.jLabel3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="txtName">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/compiler/wizard/Bundle.properties" key="CompileVisualPanel1.txtName.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="txtNameKeyTyped"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel4">
|
||||
<Properties>
|
||||
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
|
||||
<ComponentRef name="txtName"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/compiler/wizard/Bundle.properties" key="CompileVisualPanel1.jLabel4.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel5">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/compiler/wizard/Bundle.properties" key="CompileVisualPanel1.jLabel5.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="txtBuildLoc">
|
||||
<Properties>
|
||||
<Property name="editable" type="boolean" value="false"/>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/compiler/wizard/Bundle.properties" key="CompileVisualPanel1.txtBuildLoc.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -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.
|
||||
*/
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//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))
|
||||
);
|
||||
}// </editor-fold>//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
|
||||
}
|
||||
@@ -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<WizardDescriptor.Panel<WizardDescriptor>> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<WizardDescriptor> {
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 31 KiB |
@@ -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<ConversationNode, ArrayList<ConversationNode>> conversationLinks = scene.getConversationLinks();
|
||||
|
||||
for (Map.Entry<ConversationNode, ArrayList<ConversationNode>> 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<ConversationNode, ArrayList<ConversationNode>> conversationLinks) throws IOException {
|
||||
|
||||
LinkedHashMap<ConversationNode, ArrayList<ConversationNode>> 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<ConversationNode, ArrayList<ConversationNode>> 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<ConversationNode> options, int handleScreenNum,
|
||||
LinkedHashMap<ConversationNode, ArrayList<ConversationNode>> 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<ConversationNode> 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;
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,6 @@ public class SceneSaver {
|
||||
@Override
|
||||
public void run() {
|
||||
deserializeNodeDataVersion1(scene, sceneXMLNode);
|
||||
scene.validate ();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ public class SceneView extends GraphScene<ConversationNode, String>{
|
||||
|
||||
private String name = "";
|
||||
private String scenePath = "";
|
||||
private boolean loaded = false;
|
||||
|
||||
private int id = 1;
|
||||
|
||||
@@ -35,11 +36,11 @@ public class SceneView extends GraphScene<ConversationNode, String>{
|
||||
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<ConversationNode, String>{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setLoaded(boolean loaded) {
|
||||
this.loaded = loaded;
|
||||
}
|
||||
|
||||
public boolean isLoaded() {
|
||||
return loaded;
|
||||
}
|
||||
|
||||
public LinkedHashMap<ConversationNode, ArrayList<ConversationNode>> getConversationLinks() {
|
||||
List<Widget> connectedNodes = connectionLayer.getChildren();
|
||||
LinkedHashMap<ConversationNode, ArrayList<ConversationNode>> conversationLinks = new LinkedHashMap<>();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
})
|
||||
|
||||
@@ -9,11 +9,22 @@
|
||||
<file name="Debug_hidden"/>
|
||||
<file name="Diff_hidden"/>
|
||||
<folder name="Edit">
|
||||
<file name="com-projectswg-tools-csc-conversationeditor-actions-NewConvOption.instance_hidden"/>
|
||||
<file name="org-netbeans-core-ui-options-filetypes-OpenAsAction.instance_hidden"/>
|
||||
<file name="org-netbeans-core-ui-sysopen-SystemOpenAction.instance_hidden"/>
|
||||
<file name="org-netbeans-modules-quicksearch-QuickSearchAction.instance_hidden"/>
|
||||
<file name="org-netbeans-modules-search-FindInFilesAction.instance_hidden"/>
|
||||
<file name="org-netbeans-modules-search-ReplaceInFilesAction.instance_hidden"/>
|
||||
<file name="org-openide-actions-CopyAction.instance_hidden"/>
|
||||
<file name="org-openide-actions-CutAction.instance_hidden"/>
|
||||
<file name="org-openide-actions-DeleteAction.instance_hidden"/>
|
||||
<file name="org-openide-actions-FindAction.instance_hidden"/>
|
||||
<file name="org-openide-actions-GotoAction.instance_hidden"/>
|
||||
<file name="org-openide-actions-PasteAction.instance_hidden"/>
|
||||
<file name="org-openide-actions-RedoAction.instance_hidden"/>
|
||||
<file name="org-openide-actions-ReplaceAction.instance_hidden"/>
|
||||
<file name="org-openide-actions-UndoAction.instance_hidden"/>
|
||||
</folder>
|
||||
<folder name="File">
|
||||
<file name="com-projectswg-tools-csc-conversationeditor-actions-CompileConvScript.instance_hidden"/>
|
||||
<file name="com-projectswg-tools-csc-conversationeditor-actions-NewConvEnd.instance_hidden"/>
|
||||
<file name="org-netbeans-modules-print-action-PageSetupAction.instance_hidden"/>
|
||||
<file name="org-netbeans-modules-print-action-PrintAction.instance_hidden"/>
|
||||
<file name="org-netbeans-modules-project-ui-actions-CloseAllProjectsAction.instance_hidden"/>
|
||||
|
||||
@@ -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!
|
||||
@@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.7" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="tbExportDirectory" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btnChngScriptsLoc" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="tbExportDirectory" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" min="-2" pref="286" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnChngScriptsLoc" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/wizard/Bundle.properties" key="CompileVisualPanel1.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTree" name="scriptsTree">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.tree.TreeModel" editor="org.netbeans.modules.form.editors2.TreeModelEditor">
|
||||
<TreeModel code="scripts/conversation

 "/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="btnChngScriptsLoc">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/wizard/Bundle.properties" key="CompileVisualPanel1.btnChngScriptsLoc.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/wizard/Bundle.properties" key="CompileVisualPanel1.btnChngScriptsLoc.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnChngScriptsLocActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/wizard/Bundle.properties" key="CompileVisualPanel1.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="tbExportDirectory">
|
||||
<Properties>
|
||||
<Property name="editable" type="boolean" value="false"/>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/wizard/Bundle.properties" key="CompileVisualPanel1.tbExportDirectory.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -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.
|
||||
*/
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//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))
|
||||
);
|
||||
}// </editor-fold>//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
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.4" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<NonVisualComponents>
|
||||
<Component class="javax.swing.ButtonGroup" name="radialIndentation">
|
||||
</Component>
|
||||
</NonVisualComponents>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="36" max="-2" attributes="0"/>
|
||||
<Component id="radioSpaces" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="radioTabs" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="chkbxComments" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" alignment="1" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="tbScriptName" min="-2" pref="164" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="144" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="31" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="radioSpaces" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="radioTabs" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="chkbxComments" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="tbScriptName" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" min="-2" pref="118" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/wizard/Bundle.properties" key="CompileVisualPanel2.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/wizard/Bundle.properties" key="CompileVisualPanel2.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="radioSpaces">
|
||||
<Properties>
|
||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||
<ComponentRef name="radialIndentation"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/wizard/Bundle.properties" key="CompileVisualPanel2.radioSpaces.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="radioTabs">
|
||||
<Properties>
|
||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||
<ComponentRef name="radialIndentation"/>
|
||||
</Property>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/wizard/Bundle.properties" key="CompileVisualPanel2.radioTabs.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="chkbxComments">
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/wizard/Bundle.properties" key="CompileVisualPanel2.chkbxComments.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="chkbxCommentsItemStateChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextArea" name="txtAreaHeader">
|
||||
<Properties>
|
||||
<Property name="columns" type="int" value="20"/>
|
||||
<Property name="rows" type="int" value="5"/>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/wizard/Bundle.properties" key="CompileVisualPanel2.txtAreaHeader.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/wizard/Bundle.properties" key="CompileVisualPanel2.jLabel3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel4">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/wizard/Bundle.properties" key="CompileVisualPanel2.jLabel4.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="tbScriptName">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/wizard/Bundle.properties" key="CompileVisualPanel2.tbScriptName.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel5">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/wizard/Bundle.properties" key="CompileVisualPanel2.jLabel5.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@@ -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.
|
||||
*/
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//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())
|
||||
);
|
||||
}// </editor-fold>//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
|
||||
}
|
||||
@@ -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<WizardDescriptor.Panel<WizardDescriptor>> 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<WizardDescriptor>, TreeSelectionListener {
|
||||
|
||||
private CompileVisualPanel1 component;
|
||||
|
||||
private boolean valid = true;
|
||||
|
||||
private final Set<ChangeListener> 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);
|
||||
}
|
||||
}
|
||||
@@ -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<WizardDescriptor>, 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<ChangeListener> 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user