Hmm, all right, let me do a few more steps for you.
You said you want to do it when pressing the button, therefore your next step is finding out what the button does. Find the button (CreateInvoiceProposal) and look at its type. I could be a menu item button and then you would check which object does the menu item point to. But in this case, is just a regular button and therefore expand its methods and open clicked method.
You'll see it calling psaRetenetionRelease object, therefore your logic should go there.
Open the class (PSARetenetionRelease) and explore its implementation. You may notice that it extends ProjInvoiceChoose, which has validate() method and that sounds like the right place for validations.
validate() is actually a framework method - ProjInvoiceChoose extends RunBaseBatch and validate() is a method of the RunBase framework.
This is the kind of things you must do when finding the right place for your logic.