当前位置: 首页>>代码示例>>Java>>正文


Java AndroidFacet.getManifest方法代码示例

本文整理汇总了Java中org.jetbrains.android.facet.AndroidFacet.getManifest方法的典型用法代码示例。如果您正苦于以下问题:Java AndroidFacet.getManifest方法的具体用法?Java AndroidFacet.getManifest怎么用?Java AndroidFacet.getManifest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jetbrains.android.facet.AndroidFacet的用法示例。


在下文中一共展示了AndroidFacet.getManifest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLocalXmlNamespace

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@Nullable
public static String getLocalXmlNamespace(@NotNull AndroidFacet facet) {
  if (facet.isLibraryProject() || facet.isGradleProject()) {
    return SdkConstants.AUTO_URI;
  }
  final Manifest manifest = facet.getManifest();
  if (manifest != null) {
    String aPackage = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
      @Override
      @Nullable
      public String compute() {
        return manifest.getPackage().getValue();
      }
    });
    if (aPackage != null && aPackage.length() != 0) {
      return SdkConstants.URI_PREFIX + aPackage;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AndroidXmlSchemaProvider.java

示例2: getNamespaceKeyByResourcePackage

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@Nullable
public static String getNamespaceKeyByResourcePackage(@NotNull AndroidFacet facet, @Nullable String resPackage) {
  if (resPackage == null) {
    if (facet.getProperties().LIBRARY_PROJECT || facet.isGradleProject()) {
      return AUTO_URI;
    }
    Manifest manifest = facet.getManifest();
    if (manifest != null) {
      String aPackage = manifest.getPackage().getValue();
      if (aPackage != null && aPackage.length() > 0) {
        return URI_PREFIX + aPackage;
      }
    }
  }
  else if (resPackage.equals(SYSTEM_RESOURCE_PACKAGE)) {
    return ANDROID_URI;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AndroidDomExtender.java

示例3: processApkPackageAttrs

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
private void processApkPackageAttrs(@NotNull Processor<GenericAttributeValue<String>> processor) {
  for (Module depModule : ModuleRootManager.getInstance(myModule).getDependencies()) {
    final AndroidFacet depFacet = AndroidFacet.getInstance(depModule);

    if (depFacet != null && !depFacet.isLibraryProject()) {
      final Manifest manifest = depFacet.getManifest();

      if (manifest != null) {
        final GenericAttributeValue<String> packageAttr = manifest.getPackage();

        if (packageAttr != null && !processor.process(packageAttr)) {
          return;
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:InstrumentationTargetPackageConverter.java

示例4: isRJavaFile

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
public static boolean isRJavaFile(@NotNull AndroidFacet facet, @NotNull PsiFile file) {
  if (file.getName().equals(AndroidCommonUtils.R_JAVA_FILENAME) && file instanceof PsiJavaFile) {
    final PsiJavaFile javaFile = (PsiJavaFile)file;

    final Manifest manifest = facet.getManifest();
    if (manifest == null) {
      return false;
    }

    final String manifestPackage = manifest.getPackage().getValue();
    if (manifestPackage != null && javaFile.getPackageName().equals(manifestPackage)) {
      return true;
    }

    for (String aPackage : AndroidUtils.getDepLibsPackages(facet.getModule())) {
      if (javaFile.getPackageName().equals(aPackage)) {
        return true;
      }
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AndroidResourceUtil.java

示例5: excludeAllBuildConfigsFromCompilation

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
private static void excludeAllBuildConfigsFromCompilation(AndroidFacet facet, VirtualFile sourceRoot) {
  final Module module = facet.getModule();
  final Project project = module.getProject();
  final Set<String> packages = new HashSet<String>();

  final Manifest manifest = facet.getManifest();
  final String aPackage = manifest != null ? manifest.getPackage().getStringValue() : null;

  if (aPackage != null) {
    packages.add(aPackage);
  }
  packages.addAll(AndroidUtils.getDepLibsPackages(module));

  for (String p : packages) {
    excludeFromCompilation(project, sourceRoot, p);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AndroidCompileUtil.java

示例6: findCircularDependencyOnLibraryWithSamePackage

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@Nullable
public static Module findCircularDependencyOnLibraryWithSamePackage(@NotNull AndroidFacet facet) {
  final Manifest manifest = facet.getManifest();
  final String aPackage = manifest != null ? manifest.getPackage().getValue() : null;
  if (aPackage == null) {
    return null;
  }

  for (AndroidFacet depFacet : AndroidUtils.getAllAndroidDependencies(facet.getModule(), true)) {
    final Manifest depManifest = depFacet.getManifest();
    final String depPackage = depManifest != null ? depManifest.getPackage().getValue() : null;
    if (aPackage.equals(depPackage)) {
      final List<AndroidFacet> depDependencies = AndroidUtils.getAllAndroidDependencies(depFacet.getModule(), false);

      if (depDependencies.contains(facet)) {
        // circular dependency on library with the same package
        return depFacet.getModule();
      }
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AndroidCompileUtil.java

示例7: getWritableAndroidManifestXml

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@Nullable
public static XmlTag getWritableAndroidManifestXml(@NotNull Module module) {
    AndroidFacet androidFacet = AndroidFacet.getInstance(module);
    if (androidFacet == null) {
        return null;
    }

    Manifest manifest = androidFacet.getManifest();
    if (manifest == null) {
        return null;
    }

    XmlTag manifestTag = manifest.getXmlTag();
    if (manifestTag == null) {
        return null;
    }

    PsiFile manifestFile = manifestTag.getContainingFile();
    if (manifestFile == null) {
        return null;
    }

    VirtualFile vManifestFile = manifestFile.getVirtualFile();
    if (vManifestFile == null) {
        return null;
    }

    if (!ReadonlyStatusHandler.ensureFilesWritable(manifestFile.getProject(), vManifestFile)) {
        return null;
    }

    return manifestTag;
}
 
开发者ID:apsun,项目名称:XposedPlugin,代码行数:34,代码来源:AndroidXmlUtils.java

示例8: doCollectActivityAliases

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
private static void doCollectActivityAliases(@NotNull AndroidFacet facet, @NotNull Set<String> result) {
  final Manifest manifest = facet.getManifest();

  if (manifest == null) {
    return;
  }
  final String aPackage = manifest.getPackage().getStringValue();
  final Application application = manifest.getApplication();

  if (application == null) {
    return;
  }
  for (ActivityAlias activityAlias : application.getActivityAliass()) {
    String alias = activityAlias.getName().getStringValue();

    if (alias != null && alias.length() > 0) {
      if (!alias.startsWith(".")) {
        if (alias.indexOf('.') > 0) {
          result.add(alias);
        }
        alias = "." + alias;
      }
      if (aPackage != null && aPackage.length() > 0 && StringUtil.commonPrefixLength(aPackage, alias) == 0) {
        result.add(aPackage + alias);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:AndroidActivityAliasCompletionContributor.java

示例9: collectManifestElements

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
private static void collectManifestElements(@NotNull String nestedClassName,
                                            @NotNull String fieldName,
                                            @NotNull AndroidFacet facet,
                                            @NotNull List<PsiElement> result) {
  final Manifest manifest = facet.getManifest();

  if (manifest == null) {
    return;
  }
  List<? extends ManifestElementWithRequiredName> list;

  if ("permission".equals(nestedClassName)) {
    list = manifest.getPermissions();
  }
  else if ("permission_group".equals(nestedClassName)) {
    list = manifest.getPermissionGroups();
  }
  else {
    return;
  }
  for (ManifestElementWithRequiredName domElement : list) {
    final AndroidAttributeValue<String> nameAttribute = domElement.getName();
    final String name = nameAttribute.getValue();

    if (AndroidUtils.equal(name, fieldName, false)) {
      final XmlElement psiElement = nameAttribute.getXmlAttributeValue();

      if (psiElement != null) {
        result.add(psiElement);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:AndroidGotoDeclarationHandler.java

示例10: getAaptManifestPackage

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@Nullable
public static String getAaptManifestPackage(@NotNull AndroidFacet facet) {
  if (facet.getProperties().USE_CUSTOM_MANIFEST_PACKAGE) {
    return facet.getProperties().CUSTOM_MANIFEST_PACKAGE;
  }
  final Manifest manifest = facet.getManifest();

  return manifest != null
         ? manifest.getPackage().getStringValue()
         : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:AndroidCompileUtil.java

示例11: getClasses

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
private PsiClass[] getClasses(@NotNull String targetPackageName,
                              @NotNull GlobalSearchScope scope) {
  List<PsiClass> result = new ArrayList<PsiClass>();

  for(Module module : ModuleManager.getInstance(myProject).getModules()) {
    if (!scope.isSearchInModuleContent(module)) {
      continue;
    }
    AndroidFacet facet = AndroidFacet.getInstance(module);
    // If we cannot find a facet or manifest, we cannot have resources.
    if (facet == null || facet.getManifest() == null) {
      continue;
    }

    // If our target package isn't associated with this module, continue.
    String thisPackageName = facet.getManifest().getPackage().getStringValue();
    if (Strings.isNullOrEmpty(targetPackageName)
        || !targetPackageName.equals(thisPackageName)) {
      continue;
    }

    PsiClass cachedResult = facet.getLightRClass();
    if (cachedResult != null) {
      result.add(cachedResult);
    }
  }

  return result.toArray(new PsiClass[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:AndroidInMemoryRUtil.java

示例12: collectAllProcessNames

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@NotNull
private static Set<String> collectAllProcessNames(Project project) {
  final List<AndroidFacet> facets = ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID);
  final Set<String> result = new HashSet<String>();

  for (AndroidFacet facet : facets) {
    final String packageName = AndroidCompileUtil.getAaptManifestPackage(facet);

    if (packageName != null) {
      result.add(packageName.toLowerCase());
    }
    final Manifest manifest = facet.getManifest();

    if (manifest != null) {
      final XmlElement xmlElement = manifest.getXmlElement();

      if (xmlElement != null) {
        collectProcessNames(xmlElement, result);
      }
    }
    final IdeaAndroidProject androidProject = facet.getIdeaAndroidProject();
    if (androidProject != null) {
      collectApplicationIds(androidProject, result);
    }
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:AndroidProcessChooserDialog.java

示例13: findRJavaFiles

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@NotNull
private static List<PsiJavaFile> findRJavaFiles(@NotNull AndroidFacet facet, boolean onlyInOwnPackages) {
  final Module module = facet.getModule();
  final Project project = module.getProject();
  final Manifest manifest = facet.getManifest();

  if (manifest == null) {
    return Collections.emptyList();
  }
  final Set<PsiDirectory> dirs = new HashSet<PsiDirectory>();
  collectDirsForPackage(module, project, null, dirs, new HashSet<Module>(), onlyInOwnPackages);

  final List<PsiJavaFile> rJavaFiles = new ArrayList<PsiJavaFile>();

  for (PsiDirectory dir : dirs) {
    final VirtualFile file = dir.getVirtualFile().findChild(AndroidCommonUtils.R_JAVA_FILENAME);

    if (file != null) {
      final PsiFile psiFile = PsiManager.getInstance(project).findFile(file);

      if (psiFile instanceof PsiJavaFile) {
        rJavaFiles.add((PsiJavaFile)psiFile);
      }
    }
  }
  return rJavaFiles;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:AndroidResourceUtil.java

示例14: isManifestJavaFile

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
public static boolean isManifestJavaFile(@NotNull AndroidFacet facet, @NotNull PsiFile file) {
  if (file.getName().equals(AndroidCommonUtils.MANIFEST_JAVA_FILE_NAME) && file instanceof PsiJavaFile) {
    final Manifest manifest = facet.getManifest();
    final PsiJavaFile javaFile = (PsiJavaFile)file;
    return manifest != null && javaFile.getPackageName().equals(manifest.getPackage().getValue());
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:AndroidResourceUtil.java

示例15: doesPackageContainMavenProperty

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
private static boolean doesPackageContainMavenProperty(@NotNull AndroidFacet facet) {
  final Manifest manifest = facet.getManifest();

  if (manifest == null) {
    return false;
  }
  final String aPackage = manifest.getPackage().getStringValue();
  return aPackage != null && aPackage.contains("${");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AndroidRunConfiguration.java


注:本文中的org.jetbrains.android.facet.AndroidFacet.getManifest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。