JBoss Tools is a set of plugins for Eclipse that make working with JBoss AS in Eclipse easy. And the documentation for JBoss Tools is pretty good - going through some of the Getting Started guides should get you on your way; they start from installing the tools through writing and running some basic apps. I recommend following at least one or two of the examples in the guides before attempting to work with your app.
Here is the URL for JBoss Tools: www.jboss.org/tools
This page lists JBoss Tools and JBoss AS compatibility - you might have to read an older set of guides to get AS 5.1.0 instructions, the most recent guides probably are more focused on AS 7.
https://community.jboss.org/wiki/MatrixOfSupportedPlatformsRuntimesAndTechnologiesInJBossToolsJBDS