Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 511326

Summary: Provide getProject support in the file client
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: ClientAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P2 CC: kuschel, Silenio_Quarti, steve_northover
Version: 13.0   
Target Milestone: 14.0   
Hardware: PC   
OS: Mac OS X   
Whiteboard: 2017-02-24
Bug Depends on:    
Bug Blocks: 511590    
Attachments:
Description Flags
Proposed fix
none
Updated fix
none
Fix including the server changes
none
Java server patch none

Description Michael Rennie CLA 2017-01-30 12:40:15 EST
When working in Orion, a project context can be any folder above the current file you are working with. To avoid expensive client side tree walking, we should provide support in the fileClient / server to find a project with a given file / folder context.

A folder can be considered a project if:

1. it contains a .git folder
2. it contains a project.json file
3. it contains a file/folder that matches a given list of names from the request (clients should be able to send a list of names that they consider to be project-defining)
Comment 1 Michael Rennie CLA 2017-01-30 20:46:20 EST
*** Bug 511063 has been marked as a duplicate of this bug. ***
Comment 2 Michael Rennie CLA 2017-02-27 10:12:58 EST
Created attachment 267005 [details]
Proposed fix

Patch contains support in fileClient and the node server to look up a project context.

Right now it only considers a folder with a .git folder to be a project (by default).

It is hooked up the the JavaScript project to see it working - but the JS hooks are not complete yet.

One remaining part of the work would be to allow a consumer of the API to pass in either a list of names of files / folders to consider project-like (or a regex).
Comment 3 Michael Rennie CLA 2017-02-27 11:05:24 EST
Created attachment 267007 [details]
Updated fix

Here is an updated fix that allows clients to specify names to consider "project-like". It also adds project.json to the default list of names for projects
Comment 4 Michael Rennie CLA 2017-02-27 11:24:32 EST
Created attachment 267009 [details]
Fix including the server changes

Last patch seems to have left out the server changes. This patch includes them. Ignore the vs code launch config, it won't be committed with the fix (but for some reason could not exclude it from the patch in Eclipse).
Comment 5 Michael Rennie CLA 2017-02-27 13:14:55 EST
The new API and node server support have been added in:

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=8419cbddf81c7b92094654433ce994dbe222896c

I will make the corresponding changes in the Java server as well.
Comment 6 Michael Rennie CLA 2017-02-28 14:12:02 EST
Created attachment 267035 [details]
Java server patch

This patch provides server support for getProject in the Java server.
Comment 7 Michael Rennie CLA 2017-03-01 11:51:17 EST
Java server changes pushed to (thanks for reviewing Silenio): 

http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?id=8f527aa5c43dc827ba1be8fda0d8a52ba8f18315