LinkedResource (@NotNull String projectPath, @NotNull String relativePath) { String independentPath = FileUtil.toSystemIndependentName(relativePath); @NotNull String resourceName = independentPath; final int idx = independentPath.indexOf('/'); if (idx != -1) { resourceName = independentPath.substring(0, idx); } final File file = new File(projectPath, DOT_PROJECT_EXT); if (file.isFile()) { try { for (Element o : JDOMUtil.load(file).getChildren(LINKED_RESOURCES)) { for (Element l : o.getChildren(LINK)) { if (Comparing.strEqual(l.getChildText(NAME_TAG), resourceName)) { LinkedResource linkedResource = new LinkedResource(); final String relativeToLinkedResourcePath = independentPath.length() > resourceName.length() ? independentPath.substring(resourceName.length()) : ""; final Element locationURI = l.getChild("locationURI"); if (locationURI != null) { linkedResource.setURI(FileUtil.toSystemIndependentName(locationURI.getText()) + relativeToLinkedResourcePath); } final Element location = l.getChild("location"); if (location != null) { linkedResource.setLocation(FileUtil.toSystemIndependentName(location.getText()) + relativeToLinkedResourcePath); } return linkedResource; } } } } catch (Exception ignore) { } } return null; }