Example #1
0
 public static void refreshSynchronouslyRecursively(VirtualFile file) {
   if (file.is(VFileProperty.SPECIAL) || file.is(VFileProperty.SYMLINK)) {
     return;
   }
   file.refresh(false, false);
   for (VirtualFile child : file.getChildren()) {
     refreshSynchronouslyRecursively(child);
   }
 }
Example #2
0
  @Override
  protected void updateImpl(PresentationData data) {
    PsiFile value = getValue();
    data.setPresentableText(value.getName());
    data.setIcon(value.getIcon(Iconable.ICON_FLAG_READ_STATUS));

    VirtualFile file = getVirtualFile();
    if (file != null && file.is(VFileProperty.SYMLINK)) {
      String target = file.getCanonicalPath();
      if (target == null) {
        data.setAttributesKey(CodeInsightColors.WRONG_REFERENCES_ATTRIBUTES);
        data.setTooltip(CommonBundle.message("vfs.broken.link"));
      } else {
        data.setTooltip(FileUtil.toSystemDependentName(target));
      }
    }
  }
Example #3
0
        @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;
        }