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

Side by Side Diff: dart/editor/tools/plugins/com.google.dart.tools.debug.ui/src/com/google/dart/tools/debug/ui/launch/DartRunAbstractAction.java

Issue 321583008: Merge to trunk cl - fixes/features for mobile support in the editor (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
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Dart project authors. 2 * Copyright 2012 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.launch; 15 package com.google.dart.tools.debug.ui.launch;
16 16
17 import com.google.dart.tools.core.mobile.AndroidDebugBridge;
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.DebugErrorHandler; 20 import com.google.dart.tools.debug.ui.internal.DebugErrorHandler;
20 import com.google.dart.tools.debug.ui.internal.DebugInstrumentationUtilities; 21 import com.google.dart.tools.debug.ui.internal.DebugInstrumentationUtilities;
22 import com.google.dart.tools.debug.ui.internal.dialogs.ManageLaunchesDialog;
21 import com.google.dart.tools.debug.ui.internal.util.LaunchUtils; 23 import com.google.dart.tools.debug.ui.internal.util.LaunchUtils;
22 import com.google.dart.tools.ui.actions.InstrumentedAction; 24 import com.google.dart.tools.ui.actions.InstrumentedAction;
23 import com.google.dart.tools.ui.instrumentation.UIInstrumentationBuilder; 25 import com.google.dart.tools.ui.instrumentation.UIInstrumentationBuilder;
24 26
25 import org.eclipse.core.runtime.CoreException; 27 import org.eclipse.core.runtime.CoreException;
26 import org.eclipse.debug.core.ILaunchConfiguration; 28 import org.eclipse.debug.core.ILaunchConfiguration;
27 import org.eclipse.debug.core.ILaunchManager; 29 import org.eclipse.debug.core.ILaunchManager;
28 import org.eclipse.debug.ui.DebugUITools; 30 import org.eclipse.debug.ui.DebugUITools;
29 import org.eclipse.debug.ui.ILaunchShortcut; 31 import org.eclipse.debug.ui.ILaunchShortcut;
30 import org.eclipse.jface.action.ActionContributionItem; 32 import org.eclipse.jface.action.ActionContributionItem;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 int count = Math.min(launches.length, MAX_MENU_LENGTH); 185 int count = Math.min(launches.length, MAX_MENU_LENGTH);
184 186
185 for (int i = 0; i < count; i++) { 187 for (int i = 0; i < count; i++) {
186 final ILaunchConfiguration config = launches[i]; 188 final ILaunchConfiguration config = launches[i];
187 189
188 InstrumentedAction launchAction = new InstrumentedAction( 190 InstrumentedAction launchAction = new InstrumentedAction(
189 LaunchUtils.getLongLaunchName(config), 191 LaunchUtils.getLongLaunchName(config),
190 DebugUITools.getDefaultImageDescriptor(config)) { 192 DebugUITools.getDefaultImageDescriptor(config)) {
191 @Override 193 @Override
192 public void doRun(Event event, UIInstrumentationBuilder instrumentation) { 194 public void doRun(Event event, UIInstrumentationBuilder instrumentation) {
195
196 // If this is a mobile launch and device is not connected or not autho rized
197 // then open launch dialog
198 try {
199 if (config.getType().getIdentifier().equals(DartDebugCorePlugin.MOBI LE_LAUNCH_CONFIG_ID)) {
200 if (!AndroidDebugBridge.getAndroidDebugBridge().isDeviceConnectedA ndAuthorized()) {
201 ManageLaunchesDialog.openAsync(window, config);
202 return;
203 }
204 }
205 } catch (CoreException e) {
206 //$FALL-THROUGH$
207 }
208
193 launch(config, instrumentation); 209 launch(config, instrumentation);
194 } 210 }
195 }; 211 };
196 212
197 new ActionContributionItem(launchAction).fill(menu, -1); 213 new ActionContributionItem(launchAction).fill(menu, -1);
198 } 214 }
199 215
200 if (menu.getItemCount() > 0) { 216 if (menu.getItemCount() > 0) {
201 new Separator().fill(menu, -1); 217 new Separator().fill(menu, -1);
202 } 218 }
203 219
204 new ActionContributionItem(new ManageLaunchesAction(window)).fill(menu, -1); 220 new ActionContributionItem(new ManageLaunchesAction(window)).fill(menu, -1);
205 221
206 } 222 }
207 223
208 private void initMenu() { 224 private void initMenu() {
209 225
210 } 226 }
211 227
212 private void setMenu(Menu inMenu) { 228 private void setMenu(Menu inMenu) {
213 if (menu != null) { 229 if (menu != null) {
214 menu.dispose(); 230 menu.dispose();
215 } 231 }
216 232
217 menu = inMenu; 233 menu = inMenu;
218 } 234 }
219 235
220 } 236 }
OLDNEW
« no previous file with comments | « dart/editor/tools/plugins/com.google.dart.tools.debug.ui/src/com/google/dart/tools/debug/ui/internal/mobile/MobileMainTab.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698