本文整理汇总了Java中com.intellij.openapi.roots.ModifiableRootModel类的典型用法代码示例。如果您正苦于以下问题:Java ModifiableRootModel类的具体用法?Java ModifiableRootModel怎么用?Java ModifiableRootModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ModifiableRootModel类属于com.intellij.openapi.roots包,在下文中一共展示了ModifiableRootModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addLibsToModule
import com.intellij.openapi.roots.ModifiableRootModel; //导入依赖的package包/类
private void addLibsToModule(
@NotNull final ModifiableRootModel modifiableRootModel,
@NotNull IdeModifiableModelsProvider modifiableModelsProvider,
@NotNull final String libraryName,
final boolean export
) {
Validate.notNull(modifiableRootModel);
final LibraryTable.ModifiableModel libraryTableModifiableModel = modifiableModelsProvider
.getModifiableProjectLibrariesModel();
Library library = libraryTableModifiableModel.getLibraryByName(libraryName);
if (null == library) {
library = libraryTableModifiableModel.createLibrary(libraryName);
}
modifiableRootModel.addLibraryEntry(library);
if (export) {
setLibraryEntryExported(modifiableRootModel, library);
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:23,代码来源:DefaultLibRootsConfigurator.java
示例2: configure
import com.intellij.openapi.roots.ModifiableRootModel; //导入依赖的package包/类
@Override
public void configure(
@NotNull final ModifiableRootModel modifiableRootModel,
@NotNull final HybrisModuleDescriptor moduleDescriptor
) {
Validate.notNull(modifiableRootModel);
Validate.notNull(moduleDescriptor);
final CompilerModuleExtension compilerModuleExtension = modifiableRootModel.getModuleExtension(
CompilerModuleExtension.class
);
final File outputDirectory = new File(
moduleDescriptor.getRootDirectory(),
HybrisConstants.JAVA_COMPILER_FAKE_OUTPUT_PATH
);
compilerModuleExtension.setCompilerOutputPath(VfsUtilCore.pathToUrl(outputDirectory.getAbsolutePath()));
compilerModuleExtension.setCompilerOutputPathForTests(VfsUtilCore.pathToUrl(outputDirectory.getAbsolutePath()));
compilerModuleExtension.setExcludeOutput(true);
compilerModuleExtension.inheritCompilerOutputPath(false);
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:24,代码来源:DefaultCompilerOutputPathsConfigurator.java
示例3: configureModuleDependencies
import com.intellij.openapi.roots.ModifiableRootModel; //导入依赖的package包/类
private void configureModuleDependencies(
@NotNull final HybrisModuleDescriptor moduleDescriptor,
@NotNull final Module module,
@NotNull final Collection<Module> allModules,
@NotNull final Set<HybrisModuleDescriptor> extModules,
final @NotNull IdeModifiableModelsProvider modifiableModelsProvider
) {
final ModifiableRootModel rootModel = modifiableModelsProvider.getModifiableRootModel(module);
for (HybrisModuleDescriptor dependency : moduleDescriptor.getDependenciesTree()) {
if (moduleDescriptor instanceof OotbHybrisModuleDescriptor) {
if (extModules.contains(dependency)) {
continue;
}
}
Optional<Module> targetDependencyModule = findModuleByNameIgnoreCase(allModules, dependency.getName());
final ModuleOrderEntry moduleOrderEntry = targetDependencyModule.isPresent()
? rootModel.addModuleOrderEntry(targetDependencyModule.get())
: rootModel.addInvalidModuleEntry(dependency.getName());
moduleOrderEntry.setExported(true);
moduleOrderEntry.setScope(DependencyScope.COMPILE);
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:26,代码来源:DefaultModulesDependenciesConfigurator.java
示例4: configure
import com.intellij.openapi.roots.ModifiableRootModel; //导入依赖的package包/类
@Override
public void configure(
@NotNull final ModifiableRootModel modifiableRootModel,
@NotNull final HybrisModuleDescriptor moduleDescriptor
) {
Validate.notNull(modifiableRootModel);
Validate.notNull(moduleDescriptor);
final String javadocUrl = moduleDescriptor.getRootProjectDescriptor().getJavadocUrl();
if (null != javadocUrl) {
final JavaModuleExternalPaths javaModuleExternalPaths = modifiableRootModel.getModuleExtension(
JavaModuleExternalPaths.class
);
javaModuleExternalPaths.setJavadocUrls(new String[]{javadocUrl});
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:19,代码来源:DefaultJavadocModuleConfigurator.java
示例5: addToolsJar
import com.intellij.openapi.roots.ModifiableRootModel; //导入依赖的package包/类
static void addToolsJar( @NotNull ModifiableRootModel rootModel )
{
if( hasToolsJar( rootModel ) )
{
return;
}
VirtualFile toolsJarFile = findToolsJarFile( rootModel.getProject() );
if( toolsJarFile == null )
{
Notifications.Bus.notify( new Notification( "Project JDK", "tools.jar not found!", "Please add tools.jar to your JDK", NotificationType.ERROR ) );
return;
}
SdkModificator sdkModificator = rootModel.getSdk().getSdkModificator();
sdkModificator.addRoot( toolsJarFile, OrderRootType.CLASSES );
sdkModificator.commitChanges();
}
示例6: createConfigurable
import com.intellij.openapi.roots.ModifiableRootModel; //导入依赖的package包/类
@Override
@NotNull
public FrameworkSupportInModuleConfigurable createConfigurable( @NotNull final FrameworkSupportModel model )
{
return new RepositoryLibrarySupportInModuleConfigurable( model.getProject(), RepositoryLibraryDescription.findDescription( "systems.manifold", "manifold-all" ) )
{
@Override
public void addSupport( @NotNull Module module, @NotNull ModifiableRootModel rootModel, @NotNull ModifiableModelsProvider modifiableModelsProvider )
{
super.addSupport( module, rootModel, modifiableModelsProvider );
// also add tools.jar to the SDK if not already present
ApplicationManager.getApplication().invokeLater( () -> ApplicationManager.getApplication().runWriteAction( () -> {
ModifiableRootModel rootModel2 = ModuleRootManager.getInstance( module ).getModifiableModel();
ManSupportProvider.addToolsJar( rootModel2 );
rootModel2.commit();
} ) );
}
};
}
示例7: setupRootModel
import com.intellij.openapi.roots.ModifiableRootModel; //导入依赖的package包/类
@Override
public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException {
super.setupRootModel(rootModel);
addListener(new ModuleBuilderListener() {
@Override
public void moduleCreated(@NotNull Module module) {
setMuleFramework(module);
}
});
setMuleFacet(rootModel.getModule());
final Project project = rootModel.getProject();
final VirtualFile root = createAndGetContentEntry();
rootModel.addContentEntry(root);
//Check if this is a module and has parent
final MavenId parentId = (this.getParentProject() != null ? this.getParentProject().getMavenId() : null);
MavenUtil.runWhenInitialized(project, (DumbAwareRunnable) () -> {
new MuleMavenProjectBuilderHelper().configure(project, getProjectId(), muleVersion, root, parentId);
});
}
示例8: addSupport
import com.intellij.openapi.roots.ModifiableRootModel; //导入依赖的package包/类
@Override
protected void addSupport(@NotNull final Module module, @NotNull final ModifiableRootModel rootModel, final FrameworkVersion version, final @Nullable Library library) {
FacetManager facetManager = FacetManager.getInstance(module);
ModifiableFacetModel model = facetManager.createModifiableModel();
Facet underlyingFacet = null;
FacetTypeId<?> underlyingFacetType = myFacetType.getUnderlyingFacetType();
if (underlyingFacetType != null) {
underlyingFacet = model.getFacetByType(underlyingFacetType);
LOG.assertTrue(underlyingFacet != null, underlyingFacetType);
}
F facet = facetManager.createFacet(myFacetType, myFacetType.getDefaultFacetName(), underlyingFacet);
setupConfiguration(facet, rootModel, version);
if (library != null) {
onLibraryAdded(facet, library);
}
model.addFacet(facet);
model.commit();
onFacetCreated(facet, rootModel, version);
}
示例9: setupRootModel
import com.intellij.openapi.roots.ModifiableRootModel; //导入依赖的package包/类
@Override
public void setupRootModel(@NotNull final ModifiableRootModel rootModel) throws ConfigurationException {
if (mySdk == null) {
rootModel.inheritSdk();
} else {
rootModel.setSdk(mySdk);
}
// Make the entire module directory a source root.
ContentEntry contentEntry = doAddContentEntry(rootModel);
if (contentEntry != null) {
final VirtualFile file = contentEntry.getFile();
if (file != null && file.isDirectory())
contentEntry.addSourceFolder(file, false);
}
}
示例10: generateProject
import com.intellij.openapi.roots.ModifiableRootModel; //导入依赖的package包/类
@Override
public void generateProject(@NotNull final Project project, @NotNull final VirtualFile baseDir,
@NotNull final CatberryProjectSettings data, @NotNull final Module module) {
ApplicationManager.getApplication().runWriteAction(
new Runnable() {
public void run() {
final ModifiableRootModel modifiableModel =
ModifiableModelsProvider.SERVICE.getInstance().getModuleModifiableModel(module);
URL url = CatberryProjectGenerator.class.getClassLoader().getResource(
"templates/new_project/" + data.templateEngine);
if (!FileUtils.copyResourcesRecursively(url, new File(baseDir.getPath()), false))
LOG.error("Unable to copy resources for project generation");
ModifiableModelsProvider.SERVICE.getInstance().commitModuleModifiableModel(modifiableModel);
}
}
);
}
示例11: createModule
import com.intellij.openapi.roots.ModifiableRootModel; //导入依赖的package包/类
private static Module createModule(
ProjectDescriptor projectDescriptor,
final ModuleDescriptor descriptor,
final Map<LibraryDescriptor, Library> projectLibs,
final ModifiableModuleModel moduleModel) {
logger.info("Starting createModule in ProjectFromSourcesBuilderImplModified");
final String moduleFilePath = descriptor.computeModuleFilePath();
ModuleBuilder.deleteModuleFile(moduleFilePath);
final Module module =
moduleModel.newModule(moduleFilePath, descriptor.getModuleType().getId());
final ModifiableRootModel modifiableModel =
ModuleRootManager.getInstance(module).getModifiableModel();
setupRootModel(projectDescriptor, descriptor, modifiableModel, projectLibs);
descriptor.updateModuleConfiguration(module, modifiableModel);
modifiableModel.commit();
logger.info("ending createModule in ProjectFromSourcesBuilderImplModified");
return module;
}
示例12: doSetup
import com.intellij.openapi.roots.ModifiableRootModel; //导入依赖的package包/类
protected void doSetup(ModifiableModelsProvider modifiableModelsProvider, final Module module) {
final ModifiableFacetModel model = modifiableModelsProvider.getFacetModifiableModel(module);
final String name = UniqueNameGenerator.generateUniqueName(myFacetType.getDefaultFacetName(), new Condition<String>() {
@Override
public boolean value(String s) {
return FacetManager.getInstance(module).findFacet(myFacetType.getId(), s) == null;
}
});
final F facet = FacetManager.getInstance(module).createFacet(myFacetType, name, myConfiguration,
findUnderlyingFacet(module));
model.addFacet(facet);
modifiableModelsProvider.commitFacetModifiableModel(module, model);
final ModifiableRootModel rootModel = modifiableModelsProvider.getModuleModifiableModel(module);
myDetector.setupFacet(facet, rootModel);
modifiableModelsProvider.commitModuleModifiableModel(rootModel);
}
示例13: setupRootModel
import com.intellij.openapi.roots.ModifiableRootModel; //导入依赖的package包/类
public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException {
final Project project = rootModel.getProject();
final VirtualFile root = createAndGetContentEntry();
rootModel.addContentEntry(root);
// todo this should be moved to generic ModuleBuilder
if (myJdk != null){
rootModel.setSdk(myJdk);
} else {
rootModel.inheritSdk();
}
MavenUtil.runWhenInitialized(project, new DumbAwareRunnable() {
public void run() {
if (myEnvironmentForm != null) {
myEnvironmentForm.setData(MavenProjectsManager.getInstance(project).getGeneralSettings());
}
new MavenModuleBuilderHelper(myProjectId, myAggregatorProject, myParentProject, myInheritGroupId,
myInheritVersion, myArchetype, myPropertiesToCreateByArtifact, "Create new Maven module").configure(project, root, false);
}
});
}
示例14: cleanUpAndroidModuleWithoutVariants
import com.intellij.openapi.roots.ModifiableRootModel; //导入依赖的package包/类
private static void cleanUpAndroidModuleWithoutVariants(@NotNull Module module) {
// Remove Android facet, otherwise the IDE will try to build the module, and fail. The facet may have been added in a previous
// successful commit.
AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet != null) {
ModifiableFacetModel facetModel = FacetManager.getInstance(module).createModifiableModel();
facetModel.removeFacet(facet);
facetModel.commit();
}
// Clear all source and exclude folders.
ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
ModifiableRootModel rootModel = moduleRootManager.getModifiableModel();
for (ContentEntry contentEntry : rootModel.getContentEntries()) {
contentEntry.clearSourceFolders();
contentEntry.clearExcludeFolders();
}
rootModel.commit();
}
示例15: testClassUnderExcludedFolder
import com.intellij.openapi.roots.ModifiableRootModel; //导入依赖的package包/类
public void testClassUnderExcludedFolder() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
PsiTestUtil.addExcludedRoot(myModule, myPackDir);
PsiClass psiClass = myJavaFacade.findClass("p.A", GlobalSearchScope.allScope(myProject));
assertNull(psiClass);
ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
final ContentEntry content = rootModel.getContentEntries()[0];
content.removeExcludeFolder(content.getExcludeFolders()[0]);
rootModel.commit();
psiClass = myJavaFacade.findClass("p.A", GlobalSearchScope.allScope(myProject));
assertEquals("p.A", psiClass.getQualifiedName());
}
});
}