+
+ /**
+ * @param inFullPath full file path or URL to be shortened
+ * @return shortened string from beginning of path
+ */
+ private static String shortenPath(String inFullPath)
+ {
+ String path = inFullPath;
+ // Chop off the home path if possible
+ final String homePath = System.getProperty("user.home").toLowerCase();
+ if (inFullPath != null && inFullPath.toLowerCase().startsWith(homePath)) {
+ path = inFullPath.substring(homePath.length()+1);
+ }
+ return shortenString(path);
+ }
+
+ /**
+ * @param inString string to shorten
+ * @return shortened string from the beginning
+ */
+ private static String shortenString(String inString)
+ {
+ // Limit is hardcoded here, maybe it should depend on parent component width and font size etc?
+ if (inString == null || inString.length() < 21) {
+ return inString;
+ }
+ // string is too long
+ return inString.substring(0, 20) + "...";
+ }