Code templates in the jMEDK

There are a lot of generic netbeans code templates, that I often use when programming, so I thought I would write a few of my own. If you guys think this would be useful, then if you can compile a list of all the popular ones you think would be useful for having abbreviations, then I can write them and export them, then everyone can import them. These are meant to be used with the code palette to speed up programming and I thought a set of specialized jME ones would be beneficial.



An example of me using them:

http://www.youtube.com/watch?v=Si6AuLwe-gQ



I currently have (was just messing around with them):



si → SimpleApplication

newtest → Creates a test suite

newmat → Material mat = new Material (assetManager, “Common/Misc/MatDefs/Unshaded.j3md”);

newbox ->Box box = new Box (Vector3f.ZERO, new Vector())

newge ->Geometry geometry = new Geometry (“name”, );

roach → rootNode.attachChild();

physt → PhysicsTickCollisionListener

physc → PhysicsCollisionListener



Theres a few other tricks I can do, such as automatically positioning the cursor, highlighting some words, so that the user can change them etc… I haven’t investigated all of them properly.

4 Likes

newlit?

bit more detail? :stuck_out_tongue:

like newmat but lit :stuck_out_tongue:

ah right



maybe should be:

newumat → new unshaded

newlmat → new lighting

newtmat → new terrain

newpmat → new particle



edit: and for physics controls, maybe this:

newrbctrl → new rigidbody

newgctrl → new ghostcontrol

newcctrl → new charactercontrol

newrbkctrl → new rigidbody kinematic



rbctrl → “RigidBodyControl”

gctrl → “GhostControl”

cctrl → “CharacterControl”



edit: and for maths

qua → “Quaternion”

newqua → new quaternion

newqua45x → new Quaternion with 45 degrees in X axis (and similar ones ofc, although the palette does something similar already, you don’t have to use your mouse :), but still undecided about this one)



vec2 → “Vector2f”

vec3 → “Vector3f”

newvec2 → new Vector2f

newvec3 → new Vector3f

Hey, how you did that? Can I also do this in regular Netbeans?

@shirkit said:
Hey, how you did that? Can I also do this in regular Netbeans?

yeah : menu Tools/Optionsn "Editor" tab, then "Code Templates" tab.

http://netbeans.org/project_downloads/www/shortcuts.pdf the bottom page has a full list of generic java ones, very useful. By default its set to tab, but you can change that if desired

@normen if I create a list of these is it possible to incorporate it into the jMEDK on install?

No idea, don’t know where they are stored and how its possible to replace them. But sure, if theres a way…

Apparently I can create an XML file for them, and share them as a plugin, maybe thats better

http://platform.netbeans.org/tutorials/70/nbm-code-template.html

Kewl, yeah we could just add that to the drag&drop templates plugin.

ok I will try it tomorrow and give people a chance to post any suggestions about any more that they think would be useful :slight_smile: or if you don’t like the format, and want to offer alternatives then that’s fine also.

I think you covered the most common things. Maybe vec3 or v3f creates a new Vector3f