01: package gui;
02:
03: import java.util.Map;
04:
05: import org.eclipse.core.resources.IProject;
06: import org.eclipse.core.resources.IResource;
07: import org.eclipse.core.resources.IResourceDelta;
08: import org.eclipse.core.resources.IResourceDeltaVisitor;
09: import org.eclipse.core.resources.IncrementalProjectBuilder;
10: import org.eclipse.core.runtime.CoreException;
11: import org.eclipse.core.runtime.IProgressMonitor;
12:
13: public class RefactoringBuilder extends IncrementalProjectBuilder {
14:
15: class SampleDeltaVisitor implements IResourceDeltaVisitor {
16: /*
17: * (non-Javadoc)
18: *
19: * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
20: */
21: public boolean visit(IResourceDelta delta) throws CoreException {
22: IResource resource = delta.getResource();
23: switch (delta.getKind()) {
24: case IResourceDelta.ADDED:
25: // handle added resource
26: //checkXML(resource);
27: break;
28: case IResourceDelta.REMOVED:
29: // handle removed resource
30: break;
31: case IResourceDelta.CHANGED:
32: // handle changed resource
33: //checkXML(resource);
34: break;
35: }
36: //return true to continue visiting children.
37: return true;
38: }
39: }
40:
41: public static final String BUILDER_ID = "org.concept.generator.refactoringBuilder";
42:
43: /*
44: * (non-Javadoc)
45: *
46: * @see org.eclipse.core.internal.events.InternalBuilder#build(int,
47: * java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
48: */
49: protected IProject[] build(int kind, Map args,
50: IProgressMonitor monitor) throws CoreException {
51: if (kind == FULL_BUILD) {
52: fullBuild(monitor);
53: } else {
54: IResourceDelta delta = getDelta(getProject());
55: if (delta == null) {
56: fullBuild(monitor);
57: } else {
58: incrementalBuild(delta, monitor);
59: }
60: }
61: return null;
62: }
63:
64: protected void fullBuild(final IProgressMonitor monitor)
65: throws CoreException {
66: /*
67: try {
68: //getProject().accept(new SampleResourceVisitor());
69: } catch (CoreException e) {
70: }
71: */
72: }
73:
74: protected void incrementalBuild(IResourceDelta delta,
75: IProgressMonitor monitor) throws CoreException {
76: // the visitor does the work.
77: delta.accept(new SampleDeltaVisitor());
78: }
79: }
|