Search in sources :

Example 6 with StructureConfigurableContext

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

the class ClasspathPanelImpl method addItems.

@Override
public void addItems(List<ClasspathTableItem<?>> toAdd) {
    for (ClasspathTableItem<?> item : toAdd) {
        myModel.addRow(item);
    }
    TIntArrayList toSelect = new TIntArrayList();
    for (int i = myModel.getRowCount() - toAdd.size(); i < myModel.getRowCount(); i++) {
        toSelect.add(myEntryTable.convertRowIndexToView(i));
    }
    TableUtil.selectRows(myEntryTable, toSelect.toNativeArray());
    TableUtil.scrollSelectionToVisible(myEntryTable);
    final StructureConfigurableContext context = ModuleStructureConfigurable.getInstance(myState.getProject()).getContext();
    context.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(context, getRootModel().getModule()));
}
Also used : ModuleProjectStructureElement(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement) StructureConfigurableContext(com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext) TIntArrayList(gnu.trove.TIntArrayList) RelativePoint(com.intellij.ui.awt.RelativePoint)

Example 7 with StructureConfigurableContext

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

the class ClasspathPanelImpl method removeSelectedItems.

private void removeSelectedItems(final List removedRows) {
    if (removedRows.isEmpty()) {
        return;
    }
    for (final Object removedRow : removedRows) {
        final ClasspathTableItem<?> item = (ClasspathTableItem<?>) ((Object[]) removedRow)[ClasspathTableModel.ITEM_COLUMN];
        final OrderEntry orderEntry = item.getEntry();
        if (orderEntry == null) {
            continue;
        }
        getRootModel().removeOrderEntry(orderEntry);
    }
    final int[] selectedRows = myEntryTable.getSelectedRows();
    myModel.fireTableDataChanged();
    TableUtil.selectRows(myEntryTable, selectedRows);
    final StructureConfigurableContext context = ModuleStructureConfigurable.getInstance(myState.getProject()).getContext();
    context.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(context, getRootModel().getModule()));
}
Also used : ModuleProjectStructureElement(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement) StructureConfigurableContext(com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext)

Example 8 with StructureConfigurableContext

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

the class UIRootConfigurationAccessor method getLibrary.

@Override
@Nullable
public Library getLibrary(Library library, final String libraryName, final String libraryLevel) {
    final StructureConfigurableContext context = ProjectStructureConfigurable.getInstance(myProject).getContext();
    if (library == null) {
        if (libraryName != null) {
            library = context.getLibrary(libraryName, libraryLevel);
        }
    } else {
        final Library model = context.getLibraryModel(library);
        if (model != null) {
            library = model;
        }
        library = context.getLibrary(library.getName(), library.getTable().getTableLevel());
    }
    return library;
}
Also used : StructureConfigurableContext(com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext) Library(com.intellij.openapi.roots.libraries.Library) Nullable(org.jetbrains.annotations.Nullable)

Example 9 with StructureConfigurableContext

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

the class ProjectJdkConfigurable method clearCaches.

private void clearCaches() {
    final ModuleStructureConfigurable rootConfigurable = ModuleStructureConfigurable.getInstance(myProject);
    Module[] modules = rootConfigurable.getModules();
    for (Module module : modules) {
        final StructureConfigurableContext context = rootConfigurable.getContext();
        context.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(context, module));
    }
}
Also used : ModuleStructureConfigurable(com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable) ModuleProjectStructureElement(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement) StructureConfigurableContext(com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext) Module(com.intellij.openapi.module.Module)

Example 10 with StructureConfigurableContext

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

the class IdeaModifiableModelsProvider method getLibraryTableModifiableModel.

@Override
public LibraryTable.ModifiableModel getLibraryTableModifiableModel() {
    final Project[] projects = ProjectManager.getInstance().getOpenProjects();
    for (Project project : projects) {
        if (!project.isInitialized()) {
            continue;
        }
        StructureConfigurableContext context = getProjectStructureContext(project);
        LibraryTableModifiableModelProvider provider = context != null ? context.createModifiableModelProvider(LibraryTablesRegistrar.APPLICATION_LEVEL) : null;
        final LibraryTable.ModifiableModel modifiableModel = provider != null ? provider.getModifiableModel() : null;
        if (modifiableModel != null) {
            return modifiableModel;
        }
    }
    return LibraryTablesRegistrar.getInstance().getLibraryTable().getModifiableModel();
}
Also used : Project(com.intellij.openapi.project.Project) LibraryTable(com.intellij.openapi.roots.libraries.LibraryTable) StructureConfigurableContext(com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext) LibraryTableModifiableModelProvider(com.intellij.openapi.roots.ui.configuration.LibraryTableModifiableModelProvider)

Aggregations

StructureConfigurableContext (com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext)12 ModuleProjectStructureElement (com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement)6 Module (com.intellij.openapi.module.Module)3 Nullable (org.jetbrains.annotations.Nullable)3 Project (com.intellij.openapi.project.Project)2 Library (com.intellij.openapi.roots.libraries.Library)2 RelativePoint (com.intellij.ui.awt.RelativePoint)2 TIntArrayList (gnu.trove.TIntArrayList)2 NotNull (org.jetbrains.annotations.NotNull)2 LibraryOrderEntry (com.intellij.openapi.roots.LibraryOrderEntry)1 OrderEntry (com.intellij.openapi.roots.OrderEntry)1 ClonableOrderEntry (com.intellij.openapi.roots.impl.ClonableOrderEntry)1 ProjectRootManagerImpl (com.intellij.openapi.roots.impl.ProjectRootManagerImpl)1 RootModelImpl (com.intellij.openapi.roots.impl.RootModelImpl)1 LibraryTable (com.intellij.openapi.roots.libraries.LibraryTable)1 LibraryType (com.intellij.openapi.roots.libraries.LibraryType)1 LibraryTableModifiableModelProvider (com.intellij.openapi.roots.ui.configuration.LibraryTableModifiableModelProvider)1 ProjectStructureConfigurable (com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable)1 ArtifactsStructureConfigurableContext (com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurableContext)1 ArtifactsTreeNode (com.intellij.openapi.roots.ui.configuration.artifacts.nodes.ArtifactsTreeNode)1