forked from ajanata/PretendYoureXyzzy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move MessageType back inside QueuedMessage since the client doesn't n…
…eed it make converter to produce js enums out of java enums make everything use the constants on both sides for ajax operation code and disconnect reason move the handler update out of the subpackage that it generates into make the enum update and handler update run at build
- Loading branch information
Showing
27 changed files
with
222 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType"> | ||
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <resources> <item path="/cah/WebContent/js/cah.constants.js" type="1"/> <item path="/cah/src/net/socialgamer/cah/handlers" type="2"/> </resources>}"/> | ||
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> | ||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <resources> <item path="/cah/src/net/socialgamer/cah/handlers" type="2"/> </resources>}"/> | ||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE" value="${projects:cah}"/> | ||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/cah/src/net/socialgamer/cah/UpdateHandlerList.cmd}"/> | ||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="incremental,auto,"/> | ||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> | ||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc}"/> | ||
</launchConfiguration> |
11 changes: 11 additions & 0 deletions
11
.externalToolBuilders/Update JS Constants [Builder].launch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType"> | ||
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <resources> <item path="/cah/WebContent/js/cah.constants.js" type="1"/> </resources>}"/> | ||
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> | ||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <resources> <item path="/cah/src/net/socialgamer/cah/Constants.java" type="1"/> </resources>}"/> | ||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE" value="${projects:cah}"/> | ||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/cah/src/net/socialgamer/cah/UpdateJsConstants.cmd}"/> | ||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="incremental,auto,"/> | ||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> | ||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc}"/> | ||
</launchConfiguration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
#Fri Dec 09 20:46:02 PST 2011 | ||
#Thu Jan 12 19:45:21 PST 2012 | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.6 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// This file is automatically generated. Do not edit. | ||
|
||
cah.$ = {}; | ||
|
||
cah.$.AjaxOperation = function() { | ||
// pass | ||
}; | ||
cah.$.AjaxOperation.prototype.dummy = undefined; | ||
cah.$.AjaxOperation.FIRST_LOAD = "firstload"; | ||
cah.$.AjaxOperation.LOG_OUT = "logout"; | ||
cah.$.AjaxOperation.REGISTER = "register"; | ||
cah.$.AjaxOperation.CHAT = "chat"; | ||
cah.$.AjaxOperation.NAMES = "names"; | ||
|
||
cah.$.DisconnectReason = function() { | ||
// pass | ||
}; | ||
cah.$.DisconnectReason.prototype.dummy = undefined; | ||
cah.$.DisconnectReason.PING_TIMEOUT = "ping_timeout"; | ||
cah.$.DisconnectReason.KICKED = "kicked"; | ||
cah.$.DisconnectReason.MANUAL = "manual"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
java -cp build\classes net.socialgamer.cah.UpdateHandlerList |
2 changes: 1 addition & 1 deletion
2
...gamer/cah/handlers/UpdateHandlerList.java → ...et/socialgamer/cah/UpdateHandlerList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
java -cp build\classes net.socialgamer.cah.UpdateJsConstants |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package net.socialgamer.cah; | ||
|
||
import java.io.File; | ||
import java.io.PrintWriter; | ||
import java.lang.reflect.Field; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
|
||
public class UpdateJsConstants { | ||
|
||
private static final String enumHeaderFmt = "cah.$.%s = function() {\r\n // pass\r\n};\r\n"; | ||
private static final String enumDummyFmt = "cah.$.%s.prototype.dummy = undefined;\r\n"; | ||
private static final String enumValueFmt = "cah.$.%s.%s = \"%s\";\r\n"; | ||
|
||
/** | ||
* @param args | ||
*/ | ||
@SuppressWarnings("rawtypes") | ||
public static void main(final String[] args) throws Exception { | ||
final String dir = "WebContent/js/"; | ||
final File outFile = new File(dir + "cah.constants.js"); | ||
assert outFile.canWrite(); | ||
assert outFile.delete(); | ||
assert outFile.createNewFile(); | ||
final PrintWriter writer = new PrintWriter(outFile); | ||
|
||
writer.println("// This file is automatically generated. Do not edit."); | ||
writer.println(); | ||
writer.println("cah.$ = {};"); | ||
writer.println(); | ||
|
||
final Class[] classes = Constants.class.getClasses(); | ||
for (final Class c : classes) { | ||
final String cName = c.getName().split("\\$")[1]; | ||
System.out.println(cName); | ||
writer.format(enumHeaderFmt, cName); | ||
writer.format(enumDummyFmt, cName); | ||
final Map<String, String> values = getEnumValues(c); | ||
for (final String key : values.keySet()) { | ||
final String value = values.get(key); | ||
writer.format(enumValueFmt, cName, key, value); | ||
} | ||
writer.println(); | ||
} | ||
writer.flush(); | ||
writer.close(); | ||
} | ||
|
||
@SuppressWarnings("rawtypes") | ||
private static Map<String, String> getEnumValues(final Class enumClass) | ||
throws IllegalArgumentException, IllegalAccessException { | ||
if (!enumClass.isEnum()) { | ||
throw new IllegalArgumentException(enumClass.getName() + " is not an enum"); | ||
} | ||
|
||
final Field[] flds = enumClass.getDeclaredFields(); | ||
final HashMap<String, String> enumMap = new HashMap<String, String>(); | ||
for (final Field f : flds) { | ||
if (f.isEnumConstant()) { | ||
enumMap.put(f.getName(), f.get(null).toString()); | ||
} | ||
} | ||
return enumMap; | ||
} | ||
} | ||
|
||
////Automatically generated file. Do not edit! | ||
// | ||
//cah.$ = {}; | ||
// | ||
//cah.$.DisconnectReason = {}; | ||
//cah.$.DisconnectReason.prototype.dummy = undefined; | ||
//cah.$.DisconnectReason.KICKED = "kicked"; | ||
//cah.$.DisconnectReason.MANUAL = "manual"; | ||
//cah.$.DisconnectReason.PING_TIMEOUT = "ping_timeout"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.