diff --git a/ConversationCompiler/nbproject/private/private.xml b/ConversationCompiler/nbproject/private/private.xml
index f882026..6807a2b 100644
--- a/ConversationCompiler/nbproject/private/private.xml
+++ b/ConversationCompiler/nbproject/private/private.xml
@@ -2,8 +2,6 @@
-
- file:/C:/Users/Wave/Documents/NetBeansProjects/ConversationScriptCreator/ConversationCompiler/src/com/projectswg/tools/csc/compiler/Compiler.java
-
+
diff --git a/ConversationCompiler/nbproject/project.properties b/ConversationCompiler/nbproject/project.properties
index 6baf44e..8377ca3 100644
--- a/ConversationCompiler/nbproject/project.properties
+++ b/ConversationCompiler/nbproject/project.properties
@@ -1,2 +1,5 @@
javac.source=1.7
javac.compilerargs=-Xlint -Xlint:-serial
+license.file=../LICENSE
+nbm.homepage=http://www.projectswg.com
+nbm.module.author=Waverunner
diff --git a/ConversationCompiler/src/com/projectswg/tools/csc/compiler/Compiler.java b/ConversationCompiler/src/com/projectswg/tools/csc/compiler/Compiler.java
index 8ad9c91..a2b71f7 100644
--- a/ConversationCompiler/src/com/projectswg/tools/csc/compiler/Compiler.java
+++ b/ConversationCompiler/src/com/projectswg/tools/csc/compiler/Compiler.java
@@ -16,7 +16,6 @@ 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 {
@@ -28,7 +27,7 @@ public class Compiler {
public void compile() throws IOException {
- TopComponent component = WindowManager.getDefault().findTopComponent("EditorTopComponent");
+ TopComponent component = TopComponent.getRegistry().getActivated();
if (component == null || !(component instanceof EditorTopComponent))
return;
diff --git a/ConversationEditor/nbproject/genfiles.properties b/ConversationEditor/nbproject/genfiles.properties
index 0a07a29..6c3c408 100644
--- a/ConversationEditor/nbproject/genfiles.properties
+++ b/ConversationEditor/nbproject/genfiles.properties
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=90d565b1
+build.xml.data.CRC32=a42deb56
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.data.CRC32=a42deb56
nbproject/build-impl.xml.script.CRC32=b2a11926
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.66.1
diff --git a/ConversationEditor/nbproject/private/private.xml b/ConversationEditor/nbproject/private/private.xml
index aabcfea..6807a2b 100644
--- a/ConversationEditor/nbproject/private/private.xml
+++ b/ConversationEditor/nbproject/private/private.xml
@@ -2,11 +2,6 @@
-
- file:/C:/Users/Wave/Documents/NetBeansProjects/ConversationScriptCreator/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/ConversationConnectProvider.java
- file:/C:/Users/Wave/Documents/NetBeansProjects/ConversationScriptCreator/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/ConversationNode.java
- file:/C:/Users/Wave/Documents/NetBeansProjects/ConversationScriptCreator/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/ConversationWidget.java
- file:/C:/Users/Wave/Documents/NetBeansProjects/ConversationScriptCreator/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvEnd.java
-
+
diff --git a/ConversationEditor/nbproject/project.xml b/ConversationEditor/nbproject/project.xml
index 3611d1e..c4b3984 100644
--- a/ConversationEditor/nbproject/project.xml
+++ b/ConversationEditor/nbproject/project.xml
@@ -40,6 +40,14 @@
7.61.2
+
+ org.openide.dialogs
+
+
+
+ 7.36.1
+
+
org.openide.explorer
@@ -48,6 +56,14 @@
6.56.1
+
+ org.openide.filesystems
+
+
+
+ 8.10.1
+
+
org.openide.nodes
@@ -56,6 +72,14 @@
7.38.1
+
+ org.openide.text
+
+
+
+ 6.61.1
+
+
org.openide.util
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/EditorTopComponent.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/EditorTopComponent.java
index 3d09681..bd3182a 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/EditorTopComponent.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/EditorTopComponent.java
@@ -1,16 +1,20 @@
package com.projectswg.tools.csc.conversationeditor;
+import com.projectswg.tools.csc.conversationeditor.actions.SaveConversation;
+import java.awt.Point;
+import java.io.IOException;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
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.Exceptions;
import org.openide.util.NbBundle.Messages;
import org.openide.windows.TopComponent;
+import org.xml.sax.SAXException;
-/**
- * Top component which displays something.
- */
@ConvertAsProperties(
dtd = "-//com.projectswg.tools.csc.conversationeditor//Editor//EN",
autostore = false
@@ -24,7 +28,7 @@ import org.openide.windows.TopComponent;
@ActionID(category = "Window", id = "com.projectswg.tools.csc.conversationeditor.EditorTopComponent")
@ActionReference(path = "Menu/Window" /*, position = 333 */)
@TopComponent.OpenActionRegistration(
- displayName = "Conversastion Editor",
+ displayName = "Editor",
preferredID = "EditorTopComponent"
)
@Messages({
@@ -37,31 +41,40 @@ public final class EditorTopComponent extends TopComponent implements ExplorerMa
private final ExplorerManager mgr = new ExplorerManager();
private final SceneView scene;
+ // New Conversation
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));*/
+ setName(Bundle.CTL_EditorTopComponent() + " - *New Conversation*");
+ scene.addNode(new ConversationNode("Begin Conversation", false, 0, false, true, 0));
+ scene.addNode(new ConversationNode("End Conversation", false, 1, true, false, 0));
+
associateLookup(ExplorerUtils.createLookup(mgr, getActionMap()));
this.scene = scene;
}
+
+ // Open Conversation
+ public EditorTopComponent(String convName) {
+ initComponents();
+ setToolTipText(Bundle.HINT_EditorTopComponent());
+
+ SceneView scene = new SceneView(mgr);
+ scene.setSceneName(convName);
+
+ scrollPane.setViewportView(scene.createView());
+
+ setName(Bundle.CTL_EditorTopComponent() + " - " + (scene.getSceneName().equals("") ? "*New Conversation*" : scene.getSceneName()));
+
+ 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
@@ -94,7 +107,11 @@ public final class EditorTopComponent extends TopComponent implements ExplorerMa
@Override
public void componentClosed() {
- // TODO add custom code on component closing
+ /*try {
+ SaveConversation.save(scene);
+ } catch (ParserConfigurationException | IOException | SAXException | TransformerException ex) {
+ Exceptions.printStackTrace(ex);
+ }*/
}
void writeProperties(java.util.Properties p) {
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/SceneSaver.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/SceneSaver.java
new file mode 100644
index 0000000..da1fcb5
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/SceneSaver.java
@@ -0,0 +1,109 @@
+package com.projectswg.tools.csc.conversationeditor;
+
+import java.awt.Point;
+import javax.swing.SwingUtilities;
+import org.netbeans.api.visual.graph.GraphScene;
+import org.netbeans.api.visual.widget.Widget;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+// Based off of http://bits.netbeans.org/dev/javadoc/org-netbeans-api-visual/org/netbeans/api/visual/widget/doc-files/documentation.html#Serialization
+public class SceneSaver {
+ private static final String NODE_ELEMENT = "SceneNode"; // NOI18N
+ private static final String VERSION_ATTR = "version"; // NOI18N
+ private static final String NODE_NODE = "Node"; // NOI18N
+ private static final String NODEID_ATTR = "nodeID"; // NOI18N
+ private static final String X_NODE = "posX"; // NOI18N
+ private static final String Y_NODE = "posY"; // NOI18N
+
+ private static final String VERSION_VALUE_1 = "1"; // NOI18N
+
+ // creates an sceneXMLNode that has to be placed to the XML file then
+ public Node serializeData (GraphScene scene, Document file) {
+
+ Node sceneXMLNode = file.createElement(NODE_ELEMENT);
+ setAttribute(file, sceneXMLNode, VERSION_ATTR, VERSION_VALUE_1); // NOI18N
+
+ for (ConversationNode node : scene.getNodes ()) {
+ Widget widget = scene.findWidget(node);
+ if (widget != null) {
+ Point location = widget.getPreferredLocation();
+ if (location != null) {
+ Node dataXMLNode = file.createElement(NODE_NODE);
+
+ setAttribute(file, dataXMLNode, NODEID_ATTR, String.valueOf(node.getId()));
+ setAttribute(file, dataXMLNode, X_NODE, Integer.toString(location.x));
+ setAttribute(file, dataXMLNode, Y_NODE, Integer.toString(location.y));
+
+ sceneXMLNode.appendChild(dataXMLNode);
+ }
+ }
+ }
+ return sceneXMLNode;
+ }
+
+ // Returns true if deserialization is successfull
+ // sceneXMLNode has to be found in the XML file first
+ public boolean deserializeData(final GraphScene scene, final Node sceneXMLNode) {
+ if (!VERSION_VALUE_1.equals(getAttributeValue(sceneXMLNode, VERSION_ATTR)))
+ return false;
+
+ SwingUtilities.invokeLater (new Runnable() {
+ @Override
+ public void run() {
+ deserializeDataVersion1(scene, sceneXMLNode);
+ scene.validate ();
+ }
+ });
+
+ return true;
+ }
+
+ private void deserializeDataVersion1(GraphScene scene, Node data) {
+ for (Node node : getChildNode (data)) {
+ if(NODE_NODE.equals(node.getNodeName())) {
+ String nodeID = getAttributeValue(node, NODEID_ATTR);
+ int x = Integer.parseInt(getAttributeValue (node, X_NODE));
+ int y = Integer.parseInt(getAttributeValue (node, Y_NODE));
+ Widget widget = scene.findWidget(nodeID);
+ if (widget != null)
+ widget.setPreferredLocation (new Point (x, y));
+ }
+ }
+ }
+
+ private static String getAttributeValue(Node node, String attr) {
+ try {
+ if (node != null) {
+ NamedNodeMap map = node.getAttributes ();
+ if (map != null) {
+ node = map.getNamedItem (attr);
+ if (node != null)
+ return node.getNodeValue ();
+ }
+ }
+ } catch (DOMException e) {
+ //Debug.warning (e);
+ }
+ return null;
+ }
+
+ private static void setAttribute(Document xml, Node node, String name, String value) {
+ NamedNodeMap map = node.getAttributes ();
+ Attr attribute = xml.createAttribute(name);
+ attribute.setValue (value);
+ map.setNamedItem (attribute);
+ }
+
+ private static Node[] getChildNode (Node node) {
+ NodeList childNodes = node.getChildNodes ();
+ Node[] nodes = new Node[childNodes != null ? childNodes.getLength () : 0];
+ for (int i = 0; i < nodes.length; i++)
+ nodes[i] = childNodes.item (i);
+ return nodes;
+ }
+}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/SceneView.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/SceneView.java
index b3a8b6d..c315001 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/SceneView.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/SceneView.java
@@ -2,7 +2,19 @@ package com.projectswg.tools.csc.conversationeditor;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.IOException;
import javax.swing.JOptionPane;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
import org.netbeans.api.visual.action.ActionFactory;
import org.netbeans.api.visual.graph.GraphScene;
import org.netbeans.api.visual.widget.LayerWidget;
@@ -10,6 +22,9 @@ import org.netbeans.api.visual.widget.Widget;
import org.openide.explorer.ExplorerManager;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
public class SceneView extends GraphScene{
private final LayerWidget backgroundLayer;
@@ -17,6 +32,8 @@ public class SceneView extends GraphScene{
private final LayerWidget connectionLayer;
private final ExplorerManager mgr;
+ private String name = "";
+
public SceneView(ExplorerManager mgr) {
setLookFeel(new ConversationLookFeel());
@@ -91,4 +108,11 @@ public class SceneView extends GraphScene{
return connectionLayer;
}
+ public String getSceneName() {
+ return name;
+ }
+
+ public void setSceneName(String name) {
+ this.name = name;
+ }
}
\ No newline at end of file
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvEnd.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvEnd.java
index 0ca1c4f..2f404cb 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvEnd.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvEnd.java
@@ -16,7 +16,6 @@ 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",
@@ -24,7 +23,7 @@ import org.openide.windows.WindowManager;
)
@ActionRegistration(
iconBase = "com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_end.png",
- displayName = "#CTL_NewConvEnd"
+ displayName = "New End Conversation"
)
@ActionReferences({
@ActionReference(path = "Menu/Edit", position = 1362),
@@ -35,7 +34,7 @@ public final class NewConvEnd implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
- TopComponent component = WindowManager.getDefault().findTopComponent("EditorTopComponent");
+ TopComponent component = TopComponent.getRegistry().getActivated();
if (component == null || !(component instanceof EditorTopComponent))
return;
@@ -45,7 +44,7 @@ public final class NewConvEnd implements ActionListener {
if (scene == null)
return;
- int id = scene.getNodes().size() + 1;
+ int id = scene.getNodes().size();
scene.addNode(new ConversationNode("New End Conversation " + String.valueOf(id), false, id, true, false, 0));
scene.validate();
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvOption.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvOption.java
index 763bf25..d93b06f 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvOption.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvOption.java
@@ -11,7 +11,6 @@ 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",
@@ -30,7 +29,7 @@ public final class NewConvOption implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
- TopComponent component = WindowManager.getDefault().findTopComponent("EditorTopComponent");
+ TopComponent component = TopComponent.getRegistry().getActivated();
if (component == null || !(component instanceof EditorTopComponent))
return;
@@ -40,7 +39,7 @@ public final class NewConvOption implements ActionListener {
if (scene == null)
return;
- int id = scene.getNodes().size() + 1;
+ int id = scene.getNodes().size();
scene.addNode(new ConversationNode("New Conversation Option " + String.valueOf(id), true, id, false, false, 0));
scene.validate();
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvResponse.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvResponse.java
index 634a4ae..e0b5fe8 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvResponse.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvResponse.java
@@ -16,7 +16,6 @@ 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",
@@ -35,7 +34,7 @@ public final class NewConvResponse implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
- TopComponent component = WindowManager.getDefault().findTopComponent("EditorTopComponent");
+ TopComponent component = TopComponent.getRegistry().getActivated();
if (component == null || !(component instanceof EditorTopComponent))
return;
@@ -45,7 +44,7 @@ public final class NewConvResponse implements ActionListener {
if (scene == null)
return;
- int id = scene.getNodes().size() + 1;
+ int id = scene.getNodes().size();
scene.addNode(new ConversationNode("New Conversation Response " + String.valueOf(id), false, id, false, false, 0));
scene.validate();
}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConversation.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConversation.java
new file mode 100644
index 0000000..cd39e53
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConversation.java
@@ -0,0 +1,39 @@
+/*
+ * 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.EditorTopComponent;
+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;
+
+@ActionID(
+ category = "File",
+ id = "com.projectswg.tools.csc.conversationeditor.actions.NewConversation"
+)
+@ActionRegistration(
+ iconBase = "com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_new.png",
+ displayName = "New Conversation"
+)
+@ActionReferences({
+ @ActionReference(path = "Menu/File", position = -115),
+ @ActionReference(path = "Toolbars/File", position = 400),
+ @ActionReference(path = "Shortcuts", name = "D-N")
+})
+@Messages("CTL_NewConversation=New Conversation")
+public final class NewConversation implements ActionListener {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ EditorTopComponent newEditor = new EditorTopComponent();
+ newEditor.open();
+ newEditor.requestActive();
+ }
+}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/OpenConversation.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/OpenConversation.java
new file mode 100644
index 0000000..1755b3a
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/OpenConversation.java
@@ -0,0 +1,35 @@
+package com.projectswg.tools.csc.conversationeditor.actions;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionReference;
+import org.openide.awt.ActionReferences;
+import org.openide.awt.ActionRegistration;
+import org.openide.filesystems.FileChooserBuilder;
+import org.openide.util.NbBundle.Messages;
+
+@ActionID(category = "File", id = "org.mycore.OpenFileAction")
+@ActionRegistration(displayName = "Open Conversation")
+@ActionReferences({
+ @ActionReference(path = "Menu/File", position = 10, separatorAfter = 11),
+ @ActionReference(path = "Shortcuts", name = "D-O")
+})
+@Messages("CTL_OpenFileAction=Open Conversation")
+public final class OpenConversation implements ActionListener {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ //The default dir to use if no value is stored
+ File home = new File(System.getProperty("user.home"));
+
+ File toAdd = new FileChooserBuilder("user-dir").setTitle("Open Conversation").
+ setDefaultWorkingDirectory(home).setApproveText("Open").showOpenDialog();
+ //Result will be null if the user clicked cancel or closed the dialog w/o OK
+ if (toAdd != null) {
+ // TODO:
+ }
+ }
+
+}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/SaveConversation.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/SaveConversation.java
new file mode 100644
index 0000000..e111be3
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/SaveConversation.java
@@ -0,0 +1,119 @@
+/*
+ * 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.EditorTopComponent;
+import com.projectswg.tools.csc.conversationeditor.SceneSaver;
+import com.projectswg.tools.csc.conversationeditor.SceneView;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.IOException;
+import javax.swing.SwingUtilities;
+import javax.swing.filechooser.FileFilter;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionReference;
+import org.openide.awt.ActionReferences;
+import org.openide.awt.ActionRegistration;
+import org.openide.filesystems.FileChooserBuilder;
+import org.openide.util.Exceptions;
+import org.openide.util.NbBundle.Messages;
+import org.openide.windows.TopComponent;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+@ActionID(
+ category = "File",
+ id = "com.projectswg.tools.csc.conversationeditor.actions.SaveConversation"
+)
+@ActionRegistration(
+ iconBase = "com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_save.png",
+ displayName = "Save Conversation"
+)
+@ActionReferences({
+ @ActionReference(path = "Menu/File", position = -90, separatorBefore = -140),
+ @ActionReference(path = "Toolbars/File", position = 500),
+ @ActionReference(path = "Shortcuts", name = "D-S")
+})
+@Messages("CTL_SaveConversation=Save Conversation")
+public final class SaveConversation implements ActionListener {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ TopComponent component = TopComponent.getRegistry().getActivated();
+ if (component == null || !(component instanceof EditorTopComponent))
+ return;
+
+ EditorTopComponent editor = (EditorTopComponent) component;
+ final SceneView scene = editor.getScene();
+
+ if (scene == null)
+ return;
+
+ if (scene.getSceneName().equals("")) {
+ File home = new File(System.getProperty("user.home"));
+
+ FileChooserBuilder builder = new FileChooserBuilder("user-dir").setTitle("Save Conversation").setDefaultWorkingDirectory(home).setApproveText("Save");
+ builder.setAcceptAllFileFilterUsed(true);
+
+ final File file = builder.showSaveDialog();
+
+ if (file != null) {
+ scene.setSceneName(file.getName().split(".xml")[0]);
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ save(scene, file.getAbsolutePath());
+ } catch (ParserConfigurationException | IOException | SAXException | TransformerException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+ });
+ editor.setName("Conversation Editor - " + scene.getSceneName());
+ }
+ }
+ }
+
+ public static void save(SceneView scene, String path) throws ParserConfigurationException, IOException, SAXException, TransformerConfigurationException, TransformerException {
+ SceneSaver saver = new SceneSaver();
+
+ File xmlFile = new File(path + ".xml");
+ if (!xmlFile.exists())
+ xmlFile.createNewFile();
+
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document document = builder.newDocument();
+
+ document.createElement("Properties");
+
+ Node xmlNode = saver.serializeData(scene, document);
+ document.appendChild(xmlNode);
+
+ TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ Transformer transformer = transformerFactory.newTransformer();
+
+ DOMSource source = new DOMSource(document);
+ StreamResult result = new StreamResult(xmlFile);
+ transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+
+ transformer.transform(source, result);
+ }
+}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_new.png b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_new.png
new file mode 100644
index 0000000..20b40e8
Binary files /dev/null and b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_new.png differ
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_new24.png b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_new24.png
new file mode 100644
index 0000000..2206f77
Binary files /dev/null and b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_new24.png differ
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_save.png b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_save.png
new file mode 100644
index 0000000..b34460e
Binary files /dev/null and b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_save.png differ
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_save24.png b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_save24.png
new file mode 100644
index 0000000..72bdab0
Binary files /dev/null and b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_save24.png differ
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/layer.xml b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/layer.xml
index 47258db..2ceb81b 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/layer.xml
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/layer.xml
@@ -15,6 +15,7 @@
+
@@ -31,12 +32,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -45,6 +73,7 @@
+
@@ -54,17 +83,28 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -74,7 +114,16 @@
+
+
+
+
+
+
+
+
+
diff --git a/nbproject/platform.properties b/nbproject/platform.properties
index 89fdfd8..d720743 100644
--- a/nbproject/platform.properties
+++ b/nbproject/platform.properties
@@ -1,18 +1,251 @@
branding.token=conversationscriptcreator
cluster.path=\
+ ${nbplatform.active.dir}/ide:\
${nbplatform.active.dir}/platform
disabled.modules=\
+ com.jcraft.jsch,\
+ com.jcraft.jzlib,\
+ javaewah.dummy,\
+ org.apache.commons.codec,\
+ org.apache.commons.httpclient,\
+ org.apache.commons.io,\
+ org.apache.commons.lang,\
+ org.apache.commons.logging,\
+ org.apache.ws.commons.util,\
+ org.apache.xml.resolver,\
+ org.apache.xmlrpc,\
+ org.eclipse.core.contenttype,\
+ org.eclipse.core.jobs,\
+ org.eclipse.core.net,\
+ org.eclipse.core.runtime,\
+ org.eclipse.core.runtime.compatibility.auth,\
+ org.eclipse.equinox.app,\
+ org.eclipse.equinox.common,\
+ org.eclipse.equinox.preferences,\
+ org.eclipse.equinox.registry,\
+ org.eclipse.equinox.security,\
+ org.eclipse.jgit,\
+ org.eclipse.mylyn.bugzilla.core,\
+ org.eclipse.mylyn.commons.core,\
+ org.eclipse.mylyn.commons.net,\
+ org.eclipse.mylyn.commons.repositories.core,\
+ org.eclipse.mylyn.commons.xmlrpc,\
+ org.eclipse.mylyn.tasks.core,\
+ org.eclipse.mylyn.wikitext.confluence.core,\
+ org.eclipse.mylyn.wikitext.core,\
+ org.eclipse.mylyn.wikitext.textile.core,\
org.jdesktop.layout,\
+ org.netbeans.api.debugger,\
+ org.netbeans.api.java.classpath,\
+ org.netbeans.api.xml,\
+ org.netbeans.core.browser,\
+ org.netbeans.core.browser.webview,\
org.netbeans.core.execution,\
+ org.netbeans.core.ide,\
+ org.netbeans.core.multitabs.project,\
+ org.netbeans.lib.terminalemulator,\
+ org.netbeans.libs.antlr3.runtime,\
+ org.netbeans.libs.bytelist,\
+ org.netbeans.libs.commons_net,\
+ org.netbeans.libs.felix,\
+ org.netbeans.libs.freemarker,\
+ org.netbeans.libs.git,\
+ org.netbeans.libs.ini4j,\
+ org.netbeans.libs.javafx,\
+ org.netbeans.libs.jaxb,\
+ org.netbeans.libs.jsch.agentproxy,\
+ org.netbeans.libs.json_simple,\
org.netbeans.libs.jsr223,\
+ org.netbeans.libs.jvyamlb,\
+ org.netbeans.libs.lucene,\
+ org.netbeans.libs.nashorn,\
+ org.netbeans.libs.smack,\
+ org.netbeans.libs.svnClientAdapter,\
+ org.netbeans.libs.svnClientAdapter.javahl,\
+ org.netbeans.libs.svnClientAdapter.svnkit,\
+ org.netbeans.libs.swingx,\
+ org.netbeans.libs.testng,\
+ org.netbeans.libs.xerces,\
org.netbeans.modules.autoupdate.cli,\
org.netbeans.modules.autoupdate.services,\
org.netbeans.modules.autoupdate.ui,\
+ org.netbeans.modules.bugtracking,\
+ org.netbeans.modules.bugtracking.bridge,\
+ org.netbeans.modules.bugtracking.commons,\
+ org.netbeans.modules.bugzilla,\
+ org.netbeans.modules.code.analysis,\
org.netbeans.modules.core.kit,\
+ org.netbeans.modules.csl.api,\
+ org.netbeans.modules.css.editor,\
+ org.netbeans.modules.css.lib,\
+ org.netbeans.modules.css.model,\
+ org.netbeans.modules.css.prep,\
+ org.netbeans.modules.css.visual,\
+ org.netbeans.modules.db,\
+ org.netbeans.modules.db.core,\
+ org.netbeans.modules.db.dataview,\
+ org.netbeans.modules.db.drivers,\
+ org.netbeans.modules.db.kit,\
+ org.netbeans.modules.db.metadata.model,\
+ org.netbeans.modules.db.mysql,\
+ org.netbeans.modules.db.sql.editor,\
+ org.netbeans.modules.db.sql.visualeditor,\
+ org.netbeans.modules.dbapi,\
+ org.netbeans.modules.defaults,\
+ org.netbeans.modules.derby,\
+ org.netbeans.modules.diff,\
+ org.netbeans.modules.dlight.nativeexecution,\
+ org.netbeans.modules.dlight.terminal,\
+ org.netbeans.modules.editor,\
+ org.netbeans.modules.editor.actions,\
+ org.netbeans.modules.editor.bookmarks,\
+ org.netbeans.modules.editor.bracesmatching,\
+ org.netbeans.modules.editor.breadcrumbs,\
+ org.netbeans.modules.editor.codetemplates,\
+ org.netbeans.modules.editor.completion,\
+ org.netbeans.modules.editor.deprecated.pre65formatting,\
+ org.netbeans.modules.editor.errorstripe,\
+ org.netbeans.modules.editor.errorstripe.api,\
+ org.netbeans.modules.editor.fold,\
+ org.netbeans.modules.editor.fold.nbui,\
+ org.netbeans.modules.editor.global.format,\
+ org.netbeans.modules.editor.guards,\
+ org.netbeans.modules.editor.indent,\
+ org.netbeans.modules.editor.indent.project,\
+ org.netbeans.modules.editor.kit,\
+ org.netbeans.modules.editor.lib,\
+ org.netbeans.modules.editor.lib2,\
+ org.netbeans.modules.editor.macros,\
+ org.netbeans.modules.editor.plain,\
+ org.netbeans.modules.editor.plain.lib,\
+ org.netbeans.modules.editor.search,\
+ org.netbeans.modules.editor.settings,\
+ org.netbeans.modules.editor.settings.storage,\
+ org.netbeans.modules.editor.structure,\
+ org.netbeans.modules.editor.tools.storage,\
+ org.netbeans.modules.editor.util,\
+ org.netbeans.modules.extbrowser,\
+ org.netbeans.modules.extexecution,\
+ org.netbeans.modules.extexecution.impl,\
org.netbeans.modules.favorites,\
+ org.netbeans.modules.git,\
+ org.netbeans.modules.gototest,\
+ org.netbeans.modules.gsf.codecoverage,\
+ org.netbeans.modules.gsf.testrunner,\
+ org.netbeans.modules.html,\
+ org.netbeans.modules.html.angular,\
+ org.netbeans.modules.html.custom,\
+ org.netbeans.modules.html.editor,\
+ org.netbeans.modules.html.editor.lib,\
+ org.netbeans.modules.html.knockout,\
+ org.netbeans.modules.html.lexer,\
+ org.netbeans.modules.html.parser,\
+ org.netbeans.modules.html.validation,\
+ org.netbeans.modules.httpserver,\
+ org.netbeans.modules.hudson,\
+ org.netbeans.modules.hudson.git,\
+ org.netbeans.modules.hudson.mercurial,\
+ org.netbeans.modules.hudson.subversion,\
+ org.netbeans.modules.hudson.tasklist,\
+ org.netbeans.modules.hudson.ui,\
+ org.netbeans.modules.ide.kit,\
+ org.netbeans.modules.image,\
+ org.netbeans.modules.javascript2.debug,\
+ org.netbeans.modules.javascript2.editor,\
+ org.netbeans.modules.javascript2.extjs,\
+ org.netbeans.modules.javascript2.jquery,\
+ org.netbeans.modules.javascript2.kit,\
+ org.netbeans.modules.javascript2.knockout,\
+ org.netbeans.modules.jellytools.ide,\
+ org.netbeans.modules.jumpto,\
+ org.netbeans.modules.languages,\
+ org.netbeans.modules.languages.diff,\
+ org.netbeans.modules.languages.manifest,\
+ org.netbeans.modules.languages.yaml,\
+ org.netbeans.modules.lexer,\
+ org.netbeans.modules.lexer.nbbridge,\
+ org.netbeans.modules.localhistory,\
+ org.netbeans.modules.localtasks,\
+ org.netbeans.modules.mercurial,\
+ org.netbeans.modules.mylyn.util,\
+ org.netbeans.modules.notifications,\
+ org.netbeans.modules.options.editor,\
+ org.netbeans.modules.parsing.api,\
+ org.netbeans.modules.parsing.lucene,\
+ org.netbeans.modules.parsing.ui,\
+ org.netbeans.modules.print.editor,\
+ org.netbeans.modules.project.ant,\
+ org.netbeans.modules.project.indexingbridge,\
+ org.netbeans.modules.project.libraries,\
+ org.netbeans.modules.projectapi,\
+ org.netbeans.modules.projectui,\
+ org.netbeans.modules.projectui.buildmenu,\
+ org.netbeans.modules.projectuiapi,\
+ org.netbeans.modules.properties,\
+ org.netbeans.modules.properties.syntax,\
+ org.netbeans.modules.refactoring.api,\
+ org.netbeans.modules.schema2beans,\
+ org.netbeans.modules.server,\
+ org.netbeans.modules.servletapi,\
+ org.netbeans.modules.spellchecker,\
+ org.netbeans.modules.spellchecker.apimodule,\
+ org.netbeans.modules.spellchecker.bindings.htmlxml,\
+ org.netbeans.modules.spellchecker.bindings.properties,\
+ org.netbeans.modules.spellchecker.dictionary_en,\
+ org.netbeans.modules.spellchecker.kit,\
+ org.netbeans.modules.spi.actions,\
+ org.netbeans.modules.subversion,\
+ org.netbeans.modules.swing.validation,\
+ org.netbeans.modules.target.iterator,\
+ org.netbeans.modules.tasklist.kit,\
+ org.netbeans.modules.tasklist.projectint,\
+ org.netbeans.modules.tasklist.todo,\
+ org.netbeans.modules.tasklist.ui,\
+ org.netbeans.modules.team.commons,\
+ org.netbeans.modules.team.ide,\
org.netbeans.modules.templates,\
+ org.netbeans.modules.terminal,\
+ org.netbeans.modules.usersguide,\
+ org.netbeans.modules.utilities.project,\
+ org.netbeans.modules.versioning,\
+ org.netbeans.modules.versioning.core,\
+ org.netbeans.modules.versioning.indexingbridge,\
+ org.netbeans.modules.versioning.masterfs,\
+ org.netbeans.modules.versioning.system.cvss.installer,\
+ org.netbeans.modules.versioning.ui,\
+ org.netbeans.modules.versioning.util,\
+ org.netbeans.modules.web.browser.api,\
+ org.netbeans.modules.web.common,\
+ org.netbeans.modules.web.indent,\
+ org.netbeans.modules.web.webkit.debugging,\
+ org.netbeans.modules.xml,\
+ org.netbeans.modules.xml.axi,\
+ org.netbeans.modules.xml.catalog,\
+ org.netbeans.modules.xml.core,\
+ org.netbeans.modules.xml.jaxb.api,\
+ org.netbeans.modules.xml.lexer,\
+ org.netbeans.modules.xml.multiview,\
+ org.netbeans.modules.xml.retriever,\
+ org.netbeans.modules.xml.schema.completion,\
+ org.netbeans.modules.xml.schema.model,\
+ org.netbeans.modules.xml.tax,\
+ org.netbeans.modules.xml.text,\
+ org.netbeans.modules.xml.tools,\
+ org.netbeans.modules.xml.wsdl.model,\
+ org.netbeans.modules.xml.xam,\
+ org.netbeans.modules.xml.xdm,\
+ org.netbeans.modules.xsl,\
+ org.netbeans.spi.debugger.ui,\
+ org.netbeans.spi.editor.hints,\
+ org.netbeans.spi.editor.hints.projects,\
+ org.netbeans.spi.navigator,\
+ org.netbeans.spi.palette,\
+ org.netbeans.spi.tasklist,\
+ org.netbeans.spi.viewmodel,\
+ org.netbeans.swing.dirchooser,\
org.openide.compat,\
org.openide.execution,\
org.openide.options,\
- org.openide.util.enumerations
+ org.openide.util.enumerations,\
+ org.openidex.util
nbplatform.active=default