Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: dart/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/mobile/MobileUrlConnectionException.java

Issue 337623003: Version 1.5.0-dev.4.11 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2014, the Dart project authors.
3 *
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
6 *
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
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
11 * or implied. See the License for the specific language governing permissions a nd limitations under
12 * the License.
13 */
14 package com.google.dart.tools.core.mobile;
15
16 import com.google.dart.tools.core.DartCore;
17
18 import org.eclipse.core.runtime.CoreException;
19 import org.eclipse.core.runtime.IStatus;
20 import org.eclipse.core.runtime.Status;
21
22 public class MobileUrlConnectionException extends CoreException {
23
24 public static final String SERVE_OVER_USB_TEXT = "Serve content over USB, uses localhost address";
25
26 private static Status newStatus(String pageUrl, boolean localhostOverUsb) {
27 StringBuilder msg = new StringBuilder();
28 msg.append("Failed to access URL from mobile: ");
29 msg.append(pageUrl);
30 msg.append(".\n\n");
31 if (localhostOverUsb) {
32 msg.append("Check port forwarding in Chrome and try again.");
33 } else {
34 msg.append("Check wifi access permissions and try again.\n\n");
35 msg.append("Alternately, open the Manage Launches dialog,");
36 msg.append(" select the mobile launch configuration, and select \"");
37 msg.append(SERVE_OVER_USB_TEXT);
38 msg.append("\".\n");
39 }
40 return new Status(IStatus.ERROR, DartCore.PLUGIN_ID, 0, msg.toString(), null );
41 }
42
43 private final String pageUrl;
44
45 private final boolean localhostOverUsb;
46
47 public MobileUrlConnectionException(String pageUrl, boolean localhostOverUsb) {
48 super(newStatus(pageUrl, localhostOverUsb));
49 this.pageUrl = pageUrl;
50 this.localhostOverUsb = localhostOverUsb;
51 }
52
53 public String getPageUrl() {
54 return pageUrl;
55 }
56
57 public boolean isLocalhostOverUsb() {
58 return localhostOverUsb;
59 }
60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698