private String minimizeWorkspacePath(String workspacePath) {
    // TODO(cblichmann): While workspacePath longer than 25 characters,
    // delete characters from the mid-most path component
    // and replace with '...'. If not possible, delete
    // characters from filename.

    var workspaceFile = new File(workspacePath);
    String parentPath = workspaceFile.getParent();

    var minimizedPath = new StringBuilder(workspaceFile.getPath());
    if (parentPath.length() > 25) {
      minimizedPath = new StringBuilder(parentPath.substring(0, 3));
      minimizedPath.append("...");
      minimizedPath.append(parentPath, parentPath.length() - 20, parentPath.length());
      minimizedPath.append(File.separator);
      minimizedPath.append(workspaceFile.getName());
    }
    return minimizedPath.toString();
  }
The workspace menu that is visible under "File" initially and when managing workspaces in the
main window.
java/ui/src/main/java/com/google/security/zynamics/bindiff/gui/tabpanels/projecttabpanel/menubar/WorkspaceMenu.java