1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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.monitor;
18 
19 import com.android.sdkstats.DdmsPreferenceStore;
20 
21 import org.eclipse.jface.resource.ImageDescriptor;
22 import org.eclipse.ui.plugin.AbstractUIPlugin;
23 import org.osgi.framework.BundleContext;
24 
25 import java.io.File;
26 
27 public class MonitorPlugin extends AbstractUIPlugin {
28     public static final String PLUGIN_ID = "com.android.ide.eclipse.monitor"; //$NON-NLS-1$
29     private static MonitorPlugin sPlugin;
30     private static final DdmsPreferenceStore sDdmsPreferenceStore = new DdmsPreferenceStore();
31     private File mSdkFolder;
32 
33     @Override
start(BundleContext context)34     public void start(BundleContext context) throws Exception {
35         super.start(context);
36 
37         sPlugin = this;
38     }
39 
40     @Override
stop(BundleContext context)41     public void stop(BundleContext context) throws Exception {
42         sPlugin = null;
43         super.stop(context);
44     }
45 
getDefault()46     public static MonitorPlugin getDefault() {
47         return sPlugin;
48     }
49 
getImageDescriptor(String path)50     public static ImageDescriptor getImageDescriptor(String path) {
51         return imageDescriptorFromPlugin(PLUGIN_ID, path);
52     }
53 
getDdmsPreferenceStore()54     public static DdmsPreferenceStore getDdmsPreferenceStore() {
55         return sDdmsPreferenceStore;
56     }
57 
setSdkFolder(File sdkFolder)58     public void setSdkFolder(File sdkFolder) {
59         mSdkFolder = sdkFolder;
60     }
61 
getSdkFolder()62     public File getSdkFolder() {
63         return mSdkFolder;
64     }
65 }
66