Java Code Examples for com.intellij.openapi.util.Iconable#IconFlags
The following examples show how to use
com.intellij.openapi.util.Iconable#IconFlags .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JSGraphQLEndpointIconProvider.java From js-graphql-intellij-plugin with MIT License | 6 votes |
@Nullable @Override public Icon getIcon(@NotNull PsiElement element, @Iconable.IconFlags int flags) { if (element.getLanguage() != JSGraphQLEndpointLanguage.INSTANCE) { return null; } if (element instanceof JSGraphQLEndpointNamedTypeDef) { if (element.getParent() instanceof JSGraphQLEndpointNamedTypeDefinition) { return getTypeDefinitionIcon((JSGraphQLEndpointNamedTypeDefinition) element.getParent()); } } if (element instanceof JSGraphQLEndpointNamedTypeDefinition) { return getTypeDefinitionIcon((JSGraphQLEndpointNamedTypeDefinition) element); } if (element instanceof JSGraphQLEndpointProperty) { return JSGraphQLIcons.Schema.Field; } if (element instanceof JSGraphQLEndpointInputValueDefinition) { return JSGraphQLIcons.Schema.Attribute; } if(element instanceof JSGraphQLEndpointImportDeclaration) { return JSGraphQLIcons.Files.GraphQLSchema; } return null; }
Example 2
Source File: IconUtilEx.java From consulo with Apache License 2.0 | 5 votes |
public static Image getIcon(Object object, @Iconable.IconFlags int flags, Project project) { if (object instanceof PsiElement) { return IconDescriptorUpdaters.getIcon(((PsiElement)object), flags); } if (object instanceof Module) { return AllIcons.Nodes.Module; } if (object instanceof VirtualFile) { VirtualFile file = (VirtualFile)object; return VfsIconUtil.getIcon(file, flags, project); } return null; }
Example 3
Source File: HaxeIconProvider.java From intellij-haxe with Apache License 2.0 | 5 votes |
@Override public Icon getIcon(@NotNull PsiElement element, @Iconable.IconFlags int flags) { if (element instanceof HaxeFile) { return getHaxeFileIcon((HaxeFile)element, flags); } return null; }
Example 4
Source File: HaxeIconProvider.java From intellij-haxe with Apache License 2.0 | 5 votes |
@Nullable private static Icon getHaxeFileIcon(HaxeFile file, @Iconable.IconFlags int flags) { final String fileName = FileUtil.getNameWithoutExtension(file.getName()); for (HaxeComponent component : HaxeResolveUtil.findComponentDeclarations(file)) { if (fileName.equals(component.getName())) { return component.getIcon(flags); } } return null; }
Example 5
Source File: AnnotationIconProvider.java From idea-php-annotation-plugin with MIT License | 5 votes |
public Icon getIcon(@NotNull PsiElement element, @Iconable.IconFlags int flags) { if (element instanceof PhpFile && PhpPsiUtil.findClasses((PhpFile)element, AnnotationUtil::isAnnotationClass).size() == 1) { return PlatformIcons.ANNOTATION_TYPE_ICON; } return null; }
Example 6
Source File: ThriftIconProvider.java From intellij-thrift with Apache License 2.0 | 5 votes |
@Nullable @Override public Icon getIcon(@NotNull PsiElement element, @Iconable.IconFlags int flags) { if (element instanceof ThriftConst) { return ThriftIcons.CONST; } if (element instanceof ThriftEnum) { return ThriftIcons.ENUM; } if (element instanceof ThriftException) { return ThriftIcons.EXCEPTION; } if (element instanceof ThriftService) { return ThriftIcons.SERVICE; } if (element instanceof ThriftStruct) { return ThriftIcons.STRUCT; } if (element instanceof ThriftTypedef) { return ThriftIcons.TYPEDEF; } if (element instanceof ThriftUnion) { return ThriftIcons.UNION; } if (element instanceof ThriftField) { return AllIcons.Nodes.Field; } if (element instanceof ThriftFunction) { return AllIcons.Nodes.Method; } return null; }
Example 7
Source File: VfsIconUtil.java From consulo with Apache License 2.0 | 5 votes |
@Nullable public static Image getIcon(@Nonnull final VirtualFile file, @Iconable.IconFlags final int flags, @Nullable final Project project) { Image icon = Iconable.LastComputedIcon.get(file, flags); if (icon == null) { icon = VirtualFilePresentation.getIcon(file); } return IconDeferrer.getInstance().defer(icon, new AnyIconKey<>(file, project, flags), ourVirtualFileIconFunc); }
Example 8
Source File: AbstractPsiBasedNode.java From consulo with Apache License 2.0 | 5 votes |
@Iconable.IconFlags protected int getIconableFlags() { int flags = 0; if (isMarkReadOnly()) { flags |= Iconable.ICON_FLAG_READ_STATUS; } return flags; }
Example 9
Source File: IconDescriptorUpdaters.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @RequiredReadAction public static Image getIcon(@Nonnull final PsiElement element, @Iconable.IconFlags final int flags) { if (!element.isValid()) return AllIcons.Nodes.NodePlaceholder; Image baseIcon = Iconable.LastComputedIcon.get(element, flags); if (baseIcon == null) { baseIcon = computeBaseIcon(element, flags); } return IconDeferrer.getInstance().defer(baseIcon, new ElementIconRequest(element, flags), ourIconCompute); }
Example 10
Source File: AbstractMemberSelectionTable.java From consulo with Apache License 2.0 | 4 votes |
protected Icon getMemberIcon(M memberInfo, @Iconable.IconFlags int flags) { return TargetAWT.to(IconDescriptorUpdaters.getIcon(memberInfo.getMember(), flags)); }
Example 11
Source File: MUnitDomFileDescription.java From mule-intellij-plugins with Apache License 2.0 | 4 votes |
@Nullable public Icon getFileIcon(@Iconable.IconFlags int flags) { return MuleIcons.MUnitFileType; }
Example 12
Source File: PsiElementListCellRenderer.java From consulo with Apache License 2.0 | 4 votes |
@Iconable.IconFlags protected abstract int getIconFlags();
Example 13
Source File: IconDescriptorUpdaters.java From consulo with Apache License 2.0 | 4 votes |
public ElementIconRequest(PsiElement element, @Iconable.IconFlags int flags) { myPointer = SmartPointerManager.getInstance(element.getProject()).createSmartPsiElementPointer(element); myFlags = flags; }
Example 14
Source File: FlutterIconProvider.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Nullable public Icon getIcon(@NotNull final PsiElement element, @Iconable.IconFlags final int flags) { final Project project = element.getProject(); if (!FlutterModuleUtils.declaresFlutter(project)) return null; // Directories. if (element instanceof PsiDirectory) { final VirtualFile dir = ((PsiDirectory)element).getVirtualFile(); if (!dir.isInLocalFileSystem()) return null; final PubRootCache pubRootCache = PubRootCache.getInstance(project); // Show an icon for flutter modules. final PubRoot pubRoot = pubRootCache.getRoot(dir); if (pubRoot != null && dir.equals(pubRoot.getRoot()) && pubRoot.declaresFlutter()) { return FlutterIcons.Flutter; } final PubRoot root = pubRootCache.getRoot(dir.getParent()); if (root == null) return null; // TODO(devoncarew): should we just make the folder a source kind? if (dir.equals(root.getLib())) return AllIcons.Modules.SourceRoot; if (Objects.equals(dir, root.getAndroidDir())) return AllIcons.Nodes.KeymapTools; if (Objects.equals(dir, root.getiOsDir())) return AllIcons.Nodes.KeymapTools; if (dir.isDirectory() && dir.getName().equals(".idea")) return AllIcons.Modules.GeneratedFolder; } // Files. if (element instanceof DartFile) { final DartFile dartFile = (DartFile)element; final VirtualFile file = dartFile.getVirtualFile(); if (file == null || !file.isInLocalFileSystem()) return null; // Use a simple naming convention heuristic to identify test files. // TODO(pq): consider pushing up to the Dart Plugin. if (FlutterUtils.isInTestDir(dartFile) && file.getName().endsWith("_test.dart")) { return TEST_FILE; } } return null; }
Example 15
Source File: FlutterIconProvider.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Nullable public Icon getIcon(@NotNull final PsiElement element, @Iconable.IconFlags final int flags) { final Project project = element.getProject(); if (!FlutterModuleUtils.declaresFlutter(project)) return null; // Directories. if (element instanceof PsiDirectory) { final VirtualFile dir = ((PsiDirectory)element).getVirtualFile(); if (!dir.isInLocalFileSystem()) return null; final PubRootCache pubRootCache = PubRootCache.getInstance(project); // Show an icon for flutter modules. final PubRoot pubRoot = pubRootCache.getRoot(dir); if (pubRoot != null && dir.equals(pubRoot.getRoot()) && pubRoot.declaresFlutter()) { return FlutterIcons.Flutter; } final PubRoot root = pubRootCache.getRoot(dir.getParent()); if (root == null) return null; // TODO(devoncarew): should we just make the folder a source kind? if (dir.equals(root.getLib())) return AllIcons.Modules.SourceRoot; if (Objects.equals(dir, root.getAndroidDir())) return AllIcons.Nodes.KeymapTools; if (Objects.equals(dir, root.getiOsDir())) return AllIcons.Nodes.KeymapTools; if (dir.isDirectory() && dir.getName().equals(".idea")) return AllIcons.Modules.GeneratedFolder; } // Files. if (element instanceof DartFile) { final DartFile dartFile = (DartFile)element; final VirtualFile file = dartFile.getVirtualFile(); if (file == null || !file.isInLocalFileSystem()) return null; // Use a simple naming convention heuristic to identify test files. // TODO(pq): consider pushing up to the Dart Plugin. if (FlutterUtils.isInTestDir(dartFile) && file.getName().endsWith("_test.dart")) { return TEST_FILE; } } return null; }
Example 16
Source File: MuleDomFileDescription.java From mule-intellij-plugins with Apache License 2.0 | 4 votes |
@Nullable public Icon getFileIcon(@Iconable.IconFlags int flags) { return MuleIcons.MuleFileType; }
Example 17
Source File: TreeComboBox.java From consulo with Apache License 2.0 | votes |
Icon getIcon(int index, @Iconable.IconFlags int flags);