Added creator files
@@ -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>
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
@@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=90d565b1
|
||||
build.xml.script.CRC32=af729615
|
||||
build.xml.stylesheet.CRC32=[email protected]
|
||||
# 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=[email protected]
|
||||
@@ -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>
|
||||
@@ -0,0 +1,2 @@
|
||||
javac.source=1.7
|
||||
javac.compilerargs=-Xlint -Xlint:-serial
|
||||
@@ -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>
|
||||
@@ -0,0 +1 @@
|
||||
suite.dir=${basedir}/..
|
||||
@@ -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
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 22 KiB |
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||