| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012, the Dart project authors. | 2 * Copyright (c) 2012, the Dart project authors. |
| 3 * | 3 * |
| 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
| 5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
| 6 * | 6 * |
| 7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
| 8 * | 8 * |
| 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
| 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
| 11 * or implied. See the License for the specific language governing permissions a
nd limitations under | 11 * or implied. See the License for the specific language governing permissions a
nd limitations under |
| 12 * the License. | 12 * the License. |
| 13 */ | 13 */ |
| 14 | 14 |
| 15 package com.google.dart.tools.debug.ui.internal; | 15 package com.google.dart.tools.debug.ui.internal; |
| 16 | 16 |
| 17 import com.google.dart.tools.core.DartCore; | 17 import com.google.dart.tools.core.DartCore; |
| 18 import com.google.dart.tools.core.mobile.MobileUrlConnectionException; |
| 18 import com.google.dart.tools.debug.core.DartDebugCorePlugin; | 19 import com.google.dart.tools.debug.core.DartDebugCorePlugin; |
| 19 import com.google.dart.tools.debug.core.DebugUIHelper; | 20 import com.google.dart.tools.debug.core.DebugUIHelper; |
| 20 import com.google.dart.tools.debug.core.dartium.DartiumDebugTarget; | 21 import com.google.dart.tools.debug.core.dartium.DartiumDebugTarget; |
| 21 import com.google.dart.tools.debug.ui.internal.dartium.DevToolsDisconnectManager
; | 22 import com.google.dart.tools.debug.ui.internal.dartium.DevToolsDisconnectManager
; |
| 23 import com.google.dart.tools.debug.ui.internal.dialogs.MobilePortForwardDialog; |
| 22 import com.google.dart.tools.debug.ui.internal.util.LaunchUtils; | 24 import com.google.dart.tools.debug.ui.internal.util.LaunchUtils; |
| 23 import com.google.dart.tools.debug.ui.internal.view.DebuggerView; | 25 import com.google.dart.tools.debug.ui.internal.view.DebuggerView; |
| 24 | 26 |
| 25 import org.eclipse.core.runtime.CoreException; | 27 import org.eclipse.core.runtime.CoreException; |
| 26 import org.eclipse.jface.action.IStatusLineManager; | 28 import org.eclipse.jface.action.IStatusLineManager; |
| 27 import org.eclipse.jface.dialogs.MessageDialog; | 29 import org.eclipse.jface.dialogs.MessageDialog; |
| 28 import org.eclipse.swt.widgets.Display; | 30 import org.eclipse.swt.widgets.Display; |
| 29 import org.eclipse.swt.widgets.Shell; | 31 import org.eclipse.swt.widgets.Shell; |
| 30 import org.eclipse.ui.IViewPart; | 32 import org.eclipse.ui.IViewPart; |
| 31 import org.eclipse.ui.IWorkbenchPage; | 33 import org.eclipse.ui.IWorkbenchPage; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 public void openBrowserTab(String url) { | 67 public void openBrowserTab(String url) { |
| 66 try { | 68 try { |
| 67 LaunchUtils.openBrowser(url); | 69 LaunchUtils.openBrowser(url); |
| 68 } catch (CoreException e) { | 70 } catch (CoreException e) { |
| 69 showError("Open Browser", e.getMessage()); | 71 showError("Open Browser", e.getMessage()); |
| 70 } | 72 } |
| 71 | 73 |
| 72 } | 74 } |
| 73 | 75 |
| 74 @Override | 76 @Override |
| 77 public void showError(String title, CoreException e) { |
| 78 |
| 79 // Detect mobile launch port forwarding problems |
| 80 // and present user with more specific dialog to help fix them fix the probl
em |
| 81 if (e instanceof MobileUrlConnectionException) { |
| 82 final String pageUrl = ((MobileUrlConnectionException) e).getPageUrl(); |
| 83 final boolean localhostOverUsb = ((MobileUrlConnectionException) e).isLoca
lhostOverUsb(); |
| 84 Display.getDefault().asyncExec(new Runnable() { |
| 85 @Override |
| 86 public void run() { |
| 87 Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().get
Shell(); |
| 88 new MobilePortForwardDialog(shell, pageUrl, localhostOverUsb).open(); |
| 89 } |
| 90 }); |
| 91 return; |
| 92 } |
| 93 |
| 94 showError(title, e.getMessage()); |
| 95 } |
| 96 |
| 97 @Override |
| 75 public void showError(final String title, final String message) { | 98 public void showError(final String title, final String message) { |
| 76 final Display display = Display.getDefault(); | 99 final Display display = Display.getDefault(); |
| 77 | 100 |
| 78 Display.getDefault().asyncExec(new Runnable() { | 101 Display.getDefault().asyncExec(new Runnable() { |
| 79 @Override | 102 @Override |
| 80 public void run() { | 103 public void run() { |
| 81 if (display.isDisposed()) { | 104 if (display.isDisposed()) { |
| 82 return; | 105 return; |
| 83 } | 106 } |
| 84 | 107 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 233 |
| 211 private int OS_GetWindowTextLength(Number window) throws Exception { | 234 private int OS_GetWindowTextLength(Number window) throws Exception { |
| 212 if (window instanceof Integer) { | 235 if (window instanceof Integer) { |
| 213 Method method = getOSClass().getMethod("GetWindowTextLength", int.class); | 236 Method method = getOSClass().getMethod("GetWindowTextLength", int.class); |
| 214 return (Integer) method.invoke(null, window.intValue()); | 237 return (Integer) method.invoke(null, window.intValue()); |
| 215 } else { | 238 } else { |
| 216 Method method = getOSClass().getMethod("GetWindowTextLength", long.class); | 239 Method method = getOSClass().getMethod("GetWindowTextLength", long.class); |
| 217 return (Integer) method.invoke(null, window.longValue()); | 240 return (Integer) method.invoke(null, window.longValue()); |
| 218 } | 241 } |
| 219 } | 242 } |
| 220 | |
| 221 } | 243 } |
| OLD | NEW |