Update UI for finalizing build config filtering prefs. bug 11285. C3_BUILDER_WORK
authortimkelly
Thu, 24 Jun 2010 16:24:14 -0500
branchC3_BUILDER_WORK
changeset 1542 e94e8b7c075c
parent 1541 71d1c8d0e56d
child 1543 69d5b194482b
Update UI for finalizing build config filtering prefs. bug 11285.
core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/AddSBSv2ProductVariant.java
core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKUIHelpIds.java
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/AddSBSv2ProductVariant.java	Thu Jun 24 15:58:54 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/AddSBSv2ProductVariant.java	Thu Jun 24 16:24:14 2010 -0500
@@ -27,6 +27,10 @@
 import org.eclipse.jface.dialogs.TrayDialog;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
@@ -63,8 +67,6 @@
 		}
 		variantList = productVariantList;
 		defaultAlias = selectedAlias;
-		
-		
 	}
 
 	/**
@@ -77,6 +79,8 @@
 				true);
 		createButton(parent, IDialogConstants.CANCEL_ID,
 				IDialogConstants.CANCEL_LABEL, false);
+		
+		getButton(IDialogConstants.OK_ID).setEnabled(false);
 	}
 
 	/**
@@ -100,6 +104,24 @@
 		Collections.sort(aliasList);
 		aliasCombo.setItems((String[])aliasList.toArray(new String[aliasList.size()]));
 		aliasCombo.select(0);
+		aliasCombo.setEditable(false);
+		aliasCombo.addSelectionListener(new SelectionListener() {
+			public void widgetSelected(SelectionEvent e) {
+				validateData();
+			}
+			public void widgetDefaultSelected(SelectionEvent e) {
+				// ignore
+			}
+		});
+		aliasCombo.addKeyListener(new KeyListener() {
+			public void keyReleased(KeyEvent e) {
+				validateData();
+			}
+			public void keyPressed(KeyEvent e) {
+				
+			}
+		});
+		
 		
 		if (defaultAlias != null && defaultAlias.length() > 0)
 			aliasCombo.setText(defaultAlias);
@@ -114,7 +136,24 @@
 		variantCombo.setLayoutData(new GridData(263, SWT.DEFAULT));
 		Collections.sort(variantList);
 		variantCombo.setItems((String[])variantList.toArray(new String[variantList.size()]));
-
+		variantCombo.addSelectionListener(new SelectionListener() {
+			public void widgetSelected(SelectionEvent e) {
+				validateData();
+			}
+			public void widgetDefaultSelected(SelectionEvent e) {
+				// ignore
+			}
+		});
+		variantCombo.addKeyListener(new KeyListener() {
+			public void keyReleased(KeyEvent e) {
+				validateData();
+			}
+			public void keyPressed(KeyEvent e) {
+				
+			}
+		});
+		
+		
 		PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, SDKUIHelpIds.SDK_ADD_DIALOG);
 		return container;
 	}
@@ -165,5 +204,21 @@
 	public String getUserCreatedVariant() {
 		return newConfigString;
 	}
+	
+	private void validateData(){
+		if (variantCombo.getText().length() > 0){
+			getButton(IDialogConstants.OK_ID).setEnabled(true);
+		} else {
+			getButton(IDialogConstants.OK_ID).setEnabled(false);
+			return;
+		}
+		
+		if (aliasCombo.getText().length() > 0){
+			getButton(IDialogConstants.OK_ID).setEnabled(true);
+		} else {
+			getButton(IDialogConstants.OK_ID).setEnabled(false);
+			return;
+		}
+	}
 
 }
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKUIHelpIds.java	Thu Jun 24 15:58:54 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKUIHelpIds.java	Thu Jun 24 16:24:14 2010 -0500
@@ -28,5 +28,6 @@
 	public static final String SDK_PROPERTIES_DIALOG = SDKUIPlugin.PLUGIN_ID + ".sdk_properties_dialog"; //$NON-NLS-1$
 	public static final String SDK_BUILD_FILTER_PAGE = SDKUIPlugin.PLUGIN_ID + ".sdk_platform_filter_page"; //$NON-NLS-1$
 	public static final String BUILD_TARGETS_PAGE = SDKUIPlugin.PLUGIN_ID + ".build_targets_page"; //$NON-NLS-1$
+	public static final String ADD_VARIANT_DIALOG = SDKUIPlugin.PLUGIN_ID + ".sdk_variant_dialog"; //$NON-NLS-1$
 }