Fix message properties for new SBV parser stuff. Connect SBVPlatform hierarchy from the SBVCatalog.
authortimkelly
Tue, 12 May 2009 14:17:38 -0500
changeset 148 c7e636e6e9cd
parent 147 2bb08686aa38
child 149 0662b9122d01
Fix message properties for new SBV parser stuff. Connect SBVPlatform hierarchy from the SBVCatalog.
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/messages.properties
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVCatalog.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVPlatform.java
project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/messages.properties
project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/sbv/SBVView.java
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/messages.properties	Tue May 12 12:19:40 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/messages.properties	Tue May 12 14:17:38 2009 -0500
@@ -2,3 +2,5 @@
 BSFCatalog.BSFLoadError=Error loading/parsing BSF file: {0}
 BSFCatalog.MissingCustomizedPlatform=BSF platform ''{0}'' customizes platform ''{1}'' which cannot be located or parsed.
 
+SBVCatalog.SBVLoadError=Error loading/parsing VAR file: {0}
+SBVCatalog.MissingCustomizedPlatform=Variant platform ''{0}'' customizes platform ''{1}'' which cannot be located or parsed.
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVCatalog.java	Tue May 12 12:19:40 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVCatalog.java	Tue May 12 14:17:38 2009 -0500
@@ -14,15 +14,16 @@
 
 import java.io.File;
 import java.io.FilenameFilter;
+import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
 
-import com.nokia.carbide.cpp.sdk.core.ISBVCatalog;
-import com.nokia.carbide.cpp.sdk.core.ISBVPlatform;
-import com.nokia.cpp.internal.api.utils.core.IMessage;
+import com.nokia.carbide.cpp.internal.api.sdk.Messages;
+import com.nokia.carbide.cpp.sdk.core.*;
+import com.nokia.cpp.internal.api.utils.core.*;
 
 /**
  * This class defines the hierarchy of VAR files detected for a given SDK.
@@ -58,11 +59,35 @@
 			}
 		}
 		
-		// TODO: Do we need to bother with a hierarchy?
 		// now wire up the platforms
-		//establishPlatformHierarchy();
+		establishPlatformHierarchy();
 	}
 
+	/**
+	 * Iterate the platforms and connect them together
+	 */
+	private void establishPlatformHierarchy() {
+		List<ISBVPlatform> remaining = new ArrayList<ISBVPlatform>(platforms);
+		while (!remaining.isEmpty()) {
+			SBVPlatform current = (SBVPlatform) remaining.remove(0);
+			String variantPlatformName = current.getExtendedVariantName();
+			if (variantPlatformName != null) {
+				ISBVPlatform customizedPlatform = findPlatform(variantPlatformName);
+				if (customizedPlatform == null) {
+					messages.add(new Message(IMessage.ERROR,
+							new MessageLocation(current.getSBVPath()),
+							"SBVCatalog.MissingCustomizedPlatform", //$NON-NLS-1$
+							MessageFormat.format(
+									Messages.getString("SBVCatalog.MissingCustomizedPlatform"), //$NON-NLS-1$
+									new Object[] { current.getName(), variantPlatformName })
+							));
+				} else {
+					current.setExtendedPlatform(customizedPlatform);
+				}
+			}
+		}
+	}
+	
 	/* (non-Javadoc)
 	 * @see com.nokia.carbide.cpp.sdk.core.ISBVCatalog#getMessages()
 	 */
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVPlatform.java	Tue May 12 12:19:40 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVPlatform.java	Tue May 12 14:17:38 2009 -0500
@@ -88,7 +88,7 @@
 	 * Set the customized platform.
 	 * @param customized
 	 */
-	void setCustomizedPlatform(ISBVPlatform customized) {
+	void setExtendedPlatform(ISBVPlatform customized) {
 		Check.checkState(customized != this);
 		this.extendedPlatform = customized;
 		if (customized != null) {
@@ -128,7 +128,7 @@
 	 * @see com.nokia.carbide.cpp.sdk.core.ISBVPlatform#getExtendedVariant()()
 	 */
 	public ISBVPlatform getExtendedVariant() {
-		return catalog.findPlatform(getExtendedVariantName());
+		return extendedPlatform;
 	}
 
 	/**
--- a/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/messages.properties	Tue May 12 12:19:40 2009 -0500
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/messages.properties	Tue May 12 14:17:38 2009 -0500
@@ -234,6 +234,9 @@
 BSFView.InvalidBSFHeader=Did not find BSF header
 BSFView.NoCustomizesStatement=Did not find a CUSTOMIZES statement
 
+SBVParser.UnknownStatement=Invalid syntax for VAR statement
+SBVView.NoCustomizesStatement=Did not find a EXTENDS statement
+
 WorkspaceModelProvider.SavingModelFile.TaskLabel=Saving model file
 EPKGLanguage.0=Afrikaans
 EPKGLanguage.2=Amharic
--- a/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/sbv/SBVView.java	Tue May 12 12:19:40 2009 -0500
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/sbv/SBVView.java	Tue May 12 14:17:38 2009 -0500
@@ -52,7 +52,6 @@
 	
 	private IASTSBVTranslationUnit tu;
 	private String variantName;
-	private boolean sawHeaderComment;
 	private boolean sawExtends;
 	private boolean sawBuildHRH;
 	private String extendsVariantStr;
@@ -81,7 +80,6 @@
 		IDocumentParser sbvParser = ParserFactory.createSBVParser();
 		tu = (IASTSBVTranslationUnit) sbvParser.parse(getModel().getPath(), getModel().getDocument());
 		
-		sawHeaderComment = false;
 		sawExtends = false;
 		sawBuildHRH = false;
 		
@@ -189,13 +187,9 @@
 	@Override
 	protected void addViewSpecificMessages(List<IMessage> messageList) {
 		IPath fullPath = getModel().getPath();
-		if (!sawHeaderComment) {
-			messageList.add(ASTFactory.createErrorMessage("SBVView.InvalidSBVHeader",
-					new Object[0],
-					new MessageLocation(fullPath)));
-		}
+
 		if (!sawExtends) {
-			messageList.add(ASTFactory.createErrorMessage("SBVView.NoCustomizesStatement",
+			messageList.add(ASTFactory.createErrorMessage("SBVView.NoExtendsStatement",
 					new Object[0],
 					new MessageLocation(fullPath)));
 		}