Search in sources :

Example 1 with JpsRootModel

use of com.intellij.project.model.impl.module.JpsRootModel in project intellij-community by JetBrains.

the class MavenSourceFoldersModuleExtension method init.

public void init(@NotNull Module module, @NotNull ModifiableRootModel modifiableRootModel) {
    myRootModel = modifiableRootModel;
    myDummyJpsModule = JpsElementFactory.getInstance().createModule(module.getName(), JpsJavaModuleType.INSTANCE, JpsElementFactory.getInstance().createDummyElement());
    myDummyJpsRootModel = new JpsRootModel(module, myDummyJpsModule);
    for (JpsSourceFolder folder : myJpsSourceFolders) {
        Disposer.dispose(folder);
    }
    myJpsSourceFolders.clear();
    for (ContentEntry eachEntry : modifiableRootModel.getContentEntries()) {
        for (SourceFolder eachFolder : eachEntry.getSourceFolders()) {
            //noinspection unchecked
            final JpsModuleSourceRoot jpsModuleSourceRoot = JpsElementFactory.getInstance().createModuleSourceRoot(eachFolder.getUrl(), (JpsModuleSourceRootType<JpsElement>) eachFolder.getRootType(), eachFolder.getJpsElement().getProperties().getBulkModificationSupport().createCopy());
            addJspSourceFolder(jpsModuleSourceRoot, eachFolder.getUrl());
        }
    }
}
Also used : JpsRootModel(com.intellij.project.model.impl.module.JpsRootModel) JpsSourceFolder(com.intellij.project.model.impl.module.content.JpsSourceFolder) JpsModuleSourceRoot(org.jetbrains.jps.model.module.JpsModuleSourceRoot) JpsElement(org.jetbrains.jps.model.JpsElement) JpsContentEntry(com.intellij.project.model.impl.module.content.JpsContentEntry) JpsSourceFolder(com.intellij.project.model.impl.module.content.JpsSourceFolder)

Aggregations

JpsRootModel (com.intellij.project.model.impl.module.JpsRootModel)1 JpsContentEntry (com.intellij.project.model.impl.module.content.JpsContentEntry)1 JpsSourceFolder (com.intellij.project.model.impl.module.content.JpsSourceFolder)1 JpsElement (org.jetbrains.jps.model.JpsElement)1 JpsModuleSourceRoot (org.jetbrains.jps.model.module.JpsModuleSourceRoot)1