當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。