fix bug 11762. Fix targettypes for MMP editor to retrieve properly depending on whether build config is SBsv1 or SBSv2. C3_BUILDER_WORK
authortimkelly
Mon, 02 Aug 2010 10:36:48 -0500
branchC3_BUILDER_WORK
changeset 1736 ba74c19c6de3
parent 1733 13355a75b65c
child 1737 ba17d4654040
fix bug 11762. Fix targettypes for MMP editor to retrieve properly depending on whether build config is SBsv1 or SBSv2.
core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SDKCreationTest.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv1BuildInfo.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2ConfigQueryData.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv1BuildInfo.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv2BuildContext.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv2ConfigQueryData.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISDKBuildInfo.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDK.java
project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/OverviewPage.java
--- a/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SDKCreationTest.java	Fri Jul 30 13:18:50 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SDKCreationTest.java	Mon Aug 02 10:36:48 2010 -0500
@@ -66,7 +66,6 @@
 					}
 					assertTrue(sdk.getOSVersion().getMajor() == 0);
 					assertTrue(sbsv1BuildInfo.getPlatformMacros("WINSCW").size() == 0);
-					assertTrue(sdk.getSupportedTargetTypes().size() == 0);
 					File epocRoot = new File(sdk.getEPOCROOT());
 					assertTrue(epocRoot.exists() == false);
 				}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java	Fri Jul 30 13:18:50 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java	Mon Aug 02 10:36:48 2010 -0500
@@ -368,4 +368,9 @@
 		return null;
 	}
 
+	@Override
+	public List<String> getSupportedTargettypes() {
+		return configQueryData.getTargettypes();
+	}
+
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv1BuildInfo.java	Fri Jul 30 13:18:50 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv1BuildInfo.java	Mon Aug 02 10:36:48 2010 -0500
@@ -88,4 +88,19 @@
 	 */
 	List<String> getBuiltinMacros(ISymbianBuildContext context);
 
+	/**
+	 * Get a list of supported targettypes listed by this SDK. This routine parses the 
+	 * \epoc32\tools\trgttype.pm file to build it's list.
+	 * @return A list of targettype names that can be used in an MMP file
+	 */
+	List<String> getSupportedTargetTypes();
+
+	
+	/**
+	 * Returns a list of the macros defined in the variant.cfg file. This is NOT the macros
+	 * in the HRH file, but the actual maros written to the variant.cfg file.
+	 * @return A String list of macros found as is, or an empty list if none.
+	 */
+	List<String> getVariantCFGMacros();
+	
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java	Fri Jul 30 13:18:50 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java	Mon Aug 02 10:36:48 2010 -0500
@@ -120,6 +120,9 @@
 
 	private String contextKey;
 
+	/**
+	 * One of {@link ISymbianBuilderID}
+	 */
 	private String builderId;
 
 	private boolean changed;
@@ -254,18 +257,22 @@
 					hrhFilesParsed.add(inc);
 				}
 				
-				List<String> variantCFGMacros = new ArrayList<String>();
-				variantCFGMacros = sdk.getVariantCFGMacros();
-				for (String cfgMacros : variantCFGMacros){
-					// we don't want duplicate macros, so check to see if it's already there.
-					IDefine existingMacro = namedMacros.get(cfgMacros);
-					if (existingMacro != null) {
-						macros.remove(existingMacro);
+				if (buildInfo instanceof ISBSv1BuildInfo) {
+					// SBSv2 does not parse the variant.cfg file to collect macros.
+					List<String> variantCFGMacros = new ArrayList<String>();
+					
+					variantCFGMacros = ((ISBSv1BuildInfo)buildInfo).getVariantCFGMacros();
+					for (String cfgMacros : variantCFGMacros){
+						// we don't want duplicate macros, so check to see if it's already there.
+						IDefine existingMacro = namedMacros.get(cfgMacros);
+						if (existingMacro != null) {
+							macros.remove(existingMacro);
+						}
+						
+						IDefine macro = DefineFactory.createSimpleFreeformDefine(cfgMacros);
+						macros.add(macro);
+						namedMacros.put(macro.getName(), macro);
 					}
-					
-					IDefine macro = DefineFactory.createSimpleFreeformDefine(cfgMacros);
-					macros.add(macro);
-					namedMacros.put(macro.getName(), macro);
 				}
 			} 
 			
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2ConfigQueryData.java	Fri Jul 30 13:18:50 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2ConfigQueryData.java	Mon Aug 02 10:36:48 2010 -0500
@@ -31,6 +31,7 @@
 	private Map<String, String> buildMacros = new HashMap<String, String>(); // cpp preprocessor macros
 	private Map<String, String> metaDataMacros = new HashMap<String, String>();  // macros to parse the INF/MMPs files (these do not contain values)
 	private List<String> metaDataIncludes = new ArrayList<String>();
+	private List<String> targettypes = new ArrayList<String>();
 	private String buildPrefix = "";
 	private String metaDataVariantHRH = "";
 	private String outputPathString = "";
@@ -61,6 +62,11 @@
 	public Map<String, String> getBuildMacros() {
 		return buildMacros;
 	}
+	
+	@Override
+	public List<String> getTargettypes() {
+		return targettypes;
+	}
 
 	@Override
 	public String getConfigurationErrorMessage() {
@@ -187,6 +193,11 @@
 										buildMacros.put(name, value);
 									} else if (buildChild.getNodeName().equals("preinclude")){
 										buildPrefix = attribs.getNamedItem("file").getNodeValue();
+									} else if (buildChild.getNodeName().equals("targettype")){
+										String targettype = attribs.getNamedItem("name").getNodeValue();
+										if (targettype != null && targettype.length() > 0){
+											targettypes.add(targettype);
+										}
 									}
 								} catch (Exception e) {
 									// skip it
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv1BuildInfo.java	Fri Jul 30 13:18:50 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv1BuildInfo.java	Mon Aug 02 10:36:48 2010 -0500
@@ -25,6 +25,7 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
@@ -58,7 +59,15 @@
 	private List<ISymbianBuildContext> binaryVariantContextList = new ArrayList<ISymbianBuildContext>(0);
 	private List<ISymbianBuildContext> bsfContextList = new ArrayList<ISymbianBuildContext>(0);
 	private Map<String, List<String>> cachedPlatformMacros = new HashMap<String, List<String>>();
+	private List<String> supportedTargetTypesList = new ArrayList<String>();
+	
+	private static final String TARGETTYPE_PM_FILE = "epoc32/tools/trgtype.pm"; //$NON-NLS-1$
+	public static final String VARIANT_CFG_FILE = "epoc32/tools/variant/variant.cfg"; //$NON-NLS-1$
+	public static final String SPP_VARIANT_CFG_FILE = "epoc32/tools/variant/spp_variant.cfg"; //$NON-NLS-1$
 
+	// greedy match means the filename is in the last group
+	public static Pattern VARIANT_HRH_LINE_PATTERN = Pattern.compile("(?i)(.*)(/|\\\\)(.*hrh)");
+	
 	public SBSv1BuildInfo(ISymbianSDK sdk) {
 		this.sdk = sdk;
 	}
@@ -151,9 +160,9 @@
 	public IPath getPrefixFromVariantCfg(){
 		File epocRoot = new File(sdk.getEPOCROOT());
 		File variantCfg;
-		variantCfg = new File(epocRoot, SymbianSDK.SPP_VARIANT_CFG_FILE);
+		variantCfg = new File(epocRoot, SPP_VARIANT_CFG_FILE);
 		if (!variantCfg.exists()) {
-			variantCfg = new File(epocRoot, SymbianSDK.VARIANT_CFG_FILE);
+			variantCfg = new File(epocRoot, VARIANT_CFG_FILE);
 			if (!variantCfg.exists())
 				return null;
 		}
@@ -174,7 +183,7 @@
 				
 				// parse the variant line, which is an EPOCROOT-relative
 				// path to a bldvariant.hrh file
-				Matcher matcher = SymbianSDK.VARIANT_HRH_LINE_PATTERN.matcher(line);
+				Matcher matcher = VARIANT_HRH_LINE_PATTERN.matcher(line);
 				if (matcher.matches()) {
 					variantDir = matcher.group(1);
 					variantFile = matcher.group(3); 
@@ -327,6 +336,93 @@
 		
 		return macros;
 	}
+	
+	// TODO: This needs to move under ISymianBuildContext. For abld we can use this method.
+	// For SBSv2, this is configuration dependent and the information is obtained from
+	// the sbs --query=config[<config>] call.
+	public List<String> getSupportedTargetTypes() {
+		
+		synchronized (supportedTargetTypesList) {
+			if (supportedTargetTypesList.size() > 0){
+				return supportedTargetTypesList;
+			}
+			
+			File epocRoot = new File(sdk.getEPOCROOT());
+			File targetTypePM = new File(epocRoot, TARGETTYPE_PM_FILE);
+			if (!targetTypePM.exists())
+				return supportedTargetTypesList;
+			
+			// greedy match means the filename is in the last group
+			try {
+				char[] cbuf = new char[(int) targetTypePM.length()];
+				Reader reader = new FileReader(targetTypePM);
+				reader.read(cbuf);
+				reader.close();
+				String[] lines = new String(cbuf).split("\r|\r\n|\n");
+				for (int i = 0; i < lines.length; i++) {
+					// skip comments and blank lines
+					String line = SymbianSDK.removeComments(lines[i]);
+					if (line.matches("\\s*#.*") || line.trim().length() == 0) 
+						continue;
+					
+					// parse current line... the slitting could be done better with more efficent reg exp....
+					line = line.trim();
+					line = line.replaceAll(" ", "");
+					if (line.endsWith("=>{")){
+						String[] lineSplit = line.split("=>");
+						if (lineSplit.length == 2 && Character.isLetter(lineSplit[0].charAt(0))){
+							supportedTargetTypesList.add(lineSplit[0]);
+						}
+					}
+				}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
 
+		return supportedTargetTypesList;
+	}
+	
+	@SuppressWarnings("unchecked")
+	public List<String> getVariantCFGMacros(){
+		
+		List<String> variantCFGMacros = new ArrayList<String>();
+		File epocRoot = new File(sdk.getEPOCROOT());
+		File variantCfg;
+		variantCfg = new File(epocRoot, SPP_VARIANT_CFG_FILE);
+		if (!variantCfg.exists()) {
+			variantCfg = new File(epocRoot, VARIANT_CFG_FILE);
+			if (!variantCfg.exists())
+				return Collections.EMPTY_LIST;
+		}
+		
+		try {
+			char[] cbuf = new char[(int) variantCfg.length()];
+			Reader reader = new FileReader(variantCfg);
+			reader.read(cbuf);
+			reader.close();
+			String[] lines = new String(cbuf).split("\r\n|\r|\n");
+			for (int i = 0; i < lines.length; i++) {
+				// skip comments and blank lines
+				String line = SymbianSDK.removeComments(lines[i]);
+				if (line.matches("\\s*#.*") || line.trim().length() == 0) 
+					continue;
+				
+				// parse the variant line, which is an EPOCROOT-relative
+				// path to a bldvariant.hrh file
+				Matcher matcher = VARIANT_HRH_LINE_PATTERN.matcher(line);
+				if (matcher.matches()) {
+					continue; // Skip this it's the file
+				} else {
+					// all other patterns are assumed to be macro
+					variantCFGMacros.add(line.trim());
+				}
+			}
+		} catch (IOException e) {
+		}
+		
+		return variantCFGMacros;
+	}
+	
 
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java	Fri Jul 30 13:18:50 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java	Mon Aug 02 10:36:48 2010 -0500
@@ -70,9 +70,6 @@
 	private static final String PATH_ID_SRCDIR = "srcDir"; //$NON-NLS-1$
 	
 	private static final String RELEASE = "release"; //$NON-NLS-1$
-	public static final String VARIANT_CFG_FILE = "epoc32/tools/variant/variant.cfg"; //$NON-NLS-1$
-	public static final String SPP_VARIANT_CFG_FILE = "epoc32/tools/variant/spp_variant.cfg"; //$NON-NLS-1$
-	private static final String TARGETTYPE_PM_FILE = "epoc32/tools/trgtype.pm"; //$NON-NLS-1$
 	private static final String BUILD_INFO_TXT_FILE = "epoc32/data/buildinfo.txt"; //$NON-NLS-1$
 	private static final String BUILD_INFO_KEYWORD = "ManufacturerSoftwareBuild";
 	
@@ -83,15 +80,11 @@
 	protected DeviceType deviceEntry = null;
 	private boolean enabled = true;
 	private Version osVersion;
-	private List<String> supportedTargetTypesList = new ArrayList<String>();
 	private Map<String, ISDKBuildInfo> buildInfoMap = new HashMap<String, ISDKBuildInfo>();
 	private Map<String, File> prefixFileMap = new HashMap<String, File>();
 	@SuppressWarnings("rawtypes")
 	private Set<Object> sdkFeatures = new HashSet<Object>();
 
-	// greedy match means the filename is in the last group
-	public static Pattern VARIANT_HRH_LINE_PATTERN = Pattern.compile("(?i)(.*)(/|\\\\)(.*hrh)");
-
 	public SymbianSDK(DeviceType device) {
 		deviceEntry = device;
 		scanSDK();
@@ -196,52 +189,6 @@
 		return sdkFeatures;
 	}
 
-	// TODO: This needs to move under ISymianBuildContext. For abld we can use this method.
-	// For SBSv2, this is configuration dependent and the information is obtained from
-	// the sbs --query=config[<config>] call.
-	public List<String> getSupportedTargetTypes() {
-		
-		synchronized (supportedTargetTypesList) {
-			if (supportedTargetTypesList.size() > 0){
-				return supportedTargetTypesList;
-			}
-			
-			File epocRoot = new File(getEPOCROOT());
-			File targetTypePM = new File(epocRoot, TARGETTYPE_PM_FILE);
-			if (!targetTypePM.exists())
-				return supportedTargetTypesList;
-			
-			// greedy match means the filename is in the last group
-			try {
-				char[] cbuf = new char[(int) targetTypePM.length()];
-				Reader reader = new FileReader(targetTypePM);
-				reader.read(cbuf);
-				reader.close();
-				String[] lines = new String(cbuf).split("\r|\r\n|\n");
-				for (int i = 0; i < lines.length; i++) {
-					// skip comments and blank lines
-					String line = removeComments(lines[i]);
-					if (line.matches("\\s*#.*") || line.trim().length() == 0) 
-						continue;
-					
-					// parse current line... the slitting could be done better with more efficent reg exp....
-					line = line.trim();
-					line = line.replaceAll(" ", "");
-					if (line.endsWith("=>{")){
-						String[] lineSplit = line.split("=>");
-						if (lineSplit.length == 2 && Character.isLetter(lineSplit[0].charAt(0))){
-							supportedTargetTypesList.add(lineSplit[0]);
-						}
-					}
-				}
-			} catch (IOException e) {
-				e.printStackTrace();
-			}
-		}
-
-		return supportedTargetTypesList;
-	}
-
 	public IPath getToolsPath() {
 		String epocRoot = getEPOCROOT();
 		if (epocRoot.length() > 0) {
@@ -263,46 +210,7 @@
 		return "";
 	}
 
-	@SuppressWarnings("unchecked")
-	public List<String> getVariantCFGMacros(){
-		
-		List<String> variantCFGMacros = new ArrayList<String>();
-		File epocRoot = new File(getEPOCROOT());
-		File variantCfg;
-		variantCfg = new File(epocRoot, SPP_VARIANT_CFG_FILE);
-		if (!variantCfg.exists()) {
-			variantCfg = new File(epocRoot, VARIANT_CFG_FILE);
-			if (!variantCfg.exists())
-				return Collections.EMPTY_LIST;
-		}
-		
-		try {
-			char[] cbuf = new char[(int) variantCfg.length()];
-			Reader reader = new FileReader(variantCfg);
-			reader.read(cbuf);
-			reader.close();
-			String[] lines = new String(cbuf).split("\r\n|\r|\n");
-			for (int i = 0; i < lines.length; i++) {
-				// skip comments and blank lines
-				String line = removeComments(lines[i]);
-				if (line.matches("\\s*#.*") || line.trim().length() == 0) 
-					continue;
-				
-				// parse the variant line, which is an EPOCROOT-relative
-				// path to a bldvariant.hrh file
-				Matcher matcher = VARIANT_HRH_LINE_PATTERN.matcher(line);
-				if (matcher.matches()) {
-					continue; // Skip this it's the file
-				} else {
-					// all other patterns are assumed to be macro
-					variantCFGMacros.add(line.trim());
-				}
-			}
-		} catch (IOException e) {
-		}
-		
-		return variantCFGMacros;
-	}
+
 
 	public boolean isEnabled() {
 		if (!SDKCorePlugin.SUPPORTS_SBSV1_BUILDER && 
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv2BuildContext.java	Fri Jul 30 13:18:50 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv2BuildContext.java	Mon Aug 02 10:36:48 2010 -0500
@@ -65,5 +65,11 @@
 	 * @return
 	 */
 	public String getPlatformReleaseDirName();
+
+	/**
+	 * Get the supported targettypes for this build configuration
+	 * @return
+	 */
+	public List<String> getSupportedTargettypes();
 	
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv2ConfigQueryData.java	Fri Jul 30 13:18:50 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv2ConfigQueryData.java	Mon Aug 02 10:36:48 2010 -0500
@@ -17,4 +17,5 @@
 	public List<String> getMetaDataIncludes();
 	public String getMetaDataVariantHRH();
 	public String getOutputPathString();
+	public List<String> getTargettypes();
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISDKBuildInfo.java	Fri Jul 30 13:18:50 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISDKBuildInfo.java	Mon Aug 02 10:36:48 2010 -0500
@@ -40,5 +40,5 @@
 	 * @return A path object, or null if the variant.cfg does not exist. This routine does not check to see if the returned path exists.
 	 */
 	public IPath getPrefixFromVariantCfg();
-
+	
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDK.java	Fri Jul 30 13:18:50 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDK.java	Mon Aug 02 10:36:48 2010 -0500
@@ -85,14 +85,7 @@
 	 */
 	@SuppressWarnings("rawtypes")
 	Set getSupportedFeatures();
-	
-	/**
-	 * Get a list of supported targettypes listed by this SDK. This routine parses the 
-	 * \epoc32\tools\trgttype.pm file to build it's list.
-	 * @return A list of targettype names that can be used in an MMP file
-	 */
-	List<String> getSupportedTargetTypes();
-	
+		
 	/**
 	 * Returns an IPath for the epoc32\tools directory of a SDK.
 	 * @return an IPath for the epoc32\tools directory, or <code>null</code>.
@@ -107,13 +100,6 @@
 	String getUniqueId();
 	
 	/**
-	 * Returns a list of the macros defined in the variant.cfg file. This is NOT the macros
-	 * in the HRH file, but the actual maros written to the variant.cfg file.
-	 * @return A String list of macros found as is, or an empty list if none.
-	 */
-	List<String> getVariantCFGMacros();
-	
-	/**
 	 * Returns true if the SDK is enabled, false otherwise.
 	 *
 	 * @return <code>true</code> if the SDK is enabled, and
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/OverviewPage.java	Fri Jul 30 13:18:50 2010 -0500
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/mmpEditor/OverviewPage.java	Mon Aug 02 10:36:48 2010 -0500
@@ -21,7 +21,10 @@
 
 import org.eclipse.jface.dialogs.IPageChangedListener;
 import org.eclipse.jface.dialogs.PageChangedEvent;
-import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.ViewerSorter;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.FormAttachment;
 import org.eclipse.swt.layout.FormData;
@@ -29,7 +32,11 @@
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.layout.RowLayout;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.forms.IManagedForm;
 import org.eclipse.ui.forms.events.HyperlinkAdapter;
 import org.eclipse.ui.forms.events.HyperlinkEvent;
@@ -44,13 +51,18 @@
 import org.osgi.framework.Version;
 
 import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPStatement;
+import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo;
 import com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin;
-import com.nokia.carbide.cpp.internal.project.ui.editors.common.*;
+import com.nokia.carbide.cpp.internal.project.ui.editors.common.ControlHandler;
+import com.nokia.carbide.cpp.internal.project.ui.editors.common.FormUtilities;
 import com.nokia.carbide.cpp.internal.project.ui.mmpEditor.commands.EMMPListSelector;
 import com.nokia.carbide.cpp.internal.project.ui.mmpEditor.commands.EMMPStringValueSelector;
+import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext;
+import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext;
+import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID;
 import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
-import com.nokia.cpp.internal.api.utils.core.*;
-import com.nokia.cpp.internal.api.utils.ui.*;
+import com.nokia.cpp.internal.api.utils.core.TextUtils;
+import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
 import com.nokia.cpp.internal.api.utils.ui.editor.FormEditorEditingContext;
 import com.swtdesigner.ResourceManager;
 import com.swtdesigner.SWTResourceManager;
@@ -340,9 +352,18 @@
 	
 	void refresh() {
 		if (getPartControl() != null) {
+			
 			ISymbianSDK sdk = editorContext.activeBuildConfig.getSDK();
 			List<String> supportedTargetTypes = new ArrayList<String>();
-			List<String> sdkTypes = sdk.getSupportedTargetTypes();
+			List<String> sdkTypes = new ArrayList<String>();
+			if (editorContext.activeBuildConfig.getBuildContext() instanceof ISBSv1BuildContext){
+				ISBSv1BuildInfo sbsv1BuildInfo = ((ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER));
+				sdkTypes = sbsv1BuildInfo.getSupportedTargetTypes();
+			} else if (editorContext.activeBuildConfig.getBuildContext() instanceof ISBSv2BuildContext){
+				ISBSv2BuildContext sbsv2BuildContext = ((ISBSv2BuildContext)editorContext.activeBuildConfig.getBuildContext());
+				sdkTypes = sbsv2BuildContext.getSupportedTargettypes();
+			}
+			
 			// this could come back empty if a devkit is not completely installed
 			if (sdkTypes != null) {
 				supportedTargetTypes.addAll(sdkTypes);