mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
cleanup
improved error handling
This commit is contained in:
parent
22dcf4b013
commit
181ceb45e7
4 changed files with 11 additions and 12 deletions
|
@ -21,7 +21,7 @@ public interface IMakeTargetManager {
|
|||
void renameTarget(IMakeTarget target, String name) throws CoreException;
|
||||
|
||||
IMakeTarget[] getTargets(IContainer container) throws CoreException;
|
||||
IMakeTarget findTarget(IContainer container, String name);
|
||||
IMakeTarget findTarget(IContainer container, String name) throws CoreException;
|
||||
|
||||
IProject[] getTargetBuilderProjects() throws CoreException;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public class MakeBuilder extends ACBuilder {
|
|||
public class MyResourceDeltaVisitor implements IResourceDeltaVisitor {
|
||||
boolean bContinue;
|
||||
|
||||
public boolean visit(IResourceDelta delta) throws CoreException {
|
||||
public boolean visit(IResourceDelta delta) {
|
||||
IResource resource = delta.getResource();
|
||||
if (resource != null && resource.getProject() == getProject()) {
|
||||
bContinue = true;
|
||||
|
|
|
@ -114,7 +114,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
return projectTargets.get(container);
|
||||
}
|
||||
|
||||
public IMakeTarget findTarget(IContainer container, String name) {
|
||||
public IMakeTarget findTarget(IContainer container, String name) throws CoreException {
|
||||
ProjectTargets projectTargets = (ProjectTargets)projectMap.get(container.getProject());
|
||||
if (projectTargets == null) {
|
||||
projectTargets = readTargets(container.getProject());
|
||||
|
@ -256,7 +256,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
}
|
||||
}
|
||||
|
||||
protected ProjectTargets readTargets(IProject project) {
|
||||
protected ProjectTargets readTargets(IProject project) throws CoreException {
|
||||
IPath targetFilePath =
|
||||
MakeCorePlugin.getDefault().getStateLocation().append(project.getName()).addFileExtension(TARGETS_EXT);
|
||||
File targetFile = targetFilePath.toFile();
|
||||
|
@ -268,7 +268,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis
|
|||
}
|
||||
}
|
||||
if (projectTargets == null) {
|
||||
projectTargets = new ProjectTargets(this, project);
|
||||
projectTargets = new ProjectTargets(project);
|
||||
}
|
||||
projectMap.put(project, projectTargets);
|
||||
return projectTargets;
|
||||
|
|
|
@ -48,22 +48,21 @@ public class ProjectTargets {
|
|||
private HashMap targetMap = new HashMap();
|
||||
|
||||
private IProject project;
|
||||
private MakeTargetManager manager;
|
||||
|
||||
public ProjectTargets(MakeTargetManager manager, IProject project) {
|
||||
public ProjectTargets(IProject project) {
|
||||
this.project = project;
|
||||
this.manager = manager;
|
||||
}
|
||||
|
||||
public ProjectTargets(MakeTargetManager manager, IProject project, InputStream input) {
|
||||
this(manager, project);
|
||||
public ProjectTargets(MakeTargetManager manager, IProject project, InputStream input) throws CoreException {
|
||||
this(project);
|
||||
|
||||
Document document = null;
|
||||
try {
|
||||
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||
document = parser.parse(input);
|
||||
} catch (Exception e) {
|
||||
MakeCorePlugin.log(e);
|
||||
throw new CoreException(
|
||||
new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, "Error reading project targets.", e));
|
||||
}
|
||||
Node node = document.getFirstChild();
|
||||
if (node.getNodeName().equals(BUILD_TARGET_ELEMENT)) {
|
||||
|
@ -188,7 +187,7 @@ public class ProjectTargets {
|
|||
return project;
|
||||
}
|
||||
|
||||
protected Document getAsXML() throws IOException {
|
||||
protected Document getAsXML() {
|
||||
Document doc = new DocumentImpl();
|
||||
Element targetsRootElement = doc.createElement(BUILD_TARGET_ELEMENT);
|
||||
doc.appendChild(targetsRootElement);
|
||||
|
|
Loading…
Add table
Reference in a new issue