Eclipse PDE: Everything about Editor Part 4
Auto-Edit Strategy This post of Everything About Editor series explains about editors auto complete feature. Auto edit feature of any editor helps developer while writing code, for example in java editor of eclipse provides auto complete features for string quotes , open braces etc. When you type open curly braces ‘{‘ , eclipse java editor auto inserts closing curly braces considering line and indentation. Here I am going to implement auto-edit strategy for open single , double quotes and opening curly braces ‘{‘. To use auto edits, you must implement the org.eclipse.jface.text.IAutoEditStrategy interface, which contains just one method: void customizeDocumentCommand(IDocument document,DocumentCommand command); This is called each time you make a change to the document with the DocumentCommand object containing the information about that change. So, adding indents or making any change to the text being changed is as simple as modifying the DocumentCommand object. 1. Implement IA...