diff options
Diffstat (limited to 'eclipse/plugins')
4 files changed, 100 insertions, 2 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/Hyperlinks.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/Hyperlinks.java index 5911155..aef1763 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/Hyperlinks.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/Hyperlinks.java @@ -34,6 +34,7 @@ import static com.android.SdkConstants.FN_RESOURCE_CLASS; import static com.android.SdkConstants.NEW_ID_PREFIX; import static com.android.SdkConstants.PREFIX_RESOURCE_REF; import static com.android.SdkConstants.PREFIX_THEME_REF; +import static com.android.SdkConstants.RESOURCE_CLZ_ATTR; import static com.android.SdkConstants.STYLE_RESOURCE_PREFIX; import static com.android.SdkConstants.TAG_RESOURCES; import static com.android.SdkConstants.TAG_STYLE; @@ -1117,8 +1118,17 @@ public class Hyperlinks { /** Parse a resource reference or a theme reference and return the individual parts */ private static Pair<ResourceType,String> parseResource(String url) { if (url.startsWith(PREFIX_THEME_REF)) { - url = PREFIX_RESOURCE_REF + url.substring(PREFIX_THEME_REF.length()); - return ResourceHelper.parseResource(url); + String remainder = url.substring(PREFIX_THEME_REF.length()); + int colon = url.indexOf(':'); + if (colon != -1) { + // Convert from ?android:progressBarStyleBig to ?android:attr/progressBarStyleBig + if (remainder.indexOf('/', colon) == -1) { + remainder = remainder.substring(0, colon) + RESOURCE_CLZ_ATTR + '/' + + remainder.substring(colon); + } + url = PREFIX_RESOURCE_REF + remainder; + return ResourceHelper.parseResource(url); + } } return ResourceHelper.parseResource(url); diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/uimodel/UiResourceAttributeNode.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/uimodel/UiResourceAttributeNode.java index 43e9bee..eb51d3f 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/uimodel/UiResourceAttributeNode.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/uimodel/UiResourceAttributeNode.java @@ -332,6 +332,13 @@ public class UiResourceAttributeNode extends UiTextAttributeNode { if (resTypes.contains(ResourceType.ATTR) || resTypes.contains(ResourceType.STYLE)) { results.add(PREFIX_THEME_REF + ResourceType.ATTR.getName() + '/'); + if (prefix != null && prefix.startsWith(ANDROID_THEME_PREFIX)) { + // including attr isn't required + for (ResourceItem item : repository.getResourceItemsOfType( + ResourceType.ATTR)) { + results.add(ANDROID_THEME_PREFIX + item.getName()); + } + } } return results.toArray(new String[results.size()]); } diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssistTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssistTest.java index a201de6..47571cd 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssistTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/AndroidContentAssistTest.java @@ -492,6 +492,11 @@ public class AndroidContentAssistTest extends AdtProjectTest { checkLayoutCompletion("completion12.xml", "<include ^/>"); } + public void testComplation76() throws Exception { + // Test theme completion with implicit attr + checkLayoutCompletion("navigation1.xml", "?android:a^ttr/alertDialogStyle"); + } + // ---- Test *applying* code completion ---- // The following tests check -applying- a specific code completion diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-complation76.txt b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-complation76.txt new file mode 100644 index 0000000..6b9cf5b --- /dev/null +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/testdata/navigation1-expected-complation76.txt @@ -0,0 +1,76 @@ +Code completion in navigation1.xml for ?android:a^ttr/alertDialogStyle: +?android:attr/ +?android:allowClearUserData +?android:authorities +?android:action +?android:alertDialogStyle +?android:absListViewStyle +?android:autoCompleteTextViewStyle +?android:autoLink +?android:activityOpenEnterAnimation +?android:activityOpenExitAnimation +?android:activityCloseEnterAnimation +?android:activityCloseExitAnimation +?android:animationCache +?android:alwaysDrawnWithCache +?android:addStatesFromChildren +?android:animationDuration +?android:antialias +?android:adjustViewBounds +?android:autoText +?android:angle +?android:animation +?android:animationOrder +?android:alphabeticShortcut +?android:alwaysRetainTaskState +?android:allowTaskReparenting +?android:apiKey +?android:allowSingleTap +?android:animateOnClick +?android:anyDensity +?android:allowBackup +?android:autoUrlDetect +?android:accountType +?android:accountPreferences +?android:author +?android:autoStart +?android:allContactsName +?android:actionBarStyle +?android:animateFirstView +?android:actionDropDownStyle +?android:actionButtonStyle +?android:actionModeBackground +?android:actionModeCloseDrawable +?android:actionBarSize +?android:animateLayoutChanges +?android:actionBarTabStyle +?android:actionBarTabBarStyle +?android:actionBarTabTextStyle +?android:actionOverflowButtonStyle +?android:actionModeCloseButtonStyle +?android:actionLayout +?android:actionViewClass +?android:activatedBackgroundIndicator +?android:alertDialogTheme +?android:autoAdvanceViewId +?android:actionModeCutDrawable +?android:actionModeCopyDrawable +?android:actionModePasteDrawable +?android:animationResolution +?android:alpha +?android:allowParallelSyncs +?android:alertDialogIcon +?android:actionMenuTextAppearance +?android:actionMenuTextColor +?android:alignmentMode +?android:actionModeSelectAllDrawable +?android:accessibilityEventTypes +?android:accessibilityFeedbackType +?android:accessibilityFlags +?android:actionBarSplitStyle +?android:actionProviderClass +?android:actionModeStyle +?android:actionBarWidgetTheme +?android:actionBarDivider +?android:actionBarItemBackground +?android:actionModeSplitBackground |