Whenever I press Ctrl + S in eclipse to save source code I want some custom CMD on shell to run on my CentOS host. How can I do that?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your best bet is to add an external builder to your project. You can choose to run an ant script or an arbitrary program (like /bin/bash) with arguments of your choice. Every time a project resource is saved (like a file) your builder will be run. See Ant Project Builders for a discussion on external builders.
The Java Editor has Save Actions that can be activated and customized, but AFAIK they don’t include the ability to run a program. See
Preferences > Java > Editors.If you can write plugins, you can also add an
org.eclipse.core.commands.IExecutionListenerto theorg.eclipse.ui.commands.ICommandServiceand listen for the Save command (org.eclipse.ui.IWorkbenchCommandConstants.FILE_SAVE). Then you can do anything that you can write in java. But the external project builders are probably the fastest way to what you want.