How to add hook for Ctrl + S event in eclipse?

Whenever I press Ctrl+ Sin eclipse to save the source code, I want a custom CMD for the shell to run on my CentOS host. How can i do this?

+5
source share
3 answers

It is best to add an external project to your project. You can choose an ant script or an arbitrary program (e.g. / bin / bash) with arguments of your choice. Each time a project resource is saved (for example, a file), your developer will be launched. See Ant Project Builders for a discussion of external builders.

There are actions in the Java editor that can be activated and customized, but AFAIK does not include the ability to run the program. See Preferences > Java > Editors.

If you can write plugins, you can also add org.eclipse.core.commands.IExecutionListenerto org.eclipse.ui.commands.ICommandServiceand listen to the Save ( org.eclipse.ui.IWorkbenchCommandConstants.FILE_SAVE) command . Then you can do whatever you can write in java. But external project developers are probably the fastest way for what you want.

+7
source

Assuming you are Java in Eclipse ... no.

Java initially cannot connect keyboards or mice. The only way to register keys is when the java application is focused.

C or C ++ is the way to intercept.

Java, C/++-. .

0

, ... .

Yo CI .

"" pref eclipse Key pref, Ctrl + S

XShell Jenkins, .

0

All Articles