예제 #1
0
  @Override
  public String getTitle() {
    VirtualFile file = getVirtualFile();
    if (file != null) {
      return FileUtil.getLocationRelativeToUserHome(file.getPresentableUrl());
    }

    return super.getTitle();
  }
  public ReopenProjectAction(
      final String projectPath, final String projectName, final String displayName) {
    myProjectPath = projectPath;
    myProjectName = projectName;

    final Presentation presentation = getTemplatePresentation();
    String text =
        projectPath.equals(displayName)
            ? FileUtil.getLocationRelativeToUserHome(projectPath)
            : displayName;
    presentation.setText(text, false);
    presentation.setDescription(projectPath);
  }
 private String shortenName(@NotNull String name) {
   final Matcher matcher = PYTHON_PATTERN.matcher(name);
   if (matcher.matches()) {
     String path = matcher.group(2);
     if (path != null) {
       name = matcher.group(1) + " at " + path;
     } else {
       path = matcher.group(4);
       final int index = path.lastIndexOf(File.separator);
       if (index > 0) {
         path = path.substring(index);
       }
       name = matcher.group(3) + " at ..." + path;
     }
   } else if (new File(name).exists()) {
     name = FileUtil.getLocationRelativeToUserHome(name);
   }
   return name;
 }