1. Fix EDKT434: After Workspace is changed, Wizard should close all (desktop area and tree area) and refresh automatically.

2. Fix EDKT340: Search needs to provided a way to display Selected PCD information.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1834 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
hche10x 2006-10-24 01:29:36 +00:00
parent e47b06c339
commit d12f87d3b1
6 changed files with 438 additions and 94 deletions

View File

@ -3374,6 +3374,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
// Refrash the tree
//
this.refresh();
this.makeEmptyTree();
}
sw.dispose();
}

View File

@ -20,6 +20,7 @@ import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations.L
import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
import org.tianocore.PcdDeclarationsDocument.PcdDeclarations.PcdEntry;
import org.tianocore.frameworkwizard.common.DataType;
import org.tianocore.frameworkwizard.common.GlobalData;
import org.tianocore.frameworkwizard.common.Sort;
@ -631,8 +632,14 @@ public class Find {
if (spd.getPcdDeclarations() != null) {
for (int indexOfPcds = 0; indexOfPcds < spd.getPcdDeclarations().getPcdEntryList()
.size(); indexOfPcds++) {
if (spd.getPcdDeclarations().getPcdEntryList().get(indexOfPcds).getCName()
.equals(arg0)) {
PcdEntry pcdEntry = spd.getPcdDeclarations().getPcdEntryList().get(indexOfPcds);
if (pcdEntry.getCName().equals(arg0)) {
pid.setTokenSpaceGuidCName(pcdEntry.getTokenSpaceGuidCName());
pid.setToken(pcdEntry.getToken().toString());
pid.setDatumType(pcdEntry.getDatumType().toString());
pid.setValue(pcdEntry.getDefaultValue());
pid.setUsage(Tools.convertListToString(pcdEntry.getValidUsage()));
pid.setHelp(pcdEntry.getHelpText());
pid.setDeclaredBy(packageId);
break;
}
@ -659,9 +666,23 @@ public class Find {
@return
**/
public static Vector<PcdId> getAllPcdCodedForFind() {
Vector<PcdId> pcd = new Vector<PcdId>();
PcdCodedVector pv = Find.getAllPcdCodedVector();
/**
@return
**/
/**
@return
**/
/**
@return
**/
public static Vector<PcdFindResultId> getAllPcdCodedForFind(PcdCodedVector pv) {
Vector<PcdFindResultId> pcd = new Vector<PcdFindResultId>();
boolean isAdded = false;
boolean isProduced = false;
@ -683,24 +704,19 @@ public class Find {
isProduced = false;
}
//
// Get the sting "PackageName.ModuleName"
//
String tmp = pvId.getBelongModule().getPackageId().getName() + SEPERATOR + pvId.getBelongModule().getName();
//
// Check if the item has been added in
// If added, append package name and new module name
// If not added, add a new one first
//
for (int indexOfGuid = 0; indexOfGuid < pcd.size(); indexOfGuid++) {
PcdId pcdId = pcd.get(indexOfGuid);
PcdFindResultId pcdId = pcd.get(indexOfGuid);
if (pvId.getName().equals(pcdId.getName())) {
if (isProduced) {
pcd.get(indexOfGuid).setProducedModules(pcdId.getProducedModules() + "<br>" + tmp);
pcd.get(indexOfGuid).addProducedModules(pvId.getBelongModule());
} else if (!isProduced) {
pcd.get(indexOfGuid).setConsumedModules(pcdId.getConsumedModules() + "<br>" + tmp);
pcd.get(indexOfGuid).addConsumedModules(pvId.getBelongModule());
}
isAdded = true;
continue;
@ -711,19 +727,20 @@ public class Find {
// Add a new one
//
if (!isAdded) {
if (isProduced) {
pcd
.addElement(new PcdId(pvId.getName(), pvId.getType(), tmp, null, pvId.getDeclaredBy().getName()));
} else if (!isProduced) {
pcd
.addElement(new PcdId(pvId.getName(), pvId.getType(), null, tmp, pvId.getDeclaredBy().getName()));
}
PcdFindResultId pcdId = new PcdFindResultId(pvId.getName(), "PCD", pvId.getSupArchList(),
pvId.getHelp(), null, pvId.getDeclaredBy());
pcdId.setTokenSpaceGuidCName(pvId.getTokenSpaceGuidCName());
pcdId.setToken(pvId.getToken());
pcdId.setDatumType(pvId.getDatumType());
pcdId.setValue(pvId.getValue());
pcdId.setUsage(pvId.getUsage());
pcd.addElement(pcdId);
}
}
return pcd;
}
/**
Get all library class entries from workspace
@ -782,7 +799,8 @@ public class Find {
.getLibraryClassDeclarations()
.getLibraryClassList()
.size(); indexOfLibraryClass++) {
LibraryClass lc = spd.getLibraryClassDeclarations().getLibraryClassList().get(indexOfLibraryClass);
LibraryClass lc = spd.getLibraryClassDeclarations().getLibraryClassList()
.get(indexOfLibraryClass);
if (lc.getName().equals(name)) {
lcid.setSupArchList(Tools.convertListToVector(lc.getSupArchList()));
lcid.setSupModuleList(Tools.convertListToVector(lc.getSupModuleList()));
@ -813,70 +831,6 @@ public class Find {
@return
**/
// public static Vector<LibraryClassId> getAllLibraryClassForFind(LibraryClassVector lcv) {
// Vector<LibraryClassId> libraryClass = new Vector<LibraryClassId>();
// boolean isAdded = false;
// boolean isProduced = false;
//
// //
// // Go through pv to add item as new format to ppi one by one
// //
// for (int indexOfLcv = 0; indexOfLcv < lcv.size(); indexOfLcv++) {
// isAdded = false;
// LibraryClassIdentification lcvId = lcv.getLibraryClass(indexOfLcv);
//
// //
// // First check if produced or not
// //
// if (lcvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
// || lcvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
// isProduced = true;
// } else if (lcvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)
// || lcvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
// isProduced = false;
// }
//
// //
// // Get the string "PackageName.ModuleName"
// //
// String tmp = lcvId.getBelongModule().getPackageId().getName() + SEPERATOR
// + lcvId.getBelongModule().getName();
//
// //
// // Check if the item has been added in
// // If added, append package name and new module name
// // If not added, add a new one first
// //
// for (int indexOfGuid = 0; indexOfGuid < libraryClass.size(); indexOfGuid++) {
// LibraryClassId lcId = libraryClass.get(indexOfGuid);
//
// if (lcvId.getLibraryClassName().equals(lcId.getName())) {
// if (isProduced) {
// libraryClass.get(indexOfGuid).setProducedModules(lcId.getProducedModules() + "<br>" + tmp);
// } else if (!isProduced) {
// libraryClass.get(indexOfGuid).setConsumedModules(lcId.getConsumedModules() + "<br>" + tmp);
// }
// isAdded = true;
// continue;
// }
// }
//
// //
// // Add a new one
// //
// if (!isAdded) {
// if (isProduced) {
// libraryClass.addElement(new LibraryClassId(lcvId.getLibraryClassName(), "Library Class", tmp, null,
// lcvId.getDeclaredBy().getName()));
// } else if (!isProduced) {
// libraryClass.addElement(new LibraryClassId(lcvId.getLibraryClassName(), "Library Class", null, tmp,
// lcvId.getDeclaredBy().getName()));
// }
// }
// }
//
// return libraryClass;
// }
public static Vector<FindResultId> getAllLibraryClassForFind(LibraryClassVector lcv) {
Vector<FindResultId> libraryClass = new Vector<FindResultId>();
boolean isAdded = false;

View File

@ -42,6 +42,7 @@ import org.tianocore.frameworkwizard.common.Tools;
import org.tianocore.frameworkwizard.common.ui.IFrame;
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;
import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedVector;
public class FindResult extends IFrame implements TableModelListener, ListSelectionListener, MouseListener {
@ -86,6 +87,10 @@ public class FindResult extends IFrame implements TableModelListener, ListSelect
private Vector<FindResultId> vLibraryClassFindResult = null;
private PcdCodedVector pv = null;
private Vector<PcdFindResultId> vPcdFindResult = null;
/**
* This is the default constructor
*/
@ -377,29 +382,52 @@ public class FindResult extends IFrame implements TableModelListener, ListSelect
}
if (this.method.equals("PCD")) {
Vector<PcdId> vPcd = Find.getAllPcdCodedForFind();
pv = Find.getAllPcdCodedVector();
vPcdFindResult = Find.getAllPcdCodedForFind(pv);
if (vPcd.size() > 0) {
if (vPcdFindResult.size() > 0) {
for (int index = 0; index < vPcd.size(); index++) {
for (int index = 0; index < vPcdFindResult.size(); index++) {
Vector<String> v = new Vector<String>();
v.addElement(vPcd.elementAt(index).getName());
v.addElement(vPcd.elementAt(index).getType());
String strProducedModules = vPcd.elementAt(index).getProducedModules();
v.addElement(vPcdFindResult.elementAt(index).getName());
v.addElement(vPcdFindResult.elementAt(index).getType());
//
// Generate Produced Modules List
//
String strProducedModules = "";
Vector<ModuleIdentification> vModule = vPcdFindResult.elementAt(index).getProducedModules();
for (int indexOfPM = 0; indexOfPM < vModule.size(); indexOfPM++) {
strProducedModules = strProducedModules + "<br>"
+ vModule.get(indexOfPM).getPackageId().getName() + "."
+ vModule.get(indexOfPM).getName();
}
if (strProducedModules.indexOf("<br>") == 0) {
strProducedModules = strProducedModules.substring("<br>".length());
}
int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");
v.addElement("<html>" + strProducedModules + "</html>");
String strConsumedModules = vPcd.elementAt(index).getConsumedModules();
//
// Generate Consumed Modules List
//
String strConsumedModules = "";
vModule = vPcdFindResult.elementAt(index).getConsumedModules();
for (int indexOfCM = 0; indexOfCM < vModule.size(); indexOfCM++) {
strConsumedModules = strConsumedModules + "<br>"
+ vModule.get(indexOfCM).getPackageId().getName() + "."
+ vModule.get(indexOfCM).getName();
}
if (strConsumedModules.indexOf("<br>") == 0) {
strConsumedModules = strConsumedModules.substring("<br>".length());
}
int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");
v.addElement("<html>" + strConsumedModules + "</html>");
v.addElement(vPcd.elementAt(index).getDeclaredBy());
//
// Add declare package name
//
v.addElement(vPcdFindResult.elementAt(index).getDeclaredBy().getName());
model.addRow(v);
jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
@ -528,6 +556,10 @@ public class FindResult extends IFrame implements TableModelListener, ListSelect
FindResultDetailInfo frdi = new FindResultDetailInfo(vLibraryClassFindResult.elementAt(selectedRow));
frdi.setVisible(true);
}
if (this.method.equals("PCD")) {
FindResultDetailInfo frdi = new FindResultDetailInfo(vPcdFindResult.elementAt(selectedRow));
frdi.setVisible(true);
}
}
}
}

View File

@ -25,6 +25,9 @@ import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import org.tianocore.DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions;
import org.tianocore.DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo;
import org.tianocore.DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData;
import org.tianocore.FrameworkModulesDocument.FrameworkModules;
import org.tianocore.LibrariesDocument.Libraries;
import org.tianocore.LibrariesDocument.Libraries.Instance;
@ -32,6 +35,9 @@ import org.tianocore.LibraryClassDocument.LibraryClass;
import org.tianocore.ModuleSADocument.ModuleSA;
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
import org.tianocore.PcdBuildDefinitionDocument.PcdBuildDefinition;
import org.tianocore.PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData;
import org.tianocore.PcdCodedDocument.PcdCoded;
import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
import org.tianocore.frameworkwizard.common.DataType;
import org.tianocore.frameworkwizard.common.GlobalData;
@ -124,6 +130,251 @@ public class FindResultDetailInfo extends IFrame {
this.jTextArea.setSelectionEnd(0);
}
/**
@param lci
**/
public FindResultDetailInfo(PcdFindResultId frid) {
super();
init();
this.setTitle(frid.getName());
this.jTextArea.setText(createReport(frid));
this.jTextArea.setSelectionStart(0);
this.jTextArea.setSelectionEnd(0);
}
/**
Create detailed information report for pcd
@param frid
@return
**/
private String createReport(PcdFindResultId frid) {
String name = frid.getName();
//
// Write Pcd Name
//
writeReportLn("PCD C Name: " + name);
//
// Wrtie Declared package
//
writeReportLn("Declared in Package: " + frid.getDeclaredBy().getName() + " ("
+ Tools.getRelativePath(frid.getDeclaredBy().getPath(), Workspace.getCurrentWorkspace()) + ")");
//
// Write Token Space
//
writeReportLn("Token Space: " + frid.getTokenSpaceGuidCName());
//
// Write Token
//
writeReportLn("Token: " + frid.getToken());
//
// Write Datum Type
//
writeReportLn("Datum Type: " + frid.getDatumType());
//
// Write Default Value
//
writeReportLn("Default Value: " + frid.getValue());
//
// Write Usages
//
writeReportLn("Valid Usages: " + frid.getUsage());
//
// Write Help Text
//
writeReportLn("Help Text: ");
writeReportLn(TAB + frid.getHelp());
//
// Write an Empty Line
//
writeReportLn("");
//
// Wriet all modules which use this PCD:
//
writeReportLn("Modules Coded to Use This PCD: ");
Vector<ModuleIdentification> vModules = frid.getConsumedModules();
if (vModules != null) {
for (int index = 0; index < vModules.size(); index++) {
//
// Write Module Name and Path
//
writeReportLn(TAB + vModules.get(index).getName() + " ("
+ Tools.getRelativePath(vModules.get(index).getPath(), Workspace.getCurrentWorkspace())
+ ")");
//
// Write Module Pcd Info
//
ModuleSurfaceArea msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(vModules.get(index));
if (msa != null) {
PcdCoded pcdCoded = msa.getPcdCoded();
if (pcdCoded != null) {
for (int indexOfPcd = 0; indexOfPcd < pcdCoded.getPcdEntryList().size(); indexOfPcd++) {
if (pcdCoded.getPcdEntryList().get(indexOfPcd).getCName().equals(name)) {
//
// Write Pcd Item Type
//
writeReportLn(TAB + TAB + "PcdItemType: "
+ pcdCoded.getPcdEntryList().get(indexOfPcd).getPcdItemType().toString());
//
// Write Help Text
//
writeReportLn(TAB + TAB + "Help Text: ");
writeReportLn(TAB + TAB + TAB
+ pcdCoded.getPcdEntryList().get(indexOfPcd).getHelpText());
}
}
}
}
//
// Write an Empty Line
//
writeReportLn("");
}
}
//
// Write an Empty Line
//
writeReportLn("");
//
// Write All Platforms Specifing this PCD
//
writeReportLn("Platforms Specifing this PCD: ");
for (int index = 0; index < GlobalData.openingPlatformList.size(); index++) {
PlatformSurfaceArea fpd = GlobalData.openingPlatformList.getOpeningPlatformByIndex(index).getXmlFpd();
PlatformIdentification pid = GlobalData.openingPlatformList.getOpeningPlatformByIndex(index).getId();
String tmp = "";
//
// Get Non-Dynamic Pcd
//
FrameworkModules fm = fpd.getFrameworkModules();
if (fm != null) {
for (int indexOfModuleSa = 0; indexOfModuleSa < fm.getModuleSAList().size(); indexOfModuleSa++) {
ModuleSA msa = fm.getModuleSAList().get(indexOfModuleSa);
if (msa != null) {
PcdBuildDefinition p = msa.getPcdBuildDefinition();
if (p != null) {
if (p.getPcdDataList() != null) {
for (int indexOfPcd = 0; indexOfPcd < p.getPcdDataList().size(); indexOfPcd++) {
PcdData pd = p.getPcdDataList().get(indexOfPcd);
//
// Find this PCD
//
if (pd.getCName().equals(name)) {
//
// Write Module Sa Info
//
ModuleIdentification moduleSaId = GlobalData
.findIdByGuidVersion(
msa
.getModuleGuid(),
msa
.getModuleVersion(),
msa
.getPackageGuid(),
msa
.getPackageVersion());
tmp = tmp
+ TAB
+ TAB
+ "Module: "
+ moduleSaId.getName()
+ " ("
+ Tools.getRelativePath(moduleSaId.getPath(),
Workspace.getCurrentWorkspace()) + ")"
+ DataType.UNIX_LINE_SEPARATOR;
tmp = tmp + TAB + TAB + TAB + "Implementation: " + pd.getItemType().toString()
+ DataType.UNIX_LINE_SEPARATOR;
tmp = tmp + TAB + TAB + TAB + "Specified / Implementation Value: "
+ pd.getValue() + DataType.UNIX_LINE_SEPARATOR;
tmp = tmp + DataType.UNIX_LINE_SEPARATOR;
}
}
}
}
}
}
}
//
// Get Dynamic Pcd
//
DynamicPcdBuildDefinitions dpbd = fpd.getDynamicPcdBuildDefinitions();
if (dpbd != null) {
for (int indexOfDpbd = 0; indexOfDpbd < dpbd.getPcdBuildDataList().size(); indexOfDpbd++) {
PcdBuildData pbd = dpbd.getPcdBuildDataList().get(indexOfDpbd);
if (pbd != null) {
if (pbd.getCName().equals(name)) {
//
// Write Dynamic Pcd Build Definition
//
tmp = tmp + TAB + TAB + "Dynamic Pcd Build Definition: " + DataType.UNIX_LINE_SEPARATOR;
if (pbd.getSkuInfoList() != null) {
for (int indexOfPcd = 0; indexOfPcd < pbd.getSkuInfoList().size(); indexOfPcd++) {
SkuInfo si = pbd.getSkuInfoList().get(indexOfPcd);
if (si != null) {
tmp = tmp + TAB + TAB + TAB + "Sku Id: " + si.getSkuId().toString()
+ DataType.UNIX_LINE_SEPARATOR;
tmp = tmp + TAB + TAB + TAB + "Variable Name: " + si.getVariableName()
+ DataType.UNIX_LINE_SEPARATOR;
tmp = tmp + TAB + TAB + TAB + "Variable GUID: " + si.getVariableGuid()
+ DataType.UNIX_LINE_SEPARATOR;
tmp = tmp + TAB + TAB + TAB + "Variable Offset: " + si.getVariableOffset()
+ DataType.UNIX_LINE_SEPARATOR;
tmp = tmp + TAB + TAB + TAB + "Hii Default Value: " + si.getHiiDefaultValue()
+ DataType.UNIX_LINE_SEPARATOR;
}
}
}
}
}
}
}
//
// If not empty, write this platform info
//
if (!Tools.isEmpty(tmp)) {
tmp = TAB + "Platform: " + pid.getName() + " ("
+ Tools.getRelativePath(pid.getPath(), Workspace.getCurrentWorkspace()) + ")"
+ DataType.UNIX_LINE_SEPARATOR + tmp;
this.writeReportLn(tmp);
}
}
return reportContent;
}
//
// Create detailed information report for library
//
/**
@param frid
@return
**/
private String createReport(FindResultId frid) {
String tmp = "";
String name = frid.getName();

View File

@ -0,0 +1,76 @@
/** @file
The file is used to define Pcd Identification used by find function
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.frameworkwizard.common.find;
import java.util.Vector;
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
public class PcdFindResultId extends FindResultId {
private String tokenSpaceGuidCName = null;
private String token = null;
private String datumType = null;
private String value = null;
private String usage = null;
public PcdFindResultId(String strName, String strType, Vector<String> vArch, String strHelp, Vector<String> vModuleType, PackageIdentification pDeclaredBy) {
super(strName, strType, vArch, strHelp, vModuleType, pDeclaredBy);
}
public String getDatumType() {
return datumType;
}
public void setDatumType(String datumType) {
this.datumType = datumType;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getTokenSpaceGuidCName() {
return tokenSpaceGuidCName;
}
public void setTokenSpaceGuidCName(String tokenSpaceGuidCName) {
this.tokenSpaceGuidCName = tokenSpaceGuidCName;
}
public String getUsage() {
return usage;
}
public void setUsage(String usage) {
this.usage = usage;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}

View File

@ -41,6 +41,12 @@ public class PcdCodedIdentification {
private String usage = null;
private String tokenSpaceGuidCName = null;
private String token = null;
private String datumType = null;
private ModuleIdentification belongModule = null;
private PackageIdentification declaredBy = null;
@ -142,4 +148,28 @@ public class PcdCodedIdentification {
public void setDeclaredBy(PackageIdentification declaredBy) {
this.declaredBy = declaredBy;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getTokenSpaceGuidCName() {
return tokenSpaceGuidCName;
}
public void setTokenSpaceGuidCName(String tokenSpaceGuidCName) {
this.tokenSpaceGuidCName = tokenSpaceGuidCName;
}
public String getDatumType() {
return datumType;
}
public void setDatumType(String datumType) {
this.datumType = datumType;
}
}