code: function buildDeploymentTrigger(options){
  		options = options || {};
  
  		return function(results){
  			var initialConfName = options.ConfName;
  			var confName = results.ConfName;
  
  			var disableUI = options.disableUI;
  			var enableUI = options.enableUI;
  			var showMessage = options.showMessage;
  			var closeFrame = options.closeFrame;
  
  			var postMsg = options.postMsg;
  			var postError = options.postError;
  
  			var fileService = options.FileService;
  			var targetSelection = options.getTargetSelection();
  
  			var userManifest = options.Manifest;
  			var contentLocation = options.ContentLocation;
  			var appPath = options.getManifestPath();
  
  			var selection = targetSelection.getSelection();
  			if(selection === null || selection.length === 0){
  				closeFrame();
  				return;
  			}
  
  			/* disable any UI at this point */
  			disableUI();
  
  			var instrumentation = _getManifestInstrumentation(userManifest, results);
  			
  			var appName = results.name;
  			var target = selection;
  
  			if (!confName){
  				postError(new Error("Could not determine the launch config name"));
  				return;
  			}
  			return checkContinue(fileService, contentLocation, initialConfName, confName).then(function(keepGoing) {
  				if (!keepGoing) {
  					enableUI();
  					return;
  				}
  
  				showMessage(messages["saving..."]); //$NON-NLS-0$
  				return mCfUtil.prepareLaunchConfigurationContent(confName, target, appName, appPath, instrumentation).then(
  					function(launchConfigurationContent){
  						postMsg(launchConfigurationContent);
  					});
  			}).then(null, function(error){
  				postError(error, selection);
  			});
  		};
  	}
docs: A utility trigger factory for Cloud Foundry deployment logic
  after the 'Deploy' button in a deployment wizard was clicked.