在Eclipse中保存时运行外部应用程序

在Eclipse中保存时运行外部应用程序,eclipse,eclipse-plugin,unison,Eclipse,Eclipse Plugin,Unison,由于我们无法将Eclipse的RSE设置为在远程编辑工具上使用,因此我安装了。但我如何让Eclipse在每次保存文件时自动运行unison呢?是否有一个eclipse插件可用于此 TIA根据重要性,我将编写一个简单的插件来处理这个问题 编辑: 您真正需要做的就是: 1) 使用RCP\PDE Eclipse安装从模板创建插件 2) 将以下代码添加到激活器… @Override public void start( final BundleContext context ) throws Excep

由于我们无法将Eclipse的RSE设置为在远程编辑工具上使用,因此我安装了。但我如何让Eclipse在每次保存文件时自动运行unison呢?是否有一个eclipse插件可用于此


TIA

根据重要性,我将编写一个简单的插件来处理这个问题

编辑: 您真正需要做的就是:

1) 使用RCP\PDE Eclipse安装从模板创建插件
2) 将以下代码添加到激活器…

@Override
public void start( final BundleContext context ) throws Exception {
    super.start( context );
    plugin = this;

    ICommandService commandService = (ICommandService)plugin.getWorkbench().getService( ICommandService.class );
    commandService.addExecutionListener( new IExecutionListener() {

        public void notHandled( final String commandId, final NotHandledException exception ) {}

        public void postExecuteFailure( final String commandId, final ExecutionException exception ) {}

        public void postExecuteSuccess( final String commandId, final Object returnValue ) {
            if ( commandId.equals( "org.eclipse.ui.file.save" ) ) {
                // add in your action here...
                // personally, I would use a custom preference page, 
                // but hard coding would work ok too
            }
        }

        public void preExecute( final String commandId, final ExecutionEvent event ) {}

    } );
}

您可以将其设置为在每个生成上运行。任何外部工具都可以在每个构建上运行,只需打开项目的首选项,转到构建器页面,单击“新建…”。

编辑器“保存时”操作可通过扩展点插入,听起来像是一个有用的添加。在最新版本的Eclipse中,您可以通过选中“构建选项”上的“在自动构建期间”将构建器设置为在保存时运行“生成器属性”选项卡。