X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fplatform%2Fui%2FFpdFileContents.java;h=b9e772e0b3b868716eb47cd358d2621fdbb7f642;hb=6a09eb19cee6549a68a030e608435a1f73c79379;hp=3d34eb5b63d44cd39dd1f03bea19a6d162fc4c12;hpb=6cba26e882bc3c55c0f91d4fa9fe19568f4564c6;p=mirror_edk2.git diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java index 3d34eb5b63..b9e772e0b3 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.ListIterator; import java.util.Map; import java.util.Set; +import java.util.Vector; import javax.xml.namespace.QName; @@ -36,6 +37,7 @@ import org.tianocore.EfiSectionType; import org.tianocore.FlashDefinitionFileDocument; import org.tianocore.FlashDocument; import org.tianocore.FrameworkModulesDocument; +import org.tianocore.IntermediateOutputType; import org.tianocore.LibrariesDocument; import org.tianocore.ModuleSADocument; import org.tianocore.ModuleSurfaceAreaDocument; @@ -172,29 +174,6 @@ public class FpdFileContents { return fpdFrameworkModules; } - public int getPlatformDefsSkuInfoCount(){ - if (getfpdPlatformDefs().getSkuInfo() == null || getfpdPlatformDefs().getSkuInfo().getUiSkuNameList() == null) { - return 0; - } - return getfpdPlatformDefs().getSkuInfo().getUiSkuNameList().size(); - } - - public void getPlatformDefsSkuInfos(String[][] saa){ - if (getfpdPlatformDefs().getSkuInfo() == null || getfpdPlatformDefs().getSkuInfo().getUiSkuNameList() == null) { - return ; - } - - List l = getfpdPlatformDefs().getSkuInfo().getUiSkuNameList(); - ListIterator li = l.listIterator(); - int i = 0; - while(li.hasNext()) { - SkuInfoDocument.SkuInfo.UiSkuName sku = li.next(); - saa[i][0] = sku.getSkuID()+""; - saa[i][1] = sku.getStringValue(); - ++i; - } - } - public int getFrameworkModulesCount() { if (getfpdFrameworkModules().getModuleSAList() == null){ return 0; @@ -1169,6 +1148,13 @@ public class FpdFileContents { } } + public void updateBuildOptionsFfsSectionsType(int i, String type) { + BuildOptionsDocument.BuildOptions.Ffs ffs = getfpdBuildOpts().addNewFfs(); + if (type != null) { + ffs.addNewSections().setEncapsulationType(type); + } + } + public void genBuildOptionsFfsAttribute(int i, String name, String value) { BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i); BuildOptionsDocument.BuildOptions.Ffs.Attribute attrib = ffs.addNewAttribute(); @@ -1221,6 +1207,41 @@ public class FpdFileContents { sections.addNewSection().setSectionType(EfiSectionType.Enum.forString(sectionType)); } + public void removeBuildOptionsFfsSectionsSection(int i, int j) { + BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i); + BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections(); + if (sections == null) { + return; + } + XmlCursor cursor = sections.newCursor(); + QName qSection = new QName(xmlNs, "Section"); + if (cursor.toChild(qSection)) { + for (int k = 0; k < j; ++k) { + cursor.toNextSibling(qSection); + } + cursor.removeXml(); + } + cursor.dispose(); + } + + public void updateBuildOptionsFfsSectionsSection(int i, int j, String type){ + BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i); + BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections(); + if (sections == null) { + return; + } + XmlCursor cursor = sections.newCursor(); + QName qSection = new QName(xmlNs, "Section"); + if (cursor.toChild(qSection)) { + for (int k = 0; k < j; ++k) { + cursor.toNextSibling(qSection); + } + BuildOptionsDocument.BuildOptions.Ffs.Sections.Section section = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Section)cursor.getObject(); + section.setSectionType(EfiSectionType.Enum.forString(type)); + } + cursor.dispose(); + } + public void genBuildOptionsFfsSectionsSections(int i, String encapType) { BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i); if (ffs == null) { @@ -1234,6 +1255,41 @@ public class FpdFileContents { sections.addNewSections().setEncapsulationType(encapType); } + public void removeBuildOptionsFfsSectionsSections(int i, int j) { + BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i); + BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections(); + if (sections == null) { + return; + } + XmlCursor cursor = sections.newCursor(); + QName qSections = new QName(xmlNs, "Sections"); + if (cursor.toChild(qSections)) { + for (int k = 0; k < j; ++k) { + cursor.toNextSibling(qSections); + } + cursor.removeXml(); + } + cursor.dispose(); + } + + public void updateBuildOptionsFfsSectionsSections(int i, int j, String type) { + BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i); + BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections(); + if (sections == null) { + return; + } + XmlCursor cursor = sections.newCursor(); + QName qSections = new QName(xmlNs, "Sections"); + if (cursor.toChild(qSections)) { + for (int k = 0; k < j; ++k) { + cursor.toNextSibling(qSections); + } + BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2 sections2 = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2)cursor.getObject(); + sections2.setEncapsulationType(type); + } + cursor.dispose(); + } + public void genBuildOptionsFfsSectionsSectionsSection(int i, int j, String type) { BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i); if (ffs == null) { @@ -1252,6 +1308,51 @@ public class FpdFileContents { cursor.dispose(); } + public void removeBuildOptionsFfsSectionsSectionsSection(int i, int j, int k) { + BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i); + BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections(); + if (sections == null) { + return; + } + XmlCursor cursor = sections.newCursor(); + QName qSections = new QName(xmlNs, "Sections"); + if (cursor.toChild(qSections)) { + for (int l = 0; l < j; ++l) { + cursor.toNextSibling(qSections); + } + if (cursor.toFirstChild()) { + for (int m = 0; m < k; ++m) { + cursor.toNextSibling(); + } + cursor.removeXml(); + } + } + cursor.dispose(); + } + + public void updateBuildOptionsFfsSectionsSectionsSection(int i, int j, int k, String type) { + BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i); + BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections(); + if (sections == null) { + return; + } + XmlCursor cursor = sections.newCursor(); + QName qSections = new QName(xmlNs, "Sections"); + if (cursor.toChild(qSections)) { + for (int l = 0; l < j; ++l) { + cursor.toNextSibling(qSections); + } + if (cursor.toFirstChild()) { + for (int m = 0; m < k; ++m) { + cursor.toNextSibling(); + } + BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section section = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section)cursor.getObject(); + section.setSectionType(EfiSectionType.Enum.forString(type)); + } + } + cursor.dispose(); + } + public void getBuildOptionsFfsSectionsSectionsSection(int i, int j, ArrayList al) { BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i); if (ffs == null) { @@ -1272,8 +1373,11 @@ public class FpdFileContents { ListIterator li = sections2.getSectionList().listIterator(); while(li.hasNext()) { BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section section = li.next(); + if (section.isSetSectionType()) { al.add(section.getSectionType().toString()); } + + } } cursor.dispose(); @@ -1299,6 +1403,11 @@ public class FpdFileContents { } } + public void updateBuildOptionsFfsKey(int i, String key) { + BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i); + ffs.setFfsKey(key); + } + /**Get ith FFS key and contents. * @param saa */ @@ -1365,6 +1474,8 @@ public class FpdFileContents { cursor.dispose(); } + + public PlatformDefinitionsDocument.PlatformDefinitions getfpdPlatformDefs(){ if (fpdPlatformDefs == null){ fpdPlatformDefs = fpdRoot.addNewPlatformDefinitions(); @@ -1372,6 +1483,129 @@ public class FpdFileContents { return fpdPlatformDefs; } + public void getPlatformDefsSupportedArchs(Vector archs){ + if (getfpdPlatformDefs().getSupportedArchitectures() == null) { + return; + } + ListIterator li = getfpdPlatformDefs().getSupportedArchitectures().listIterator(); + while(li.hasNext()) { + archs.add(li.next()); + } + } + + public void setPlatformDefsSupportedArchs(Vector archs) { + getfpdPlatformDefs().setSupportedArchitectures(archs); + } + + public void getPlatformDefsBuildTargets(Vector targets) { + if (getfpdPlatformDefs().getBuildTargets() == null) { + return; + } + ListIterator li = getfpdPlatformDefs().getBuildTargets().listIterator(); + while(li.hasNext()) { + targets.add(li.next()); + } + } + + public void setPlatformDefsBuildTargets(Vector targets) { + getfpdPlatformDefs().setBuildTargets(targets); + } + + public void genPlatformDefsSkuInfo(String id, String name) { + SkuInfoDocument.SkuInfo skuInfo = null; + if (getfpdPlatformDefs().getSkuInfo() == null) { + skuInfo = getfpdPlatformDefs().addNewSkuInfo(); + } + skuInfo = getfpdPlatformDefs().getSkuInfo(); + if (skuInfo.getUiSkuNameList() == null || skuInfo.getUiSkuNameList().size() == 0) { + SkuInfoDocument.SkuInfo.UiSkuName skuName = skuInfo.addNewUiSkuName(); + skuName.setSkuID(new BigInteger("0")); + skuName.setStringValue("DEFAULT"); + } + if (id.equals("0")) { + return; + } + SkuInfoDocument.SkuInfo.UiSkuName skuName = skuInfo.addNewUiSkuName(); + skuName.setSkuID(new BigInteger(id)); + skuName.setStringValue(name); + } + + public int getPlatformDefsSkuInfoCount(){ + if (getfpdPlatformDefs().getSkuInfo() == null || getfpdPlatformDefs().getSkuInfo().getUiSkuNameList() == null) { + return 0; + } + return getfpdPlatformDefs().getSkuInfo().getUiSkuNameList().size(); + } + + public void getPlatformDefsSkuInfos(String[][] saa){ + if (getfpdPlatformDefs().getSkuInfo() == null || getfpdPlatformDefs().getSkuInfo().getUiSkuNameList() == null) { + return ; + } + + List l = getfpdPlatformDefs().getSkuInfo().getUiSkuNameList(); + ListIterator li = l.listIterator(); + int i = 0; + while(li.hasNext()) { + SkuInfoDocument.SkuInfo.UiSkuName sku = li.next(); + saa[i][0] = sku.getSkuID()+""; + saa[i][1] = sku.getStringValue(); + ++i; + } + } + + public void removePlatformDefsSkuInfo(int i) { + SkuInfoDocument.SkuInfo skuInfo = getfpdPlatformDefs().getSkuInfo(); + if (skuInfo == null || i == 0) { + return ; + } + + XmlCursor cursor = skuInfo.newCursor(); + if (cursor.toFirstChild()) { + for (int j = 0; j < i; ++j) { + cursor.toNextSibling(); + } + cursor.removeXml(); + } + cursor.dispose(); + } + + public void updatePlatformDefsSkuInfo(int i, String id, String name) { + SkuInfoDocument.SkuInfo skuInfo = getfpdPlatformDefs().getSkuInfo(); + if (skuInfo == null || i == 0) { + return ; + } + + XmlCursor cursor = skuInfo.newCursor(); + if (cursor.toFirstChild()) { + for (int j = 0; j < i; ++j) { + cursor.toNextSibling(); + } + SkuInfoDocument.SkuInfo.UiSkuName sku = (SkuInfoDocument.SkuInfo.UiSkuName)cursor.getObject(); + sku.setSkuID(new BigInteger(id)); + sku.setStringValue(name); + } + cursor.dispose(); + } + + public String getPlatformDefsInterDir(){ + if (getfpdPlatformDefs().getIntermediateDirectories() == null) { + return null; + } + return getfpdPlatformDefs().getIntermediateDirectories().toString(); + } + + public void setPlatformDefsInterDir(String interDir){ + getfpdPlatformDefs().setIntermediateDirectories(IntermediateOutputType.Enum.forString(interDir)); + } + + public String getPlatformDefsOutputDir() { + return getfpdPlatformDefs().getOutputDirectory(); + } + + public void setPlatformDefsOutputDir(String outputDir) { + getfpdPlatformDefs().setOutputDirectory(outputDir); + } + public FlashDocument.Flash getfpdFlash() { if (fpdFlash == null) { fpdFlash = fpdRoot.addNewFlash(); @@ -1656,26 +1890,6 @@ public class FpdFileContents { return fpdHdr; } - public void genPlatformDefsSkuInfo(String id, String name) { - SkuInfoDocument.SkuInfo skuInfo = null; - if (getfpdPlatformDefs().getSkuInfo() == null) { - skuInfo = getfpdPlatformDefs().addNewSkuInfo(); - } - skuInfo = getfpdPlatformDefs().getSkuInfo(); - if (skuInfo.getUiSkuNameList() == null || skuInfo.getUiSkuNameList().size() == 0) { - SkuInfoDocument.SkuInfo.UiSkuName skuName = skuInfo.addNewUiSkuName(); - skuName.setSkuID(new BigInteger("0")); - skuName.setStringValue("DEFAULT"); - } - if (id.equals("0")) { - return; - } - SkuInfoDocument.SkuInfo.UiSkuName skuName = skuInfo.addNewUiSkuName(); - skuName.setSkuID(new BigInteger(id)); - skuName.setStringValue(name); - - - } public String getFpdHdrPlatformName() { return getFpdHdr().getPlatformName(); }