Java Code Examples for com.intellij.openapi.util.io.UniqueNameBuilder

The following are top voted examples for showing how to use com.intellij.openapi.util.io.UniqueNameBuilder. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: tools-idea   File: UniqueVFilePathBuilderImpl.java   View source code 6 votes vote down vote up
@NotNull
@Override
public String getUniqueVirtualFilePath(Project project, VirtualFile file) {
  final Collection<VirtualFile> filesWithSameName = FilenameIndex.getVirtualFilesByName(project, file.getName(),
                                                                                        ProjectScope.getProjectScope(project));
  if (filesWithSameName.size() > 1 && filesWithSameName.contains(file)) {
    String path = project.getBasePath();
    path = path == null ? "" : FileUtil.toSystemIndependentName(path);
    UniqueNameBuilder<VirtualFile> builder = new UniqueNameBuilder<VirtualFile>(path, File.separator, 25);
    for (VirtualFile virtualFile: filesWithSameName) {
      builder.addPath(virtualFile, virtualFile.getPath());
    }
    return builder.getShortPath(file);
  }
  return file.getName();
}
 
Example 2
Project: intellij-ce-playground   File: RecentProjectPanel.java   View source code 5 votes vote down vote up
protected RecentProjectItemRenderer(UniqueNameBuilder<ReopenProjectAction> pathShortener) {
  super(new VerticalFlowLayout());
  myShortener = pathShortener;
  myPath.setFont(JBUI.Fonts.label(SystemInfo.isMac ? 10f : 11f));
  setFocusable(true);
  layoutComponents();
}
 
Example 3
Project: intellij-ce-playground   File: UniqueNameBuilderTest.java   View source code 5 votes vote down vote up
public void testRoot() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("/Users/yole/idea", "/", 100);
  builder.addPath("A", "/Users/yole/idea/build/scripts/layouts.gant");
  builder.addPath("B", "/Users/yole/idea/community/build/scripts/layouts.gant");
  assertEquals("build/\u2026/layouts.gant", builder.getShortPath("A"));
  assertEquals("community/\u2026/layouts.gant", builder.getShortPath("B"));

  builder = new UniqueNameBuilder<String>("", "/", 100);
  builder.addPath("A", "build/scripts/layouts.gant");
  builder.addPath("B", "community/build/scripts/layouts.gant");
  assertEquals("build/\u2026/layouts.gant", builder.getShortPath("A"));
  assertEquals("community/\u2026/layouts.gant", builder.getShortPath("B"));
}
 
Example 4
Project: intellij-ce-playground   File: UniqueNameBuilderTest.java   View source code 5 votes vote down vote up
public void testShortenNames() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("/Users/yole/idea", "/", 25);
  builder.addPath("A", "/Users/yole/idea/build/scripts/layouts.gant");
  builder.addPath("B", "/Users/yole/idea/community/build/scripts/layouts.gant");
  assertEquals("build/\u2026/layouts.gant", builder.getShortPath("A"));
  assertEquals("community/\u2026/layouts.gant", builder.getShortPath("B"));
}
 
Example 5
Project: intellij-ce-playground   File: UniqueNameBuilderTest.java   View source code 5 votes vote down vote up
public void testShortenNamesUnique() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("/Users/yole/idea", "/", 25);
  builder.addPath("A", "/Users/yole/idea/pycharm/download/index.html");
  builder.addPath("B", "/Users/yole/idea/pycharm/documentation/index.html");
  builder.addPath("C", "/Users/yole/idea/fabrique/download/index.html");
  assertEquals("pycharm/\u2026/index.html", builder.getShortPath("A"));
}
 
Example 6
Project: intellij-ce-playground   File: UniqueNameBuilderTest.java   View source code 5 votes vote down vote up
public void testShortenNamesUnique2() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("/Users/yole/idea", "/", 25);
  builder.addPath("A", "source/components/views/something/tmpl/default.php");
  builder.addPath("B", "source/components/views/something_else/tmpl/default.php");
  assertEquals("something/\u2026/default.php", builder.getShortPath("A"));
  assertEquals("something_else/\u2026/default.php", builder.getShortPath("B"));
}
 
Example 7
Project: intellij-ce-playground   File: UniqueNameBuilderTest.java   View source code 5 votes vote down vote up
public void testFilesWithoutExtensions() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("", "/", 25);
  builder.addPath("A", "foo/.htaccess");
  builder.addPath("B", "bar/.htaccess");
  assertEquals("foo/.htaccess", UniqueVFilePathBuilderImpl.getEditorTabText("A", builder, false));
  assertEquals("foo/.htaccess", UniqueVFilePathBuilderImpl.getEditorTabText("A", builder, true));

}
 
Example 8
Project: intellij-ce-playground   File: UniqueVFilePathBuilderImpl.java   View source code 5 votes vote down vote up
@Nullable
private static UniqueNameBuilder<VirtualFile> filesWithTheSameName(String fileName, Project project,
                                                            boolean skipNonOpenedFiles,
                                                            GlobalSearchScope scope) {
  Collection<VirtualFile> filesWithSameName = skipNonOpenedFiles ? Collections.<VirtualFile>emptySet() :
                                              FilenameIndex.getVirtualFilesByName(project, fileName,
                                                                                  scope);
  THashSet<VirtualFile> setOfFilesWithTheSameName = new THashSet<VirtualFile>(filesWithSameName);
  // add open files out of project scope
  for(VirtualFile openFile: FileEditorManager.getInstance(project).getOpenFiles()) {
    if (openFile.getName().equals(fileName)) {
      setOfFilesWithTheSameName.add(openFile);
    }
  }
  for (VirtualFile recentlyEditedFile : EditorHistoryManager.getInstance(project).getFiles()) {
    if (recentlyEditedFile.getName().equals(fileName)) {
      setOfFilesWithTheSameName.add(recentlyEditedFile);
    }
  }

  filesWithSameName = setOfFilesWithTheSameName;

  if (filesWithSameName.size() > 1) {
    String path = project.getBasePath();
    path = path == null ? "" : FileUtil.toSystemIndependentName(path);
    UniqueNameBuilder<VirtualFile> builder = new UniqueNameBuilder<VirtualFile>(path, File.separator, 25);
    for (VirtualFile virtualFile: filesWithSameName) {
      builder.addPath(virtualFile, virtualFile.getPath());
    }
    return builder;
  }
  return null;
}
 
Example 9
Project: intellij-ce-playground   File: UniqueVFilePathBuilderImpl.java   View source code 5 votes vote down vote up
public static <T> String getEditorTabText(T key, UniqueNameBuilder<T> builder, boolean hideKnownExtensionInTabs) {
  String result = builder.getShortPath(key);
  if (hideKnownExtensionInTabs) {
    String withoutExtension = FileUtil.getNameWithoutExtension(result);
    if (StringUtil.isNotEmpty(withoutExtension) && !withoutExtension.endsWith(builder.getSeparator())) {
      return withoutExtension;
    }
  }
  return result;
}
 
Example 10
Project: tools-idea   File: UniqueNameBuilderTest.java   View source code 5 votes vote down vote up
public void testRoot() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("/Users/yole/idea", "/", 100);
  builder.addPath("A", "/Users/yole/idea/build/scripts/layouts.gant");
  builder.addPath("B", "/Users/yole/idea/community/build/scripts/layouts.gant");
  assertEquals("build/\u2026/layouts.gant", builder.getShortPath("A"));
  assertEquals("community/\u2026/layouts.gant", builder.getShortPath("B"));

  builder = new UniqueNameBuilder<String>("", "/", 100);
  builder.addPath("A", "build/scripts/layouts.gant");
  builder.addPath("B", "community/build/scripts/layouts.gant");
  assertEquals("build/\u2026/layouts.gant", builder.getShortPath("A"));
  assertEquals("community/\u2026/layouts.gant", builder.getShortPath("B"));
}
 
Example 11
Project: tools-idea   File: UniqueNameBuilderTest.java   View source code 5 votes vote down vote up
public void testShortenNames() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("/Users/yole/idea", "/", 25);
  builder.addPath("A", "/Users/yole/idea/build/scripts/layouts.gant");
  builder.addPath("B", "/Users/yole/idea/community/build/scripts/layouts.gant");
  assertEquals("build/\u2026/layouts.gant", builder.getShortPath("A"));
  assertEquals("community/\u2026/layouts.gant", builder.getShortPath("B"));
}
 
Example 12
Project: tools-idea   File: UniqueNameBuilderTest.java   View source code 5 votes vote down vote up
public void testShortenNamesUnique() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("/Users/yole/idea", "/", 25);
  builder.addPath("A", "/Users/yole/idea/pycharm/download/index.html");
  builder.addPath("B", "/Users/yole/idea/pycharm/documentation/index.html");
  builder.addPath("C", "/Users/yole/idea/fabrique/download/index.html");
  assertEquals("pycharm/\u2026/index.html", builder.getShortPath("A"));
}
 
Example 13
Project: tools-idea   File: UniqueNameBuilderTest.java   View source code 5 votes vote down vote up
public void testShortenNamesUnique2() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("/Users/yole/idea", "/", 25);
  builder.addPath("A", "source/components/views/something/tmpl/default.php");
  builder.addPath("B", "source/components/views/something_else/tmpl/default.php");
  assertEquals("something/\u2026/default.php", builder.getShortPath("A"));
  assertEquals("something_else/\u2026/default.php", builder.getShortPath("B"));
}
 
Example 14
Project: consulo   File: UniqueNameBuilderTest.java   View source code 5 votes vote down vote up
public void testRoot() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("/Users/yole/idea", "/", 100);
  builder.addPath("A", "/Users/yole/idea/build/scripts/layouts.gant");
  builder.addPath("B", "/Users/yole/idea/community/build/scripts/layouts.gant");
  assertEquals("build/\u2026/layouts.gant", builder.getShortPath("A"));
  assertEquals("community/\u2026/layouts.gant", builder.getShortPath("B"));

  builder = new UniqueNameBuilder<String>("", "/", 100);
  builder.addPath("A", "build/scripts/layouts.gant");
  builder.addPath("B", "community/build/scripts/layouts.gant");
  assertEquals("build/\u2026/layouts.gant", builder.getShortPath("A"));
  assertEquals("community/\u2026/layouts.gant", builder.getShortPath("B"));
}
 
Example 15
Project: consulo   File: UniqueNameBuilderTest.java   View source code 5 votes vote down vote up
public void testShortenNames() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("/Users/yole/idea", "/", 25);
  builder.addPath("A", "/Users/yole/idea/build/scripts/layouts.gant");
  builder.addPath("B", "/Users/yole/idea/community/build/scripts/layouts.gant");
  assertEquals("build/\u2026/layouts.gant", builder.getShortPath("A"));
  assertEquals("community/\u2026/layouts.gant", builder.getShortPath("B"));
}
 
Example 16
Project: consulo   File: UniqueNameBuilderTest.java   View source code 5 votes vote down vote up
public void testShortenNamesUnique() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("/Users/yole/idea", "/", 25);
  builder.addPath("A", "/Users/yole/idea/pycharm/download/index.html");
  builder.addPath("B", "/Users/yole/idea/pycharm/documentation/index.html");
  builder.addPath("C", "/Users/yole/idea/fabrique/download/index.html");
  assertEquals("pycharm/\u2026/index.html", builder.getShortPath("A"));
}
 
Example 17
Project: consulo   File: UniqueNameBuilderTest.java   View source code 5 votes vote down vote up
public void testShortenNamesUnique2() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("/Users/yole/idea", "/", 25);
  builder.addPath("A", "source/components/views/something/tmpl/default.php");
  builder.addPath("B", "source/components/views/something_else/tmpl/default.php");
  assertEquals("something/\u2026/default.php", builder.getShortPath("A"));
  assertEquals("something_else/\u2026/default.php", builder.getShortPath("B"));
}
 
Example 18
Project: consulo   File: RecentProjectPanel.java   View source code 5 votes vote down vote up
protected RecentProjectItemRenderer(UniqueNameBuilder<ReopenProjectAction> pathShortener) {
  super(new VerticalFlowLayout());
  myShortener = pathShortener;
  myPath.setFont(JBUI.Fonts.label(SystemInfo.isMac ? 10f : 11f));
  setFocusable(true);
  layoutComponents();
}
 
Example 19
Project: consulo   File: UniqueVFilePathBuilderImpl.java   View source code 5 votes vote down vote up
@Nullable
private static UniqueNameBuilder<VirtualFile> filesWithTheSameName(String fileName, Project project,
                                                                   boolean skipNonOpenedFiles,
                                                                   GlobalSearchScope scope) {
  Collection<VirtualFile> filesWithSameName = skipNonOpenedFiles ? Collections.emptySet() :
                                              FilenameIndex.getVirtualFilesByName(project, fileName,
                                                                                  scope);
  THashSet<VirtualFile> setOfFilesWithTheSameName = new THashSet<>(filesWithSameName);
  // add open files out of project scope
  for(VirtualFile openFile: FileEditorManager.getInstance(project).getOpenFiles()) {
    if (openFile.getName().equals(fileName)) {
      setOfFilesWithTheSameName.add(openFile);
    }
  }
  if (!skipNonOpenedFiles) {
    for (VirtualFile recentlyEditedFile : EditorHistoryManager.getInstance(project).getFiles()) {
      if (recentlyEditedFile.getName().equals(fileName)) {
        setOfFilesWithTheSameName.add(recentlyEditedFile);
      }
    }
  }

  filesWithSameName = setOfFilesWithTheSameName;

  if (filesWithSameName.size() > 1) {
    String path = project.getBasePath();
    path = path == null ? "" : FileUtil.toSystemIndependentName(path);
    UniqueNameBuilder<VirtualFile> builder = new UniqueNameBuilder<>(path, File.separator, 25);
    for (VirtualFile virtualFile: filesWithSameName) {
      builder.addPath(virtualFile, virtualFile.getPath());
    }
    return builder;
  }
  return null;
}
 
Example 20
Project: intellij-ce-playground   File: RecentProjectPanel.java   View source code 4 votes vote down vote up
protected ListCellRenderer createRenderer(UniqueNameBuilder<ReopenProjectAction> pathShortener) {
  return new RecentProjectItemRenderer(pathShortener);
}
 
Example 21
Project: intellij-ce-playground   File: UniqueNameBuilderTest.java   View source code 4 votes vote down vote up
public void testSimple() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("", "/", 100);
  builder.addPath("A", "/Users/yole/idea/foo/bar.java");
  builder.addPath("B", "/Users/yole/idea/baz/bar.java");
  assertEquals("foo/bar.java", builder.getShortPath("A"));
}
 
Example 22
Project: intellij-ce-playground   File: UniqueNameBuilderTest.java   View source code 4 votes vote down vote up
public void testTwoLevel() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("", "/", 100);
  builder.addPath("A", "/Users/yole/idea/foo/buy/index.html");
  builder.addPath("B", "/Users/yole/idea/bar/buy/index.html");
  assertEquals("foo/\u2026/index.html", builder.getShortPath("A"));
}
 
Example 23
Project: intellij-ce-playground   File: UniqueNameBuilderTest.java   View source code 4 votes vote down vote up
public void testSeparator() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("", "\\", 100);
  builder.addPath("A", "/Users/yole/idea/foo/buy/index.html");
  builder.addPath("B", "/Users/yole/idea/bar/buy/index.html");
  assertEquals("foo\\\u2026\\index.html", builder.getShortPath("A"));
}
 
Example 24
Project: intellij-ce-playground   File: UniqueVFilePathBuilderImpl.java   View source code 4 votes vote down vote up
private static String getUniqueVirtualFilePath(final Project project, VirtualFile file, final boolean skipNonOpenedFiles) {
  Key<CachedValue<ConcurrentMap<String, UniqueNameBuilder<VirtualFile>>>> key =
    skipNonOpenedFiles ?  ourShortNameOpenedBuilderCacheKey:ourShortNameBuilderCacheKey;
  CachedValue<ConcurrentMap<String, UniqueNameBuilder<VirtualFile>>> data = project.getUserData(key);
  if (data == null) {
    project.putUserData(key, data = CachedValuesManager.getManager(project).createCachedValue(
      new CachedValueProvider<ConcurrentMap<String, UniqueNameBuilder<VirtualFile>>>() {
        @Nullable
        @Override
        public Result<ConcurrentMap<String, UniqueNameBuilder<VirtualFile>>> compute() {
          return new Result<ConcurrentMap<String, UniqueNameBuilder<VirtualFile>>>(
            ContainerUtil.<String, UniqueNameBuilder<VirtualFile>>createConcurrentSoftValueMap(),
            PsiModificationTracker.MODIFICATION_COUNT,
            //ProjectRootModificationTracker.getInstance(project),
            //VirtualFileManager.VFS_STRUCTURE_MODIFICATIONS,
            FileEditorManagerImpl.OPEN_FILE_SET_MODIFICATION_COUNT
          );
        }
      }, false));
  }

  final ConcurrentMap<String, UniqueNameBuilder<VirtualFile>> valueMap = data.getValue();
  final String fileName = file.getName();
  UniqueNameBuilder<VirtualFile> uniqueNameBuilderForShortName = valueMap.get(fileName);

  if (uniqueNameBuilderForShortName == null) {
    final UniqueNameBuilder<VirtualFile> builder = filesWithTheSameName(
      fileName,
      project,
      skipNonOpenedFiles,
      ProjectScope.getProjectScope(project)
    );
    valueMap.put(fileName, builder != null ? builder:ourEmptyBuilder);
    uniqueNameBuilderForShortName = builder;
  } else if (uniqueNameBuilderForShortName == ourEmptyBuilder) {
    uniqueNameBuilderForShortName = null;
  }

  if (uniqueNameBuilderForShortName != null && uniqueNameBuilderForShortName.contains(file)) {
    if (file instanceof VirtualFilePathWrapper) {
      return ((VirtualFilePathWrapper)file).getPresentablePath();
    }
    return getEditorTabText(file, uniqueNameBuilderForShortName, UISettings.getInstance().HIDE_KNOWN_EXTENSION_IN_TABS);
  }
  return file.getPresentableName();
}
 
Example 25
Project: tools-idea   File: UniqueNameBuilderTest.java   View source code 4 votes vote down vote up
public void testSimple() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("", "/", 100);
  builder.addPath("A", "/Users/yole/idea/foo/bar.java");
  builder.addPath("B", "/Users/yole/idea/baz/bar.java");
  assertEquals("foo/bar.java", builder.getShortPath("A"));
}
 
Example 26
Project: tools-idea   File: UniqueNameBuilderTest.java   View source code 4 votes vote down vote up
public void testTwoLevel() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("", "/", 100);
  builder.addPath("A", "/Users/yole/idea/foo/buy/index.html");
  builder.addPath("B", "/Users/yole/idea/bar/buy/index.html");
  assertEquals("foo/\u2026/index.html", builder.getShortPath("A"));
}
 
Example 27
Project: tools-idea   File: UniqueNameBuilderTest.java   View source code 4 votes vote down vote up
public void testSeparator() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("", "\\", 100);
  builder.addPath("A", "/Users/yole/idea/foo/buy/index.html");
  builder.addPath("B", "/Users/yole/idea/bar/buy/index.html");
  assertEquals("foo\\\u2026\\index.html", builder.getShortPath("A"));
}
 
Example 28
Project: consulo   File: UniqueNameBuilderTest.java   View source code 4 votes vote down vote up
public void testSimple() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("", "/", 100);
  builder.addPath("A", "/Users/yole/idea/foo/bar.java");
  builder.addPath("B", "/Users/yole/idea/baz/bar.java");
  assertEquals("foo/bar.java", builder.getShortPath("A"));
}
 
Example 29
Project: consulo   File: UniqueNameBuilderTest.java   View source code 4 votes vote down vote up
public void testTwoLevel() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("", "/", 100);
  builder.addPath("A", "/Users/yole/idea/foo/buy/index.html");
  builder.addPath("B", "/Users/yole/idea/bar/buy/index.html");
  assertEquals("foo/\u2026/index.html", builder.getShortPath("A"));
}
 
Example 30
Project: consulo   File: UniqueNameBuilderTest.java   View source code 4 votes vote down vote up
public void testSeparator() {
  UniqueNameBuilder<String> builder = new UniqueNameBuilder<String>("", "\\", 100);
  builder.addPath("A", "/Users/yole/idea/foo/buy/index.html");
  builder.addPath("B", "/Users/yole/idea/bar/buy/index.html");
  assertEquals("foo\\\u2026\\index.html", builder.getShortPath("A"));
}
 
Example 31
Project: consulo   File: RecentProjectPanel.java   View source code 4 votes vote down vote up
protected ListCellRenderer createRenderer(UniqueNameBuilder<ReopenProjectAction> pathShortener) {
  return new RecentProjectItemRenderer(pathShortener);
}
 
Example 32
Project: consulo   File: UniqueVFilePathBuilderImpl.java   View source code 4 votes vote down vote up
private static String getUniqueVirtualFilePath(final Project project, VirtualFile file, final boolean skipNonOpenedFiles, GlobalSearchScope scope) {
  Key<CachedValue<Map<GlobalSearchScope, Map<String, UniqueNameBuilder<VirtualFile>>>>> key =
          skipNonOpenedFiles ?  ourShortNameOpenedBuilderCacheKey:ourShortNameBuilderCacheKey;
  CachedValue<Map<GlobalSearchScope, Map<String, UniqueNameBuilder<VirtualFile>>>> data = project.getUserData(key);
  if (data == null) {
    project.putUserData(key, data = CachedValuesManager.getManager(project).createCachedValue(
            () -> new CachedValueProvider.Result<Map<GlobalSearchScope, Map<String, UniqueNameBuilder<VirtualFile>>>>(
                    new ConcurrentHashMap<>(2),
                    PsiModificationTracker.MODIFICATION_COUNT,
                    //ProjectRootModificationTracker.getInstance(project),
                    //VirtualFileManager.VFS_STRUCTURE_MODIFICATIONS,
                    FileEditorManagerImpl.OPEN_FILE_SET_MODIFICATION_COUNT
            ), false));
  }

  ConcurrentMap<GlobalSearchScope, Map<String, UniqueNameBuilder<VirtualFile>>> scope2ValueMap =
          (ConcurrentMap<GlobalSearchScope, Map<String,UniqueNameBuilder<VirtualFile>>>)data.getValue();
  Map<String, UniqueNameBuilder<VirtualFile>> valueMap = scope2ValueMap.get(scope);
  if (valueMap == null) {
    valueMap = ConcurrencyUtil.cacheOrGet(scope2ValueMap, scope, ContainerUtil.createConcurrentSoftValueMap());
  }

  final String fileName = file.getName();
  UniqueNameBuilder<VirtualFile> uniqueNameBuilderForShortName = valueMap.get(fileName);

  if (uniqueNameBuilderForShortName == null) {
    final UniqueNameBuilder<VirtualFile> builder = filesWithTheSameName(
            fileName,
            project,
            skipNonOpenedFiles,
            scope
    );
    valueMap.put(fileName, builder != null ? builder:ourEmptyBuilder);
    uniqueNameBuilderForShortName = builder;
  } else if (uniqueNameBuilderForShortName == ourEmptyBuilder) {
    uniqueNameBuilderForShortName = null;
  }

  if (uniqueNameBuilderForShortName != null && uniqueNameBuilderForShortName.contains(file)) {
    if (file instanceof VirtualFilePathWrapper) {
      return ((VirtualFilePathWrapper)file).getPresentablePath();
    }
    return uniqueNameBuilderForShortName.getShortPath(file);
  }
  return file.getName();
}