• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2009 The Android Open Source Project
3  *
4  * Licensed under the Eclipse Public License, Version 1.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.eclipse.org/org/documents/epl-v10.php
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.ide.eclipse.adt.internal.wizards.actions;
18 
19 import com.android.ide.eclipse.adt.AdtPlugin;
20 import com.android.ide.eclipse.adt.internal.sdk.Sdk;
21 import com.android.sdkuilib.repository.UpdaterWindow;
22 
23 import org.eclipse.jface.action.IAction;
24 import org.eclipse.jface.viewers.ISelection;
25 import org.eclipse.ui.IObjectActionDelegate;
26 import org.eclipse.ui.IWorkbenchPart;
27 import org.eclipse.ui.IWorkbenchWindow;
28 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
29 
30 /**
31  * Delegate for the toolbar/menu action "Android AVD Manager".
32  * It displays the Android AVD Manager.
33  */
34 public class AvdManagerAction implements IWorkbenchWindowActionDelegate, IObjectActionDelegate {
35 
dispose()36     public void dispose() {
37         // nothing to dispose.
38     }
39 
init(IWorkbenchWindow window)40     public void init(IWorkbenchWindow window) {
41         // no init
42     }
43 
run(IAction action)44     public void run(IAction action) {
45         Sdk sdk = Sdk.getCurrent();
46         if (sdk != null) {
47             UpdaterWindow window = new UpdaterWindow(
48                     AdtPlugin.getDisplay().getActiveShell(),
49                     null /*sdk log*/,
50                     sdk.getSdkLocation(),
51                     false /*userCanChangeSdkRoot*/);
52             window.addListeners(new UpdaterWindow.ISdkListener() {
53                 public void onSdkChange() {
54                     AdtPlugin.getDefault().reparseSdk();
55                 }
56             });
57             window.open();
58         }
59     }
60 
selectionChanged(IAction action, ISelection selection)61     public void selectionChanged(IAction action, ISelection selection) {
62         // nothing related to the current selection.
63     }
64 
setActivePart(IAction action, IWorkbenchPart targetPart)65     public void setActivePart(IAction action, IWorkbenchPart targetPart) {
66         // nothing to do.
67     }
68 }
69