Bug 33356 Read Only files: 2 dialogs from 'override methods' [code manipulation]
rc1 1. set a file to read-only 2. open the file in the editor, select an import statement 3. invoke 'override/implement methods' from the context menu 4. error dialog shows up, 'file is read only', press ok 5. second dialog comes up, invalid selection, select type...
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OverrideMethodsAction.java
BusyIndicatorRunnableContext context= new BusyIndicatorRunnableContext();
			context.run(false, true, new WorkbenchRunnableAdapter(op));
			IMethod[] res= op.getCreatedMethods();
			if (res == null || res.length == 0) {
				MessageDialog.openInformation(shell, getDialogTitle(), ActionMessages.getString("OverrideMethodsAction.error.nothing_found")); 
			} else if (editor != null) {
				EditorUtility.revealInEditor(editor, res[0]);
			}
		} catch (InvocationTargetException e) {
			ExceptionHandler.handle(e, shell, getDialogTitle(), null); 
		} catch (InterruptedException e) {
			
		}
	}
		
	private IType getSelectedType(IStructuredSelection selection) throws JavaModelException {
		Object[] elements= selection.toArray();
		if (elements.length == 1 && (elements[0] instanceof IType)) {
			IType type= (IType) elements[0];
			if (type.getCompilationUnit() != null && type.isClass()) {
				return type;
			}
		}
		return null;
	}
	
	private String getDialogTitle() {
		return ActionMessages.getString("OverrideMethodsAction.error.title"); 
	}	
}