diff --git a/.gitignore b/.gitignore
index 42c1ab3..ade8ef2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,4 +17,6 @@ hs_err_pid*
/dist/
/nbproject/private/
/ConversationEditor/nbproject/private/
-/ConversationCompiler/nbproject/private/
\ No newline at end of file
+/ConversationCompiler/nbproject/private/
+/mina-core/build/
+/mina-core/nbproject/private/
\ No newline at end of file
diff --git a/ConversationEditor/nbproject/genfiles.properties b/ConversationEditor/nbproject/genfiles.properties
index 2a816b9..0660815 100644
--- a/ConversationEditor/nbproject/genfiles.properties
+++ b/ConversationEditor/nbproject/genfiles.properties
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=87962ed9
+build.xml.data.CRC32=c55d3ba8
build.xml.script.CRC32=af729615
build.xml.stylesheet.CRC32=a56c6a5b@2.67.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=87962ed9
+nbproject/build-impl.xml.data.CRC32=c55d3ba8
nbproject/build-impl.xml.script.CRC32=b2a11926
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.67.1
diff --git a/ConversationEditor/nbproject/project.xml b/ConversationEditor/nbproject/project.xml
index 45f88d7..ecda221 100644
--- a/ConversationEditor/nbproject/project.xml
+++ b/ConversationEditor/nbproject/project.xml
@@ -6,6 +6,14 @@
com.projectswg.tools.csc.conversationeditor
+
+ com.projectswg.minacore
+
+
+
+ 1.0
+
+
org.netbeans.api.visual
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/Compiler.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/Compiler.java
index 5b6ee6b..dafbba2 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/Compiler.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/Compiler.java
@@ -107,12 +107,9 @@ public class Compiler {
break;
case ConversationNode.END:
- if (handleNode.getStf().contains(":")) {
- String[] split = handleNode.getStf().split(":");
- bw.write(indent8 + "core.conversationService.sendStopConversation(actor, npc, 'conversation/" + split[0] + "', '" + split[1] + "')\n");
- } else {
- bw.write(indent8 + "# Couldn't write end response because of bad format!");
- }
+
+ String[] split = handleNode.getStf().toString().split(":");
+ bw.write(indent8 + "core.conversationService.sendStopConversation(actor, npc, 'conversation/" + split[0] + "', '" + split[1] + "')\n");
break;
}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/ConversationWidget.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/ConversationWidget.java
index aa75d94..6c5bae7 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/ConversationWidget.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/ConversationWidget.java
@@ -28,7 +28,7 @@ public class ConversationWidget extends IconNodeWidget implements LookupListener
this.attachedNode = node;
this.mgr = mgr;
- setLabel(node.getStf());
+ setLabel(node.getStf().toString());
setImage(ImageUtilities.loadImage(node.getImageStr()));
// Alignment/pos/ori
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/EditorTopComponent.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/EditorTopComponent.java
index 1eb772b..9ed5c27 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/EditorTopComponent.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/EditorTopComponent.java
@@ -124,7 +124,7 @@ public final class EditorTopComponent extends TopComponent implements ExplorerMa
}
public void blankSlate() {
- scene.addNode(new BeginNode("sdafsdf", 0));
- scene.addNode(new EndNode("asdfasdfsaf", 1));
+ scene.addNode(new BeginNode(scene.getStfFile(), 0));
+ scene.addNode(new EndNode(scene.getStfFile(), 1));
}
}
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 1e44c97..ee06820 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvEnd.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvEnd.java
@@ -45,7 +45,7 @@ public final class NewConvEnd implements ActionListener {
return;
int id = scene.getNextId();
- scene.addNode(new EndNode("New End Conversation " + String.valueOf(id), id));
+ scene.addNode(new EndNode(scene.getStfFile(), id));
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 50a20b1..ab20ccd 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvOption.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvOption.java
@@ -40,7 +40,7 @@ public final class NewConvOption implements ActionListener {
return;
int id = scene.getNextId();
- scene.addNode(new OptionNode("New Conversation Option " + String.valueOf(id), id));
+ scene.addNode(new OptionNode(scene.getStfFile(), id));
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 9da8fad..87131a7 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvResponse.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConvResponse.java
@@ -45,7 +45,7 @@ public final class NewConvResponse implements ActionListener {
return;
int id = scene.getNextId();
- scene.addNode(new ResponseNode("New Conversation Response " + String.valueOf(id), id));
+ scene.addNode(new ResponseNode(scene.getStfFile(), id));
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
deleted file mode 100644
index 032b8af..0000000
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/actions/NewConversation.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.projectswg.tools.csc.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 = 2),
- @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/nodes/ConversationNode.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/nodes/ConversationNode.java
index 9ba6444..5b29a98 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/nodes/ConversationNode.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/nodes/ConversationNode.java
@@ -1,17 +1,22 @@
package com.projectswg.tools.csc.conversationeditor.nodes;
+import com.projectswg.tools.csc.conversationeditor.nodes.editors.StfEditor;
+import com.projectswg.tools.csc.conversationeditor.stf.Stf;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.nodes.PropertySupport;
import org.openide.nodes.Sheet;
+import org.openide.util.Exceptions;
import org.openide.util.Lookup;
public class ConversationNode extends AbstractNode implements Lookup.Provider {
private final int id;
- private String stf;
+
+ private Stf stf;
+
private boolean locked;
private final Sheet sheet;
@@ -29,7 +34,7 @@ public class ConversationNode extends AbstractNode implements Lookup.Provider {
super(Children.LEAF);
this.id = id;
- this.stf = stf;
+ this.stf = new Stf(stf);
this.imageStr = imageStr;
this.sheet = super.createSheet();
@@ -39,25 +44,31 @@ public class ConversationNode extends AbstractNode implements Lookup.Provider {
properties.setShortDescription("Basic properties for all conversation nodes.");
properties.put(new IdProperty(this));
- properties.put(new StfProperty(this));
+ try {
+ properties.put(new StfProperty(this));
+ } catch (NoSuchMethodException ex) {
+ Exceptions.printStackTrace(ex);
+ }
properties.put(new LockedProperty(this));
sheet.put(properties);
this.type = type;
- this.setDisplayName(stf);
+ //this.setDisplayName("New Node"); Controls name shown in properties window
}
public final int getId() {
return id;
}
- public final String getStf() {
+ public Stf getStf() {
+ firePropertyChange("stf", stf, stf); // setStf is never used when changing property, so using getStf instead
return stf;
}
- public final void setStf(String stf) {
+ public void setStf(Stf stf) {
+ //firePropertyChange("Stf", this.stf.toString(), stf.toString());
this.stf = stf;
}
@@ -66,6 +77,7 @@ public class ConversationNode extends AbstractNode implements Lookup.Provider {
}
public final void setLocked(boolean isLocked) {
+ firePropertyChange("locked", this.locked, isLocked);
this.locked = isLocked;
}
@@ -123,17 +135,20 @@ final class LockedProperty extends PropertySupport.ReadWrite {
}
-final class StfProperty extends PropertySupport.ReadWrite {
+final class StfProperty extends PropertySupport.Reflection {
private final ConversationNode node;
- public StfProperty(ConversationNode node) {
- super("stf", String.class, "STF", "STF file for this conversation node, excluding conversation/. Ex: conversation/c_newbie_mentor:s_109 would be c_newbie_mentor:s_109");
- this.setValue("oneline", true);
+ public StfProperty(ConversationNode node) throws NoSuchMethodException {
+ super(node, Stf.class, "Stf");
+ //super("stf", String.class, "STF", "STF file for this conversation node, excluding conversation/. Ex: conversation/c_newbie_mentor:s_109 would be c_newbie_mentor:s_109");
+ //this.setValue("oneline", true);
+
+ this.setPropertyEditorClass(StfEditor.class);
this.node = node;
}
- @Override
+ /* @Override
public String getValue() throws IllegalAccessException, InvocationTargetException {
return node.getStf();
}
@@ -141,7 +156,7 @@ final class StfProperty extends PropertySupport.ReadWrite {
@Override
public void setValue(String val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
node.setStf(String.valueOf(val));
- }
+ }*/
}
final class IdProperty extends PropertySupport.ReadOnly {
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/nodes/editors/Bundle.properties b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/nodes/editors/Bundle.properties
new file mode 100644
index 0000000..717eb02
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/nodes/editors/Bundle.properties
@@ -0,0 +1,5 @@
+StfEditorVisual.jLabel1.text=STF File:
+StfEditorVisual.jLabel1.toolTipText=
+StfEditorVisual.jLabel2.text=STF Key:
+StfEditorVisual.tfStfKey.text=None
+StfEditorVisual.tfStfFile.text=None
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/nodes/editors/StfEditor.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/nodes/editors/StfEditor.java
new file mode 100644
index 0000000..01924b1
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/nodes/editors/StfEditor.java
@@ -0,0 +1,115 @@
+package com.projectswg.tools.csc.conversationeditor.nodes.editors;
+
+import com.projectswg.tools.csc.conversationeditor.EditorTopComponent;
+import com.projectswg.tools.csc.conversationeditor.scene.SceneView;
+import com.projectswg.tools.csc.conversationeditor.stf.Stf;
+import java.awt.Component;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyEditorSupport;
+import java.beans.PropertyVetoException;
+import java.beans.VetoableChangeListener;
+import java.util.Set;
+import org.openide.explorer.propertysheet.ExPropertyEditor;
+import org.openide.explorer.propertysheet.PropertyEnv;
+import org.openide.windows.TopComponent;
+
+public class StfEditor extends PropertyEditorSupport implements ExPropertyEditor, VetoableChangeListener {
+
+ private StfEditorVisual editor;
+ private PropertyEnv env;
+
+ public StfEditor() {
+ editor = new StfEditorVisual();
+ }
+
+ @Override
+ public Object getValue() {
+ if (super.getValue() == null) {
+ //System.out.println("NULL VALUE");
+ setValue(null);
+ }
+ Stf val = (Stf) super.getValue();
+
+ val.setKey(editor.getTfStfKey().getText());
+ val.setFile(editor.tfStfFile.getText());
+ //val.setValue((String) editor.stfValues.getModel().getElementAt(editor.stfValues.getSelectedIndex()));
+
+ return super.getValue(); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public boolean supportsCustomEditor() {
+ return true;
+ }
+
+ @Override
+ public void setAsText(String text) throws IllegalArgumentException {
+ //System.out.println("Setting as text.");
+ super.setAsText(text); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public String getAsText() {
+ Stf val = (Stf) super.getValue();
+ //System.out.println("Getting as text.");
+ return val.toString(); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public Component getCustomEditor() {
+ //editor.addPropertyChangeListener(StfEditorVisual.);
+ env.addVetoableChangeListener(this);
+ return editor; //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public void setValue(Object stf) {
+ if (stf != null) {
+ super.setValue(stf);
+ return;
+ }
+
+ TopComponent component = TopComponent.getRegistry().getActivated();
+ if (component == null || !(component instanceof EditorTopComponent)) {
+ Set components = TopComponent.getRegistry().getOpened();
+ boolean success = false;
+ for (TopComponent comp : components) {
+ if (comp instanceof EditorTopComponent) {
+ component = comp;
+ success = true;
+ break;
+ }
+ }
+ if (!success)
+ return;
+ }
+
+ EditorTopComponent editorComp = (EditorTopComponent) component;
+ SceneView scene = editorComp.getScene();
+
+ if (scene == null)
+ return;
+
+ if(stf==null){
+ stf = new Stf(scene.getStfFile());
+ }
+ editor.tfStfFile.setText(((Stf)stf).getFile());
+ editor.getTfStfKey().setText(((Stf)stf).getKey());
+ editor.stfValues.setListData(((Stf)stf).getEntries());
+ super.setValue(stf);
+ //System.out.println("Value set (setValue): " + ((Stf)stf).getKey());
+ }
+
+ @Override
+ public void attachEnv(PropertyEnv env) {
+ this.env = env;
+ editor.env = env;
+ editor.env.setState(PropertyEnv.STATE_NEEDS_VALIDATION);
+ }
+
+ @Override
+ public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
+ // Only thrown when OK is pressed.
+ Stf val = (Stf) getValue();
+ }
+}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/nodes/editors/StfEditorVisual.form b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/nodes/editors/StfEditorVisual.form
new file mode 100644
index 0000000..7df3e04
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/nodes/editors/StfEditorVisual.form
@@ -0,0 +1,120 @@
+
+
+
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/nodes/editors/StfEditorVisual.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/nodes/editors/StfEditorVisual.java
new file mode 100644
index 0000000..1806355
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/nodes/editors/StfEditorVisual.java
@@ -0,0 +1,121 @@
+/*
+ * 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.nodes.editors;
+
+import javax.swing.JTextField;
+import org.openide.explorer.propertysheet.PropertyEnv;
+
+/**
+ *
+ * @author Wave
+ */
+public class StfEditorVisual extends javax.swing.JPanel {
+
+ public PropertyEnv env;
+
+ /**
+ * Creates new form StfEditorVisual
+ */
+ public StfEditorVisual() {
+ initComponents();
+ }
+
+ public StfEditorVisual(PropertyEnv env) {
+ initComponents();
+ env.setState(PropertyEnv.STATE_NEEDS_VALIDATION);
+ }
+ /**
+ * 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.
+ */
+ @SuppressWarnings("unchecked")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jLabel1 = new javax.swing.JLabel();
+ tfStfFile = new javax.swing.JTextField();
+ jLabel2 = new javax.swing.JLabel();
+ tfStfKey = new javax.swing.JTextField();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ stfValues = new javax.swing.JList();
+
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(StfEditorVisual.class, "StfEditorVisual.jLabel1.text")); // NOI18N
+ jLabel1.setToolTipText(org.openide.util.NbBundle.getMessage(StfEditorVisual.class, "StfEditorVisual.jLabel1.toolTipText")); // NOI18N
+
+ tfStfFile.setText(org.openide.util.NbBundle.getMessage(StfEditorVisual.class, "StfEditorVisual.tfStfFile.text")); // NOI18N
+ tfStfFile.setEnabled(false);
+
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(StfEditorVisual.class, "StfEditorVisual.jLabel2.text")); // NOI18N
+
+ tfStfKey.setEditable(false);
+ tfStfKey.setText(org.openide.util.NbBundle.getMessage(StfEditorVisual.class, "StfEditorVisual.tfStfKey.text")); // NOI18N
+
+ stfValues.setModel(new javax.swing.AbstractListModel() {
+ String[] strings = { "NULL" };
+ public int getSize() { return strings.length; }
+ public Object getElementAt(int i) { return strings[i]; }
+ });
+ stfValues.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
+ public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
+ stfValuesValueChanged(evt);
+ }
+ });
+ jScrollPane1.setViewportView(stfValues);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jLabel1)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(tfStfFile))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jLabel2)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(tfStfKey, javax.swing.GroupLayout.DEFAULT_SIZE, 333, Short.MAX_VALUE)))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel1)
+ .addComponent(tfStfFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel2)
+ .addComponent(tfStfKey, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(18, 18, 18)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 209, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+ }// //GEN-END:initComponents
+
+ private void stfValuesValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_stfValuesValueChanged
+ tfStfKey.setText(stfValues.getSelectedValue().toString().split(" | ")[0]);
+ }//GEN-LAST:event_stfValuesValueChanged
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JScrollPane jScrollPane1;
+ public javax.swing.JList stfValues;
+ public javax.swing.JTextField tfStfFile;
+ private javax.swing.JTextField tfStfKey;
+ // End of variables declaration//GEN-END:variables
+
+ public JTextField getTfStfKey() {
+ return tfStfKey;
+ }
+}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scene/SceneSaver.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scene/SceneSaver.java
index 05b21aa..926ab5e 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scene/SceneSaver.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scene/SceneSaver.java
@@ -74,7 +74,7 @@ public class SceneSaver {
setAttribute(file, dataXMLNode, X_NODE, Integer.toString(location.x));
setAttribute(file, dataXMLNode, Y_NODE, Integer.toString(location.y));
setAttribute(file, dataXMLNode, LOCKED, Boolean.toString(node.isLocked()));
- setAttribute(file, dataXMLNode, STF, node.getStf());
+ setAttribute(file, dataXMLNode, STF, node.getDisplayName());
for (HashMap.Entry entry : node.getAttributes().entrySet()) {
setAttribute(file, dataXMLNode, entry.getKey(), entry.getValue().toString());
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scene/SceneView.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scene/SceneView.java
index 4b7a0c1..78ea981 100644
--- a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scene/SceneView.java
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scene/SceneView.java
@@ -4,8 +4,10 @@ import com.projectswg.tools.csc.conversationeditor.ConversationLookFeel;
import com.projectswg.tools.csc.conversationeditor.ConversationWidget;
import com.projectswg.tools.csc.conversationeditor.EditorTopComponent;
import com.projectswg.tools.csc.conversationeditor.nodes.ConversationNode;
+import com.projectswg.tools.csc.conversationeditor.stf.StfTable;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@@ -16,6 +18,7 @@ import org.netbeans.api.visual.widget.ConnectionWidget;
import org.netbeans.api.visual.widget.LayerWidget;
import org.netbeans.api.visual.widget.Widget;
import org.openide.explorer.ExplorerManager;
+import org.openide.util.Exceptions;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
@@ -29,6 +32,10 @@ public class SceneView extends GraphScene{
private String scenePath = "";
private boolean loaded = false;
+ private String stfFile = "None";
+
+ private StfTable stfTable;
+
private int id = 1;
public SceneView(ExplorerManager mgr) {
@@ -50,7 +57,7 @@ public class SceneView extends GraphScene{
}
@Override
- protected Widget attachNodeWidget(ConversationNode n) {
+ protected Widget attachNodeWidget(final ConversationNode n) {
final ConversationWidget widget = new ConversationWidget(this, mgr, n);
widget.getActions().addAction(createObjectHoverAction());
@@ -59,6 +66,7 @@ public class SceneView extends GraphScene{
@Override
public void propertyChange(PropertyChangeEvent evt) {
+
TopComponent component = WindowManager.getDefault().findTopComponent("EditorTopComponent");
if (component == null || !(component instanceof EditorTopComponent))
return;
@@ -69,9 +77,13 @@ public class SceneView extends GraphScene{
if (scene == null)
return;
+ widget.getLabelWidget().setLabel(n.getStf().toString());
+ widget.repaint();
+ scene.validate();
+
switch(evt.getPropertyName()) {
case "stf":
- widget.getLabelWidget().setLabel((String) evt.getNewValue());
+ widget.getLabelWidget().setLabel(evt.getNewValue().toString());
widget.repaint();
scene.validate();
@@ -79,6 +91,7 @@ public class SceneView extends GraphScene{
}
}
});
+
mainLayer.addChild(widget);
return widget;
}
@@ -143,6 +156,25 @@ public class SceneView extends GraphScene{
return loaded;
}
+ public String getStfFile() {
+ return stfFile;
+ }
+
+ public void setStfFile(String stfFile) {
+ this.stfFile = stfFile;
+ StfTable stfTable = new StfTable();
+ try {
+ stfTable.readFile(stfFile);
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ this.stfTable = stfTable;
+ }
+
+ public StfTable getStfTable() {
+ return stfTable;
+ }
+
public LinkedHashMap> getConversationLinks() {
List connectedNodes = connectionLayer.getChildren();
LinkedHashMap> conversationLinks = new LinkedHashMap<>();
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scenewizard/Bundle.properties b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scenewizard/Bundle.properties
new file mode 100644
index 0000000..aeb317f
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scenewizard/Bundle.properties
@@ -0,0 +1,4 @@
+SceneVisualPanel1.jLabel1.text=Conversation STF file
+SceneVisualPanel1.jButton1.text=Browse
+SceneVisualPanel1.jLabel2.text=Select directory for STF file. This is used for displaying conversation entries for nodes.
+SceneVisualPanel1.directory.text=None Specified
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scenewizard/SceneVisualPanel1.form b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scenewizard/SceneVisualPanel1.form
new file mode 100644
index 0000000..1dff019
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scenewizard/SceneVisualPanel1.form
@@ -0,0 +1,85 @@
+
+
+
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scenewizard/SceneVisualPanel1.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scenewizard/SceneVisualPanel1.java
new file mode 100644
index 0000000..7cc15de
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scenewizard/SceneVisualPanel1.java
@@ -0,0 +1,112 @@
+/*
+ * 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.scenewizard;
+
+import java.io.File;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import org.openide.filesystems.FileChooserBuilder;
+
+public final class SceneVisualPanel1 extends JPanel {
+
+ /**
+ * Creates new form SceneVisualPanel1
+ */
+ public SceneVisualPanel1() {
+ initComponents();
+ }
+
+ @Override
+ public String getName() {
+ return "Properties";
+ }
+
+ /**
+ * This method is called from within the constructor to initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is always
+ * regenerated by the Form Editor.
+ */
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jLabel1 = new javax.swing.JLabel();
+ directory = new javax.swing.JTextField();
+ jButton1 = new javax.swing.JButton();
+ jLabel2 = new javax.swing.JLabel();
+
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(SceneVisualPanel1.class, "SceneVisualPanel1.jLabel1.text")); // NOI18N
+
+ directory.setText(org.openide.util.NbBundle.getMessage(SceneVisualPanel1.class, "SceneVisualPanel1.directory.text")); // NOI18N
+ directory.setEnabled(false);
+
+ org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(SceneVisualPanel1.class, "SceneVisualPanel1.jButton1.text")); // NOI18N
+ jButton1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton1ActionPerformed(evt);
+ }
+ });
+
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(SceneVisualPanel1.class, "SceneVisualPanel1.jLabel2.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(jLabel1)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(directory, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jButton1))
+ .addComponent(jLabel2))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGap(32, 32, 32)
+ .addComponent(jLabel2)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel1)
+ .addComponent(directory, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jButton1))
+ .addContainerGap(220, Short.MAX_VALUE))
+ );
+ }// //GEN-END:initComponents
+
+ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
+ File home = new File(System.getProperty("user.home"));
+
+ File selection = new FileChooserBuilder("user-dir").setTitle("Select Directory").
+ setDefaultWorkingDirectory(home).setApproveText("Select").setDirectoriesOnly(false).showOpenDialog();
+
+ if (selection != null) {
+ String path = selection.getAbsolutePath();
+
+ if (!path.endsWith(".stf")) {
+ JOptionPane.showConfirmDialog(null, path + " is not a STF", "Error", JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+ directory.setText(path);
+ }
+ }//GEN-LAST:event_jButton1ActionPerformed
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JTextField directory;
+ private javax.swing.JButton jButton1;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ // End of variables declaration//GEN-END:variables
+
+ public JTextField getDirectory() {
+ return directory;
+ }
+}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scenewizard/SceneWizardAction.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scenewizard/SceneWizardAction.java
new file mode 100644
index 0000000..9571f70
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scenewizard/SceneWizardAction.java
@@ -0,0 +1,70 @@
+/*
+ * 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.scenewizard;
+
+import com.projectswg.tools.csc.conversationeditor.EditorTopComponent;
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+import javax.swing.JComponent;
+import org.openide.DialogDisplayer;
+import org.openide.WizardDescriptor;
+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;
+
+@ActionID(
+ category = "File",
+ id = "com.projectswg.tools.csc.conversationeditor.scenewizard.SceneWizardAction"
+)
+@ActionRegistration(
+ iconBase = "com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_new.png",
+ displayName = "New Conversation"
+)
+@ActionReferences({
+ @ActionReference(path = "Menu/File", position = 2),
+ @ActionReference(path = "Toolbars/File", position = 400),
+ @ActionReference(path = "Shortcuts", name = "D-N")
+})
+@NbBundle.Messages("CTL_NewConversation=New Conversation")
+public final class SceneWizardAction implements ActionListener {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ List> panels = new ArrayList>();
+ panels.add(new SceneWizardPanel1());
+ 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("New Conversation");
+ if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
+ EditorTopComponent newEditor = new EditorTopComponent();
+ newEditor.open();
+ newEditor.requestActive();
+ newEditor.getScene().setStfFile((String) wiz.getProperty("directory"));
+ }
+ }
+
+}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scenewizard/SceneWizardPanel1.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scenewizard/SceneWizardPanel1.java
new file mode 100644
index 0000000..6224fd1
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/scenewizard/SceneWizardPanel1.java
@@ -0,0 +1,68 @@
+/*
+ * 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.scenewizard;
+
+import javax.swing.event.ChangeListener;
+import org.openide.WizardDescriptor;
+import org.openide.util.HelpCtx;
+
+public class SceneWizardPanel1 implements WizardDescriptor.Panel {
+
+ /**
+ * The visual component that displays this panel. If you need to access the
+ * component from this class, just use getComponent().
+ */
+ private SceneVisualPanel1 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 SceneVisualPanel1 getComponent() {
+ if (component == null) {
+ component = new SceneVisualPanel1();
+ }
+ 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) {
+ wiz.putProperty("directory", component.getDirectory().getText());
+ }
+
+}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/stf/Stf.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/stf/Stf.java
new file mode 100644
index 0000000..44e2437
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/stf/Stf.java
@@ -0,0 +1,91 @@
+/*
+ * 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.stf;
+
+import com.projectswg.tools.csc.conversationeditor.stf.StfTable.Pair;
+import java.io.IOException;
+import java.util.Vector;
+import org.openide.util.Exceptions;
+
+public class Stf {
+ private String file;
+
+ private String key = "None";
+ private String value = "";
+
+ private Vector entries = new Vector<>();
+
+ public Stf(String file) {
+ this.file = file;
+
+ if (!getFilename().equals("None")) {
+ StfTable table = new StfTable();
+ try {
+ table.readFile(file);
+
+ for (Pair pair : table.disorderedTable) {
+ if (pair.getKey().equals("do_not_edit"))
+ continue;
+
+ entries.add(pair.getKey() + " | " + pair.getValue());
+ }
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+
+ }
+ }
+
+ public String getFile() {
+ return file;
+ }
+
+ public void setFile(String file) {
+ this.file = file;
+ }
+
+ public final String getFilename() {
+ String r2;
+ try {
+ String[] base = file.split("conversation");
+ r2 = base[1].replace("\\", "").replace(".stf", "");
+ } catch (ArrayIndexOutOfBoundsException exc) {
+ r2 = "None";
+ }
+ return r2;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public Vector getEntries() {
+ return entries;
+ }
+
+ public void setEntries(Vector entries) {
+ this.entries = entries;
+ }
+
+ @Override
+ public String toString() {
+ return getFilename() + ":" + getKey();
+ }
+
+
+}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/stf/StfTable.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/stf/StfTable.java
new file mode 100644
index 0000000..2571328
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/stf/StfTable.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Part of NGECore2
+ * Copyright (c) 2013
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ ******************************************************************************/
+package com.projectswg.tools.csc.conversationeditor.stf;
+
+import java.io.IOException;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+/*
+ * Stf files don't appear to use the IFF format.
+ *
+ * ID 0 will probably always be null because they start at 1.
+ */
+public class StfTable {
+
+ private String[][] orderedTable;
+ public List> disorderedTable;
+
+ public class Pair {
+
+ private K key;
+ private V value;
+
+ public Pair(K key, V value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ public K getKey() {
+ return key;
+ }
+
+ public V getValue() {
+ return value;
+ }
+
+ }
+
+ public StfTable() {
+
+ }
+
+ public StfTable(String filePath) throws IOException {
+ readFile(filePath);
+ }
+
+ public void readFile(String filePath) throws IOException {
+ java.io.FileInputStream stf = new java.io.FileInputStream(filePath);
+
+ IoBuffer buffer = IoBuffer.allocate(stf.available(), false);
+
+ buffer.setAutoExpand(true);
+ buffer.order(ByteOrder.LITTLE_ENDIAN);
+
+ byte[] buf = new byte[1024];
+
+ for (int i = stf.read(buf); i != -1; i = stf.read(buf)) {
+ buffer.put(buf, 0, i);
+ }
+
+ buffer.flip();
+
+ buffer.getInt(); // Size?
+
+ buffer.get(); // isMore?
+
+ int arrayCount = buffer.getInt();
+
+ int rowCount = buffer.getInt();
+
+ orderedTable = new String[arrayCount][2];
+ disorderedTable = new ArrayList>();
+
+ for (int i = 0; i < rowCount; i++) {
+ int id = buffer.getInt();
+ buffer.getInt();
+ String value = "";
+ value = StringUtilities.getUnicodeString(buffer, true);
+ orderedTable[id][0] = null;
+ orderedTable[id][1] = value;
+ }
+
+ for (int i = 0; i < rowCount; i++) {
+ int id = buffer.getInt();
+ String name = StringUtilities.getAsciiString(buffer, true);
+ orderedTable[id][0] = name;
+ disorderedTable.add(new Pair(name, orderedTable[id][1]));
+ }
+
+ stf.close();
+ }
+
+ public int getRowCount() {
+ return ((orderedTable == null) ? 0 : orderedTable.length);
+ }
+
+ public int getColumnCount() {
+ return ((orderedTable == null) ? 0 : 3);
+ }
+
+ /*
+ * @param id Iteration number
+ *
+ * @returns String's key-value pair from an alphanumeric list
+ */
+ public Pair getString(int id) {
+ return disorderedTable.get(id);
+ }
+
+ /*
+ * @param id Identifying number of the string from the .stf file, unlike above
+ *
+ * @returns String's key-value pair from an unordered list
+ */
+ public Pair getStringById(int id) {
+ return new Pair(orderedTable[id][0], orderedTable[id][1]);
+ }
+
+ /*
+ * @param name Name of the string to return
+ *
+ * @returns The value for this key, or null if the key is not found
+ */
+ public String getString(String name) {
+ for (String[] columns : orderedTable) {
+ if (columns[0].equals(name)) {
+ return columns[1];
+ }
+ }
+
+ return null;
+ }
+
+}
diff --git a/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/stf/StringUtilities.java b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/stf/StringUtilities.java
new file mode 100644
index 0000000..3fca536
--- /dev/null
+++ b/ConversationEditor/src/com/projectswg/tools/csc/conversationeditor/stf/StringUtilities.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Part of NGECore2
+ * Copyright (c) 2013
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ ******************************************************************************/
+package com.projectswg.tools.csc.conversationeditor.stf;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+public class StringUtilities {
+
+ public static String getUnicodeString(IoBuffer buffer, boolean integer) {
+ return getString(buffer, "UTF-16LE", integer);
+ }
+
+ public static String getAsciiString(IoBuffer buffer, boolean integer) {
+ return getString(buffer, "US-ASCII", integer);
+ }
+
+ private static String getString(IoBuffer buffer, String charFormat, boolean integer) {
+ String result;
+ int length;
+
+ if (charFormat.equals("UTF-16LE")) {
+ if (integer) {
+ length = buffer.order(ByteOrder.LITTLE_ENDIAN).getInt() * 2;
+ } else {
+ length = buffer.order(ByteOrder.LITTLE_ENDIAN).getInt();
+ }
+ } else {
+ if (integer) {
+ length = buffer.order(ByteOrder.LITTLE_ENDIAN).getInt();
+ } else {
+ length = buffer.order(ByteOrder.LITTLE_ENDIAN).getShort();
+ }
+ }
+
+ int bufferPosition = buffer.position();
+
+ try {
+ result = new String(buffer.array(), bufferPosition, length, charFormat);
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ return "";
+ }
+
+ buffer.position(bufferPosition + length);
+
+ return result;
+ }
+}
diff --git a/mina-core/build.xml b/mina-core/build.xml
new file mode 100644
index 0000000..5235457
--- /dev/null
+++ b/mina-core/build.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+ Builds, tests, and runs the project com.projectswg.minacore.
+
+
diff --git a/mina-core/manifest.mf b/mina-core/manifest.mf
new file mode 100644
index 0000000..d34128a
--- /dev/null
+++ b/mina-core/manifest.mf
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+AutoUpdate-Show-In-Client: true
+OpenIDE-Module: com.projectswg.minacore
+OpenIDE-Module-Localizing-Bundle: com/projectswg/minacore/Bundle.properties
+OpenIDE-Module-Specification-Version: 1.0
+
diff --git a/mina-core/nbproject/build-impl.xml b/mina-core/nbproject/build-impl.xml
new file mode 100644
index 0000000..73fa6bc
--- /dev/null
+++ b/mina-core/nbproject/build-impl.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ You must set 'suite.dir' to point to your containing module suite
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mina-core/nbproject/genfiles.properties b/mina-core/nbproject/genfiles.properties
new file mode 100644
index 0000000..3274757
--- /dev/null
+++ b/mina-core/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=4841ee18
+build.xml.script.CRC32=c0ea07ec
+build.xml.stylesheet.CRC32=a56c6a5b@2.67.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=4841ee18
+nbproject/build-impl.xml.script.CRC32=78cc321f
+nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.67.1
diff --git a/mina-core/nbproject/project.properties b/mina-core/nbproject/project.properties
new file mode 100644
index 0000000..c4a287a
--- /dev/null
+++ b/mina-core/nbproject/project.properties
@@ -0,0 +1 @@
+is.autoload=true
diff --git a/mina-core/nbproject/project.xml b/mina-core/nbproject/project.xml
new file mode 100644
index 0000000..0e9250b
--- /dev/null
+++ b/mina-core/nbproject/project.xml
@@ -0,0 +1,65 @@
+
+
+ org.netbeans.modules.apisupport.project
+
+
+ com.projectswg.minacore
+
+
+
+ org.apache.mina.core
+ org.apache.mina.core.buffer
+ org.apache.mina.core.file
+ org.apache.mina.core.filterchain
+ org.apache.mina.core.future
+ org.apache.mina.core.polling
+ org.apache.mina.core.service
+ org.apache.mina.core.session
+ org.apache.mina.core.write
+ org.apache.mina.filter.buffer
+ org.apache.mina.filter.codec
+ org.apache.mina.filter.codec.demux
+ org.apache.mina.filter.codec.prefixedstring
+ org.apache.mina.filter.codec.serialization
+ org.apache.mina.filter.codec.statemachine
+ org.apache.mina.filter.codec.textline
+ org.apache.mina.filter.errorgenerating
+ org.apache.mina.filter.executor
+ org.apache.mina.filter.firewall
+ org.apache.mina.filter.keepalive
+ org.apache.mina.filter.logging
+ org.apache.mina.filter.reqres
+ org.apache.mina.filter.ssl
+ org.apache.mina.filter.statistic
+ org.apache.mina.filter.stream
+ org.apache.mina.filter.util
+ org.apache.mina.handler.chain
+ org.apache.mina.handler.demux
+ org.apache.mina.handler.multiton
+ org.apache.mina.handler.stream
+ org.apache.mina.proxy
+ org.apache.mina.proxy.event
+ org.apache.mina.proxy.filter
+ org.apache.mina.proxy.handlers
+ org.apache.mina.proxy.handlers.http
+ org.apache.mina.proxy.handlers.http.basic
+ org.apache.mina.proxy.handlers.http.digest
+ org.apache.mina.proxy.handlers.http.ntlm
+ org.apache.mina.proxy.handlers.socks
+ org.apache.mina.proxy.session
+ org.apache.mina.proxy.utils
+ org.apache.mina.transport
+ org.apache.mina.transport.socket
+ org.apache.mina.transport.socket.nio
+ org.apache.mina.transport.vmpipe
+ org.apache.mina.util
+ org.apache.mina.util.byteaccess
+ testcase
+
+
+ ext/mina-core-2.0.4.jar
+ release/modules/ext/mina-core-2.0.4.jar
+
+
+
+
diff --git a/mina-core/nbproject/suite.properties b/mina-core/nbproject/suite.properties
new file mode 100644
index 0000000..29d7cc9
--- /dev/null
+++ b/mina-core/nbproject/suite.properties
@@ -0,0 +1 @@
+suite.dir=${basedir}/..
diff --git a/mina-core/release/modules/ext/mina-core-2.0.4.jar b/mina-core/release/modules/ext/mina-core-2.0.4.jar
new file mode 100644
index 0000000..1e7ba38
Binary files /dev/null and b/mina-core/release/modules/ext/mina-core-2.0.4.jar differ
diff --git a/mina-core/src/com/projectswg/minacore/Bundle.properties b/mina-core/src/com/projectswg/minacore/Bundle.properties
new file mode 100644
index 0000000..1dd9263
--- /dev/null
+++ b/mina-core/src/com/projectswg/minacore/Bundle.properties
@@ -0,0 +1 @@
+OpenIDE-Module-Name=mina-core
diff --git a/nbproject/project.properties b/nbproject/project.properties
index 782fb1d..4498362 100644
--- a/nbproject/project.properties
+++ b/nbproject/project.properties
@@ -9,5 +9,7 @@ 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.conversationeditor}:\
+ ${project.com.projectswg.minacore}
+project.com.projectswg.minacore=mina-core
project.com.projectswg.tools.csc.conversationeditor=ConversationEditor