Search in sources :

Example 1 with ProjectFacetManager

use of com.intellij.facet.ProjectFacetManager in project intellij-community by JetBrains.

the class BuildoutFacetConfigurator method configureProject.

@Override
public void configureProject(Project project, @NotNull VirtualFile baseDir, Ref<Module> moduleRef) {
    final Module[] modules = ModuleManager.getInstance(project).getModules();
    if (modules.length > 0) {
        final Module module = modules[0];
        if (BuildoutFacet.getInstance(module) == null) {
            baseDir.refresh(false, false);
            final VirtualFile runner = BuildoutFacet.getRunner(baseDir);
            if (runner != null) {
                // TODO parse buildout.cfg and find out the part to use for the default script
                final File script = BuildoutFacet.findScript(null, "buildout", project.getBaseDir());
                if (script != null) {
                    final ProjectFacetManager facetManager = ProjectFacetManager.getInstance(module.getProject());
                    final BuildoutFacetConfiguration config = facetManager.createDefaultConfiguration(BuildoutFacetType.getInstance());
                    config.setScriptName(script.getPath());
                    setupFacet(module, config);
                }
            }
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Module(com.intellij.openapi.module.Module) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) ProjectFacetManager(com.intellij.facet.ProjectFacetManager)

Aggregations

ProjectFacetManager (com.intellij.facet.ProjectFacetManager)1 Module (com.intellij.openapi.module.Module)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 File (java.io.File)1