diff --git a/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/utils/ProjectHelper.java b/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/utils/ProjectHelper.java index 4045ffe..d5143e9 100644 --- a/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/utils/ProjectHelper.java +++ b/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/utils/ProjectHelper.java @@ -278,6 +278,17 @@ } /** + * Gets the associated project name by the absolute build-file path + * + * @param buildFile + * The file + * @return The project name + */ + public static String getProjectNameOfBuildFile(String absolutePath) { + return parsedProjectNames.get(absolutePath); + } + + /** * Builds the hash-map's build-file key * * @param buildFile @@ -345,8 +356,11 @@ String currentProjectName = context.getCurrentProjectName(); // just an additional check if the name is non-empty if (this.isCurrentProjectNameValid(currentProjectName)) { - String buildFilePath = context.getBuildFile().getAbsolutePath(); - storeParsedProjectName(buildFilePath, currentProjectName); + if (context.getBuildFile() != null) { + storeParsedProjectName(context.getBuildFile().getAbsolutePath(), currentProjectName); + } else if (context.getBuildFileURL() != null) { + storeParsedProjectName(new File(context.getBuildFileURL().getPath()).getAbsolutePath(), currentProjectName); + } } } catch (SAXParseException e) { diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntIncludeNode.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntIncludeNode.java index 906d54c..dfda703 100644 --- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntIncludeNode.java +++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/model/AntIncludeNode.java @@ -141,7 +141,10 @@ * of any subsequent operation on the AntIncludeNode object. */ IFile projectSpecificBuildFile = this.handleCorrectBuildFile(importedFromNode); - return org.eclipse.ant.internal.ui.editor.utils.ProjectHelper.getProjectNameOfBuildFile(projectSpecificBuildFile); + if (projectSpecificBuildFile != null) { + return org.eclipse.ant.internal.ui.editor.utils.ProjectHelper.getProjectNameOfBuildFile(projectSpecificBuildFile); + } + return org.eclipse.ant.internal.ui.editor.utils.ProjectHelper.getProjectNameOfBuildFile(this.getFilePath()); } /**