Bug 17598 Source->Generate Getter and Setter enabled for read only file
F1 This action is enabled for read-only files. Executing it shows a dialog saying that the file is read-only. The action should be disabled since all other source actions are disabled as well.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddGetterSetterAction.java
private static boolean canEnableOn(IType type) throws JavaModelException {
		if (type == null)
			return false;
		if (type.getFields().length == 0)
			return false;
		if (type.getCompilationUnit() == null)
			return false;
		if (JavaModelUtil.isEditable(type.getCompilationUnit()))
			return true;
		return false;	
	}
	
	private static boolean canEnableOn(IField[] fields) throws JavaModelException {
		return fields != null && fields.length > 0 && JavaModelUtil.isEditable(fields[0].getCompilationUnit());
	}
	
	private void run(IType type, IField[] preselected) throws CoreException{
		ILabelProvider lp= new AddGetterSetterLabelProvider(createNameProposer());
		Map entries= createGetterSetterMapping(type);
		if (entries.isEmpty()){
			MessageDialog.openInformation(getShell(), dialogTitle, "The type contains no fields or all fields have getters/setters already.");
			return;
		}	
		ITreeContentProvider cp= new AddGetterSetterContentProvider(entries);
		CheckedTreeSelectionDialog dialog= new CheckedTreeSelectionDialog(getShell(), lp, cp);
		dialog.setSorter(new JavaElementSorter());
		dialog.setTitle(dialogTitle);
		String message= ActionMessages.getFormattedString("AddGetterSetterAction.dialog.title", JavaElementUtil.createSignature(type));
		dialog.setMessage(message);
		dialog.setValidator(createValidator());