Polyline Creation - Tool

I’m trying to put together a tool within my plugin that allows the user to select a string of lines (point by point) and then draws a foundation wall along it. If the user closes the polygon created by these lines this is easy enough to detect since I just check if the original point is selected each time I detect another point. However what I would like it to be able to do is have the user right click the mouse to end or terminate the line entry and then have the plugin proceed with the geometry creation without requiring a closed polygon. I’m sure I can eventually figure this out but I am wondering if there is already some code out there that is floating around that will allow me not to reinvent the wheel on this one.

You should by now have installed (or downloaded) the Examples extension by the SketchUp Team.
Use it’s linetool example as a template for your tool. (But wrap it in your own company and plugin module nesting.)

http://extensions.sketchup.com/en/content/example-ruby-scripts

The Utilities Tools examples are also good ones top study:

http://extensions.sketchup.com/en/content/utilities-tools