views:

282

answers:

2

Since we cannot setup Eclipse's RSE to use at the tool for remote editing, I have installed Unison. But how can I get Eclipse to automatically run unison on every file save? Is there an eclipse plugin available for this?

TIA

+1  A: 

Depending on the importance, I would write a simple plugin to handle this.

EDIT: All you really need to do is this:

1) Create the plugin from the templates with the RCP\PDE Eclipse install
2) Add the following code to your activator...

@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 ) {}

 } );
}
javamonkey79
The editor "on save" actions are pluggable via extension point and it sounds like a useful addition.
cjstehno
+2  A: 

You can setup it to be run on every build. Any external tool can be run on every build, just open project's preferences, go to Builders page, click “New…”.

Andrey Tarantsov