I'm developing an Eclipse plugin and would like to programmatically determine where the user has installed the Android SDK at. This information is stored in the Eclipse Workbench preferences page. It is access as follows: Window->Preferences->Android.
Is it possible to load this value stored on the preferences page?
Th开发者_运维技巧anks!
On a Mac, I found the value in a file stored in my workspace: {workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings/com.android.ide.eclipse.adt.prefs
File contents:
com.android.ide.eclipse.adt.fixLegacyEditors=1
com.android.ide.eclipse.adt.sdk=/Users/Jakuben/Documents/android_dev_environment/android-sdk-macosx
eclipse.preferences.version=1
From the information Ben Jakuben gave, I figured out the magic incantation:
Platform.getPreferencesService().getString("com.android.ide.eclipse.adt", "com.android.ide.eclipse.adt.sdk", null, null);
Key pieces of information here are:
- "com.android.ide.eclipse.adt" - Android plugin ID
- "com.android.ide.eclipse.adt.sdk" - Key for SDK location preference
精彩评论