1 11 12 package org.eclipse.ant.internal.ui.editor.model; 13 14 import java.util.HashMap ; 15 import java.util.Map ; 16 import org.apache.tools.ant.Project; 17 import org.eclipse.ant.internal.ui.editor.outline.AntModel; 18 import org.eclipse.ant.internal.ui.editor.outline.AntModelProject; 19 import org.eclipse.ant.internal.ui.editor.outline.XMLProblem; 20 import org.eclipse.ant.internal.ui.model.AntUIImages; 21 import org.eclipse.ant.internal.ui.model.IAntUIConstants; 22 import org.eclipse.jface.resource.ImageDescriptor; 23 24 25 public class AntProjectNode extends AntElementNode { 26 27 private AntModelProject fProject; 28 private AntModel fModel; 29 private Map fNameToDefiningNodeMap; 30 31 public AntProjectNode(AntModelProject project, AntModel antModel) { 32 super("project"); fProject= project; 34 fModel= antModel; 35 } 36 37 40 public String getLabel() { 41 String projectName= fProject.getName(); 42 if (projectName == null || projectName.length() == 0) { 43 projectName= "project"; } 45 return projectName; 46 } 47 50 protected ImageDescriptor getBaseImageDescriptor() { 51 return AntUIImages.getImageDescriptor(IAntUIConstants.IMG_ANT_PROJECT); 52 } 53 54 58 public Project getProject() { 59 return fProject; 60 } 61 62 protected AntModel getAntModel() { 63 return fModel; 64 } 65 66 69 public void reset() { 70 super.reset(); 71 fProject.reset(); 72 if (fNameToDefiningNodeMap != null) { 73 getAntModel().setNamesOfOldDefiningNodes(fNameToDefiningNodeMap.keySet()); 74 } 75 fNameToDefiningNodeMap= null; 76 setProblemSeverity(XMLProblem.NO_PROBLEM); 77 } 78 79 public void addDefiningTaskNode(AntDefiningTaskNode node) { 80 if (fNameToDefiningNodeMap == null) { 81 fNameToDefiningNodeMap= new HashMap (); 82 } 83 String label= node.getLabel(); 84 if (label.equalsIgnoreCase("macrodef") || label.equalsIgnoreCase("presetdef") || label.equalsIgnoreCase("typedef") || label.equalsIgnoreCase("taskdef")) { return; 90 } 91 fNameToDefiningNodeMap.put(node.getLabel(), node); 92 } 93 94 public AntDefiningTaskNode getDefininingTaskNode(String nodeName) { 95 if (fNameToDefiningNodeMap != null) { 96 return (AntDefiningTaskNode)fNameToDefiningNodeMap.get(nodeName); 97 } 98 return null; 99 } 100 } 101 | Popular Tags |