Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 267005 Details for
Bug 511326
Provide getProject support in the file client
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Proposed fix
org.eclipse.orion.client.getproject.patch (text/plain), 5.52 KB, created by
Michael Rennie
on 2017-02-27 10:12:58 EST
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Michael Rennie
Created:
2017-02-27 10:12:58 EST
Size:
5.52 KB
patch
obsolete
>diff --git a/bundles/org.eclipse.orion.client.core/web/orion/fileClient.js b/bundles/org.eclipse.orion.client.core/web/orion/fileClient.js >index 13f4879..a756c1c 100644 >--- a/bundles/org.eclipse.orion.client.core/web/orion/fileClient.js >+++ b/bundles/org.eclipse.orion.client.core/web/orion/fileClient.js >@@ -142,6 +142,12 @@ > }, 100); > return d; > }, >+ /** >+ * @description Computes the project context from the given location >+ * @param {String} context The resource context to find the project for >+ * @since 14.0 >+ */ >+ getProject: _noMatch, > search: _noMatch, > createProject: _noMatch, > createFolder: _noMatch, >@@ -361,7 +367,14 @@ > changeWorkspace: function(workspaceLocation) { > return _doServiceCall(this._getService(), "changeWorkspace", arguments); //$NON-NLS-1$ > }, >- >+ /** >+ * @description Computes the project context from the given location >+ * @param {String} context The resource context to find the project for >+ * @since 14.0 >+ */ >+ getProject: function getProject(resource) { >+ return _doServiceCall(this._getService(resource), "getProject", arguments); >+ }, > _createArtifact: function(parentLocation, funcName, eventData, funcArgs) { > return _doServiceCall(this._getService(parentLocation), funcName, funcArgs).then(function(result){ > if(this.isEventFrozen()) { >diff --git a/bundles/org.eclipse.orion.client.javascript/web/javascript/javascriptProject.js b/bundles/org.eclipse.orion.client.javascript/web/javascript/javascriptProject.js >index 5dc369a..7794813 100644 >--- a/bundles/org.eclipse.orion.client.javascript/web/javascript/javascriptProject.js >+++ b/bundles/org.eclipse.orion.client.javascript/web/javascript/javascriptProject.js >@@ -692,26 +692,30 @@ > deferred.resolve({Location: "/file/"}); > } else { > if(Util.isElectron) { >- //TODO call out the server for #getProject >- var promises = [], >- prnt = parents[parents.length-1]; >- this.projectFiles.forEach(function(_f) { >- promises.push(this.getFile(_f, prnt.Location)); >- promises.push(this.getFile(_f, "/file/")); >- }.bind(this)); >- promises.reduce(function(prev, item, index, array) { >- return prev.then(function(_file) { >- if(_file && _file.contents) { >- deferred.resolve({Location: _file.project}); >- return item.reject("done"); >- } >- if(index === array.length-1) { >- //nothing was found, assume /file/ >- deferred.resolve({Location: "/file/"}); >- } >- return item; >- }); >- }, new Deferred().resolve()); >+ this.getFileClient().getProject(floc).then(function(projectPath) { >+ if(projectPath) { >+ return deferred.resolve({Location: projectPath.Location}); >+ } >+ var promises = [], >+ prnt = parents[parents.length-1]; >+ this.projectFiles.forEach(function(_f) { >+ promises.push(this.getFile(_f, prnt.Location)); >+ promises.push(this.getFile(_f, "/file/")); >+ }.bind(this)); >+ promises.reduce(function(prev, item, index, array) { >+ return prev.then(function(_file) { >+ if(_file && _file.contents) { >+ deferred.resolve({Location: _file.project}); >+ return item.reject("done"); >+ } >+ if(index === array.length-1) { >+ //nothing was found, assume /file/ >+ deferred.resolve({Location: "/file/"}); >+ } >+ return item; >+ }); >+ }, new Deferred().resolve()); >+ }); > } else { > deferred.resolve(parents[parents.length-1]); > } >diff --git a/bundles/org.eclipse.orion.client.ui/web/plugins/filePlugin/fileImpl.js b/bundles/org.eclipse.orion.client.ui/web/plugins/filePlugin/fileImpl.js >index aeecd4d..88a3fc7 100644 >--- a/bundles/org.eclipse.orion.client.ui/web/plugins/filePlugin/fileImpl.js >+++ b/bundles/org.eclipse.orion.client.ui/web/plugins/filePlugin/fileImpl.js >@@ -1,6 +1,6 @@ > /******************************************************************************* > * @license >- * Copyright (c) 2010, 2016 IBM Corporation and others. >+ * Copyright (c) 2010, 2017 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials are made > * available under the terms of the Eclipse Public License v1.0 > * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution >@@ -360,7 +360,26 @@ > return result; > }.bind(this)); > }, >- >+ /** >+ * @description Computes the project context from the given location >+ * @param {String} resourceLocation The resource context to find the project for >+ * @since 14.0 >+ */ >+ getProject: function getProject(resourceLocation) { >+ var url = new URL(resourceLocation, self.location); >+ url.query.set("project", "true"); >+ return _xhr("GET", url.href, { >+ headers: { >+ "Orion-Version": "1" >+ }, >+ timeout: 15000, >+ log: false >+ }).then(function(result) { >+ return result.response ? JSON.parse(result.response) : null; >+ },/* @callback */ function reject(err) { >+ return null; >+ }); >+ }, > /** > * Creates a folder. > * @param {String} parentLocation The location of the parent folder
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 511326
:
267005
|
267007
|
267009
|
267035