Index: C:/work2/org.seasar.diigu.eclipse.plugin/src/main/java/org/seasar/diigu/eclipse/operation/NameEnhanceJob.java =================================================================== --- C:/work2/org.seasar.diigu.eclipse.plugin/src/main/java/org/seasar/diigu/eclipse/operation/NameEnhanceJob.java (revision 1950) +++ C:/work2/org.seasar.diigu.eclipse.plugin/src/main/java/org/seasar/diigu/eclipse/operation/NameEnhanceJob.java (working copy) @@ -100,6 +100,18 @@ || family == ResourcesPlugin.FAMILY_MANUAL_BUILD; } + //IResourceDeltaでなくIResourceを引数にとるように変更 + public NameEnhanceJob(String name, final IResource resource) { + super(name); + setPriority(Job.BUILD); + this.project = resource.getProject(); + this.runnable = new IWorkspaceRunnable() { + public void run(final IProgressMonitor monitor) + throws CoreException { + enhance(resource, monitor); + } + }; + } public NameEnhanceJob(String name, final IResourceDelta delta) { super(name); @@ -243,14 +255,14 @@ IResource classfile) throws CoreException { QualifiedName qn = new QualifiedName(Constants.PLUGIN_ID, Constants.ENHANCE_LOCALNAME); - if (classfile.getPersistentProperty(qn) == null) { - ParameterNameEnhancer enhancer = new ParameterNameEnhancer(type - .getFullyQualifiedName(), loader); - if (enhanceClassFile(type, enhancer)) { - enhancer.save(); - classfile.setPersistentProperty(qn, "enhanced"); - return true; - } + //classfileのPropertyにenhancedがある場合でもインクリメンタルコンパイルされたときは + //enhanceが必要 + ParameterNameEnhancer enhancer = new ParameterNameEnhancer(type + .getFullyQualifiedName(), loader); + if (enhanceClassFile(type, enhancer)) { + enhancer.save(); + classfile.setPersistentProperty(qn, "enhanced"); + return true; } return false; } Index: C:/work2/org.seasar.diigu.eclipse.plugin/src/main/java/org/seasar/diigu/eclipse/startup/DiiguStartup.java =================================================================== --- C:/work2/org.seasar.diigu.eclipse.plugin/src/main/java/org/seasar/diigu/eclipse/startup/DiiguStartup.java (revision 1950) +++ C:/work2/org.seasar.diigu.eclipse.plugin/src/main/java/org/seasar/diigu/eclipse/startup/DiiguStartup.java (working copy) @@ -39,7 +39,7 @@ public class DiiguStartup implements IStartup { private class ClassImageChangedListener extends - JavaElementDeltaAcceptor.Visitor implements IElementChangedListener { + JavaElementDeltaAcceptor.Visitor implements IElementChangedListener { public void elementChanged(ElementChangedEvent event) { JavaElementDeltaAcceptor.accept(event.getDelta(), this); } @@ -60,24 +60,26 @@ */ protected boolean postVisit(IJavaElementDelta delta) { IJavaElement e = delta.getElement(); - if (e.getElementType() == IJavaElement.JAVA_PROJECT) { - IJavaElementDelta[] children = delta.getAffectedChildren(); - for (int i = 0; children != null && i < children.length; i++) { - IResourceDelta[] ary = children[i].getResourceDeltas(); - for (int j = 0; ary != null && j < ary.length; j++) { - final IResourceDelta d = ary[j]; - IResource r = d.getResource(); - if (r != null - && ProjectUtils.hasNature(r.getProject(), - DiiguNature.NATURE_ID)) { - NameEnhanceJob job = new NameEnhanceJob( - Messages.ENHANCE_INCREMENTALBUILD, d); - job.schedule(3L); - } - } + if (e.getElementType() == IJavaElement.COMPILATION_UNIT) { + //JAVA_PROJECTのchildren[i].getResourceDeltas()がnullを返すので + //変更 + final int MASK = IResourceDelta.ADDED + | IResourceDelta.CHANGED; + if ((MASK & delta.getKind()) == 0) { + return false; } + IResource r = e.getResource(); + if (r != null + && ProjectUtils.hasNature(r.getProject(), + DiiguNature.NATURE_ID)) { + NameEnhanceJob job = new NameEnhanceJob( + Messages.ENHANCE_INCREMENTALBUILD, r); + job.schedule(3L); + } + return false; } - return false; + //最初にJAVA_PROJECTでなく、JAVA_MODELがわたってくるので、trueにする + return true; } }