public static boolean shouldEnableDeleteAction(PsiElement[] elements) { if (elements == null || elements.length == 0) return false; for (PsiElement element : elements) { VirtualFile virtualFile = PsiUtilCore.getVirtualFile(element); if (virtualFile == null) { return false; } if (!WritingAccessProvider.isPotentiallyWritable(virtualFile, element.getProject())) { return false; } } return true; }
@Override public Icon fun(final FileIconKey key) { final VirtualFile file = key.getFile(); final int flags = key.getFlags(); final Project project = key.getProject(); if (!file.isValid() || project != null && (project.isDisposed() || !wasEverInitialized(project))) return null; final Icon providersIcon = getProvidersIcon(file, flags, project); Icon icon = providersIcon == null ? VirtualFilePresentation.getIconImpl(file) : providersIcon; final boolean dumb = project != null && DumbService.getInstance(project).isDumb(); for (FileIconPatcher patcher : getPatchers()) { if (dumb && !DumbService.isDumbAware(patcher)) { continue; } icon = patcher.patchIcon(icon, file, flags, project); } if ((flags & Iconable.ICON_FLAG_READ_STATUS) != 0 && (!file.isWritable() || !WritingAccessProvider.isPotentiallyWritable(file, project))) { icon = new LayeredIcon(icon, PlatformIcons.LOCKED_ICON); } if (file.is(VFileProperty.SYMLINK)) { icon = new LayeredIcon(icon, PlatformIcons.SYMLINK_ICON); } Iconable.LastComputedIcon.put(file, icon, flags); return icon; }