本文整理汇总了Java中consulo.ide.IconDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java IconDescriptor类的具体用法?Java IconDescriptor怎么用?Java IconDescriptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IconDescriptor类属于consulo.ide包,在下文中一共展示了IconDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateIcon
import consulo.ide.IconDescriptor; //导入依赖的package包/类
@Override
public void updateIcon(@NotNull IconDescriptor iconDescriptor, @NotNull PsiElement element, int flags)
{
if(element instanceof HaxeFile)
{
iconDescriptor.setMainIcon(getHaxeFileIcon((HaxeFile) element, flags));
}
else
{
HaxeComponentType haxeComponentType = HaxeComponentType.typeOf(element);
if(haxeComponentType != null)
{
iconDescriptor.setMainIcon(haxeComponentType.getIcon());
}
}
}
示例2: updateIcon
import consulo.ide.IconDescriptor; //导入依赖的package包/类
@RequiredReadAction
@Override
public void updateIcon(@NotNull IconDescriptor iconDescriptor, @NotNull PsiElement element, int flags)
{
if(element instanceof DotNetTypeDeclaration)
{
if(DotNetTestFrameworks.isTestType((DotNetTypeDeclaration) element))
{
iconDescriptor.addLayerIcon(AllIcons.RunConfigurations.TestMark);
}
}
else if(element instanceof DotNetLikeMethodDeclaration)
{
if(DotNetTestFrameworks.isTestMethod((DotNetLikeMethodDeclaration) element))
{
iconDescriptor.addLayerIcon(AllIcons.RunConfigurations.TestMark);
}
}
}
示例3: getIcon
import consulo.ide.IconDescriptor; //导入依赖的package包/类
@Nonnull
@SuppressWarnings("unchecked")
public Icon getIcon(@Nonnull Map<Key, Object> map) {
if(map.isEmpty()) {
return getIcon();
}
IconDescriptor iconDescriptor = new IconDescriptor(getIcon());
for (ContentFolderPropertyProvider propertyProvider : ContentFolderPropertyProvider.EP_NAME.getExtensions()) {
Object value = propertyProvider.getKey().get(map);
if(value == null) {
continue;
}
Icon layerIcon = propertyProvider.getLayerIcon(value);
if(layerIcon == null) {
continue;
}
iconDescriptor.addLayerIcon(layerIcon);
}
return iconDescriptor.toIcon();
}
示例4: updateIcon
import consulo.ide.IconDescriptor; //导入依赖的package包/类
@RequiredReadAction
@Override
public void updateIcon(@Nonnull IconDescriptor iconDescriptor, @Nonnull PsiElement element, int flags) {
if (element instanceof PsiFile) {
if (iconDescriptor.getMainIcon() == null) {
FileType fileType = ((PsiFile)element).getFileType();
iconDescriptor.setMainIcon(fileType.getIcon());
}
VirtualFile virtualFile = ((PsiFile)element).getVirtualFile();
if (virtualFile != null && virtualFile.is(VFileProperty.SYMLINK)) {
iconDescriptor.addLayerIcon(AllIcons.Nodes.Symlink);
}
}
else {
Icon languageElementIcon = LanguageElementIcons.INSTANCE.forLanguage(element.getLanguage());
if (languageElementIcon == null) {
return;
}
iconDescriptor.addLayerIcon(languageElementIcon);
}
}
示例5: updateIcon
import consulo.ide.IconDescriptor; //导入依赖的package包/类
@Override
public void updateIcon(@NotNull IconDescriptor iconDescriptor, @NotNull PsiElement element, int flags) {
if (element instanceof XmlFile) {
final VirtualFile vf = ((XmlFile)element).getVirtualFile();
if (vf != null) {
final String extension = vf.getExtension();
if (XSD_FILE_EXTENSION.equals(extension)) {
iconDescriptor.setMainIcon(AllIcons.FileTypes.XsdFile);
}
if (WSDL_FILE_EXTENSION.equals(extension)) {
iconDescriptor.setMainIcon(AllIcons.FileTypes.WsdlFile);
}
}
}
}
示例6: updateIcon
import consulo.ide.IconDescriptor; //导入依赖的package包/类
@RequiredReadAction
@Override
public void updateIcon(@NotNull IconDescriptor iconDescriptor, @NotNull PsiElement element, int flags)
{
for(TestFramework framework : TestFramework.EXTENSION_NAME.getExtensions())
{
if(framework.isIgnoredMethod(element))
{
iconDescriptor.setMainIcon(AllIcons.RunConfigurations.IgnoredTest);
}
if(framework.isTestMethod(element) || framework.isTestClass(element))
{
iconDescriptor.addLayerIcon(AllIcons.RunConfigurations.TestMark);
}
}
}
示例7: processedFile
import consulo.ide.IconDescriptor; //导入依赖的package包/类
private static boolean processedFile(PsiElement element, IconDescriptor iconDescriptor)
{
final PsiFile containingFile = element.getContainingFile();
if(containingFile == null)
{
return false;
}
final FileType fileType = containingFile.getFileType();
if(fileType != JavaFileType.INSTANCE && fileType != JavaClassFileType.INSTANCE)
{
return false;
}
final VirtualFile virtualFile = containingFile.getVirtualFile();
if(virtualFile == null)
{
return false;
}
if(!JavaProjectRootsUtil.isJavaSourceFile(element.getProject(), virtualFile, true))
{
iconDescriptor.setMainIcon(JavaIcons.FileTypes.JavaOutsideSource);
return true;
}
return false;
}
示例8: processElementsWithName
import consulo.ide.IconDescriptor; //导入依赖的package包/类
@Override
public void processElementsWithName(@NotNull String name, @NotNull final Processor<NavigationItem> processor, @NotNull FindSymbolParameters parameters)
{
StubIndex.getInstance().processElements(UnityScriptIndexKeys.FILE_BY_NAME_INDEX, name, parameters.getProject(), parameters.getSearchScope(), parameters.getIdFilter(), JSFile.class,
new Processor<JSFile>()
{
@Override
public boolean process(final JSFile file)
{
return processor.process(new FakePsiElement()
{
@Override
public String getName()
{
return FileUtil.getNameWithoutExtension(file.getName());
}
@Nullable
@Override
public Icon getIcon(boolean open)
{
IconDescriptor descriptor = new IconDescriptor(AllIcons.Nodes.Class);
descriptor.addLayerIcon(Unity3dIcons.Js);
descriptor.setRightIcon(AllIcons.Nodes.C_public);
return descriptor.toIcon();
}
@Override
public PsiElement getParent()
{
return file;
}
});
}
});
}
示例9: updateIcon
import consulo.ide.IconDescriptor; //导入依赖的package包/类
@Override
@RequiredReadAction
public void updateIcon(@NotNull IconDescriptor iconDescriptor, @NotNull PsiElement element, int flags)
{
if(element instanceof JSFile)
{
Unity3dScriptModuleExtension moduleExtension = ModuleUtilCore.getExtension(element, Unity3dScriptModuleExtension.class);
if(moduleExtension == null)
{
return;
}
iconDescriptor.setMainIcon(AllIcons.Nodes.Class);
iconDescriptor.addLayerIcon(Unity3dIcons.Js);
if(BitUtil.isSet(flags, Iconable.ICON_FLAG_VISIBILITY))
{
iconDescriptor.setRightIcon(AllIcons.Nodes.C_public);
}
}
else if(element instanceof CSharpLightTypeDeclarationBuilder)
{
if(element.getUserData(UnityScriptToNativeElementTransformer.JS_MARKER) == Boolean.TRUE)
{
PsiElement navigationElement = element.getNavigationElement();
assert navigationElement != null;
updateIcon(iconDescriptor, navigationElement, flags);
}
}
}
示例10: updateIcon
import consulo.ide.IconDescriptor; //导入依赖的package包/类
@RequiredReadAction
@Override
public void updateIcon(@NotNull IconDescriptor iconDescriptor, @NotNull PsiElement element, int i)
{
if(element instanceof IkvmJavaClassAsDotNetTypeElement)
{
IconDescriptorUpdaters.processExistingDescriptor(iconDescriptor, ((IkvmJavaClassAsDotNetTypeElement) element).getPsiClass(), i);
}
}
示例11: buildDialog
import consulo.ide.IconDescriptor; //导入依赖的package包/类
@Override
@RequiredDispatchThread
protected void buildDialog(Project project, PsiDirectory psiDirectory, CreateFileFromTemplateDialog.Builder builder)
{
Set<String> used = new HashSet<>();
addKind(builder, used, "Class", new IconDescriptor(AllIcons.Nodes.Class).toIcon(), "CSharpClass");
addKind(builder, used, "Interface", new IconDescriptor(AllIcons.Nodes.Interface).toIcon(), "CSharpInterface");
addKind(builder, used, "Enum", new IconDescriptor(AllIcons.Nodes.Enum).toIcon(), "CSharpEnum");
addKind(builder, used, "Struct", new IconDescriptor(AllIcons.Nodes.Struct).toIcon(), "CSharpStruct");
addKind(builder, used, "Attribute", new IconDescriptor(AllIcons.Nodes.Attribute).toIcon(), "CSharpAttribute");
if(isCreationOfAssemblyFileAvailable(psiDirectory))
{
addKind(builder, used, "Assembly File", AllIcons.FileTypes.Config, "CSharpAssemblyFile");
}
addKind(builder, used, "Empty File", CSharpFileType.INSTANCE.getIcon(), "CSharpFile");
final CSharpCreateFromTemplateHandler handler = CSharpCreateFromTemplateHandler.getInstance();
for(FileTemplate template : FileTemplateManager.getInstance(project).getAllTemplates())
{
if(handler.handlesTemplate(template))
{
String name = template.getName().replaceFirst("CSharp", "");
if(!used.add(name))
{
name = template.getName();
}
addKind(builder, used, name, CSharpFileType.INSTANCE.getIcon(), template.getName());
}
}
builder.setTitle("Create New File");
}
示例12: getTemplateIcon
import consulo.ide.IconDescriptor; //导入依赖的package包/类
@NotNull
public static Icon getTemplateIcon(String name) {
name = getTemplateShortName(name);
if ("Class".equals(name)) {
return new IconDescriptor(AllIcons.Nodes.Class).addLayerIcon(HaxeIcons.HaxeLang).toIcon();
}
else if ("Interface".equals(name)) {
return new IconDescriptor(AllIcons.Nodes.Interface).addLayerIcon(HaxeIcons.HaxeLang).toIcon();
}
else if ("Enum".equals(name)) {
return new IconDescriptor(AllIcons.Nodes.Enum).addLayerIcon(HaxeIcons.HaxeLang).toIcon();
}
return icons.HaxeIcons.Haxe;
}
示例13: updateIcon
import consulo.ide.IconDescriptor; //导入依赖的package包/类
@Override
public void updateIcon(@NotNull IconDescriptor iconDescriptor, @NotNull PsiElement element, int i)
{
if(element instanceof ThriftConst)
{
iconDescriptor.setMainIcon(AllIcons.Nodes.Value);
}
if(element instanceof ThriftEnum)
{
iconDescriptor.setMainIcon(AllIcons.Nodes.Enum);
}
if(element instanceof ThriftException)
{
iconDescriptor.setMainIcon(AllIcons.Nodes.ExceptionClass);
}
if(element instanceof ThriftService)
{
iconDescriptor.setMainIcon(AllIcons.Nodes.Static);
}
if(element instanceof ThriftStruct)
{
iconDescriptor.setMainIcon(AllIcons.Nodes.Struct);
}
if(element instanceof ThriftTypedef)
{
iconDescriptor.setMainIcon(AllIcons.Nodes.TypeAlias);
}
if(element instanceof ThriftUnion)
{
iconDescriptor.setMainIcon(AllIcons.Nodes.AnonymousClass);
}
if(element instanceof ThriftField)
{
iconDescriptor.setMainIcon(AllIcons.Nodes.Field);
}
if(element instanceof ThriftFunction)
{
iconDescriptor.setMainIcon(AllIcons.Nodes.Function);
}
}
示例14: processModifierListOwner
import consulo.ide.IconDescriptor; //导入依赖的package包/类
@RequiredReadAction
private static void processModifierListOwner(PsiElement element, IconDescriptor iconDescriptor, int flags)
{
DotNetModifierListOwner owner = (DotNetModifierListOwner) element;
if(BitUtil.isSet(flags, Iconable.ICON_FLAG_VISIBILITY))
{
if(owner.hasModifier(MsilTokens.PRIVATE_KEYWORD))
{
iconDescriptor.setRightIcon(AllIcons.Nodes.C_private);
}
else if(owner.hasModifier(MsilTokens.PUBLIC_KEYWORD))
{
iconDescriptor.setRightIcon(AllIcons.Nodes.C_public);
}
else if(owner.hasModifier(MsilTokens.PROTECTED_KEYWORD))
{
iconDescriptor.setRightIcon(AllIcons.Nodes.C_protected);
}
else
{
iconDescriptor.setRightIcon(AllIcons.Nodes.C_plocal);
}
}
if(owner.hasModifier(MsilTokens.SEALED_KEYWORD))
{
iconDescriptor.addLayerIcon(AllIcons.Nodes.FinalMark);
}
}
示例15: fun
import consulo.ide.IconDescriptor; //导入依赖的package包/类
@Override
@RequiredReadAction
public Icon fun(final AnyIconKey<VirtualFile> key) {
final VirtualFile file = key.getObject();
final int flags = key.getFlags();
Project project = key.getProject();
if (!file.isValid() || project != null && (project.isDisposed() || !wasEverInitialized(project))) return null;
boolean processedDescriptors = false;
// disable on webservice native icon
IconDescriptor iconDescriptor = new IconDescriptor(VirtualFilePresentation.getIcon(file));
if (project != null) {
PsiManager manager = PsiManager.getInstance(project);
final PsiElement element = file.isDirectory() ? manager.findDirectory(file) : manager.findFile(file);
if (element != null) {
IconDescriptorUpdaters.processExistingDescriptor(iconDescriptor, element, flags);
processedDescriptors = true;
}
}
// if descriptors not processed - we need add layer icon obviously
if (!processedDescriptors && file.is(VFileProperty.SYMLINK)) {
iconDescriptor.addLayerIcon(AllIcons.Nodes.Symlink);
}
if (BitUtil.isSet(flags, Iconable.ICON_FLAG_READ_STATUS)) {
final boolean isLocked = !file.isWritable() || !WritingAccessProvider.isPotentiallyWritable(file, project);
if (isLocked) {
iconDescriptor.addLayerIcon(AllIcons.Nodes.Locked);
}
}
Icon icon = iconDescriptor.toIcon();
Iconable.LastComputedIcon.put(file, icon, flags);
return icon;
}