use of org.jetbrains.android.dom.manifest.Application in project android by JetBrains.
the class AddActivityToManifest method invoke.
@Override
void invoke(@NotNull PsiClass psiClass, @NotNull Manifest manifest) {
final Application application = manifest.getApplication();
application.addActivity().getActivityClass().setValue(psiClass);
}
use of org.jetbrains.android.dom.manifest.Application in project android by JetBrains.
the class AddServiceToManifest method invoke.
@Override
void invoke(@NotNull PsiClass psiClass, @NotNull Manifest manifest) {
final Application application = manifest.getApplication();
application.addService().getServiceClass().setValue(psiClass);
}
use of org.jetbrains.android.dom.manifest.Application in project android by JetBrains.
the class RenderErrorContributor method reportRtlNotEnabled.
private void reportRtlNotEnabled(@NotNull RenderLogger logger, @Nullable RenderTask task) {
ApplicationManager.getApplication().runReadAction(() -> {
Project project = logger.getProject();
if (project == null || project.isDisposed()) {
return;
}
Module module = logger.getModule();
if (module == null) {
return;
}
AndroidFacet facet = AndroidFacet.getInstance(module);
Manifest manifest = facet != null ? facet.getManifest() : null;
Application application = manifest != null ? manifest.getApplication() : null;
if (application == null) {
return;
}
final XmlTag applicationTag = application.getXmlTag();
if (applicationTag == null) {
return;
}
HtmlBuilder builder = new HtmlBuilder();
builder.add("(").addLink("Add android:supportsRtl=\"true\" to the manifest", logger.getLinkManager().createRunnableLink(() -> {
new SetAttributeFix(project, applicationTag, AndroidManifest.ATTRIBUTE_SUPPORTS_RTL, ANDROID_URI, VALUE_TRUE).execute();
EditorDesignSurface surface = task != null ? task.getDesignSurface() : null;
if (surface != null) {
surface.requestRender(true);
}
})).add(")");
addIssue().setSeverity(HighlightSeverity.ERROR).setSummary("RTL support requires android:supportsRtl=\"true\" in the manifest").setHtmlContent(builder).build();
});
}
use of org.jetbrains.android.dom.manifest.Application in project android by JetBrains.
the class AddBroadcastReceiverToManifest method invoke.
@Override
void invoke(@NotNull PsiClass psiClass, @NotNull Manifest manifest) {
final Application application = manifest.getApplication();
application.addReceiver().getReceiverClass().setValue(psiClass);
}
use of org.jetbrains.android.dom.manifest.Application in project android by JetBrains.
the class AndroidActivityAliasCompletionContributor method doCollectActivityAliases.
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.getActivityAliases()) {
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);
}
}
}
}
Aggregations