Search in sources :

Example 1 with ScalableIcon

use of com.intellij.openapi.util.ScalableIcon in project intellij-community by JetBrains.

the class IdeConsoleRootType method substituteIcon.

@Nullable
@Override
public Icon substituteIcon(@NotNull Project project, @NotNull VirtualFile file) {
    FileType fileType = FileTypeManager.getInstance().getFileTypeByFileName(file.getName());
    if (fileType == UnknownFileType.INSTANCE || fileType == PlainTextFileType.INSTANCE) {
        return AllIcons.Debugger.ToolConsole;
    }
    Icon icon = fileType.getIcon();
    Icon subscript = ((ScalableIcon) AllIcons.Debugger.ToolConsole).scale(.5f);
    LayeredIcon icons = new LayeredIcon(2);
    icons.setIcon(icon, 0);
    icons.setIcon(subscript, 1, 8, 8);
    return JBUI.scale(icons);
}
Also used : ScalableIcon(com.intellij.openapi.util.ScalableIcon) LayeredIcon(com.intellij.ui.LayeredIcon) PlainTextFileType(com.intellij.openapi.fileTypes.PlainTextFileType) FileType(com.intellij.openapi.fileTypes.FileType) UnknownFileType(com.intellij.openapi.fileTypes.UnknownFileType) ScalableIcon(com.intellij.openapi.util.ScalableIcon) LayeredIcon(com.intellij.ui.LayeredIcon) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

FileType (com.intellij.openapi.fileTypes.FileType)1 PlainTextFileType (com.intellij.openapi.fileTypes.PlainTextFileType)1 UnknownFileType (com.intellij.openapi.fileTypes.UnknownFileType)1 ScalableIcon (com.intellij.openapi.util.ScalableIcon)1 LayeredIcon (com.intellij.ui.LayeredIcon)1 Nullable (org.jetbrains.annotations.Nullable)1