author | Eugene Ostroukhov <eugeneo@symbian.org> |
Thu, 15 Jul 2010 10:08:51 -0700 | |
changeset 450 | ed815e0eef9a |
parent 55 | bb6160d0b6f2 |
permissions | -rw-r--r-- |
2 | 1 |
/******************************************************************************* |
2 |
* Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Symbian Foundation - initial contribution. |
|
11 |
* Contributors: |
|
12 |
* Description: |
|
13 |
* Overview: |
|
14 |
* Details: |
|
15 |
* Platforms/Drives/Compatibility: |
|
16 |
* Assumptions/Requirement/Pre-requisites: |
|
17 |
* Failures and causes: |
|
18 |
*******************************************************************************/ |
|
19 |
package org.symbian.tools.wrttools.debug.internal; |
|
20 |
||
21 |
import java.io.File; |
|
22 |
||
23 |
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; |
|
24 |
import org.eclipse.jface.preference.IPreferenceStore; |
|
55
bb6160d0b6f2
Added fallback to default browser if platform is Mac or XULRunner is not available
Eugene Ostroukhov <eostroukhov@gmail.com>
parents:
43
diff
changeset
|
25 |
import org.symbian.tools.wrttools.util.CoreUtil; |
2 | 26 |
|
27 |
public class PreferenceInitializer extends AbstractPreferenceInitializer { |
|
28 |
private final static String DEFAULT_CHROME_LOCATION = "Local Settings/Application Data/Google/Chrome/Application"; |
|
29 |
||
30 |
@Override |
|
31 |
public void initializeDefaultPreferences() { |
|
32 |
IPreferenceStore store = Activator.getDefault().getPreferenceStore(); |
|
33 |
File folder = getDefaultFolder(); |
|
34 |
if (ChromeDebugUtils.getExecutablePath(folder.getAbsolutePath()) != null) { |
|
35 |
store.setDefault(IConstants.PREF_NAME_CHROME_LOCATION, folder |
|
36 |
.getAbsolutePath()); |
|
37 |
} |
|
38 |
} |
|
39 |
||
40 |
private File getDefaultFolder() { |
|
55
bb6160d0b6f2
Added fallback to default browser if platform is Mac or XULRunner is not available
Eugene Ostroukhov <eostroukhov@gmail.com>
parents:
43
diff
changeset
|
41 |
if (CoreUtil.isMac()) { |
2 | 42 |
return new File("/Applications"); |
55
bb6160d0b6f2
Added fallback to default browser if platform is Mac or XULRunner is not available
Eugene Ostroukhov <eostroukhov@gmail.com>
parents:
43
diff
changeset
|
43 |
} else if (CoreUtil.isLinux()) { |
43
464130c45935
Linux support, first cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
39
diff
changeset
|
44 |
return new File("/opt/google/chrome"); |
2 | 45 |
} |
46 |
String property = System.getProperty("user.home"); |
|
47 |
File folder = new File(property, DEFAULT_CHROME_LOCATION); |
|
450
ed815e0eef9a
Bug 3268 - Debugger does not start on Windows XP
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
55
diff
changeset
|
48 |
if (!folder.exists()) { |
ed815e0eef9a
Bug 3268 - Debugger does not start on Windows XP
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
55
diff
changeset
|
49 |
folder = new File("C:/Program Files/Google/Chrome/Application/"); |
ed815e0eef9a
Bug 3268 - Debugger does not start on Windows XP
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
55
diff
changeset
|
50 |
} |
2 | 51 |
return folder; |
52 |
} |
|
53 |
||
54 |
} |