本文整理匯總了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);
}
}
}
}
}