Bug 85590 - IndexOutOfBoundsException in the Ant preference page on loss of selection
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntCodeAssistPreferencePage.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntCodeAssistPreferencePage.java
index 61d3ebc..20b5f27 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntCodeAssistPreferencePage.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntCodeAssistPreferencePage.java
@@ -165,6 +165,9 @@
 			}
 			public void widgetSelected(SelectionEvent e) {
 				int i= fContentAssistColorList.getSelectionIndex();
+				if (i == -1) { //bug 85590
+					return;
+				}
 				String key= fContentAssistColorListModel[i][1];
 				
 				PreferenceConverter.setValue(getOverlayStore(), key, fContentAssistColorEditor.getColorValue());
@@ -176,6 +179,9 @@
 	
 	private void handleContentAssistColorListSelection() {	
 		int i= fContentAssistColorList.getSelectionIndex();
+		if (i == -1) { //bug 85590
+			return;
+		}
 		String key= fContentAssistColorListModel[i][1];
 		RGB rgb= PreferenceConverter.getColor(getOverlayStore(), key);
 		fContentAssistColorEditor.setColorValue(rgb);
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntPreferencePage.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntPreferencePage.java
index 8b469e6..04007fb 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntPreferencePage.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntPreferencePage.java
@@ -188,8 +188,10 @@
 		foregroundColorButton.addSelectionListener(new SelectionAdapter() {
 			public void widgetSelected(SelectionEvent e) {
 				int i= fConsoleColorList.getSelectionIndex();
+				if (i == -1) { //bug 85590
+					return;
+				}
 				String key= fAppearanceColorListModel[i][1];
-		
 				PreferenceConverter.setValue(getPreferenceStore(), key, fConsoleColorEditor.getColorValue());
 			}
 		});
@@ -217,6 +219,9 @@
 	
 	private void handleAppearanceColorListSelection() {	
 		int i= fConsoleColorList.getSelectionIndex();
+		if (i == -1) { //bug 85590
+			return;
+		}
 		String key= fAppearanceColorListModel[i][1];
 		RGB rgb= PreferenceConverter.getColor(getPreferenceStore(), key);
 		fConsoleColorEditor.setColorValue(rgb);