1 11 package org.eclipse.core.internal.resources; 12 13 import java.util.HashMap ; 14 import org.eclipse.core.internal.events.BuildCommand; 15 import org.eclipse.core.resources.ICommand; 16 import org.eclipse.core.resources.IProjectNature; 17 import org.eclipse.core.runtime.content.IContentTypeMatcher; 18 19 public class ProjectInfo extends ResourceInfo { 20 21 22 protected ProjectDescription description = null; 23 24 25 protected HashMap natures = null; 26 27 28 protected Object propertyStore = null; 29 30 31 protected IContentTypeMatcher matcher = null; 32 33 37 public synchronized void fixupAfterMove() { 38 natures = null; 39 propertyStore = null; 41 if (description != null) { 42 ICommand[] buildSpec = description.getBuildSpec(false); 43 for (int i = 0; i < buildSpec.length; i++) 44 ((BuildCommand) buildSpec[i]).setBuilder(null); 45 } 46 } 47 48 51 public ProjectDescription getDescription() { 52 return description; 53 } 54 55 58 public IContentTypeMatcher getMatcher() { 59 return matcher; 60 } 61 62 public IProjectNature getNature(String natureId) { 63 HashMap temp = natures; 65 if (temp == null) 66 return null; 67 return (IProjectNature) temp.get(natureId); 68 } 69 70 73 public Object getPropertyStore() { 74 return propertyStore; 75 } 76 77 80 public void setDescription(ProjectDescription value) { 81 if (description != null) { 82 ICommand[] oldSpec = description.buildSpec; 86 ICommand[] newSpec = value.buildSpec; 87 value.buildSpec = oldSpec; 88 value.setBuildSpec(newSpec); 89 } 90 description = value; 91 } 92 93 96 public void setMatcher(IContentTypeMatcher matcher) { 97 this.matcher = matcher; 98 } 99 100 public synchronized void setNature(String natureId, IProjectNature value) { 101 if (value == null) { 103 if (natures == null) 104 return; 105 HashMap temp = (HashMap ) natures.clone(); 106 temp.remove(natureId); 107 if (temp.isEmpty()) 108 natures = null; 109 else 110 natures = temp; 111 } else { 112 HashMap temp = natures; 113 if (temp == null) 114 temp = new HashMap (5); 115 else 116 temp = (HashMap ) natures.clone(); 117 temp.put(natureId, value); 118 natures = temp; 119 } 120 } 121 122 125 public void setPropertyStore(Object value) { 126 propertyStore = value; 127 } 128 } 129 | Popular Tags |