When you have imported the model in Eclipse and you commit your Java in Eclipse it should just work. You could double check it if after the commit in Eclipse you open up your model directory and check the code in the javasource directory (find the module open the sub dir and open the actions dir and the the action you have changed in a text editor. It should be the same as in Eclipse. You could also check the changed date status of the file. If it is not changed you did something weird in Eclipse and you need to make sure that you imported the Mendix model in the correct way.
You need to put your changes between the blocks marked BEGIN USER CODE and END USER CODE. If you change anything outside these blocks (with the exception of import statements) then your code will be overwritten next time you build your application.
In your example, I can see you are making changes outside these blocks, so Mendix would overwrite these when you run the application locally.
Hope this helps.