本文整理汇总了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);
}
示例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();
}
示例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;
}
}
}
}
示例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);
}
}
}
}
}