Added creator files

This commit is contained in:
Waverunner
2014-09-08 13:25:39 -04:00
parent 996e45e8e5
commit 3637c5abc1
59 changed files with 2150 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
<?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>

View File

@@ -0,0 +1,5 @@
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

View File

@@ -0,0 +1,45 @@
<?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>

View File

@@ -0,0 +1,8 @@
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

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/C:/Users/Wave/Documents/NetBeansProjects/ConversationScriptCreator/ConversationCompiler/src/com/projectswg/tools/csc/compiler/Compiler.java</file>
</group>
</open-files>
</project-private>

View File

@@ -0,0 +1,2 @@
javac.source=1.7
javac.compilerargs=-Xlint -Xlint:-serial

View File

@@ -0,0 +1,69 @@
<?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>

View File

@@ -0,0 +1 @@
suite.dir=${basedir}/..

View File

@@ -0,0 +1 @@
OpenIDE-Module-Name=Conversation Compiler

View File

@@ -0,0 +1,179 @@
package com.projectswg.tools.csc.compiler;
import com.projectswg.tools.csc.conversationeditor.ConversationNode;
import com.projectswg.tools.csc.conversationeditor.ConversationWidget;
import com.projectswg.tools.csc.conversationeditor.EditorTopComponent;
import com.projectswg.tools.csc.conversationeditor.SceneView;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.swing.JOptionPane;
import org.netbeans.api.visual.widget.ConnectionWidget;
import org.netbeans.api.visual.widget.Widget;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
public class Compiler {
private final File file;
public Compiler(File file) {
this.file = file;
}
public void compile() throws IOException {
TopComponent component = WindowManager.getDefault().findTopComponent("EditorTopComponent");
if (component == null || !(component instanceof EditorTopComponent))
return;
EditorTopComponent editor = (EditorTopComponent) component;
SceneView scene = editor.getScene();
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;
}
try (BufferedWriter bw = new BufferedWriter(new FileWriter(file.getAbsolutePath()))) {
createBaseFile(bw);
List<Widget> connectedNodes = scene.getConnectionLayer().getChildren();
LinkedHashMap<ConversationNode, ArrayList<ConversationNode>> conversationLinks = new LinkedHashMap<>();
for (Widget widget : connectedNodes) {
ConnectionWidget connection = (ConnectionWidget) widget;
ConversationWidget source = (ConversationWidget) connection.getSourceAnchor().getRelatedWidget();
ConversationNode sNode = source.getAttachedNode();
if (!conversationLinks.containsKey(sNode)) {
conversationLinks.put(sNode, new ArrayList<ConversationNode>());
}
ConversationWidget target = (ConversationWidget) connection.getTargetAnchor().getRelatedWidget();
ConversationNode tNode = target.getAttachedNode();
if (conversationLinks.containsKey(sNode))
conversationLinks.get(sNode).add(tNode);
else
System.out.println("No key for node " + sNode.getStf());
//System.out.println("This connection widget came from " + sNode.getStf() + " and is pointing to " + tNode.getStf());
//compiler.compileTarget(tNode);
}
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;
}
}
}
}
private void createBaseFile(BufferedWriter bw) throws IOException {
bw.write("# Base file generated using Conversation Script Creator for ProjectSWG\n");
bw.write("from resources.common import ConversationOption\n" +
"from resources.common import OutOfBand\n" +
"from resources.common import ProsePackage\n" +
"from java.util import Vector\n");
bw.newLine();
bw.write("import sys\n");
bw.newLine();
bw.write("def startConversation(core, actor, npc):\n");
}
private void createResponseHandler(BufferedWriter bw, ArrayList<ConversationNode> options, int handleNum,
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();
int count = handleNum + 1;
for (ConversationNode selectedOption : options) {
bw.write(" " + (options.indexOf(selectedOption) > 0 ? "elif" : "if") + " selection == " + options.indexOf(selectedOption) + ":\n");
if (conversationLinks.containsKey(selectedOption)) {
bw.write(" #Handler for Option " + selectedOption.getStf() + "\n");
for (ConversationNode handleNode : conversationLinks.get(selectedOption)) {
if (!handleNode.isOption()) {
if (conversationLinks.get(handleNode) == null) {
bw.write(" core.conversationService.sendStopConversation(actor, npc, 'conversation/c_newbie_secondchance', 's_136')\n");
} else {
createOptions(bw, conversationLinks.get(handleNode), count++, " ");
bw.write(" core.conversationService.sendConversationMessage(actor, npc, OutOfBand.ProsePackage('@" + handleNode.getStf() + "')\n");
handleFuncs.put(handleNode, conversationLinks.get(handleNode)); // Put these nodes in list so we can create the handlers later.
}
}
}
}
bw.write(" return\n");
bw.newLine();
}
bw.write(" return\n");
bw.newLine();
int currentHandler = handleNum + 1;
for (Map.Entry<ConversationNode, ArrayList<ConversationNode>> handleNode : handleFuncs.entrySet()) {
createResponseHandler(bw, handleNode.getValue(), currentHandler++, conversationLinks);
}
}
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");
if (options.size() > 1) {
ArrayList<ConversationNode> orderedOptions = new ArrayList<>();
for (ConversationNode unOrdered : options) {
orderedOptions.add(unOrdered.getOptionId(), unOrdered);
}
for (ConversationNode option : orderedOptions) {
bw.write(" options.add(ConversationOption(OutOfBand.ProsePackage('@" + option.getStf() +"'), " + options.indexOf(option) + ")\n");
}
} else {
for (ConversationNode option : options) {
bw.write(" options.add(ConversationOption(OutOfBand.ProsePackage('@" + 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('@" + response.getStf() + "'))\n");
bw.write(" return\n");
bw.newLine();
createResponseHandler(bw, options, handleScreenNum, conversationLinks);
}
private void createOptions(BufferedWriter bw, ArrayList<ConversationNode> options, int handleScreenNum, String space) throws IOException {
bw.write(space + "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 : orderedOptions) {
bw.write(space + "options.add(ConversationOption(OutOfBand.ProsePackage('@" + option.getStf() +"'), " + options.indexOf(option) + ")\n");
}
} else {
for (ConversationNode option : options) {
bw.write(space + "options.add(ConversationOption(OutOfBand.ProsePackage('@" + option.getStf() +"'), " + options.indexOf(option) + ")\n");
}
}
bw.write(space + "core.conversationService.sendConversationOptions(actor, npc, handleOptionScreen" + String.valueOf(handleScreenNum) + ")\n");
}
}

View File

@@ -0,0 +1,9 @@
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=

View File

@@ -0,0 +1,158 @@
<?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, &quot;{key}&quot;)"/>
</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, &quot;{key}&quot;)"/>
</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, &quot;{key}&quot;)"/>
</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, &quot;{key}&quot;)"/>
</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, &quot;{key}&quot;)"/>
</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, &quot;{key}&quot;)"/>
</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, &quot;{key}&quot;)"/>
</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, &quot;{key}&quot;)"/>
</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, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@@ -0,0 +1,155 @@
/*
* 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
}

View File

@@ -0,0 +1,72 @@
/*
* 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);
}
}
}
}
}

View File

@@ -0,0 +1,63 @@
/*
* 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.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -0,0 +1,8 @@
<?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.conversationeditor" default="netbeans" basedir=".">
<description>Builds, tests, and runs the project com.projectswg.tools.csc.conversationeditor.</description>
<import file="nbproject/build-impl.xml"/>
</project>

View File

@@ -0,0 +1,7 @@
Manifest-Version: 1.0
OpenIDE-Module: com.projectswg.tools.csc.conversationeditor
OpenIDE-Module-Layer: com/projectswg/tools/csc/conversationeditor/layer.xml
OpenIDE-Module-Localizing-Bundle: com/projectswg/tools/csc/conversationeditor/Bundle.properties
OpenIDE-Module-Requires: org.openide.windows.WindowManager
OpenIDE-Module-Specification-Version: 1.0

View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
-->
<project name="com.projectswg.tools.csc.conversationeditor-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>

View File

@@ -0,0 +1,8 @@
build.xml.data.CRC32=90d565b1
build.xml.script.CRC32=af729615
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=90d565b1
nbproject/build-impl.xml.script.CRC32=b2a11926
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.66.1

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/C:/Users/Wave/Documents/NetBeansProjects/ConversationScriptCreator/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/ConversationConnectProvider.java</file>
<file>file:/C:/Users/Wave/Documents/NetBeansProjects/ConversationScriptCreator/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/ConversationNode.java</file>
<file>file:/C:/Users/Wave/Documents/NetBeansProjects/ConversationScriptCreator/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/ConversationWidget.java</file>
<file>file:/C:/Users/Wave/Documents/NetBeansProjects/ConversationScriptCreator/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvEnd.java</file>
</group>
</open-files>
</project-private>

View File

@@ -0,0 +1,2 @@
javac.source=1.7
javac.compilerargs=-Xlint -Xlint:-serial

View File

@@ -0,0 +1,90 @@
<?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.conversationeditor</code-name-base>
<suite-component/>
<module-dependencies>
<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.netbeans.modules.options.api</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.39.1</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.netbeans.modules.settings</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<release-version>1</release-version>
<specification-version>1.44.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.explorer</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>6.56.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.util.lookup</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>8.24.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>
<package>com.projectswg.tools.csc.conversationeditor</package>
<package>com.projectswg.tools.csc.conversationeditor.actions</package>
</public-packages>
</data>
</configuration>
</project>

View File

@@ -0,0 +1 @@
suite.dir=${basedir}/..

View File

@@ -0,0 +1,8 @@
OpenIDE-Module-Display-Category=Tools
OpenIDE-Module-Long-Description=\
This is the visual editor that allows a visual representation of conversations in SWG based off of supported scripting formats.
OpenIDE-Module-Name=Conversation Editor
OpenIDE-Module-Short-Description=Visual editor for SWG conversations
GeneralPanel.jLabel1.text=Compile Location
GeneralPanel.jTextField1.text=C:/conversation_script.py
GeneralPanel.jButton1.text=Browse

View File

@@ -0,0 +1,58 @@
package com.projectswg.tools.csc.conversationeditor;
import java.awt.Point;
import javax.swing.JOptionPane;
import org.netbeans.api.visual.action.ConnectProvider;
import org.netbeans.api.visual.action.ConnectorState;
import org.netbeans.api.visual.anchor.AnchorFactory;
import org.netbeans.api.visual.anchor.AnchorShape;
import org.netbeans.api.visual.widget.ConnectionWidget;
import org.netbeans.api.visual.widget.Scene;
import org.netbeans.api.visual.widget.Widget;
public class ConversationConnectProvider implements ConnectProvider {
private final SceneView scene;
public ConversationConnectProvider(SceneView scene) {
this.scene = scene;
}
@Override
public boolean isSourceWidget(Widget source) {
return source instanceof ConversationWidget;
}
@Override
public ConnectorState isTargetWidget(Widget source, Widget target) {
return source != target && target instanceof ConversationWidget ? ConnectorState.ACCEPT : ConnectorState.REJECT;
}
@Override
public boolean hasCustomTargetWidgetResolver(Scene scene) {
return false;
}
@Override
public Widget resolveTargetWidget(Scene scene, Point point) {
return null;
}
@Override
public void createConnection(Widget source, Widget target) {
if (source instanceof ConversationWidget && target instanceof ConversationWidget) {
if (((ConversationWidget)source).getAttachedNode().isEndNode()) {
JOptionPane.showMessageDialog(null, "Cannot attach end conversation node to responses/options!", "Conversation Script Creator", JOptionPane.INFORMATION_MESSAGE);
return;
}
ConnectionWidget conn = new ConnectionWidget(scene);
conn.setTargetAnchorShape(AnchorShape.TRIANGLE_FILLED);
conn.setTargetAnchor(AnchorFactory.createRectangularAnchor(target));
conn.setSourceAnchor(AnchorFactory.createRectangularAnchor(source));
scene.getConnectionLayer().addChild(conn);
((ConversationWidget)source).getAttachedNode().setCompiled(false);
((ConversationWidget)target).getAttachedNode().setCompiled(false);
}
}
}

View File

@@ -0,0 +1,95 @@
package com.projectswg.tools.csc.conversationeditor;
import java.awt.Color;
import java.awt.Paint;
import org.netbeans.api.visual.border.Border;
import org.netbeans.api.visual.border.BorderFactory;
import org.netbeans.api.visual.laf.LookFeel;
import org.netbeans.api.visual.model.ObjectState;
public class ConversationLookFeel extends LookFeel{
private static final Color COLOR_SELECTED = new Color (0x447BCD);
private static final Color COLOR_HIGHLIGHTED = COLOR_SELECTED.darker ();
private static final Color COLOR_HOVERED = new Color (0x52E544);
private static final Color LINE_COLOR = new Color (0x466f16);
private static final int MARGIN = 3;
private static final int ARC = 10;
private static final int MINI_THICKNESS = 1;
private static final Border BORDER_NORMAL = BorderFactory.createEmptyBorder (MARGIN, MARGIN);
private static final Border BORDER_HOVERED = BorderFactory.createRoundedBorder (ARC, ARC, MARGIN, MARGIN, COLOR_HOVERED, COLOR_HOVERED.darker ());
private static final Border BORDER_SELECTED = BorderFactory.createRoundedBorder (ARC, ARC, MARGIN, MARGIN, COLOR_SELECTED, COLOR_SELECTED.darker ());
private static final Border MINI_BORDER_NORMAL = BorderFactory.createEmptyBorder (MINI_THICKNESS);
private static final Border MINI_BORDER_HOVERED = BorderFactory.createRoundedBorder (MINI_THICKNESS, MINI_THICKNESS, MINI_THICKNESS, MINI_THICKNESS, COLOR_HOVERED, COLOR_HOVERED.darker ());
private static final Border MINI_BORDER_SELECTED = BorderFactory.createRoundedBorder (MINI_THICKNESS, MINI_THICKNESS, MINI_THICKNESS, MINI_THICKNESS, COLOR_SELECTED, COLOR_SELECTED.darker ());
@Override
public Paint getBackground() {
return Color.BLACK;
}
@Override
public Color getForeground() {
return Color.BLACK;
}
@Override
public Border getBorder(ObjectState state) {
if (state.isHovered ())
return BORDER_HOVERED;
if (state.isSelected ())
return BORDER_SELECTED;
if (state.isFocused ())
return BORDER_HOVERED;
return BORDER_NORMAL;
}
@Override
public Border getMiniBorder (ObjectState state) {
if (state.isHovered ())
return MINI_BORDER_HOVERED;
if (state.isSelected ())
return MINI_BORDER_SELECTED;
if (state.isFocused ())
return MINI_BORDER_HOVERED;
return MINI_BORDER_NORMAL;
}
@Override
public boolean getOpaque (ObjectState state) {
return state.isHovered () || state.isSelected ();
}
@Override
public Color getLineColor (ObjectState state) {
if (state.isHovered ())
return COLOR_HOVERED;
if (state.isSelected ())
return COLOR_SELECTED;
if (state.isHighlighted () || state.isFocused ())
return COLOR_HIGHLIGHTED;
return Color.BLACK;
}
@Override
public Paint getBackground (ObjectState state) {
if (state.isHovered ())
return COLOR_HOVERED;
if (state.isSelected ())
return COLOR_SELECTED;
if (state.isHighlighted () || state.isFocused ())
return COLOR_HIGHLIGHTED;
return Color.WHITE;
}
@Override
public Color getForeground (ObjectState state) { // Determines LabelWidget's color
return state.isSelected () ? Color.BLACK : Color.WHITE;
}
@Override
public int getMargin () {
return MARGIN;
}
}

View File

@@ -0,0 +1,248 @@
package com.projectswg.tools.csc.conversationeditor;
import java.lang.reflect.InvocationTargetException;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.nodes.PropertySupport;
import org.openide.nodes.Sheet;
import org.openide.util.Lookup;
public class ConversationNode extends AbstractNode implements Lookup.Provider {
private final int id;
private int optionId;
private String displayText;
private String stf;
private boolean option;
private boolean locked;
private boolean compiled;
private boolean endNode;
private boolean startNode;
public ConversationNode(String stf, boolean isOption, int id, boolean isEndNode, boolean isStartNode, int optionId) {
super(Children.LEAF);
this.stf = stf;
this.option = isOption;
this.displayText = "";
this.id = id;
this.endNode = isEndNode;
this.startNode = isStartNode;
this.optionId = optionId;
// Properties Window
if (!isStartNode)
setDisplayName("Conversation " + ((isOption) ? "Option " + String.valueOf(id) : ((isEndNode) ? "End" : "Response " + String.valueOf(id))));
else
setDisplayName("Begin Conversation Node");
setShortDescription("Properties for this Conversation Node");
}
public String getStf() {
return stf;
}
public void setStf(String stf) {
firePropertyChange("stf", this.stf, stf);
this.stf = stf;
}
public String getDisplayText() {
return displayText;
}
public void setDisplayText(String displayText) {
firePropertyChange("display", this.displayText, displayText);
this.displayText = displayText;
}
public boolean isOption() {
return option;
}
public void setOption(boolean option) {
this.option = option;
}
public boolean isLocked() {
return locked;
}
public void setLocked(boolean locked) {
this.locked = locked;
}
public int getId() {
return id;
}
public boolean isCompiled() {
return compiled;
}
public void setCompiled(boolean compiled) {
this.compiled = compiled;
}
public boolean isEndNode() {
return endNode;
}
public void setEndNode(boolean endNode) {
this.endNode = endNode;
}
public boolean isStartNode() {
return this.startNode;
}
public void setStartNode(boolean startNode) {
this.startNode = startNode;
}
public int getOptionId() {
return this.optionId;
}
public void setOptionId(int optionId) {
this.optionId = optionId;
}
@Override
protected Sheet createSheet() {
Sheet sheet = super.createSheet();
Sheet.Set set = Sheet.createPropertiesSet();
set.put(new IdProperty(this));
set.put(new StfProperty(this));
set.put(new DisplayProperty(this));
if (!endNode) {
set.put(new TypeProperty(this));
if (option) {
set.put(new OptionIdProperty(this));
}
}
set.put(new LockedProperty(this));
sheet.put(set);
return sheet;
}
}
class OptionIdProperty extends PropertySupport.ReadWrite<Integer> {
private final ConversationNode node;
public OptionIdProperty(ConversationNode node) {
super("optionId", Integer.class, "Option ID", "ID used for displaying the order of this option in relation to the response (what option should show first in"
+ "list of options)");
this.node = node;
}
@Override
public Integer getValue() throws IllegalAccessException, InvocationTargetException {
return node.getOptionId();
}
@Override
public void setValue(Integer val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
node.setOptionId(val);
}
}
class IdProperty extends PropertySupport.ReadOnly<Integer> {
private final ConversationNode node;
public IdProperty(ConversationNode node) {
super("id", Integer.class, "Id", "Conversation Node Id");
this.node = node;
}
@Override
public Integer getValue() throws IllegalAccessException, InvocationTargetException {
return node.getId();
}
}
class StfProperty extends PropertySupport.ReadWrite<String> {
private final ConversationNode node;
public StfProperty(ConversationNode node) {
super("stf", String.class, "STF", "STF file for this conversation node. Ex: conversation/c_newbie_mentor:s_109");
this.setValue("oneline", true);
this.node = node;
}
@Override
public String getValue() throws IllegalAccessException, InvocationTargetException {
return node.getStf();
}
@Override
public void setValue(String val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
node.setStf(String.valueOf(val));
}
}
class TypeProperty extends PropertySupport.ReadOnly<Boolean> {
private final ConversationNode node;
public TypeProperty(ConversationNode node) {
super("option", Boolean.class, "Option", "The conversation node is a response or a option");
this.node = node;
}
@Override
public Boolean getValue() throws IllegalAccessException, InvocationTargetException {
return node.isOption();
}
@Override
public void setValue(Boolean val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
node.setOption(val);
}
}
class DisplayProperty extends PropertySupport.ReadWrite<String> {
private final ConversationNode node;
public DisplayProperty(ConversationNode node) {
super ("display", String.class, "Text", "Optional text. This won't affect anything and can be left blank.\n" +
"You can use this for entering the value of a key from the coresponding STF for quick reference.");
this.node = node;
}
@Override
public String getValue() throws IllegalAccessException, InvocationTargetException {
return node.getDisplayText();
}
@Override
public void setValue(String val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
node.setDisplayText(val);
}
}
class LockedProperty extends PropertySupport.ReadWrite<Boolean> {
private final ConversationNode node;
public LockedProperty(ConversationNode node) {
super("locked", Boolean.class, "Locked", "Determines if this node can be moved.");
this.node = node;
}
@Override
public Boolean getValue() throws IllegalAccessException, InvocationTargetException {
return node.isLocked();
}
@Override
public void setValue(Boolean val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
node.setLocked(val);
}
}

View File

@@ -0,0 +1,105 @@
package com.projectswg.tools.csc.conversationeditor;
import java.awt.Point;
import java.beans.PropertyVetoException;
import org.netbeans.api.visual.action.ActionFactory;
import org.netbeans.api.visual.action.MoveStrategy;
import org.netbeans.api.visual.action.SelectProvider;
import org.netbeans.api.visual.layout.LayoutFactory;
import org.netbeans.api.visual.widget.LabelWidget;
import org.netbeans.api.visual.widget.Widget;
import org.netbeans.api.visual.widget.general.IconNodeWidget;
import org.openide.explorer.ExplorerManager;
import org.openide.util.Exceptions;
import org.openide.util.ImageUtilities;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;
public class ConversationWidget extends IconNodeWidget implements LookupListener {
private final ConversationNode attachedNode;
private final ExplorerManager mgr;
public ConversationWidget(SceneView scene, final ExplorerManager mgr, final ConversationNode node, boolean endConversation) {
super(scene.getScene());
this.attachedNode = node;
this.mgr = mgr;
if (node.isEndNode()) {
setLabel(node.getStf());
setImage(ImageUtilities.loadImage("com/projectswg/tools/csc/conversationeditor/conversation_end.png"));
} else {
setLabel(node.getStf());
if (node.isStartNode()) {
setImage(ImageUtilities.loadImage("com/projectswg/tools/csc/conversationeditor/conversation_begin.png"));
} else {
setImage(node.isOption() ? ImageUtilities.loadImage("com/projectswg/tools/csc/conversationeditor/conversation_option.png")
: ImageUtilities.loadImage("com/projectswg/tools/csc/conversationeditor/conversation_response.png"));
}
}
// Alignment/pos/ori
getLabelWidget().setAlignment(LabelWidget.Alignment.CENTER);
setLayout(LayoutFactory.createOverlayLayout());
// Add Actions
getActions().addAction(ActionFactory.createExtendedConnectAction(scene.getConnectionLayer(), new ConversationConnectProvider(scene)));
getActions().addAction(ActionFactory.createMoveAction(new MoveStrategy() {
@Override
public Point locationSuggested(Widget widget, Point originalLocation, Point suggestedLocation) {
if (!(widget instanceof ConversationWidget))
return suggestedLocation;
if (((ConversationWidget) widget).getAttachedNode().isLocked())
return originalLocation;
return suggestedLocation;
}
}, ActionFactory.createDefaultMoveProvider()));
getActions().addAction(ActionFactory.createSelectAction(new SelectProvider() {
@Override
public boolean isAimingAllowed(Widget widget, Point point, boolean bln) {
return true;
}
@Override
public boolean isSelectionAllowed(Widget widget, Point point, boolean bln) {
return true;
}
@Override
public void select(Widget widget, Point point, boolean bln) {
if (!(widget instanceof ConversationWidget))
return;
ConversationWidget convWidget = (ConversationWidget) widget;
ConversationNode convNode = convWidget.getAttachedNode();
convWidget.getExpManager().setRootContext(convNode);
ConversationNode[] nodes = new ConversationNode[1];
nodes[0] = node;
try {
convWidget.getExpManager().setSelectedNodes(nodes);
} catch (PropertyVetoException ex) {
Exceptions.printStackTrace(ex);
}
}
}, true));
}
public ConversationNode getAttachedNode() {
return attachedNode;
}
public ExplorerManager getExpManager() {
return mgr;
}
@Override
public void resultChanged(LookupEvent ev) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}

View File

@@ -0,0 +1,34 @@
<?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">
<Component id="scrollPane" alignment="0" pref="400" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="scrollPane" alignment="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="scrollPane">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
</Container>
</SubComponents>
</Form>

View File

@@ -0,0 +1,120 @@
package com.projectswg.tools.csc.conversationeditor;
import org.netbeans.api.settings.ConvertAsProperties;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.explorer.ExplorerManager;
import org.openide.explorer.ExplorerUtils;
import org.openide.util.NbBundle.Messages;
import org.openide.windows.TopComponent;
/**
* Top component which displays something.
*/
@ConvertAsProperties(
dtd = "-//com.projectswg.tools.csc.conversationeditor//Editor//EN",
autostore = false
)
@TopComponent.Description(
preferredID = "EditorTopComponent",
//iconBase="SET/PATH/TO/ICON/HERE",
persistenceType = TopComponent.PERSISTENCE_ALWAYS
)
@TopComponent.Registration(mode = "editor", openAtStartup = true)
@ActionID(category = "Window", id = "com.projectswg.tools.csc.conversationeditor.EditorTopComponent")
@ActionReference(path = "Menu/Window" /*, position = 333 */)
@TopComponent.OpenActionRegistration(
displayName = "Conversastion Editor",
preferredID = "EditorTopComponent"
)
@Messages({
"CTL_EditorAction=Conversation Editor",
"CTL_EditorTopComponent=Conversation Editor",
"HINT_EditorTopComponent=Conversation Editor window"
})
public final class EditorTopComponent extends TopComponent implements ExplorerManager.Provider {
private final ExplorerManager mgr = new ExplorerManager();
private final SceneView scene;
public EditorTopComponent() {
initComponents();
setName(Bundle.CTL_EditorTopComponent());
setToolTipText(Bundle.HINT_EditorTopComponent());
SceneView scene = new SceneView(mgr);
scrollPane.setViewportView(scene.createView());
scene.addNode(new ConversationNode("Begin Conversation", false, 1, false, true, 0));
scene.addNode(new ConversationNode("", false, 1, true, false, 0));
/*
// Testing widgets!
Widget n1 = scene.addNode(new ConversationNode("conversation/c_newbie_mentor:s_1063", false, 1, false));
n1.setPreferredLocation(new Point(10, 100));
Widget n2 = scene.addNode(new ConversationNode("conversation/c_newbie_mentor:s_109", true, 2, false));
n2.setPreferredLocation(new Point(480, 100));
Widget n3 = scene.addNode(new ConversationNode("conversation/c_newbie_mentor:s_1067", true, 3, false));
n3.setPreferredLocation(new Point(480, 150));*/
associateLookup(ExplorerUtils.createLookup(mgr, getActionMap()));
this.scene = scene;
}
/**
* 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() {
scrollPane = new javax.swing.JScrollPane();
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(scrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(scrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JScrollPane scrollPane;
// End of variables declaration//GEN-END:variables
@Override
public void componentOpened() {
// TODO add custom code on component opening
}
@Override
public void componentClosed() {
// TODO add custom code on component closing
}
void writeProperties(java.util.Properties p) {
// better to version settings since initial version as advocated at
// http://wiki.apidesign.org/wiki/PropertyFiles
p.setProperty("version", "1.0");
// TODO store your settings
}
void readProperties(java.util.Properties p) {
String version = p.getProperty("version");
// TODO read your settings according to their version
}
@Override
public ExplorerManager getExplorerManager() {
return mgr;
}
public SceneView getScene() {
return scene;
}
}

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tc-ref PUBLIC "-//NetBeans//DTD Top Component in Mode Properties 2.0//EN" "http://www.netbeans.org/dtds/tc-ref2_0.dtd">
<tc-ref version="2.0">
<tc-id id="EditorTopComponent"/>
<state opened="true"/>
</tc-ref>

View File

@@ -0,0 +1,94 @@
package com.projectswg.tools.csc.conversationeditor;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JOptionPane;
import org.netbeans.api.visual.action.ActionFactory;
import org.netbeans.api.visual.graph.GraphScene;
import org.netbeans.api.visual.widget.LayerWidget;
import org.netbeans.api.visual.widget.Widget;
import org.openide.explorer.ExplorerManager;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
public class SceneView extends GraphScene<ConversationNode, String>{
private final LayerWidget backgroundLayer;
private final LayerWidget mainLayer;
private final LayerWidget connectionLayer;
private final ExplorerManager mgr;
public SceneView(ExplorerManager mgr) {
setLookFeel(new ConversationLookFeel());
backgroundLayer = new LayerWidget(this);
addChild(backgroundLayer);
mainLayer = new LayerWidget(this);
addChild(mainLayer);
getActions().addAction(ActionFactory.createZoomAction());
getActions().addAction(ActionFactory.createWheelPanAction());
connectionLayer = new LayerWidget(this);
addChild(connectionLayer);
this.mgr = mgr;
}
@Override
protected Widget attachNodeWidget(ConversationNode n) {
final ConversationWidget widget = new ConversationWidget(this, mgr, n, n.isEndNode());
widget.getActions().addAction(createObjectHoverAction());
n.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
TopComponent component = WindowManager.getDefault().findTopComponent("EditorTopComponent");
if (component == null || !(component instanceof EditorTopComponent))
return;
EditorTopComponent editor = (EditorTopComponent) component;
SceneView scene = editor.getScene();
if (scene == null)
return;
switch(evt.getPropertyName()) {
case "stf":
widget.getLabelWidget().setLabel((String) evt.getNewValue());
widget.repaint();
scene.validate();
break;
}
}
});
mainLayer.addChild(widget);
return widget;
}
@Override
protected Widget attachEdgeWidget(String e) {
JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),
"Edge widget attachments is not support yet.", "Conversation Script Editor", JOptionPane.WARNING_MESSAGE);
return null;
}
@Override
protected void attachEdgeSourceAnchor(String e, ConversationNode n, ConversationNode n1) {
JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),
"Edge widget attachments is not support yet.", "Conversation Script Editor", JOptionPane.WARNING_MESSAGE);
}
@Override
protected void attachEdgeTargetAnchor(String e, ConversationNode n, ConversationNode n1) {
JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),
"Edge widget attachments is not support yet.", "Conversation Script Editor", JOptionPane.WARNING_MESSAGE);
}
public LayerWidget getConnectionLayer() {
return connectionLayer;
}
}

View File

@@ -0,0 +1,53 @@
/*
* 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.actions;
import com.projectswg.tools.csc.conversationeditor.ConversationNode;
import com.projectswg.tools.csc.conversationeditor.EditorTopComponent;
import com.projectswg.tools.csc.conversationeditor.SceneView;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
import org.openide.awt.ActionRegistration;
import org.openide.util.NbBundle.Messages;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
@ActionID(
category = "Edit",
id = "com.projectswg.tools.csc.conversationeditor.actions.NewConvEnd"
)
@ActionRegistration(
iconBase = "com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_end.png",
displayName = "#CTL_NewConvEnd"
)
@ActionReferences({
@ActionReference(path = "Menu/Edit", position = 1362),
@ActionReference(path = "Toolbars/Edit", position = 450)
})
@Messages("CTL_NewConvEnd=New End Conversation")
public final class NewConvEnd implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
TopComponent component = WindowManager.getDefault().findTopComponent("EditorTopComponent");
if (component == null || !(component instanceof EditorTopComponent))
return;
EditorTopComponent editor = (EditorTopComponent) component;
SceneView scene = editor.getScene();
if (scene == null)
return;
int id = scene.getNodes().size() + 1;
scene.addNode(new ConversationNode("New End Conversation " + String.valueOf(id), false, id, true, false, 0));
scene.validate();
}
}

View File

@@ -0,0 +1,48 @@
package com.projectswg.tools.csc.conversationeditor.actions;
import com.projectswg.tools.csc.conversationeditor.ConversationNode;
import com.projectswg.tools.csc.conversationeditor.EditorTopComponent;
import com.projectswg.tools.csc.conversationeditor.SceneView;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
import org.openide.awt.ActionRegistration;
import org.openide.util.NbBundle.Messages;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
@ActionID(
category = "File",
id = "com.projectswg.tools.csc.conversationeditor.actions.NewConvOption"
)
@ActionRegistration(
iconBase = "com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_option.png",
displayName = "New Option"
)
@ActionReferences({
@ActionReference(path = "Menu/Edit", position = 1250),
@ActionReference(path = "Toolbars/Edit", position = 250)
})
@Messages("CTL_NewConvOption=New Option")
public final class NewConvOption implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
TopComponent component = WindowManager.getDefault().findTopComponent("EditorTopComponent");
if (component == null || !(component instanceof EditorTopComponent))
return;
EditorTopComponent editor = (EditorTopComponent) component;
SceneView scene = editor.getScene();
if (scene == null)
return;
int id = scene.getNodes().size() + 1;
scene.addNode(new ConversationNode("New Conversation Option " + String.valueOf(id), true, id, false, false, 0));
scene.validate();
}
}

View File

@@ -0,0 +1,52 @@
/*
* 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.actions;
import com.projectswg.tools.csc.conversationeditor.ConversationNode;
import com.projectswg.tools.csc.conversationeditor.EditorTopComponent;
import com.projectswg.tools.csc.conversationeditor.SceneView;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
import org.openide.awt.ActionRegistration;
import org.openide.util.NbBundle.Messages;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
@ActionID(
category = "File",
id = "com.projectswg.tools.csc.conversationeditor.actions.NewConvResponse"
)
@ActionRegistration(
iconBase = "com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_response.png",
displayName = "New Response"
)
@ActionReferences({
@ActionReference(path = "Menu/Edit", position = 1350, separatorAfter = 1375),
@ActionReference(path = "Toolbars/Edit", position = 350)
})
@Messages("CTL_NewConvResponse=New Response")
public final class NewConvResponse implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
TopComponent component = WindowManager.getDefault().findTopComponent("EditorTopComponent");
if (component == null || !(component instanceof EditorTopComponent))
return;
EditorTopComponent editor = (EditorTopComponent) component;
SceneView scene = editor.getScene();
if (scene == null)
return;
int id = scene.getNodes().size() + 1;
scene.addNode(new ConversationNode("New Conversation Response " + String.valueOf(id), false, id, false, false, 0));
scene.validate();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
<filesystem>
<folder name="Actions">
<folder name="Edit">
<file name="com-projectswg-tools-csc-conversationeditor-actions-NewConvOption.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"/>
</folder><folder name="Window">
<file name="com-projectswg-tools-csc-conversationeditor-test-ConvSettingsTopComponent.instance_hidden"/>
</folder>
</folder>
<folder name="Menu">
<folder name="Edit">
<file name="Separator1.instance_hidden"/>
<file name="Separator2.instance_hidden"/>
<file name="org-netbeans-modules-search-FindInFilesAction-separatorBefore.instance_hidden"/>
<file name="org-netbeans-modules-search-FindInFilesAction.shadow_hidden"/>
<file name="org-netbeans-modules-search-ReplaceInFilesAction.shadow_hidden"/>
<file name="org-openide-actions-CopyAction.shadow_hidden"/>
<file name="org-openide-actions-CutAction.shadow_hidden"/>
<file name="org-openide-actions-DeleteAction.shadow_hidden"/>
<file name="org-openide-actions-FindAction.shadow_hidden"/>
<file name="org-openide-actions-PasteAction.shadow_hidden"/>
<file name="org-openide-actions-RedoAction.shadow_hidden"/>
<file name="org-openide-actions-ReplaceAction.shadow_hidden"/>
<file name="org-openide-actions-UndoAction.shadow_hidden"/>
</folder>
<folder name="File">
<file name="Separator2.instance_hidden"/>
<file name="Separator4.instance_hidden"/>
<file name="org-netbeans-modules-print-action-PageSetupAction.shadow_hidden"/>
<file name="org-netbeans-modules-print-action-PrintAction.shadow_hidden"/>
</folder>
<file name="GoTo_hidden"/>
<folder name="Tools">
<file name="Separator1.instance_hidden"/>
<file name="Separator2.instance_hidden"/>
<file name="org-netbeans-modules-autoupdate-ui-actions-PluginManagerAction.shadow_hidden"/>
<file name="org-netbeans-modules-options-OptionsWindowAction-separatorBefore.instance_hidden"/>
<file name="org-netbeans-modules-templates-actions-TemplatesAction.shadow_hidden"/>
<file name="org-openide-actions-ToolsAction.shadow_hidden"/>
</folder>
<folder name="View">
<file name="Separator2.instance_hidden"/>
<file name="Separator3.instance_hidden"/>
<file name="org-netbeans-core-actions-LogAction.shadow_hidden"/>
<file name="org-netbeans-core-multiview-EditorsAction.instance_hidden"/>
<file name="org-netbeans-core-multiview-SplitAction.instance_hidden"/>
<file name="org-netbeans-core-windows-actions-ToolbarsListAction.shadow_hidden"/>
</folder>
<folder name="Window">
<file name="DocumentsAction.shadow_hidden"/>
<file name="GroupsMenuAction.shadow_hidden"/>
<file name="SwitchToRecentDocumentAction.shadow_hidden"/>
<file name="Tools_hidden"/>
<file name="Web_hidden"/>
<file name="org-netbeans-core-windows-actions-GlobalPropertiesAction.shadow">
<attr name="originalFile" stringvalue="Actions/Window/org-netbeans-core-windows-actions-GlobalPropertiesAction.instance"/>
<attr intvalue="100" name="position"/>
</file>
<file name="org-netbeans-modules-favorites-View.shadow_hidden"/>
</folder>
</folder>
<folder name="OptionsDialog">
<file name="Advanced.instance_hidden"/>
<file name="Advanced_hidden"/>
<file name="General.instance_hidden"/>
<file name="Keymaps.instance_hidden"/>
<file name="Keywords_hidden"/>
</folder>
<folder name="Toolbars">
<file name="Clipboard_hidden"/>
<file name="Memory_hidden"/>
<file name="UndoRedo_hidden"/>
</folder>
<folder name="Windows2">
<folder name="Modes">
<folder name="properties">
<file name="properties.wstcref" url="propertiesWstcref.xml"/>
</folder>
</folder>
</folder>
</filesystem>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mode PUBLIC
"-//NetBeans//DTD Mode Properties 2.0//EN"
"http://www.netbeans.org/dtds/mode-properties2_0.dtd">
<mode version="2.0">
<name unique="properties" />
<kind type="view" />
<state type="joined" />
<constraints>
<path orientation="horizontal" number="60" weight="0.7" />
<path orientation="vertical" number="40" weight="0.7" />
<path orientation="horizontal" number="80" weight="0.3" />
<path orientation="vertical" number="80" weight="0.5" />
</constraints>
<relative-bounds x="75" y="56" width="15" height="32" />
<active-tc id="properties" />
<empty-behavior permanent="true" />
</mode>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tc-ref PUBLIC
"-//NetBeans//DTD Top Component in Mode Properties 2.0//EN"
"http://www.netbeans.org/dtds/tc-ref2_0.dtd">
<tc-ref version="2.0">
<module name="org.netbeans.core.ui/1" spec="1.2" />
<tc-id id="properties" />
<state opened="true" />
</tc-ref>

8
build.xml Normal file
View File

@@ -0,0 +1,8 @@
<?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="ConversationScriptCreator" basedir=".">
<description>Builds the module suite ConversationScriptCreator.</description>
<import file="nbproject/build-impl.xml"/>
</project>

50
nbproject/build-impl.xml Normal file
View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
-->
<project name="ConversationScriptCreator-impl" basedir=".." xmlns:sproject="http://www.netbeans.org/ns/nb-module-suite-project/1">
<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/platform-private.properties"/>
<property file="nbproject/platform.properties"/>
<macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-suite-project/1">
<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-suite-project/1">
<attribute name="property"/>
<attribute name="value"/>
<sequential>
<property name="@{property}" value="@{value}"/>
</sequential>
</macrodef>
<property file="${user.properties.file}"/>
<sproject:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir"/>
<sproject:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir"/>
<sproject:evalprops property="cluster.path.evaluated" value="${cluster.path}"/>
<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>
<ant antfile="nbproject/platform.xml"/>
<fail message="Cannot find NetBeans build harness. ${line.separator}Check that nbplatform.${nbplatform.active}.netbeans.dest.dir and nbplatform.${nbplatform.active}.harness.dir are defined. ${line.separator}On a developer machine these are normally defined in ${user.properties.file}=${netbeans.user}/build.properties ${line.separator}but for automated builds you should pass these properties to Ant explicitly. ${line.separator}You may instead download the harness and platform: -Dbootstrap.url=.../tasks.jar -Dautoupdate.catalog.url=.../updates.xml">
<condition>
<not>
<available file="${harness.dir}/suite.xml"/>
</not>
</condition>
</fail>
<import file="${harness.dir}/suite.xml"/>
</project>

View File

@@ -0,0 +1,11 @@
build.xml.data.CRC32=351e2a03
build.xml.script.CRC32=bfbbd184
build.xml.stylesheet.CRC32=eaf9f76a@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=351e2a03
nbproject/build-impl.xml.script.CRC32=e2a68411
nbproject/build-impl.xml.stylesheet.CRC32=0f381476@2.66.1
nbproject/platform.xml.data.CRC32=351e2a03
nbproject/platform.xml.script.CRC32=6dcbd131
nbproject/platform.xml.stylesheet.CRC32=4e1f53d4@2.66.1

View File

@@ -0,0 +1,18 @@
branding.token=conversationscriptcreator
cluster.path=\
${nbplatform.active.dir}/platform
disabled.modules=\
org.jdesktop.layout,\
org.netbeans.core.execution,\
org.netbeans.libs.jsr223,\
org.netbeans.modules.autoupdate.cli,\
org.netbeans.modules.autoupdate.services,\
org.netbeans.modules.autoupdate.ui,\
org.netbeans.modules.core.kit,\
org.netbeans.modules.favorites,\
org.netbeans.modules.templates,\
org.openide.compat,\
org.openide.execution,\
org.openide.options,\
org.openide.util.enumerations
nbplatform.active=default

34
nbproject/platform.xml Normal file
View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="platform" default="download" basedir="..">
<condition property="download.required">
<and>
<not>
<available file="${harness.dir}/suite.xml"/>
</not>
<isset property="bootstrap.url"/>
<isset property="autoupdate.catalog.url"/>
</and>
</condition>
<target name="download" if="download.required">
<mkdir dir="${harness.dir}"/>
<pathconvert pathsep="|" property="download.clusters">
<mapper type="flatten"/>
<path path="${cluster.path}"/>
</pathconvert>
<property name="disabled.modules" value=""/>
<pathconvert property="module.includes" pathsep="">
<mapper type="glob" from="${basedir}${file.separator}*" to="(?!^\Q*\E$)"/>
<path>
<filelist files="${disabled.modules}" dir="."/>
</path>
</pathconvert>
<echo message="Downloading clusters ${download.clusters}"/>
<property name="tasks.jar" location="${java.io.tmpdir}/tasks.jar"/>
<get src="${bootstrap.url}" dest="${tasks.jar}" usetimestamp="true" verbose="true"/>
<taskdef name="autoupdate" classname="org.netbeans.nbbuild.AutoUpdate" classpath="${tasks.jar}"/>
<autoupdate installdir="${nbplatform.active.dir}" updatecenter="${autoupdate.catalog.url}">
<modules includes="${module.includes}.*" clusters="${download.clusters}"/>
<modules includes="org[.]netbeans[.]modules[.]apisupport[.]harness" clusters="harness"/>
</autoupdate>
</target>
</project>

View File

@@ -0,0 +1 @@
user.properties.file=C:\\Users\\Wave\\AppData\\Roaming\\NetBeans\\8.0\\build.properties

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/>
</open-files>
</project-private>

View File

@@ -0,0 +1,15 @@
app.icon=branding/core/core.jar/org/netbeans/core/startup/frame48.gif
app.name=${branding.token}
app.title=Conversation Script Creator
auxiliary.org-netbeans-modules-apisupport-installer.license-type=no
auxiliary.org-netbeans-modules-apisupport-installer.os-linux=false
auxiliary.org-netbeans-modules-apisupport-installer.os-macosx=false
auxiliary.org-netbeans-modules-apisupport-installer.os-solaris=false
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=ConversationEditor

9
nbproject/project.xml Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.apisupport.project.suite</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/nb-module-suite-project/1">
<name>ConversationScriptCreator</name>
</data>
</configuration>
</project>