use of org.jetbrains.android.dom.manifest.Manifest in project freeline by alibaba.
the class UsingReportAction method report.
private void report(Project project, PsiFile psiFile) {
Module module = ModuleUtilCore.findModuleForFile(psiFile.getVirtualFile(), project);
assert module != null;
AndroidFacet facet = AndroidFacet.getInstance(module);
assert facet != null;
Manifest manifest = facet.getManifest();
if (manifest == null) {
NotificationUtils.errorNotification("manifest file is null.");
return;
}
String packageName = manifest.getPackage().getValue();
if (packageName != null && packageName.length() > 0) {
UsingReportAsync task = new UsingReportAsync(packageName, this);
ApplicationManager.getApplication().executeOnPooledThread(task);
}
}
use of org.jetbrains.android.dom.manifest.Manifest in project android by JetBrains.
the class PackageClassConverter method toString.
@Override
@Nullable
public String toString(@Nullable PsiClass psiClass, ConvertContext context) {
DomElement domElement = context.getInvocationElement();
Manifest manifest = domElement.getParentOfType(Manifest.class, true);
final String packageName = manifest == null ? null : manifest.getPackage().getValue();
return classToString(psiClass, packageName, "");
}
use of org.jetbrains.android.dom.manifest.Manifest in project android by JetBrains.
the class AndroidResourceUtil method isRJavaFile.
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) {
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;
}
use of org.jetbrains.android.dom.manifest.Manifest in project android by JetBrains.
the class AndroidResourceUtil method manifestPackageForModule.
@Nullable
private static String manifestPackageForModule(@NotNull Module module) {
AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet == null) {
return null;
}
Manifest manifest = facet.getManifest();
if (manifest == null) {
return null;
}
return manifest.getPackage().getValue();
}
use of org.jetbrains.android.dom.manifest.Manifest in project android by JetBrains.
the class AndroidFrameworkDetector method doImportSdkAndFacetConfiguration.
public static void doImportSdkAndFacetConfiguration(@NotNull AndroidFacet facet, @Nullable ModifiableRootModel model) {
Module module = facet.getModule();
AndroidSdkUtils.setupAndroidPlatformIfNecessary(module, true);
if (model != null && !model.isDisposed() && model.isWritable()) {
model.setSdk(ModuleRootManager.getInstance(module).getSdk());
}
Pair<String, VirtualFile> manifestMergerProperty = getProjectPropertyValue(module, ANDROID_MANIFEST_MERGER_PROPERTY);
if (manifestMergerProperty != null) {
facet.getProperties().ENABLE_MANIFEST_MERGING = getFirstAsBoolean(manifestMergerProperty);
}
Pair<String, VirtualFile> dexDisableMergerProperty = getProjectPropertyValue(module, ANDROID_DEX_DISABLE_MERGER);
if (dexDisableMergerProperty != null) {
facet.getProperties().ENABLE_PRE_DEXING = !getFirstAsBoolean(dexDisableMergerProperty);
}
// Left here for compatibility with loading older projects
Pair<String, VirtualFile> androidLibraryProperty = getProjectPropertyValue(module, ANDROID_LIBRARY_PROPERTY);
if (androidLibraryProperty != null && getFirstAsBoolean(androidLibraryProperty)) {
facet.setProjectType(PROJECT_TYPE_LIBRARY);
}
Pair<String, VirtualFile> androidProjectTypeProperty = getProjectPropertyValue(module, ANDROID_PROJECT_TYPE_PROPERTY);
if (androidProjectTypeProperty != null) {
facet.setProjectType(Integer.parseInt(androidProjectTypeProperty.getFirst()));
}
if (facet.isAppProject()) {
Pair<String, VirtualFile> dexForceJumboProperty = getProjectPropertyValue(module, ANDROID_DEX_FORCE_JUMBO_PROPERTY);
if (dexForceJumboProperty != null) {
showDexOptionNotification(module, ANDROID_DEX_FORCE_JUMBO_PROPERTY);
}
Manifest manifest = facet.getManifest();
if (manifest != null && DefaultActivityLocator.getDefaultLauncherActivityName(module.getProject(), manifest) != null) {
AndroidRunConfigurations.getInstance().addRunConfiguration(facet, null, null, null);
}
}
}
Aggregations