当前位置: 首页>>代码示例>>Java>>正文


Java Iconable.IconFlags方法代码示例

本文整理汇总了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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GroovyFileIconProvider.java

示例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;
}
 
开发者ID:jimkyndemeyer,项目名称:js-graphql-intellij-plugin,代码行数:26,代码来源:JSGraphQLEndpointIconProvider.java

示例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);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:ElementBase.java

示例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;
}
 
开发者ID:polyglot-mark,项目名称:salesforce-plugin,代码行数:24,代码来源:ApexFileIconPatcher.java

示例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;
}
 
开发者ID:SumoLogic,项目名称:epigraph,代码行数:16,代码来源:SchemaFileIconPatcher.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:NativeIconProvider.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:IconUtilEx.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:IconUtil.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ScratchFileServiceImpl.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ElementBase.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ElementBase.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:ElementBase.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:AbstractPsiBasedNode.java

示例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;
}
 
开发者ID:vsch,项目名称:idea-multimarkdown,代码行数:8,代码来源:MultiMarkdownFileIconProvider.java

示例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;
}
 
开发者ID:jumperchen,项目名称:zkidea,代码行数:9,代码来源:ZulIconProvider.java


注:本文中的com.intellij.openapi.util.Iconable.IconFlags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。