diff options
author | Tor Norbye <tnorbye@google.com> | 2012-10-25 13:08:49 -0700 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2012-10-25 13:08:50 -0700 |
commit | 152af2d57d5e2a6874e14fa1557566c6df7f9dad (patch) | |
tree | 5f7896ca9282ae210f544bac3d9c191832be2dc6 /eclipse | |
parent | 1506fc5ab1fc54f8bcfc6d28382907f5b39843f8 (diff) | |
parent | ea762f7cd0714854f72eb30d61fb0eced01dd628 (diff) | |
download | sdk-152af2d57d5e2a6874e14fa1557566c6df7f9dad.zip sdk-152af2d57d5e2a6874e14fa1557566c6df7f9dad.tar.gz sdk-152af2d57d5e2a6874e14fa1557566c6df7f9dad.tar.bz2 |
Merge "Avoid inlining the package prefix when adding activities"
Diffstat (limited to 'eclipse')
-rw-r--r-- | eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/TemplateHandler.java | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/TemplateHandler.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/TemplateHandler.java index d78fa03..44814d4 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/TemplateHandler.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/templates/TemplateHandler.java @@ -15,6 +15,7 @@ */ package com.android.ide.eclipse.adt.internal.wizards.templates; +import static com.android.SdkConstants.ATTR_PACKAGE; import static com.android.SdkConstants.DOT_AIDL; import static com.android.SdkConstants.DOT_FTL; import static com.android.SdkConstants.DOT_JAVA; @@ -798,12 +799,28 @@ class TemplateHandler { private boolean mergeManifest(Document currentManifest, Document fragment) { // TODO change MergerLog.wrapSdkLog by a custom IMergerLog that will create // and maintain error markers. + + // Transfer package element from manifest to merged in root; required by + // manifest merger + Element fragmentRoot = fragment.getDocumentElement(); + Element manifestRoot = currentManifest.getDocumentElement(); + if (fragmentRoot == null || manifestRoot == null) { + return false; + } + String pkg = fragmentRoot.getAttribute(ATTR_PACKAGE); + if (pkg == null || pkg.isEmpty()) { + pkg = manifestRoot.getAttribute(ATTR_PACKAGE); + if (pkg != null && !pkg.isEmpty()) { + fragmentRoot.setAttribute(ATTR_PACKAGE, pkg); + } + } + ManifestMerger merger = new ManifestMerger( MergerLog.wrapSdkLog(AdtPlugin.getDefault()), - new AdtManifestMergeCallback()); + new AdtManifestMergeCallback()).setExtractPackagePrefix(true); return currentManifest != null && - fragment != null && - merger.process(currentManifest, fragment); + fragment != null && + merger.process(currentManifest, fragment); } /** |