Community
Participate
Working Groups
In the following CU: ---- import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFileModificationValidator; import org.eclipse.core.runtime.IStatus; public class MyClass implements IFileModificationValidator { ---- Do an Add unimplemented method and you get the code below import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFileModificationValidator; import org.eclipse.core.runtime.IStatus; public class MyClass implements IFileModificationValidator /* * @see IFileModificationValidator#validateEdit(IFile[], Object) */ public IStatus validateEdit(IFile[] files, Object context) { return null; } /* * @see IFileModificationValidator#validateSave(IFile) */ public IStatus validateSave(IFile file) { return null; } {
Could reproduce: Problem is the missing close bracket of MyClass. using IType.createMethod() -> moving to JCore
If you add a cariage return after the opening brace, the problem is gone. I will check the positions of the beginning of the body of the class.
This is a bug in the actual CreateElementInCUOperation class. When the '{' is the last character of the CU the new element is added at the position of this character instead of this position + 1. This is why the opening brace ends up at the end of the CU and the new unimplemented methods between the implements clause and the '{'. I will try to see how to fix it.
There is no check to know if the insertPosition was equal to the buffer length. If true, the right operation on the buffer is an append and not an insertion. I will release as soon as the stream is reopen.
Released in HEAD. All tests are green.
The fix was enough. Adding getters/setters won't work as expected anymore. An append is the right operation only if the last character is an open brace, otherwise the replace was the right solution.
I release a fix in order to restore the getter/setters feature. There is no test that is checking this feature. This is scary. We should have found this bug earlier. All tests are green.
This feature seems to be gone. How do I use it in a 1218 build?
The action is now called "Override Methods" and is available on types in the outline or packages viwe.
This requires a complete rework on the normalize methods in the JDOM world. It will wait for the new DOM node.
Fixed and released in HEAD.