PDT Eclipse to auto upload on save

Frankie picture Frankie · Mar 16, 2009 · Viewed 13.9k times · Source

I am migrating from a Dreamweaver forced working environment to a free-of-choice one. That said I must say I was rather enthusiastic about being able to use Dreamweaver PDT. However I have come to rely very heavily on the use of the "auto upload on save" function.

I am developing LAMP but oriented to a Windows base majority so I really must run Windows native and test heavy for IE, all projects work smooth on FF and Safari, IE's really the bottleneck. On the other hand I like to have my project served by a clone of the server so I have a Virtual machine on windows running Linux that works as my Dev Server.

As you can tell the auto-update on save works like a charm.

I've dug up some of the documentation and I've also Google quite a bit and found nothing (besides Aptana) to suit my needs. I am looking in the wrong direction or isn't there really something like this for Eclipse?

Thank you in advance!

Answer

Frankie picture Frankie · Oct 6, 2009

After some months of using different set ups I've come to use a combination that's perfect for my needs and though I should share.

Eclipse running Aptana as plug-in.

All the power of Eclipse and all the usability of Dreamweaver plus some nice Aptana goodies. That said, after installing Aptana as a plug-in just create a new file under the /scripts directory (or put that file into a project you'll never close) and the following code inside:

/* 
 * Menu: gMan > Upload On Save 
 * Kudos: Ingo Muschenetz 
 * License: EPL 1.0 
 * Listener: commandService().addExecutionListener(this); 
 * DOM: http://localhost/com.aptana.ide.syncing.doms
 * DOM: http://download.eclipse.org/technology/dash/update/org.eclipse.eclipsemonkey.lang.javascript 
 */  

function commandService() 
{ 
   var commandServiceClass = Packages.org.eclipse.ui.commands.ICommandService; 
   var commandService = Packages.org.eclipse.ui.PlatformUI.getWorkbench().getAdapter(commandServiceClass);
   return commandService; 
} 

function preExecute(commandId, event) {}

function postExecuteSuccess(commandId, returnValue) 
{ 
   if (commandId == "org.eclipse.ui.file.save") 
   { 
       sync.uploadCurrentEditor(); 
   } 
}

function notHandled(commandId, exception) {} 

function postExecuteFailure(commandId, exception) {}

So, if the project your working on has a syncronize connection active on each and every save you'll have the file uploaded to the server.

Hope it saves you some time!