bundles/org.eclipse.orion.client.ui/web/orion/fileCommands.js
function createNewArtifact(namePrefix, parentItem, isDirectory) {
			var createFunction = function(name) {
				if (name) {
					var location = parentItem.Location;
					var functionName = isDirectory ? "createFolder" : "createFile";
					var deferred = fileClient[functionName](location, name, {select: true});
					progressService.showWhile(deferred, i18nUtil.formatMessage(messages["Creating ${0}"], name)).then(
						function(newArtifact) {
						},
						function(error) {
							if (error.status === 400 || error.status === 412) {
								var resp = error.responseText;
								if (typeof resp === "string") {
									try {
										resp = JSON.parse(resp);
										resp.Message = i18nUtil.formatMessage(messages["FailedToCreateFile"], name);
										error = resp;
									} catch(error) {}
								}
							}
							errorHandler(error);
						}
					);
				}
			};
			
			createUniqueNameArtifact(parentItem, namePrefix, function(uniqueName){
				getNewItemName(explorer, parentItem, explorer.getRow(parentItem), uniqueName, function(name) {
					createFunction(name);
				});
			});
		}
function createNewArtifact(namePrefix, parentItem, isDirectory) {
			var createFunction = function(name) {
				if (name) {
					var location = parentItem.Location;
					var functionName = isDirectory ? "createFolder" : "createFile";
					var deferred = fileClient[functionName](location, name, {select: true});
					progressService.showWhile(deferred, i18nUtil.formatMessage(messages["Creating ${0}"], name)).then(
						function(newArtifact) {
						},
						function(error) {
							if (error.status === 400 || error.status === 412) {
								var resp = error.responseText;
								if (typeof resp === "string") {
									try {
										resp = JSON.parse(resp);
										resp.Message = i18nUtil.formatMessage(messages["FailedToCreateFile"], name);
										error = resp;
									} catch(error) {}
								}
							}
							errorHandler(error);
						}
					);
				}
			};
			
			createUniqueNameArtifact(parentItem, namePrefix, function(uniqueName){
				getNewItemName(explorer, parentItem, explorer.getRow(parentItem), uniqueName, function(name) {
					createFunction(name);
				});
			});
		}
function createNewArtifact ( namePrefix , parentItem , isDirectory ) { var createFunction = function ( name ) { if ( name ) { var location = parentItem . Location ; var functionName = isDirectory ? "createFolder" : "createFile" ; var deferred = fileClient [ functionName ] ( location , name , { select : true } ) ; progressService . showWhile ( deferred , i18nUtil . formatMessage ( messages [ "Creating ${0}" ] , name ) ) . then ( function ( newArtifact ) { } , function ( error ) { if ( error . status === 400 || error . status === 412 ) { var resp = error . responseText ; if ( typeof resp === "string" ) { try { resp = JSON . parse ( resp ) ; resp . Message = i18nUtil . formatMessage ( messages [ "FailedToCreateFile" ] , name ) ; error = resp ; } catch ( error ) { } } } errorHandler ( error ) ; } ) ; } } ; createUniqueNameArtifact ( parentItem , namePrefix , function ( uniqueName ) { getNewItemName ( explorer , parentItem , explorer . getRow ( parentItem ) , uniqueName , function ( name ) { createFunction ( name ) ; } ) ; } ) ; }
Creates a new file or folder as a child of the specified parentItem.
Creates a new file or folder as a child of the specified parentItem .