1 /* 2 * Copyright (C) 2012 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.base; 18 19 import org.eclipse.core.runtime.Platform; 20 import org.osgi.framework.Bundle; 21 import org.osgi.framework.Version; 22 23 public class InstallDetails { 24 private static final String ADT_PLUGIN_ID = "com.android.ide.eclipse.adt"; //$NON-NLS-1$ 25 private static final String ECLIPSE_PLATFORM_PLUGIN_ID = "org.eclipse.platform"; //$NON-NLS-1$ 26 27 /** 28 * Returns true if the ADT plugin is available in the current platform. This is useful 29 * for distinguishing between specific RCP applications vs. ADT + Eclipse. 30 */ 31 public static boolean isAdtInstalled() { 32 Bundle b = Platform.getBundle(ADT_PLUGIN_ID); 33 return b != null; 34 } 35 36 /** Returns the version of current eclipse platform. */ 37 public static Version getPlatformVersion() { 38 Bundle b = Platform.getBundle(ECLIPSE_PLATFORM_PLUGIN_ID); 39 return b == null ? Version.emptyVersion : b.getVersion(); 40 } 41 } 42