projectListener = new IResourceChangeListener() {
@Override
public void resourceChanged(IResourceChangeEvent event) {
if (event.getType() == IResourceChangeEvent.PRE_CLOSE && event.getResource() instanceof IResource) {
final PhpWebProject webProject = webProjects.get((IProject) event.getResource());
if (webProject != null) {
webProject.notifyProjectClosed();
webProjects.remove((IProject) event.getResource());
}
} else if (event.getType() == IResourceChangeEvent.POST_CHANGE) {
final IResourceDelta delta = event.getDelta();
if (delta != null) {
for (final PhpWebProject project : webProjects.values()) {
final IResourceDelta settingsDelta = delta.findMember(project.getEclipseProject().getFile(SettingsPhpProjectStorage.SETTINGS_FILENAME).getFullPath());
if (settingsDelta != null) {
project.notifySettingsChanged();
}
}
}
}
}
};
ResourcesPlugin.getWorkspace().addResourceChangeListener(projectListener,
IResourceChangeEvent.PRE_CLOSE | IResourceChangeEvent.POST_CHANGE);
}
PhpWebProject webProject = webProjects.get(project);
if (webProject == null) {
if (PHPFacets.isFacetedProject(project)) {
webProject = new PhpWebProject(project);
webProjects.put(project, webProject);
} else {
throw new CoreException(new Status(IStatus.ERROR, PLUGIN_ID, "Given project is not a php faceted project")); //$NON-NLS-1$
}
}