// Path: ca.edchipman.silverStripePDT/src/ca/edchipman/silverstripepdt/SilverStripePreferences.java
// public class SilverStripePreferences {
//     public static final String SILVERSTRIPE_VERSION = "silverstripe_version";
//     public static final String SILVERSTRIPE_FRAMEWORK_MODEL = "silverstripe_framework_model";
//     public static final String SILVERSTRIPE_SITECONFIG_MODULE = "silverstripe_siteconfig_module";
//     public static final String SILVERSTRIPE_REPORTS_MODULE = "silverstripe_reports_module";
// }


import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.php.internal.core.PHPCorePlugin;
import org.eclipse.php.internal.core.preferences.CorePreferencesSupport;
import org.eclipse.php.internal.core.preferences.IPreferencesPropagatorListener;
import org.eclipse.php.internal.core.preferences.PreferencePropagatorFactory;
import org.eclipse.php.internal.core.preferences.PreferencesPropagator;
import org.eclipse.php.internal.core.preferences.PreferencesPropagatorEvent;
import ca.edchipman.silverstripepdt.SilverStripePreferences;
        HashSet<IPreferencesPropagatorListener> listeners = projectListeners.get(project);
        if (listeners == null) {
            projectAdded(project);
            listeners = projectListeners.get(project);
        }
        listeners.add(listener);
    }

    public void removeSilverStripeVersionChangedListener(IPreferencesPropagatorListener listener) {
        if (listener == null) {// this was added since when working with RSE
            // project model, listener was NULL
            return;
        }
        IProject project = listener.getProject();
        HashSet<IPreferencesPropagatorListener> listeners = projectListeners.get(project);
        if (listeners != null) {
            listeners.remove(listener);
        }
    }

    public void projectAdded(IProject project) {
        if (project == null || projectListeners.get(project) != null) {
            return;
        }
        
        projectListeners.put(project, new HashSet<IPreferencesPropagatorListener>());

        // register as a listener to the PP on this project
        PreferencesPropagatorListener listener = new PreferencesPropagatorListener(project);
        preferencesPropagatorListeners.put(project, listener);
// Path: ca.edchipman.silverStripePDT/src/ca/edchipman/silverstripepdt/SilverStripePreferences.java
// public class SilverStripePreferences {
//     public static final String SILVERSTRIPE_VERSION = "silverstripe_version";
//     public static final String SILVERSTRIPE_FRAMEWORK_MODEL = "silverstripe_framework_model";
//     public static final String SILVERSTRIPE_SITECONFIG_MODULE = "silverstripe_siteconfig_module";
//     public static final String SILVERSTRIPE_REPORTS_MODULE = "silverstripe_reports_module";
// }


// Path: ca.edchipman.silverStripePDT/src/ca/edchipman/silverstripepdt/language/SilverStripeVersionChangedHandler.java
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.php.internal.core.PHPCorePlugin;
import org.eclipse.php.internal.core.preferences.CorePreferencesSupport;
import org.eclipse.php.internal.core.preferences.IPreferencesPropagatorListener;
import org.eclipse.php.internal.core.preferences.PreferencePropagatorFactory;
import org.eclipse.php.internal.core.preferences.PreferencesPropagator;
import org.eclipse.php.internal.core.preferences.PreferencesPropagatorEvent;
import ca.edchipman.silverstripepdt.SilverStripePreferences;

        HashSet<IPreferencesPropagatorListener> listeners = projectListeners.get(project);
        if (listeners == null) {
            projectAdded(project);
            listeners = projectListeners.get(project);
        }
        listeners.add(listener);
    }

    public void removeSilverStripeVersionChangedListener(IPreferencesPropagatorListener listener) {
        if (listener == null) {// this was added since when working with RSE
            // project model, listener was NULL
            return;
        }
        IProject project = listener.getProject();
        HashSet<IPreferencesPropagatorListener> listeners = projectListeners.get(project);
        if (listeners != null) {
            listeners.remove(listener);
        }
    }

    public void projectAdded(IProject project) {
        if (project == null || projectListeners.get(project) != null) {
            return;
        }
        
        projectListeners.put(project, new HashSet<IPreferencesPropagatorListener>());

        // register as a listener to the PP on this project
        PreferencesPropagatorListener listener = new PreferencesPropagatorListener(project);
        preferencesPropagatorListeners.put(project, listener);
        preferencesPropagator.addPropagatorListener(listener, SilverStripePreferences.SILVERSTRIPE_VERSION);