You need to set up your Extensions as a 'Tool'.http://ruby.sketchup.com/Sketchup/Tool.html
Clear the selection as you initialize.
On a mouse-click you use a pick-helper.
That filters what you have clicked on - so you can have various results.
You then filter that further by limiting what chosen by some other factor[s] like: context, already-selected, material, layer, name, attribute etc.
If you have a valid object add it to the selection.
Repeat until the user exits - e.g. double-click or <enter> press - then go onto the next step in your tool...