Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 511326 | Differences between
and this patch

Collapse All | Expand All

(-)a/bundles/org.eclipse.orion.client.core/web/orion/fileClient.js (-1 / +14 lines)
Lines 142-147 Link Here
142
				}, 100);
142
				}, 100);
143
				return d;
143
				return d;
144
			},
144
			},
145
			/**
146
			 * @description Computes the project context from the given location
147
			 * @param {String} context The resource context to find the project for
148
			 * @since 14.0
149
			 */
150
			getProject: _noMatch,
145
			search: _noMatch,
151
			search: _noMatch,
146
			createProject: _noMatch,
152
			createProject: _noMatch,
147
			createFolder: _noMatch,
153
			createFolder: _noMatch,
Lines 361-367 Link Here
361
		changeWorkspace: function(workspaceLocation) {
367
		changeWorkspace: function(workspaceLocation) {
362
			return _doServiceCall(this._getService(), "changeWorkspace", arguments); //$NON-NLS-1$
368
			return _doServiceCall(this._getService(), "changeWorkspace", arguments); //$NON-NLS-1$
363
		},
369
		},
364
370
		/**
371
		 * @description Computes the project context from the given location
372
		 * @param {String} context The resource context to find the project for
373
		 * @since 14.0
374
		 */
375
		getProject: function getProject(resource) {
376
			return _doServiceCall(this._getService(resource), "getProject", arguments);	
377
		},
365
		_createArtifact: function(parentLocation, funcName, eventData, funcArgs) {
378
		_createArtifact: function(parentLocation, funcName, eventData, funcArgs) {
366
			return _doServiceCall(this._getService(parentLocation), funcName, funcArgs).then(function(result){
379
			return _doServiceCall(this._getService(parentLocation), funcName, funcArgs).then(function(result){
367
				if(this.isEventFrozen()) {
380
				if(this.isEventFrozen()) {
(-)a/bundles/org.eclipse.orion.client.javascript/web/javascript/javascriptProject.js (-20 / +24 lines)
Lines 692-717 Link Here
692
				deferred.resolve({Location: "/file/"});
692
				deferred.resolve({Location: "/file/"});
693
			} else {
693
			} else {
694
				if(Util.isElectron) {
694
				if(Util.isElectron) {
695
					//TODO call out the server for #getProject
695
					this.getFileClient().getProject(floc).then(function(projectPath) {
696
					var promises = [],
696
						if(projectPath) {
697
						prnt = parents[parents.length-1];
697
							return deferred.resolve({Location: projectPath.Location});
698
					this.projectFiles.forEach(function(_f) {
698
						}
699
						promises.push(this.getFile(_f, prnt.Location));
699
						var promises = [],
700
						promises.push(this.getFile(_f, "/file/"));
700
							prnt = parents[parents.length-1];
701
					}.bind(this));
701
						this.projectFiles.forEach(function(_f) {
702
					promises.reduce(function(prev, item, index, array) {
702
							promises.push(this.getFile(_f, prnt.Location));
703
                        return prev.then(function(_file) {
703
							promises.push(this.getFile(_f, "/file/"));
704
                            if(_file && _file.contents) {
704
						}.bind(this));
705
                                deferred.resolve({Location: _file.project});
705
						promises.reduce(function(prev, item, index, array) {
706
                                return item.reject("done");
706
	                        return prev.then(function(_file) {
707
                            }
707
	                            if(_file && _file.contents) {
708
                            if(index === array.length-1) {
708
	                                deferred.resolve({Location: _file.project});
709
                                //nothing was found, assume /file/
709
	                                return item.reject("done");
710
                                deferred.resolve({Location: "/file/"});
710
	                            }
711
                            }
711
	                            if(index === array.length-1) {
712
                            return item;
712
	                                //nothing was found, assume /file/
713
                        });
713
	                                deferred.resolve({Location: "/file/"});
714
					}, new Deferred().resolve());
714
	                            }
715
	                            return item;
716
	                        });
717
						}, new Deferred().resolve());
718
					});
715
				} else {
719
				} else {
716
					deferred.resolve(parents[parents.length-1]);
720
					deferred.resolve(parents[parents.length-1]);
717
				}
721
				}
(-)a/bundles/org.eclipse.orion.client.ui/web/plugins/filePlugin/fileImpl.js (-2 / +21 lines)
Lines 1-6 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * @license
2
 * @license
3
 * Copyright (c) 2010, 2016 IBM Corporation and others.
3
 * Copyright (c) 2010, 2017 IBM Corporation and others.
4
 * All rights reserved. This program and the accompanying materials are made
4
 * All rights reserved. This program and the accompanying materials are made
5
 * available under the terms of the Eclipse Public License v1.0
5
 * available under the terms of the Eclipse Public License v1.0
6
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
6
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
Lines 360-366 Link Here
360
				return result;
360
				return result;
361
			}.bind(this));
361
			}.bind(this));
362
		},
362
		},
363
363
		/**
364
		 * @description Computes the project context from the given location
365
		 * @param {String} resourceLocation The resource context to find the project for
366
		 * @since 14.0
367
		 */
368
		getProject: function getProject(resourceLocation) {
369
			var url = new URL(resourceLocation, self.location);
370
			url.query.set("project", "true");
371
			return _xhr("GET", url.href, {
372
				headers: {
373
					"Orion-Version": "1"
374
				},
375
				timeout: 15000,
376
				log: false
377
			}).then(function(result) {
378
				return result.response ? JSON.parse(result.response) : null;
379
			},/* @callback */ function reject(err) {
380
				return null;
381
			});
382
		},
364
		/**
383
		/**
365
		 * Creates a folder.
384
		 * Creates a folder.
366
		 * @param {String} parentLocation The location of the parent folder
385
		 * @param {String} parentLocation The location of the parent folder

Return to bug 511326