--- a/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/ChromeDebugUtils.java Wed Jul 14 16:31:49 2010 -0700
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/ChromeDebugUtils.java Thu Jul 15 10:08:51 2010 -0700
@@ -29,7 +29,13 @@
File chromeExecutable = new File(file, getExecutable());
if (chromeExecutable.isFile()) {
return chromeExecutable.getAbsolutePath();
+ } else if (CoreUtil.isMac() && file.getName().equals("Google Chrome.app")) {
+ return getExecutablePath(file.getParent());
}
+ } else if (file.isFile()) {
+ if (file.getName().equalsIgnoreCase(getExecutable())) {
+ return file.getAbsolutePath();
+ }
}
return null;
}
--- a/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/PreferenceInitializer.java Wed Jul 14 16:31:49 2010 -0700
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/PreferenceInitializer.java Thu Jul 15 10:08:51 2010 -0700
@@ -45,6 +45,9 @@
}
String property = System.getProperty("user.home");
File folder = new File(property, DEFAULT_CHROME_LOCATION);
+ if (!folder.exists()) {
+ folder = new File("C:/Program Files/Google/Chrome/Application/");
+ }
return folder;
}
--- a/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/ui/DebugPreferencePage.java Wed Jul 14 16:31:49 2010 -0700
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/ui/DebugPreferencePage.java Thu Jul 15 10:08:51 2010 -0700
@@ -18,15 +18,19 @@
*******************************************************************************/
package org.symbian.tools.wrttools.debug.ui;
+import java.io.File;
+
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.DirectoryFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.symbian.tools.wrttools.debug.internal.Activator;
+import org.symbian.tools.wrttools.debug.internal.ChromeDebugUtils;
import org.symbian.tools.wrttools.debug.internal.IConstants;
public class DebugPreferencePage extends FieldEditorPreferencePage implements
@@ -42,8 +46,22 @@
@Override
protected void createFieldEditors() {
- DirectoryFieldEditor editor = new DirectoryFieldEditor("chrome", "Chrome Install Location:", getFieldEditorParent());
- editor.setPreferenceName(IConstants.PREF_NAME_CHROME_LOCATION);
+ DirectoryFieldEditor editor = new DirectoryFieldEditor(IConstants.PREF_NAME_CHROME_LOCATION,
+ "Chrome Install Location:",
+ getFieldEditorParent()) {
+ @Override
+ protected boolean doCheckState() {
+ if (super.doCheckState()) {
+ String message = validate(getStringValue());
+ setErrorMessage(message);
+ return message == null;
+ } else {
+ return false;
+ }
+ }
+ };
+ editor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
+ editor.setEmptyStringAllowed(false);
addField(editor);
check = new Button(getFieldEditorParent(), SWT.CHECK);
@@ -54,6 +72,19 @@
IConstants.PREF_SHOW_RESOURCE_CHANGE_ERROR)));
}
+
+ protected String validate(String newValue) {
+ String error = null;
+ if (newValue == null || newValue.trim().length() == 0) {
+ error = "Chrome install location is not specified";
+ } else if (!new File(newValue).exists()) {
+ error = String.format("%s does not exist", newValue);
+ } else if (ChromeDebugUtils.getExecutablePath(newValue) == null) {
+ error = String.format("%s does not contain Chrome executable", newValue);
+ }
+ return error;
+ }
+
@Override
protected void performDefaults() {
super.performDefaults();