try {
String[] contentTypes= getContentTypes(viewer.getDocument());
if (viewer instanceof ITextViewerExtension2) {
ITextViewerExtension2 vExtension= ((ITextViewerExtension2) viewer);
for (int i= 0; i < contentTypes.length; i++) {
vExtension.prependAutoEditStrategy(fAutoEditVetoer, contentTypes[i]);
}
} else {
Assert.isTrue(false);
}