Search in sources :

Example 6 with ModuleEditor

use of com.intellij.openapi.roots.ui.configuration.ModuleEditor in project intellij-community by JetBrains.

the class IdeaModifiableModelsProvider method getModuleModifiableModel.

@Override
@Nullable
public ModifiableRootModel getModuleModifiableModel(final Module module) {
    final Project project = module.getProject();
    final ModulesConfigurator configurator = getModulesConfigurator(project);
    if (configurator != null) {
        if (!configurator.isModuleModelCommitted()) {
            final ModuleEditor moduleEditor = configurator.getModuleEditor(module);
            if (moduleEditor != null) {
                return moduleEditor.getModifiableRootModelProxy();
            }
        }
    }
    return ModuleRootManager.getInstance(module).getModifiableModel();
}
Also used : Project(com.intellij.openapi.project.Project) ModulesConfigurator(com.intellij.openapi.roots.ui.configuration.ModulesConfigurator) ModuleEditor(com.intellij.openapi.roots.ui.configuration.ModuleEditor) Nullable(org.jetbrains.annotations.Nullable)

Example 7 with ModuleEditor

use of com.intellij.openapi.roots.ui.configuration.ModuleEditor in project intellij-community by JetBrains.

the class ModuleStructureConfigurable method selectOrderEntry.

public ActionCallback selectOrderEntry(@NotNull Module module, @Nullable OrderEntry orderEntry) {
    for (final ModuleStructureExtension extension : ModuleStructureExtension.EP_NAME.getExtensions()) {
        final ActionCallback callback = extension.selectOrderEntry(module, orderEntry);
        if (callback != null) {
            return callback;
        }
    }
    Place p = new Place();
    p.putPath(ProjectStructureConfigurable.CATEGORY, this);
    Runnable r = null;
    final MasterDetailsComponent.MyNode node = findModuleNode(module);
    if (node != null) {
        p.putPath(TREE_OBJECT, module);
        p.putPath(ModuleEditor.SELECTED_EDITOR_NAME, ClasspathEditor.NAME);
        r = () -> {
            if (orderEntry != null) {
                ModuleEditor moduleEditor = ((ModuleConfigurable) node.getConfigurable()).getModuleEditor();
                ModuleConfigurationEditor editor = moduleEditor.getEditor(ClasspathEditor.NAME);
                if (editor instanceof ClasspathEditor) {
                    ((ClasspathEditor) editor).selectOrderEntry(orderEntry);
                }
            }
        };
    }
    final ActionCallback result = ProjectStructureConfigurable.getInstance(myProject).navigateTo(p, true);
    return r != null ? result.doWhenDone(r) : result;
}
Also used : ActionCallback(com.intellij.openapi.util.ActionCallback) ClasspathEditor(com.intellij.openapi.roots.ui.configuration.ClasspathEditor) ModuleEditor(com.intellij.openapi.roots.ui.configuration.ModuleEditor) Place(com.intellij.ui.navigation.Place)

Example 8 with ModuleEditor

use of com.intellij.openapi.roots.ui.configuration.ModuleEditor in project intellij-community by JetBrains.

the class ModuleStructureConfigurable method removeLibraryOrderEntry.

public void removeLibraryOrderEntry(final Module module, final Library library) {
    final ModuleEditor moduleEditor = myContext.myModulesConfigurator.getModuleEditor(module);
    LOG.assertTrue(moduleEditor != null, "Current module editor was not initialized");
    final ModifiableRootModel modelProxy = moduleEditor.getModifiableRootModelProxy();
    final OrderEntry[] entries = modelProxy.getOrderEntries();
    for (OrderEntry entry : entries) {
        if (entry instanceof LibraryOrderEntry && Comparing.strEqual(entry.getPresentableName(), library.getName())) {
            modelProxy.removeOrderEntry(entry);
            break;
        }
    }
    myContext.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(myContext, module));
    myTree.repaint();
}
Also used : ClonableOrderEntry(com.intellij.openapi.roots.impl.ClonableOrderEntry) ModuleProjectStructureElement(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement) ModuleEditor(com.intellij.openapi.roots.ui.configuration.ModuleEditor)

Aggregations

ModuleEditor (com.intellij.openapi.roots.ui.configuration.ModuleEditor)8 Module (com.intellij.openapi.module.Module)2 ClonableOrderEntry (com.intellij.openapi.roots.impl.ClonableOrderEntry)2 ModulesConfigurator (com.intellij.openapi.roots.ui.configuration.ModulesConfigurator)2 ModuleProjectStructureElement (com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement)2 Project (com.intellij.openapi.project.Project)1 Sdk (com.intellij.openapi.projectRoots.Sdk)1 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)1 Library (com.intellij.openapi.roots.libraries.Library)1 ClasspathEditor (com.intellij.openapi.roots.ui.configuration.ClasspathEditor)1 ModuleConfigurationState (com.intellij.openapi.roots.ui.configuration.ModuleConfigurationState)1 ActionCallback (com.intellij.openapi.util.ActionCallback)1 Place (com.intellij.ui.navigation.Place)1 ArrayList (java.util.ArrayList)1 Nullable (org.jetbrains.annotations.Nullable)1