String (Map<PsiFile, String> relativeMap) { String vector = null; for (String relativePath : relativeMap.values()) { if (vector == null) { vector = relativePath; } else if (vector.startsWith(relativePath + "/")) { vector = relativePath; } else if (!relativePath.startsWith(vector + "/") && !relativePath.equals(vector)) { return null; } } if (vector != null) { for (PsiFile psiFile : relativeMap.keySet()) { final String path = relativeMap.get(psiFile); relativeMap.put(psiFile, path.equals(vector) ? "" : path.substring(vector.length() + 1)); } } return vector; }