Bug 38500 getters/setters: very confused by interface fields
20030604 strange things happen when you start generating getters/setters for interface fields: - dialog says you can make them 'private/protected/default' which is incorrect for interface methods (default makes some sense but the others do not) - even if you say 'private' it still generates 'public' - all interface methods are always 'abstract' so 'final' makes no sense - it will never compile -'synchronized' makes no sense either -nor does 'native'
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddGetterSetterAction.java
IField[] selectedFields= getSelectedFields(selection);
			if (canRunOn(selectedFields)){
				run(selectedFields[0].getDeclaringType(), selectedFields, false);
				return;
			}	
			Object firstElement= selection.getFirstElement();
			if (firstElement instanceof IType)
				run((IType)firstElement, new IField[0], false);
			else if (firstElement instanceof ICompilationUnit)	
				run(((ICompilationUnit) firstElement).findPrimaryType(), new IField[0], false);
		} catch (CoreException e) {
			ExceptionHandler.handle(e, getShell(), dialogTitle, ActionMessages.getString("AddGetterSetterAction.error.actionfailed")); 
		}
				
	}
	
	private boolean canEnable(IStructuredSelection selection) throws JavaModelException {
		if (getSelectedFields(selection) != null)
			return true;
		if ((selection.size() == 1) && (selection.getFirstElement() instanceof IType)) {
			IType type= (IType) selection.getFirstElement();
			return type.getCompilationUnit() != null && type.isClass(); 
		}
		if ((selection.size() == 1) && (selection.getFirstElement() instanceof ICompilationUnit))
			return true;
		return false;
	}	
	private static boolean canRunOn(IField[] fields) throws JavaModelException {
		return fields != null && fields.length > 0;
	}