mogilka mogilka - 1 year ago 62
PHP Question

Folders and files don't appear in PHP Explorer in Eclipse IDE

I use PHP Development Tools in Eclipse IDE. I did refactoring and move some scripts to the new folders of PHP project. Now no refactored folders or files are displayed in PHP Explorer View although they are present in the file system.

The problem occurs regularly after moving or renaming files. I sent bug report to Eclipse technical support but so far they have not solved it.

There is radical solution - to re-create the workspace, but then it's too expensive restore all my settings, reimport all projects, restore all working sets, etc.

All described above causes a lot of discomfort in my development work. So I decided to try to resolve it myself, because there is the only Eclipse workspace and a bug can be hidden within it.

I make a simple search on the file system and found three files that mention the name of my PHP project:

  • workspace/.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2/model.h2.db

  • workspace/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml

  • workspace/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi

Removing sqlite database yielded nothing - after restarting Eclipse recovered db file, but I didn't saw my files in new location.

Then I deleted workingsets.xml file and restarted Eclipse - and lo! My files and folders now appear in the PHP explorer. But the truth is that all my working sets also deleted... In any case it's better than to remove and restore the whole workspace. Although using of working sets is very important for me - I work with a lot of different projects on PHP and Java, and I love when they all are classified.

I don't really go into the heart of the problem, but it seems that Eclipse can't work with the PHP projects correctly when they are placed in the working sets. I think it is a bug in this.

Wait and see how things will work on. But maybe anybody has a solution?

Answer Source

For me this happened multiple times, on different project and different folders. Opening+closing or refreshing the project yield no success.

In my case, I have found out that this is related to the Working sets. It seems by default new subfolders and files of a project are not marked belonging to the set, so the project has a mix of old folders (included) and new folders (excluded).

To fix this, you can disable the working sets or edit the active working set and check the project's checkbox (which will check all subfolders).

Bonus tip: on large projects, having this mixed state working set made opening the folder structure (and other operations) very slow (3-5 seconds per level). Turning off the working set filter made it instantaneous.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download