1 11 package org.eclipse.core.internal.events; 12 13 import java.util.Map ; 14 import org.eclipse.core.internal.resources.ICoreConstants; 15 import org.eclipse.core.internal.watson.ElementTree; 16 import org.eclipse.core.resources.*; 17 import org.eclipse.core.runtime.*; 18 19 25 public abstract class InternalBuilder { 26 30 static BuildManager buildManager; 31 private ICommand command; 32 private boolean forgetStateRequested = false; 33 private IProject[] interestingProjects = ICoreConstants.EMPTY_PROJECT_ARRAY; 34 37 private String label; 38 private String natureId; 39 private ElementTree oldState; 40 43 private String pluginId; 44 private IProject project; 45 46 49 private boolean callOnEmptyDelta = false; 50 51 54 protected abstract IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException; 55 56 59 final boolean callOnEmptyDelta() { 60 return callOnEmptyDelta; 61 } 62 65 protected abstract void clean(IProgressMonitor monitor) throws CoreException; 66 67 70 final void clearForgetLastBuiltState() { 71 forgetStateRequested = false; 72 } 73 74 77 protected void forgetLastBuiltState() { 78 oldState = null; 79 forgetStateRequested = true; 80 } 81 82 85 protected ICommand getCommand() { 86 return (ICommand)((BuildCommand)command).clone(); 87 } 88 89 92 protected IResourceDelta getDelta(IProject aProject) { 93 return buildManager.getDelta(aProject); 94 } 95 96 final IProject[] getInterestingProjects() { 97 return interestingProjects; 98 } 99 100 final String getLabel() { 101 return label; 102 } 103 104 final ElementTree getLastBuiltTree() { 105 return oldState; 106 } 107 108 112 final String getNatureId() { 113 return natureId; 114 } 115 116 final String getPluginId() { 117 return pluginId; 118 } 119 120 123 protected IProject getProject() { 124 return project; 125 } 126 127 130 protected boolean hasBeenBuilt(IProject aProject) { 131 return buildManager.hasBeenBuilt(aProject); 132 } 133 134 137 public boolean isInterrupted() { 138 return buildManager.autoBuildJob.isInterrupted(); 139 } 140 141 144 protected void needRebuild() { 145 buildManager.requestRebuild(); 146 } 147 148 final void setCallOnEmptyDelta(boolean value) { 149 this.callOnEmptyDelta = value; 150 } 151 152 final void setCommand(ICommand value) { 153 this.command = value; 154 } 155 156 final void setInterestingProjects(IProject[] value) { 157 interestingProjects = value; 158 } 159 160 final void setLabel(String value) { 161 this.label = value; 162 } 163 164 final void setLastBuiltTree(ElementTree value) { 165 oldState = value; 166 } 167 168 final void setNatureId(String id) { 169 this.natureId = id; 170 } 171 172 final void setPluginId(String value) { 173 pluginId = value; 174 } 175 176 180 final void setProject(IProject value) { 181 Assert.isTrue(project == null); 182 project = value; 183 } 184 185 188 protected abstract void startupOnInitialize(); 189 190 194 final boolean wasForgetStateRequested() { 195 return forgetStateRequested; 196 } 197 } 198 | Popular Tags |