1 11 12 package org.eclipse.ant.internal.ui.editor.model; 13 14 import org.apache.tools.ant.BuildException; 15 import org.apache.tools.ant.Task; 16 import org.eclipse.ant.internal.ui.model.AntUIImages; 17 import org.eclipse.ant.internal.ui.model.IAntUIConstants; 18 import org.eclipse.ant.internal.ui.preferences.AntEditorPreferenceConstants; 19 import org.eclipse.jface.resource.ImageDescriptor; 20 import org.xml.sax.Attributes ; 21 22 public class AntPropertyNode extends AntTaskNode { 23 24 private String fValue= null; 25 26 public AntPropertyNode(Task task, Attributes attributes) { 27 super(task); 28 String label = attributes.getValue(IAntModelConstants.ATTR_NAME); 29 if(label == null) { 30 label = attributes.getValue(IAntModelConstants.ATTR_FILE); 31 if(label != null) { 32 label= "file="+label; } else { 34 label = attributes.getValue(IAntModelConstants.ATTR_RESOURCE); 35 if (label != null) { 36 label= "resource="+label; } else { 38 label = attributes.getValue(IAntModelConstants.ATTR_ENVIRONMENT); 39 if(label != null) { 40 label= "environment=" + label; } 42 } 43 } 44 } else { 45 fValue= attributes.getValue(IAntModelConstants.ATTR_VALUE); 46 } 47 setLabel(label); 48 } 49 50 public String getValue() { 51 return fValue; 52 } 53 54 57 protected ImageDescriptor getBaseImageDescriptor() { 58 return AntUIImages.getImageDescriptor(IAntUIConstants.IMG_PROPERTY); 59 } 60 61 64 public boolean configure(boolean validateFully) { 65 if (configured) { 66 return false; 67 } 68 try { 69 getTask().maybeConfigure(); 70 getTask().execute(); 71 configured= true; 72 } catch (BuildException be) { 73 handleBuildException(be, AntEditorPreferenceConstants.PROBLEM_PROPERTIES); 74 } 75 return false; 76 } 77 } | Popular Tags |