If you're plug-in is using the Commands framework, then you're action will trigger a handler. Handler have a utility called HandlerUtil and there is a nice collection of useful methods in there. You can get the current selection in the util and will get an IFile object. For that one you can simply get the location and print it wherever you want.

It should work similar with Actions (all though I'd have to look it up). Pretty sure though that there is some sort of selection event. You should check if you can get the selection from that even and print out its location.