| 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 package com.google.dart.tools.debug.ui.internal.mobile; | 14 package com.google.dart.tools.debug.ui.internal.mobile; |
| 15 | 15 |
| 16 import com.google.dart.tools.core.mobile.AndroidDebugBridge; |
| 16 import com.google.dart.tools.core.model.DartSdkManager; | 17 import com.google.dart.tools.core.model.DartSdkManager; |
| 17 import com.google.dart.tools.debug.core.DartDebugCorePlugin; | 18 import com.google.dart.tools.debug.core.DartDebugCorePlugin; |
| 18 import com.google.dart.tools.debug.core.DartLaunchConfigWrapper; | 19 import com.google.dart.tools.debug.core.DartLaunchConfigWrapper; |
| 19 import com.google.dart.tools.debug.ui.internal.DartUtil; | 20 import com.google.dart.tools.debug.ui.internal.DartUtil; |
| 21 import com.google.dart.tools.debug.ui.internal.dialogs.ManageLaunchesDialog; |
| 20 import com.google.dart.tools.debug.ui.internal.util.AbstractLaunchShortcut; | 22 import com.google.dart.tools.debug.ui.internal.util.AbstractLaunchShortcut; |
| 21 import com.google.dart.tools.debug.ui.internal.util.ILaunchShortcutExt; | 23 import com.google.dart.tools.debug.ui.internal.util.ILaunchShortcutExt; |
| 22 import com.google.dart.tools.debug.ui.internal.util.LaunchUtils; | 24 import com.google.dart.tools.debug.ui.internal.util.LaunchUtils; |
| 23 | 25 |
| 24 import org.eclipse.core.resources.IFile; | 26 import org.eclipse.core.resources.IFile; |
| 25 import org.eclipse.core.resources.IResource; | 27 import org.eclipse.core.resources.IResource; |
| 26 import org.eclipse.core.runtime.CoreException; | 28 import org.eclipse.core.runtime.CoreException; |
| 27 import org.eclipse.core.runtime.OperationCanceledException; | 29 import org.eclipse.core.runtime.OperationCanceledException; |
| 28 import org.eclipse.debug.core.DebugPlugin; | 30 import org.eclipse.debug.core.DebugPlugin; |
| 29 import org.eclipse.debug.core.ILaunchConfiguration; | 31 import org.eclipse.debug.core.ILaunchConfiguration; |
| 30 import org.eclipse.debug.core.ILaunchConfigurationType; | 32 import org.eclipse.debug.core.ILaunchConfigurationType; |
| 31 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; | 33 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; |
| 32 import org.eclipse.debug.core.ILaunchManager; | 34 import org.eclipse.debug.core.ILaunchManager; |
| 35 import org.eclipse.ui.PlatformUI; |
| 33 | 36 |
| 34 /** | 37 /** |
| 35 * A launch shortcut to allow users to launch Dart applications on Mobile. | 38 * A launch shortcut to allow users to launch Dart applications on Mobile. |
| 36 */ | 39 */ |
| 37 public class MobileLaunchShortcut extends AbstractLaunchShortcut implements ILau
nchShortcutExt { | 40 public class MobileLaunchShortcut extends AbstractLaunchShortcut implements ILau
nchShortcutExt { |
| 38 | 41 |
| 39 public MobileLaunchShortcut() { | 42 public MobileLaunchShortcut() { |
| 40 super("Mobile"); | 43 super("Mobile"); |
| 41 } | 44 } |
| 42 | 45 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 manager.generateLaunchConfigurationName(resource.getName())); | 92 manager.generateLaunchConfigurationName(resource.getName())); |
| 90 } catch (CoreException ce) { | 93 } catch (CoreException ce) { |
| 91 DartUtil.logError(ce); | 94 DartUtil.logError(ce); |
| 92 return; | 95 return; |
| 93 } | 96 } |
| 94 | 97 |
| 95 DartLaunchConfigWrapper launchWrapper = new DartLaunchConfigWrapper(launch
Config); | 98 DartLaunchConfigWrapper launchWrapper = new DartLaunchConfigWrapper(launch
Config); |
| 96 | 99 |
| 97 launchWrapper.setApplicationName(resource.getFullPath().toString()); | 100 launchWrapper.setApplicationName(resource.getFullPath().toString()); |
| 98 launchWrapper.setProjectName(resource.getProject().getName()); | 101 launchWrapper.setProjectName(resource.getProject().getName()); |
| 102 launchWrapper.setUsePubServe(false); |
| 99 launchConfig.setMappedResources(new IResource[] {resource}); | 103 launchConfig.setMappedResources(new IResource[] {resource}); |
| 100 | 104 |
| 101 try { | 105 try { |
| 102 config = launchConfig.doSave(); | 106 config = launchConfig.doSave(); |
| 103 } catch (CoreException e) { | 107 } catch (CoreException e) { |
| 104 DartUtil.logError(e); | 108 DartUtil.logError(e); |
| 105 return; | 109 return; |
| 106 } | 110 } |
| 107 } | 111 } |
| 108 | 112 |
| 113 // If device is not connected or not authorized then open launch dialog |
| 114 if (!AndroidDebugBridge.getAndroidDebugBridge().isDeviceConnectedAndAuthoriz
ed()) { |
| 115 ManageLaunchesDialog.openAsync(PlatformUI.getWorkbench().getActiveWorkbenc
hWindow(), config); |
| 116 return; |
| 117 } |
| 118 |
| 109 DartLaunchConfigWrapper launchWrapper = new DartLaunchConfigWrapper(config); | 119 DartLaunchConfigWrapper launchWrapper = new DartLaunchConfigWrapper(config); |
| 110 launchWrapper.markAsLaunched(); | 120 launchWrapper.markAsLaunched(); |
| 111 LaunchUtils.clearDartiumConsoles(); | 121 LaunchUtils.clearDartiumConsoles(); |
| 112 | 122 |
| 113 LaunchUtils.launch(config, mode); | 123 LaunchUtils.launch(config, mode); |
| 114 } | 124 } |
| 115 | 125 |
| 116 @Override | 126 @Override |
| 117 protected boolean testSimilar(IResource resource, ILaunchConfiguration config)
{ | 127 protected boolean testSimilar(IResource resource, ILaunchConfiguration config)
{ |
| 118 return super.testSimilar(resource, config); | 128 return super.testSimilar(resource, config); |
| 119 } | 129 } |
| 120 | 130 |
| 121 } | 131 } |
| OLD | NEW |