@Override
  public void addFacetToModule(
      final Module module, @Nullable String jdkProvider, boolean forAndroid, boolean showSettings) {
    if (ceylonModel == null) {
      ceylonModel = module.getProject().getComponent(IdeaCeylonProjects.class);
      ceylonModel.addProject(module);
    }

    IdeaCeylonProject ceylonProject = (IdeaCeylonProject) ceylonModel.getProject(module);

    if (forAndroid) {
      ceylonProject.$setupForAndroid(jdkProvider);
    }

    ceylonProject.getConfiguration().save();

    CeylonFacet facet = CeylonFacet.forModule(module);
    if (facet == null) {
      facet =
          ApplicationManager.getApplication()
              .runWriteAction(
                  new Computable<CeylonFacet>() {
                    @Override
                    public CeylonFacet compute() {
                      return FacetManager.getInstance(module)
                          .addFacet(
                              CeylonFacet.getFacetType(),
                              CeylonFacet.getFacetType().getPresentableName(),
                              null);
                    }
                  });
      facet.getConfiguration().setModule(module);
    }

    if (showSettings) {
      ModulesConfigurator.showFacetSettingsDialog(facet, CeylonFacetConfiguration.COMPILATION_TAB);
    }
  }
 @Nullable
 public IdeaCeylonProject getCeylonProject() {
   return (IdeaCeylonProject) ceylonModel.getProject(module);
 }