Search in sources :

Example 1 with FacetModel

use of com.intellij.facet.FacetModel in project android by JetBrains.

the class AndroidApplicationArtifactType method getNewArtifactTemplates.

@NotNull
@Override
public List<? extends ArtifactTemplate> getNewArtifactTemplates(@NotNull PackagingElementResolvingContext context) {
    final List<AndroidFacet> facets = new ArrayList<AndroidFacet>();
    for (Module module : context.getModulesProvider().getModules()) {
        final FacetModel facetModel = context.getModulesProvider().getFacetModel(module);
        final AndroidFacet facet = facetModel.getFacetByType(AndroidFacet.ID);
        if (facet != null && facet.isAppProject()) {
            facets.add(facet);
        }
    }
    if (facets.size() == 0) {
        return Collections.emptyList();
    }
    return Collections.singletonList(new MyTemplate(context.getProject(), facets));
}
Also used : ArrayList(java.util.ArrayList) Module(com.intellij.openapi.module.Module) FacetModel(com.intellij.facet.FacetModel) AndroidFacet(org.jetbrains.android.facet.AndroidFacet) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

FacetModel (com.intellij.facet.FacetModel)1 Module (com.intellij.openapi.module.Module)1 ArrayList (java.util.ArrayList)1 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)1 NotNull (org.jetbrains.annotations.NotNull)1