Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark folders as web root folders #37

Closed
kaloyan-raev opened this issue Jan 27, 2015 · 12 comments
Closed

Mark folders as web root folders #37

kaloyan-raev opened this issue Jan 27, 2015 · 12 comments

Comments

@kaloyan-raev
Copy link
Contributor

Consider the following project structure:

+ project
  + public
    + img
      - myimage.png
  + deep
    + deep
      + deep
        - template.phtml

The template.phtml file is not directly accessible, but via inclusion in another PHP/HTML resource. Therefore any relative paths does not really follow the project tree hierarchy and are marked as validation errors, e.g. <img src="/img/myimage.png" /> will be marked as error.

This situation can be improved by marking a folder in the project (i.e. "public" in the above case) as the web root folder. I am thinking about providing a project property for this. The user can right-click on the project, choose properties, then go to the Web Resources node and browse a folder to specify as Web Root. Then the validator should consider the value of this property.

Is such improvement acceptable? Any other suggestions to resolve the above case?

@angelozerr
Copy link
Owner

@kaloyan-raev I think it's a good idea. It seems that it's similar issue than #24

Today I'm very busy with tern.java, I will do this issue when I will have time.

@MichaelChambers
Copy link

It would be great if we could mark a list of source folders that would each be counted as the root.
I'm looking at a project now with the following structure:
src/main/resources/static/css, js, etc
target/generated-resources/static/css, js, etc
These static folders are combined later when deploying. I think I would need both static folders to be marked as web root.

@angelozerr
Copy link
Owner

I agree @MichaelChambers but I'm very busy for the moment with JSON Editor and Grunt development.

Any contribution are welcome!

@kaloyan-raev
Copy link
Contributor Author

I am working on this. I will consider @MichaelChambers suggestion.

@kaloyan-raev kaloyan-raev changed the title Mark project folder as web root Mark folders as web root folders Mar 27, 2015
kaloyan-raev added a commit to kaloyan-raev/eclipse-wtp-webresources that referenced this issue Mar 27, 2015
New Web Resources > Validation > Web Root Folders property page is
added. It allows zero or more folders from the project to be selected as
web root folders. The settings are stored as persistent property in the
IProject.

The DefaultURIResolver reads the persistent property to find out if any
web root folders are selected for the current project. If yes, then the
existence of files with path containing a leading / are validated
against the web root folders.
kaloyan-raev added a commit to kaloyan-raev/eclipse-wtp-webresources that referenced this issue Mar 27, 2015
New Web Resources > Validation > Web Root Folders property page is
added. It allows zero or more folders from the project to be selected as
web root folders. The settings are stored as persistent property in the
IProject.

The DefaultURIResolver reads the persistent property to find out if any
web root folders are selected for the current project. If yes, then the
existence of files with path containing a leading / are validated
against the web root folders.
@kaloyan-raev
Copy link
Contributor Author

PR #41

angelozerr added a commit that referenced this issue Mar 28, 2015
Fixes #37 - Mark folders as web root folders
@kaloyan-raev
Copy link
Contributor Author

@MichaelChambers could you update from the snapshot repository and check if this solution works for you?
http://oss.opensagres.fr/eclipse-wtp-webresources/0.9.0-SNAPSHOT/

@angelozerr
Copy link
Owner

@kaloyan-raev I tell me why Web Root Folders Preferences is inside Web Resources -> Validation -> Web Root Folders menu item. This config works too for completion, no? Wyh don't set this menu to Web Resources -> Web Root Folders ?

@nitind
Copy link

nitind commented Mar 28, 2015

Isn't this what the Deployment Assembly property page already does and then surfaces through the ModuleCore APIs?

@angelozerr
Copy link
Owner

@nitind I'm sorry I don't understand what you mean?

@kaloyan-raev
Copy link
Contributor Author

@angelozerr No, currently web root folder are not considered for completion - just for validation. I had only the validation in my mind and did not thought about the completion. Therefore, I placed the new property page under the Web Resource > Validation one. When completion starts considering web root folders, I agree the page should me moved directly under Web Resources.

The Deployment Assembly page that @nitind mentioned is used in the WTP Java EE Tools. Here is screenshot:
image
It provides mapping between project structure and deployment package structure. However, there some issues to use it to resolve the problem targeted by this issue:

  1. There is no guarantee that the deployment package will be deployed in the web server's root. Of course, such assumption can be made, but it might be wrong. Whereas in the Web Root Folders property page, the user explicitly declares such intention.
  2. In the case of PHP, there is no such clear deployment strategy like in Java EE, where it is defined by a specification. Very often PHP projects are not deployed, but just uploaded to the server. Perhaps, this may be the reason that PDT was not integrated with the WTP Module Core framework.

@angelozerr
Copy link
Owner

Many thanks for your information.

It should be cool if completion could use your preferences.

@anubas
Copy link

anubas commented Mar 30, 2015

This works perfectly. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants