23 import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; |
23 import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; |
24 import org.eclipse.jface.preference.IPreferenceStore; |
24 import org.eclipse.jface.preference.IPreferenceStore; |
25 import org.symbian.tools.tmw.core.utilities.CoreUtil; |
25 import org.symbian.tools.tmw.core.utilities.CoreUtil; |
26 |
26 |
27 public class PreferenceInitializer extends AbstractPreferenceInitializer { |
27 public class PreferenceInitializer extends AbstractPreferenceInitializer { |
28 private final static String DEFAULT_CHROME_LOCATION = "Local Settings/Application Data/Google/Chrome/Application"; |
28 private static final String DEFAULT_CHROME_PATH_WINXP = "C:/Program Files/Google/Chrome/Application/"; |
|
29 private static final String DEFAULT_CHROME_PATH_LINUX = "/opt/google/chrome"; |
|
30 private static final String DEFAULT_CHROME_PATH_MAC = "/Applications"; |
|
31 private final static String DEFAULT_CHROME_PATH_VISTA = "Local Settings/Application Data/Google/Chrome/Application"; |
29 |
32 |
30 @Override |
33 @Override |
31 public void initializeDefaultPreferences() { |
34 public void initializeDefaultPreferences() { |
32 IPreferenceStore store = Activator.getDefault().getPreferenceStore(); |
35 IPreferenceStore store = Activator.getDefault().getPreferenceStore(); |
33 File folder = getDefaultFolder(); |
36 File folder = getDefaultFolder(); |
34 if (ChromeDebugUtils.getExecutablePath(folder.getAbsolutePath()) != null) { |
37 if (ChromeDebugUtils.getExecutablePath(folder.getAbsolutePath()) != null) { |
35 store.setDefault(IConstants.PREF_NAME_CHROME_LOCATION, folder |
38 store.setDefault(IConstants.PREF_NAME_CHROME_LOCATION, folder.getAbsolutePath()); |
36 .getAbsolutePath()); |
39 } |
37 } |
40 } |
38 } |
|
39 |
41 |
40 private File getDefaultFolder() { |
42 private File getDefaultFolder() { |
41 if (CoreUtil.isMac()) { |
43 if (CoreUtil.isMac()) { |
42 return new File("/Applications"); |
44 return new File(DEFAULT_CHROME_PATH_MAC); |
43 } else if (CoreUtil.isLinux()) { |
45 } else if (CoreUtil.isLinux()) { |
44 return new File("/opt/google/chrome"); |
46 return new File(DEFAULT_CHROME_PATH_LINUX); |
45 } |
47 } |
46 String property = System.getProperty("user.home"); |
48 String property = System.getProperty("user.home"); |
47 File folder = new File(property, DEFAULT_CHROME_LOCATION); |
49 File folder = new File(property, DEFAULT_CHROME_PATH_VISTA); |
48 if (!folder.exists()) { |
50 if (!folder.exists()) { |
49 folder = new File("C:/Program Files/Google/Chrome/Application/"); |
51 folder = new File(DEFAULT_CHROME_PATH_WINXP); |
50 } |
52 } |
51 return folder; |
53 return folder; |
52 } |
54 } |
53 |
55 |
54 } |
56 } |