Search in sources :

Example 11 with StructureConfigurableContext

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

the class OrderEntryAppearanceServiceImpl method forLibrary.

@NotNull
@Override
public CellAppearanceEx forLibrary(Project project, @NotNull final Library library, final boolean hasInvalidRoots) {
    final StructureConfigurableContext context = ProjectStructureConfigurable.getInstance(project).getContext();
    final Icon icon = LibraryPresentationManager.getInstance().getCustomIcon(library, context);
    final String name = library.getName();
    if (name != null) {
        return normalOrRedWaved(name, (icon != null ? icon : PlatformIcons.LIBRARY_ICON), hasInvalidRoots);
    }
    final String[] files = library.getUrls(OrderRootType.CLASSES);
    if (files.length == 0) {
        return SimpleTextCellAppearance.invalid(ProjectBundle.message("library.empty.library.item"), PlatformIcons.LIBRARY_ICON);
    } else if (files.length == 1) {
        return forVirtualFilePointer(new LightFilePointer(files[0]));
    }
    final String url = StringUtil.trimEnd(files[0], JarFileSystem.JAR_SEPARATOR);
    String text = ProjectBundle.message("library.unnamed.text", PathUtil.getFileName(url), files.length - 1);
    return SimpleTextCellAppearance.regular(text, PlatformIcons.LIBRARY_ICON);
}
Also used : StructureConfigurableContext(com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext) LightFilePointer(com.intellij.openapi.vfs.impl.LightFilePointer) NotNull(org.jetbrains.annotations.NotNull)

Example 12 with StructureConfigurableContext

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

the class ModuleJdkConfigurable method clearCaches.

private void clearCaches() {
    final Module module = getRootModel().getModule();
    final Project project = module.getProject();
    final StructureConfigurableContext context = ModuleStructureConfigurable.getInstance(project).getContext();
    context.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(context, module));
}
Also used : Project(com.intellij.openapi.project.Project) 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)

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