merge commit C3_BUILDER_WORK
authortimkelly
Fri, 18 Jun 2010 17:11:00 -0500
branchC3_BUILDER_WORK
changeset 1498 2391353b9c2a
parent 1497 440c4eac1a5a (diff)
parent 1496 955e25610999 (current diff)
child 1499 05dee993230e
merge commit
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java	Fri Jun 18 12:03:24 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java	Fri Jun 18 17:11:00 2010 -0500
@@ -68,6 +68,7 @@
 import com.nokia.cpp.internal.api.utils.core.Check;
 import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
 
+@SuppressWarnings("restriction")
 public class ManageConfigurationsDialog extends TrayDialog {
 	
 	protected ContainerCheckedTreeViewer properSdkViewer;
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildManager.java	Fri Jun 18 12:03:24 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildManager.java	Fri Jun 18 17:11:00 2010 -0500
@@ -389,19 +389,22 @@
 				CarbideBuilderPlugin.getDefault().getPreferenceStore().setValue(CONVERTED_SRC_MAPPINGS_2X_TO_3X, true);
 			}
 
-			synchronized(projectInfoMap){
-				for (IProject currPrj : projectInfoMap.keySet()){
-					try {
-					ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(currPrj);
-					if (projDes != null) {
-						CCorePlugin.getDefault().setProjectDescription(currPrj, projDes, true, null);
-					}
-					} catch (CoreException e) {
-						e.printStackTrace();
-						CarbideBuilderPlugin.log(e);
-					}
-				}
-			}
+			// TODO: This is causing deadlocks with the indexer and generally when other project info is being retrieved
+			// Need to consider what this is actually doing and why it even needs to be here.
+			
+//			synchronized(projectInfoMap){
+//				for (IProject currPrj : projectInfoMap.keySet()){
+//					try {
+//					ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(currPrj);
+//					if (projDes != null) {
+//						CCorePlugin.getDefault().setProjectDescription(currPrj, projDes, true, null);
+//					}
+//					} catch (CoreException e) {
+//						e.printStackTrace();
+//						CarbideBuilderPlugin.log(e);
+//					}
+//				}
+//			}
 		}
 	}
 
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java	Fri Jun 18 12:03:24 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java	Fri Jun 18 17:11:00 2010 -0500
@@ -359,7 +359,6 @@
 
 	public static HashMap<String, String> getCompleteAliasList() throws SBSv2MinimumVersionException {
 		HashMap<String, String> resultMap = new HashMap<String, String>();
-		//return getAliasesForSDK(null);
 		
 		// iterate all SDKs and build the map up
 		for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()){
@@ -376,5 +375,22 @@
 		return resultMap;
 	}
 	
+	public static List<String> getCompleteProductVariantList() throws SBSv2MinimumVersionException {
+		List<String> resultList = new ArrayList<String>();
+		
+		// iterate all SDKs and build the map up
+		for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()){
+			if (sdk.isEnabled() && (new File(sdk.getEPOCROOT()).exists())){
+				List<String> productList = getProductVariantsForSDK(sdk);
+				for (String variant : productList){
+					if (!resultList.contains(variant)){
+						resultList.add(variant);
+					}
+				}
+			}
+		}
+		
+		return resultList;
+	}
 	
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java	Fri Jun 18 12:03:24 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java	Fri Jun 18 17:11:00 2010 -0500
@@ -145,6 +145,7 @@
 				// ignore, previous exception would have caught the error
 			}
 			for (String alias : newContextsToQuery){
+				// TODO: Need to test for variants. Right now variants are not added
 				if (aliasToMeaningMap.get(alias) == null){
 					continue; // This alias is not valid with this SDK, ignore
 				}
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/BuildPlatformFilterPage.java	Fri Jun 18 12:03:24 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/BuildPlatformFilterPage.java	Fri Jun 18 17:11:00 2010 -0500
@@ -62,15 +62,17 @@
 			sbsv2Tab = new SBSv2PlatformFilterComposite(tabFolder);
 			sbsv2Tab.createControls();
 			sbsv2TabItem.setControl(sbsv2Tab);
-			
-			// New SBS config manager, to replace SBSv2PlatformFilterComposite
-			TabItem sbsConfigMgrItem = new TabItem(tabFolder, SWT.NONE);
-			sbsConfigMgrItem.setText("SBS Configuration Manager"); //$NON-NLS-1$
-			sbsConfigMgrItem.setToolTipText("TODO"); //$NON-NLS-1$
-
-			sbsConfigManagerTab = new SBSv2ConfigManager(tabFolder);
-			sbsConfigManagerTab.createControls();
-			sbsConfigMgrItem.setControl(sbsConfigManagerTab);
+	
+			// TODO: We will likely remove this suggested approach
+			// which means removing the SBSv2PlatformFilterComposite page too
+//			// New SBS config manager, to replace SBSv2PlatformFilterComposite
+//			TabItem sbsConfigMgrItem = new TabItem(tabFolder, SWT.NONE);
+//			sbsConfigMgrItem.setText("SBS Configuration Manager"); //$NON-NLS-1$
+//			sbsConfigMgrItem.setToolTipText("TODO"); //$NON-NLS-1$
+//
+//			sbsConfigManagerTab = new SBSv2ConfigManager(tabFolder);
+//			sbsConfigManagerTab.createControls();
+//			sbsConfigMgrItem.setControl(sbsConfigManagerTab);
 			
 		}
 		
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java	Fri Jun 18 12:03:24 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java	Fri Jun 18 17:11:00 2010 -0500
@@ -22,6 +22,7 @@
 import java.util.List;
 
 import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.TrayDialog;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.CheckboxTableViewer;
 import org.eclipse.jface.viewers.LabelProvider;
@@ -38,6 +39,7 @@
 import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
 import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2MinimumVersionException;
 import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2QueryUtils;
+import com.nokia.carbide.cpp.internal.sdk.ui.AddSBSv2ProductVariant;
 import com.nokia.carbide.cpp.internal.sdk.ui.Messages;
 import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
 
@@ -51,9 +53,12 @@
 	// when needed and that the data we are getting is properly cached to avoid
 	// having to run Raptor queries too often
 	private static HashMap<String, String> aliasMap = new HashMap<String, String>();
+	private static List<String> productVariantList = new ArrayList<String>();
 	
-	private CheckboxTableViewer tableViewer;
+	private CheckboxTableViewer buildAliasTableViewer;
+	private CheckboxTableViewer customVariantTableViewer;
 	private Button refreshButton;
+	private Button addVariantButton;
 
 	
 	SBSv2PlatformFilterComposite(Composite parent) {
@@ -62,26 +67,42 @@
 
 	public void createControls() {
 		GridLayout gridLayout = new GridLayout();
+		gridLayout.numColumns =  2;
 		setLayout(gridLayout);
 		
-		Group platformsGroup = new Group(this, SWT.NONE);
-		platformsGroup.setText(Messages.getString("SBSv2PlatformFilterComposite.PlatformsGroupText")); //$NON-NLS-1$
-		platformsGroup.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.PlatformsGroupToolTip")); //$NON-NLS-1$
+		Group aliasGroup = new Group(this, SWT.NONE);
+		aliasGroup.setText(Messages.getString("SBSv2PlatformFilterComposite.PlatformsGroupText")); //$NON-NLS-1$
+		aliasGroup.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.PlatformsGroupToolTip")); //$NON-NLS-1$
 		GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
-		gd.widthHint = 350;
-		platformsGroup.setLayoutData(gd);
-		platformsGroup.setLayout(new GridLayout());
+		gd.widthHint = 200;
+		gd.heightHint = 350;
+		aliasGroup.setLayoutData(gd);
+		aliasGroup.setLayout(new GridLayout());
 
-		tableViewer = CheckboxTableViewer.newCheckList(platformsGroup, SWT.BORDER);
-		tableViewer.getTable().setLayoutData(gd);
-		tableViewer.setContentProvider(new ArrayContentProvider());
-		tableViewer.setLabelProvider(new LabelProvider());
+		buildAliasTableViewer = CheckboxTableViewer.newCheckList(aliasGroup, SWT.BORDER);
+		buildAliasTableViewer.getTable().setLayoutData(gd);
+		buildAliasTableViewer.setContentProvider(new ArrayContentProvider());
+		buildAliasTableViewer.setLabelProvider(new LabelProvider());
+		
+		Group customConfigGroup = new Group(this, SWT.NONE);
+		customConfigGroup.setText(Messages.getString("SBSv2PlatformFilterComposite.ProductsGroupText")); //$NON-NLS-1$
+		customConfigGroup.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.ProductsGroupToolTip")); //$NON-NLS-1$
+		GridData gd2 = new GridData(SWT.FILL, SWT.CENTER, true, false);
+		gd2.widthHint = 200;
+		gd2.heightHint = 350;
+		customConfigGroup.setLayoutData(gd2);
+		customConfigGroup.setLayout(new GridLayout());
+		
+		customVariantTableViewer = CheckboxTableViewer.newCheckList(customConfigGroup, SWT.BORDER);
+		customVariantTableViewer.getTable().setLayoutData(gd);
+		customVariantTableViewer.setContentProvider(new ArrayContentProvider());
+		customVariantTableViewer.setLabelProvider(new LabelProvider());
 		
 		refreshButton = new Button(this, SWT.NONE);		
 		refreshButton.setText(Messages.getString("SBSv2PlatformFilterComposite.RefreshButtonText")); //$NON-NLS-1$
 		refreshButton.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.RefreshButtonToolTip")); //$NON-NLS-1$
 		refreshButton.addSelectionListener(new SelectionListener() {
-
+			
 			public void widgetDefaultSelected(SelectionEvent e) {
 				widgetSelected(e);
 			}
@@ -92,14 +113,44 @@
 			
 		});
 		
+		addVariantButton = new Button(this, SWT.NONE);		
+		addVariantButton.setText(Messages.getString("SBSv2PlatformFilterComposite.AddProductButtonText")); //$NON-NLS-1$
+		addVariantButton.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.AddProductButtonToolTip")); //$NON-NLS-1$
+		addVariantButton.addSelectionListener(new SelectionListener() {
+			
+			public void widgetDefaultSelected(SelectionEvent e) {widgetSelected(e);}
+			public void widgetSelected(SelectionEvent e) {
+				if (aliasMap.size() == 0){
+					MessageDialog.openError(getShell(), "No build configurations found.", "No build configurations (aliases) were found from any SDKs. Attempted 'sbs --query=aliases' but found no results.");
+				} else if  (productVariantList.size() == 0){
+						MessageDialog.openError(getShell(), "No products found.", "No products were found from any SDKs. Attempted 'sbs --query=products' but found no results.");
+				} else {
+					AddSBSv2ProductVariant addVariantDlg = new AddSBSv2ProductVariant(getShell(), aliasMap, productVariantList);
+					if (addVariantDlg.open() == TrayDialog.OK){
+						if (customVariantTableViewer.testFindItem(addVariantDlg.getUserCreatedVariant()) == null){
+							// doesn't exist, add it. if it does exist just ignore it
+							customVariantTableViewer.add(addVariantDlg.getUserCreatedVariant());
+							customVariantTableViewer.setChecked(addVariantDlg.getUserCreatedVariant(), true);
+						}
+					}
+				}
+			}
+			
+		});
 		initTable(false);
 	}
 
 	public void performOk() {
 		// save the list of unchecked configs
 		List<String> checkedConfigs = new ArrayList<String>();
-		for (TableItem item : tableViewer.getTable().getItems()) {
-			if (tableViewer.getChecked(item.getData())) {
+		for (TableItem item : buildAliasTableViewer.getTable().getItems()) {
+			if (buildAliasTableViewer.getChecked(item.getData())) {
+				checkedConfigs.add(item.getText());
+			}
+		}
+		
+		for (TableItem item : customVariantTableViewer.getTable().getItems()) {
+			if (customVariantTableViewer.getChecked(item.getData())) {
 				checkedConfigs.add(item.getText());
 			}
 		}
@@ -126,39 +177,70 @@
 			} 
 		}
 		
-		List<String> sbsAliases = new ArrayList<String>();
-		for (String key : aliasMap.keySet())
+		if (productVariantList.size() == 0){
+			try {
+				productVariantList = SBSv2QueryUtils.getCompleteProductVariantList();
+			} catch (SBSv2MinimumVersionException e) {
+				
+			}
+		}
+		// get saved configs in the store
+		List<String> checkedConfigsFromStore = SBSv2Utils.getSBSv2FilteredConfigPreferences();
+		
+		List<String> sbsAliases = new ArrayList<String>(); // global build aliases
+		List<String> savedVariants = new ArrayList<String>(); // custom variants
+		for (String key : aliasMap.keySet()){
 			sbsAliases.add(key);
+		}
+		
+		for (String config : checkedConfigsFromStore){
+			if (config.contains(".")){
+				savedVariants.add(config);
+			}
+		}
+		
 		Collections.sort(sbsAliases);
-		tableViewer.setInput(sbsAliases);
+		buildAliasTableViewer.setInput(sbsAliases);
+		customVariantTableViewer.setInput(savedVariants);
 		
 		// check all configs
-		tableViewer.setAllChecked(false);
+		buildAliasTableViewer.setAllChecked(false);
+		customVariantTableViewer.setAllChecked(true);
+		
 		
-		// now check ones from the store
-		List<String> uncheckedConfigs = SBSv2Utils.getSBSv2FilteredConfigPreferences();
-		for (String config : uncheckedConfigs) {
-			for (TableItem item : tableViewer.getTable().getItems()) {
-				if (item.getText().equals(config)) {
-					tableViewer.setChecked(item.getData(), true);
+		for (String config : checkedConfigsFromStore) {
+			for (TableItem item : buildAliasTableViewer.getTable().getItems()) {
+				if (item.getText().equals(config) && !item.getText().contains(".")) {
+					buildAliasTableViewer.setChecked(item.getData(), true);
 					break;
 				}
 			}
 		}
+		
+		for (String config : checkedConfigsFromStore) {
+			for (TableItem item : customVariantTableViewer.getTable().getItems()) {
+				if (item.getText().equals(config) && item.getText().contains(".")) {
+					customVariantTableViewer.setChecked(item.getData(), true);
+					break;
+				}
+			}
+		}
+		
+		
 	}
 	
 	public void setDefaults(){
 		initTable(true);
-		for (TableItem item : tableViewer.getTable().getItems()) {
+		for (TableItem item : buildAliasTableViewer.getTable().getItems()) {
 			if (item.getText().toLowerCase().equals("armv5_udeb")  || 
 				item.getText().toLowerCase().equals("armv5_urel") ||
 				item.getText().toLowerCase().equals("armv5_udeb_gcce")  || 
 				item.getText().toLowerCase().equals("armv5_urel_gcce") ||
 				item.getText().toLowerCase().equals("winscw_udeb")  ||
 				item.getText().toLowerCase().equals("winscw_urel")) {
-				tableViewer.setChecked(item.getData(), true);
+				buildAliasTableViewer.setChecked(item.getData(), true);
 			} else {
-				tableViewer.setChecked(item.getData(), false);
+				buildAliasTableViewer.setChecked(item.getData(), false);
 			}
 		}
 	}
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties	Fri Jun 18 12:03:24 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties	Fri Jun 18 17:11:00 2010 -0500
@@ -80,7 +80,12 @@
 
 SBSv2PlatformFilterComposite.PlatformsGroupText=SBSv2 Configurations Filter
 SBSv2PlatformFilterComposite.PlatformsGroupToolTip=Uncheck the SBSv2 build configurations to hide from the list of available configurations when creating a project.
-SBSv2PlatformFilterComposite.RefreshButtonText=Refresh
-SBSv2PlatformFilterComposite.RefreshButtonToolTip=Forces the configuration xml files in SBSv2 to be parsed again.
+SBSv2PlatformFilterComposite.RefreshButtonText=Scan SBS for Configurations
+SBSv2PlatformFilterComposite.RefreshButtonToolTip=Queries your sbs and sdk installation for allowable build configurations.
+
+SBSv2PlatformFilterComposite.ProductsGroupText=Custom Product Configurations
+SBSv2PlatformFilterComposite.ProductsGroupToolTip=Checked configurations will be displayed under the SDK where they are valid. Unchecked configurations will be removed from this preference page.
+SBSv2PlatformFilterComposite.AddProductButtonText=Add Product Variant
+SBSv2PlatformFilterComposite.AddProductButtonToolTip=Create a new build alias with a product variant you can use as a build configuration.