Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
Also, added in a prelim look at SBSv2 Config manager prefs.
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/CarbideConfigurationDataProvider.java Mon Jun 07 10:17:00 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/CarbideConfigurationDataProvider.java Tue Jun 08 10:24:12 2010 -0500
@@ -40,6 +40,7 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.ui.internal.ide.handlers.BuildAllProjectsHandler;
import com.nokia.carbide.cdt.builder.BuildArgumentsInfo;
import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
@@ -171,9 +172,9 @@
return null;
}
String configID = des.getConfiguration().getId();
- String buidAlias = "";
- String platform = "";
- String target = "";
+ String buidAlias = null;
+ String platform = null;
+ String target = null;
String displayString = null;
String variant = "";
String sdkID = null;
@@ -181,6 +182,7 @@
for (ICStorageElement se : rootStorage.getChildren()) {
if (se.getName().equals(
CarbideBuildConfiguration.SBSV2_DATA_ID)) {
+
String value = se.getAttribute(ISBSv2BuildConfigInfo.ATRRIB_CONFIG_BASE_PLATFORM);
if (value != null) {
platform = value;
@@ -206,8 +208,7 @@
displayString = value;
}
- value = se
- .getAttribute(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_SDK_ID);
+ value = se.getAttribute(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_SDK_ID);
if (value != null) {
sdkID = value;
}
@@ -218,23 +219,28 @@
}
ISymbianSDK sdk = null;
- if (sdkID == null){
+ if (!configID.startsWith(ISBSv2BuildContext.BUILDER_ID)){
// pre-C3 project, get SDK id from config name
if (displayString == null){
displayString = configID;
+ }
+ if (sdkID == null){
+ sdkID = BuildContextSBSv2.getSDKIDFromV1ConfigName(displayString);
}
- sdkID = BuildContextSBSv2.getSDKIDFromConfigName(displayString);
+ if (platform == null){
+ platform = BuildContextSBSv2.getPlatformFromV1ConfigName(displayString);
+ }
+ if (target == null){
+ target = BuildContextSBSv2.getTargetFromV1ConfigName(displayString);
+ }
+ if (buidAlias == null){
+ buidAlias = BuildContextSBSv2.getBuildAliasFromV1ConfigName(displayString);
+ }
}
if (sdkID != null){
sdk = SDKCorePlugin.getSDKManager().getSDK(sdkID, true);
// TODO: NEED TO HANDLE MISSING SDK ID
if (sdk != null){
-
- if (displayString == null && !configID.startsWith(ISBSv2BuildContext.BUILDER_ID)){
- displayString = configID; // Old config, used unique 'id' and config name interchangably
- } else {
- displayString = displayString;
- }
return new BuildContextSBSv2(sdk, platform, target, buidAlias, displayString, configID);
}
}
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java Mon Jun 07 10:17:00 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java Tue Jun 08 10:24:12 2010 -0500
@@ -415,13 +415,13 @@
checkIt = true;
}
}
- else if (v2Context.getSBSv2Alias().equals(currV2Context.getSBSv2Alias()) &&
- v2Context.getPlatformString().equals(currExistingConfig.getPlatformString()) &&
- v2Context.getSDK().getUniqueId().equals(currExistingConfig.getSDK().getUniqueId() )
- && v2Context.getSBSv2Alias() != null && v2Context.getSBSv2Alias().split("_").length == 2){
-
- checkIt = true;
- }
+// else if (v2Context.getSBSv2Alias().equals(currV2Context.getSBSv2Alias()) &&
+// v2Context.getPlatformString().equals(currExistingConfig.getPlatformString()) &&
+// v2Context.getSDK().getUniqueId().equals(currExistingConfig.getSDK().getUniqueId() )
+// && v2Context.getSBSv2Alias() != null && v2Context.getSBSv2Alias().split("_").length == 2){
+//
+// checkIt = true;
+// }
}
}
if (checkIt){
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java Mon Jun 07 10:17:00 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java Tue Jun 08 10:24:12 2010 -0500
@@ -15,6 +15,7 @@
import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
+import com.nokia.cpp.internal.api.utils.core.Check;
public class BuildContextSBSv2 implements ISBSv2BuildContext {
@@ -55,41 +56,7 @@
@Override
public String getDisplayString() {
-
-
- // TODO: Still need to decide on how to set display string
- // and how it's used for legacy SBSv2 configs
- if (displayString != null){
- return displayString;
- }
-
- // TODO: else fallback for old configs, we should convert
- String EMULATOR_DISPLAY_TEXT = "Emulator"; //$NON-NLS-1$
- String PHONE_DISPLAY_TEXT = "Phone"; //$NON-NLS-1$
- String DEBUG_DISPLAY_TEXT = "Debug"; //$NON-NLS-1$
- String RELEASE_DISPLAY_TEXT = "Release"; //$NON-NLS-1$
- String SPACE_DISPLAY_TEXT = " "; //$NON-NLS-1$
- String SDK_NOT_INSTALLED = "SDK not installed"; //$NON-NLS-1$
- String displayString = null;
- if (displayString == null) {
- // in the form Emulation Debug (WINSCW) [S60_3rd_MR] or
- // Phone Release (GCCE) [S60_3rd_MR]
- if (platform.compareTo(ISymbianBuildContext.EMULATOR_PLATFORM) == 0) {
- displayString = EMULATOR_DISPLAY_TEXT;
- } else {
- displayString = PHONE_DISPLAY_TEXT;
- }
-
- if (target.compareTo(ISymbianBuildContext.DEBUG_TARGET) == 0) {
- displayString = displayString + SPACE_DISPLAY_TEXT + DEBUG_DISPLAY_TEXT;
- } else {
- displayString = displayString + SPACE_DISPLAY_TEXT + RELEASE_DISPLAY_TEXT;
- }
-
- String basePlatform = sbsv2Alias;
-
- displayString = displayString + " (" + basePlatform + ") [" + getSDK().getUniqueId() + "]"; //$NON-NLS-1$
- }
+ Check.checkState(displayString != null);
return displayString;
}
@@ -302,18 +269,6 @@
return getCachedData().getSystemIncludePaths();
}
-
- // Fall-back to get SDK id from old config name
- public static String getSDKIDFromConfigName(String configName) {
- int indexBegin = configName.indexOf("["); //$NON-NLS-1$
- int indexEnd = configName.indexOf("]"); //$NON-NLS-1$
- if (indexBegin > 0 && indexEnd > 0){
- return configName.substring(indexBegin+1, indexEnd);
- } else {
- return ""; //$NON-NLS-1$
- }
- }
-
@Override
public int hashCode() {
final int prime = 31;
@@ -357,6 +312,44 @@
return true;
}
+ public static String getPlatformFromV1ConfigName(String displayString) {
+ String[] tokens = displayString.split(" ");
+ String sdkIdToken = tokens[2];
+ if (sdkIdToken.contains("_")){
+ sdkIdToken = sdkIdToken.substring(1, sdkIdToken.length()-1);
+ String[] aliasTokens = sdkIdToken.split("_");
+ return aliasTokens[0];
+ } else {
+ return sdkIdToken.substring(1, sdkIdToken.length()-1);
+ }
+ }
+
+ public static String getTargetFromV1ConfigName(String displayString) {
+ String[] tokens = displayString.split(" ");
+ if (tokens[1].compareTo("Debug") == 0) {
+ return ISymbianBuildContext.DEBUG_TARGET;
+ } else {
+ return ISymbianBuildContext.RELEASE_TARGET;
+ }
+ }
+
+ public static String getBuildAliasFromV1ConfigName(String displayString) {
+ String target = getTargetFromV1ConfigName(displayString);
+ String platform = getPlatformFromV1ConfigName(displayString);
+ return platform.toLowerCase() + "_" + target.toLowerCase();
+ }
+
+ // Fall-back to get SDK id from old config name
+ public static String getSDKIDFromV1ConfigName(String configName) {
+ int indexBegin = configName.indexOf("["); //$NON-NLS-1$
+ int indexEnd = configName.indexOf("]"); //$NON-NLS-1$
+ if (indexBegin > 0 && indexEnd > 0){
+ return configName.substring(indexBegin+1, indexEnd);
+ } else {
+ return ""; //$NON-NLS-1$
+ }
+ }
+
}
--- a/core/com.nokia.carbide.cpp.sdk.ui/plugin.properties Mon Jun 07 10:17:00 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/plugin.properties Tue Jun 08 10:24:12 2010 -0500
@@ -1,7 +1,7 @@
// Copyright 2007 Nokia, Inc.
SDKUIPlugin.SDK_Preferences=Symbian SDKs
-SDKUIPlugin.Platform_Filtering_Preferences=Platform Filtering Preferences
+SDKUIPlugin.Platform_Filtering_Preferences=Build Configuration Manager
#Keywords for Carbide preferences
carbcPreference.common=carbide symbian c cpp cplusplus
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/BuildPlatformFilterPage.java Mon Jun 07 10:17:00 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/BuildPlatformFilterPage.java Tue Jun 08 10:24:12 2010 -0500
@@ -38,6 +38,7 @@
SBSv1PlatformFilterComposite sbsv1Tab;
SBSv2PlatformFilterComposite sbsv2Tab;
+ SBSv2ConfigManager sbsConfigManagerTab;
public BuildPlatformFilterPage() {
super();
@@ -61,6 +62,16 @@
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);
+
}
if (SBSv2Utils.enableSBSv1Support()) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2ConfigManager.java Tue Jun 08 10:24:12 2010 -0500
@@ -0,0 +1,226 @@
+package com.nokia.carbide.cpp.internal.api.sdk.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.ComboBoxViewerCellEditor;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
+
+import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv2;
+import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext;
+import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
+import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
+
+public class SBSv2ConfigManager extends Composite {
+
+ private CheckboxTableViewer sbsConfigTableViewer;
+ private List<ISBSv2BuildContext> sbsContexts;
+ List<String> globalBuildAliasList = new ArrayList<String>();
+ List<ISBSv2BuildContext> sbsBuildContexts = new ArrayList<ISBSv2BuildContext>();
+
+ private class SBSv2BuildContextLabelProvider extends LabelProvider implements ITableLabelProvider {
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ ISBSv2BuildContext sdk = (ISBSv2BuildContext) element;
+ switch (columnIndex) {
+ case 1:
+ return sdk.getSBSv2Alias();
+ case 2:
+ return sdk.getBuildVariationName();
+ case 3:
+ return sdk.getDisplayString();
+ default:
+ return "";
+ }
+ }
+ }
+
+ private class BuildAliasEditingSupport extends EditingSupport {
+ private BuildAliasComboEditor editor;
+
+ public BuildAliasEditingSupport(ColumnViewer viewer) {
+ super(viewer);
+ editor = new BuildAliasComboEditor((Composite) viewer.getControl());
+ }
+
+ @Override
+ protected boolean canEdit(Object element) {
+ if (element instanceof ISBSv2BuildContext) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ protected CellEditor getCellEditor(Object element) {
+ return editor;
+ }
+
+ @Override
+ protected Object getValue(Object element) {
+ ISBSv2BuildContext context = (ISBSv2BuildContext) element;
+ return context.getSBSv2Alias();
+ }
+
+ @Override
+ protected void setValue(Object element, Object value) {
+ if (value == null)
+ return;
+
+ ISBSv2BuildContext context = (ISBSv2BuildContext) element;
+
+
+ // TODO: Use real data. Here we can find an existing build context that works, or create a new one if a variant was applied
+ // We would need to run the query here to fill out extra params
+ context = new BuildContextSBSv2(context.getSDK(), "ARMV5", "UDEB", value.toString(), "New Display name", ISBSv2BuildContext.BUILDER_ID + ".arvm5_udeb." + context.getSDK().getUniqueId());
+ // TODO: Handle edit and store data if alias changes
+ getViewer().refresh();
+ }
+ }
+
+ class BuildAliasContentProvider implements IStructuredContentProvider {
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return globalBuildAliasList.toArray();
+ }
+
+ }
+
+ private class BuildAliasComboEditor extends ComboBoxViewerCellEditor {
+ private Text text;
+
+ public BuildAliasComboEditor(Composite parent) {
+ super(parent);
+ }
+
+
+ @Override
+ protected Control createControl(Composite parent) {
+ Control control = super.createControl(parent);
+ this.setContenProvider(new BuildAliasContentProvider());
+ this.setInput(globalBuildAliasList);
+ return control;
+ }
+ }
+
+ public SBSv2ConfigManager(Composite parent) {
+ super(parent, SWT.NONE);
+ }
+
+ public void createControls() {
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ setLayout(gridLayout);
+
+ initData();
+
+ sbsConfigTableViewer = CheckboxTableViewer.newCheckList(this,
+ SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
+ createSBSConfigTable();
+
+ addBuildConfigurationTableItems();
+ }
+
+ private void initData() {
+
+ ////////////////////TODO: DUMMY DATA. GET FROM RAPTOR QUERY
+ globalBuildAliasList.add("armv5_udeb");
+ globalBuildAliasList.add("armv5_urel");
+ globalBuildAliasList.add("winscw_udeb");
+ globalBuildAliasList.add("winscw_urel");
+ globalBuildAliasList.add("tools2_deb");
+ globalBuildAliasList.add("tools2_rel");
+ /////////////////////
+
+ }
+
+ private void createSBSConfigTable() {
+ final Table table = sbsConfigTableViewer.getTable();
+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ gridData.widthHint = 425;
+ gridData.heightHint = table.getItemHeight() * 10;
+ table.setLayoutData(gridData);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(false);
+
+
+ TableViewerColumn enabledCol = new TableViewerColumn(sbsConfigTableViewer, SWT.LEFT);
+ enabledCol.getColumn().setText("Enabled"); //$NON-NLS-1$
+ enabledCol.getColumn().setWidth(50);
+
+ TableViewerColumn aliasCol = new TableViewerColumn(sbsConfigTableViewer, SWT.LEFT);
+ aliasCol.setEditingSupport(new BuildAliasEditingSupport(sbsConfigTableViewer)); //$NON-NLS-1$
+ aliasCol.getColumn().setText("SBS Configuration");
+ aliasCol.getColumn().setWidth(160);
+
+ TableViewerColumn variantCol = new TableViewerColumn(sbsConfigTableViewer, SWT.LEFT);
+ //aliasCol.setEditingSupport(new IdEditingSupport(sbsConfigTableViewer)); //$NON-NLS-1$
+ variantCol.getColumn().setText("Product Variant");
+ variantCol.getColumn().setWidth(120);
+
+ TableViewerColumn displaNameCol = new TableViewerColumn(sbsConfigTableViewer, SWT.LEFT);
+ //aliasCol.setEditingSupport(new IdEditingSupport(sbsConfigTableViewer)); //$NON-NLS-1$
+ displaNameCol.getColumn().setText("Display Name");
+ displaNameCol.getColumn().setWidth(160);
+
+ }
+
+ private void addBuildConfigurationTableItems() {
+ sbsConfigTableViewer.setLabelProvider(new SBSv2BuildContextLabelProvider());
+ sbsConfigTableViewer.setContentProvider(new ArrayContentProvider());
+ sbsContexts = getGlobalSBSContexts();
+ sbsConfigTableViewer.setInput(sbsContexts.toArray());
+ sbsConfigTableViewer.getTable().setToolTipText("TODO Tooltip"); //$NON-NLS-1$
+ setCheckedElements();
+// addSDKTableViewerListeners();
+ if (sbsContexts == null || sbsContexts.size() == 0){
+// statusError(Messages.getString("SDKPreferencePage.No_SDKs_Available_Message")); //$NON-NLS-1$
+ }
+ }
+
+ // TODO: Get context list from SDKManager for SBSv2
+ private List<ISBSv2BuildContext> getGlobalSBSContexts() {
+ List<ISBSv2BuildContext> contexts = new ArrayList<ISBSv2BuildContext>();
+
+ // TODO: DUMMY TEST DATA
+ ISymbianSDK sdk = SDKCorePlugin.getSDKManager().getSDKList().get(0);
+ ISBSv2BuildContext testContext = new BuildContextSBSv2(sdk, "ARMV5", "DEBUG", "arvm5_udeb", "ARMV5 Debug", ISBSv2BuildContext.BUILDER_ID + ".arvm5_udeb." + sdk.getUniqueId());
+ contexts.add(testContext);
+ testContext = new BuildContextSBSv2(sdk, "ARMV5", "Release", "arvm5_urel", "ARMV5 Release", ISBSv2BuildContext.BUILDER_ID + ".arvm5_udeb." + sdk.getUniqueId());
+ contexts.add(testContext);
+
+ return contexts;
+ }
+
+ private void setCheckedElements() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKPropertiesDialog.java Mon Jun 07 10:17:00 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKPropertiesDialog.java Tue Jun 08 10:24:12 2010 -0500
@@ -29,7 +29,6 @@
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;