/**
 * $id:  $
 */
package org.jvnet.lookout.google.web.preference;

import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.jvnet.lookout.core.util.Utilities;
import org.jvnet.lookout.google.web.Plugin;

public class WebPreferenceInitializer extends AbstractPreferenceInitializer {
	
	private org.eclipse.core.runtime.Preferences sourcePreferences;
	
	public WebPreferenceInitializer() {
		super();
		sourcePreferences = obtainSourcePreference();
	}
	
	protected org.eclipse.core.runtime.Preferences obtainSourcePreference() {
		return Plugin.getDefault().getPluginPreferences();		
	}
	
	final protected org.eclipse.core.runtime.Preferences getSourcePreference() {
		return sourcePreferences;
	}
	
	public void initializeDefaultPreferences() {
		
		//Web API Key....
		getSourcePreference().setDefault(Preferences.Key,"");

		//Part to search
		getSourcePreference().setDefault(Preferences.PartOfResourceToSearch, Preferences.AnyPart);

		//Site...
		getSourcePreference().setDefault(Preferences.SiteToSearch, "");

		//Search date...
		getSourcePreference().setDefault(Preferences.DateToSearchFrom, 
				Utilities.getJulianDate(Utilities.getZeroDate()));
		
		//File types to search...
		getSourcePreference().setDefault(Preferences.SearchableFileTypes,"");
		
		//Search all file types...
		getSourcePreference().setDefault(Preferences.SearchAllFiles, true);
		

	}
}
