Posted By

nerdfiles on 09/17/09


Tagged

save upload eclipse Development aptana IDE


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

jodm


Aptana, Upload File on Save


 / Published in: JavaScript
 

I believe the spaces between the asterisk and the base of the row are important. Moreover, I think the positioning of main() is also important.

It seems a lot of things that we are taught are not important in programming or as "permissible" do in fact have significance here.

Obviously the comment block up top is a "variable declaration block." Aptana sniffs for these.

  1. /*
  2.  * Currently an example script (disabled)> Copy as your own script, and modify
  3.  * the Listener command as shown below
  4.  * Listener: commandService().addExecutionListener(this);
  5.  * Menu: Synchronize > Upload Current File On Save
  6.  * Kudos: Ingo Muschenetz
  7.  * License: EPL 1.0
  8.  * DOM: http://localhost/com.aptana.ide.syncing.doms
  9.  * DOM: http://download.eclipse.org/technology/dash/update/org.eclipse.eclipsemonkey.lang.javascript
  10.  */
  11.  
  12. /**
  13.  * Returns a reference to the workspace command service
  14.  */
  15.  
  16. function main() {}
  17.  
  18. function commandService()
  19. {
  20. var commandServiceClass = Packages.org.eclipse.ui.commands.ICommandService;
  21.  
  22. // same as doing ICommandService.class
  23. var commandService = Packages.org.eclipse.ui.PlatformUI.getWorkbench().getAdapter(commandServiceClass);
  24. return commandService;
  25. }
  26.  
  27. /**
  28.  * Called before any/every command is executed, so we must filter on command ID
  29.  */
  30. function preExecute(commandId, event) {}
  31.  
  32. /* Add in all methods required by the interface, even if they are unused */
  33. function postExecuteSuccess(commandId, returnValue)
  34. {
  35.  
  36. // if we see a save command
  37. if (commandId == "org.eclipse.ui.file.save")
  38. {
  39. sync.uploadCurrentEditor();
  40.  
  41. /* Replace above line if you'd like to limit it to just certain projects
  42.   var fileName = editors.activeEditor.uri;
  43.   if(fileName.match(/projectName/ig))
  44.   {
  45.   sync.uploadCurrentEditor();
  46.   }
  47.   */
  48. }
  49. }
  50.  
  51. function notHandled(commandId, exception) {}
  52.  
  53. function postExecuteFailure(commandId, exception) {}

Report this snippet  

You need to login to post a comment.