本文整理汇总了Java中com.intellij.openapi.util.Iconable.IconFlags方法的典型用法代码示例。如果您正苦于以下问题:Java Iconable.IconFlags方法的具体用法?Java Iconable.IconFlags怎么用?Java Iconable.IconFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.Iconable
的用法示例。
在下文中一共展示了Iconable.IconFlags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIcon
import com.intellij.openapi.util.Iconable; //导入方法依赖的package包/类
@Nullable
@Override
public Icon getIcon(@NotNull VirtualFile virtualFile, @Iconable.IconFlags int flags, @Nullable Project project) {
if (project == null || virtualFile.getFileType() != GroovyFileType.GROOVY_FILE_TYPE) return null;
final PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
if (!(psiFile instanceof GroovyFile)) return null;
final GroovyFile file = (GroovyFile)psiFile;
final Icon icon;
if (file.isScript()) {
icon = GroovyScriptTypeDetector.getIcon(file);
}
else if (GrFileIndexUtil.isGroovySourceFile(file)) {
final GrTypeDefinition[] typeDefinitions = file.getTypeDefinitions();
icon = typeDefinitions.length > 0
? typeDefinitions[0].getIcon(flags)
: JetgroovyIcons.Groovy.Groovy_16x16;
}
else {
icon = JetgroovyIcons.Groovy.Groovy_outsideSources;
}
return ElementBase.createLayeredIcon(psiFile, icon, ElementBase.transformFlags(psiFile, flags));
}
示例2: getIcon
import com.intellij.openapi.util.Iconable; //导入方法依赖的package包/类
@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;
}
示例3: computeIcon
import com.intellij.openapi.util.Iconable; //导入方法依赖的package包/类
@Nullable
private Icon computeIcon(@Iconable.IconFlags int flags) {
PsiElement psiElement = (PsiElement)this;
if (!psiElement.isValid()) return null;
if (Registry.is("psi.deferIconLoading")) {
Icon baseIcon = LastComputedIcon.get(psiElement, flags);
if (baseIcon == null) {
TIntObjectHashMap<Icon> cache = getUserData(BASE_ICONS);
if (cache == null) {
cache = putUserDataIfAbsent(BASE_ICONS, new TIntObjectHashMap<Icon>());
}
synchronized (cache) {
if (!cache.containsKey(flags)) {
cache.put(flags, computeBaseIcon(flags));
}
baseIcon = cache.get(flags);
}
}
return IconDeferrer.getInstance().defer(baseIcon, new ElementIconRequest(psiElement, flags), ICON_COMPUTE);
}
return computeIconNow(psiElement, flags);
}
示例4: patchIcon
import com.intellij.openapi.util.Iconable; //导入方法依赖的package包/类
@Override
public Icon patchIcon(Icon baseIcon, VirtualFile file, @Iconable.IconFlags int flags, @Nullable Project project) {
if (project == null) return baseIcon;
Icon result = baseIcon;
PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
if (psiFile instanceof ApexClassFile) {
ApexClassFile apexClassFile = (ApexClassFile)psiFile;
if (apexClassFile.isException()) {
result = getIconWithVisibility(ApexIcons.EXCEPTION, apexClassFile, flags);
} else if (apexClassFile.isInterface()) {
result = getIconWithVisibility(ApexIcons.INTERFACE, apexClassFile, flags);
} else if (apexClassFile.isClass()) {
result = getIconWithVisibility(ApexIcons.CLASS, apexClassFile, flags);
} else if (apexClassFile.isEnum()) {
result = getIconWithVisibility(ApexIcons.ENUM, apexClassFile, flags);
} else if (apexClassFile.isTrigger()) {
// Triggers do not have any visibility
result = ApexTriggerFileType.INSTANCE.getIcon();
}
}
return result;
}
示例5: patchIcon
import com.intellij.openapi.util.Iconable; //导入方法依赖的package包/类
@Override
public Icon patchIcon(Icon baseIcon, VirtualFile file, @Iconable.IconFlags int flags, @Nullable Project project) {
if (project == null) {
return baseIcon;
}
Icon icon = replaceIcon(file, flags, project, baseIcon);
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
if (fileIndex.isInSource(file) && CompilerManager.getInstance(project).isExcludedFromCompilation(file)) {
return new LayeredIcon(icon, PlatformIcons.EXCLUDED_FROM_COMPILE_ICON);
}
return icon;
}
示例6: getIcon
import com.intellij.openapi.util.Iconable; //导入方法依赖的package包/类
@Nullable
@Override
public Icon getIcon(@NotNull PsiElement element, @Iconable.IconFlags int flags) {
if (element instanceof PsiFileSystemItem) {
VirtualFile file = ((PsiFileSystemItem)element).getVirtualFile();
if (file != null) return doGetIcon(file, flags);
}
return null;
}
示例7: getIcon
import com.intellij.openapi.util.Iconable; //导入方法依赖的package包/类
public static Icon getIcon(Object object, @Iconable.IconFlags int flags, Project project) {
if (object instanceof PsiElement) {
return ((PsiElement)object).getIcon(flags);
}
if (object instanceof Module) {
return ModuleType.get((Module)object).getIcon();
}
if (object instanceof VirtualFile) {
VirtualFile file = (VirtualFile)object;
return IconUtil.getIcon(file, flags, project);
}
return ElementPresentationManager.getIcon(object);
}
示例8: getProvidersIcon
import com.intellij.openapi.util.Iconable; //导入方法依赖的package包/类
@Nullable
private static Icon getProvidersIcon(@NotNull VirtualFile file, @Iconable.IconFlags int flags, Project project) {
for (FileIconProvider provider : getProviders()) {
final Icon icon = provider.getIcon(file, flags, project);
if (icon != null) return icon;
}
return null;
}
示例9: getIcon
import com.intellij.openapi.util.Iconable; //导入方法依赖的package包/类
@Nullable
@Override
public Icon getIcon(@NotNull VirtualFile file, @Iconable.IconFlags int flags, @Nullable Project project) {
if (project == null || file.isDirectory()) return null;
RootType rootType = ScratchFileService.getInstance().getRootType(file);
if (rootType == null) return null;
return rootType.substituteIcon(project, file);
}
示例10: computeIcon
import com.intellij.openapi.util.Iconable; //导入方法依赖的package包/类
@Nullable
private Icon computeIcon(@Iconable.IconFlags int flags) {
PsiElement psiElement = (PsiElement)this;
if (!psiElement.isValid()) return null;
if (Registry.is("psi.deferIconLoading")) {
Icon baseIcon = LastComputedIcon.get(psiElement, flags);
if (baseIcon == null) {
baseIcon = computeBaseIcon(flags);
}
return IconDeferrer.getInstance().defer(baseIcon, new ElementIconRequest(psiElement, flags), ICON_COMPUTE);
}
return computeIconNow(psiElement, flags);
}
示例11: computeIconNow
import com.intellij.openapi.util.Iconable; //导入方法依赖的package包/类
@Nullable
private static Icon computeIconNow(@NotNull PsiElement element, @Iconable.IconFlags int flags) {
final Icon providersIcon = PsiIconUtil.getProvidersIcon(element, flags);
if (providersIcon != null) {
return providersIcon instanceof RowIcon ? (RowIcon)providersIcon : createLayeredIcon(element, providersIcon, flags);
}
return ((ElementBase)element).getElementIcon(flags);
}
示例12: getElementIcon
import com.intellij.openapi.util.Iconable; //导入方法依赖的package包/类
@Nullable
protected Icon getElementIcon(@Iconable.IconFlags int flags) {
final PsiElement element = (PsiElement)this;
if (!element.isValid()) return null;
RowIcon baseIcon;
final boolean isLocked = (flags & ICON_FLAG_READ_STATUS) != 0 && !element.isWritable();
int elementFlags = isLocked ? FLAGS_LOCKED : 0;
if (element instanceof ItemPresentation && ((ItemPresentation)element).getIcon(false) != null) {
baseIcon = createLayeredIcon(this, ((ItemPresentation)element).getIcon(false), elementFlags);
}
else if (element instanceof PsiFile) {
PsiFile file = (PsiFile)element;
VirtualFile virtualFile = file.getVirtualFile();
final Icon fileTypeIcon;
if (virtualFile == null) {
fileTypeIcon = file.getFileType().getIcon();
}
else {
fileTypeIcon = IconUtil.getIcon(virtualFile, flags & ~ICON_FLAG_READ_STATUS, file.getProject());
}
return createLayeredIcon(this, fileTypeIcon, elementFlags);
}
else {
return null;
}
return baseIcon;
}
示例13: getIconableFlags
import com.intellij.openapi.util.Iconable; //导入方法依赖的package包/类
@Iconable.IconFlags
protected int getIconableFlags() {
int flags = Iconable.ICON_FLAG_VISIBILITY;
if (isMarkReadOnly()) {
flags |= Iconable.ICON_FLAG_READ_STATUS;
}
return flags;
}
示例14: getIcon
import com.intellij.openapi.util.Iconable; //导入方法依赖的package包/类
@Nullable @Override
public Icon getIcon(@NotNull VirtualFile file, @Iconable.IconFlags int flags, @Nullable Project project) {
if (MultiMarkdownPreviewEditorProvider.accept(file)) {
return (new FileRef(file.getPath()).isWikiPage() ? MultiMarkdownIcons.WIKI : MultiMarkdownIcons.FILE);
}
return null;
}
示例15: getIcon
import com.intellij.openapi.util.Iconable; //导入方法依赖的package包/类
@Nullable
@Override
public Icon getIcon(@NotNull VirtualFile file, @Iconable.IconFlags int flags, @Nullable Project project) {
if(project == null) return null;
if (ZulFileType.EXTENSION.equalsIgnoreCase(file.getExtension()))
return ZulIcons.FILE;
return null;
}