private File getModuleRoot(final String module, final Pom pom) {
   if (pom == null) {
     // No POM exists for this module; we must be creating it
     return new File(pomManagementService.getFocusedModule().getRoot(), module);
   }
   // This is a known module; use its known root path
   return new File(pom.getRoot());
 }
 protected Collection<LogicalPath> getPaths(final boolean sourceOnly) {
   final Collection<LogicalPath> pathIds = new ArrayList<LogicalPath>();
   for (final Pom pom : pomManagementService.getPoms()) {
     for (final PhysicalPath modulePath : pom.getPhysicalPaths()) {
       if (!sourceOnly || modulePath.isSource()) {
         pathIds.add(modulePath.getLogicalPath());
       }
     }
   }
   return pathIds;
 }
 /**
  * Locates the first {@link PhysicalPath} which can be construed as a parent of the presented
  * identifier.
  *
  * @param identifier to locate the parent of (required)
  * @return the first matching parent, or null if not found
  */
 protected PhysicalPath getApplicablePhysicalPath(final String identifier) {
   Assert.notNull(identifier, "Identifier required");
   PhysicalPath physicalPath = null;
   int longest = 0;
   for (final Pom pom : pomManagementService.getPoms()) {
     if (removeTrailingSeparator(identifier).startsWith(removeTrailingSeparator(pom.getRoot()))
         && removeTrailingSeparator(pom.getRoot()).length() > longest) {
       longest = removeTrailingSeparator(pom.getRoot()).length();
       int nextLongest = 0;
       for (final PhysicalPath thisPhysicalPath : pom.getPhysicalPaths()) {
         final String possibleParent =
             new FileDetails(thisPhysicalPath.getLocation(), null).getCanonicalPath();
         if (removeTrailingSeparator(identifier).startsWith(possibleParent)
             && possibleParent.length() > nextLongest) {
           nextLongest = possibleParent.length();
           physicalPath = thisPhysicalPath;
         }
       }
     }
   }
   return physicalPath;
 }
 private File getPath(final LogicalPath logicalPath) {
   final Pom pom = pomManagementService.getPomFromModuleName(logicalPath.getModule());
   final File moduleRoot = getModuleRoot(logicalPath.getModule(), pom);
   final String pathRelativeToPom = logicalPath.getPathRelativeToPom(pom);
   return new File(moduleRoot, pathRelativeToPom);
 }
 public String getFocusedRoot(final Path path) {
   return pomManagementService.getFocusedModule().getPathLocation(path);
 }
 public LogicalPath getFocusedPath(final Path path) {
   final PhysicalPath physicalPath = pomManagementService.getFocusedModule().getPhysicalPath(path);
   Assert.notNull(physicalPath, "Physical path for '" + path.name() + "' not found");
   return physicalPath.getLogicalPath();
 }
 public String getFocusedIdentifier(final Path path, final String relativePath) {
   return getIdentifier(
       LogicalPath.getInstance(path, pomManagementService.getFocusedModuleName()), relativePath);
 }
 public String getFocusedCanonicalPath(final Path path, final JavaType javaType) {
   return getCanonicalPath(
       path.getModulePathId(pomManagementService.getFocusedModuleName()), javaType);
 }
 public boolean isActive() {
   return pomManagementService.getRootPom() != null;
 }
 public String getRoot(final LogicalPath modulePathId) {
   final Pom pom = pomManagementService.getPomFromModuleName(modulePathId.getModule());
   return pom.getPhysicalPath(modulePathId.getPath()).getLocationPath();
 }