当前位置: 首页>>代码示例>>Java>>正文


Java ModifiableRootModel.getOrderEntries方法代码示例

本文整理汇总了Java中com.intellij.openapi.roots.ModifiableRootModel.getOrderEntries方法的典型用法代码示例。如果您正苦于以下问题:Java ModifiableRootModel.getOrderEntries方法的具体用法?Java ModifiableRootModel.getOrderEntries怎么用?Java ModifiableRootModel.getOrderEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.roots.ModifiableRootModel的用法示例。


在下文中一共展示了ModifiableRootModel.getOrderEntries方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeModule

import com.intellij.openapi.roots.ModifiableRootModel; //导入方法依赖的package包/类
public static void removeModule(@NotNull final Module moduleToRemove,
                                 @Nullable ModifiableRootModel modifiableRootModelToRemove,
                                 @NotNull Collection<ModifiableRootModel> otherModuleRootModels,
                                 @NotNull final ModifiableModuleModel moduleModel) {
  // remove all dependencies on the module that is about to be removed
  for (final ModifiableRootModel modifiableRootModel : otherModuleRootModels) {
    final OrderEntry[] orderEntries = modifiableRootModel.getOrderEntries();
    for (final OrderEntry orderEntry : orderEntries) {
      if (orderEntry instanceof ModuleOrderEntry && orderEntry.isValid()) {
        final Module orderEntryModule = ((ModuleOrderEntry)orderEntry).getModule();
        if (orderEntryModule != null && orderEntryModule.equals(moduleToRemove)) {
          modifiableRootModel.removeOrderEntry(orderEntry);
        }
      }
    }
  }
  // destroyProcess editor
  if (modifiableRootModelToRemove != null) {
    modifiableRootModelToRemove.dispose();
  }
  // destroyProcess module
  moduleModel.disposeModule(moduleToRemove);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ModuleDeleteProvider.java

示例2: applyFix

import com.intellij.openapi.roots.ModifiableRootModel; //导入方法依赖的package包/类
@Override
public void applyFix(@NotNull Project project, @NotNull CommonProblemDescriptor descriptor) {
  final ModifiableRootModel model = ModuleRootManager.getInstance(myModule).getModifiableModel();
  for (OrderEntry entry : model.getOrderEntries()) {
    if (entry instanceof ModuleOrderEntry) {
      final Module mDependency = ((ModuleOrderEntry)entry).getModule();
      if (Comparing.equal(mDependency, myDependency)) {
        model.removeOrderEntry(entry);
        break;
      }
    }
  }
  model.commit();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:UnnecessaryModuleDependencyInspection.java

示例3: removeData

import com.intellij.openapi.roots.ModifiableRootModel; //导入方法依赖的package包/类
protected void removeData(@NotNull Collection<? extends ExportableOrderEntry> toRemove,
                          @NotNull Module module,
                          @NotNull IdeModifiableModelsProvider modelsProvider) {
  if (toRemove.isEmpty()) {
    return;
  }
  final ModifiableRootModel modifiableRootModel = modelsProvider.getModifiableRootModel(module);
  for (final ExportableOrderEntry dependency : toRemove) {
    // The thing is that intellij created order entry objects every time new modifiable model is created,
    // that's why we can't use target dependency object as is but need to get a reference to the current
    // entry object from the model instead.
    for (OrderEntry entry : modifiableRootModel.getOrderEntries()) {
      if (entry instanceof ExportableOrderEntry) {
        ExportableOrderEntry orderEntry = (ExportableOrderEntry)entry;
        if (orderEntry.getPresentableName().equals(dependency.getPresentableName()) &&
            orderEntry.getScope().equals(dependency.getScope())) {
          modifiableRootModel.removeOrderEntry(entry);
          break;
        }
      }
      else if (entry.getPresentableName().equals(dependency.getPresentableName())) {
        modifiableRootModel.removeOrderEntry(entry);
        break;
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:AbstractDependencyDataService.java

示例4: removeOldMvcSdk

import com.intellij.openapi.roots.ModifiableRootModel; //导入方法依赖的package包/类
private static void removeOldMvcSdk(MvcFramework framework, ModifiableRootModel model) {
  final LibraryPresentationManager presentationManager = LibraryPresentationManager.getInstance();
  for (OrderEntry entry : model.getOrderEntries()) {
    if (entry instanceof LibraryOrderEntry) {
      final Library library = ((LibraryOrderEntry)entry).getLibrary();
      final LibrariesContainer container = LibrariesContainerFactory.createContainer(model);
      if (library != null) {
        final VirtualFile[] files = container.getLibraryFiles(library, OrderRootType.CLASSES);
        if (presentationManager.isLibraryOfKind(Arrays.asList(files), framework.getLibraryKind())) {
          model.removeOrderEntry(entry);
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:MvcUpgradeAction.java


注:本文中的com.intellij.openapi.roots.ModifiableRootModel.getOrderEntries方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。