mirror of https://github.com/acidanthera/audk.git
1. Fix EDKT339 Library Class Search need to get info for selected library class
2. Fix EDKT303 Give warning if no library instances that support the required the library class git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1816 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
aa23173f1a
commit
419558bbad
|
@ -199,4 +199,25 @@ public class GlobalData {
|
||||||
}
|
}
|
||||||
return modulePath;
|
return modulePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get a module id
|
||||||
|
|
||||||
|
@param moduleGuid
|
||||||
|
@param moduleVersion
|
||||||
|
@param packageGuid
|
||||||
|
@param packageVersion
|
||||||
|
@return
|
||||||
|
|
||||||
|
**/
|
||||||
|
public static ModuleIdentification findIdByGuidVersion(String moduleGuid, String moduleVersion, String packageGuid, String packageVersion) {
|
||||||
|
ModuleIdentification mid = null;
|
||||||
|
for (int index = 0; index < vModuleList.size(); index++) {
|
||||||
|
if (vModuleList.elementAt(index).equals(moduleGuid, moduleVersion, packageGuid, packageVersion)) {
|
||||||
|
mid = vModuleList.elementAt(index);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,10 +231,12 @@ public class Tools {
|
||||||
//
|
//
|
||||||
// remove file separator of rear
|
// remove file separator of rear
|
||||||
//
|
//
|
||||||
if (path.length() > 0 && path.indexOf(DataType.DOS_FILE_SEPARATOR) == path.length() - DataType.DOS_FILE_SEPARATOR.length()) {
|
if (path.length() > 0
|
||||||
|
&& path.indexOf(DataType.DOS_FILE_SEPARATOR) == path.length() - DataType.DOS_FILE_SEPARATOR.length()) {
|
||||||
path = path.substring(0, path.length() - DataType.DOS_FILE_SEPARATOR.length());
|
path = path.substring(0, path.length() - DataType.DOS_FILE_SEPARATOR.length());
|
||||||
}
|
}
|
||||||
if (path.length() > 0 && path.indexOf(DataType.UNIX_FILE_SEPARATOR) == path.length() - DataType.UNIX_FILE_SEPARATOR.length()) {
|
if (path.length() > 0
|
||||||
|
&& path.indexOf(DataType.UNIX_FILE_SEPARATOR) == path.length() - DataType.UNIX_FILE_SEPARATOR.length()) {
|
||||||
path = path.substring(0, path.length() - DataType.DOS_FILE_SEPARATOR.length());
|
path = path.substring(0, path.length() - DataType.DOS_FILE_SEPARATOR.length());
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
@ -261,6 +263,35 @@ public class Tools {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert a Vector to a String, separator with ", "
|
||||||
|
|
||||||
|
@param v
|
||||||
|
@return
|
||||||
|
|
||||||
|
**/
|
||||||
|
public static String convertVectorToString(Vector<String> v) {
|
||||||
|
String s = "";
|
||||||
|
for (int index = 0; index < v.size(); index++) {
|
||||||
|
s = s + v.elementAt(index).toString() + ", ";
|
||||||
|
}
|
||||||
|
if (s.length() > 0) {
|
||||||
|
s = s.substring(0, s.length() - ", ".length());
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert a List to a String
|
||||||
|
|
||||||
|
@param list
|
||||||
|
@return
|
||||||
|
|
||||||
|
**/
|
||||||
|
public static String convertListToString(List list) {
|
||||||
|
return Tools.convertVectorToString(Tools.convertListToVector(list));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
If the input path missing ext, append the ext to the path
|
If the input path missing ext, append the ext to the path
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ package org.tianocore.frameworkwizard.common.find;
|
||||||
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass;
|
||||||
import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;
|
import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;
|
||||||
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
|
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
|
||||||
import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
|
import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
|
||||||
|
@ -781,8 +782,11 @@ public class Find {
|
||||||
.getLibraryClassDeclarations()
|
.getLibraryClassDeclarations()
|
||||||
.getLibraryClassList()
|
.getLibraryClassList()
|
||||||
.size(); indexOfLibraryClass++) {
|
.size(); indexOfLibraryClass++) {
|
||||||
if (spd.getLibraryClassDeclarations().getLibraryClassList().get(indexOfLibraryClass)
|
LibraryClass lc = spd.getLibraryClassDeclarations().getLibraryClassList().get(indexOfLibraryClass);
|
||||||
.getName().equals(name)) {
|
if (lc.getName().equals(name)) {
|
||||||
|
lcid.setSupArchList(Tools.convertListToVector(lc.getSupArchList()));
|
||||||
|
lcid.setSupModuleList(Tools.convertListToVector(lc.getSupModuleList()));
|
||||||
|
lcid.setHelp(lc.getHelpText());
|
||||||
lcid.setDeclaredBy(packageId);
|
lcid.setDeclaredBy(packageId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -809,9 +813,72 @@ public class Find {
|
||||||
@return
|
@return
|
||||||
|
|
||||||
**/
|
**/
|
||||||
public static Vector<LibraryClassId> getAllLibraryClassForFind() {
|
// public static Vector<LibraryClassId> getAllLibraryClassForFind(LibraryClassVector lcv) {
|
||||||
Vector<LibraryClassId> libraryClass = new Vector<LibraryClassId>();
|
// Vector<LibraryClassId> libraryClass = new Vector<LibraryClassId>();
|
||||||
LibraryClassVector lcv = Find.getAllLibraryClassVector();
|
// 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;
|
boolean isAdded = false;
|
||||||
boolean isProduced = false;
|
boolean isProduced = false;
|
||||||
|
|
||||||
|
@ -833,25 +900,19 @@ public class Find {
|
||||||
isProduced = false;
|
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
|
// Check if the item has been added in
|
||||||
// If added, append package name and new module name
|
// If added, append package name and new module name
|
||||||
// If not added, add a new one first
|
// If not added, add a new one first
|
||||||
//
|
//
|
||||||
for (int indexOfGuid = 0; indexOfGuid < libraryClass.size(); indexOfGuid++) {
|
for (int indexOfGuid = 0; indexOfGuid < libraryClass.size(); indexOfGuid++) {
|
||||||
LibraryClassId lcId = libraryClass.get(indexOfGuid);
|
FindResultId frId = libraryClass.get(indexOfGuid);
|
||||||
|
|
||||||
if (lcvId.getLibraryClassName().equals(lcId.getName())) {
|
if (lcvId.getLibraryClassName().equals(frId.getName())) {
|
||||||
if (isProduced) {
|
if (isProduced) {
|
||||||
libraryClass.get(indexOfGuid).setProducedModules(lcId.getProducedModules() + "<br>" + tmp);
|
libraryClass.get(indexOfGuid).addProducedModules(lcvId.getBelongModule());
|
||||||
} else if (!isProduced) {
|
} else if (!isProduced) {
|
||||||
libraryClass.get(indexOfGuid).setConsumedModules(lcId.getConsumedModules() + "<br>" + tmp);
|
libraryClass.get(indexOfGuid).addConsumedModules(lcvId.getBelongModule());
|
||||||
}
|
}
|
||||||
isAdded = true;
|
isAdded = true;
|
||||||
continue;
|
continue;
|
||||||
|
@ -862,13 +923,9 @@ public class Find {
|
||||||
// Add a new one
|
// Add a new one
|
||||||
//
|
//
|
||||||
if (!isAdded) {
|
if (!isAdded) {
|
||||||
if (isProduced) {
|
libraryClass.addElement(new FindResultId(lcvId.getLibraryClassName(), "Library Class",
|
||||||
libraryClass.addElement(new LibraryClassId(lcvId.getLibraryClassName(), "Library Class", tmp, null,
|
lcvId.getSupArchList(), lcvId.getHelp(),
|
||||||
lcvId.getDeclaredBy().getName()));
|
lcvId.getSupModuleList(), lcvId.getDeclaredBy()));
|
||||||
} else if (!isProduced) {
|
|
||||||
libraryClass.addElement(new LibraryClassId(lcvId.getLibraryClassName(), "Library Class", null, tmp,
|
|
||||||
lcvId.getDeclaredBy().getName()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,8 @@ package org.tianocore.frameworkwizard.common.find;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ComponentEvent;
|
import java.awt.event.ComponentEvent;
|
||||||
import java.awt.event.ComponentListener;
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.awt.event.MouseListener;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
@ -28,6 +29,8 @@ import javax.swing.JScrollPane;
|
||||||
import javax.swing.JTable;
|
import javax.swing.JTable;
|
||||||
import javax.swing.ListSelectionModel;
|
import javax.swing.ListSelectionModel;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
|
import javax.swing.event.ListSelectionEvent;
|
||||||
|
import javax.swing.event.ListSelectionListener;
|
||||||
import javax.swing.event.TableModelEvent;
|
import javax.swing.event.TableModelEvent;
|
||||||
import javax.swing.event.TableModelListener;
|
import javax.swing.event.TableModelListener;
|
||||||
import javax.swing.table.DefaultTableCellRenderer;
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
|
@ -37,8 +40,10 @@ import org.tianocore.frameworkwizard.common.IDefaultTableModel;
|
||||||
import org.tianocore.frameworkwizard.common.Log;
|
import org.tianocore.frameworkwizard.common.Log;
|
||||||
import org.tianocore.frameworkwizard.common.Tools;
|
import org.tianocore.frameworkwizard.common.Tools;
|
||||||
import org.tianocore.frameworkwizard.common.ui.IFrame;
|
import org.tianocore.frameworkwizard.common.ui.IFrame;
|
||||||
|
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||||
|
import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;
|
||||||
|
|
||||||
public class FindResult extends IFrame implements TableModelListener, ComponentListener {
|
public class FindResult extends IFrame implements TableModelListener, ListSelectionListener, MouseListener {
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Define class Serial Version UID
|
/// Define class Serial Version UID
|
||||||
|
@ -75,6 +80,12 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL
|
||||||
|
|
||||||
private static FindResult findLibraryClassResult = null;
|
private static FindResult findLibraryClassResult = null;
|
||||||
|
|
||||||
|
private int selectedRow = -1;
|
||||||
|
|
||||||
|
private LibraryClassVector lcv = null;
|
||||||
|
|
||||||
|
private Vector<FindResultId> vLibraryClassFindResult = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the default constructor
|
* This is the default constructor
|
||||||
*/
|
*/
|
||||||
|
@ -160,7 +171,9 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL
|
||||||
jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
|
jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
|
||||||
jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||||
|
|
||||||
|
jTable.getSelectionModel().addListSelectionListener(this);
|
||||||
jTable.getModel().addTableModelListener(this);
|
jTable.getModel().addTableModelListener(this);
|
||||||
|
jTable.addMouseListener(this);
|
||||||
|
|
||||||
model.addColumn("Name");
|
model.addColumn("Name");
|
||||||
model.addColumn("Type");
|
model.addColumn("Type");
|
||||||
|
@ -174,11 +187,6 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL
|
||||||
jTable.getColumn("Consumed by").setCellRenderer(new MyTableCellRenderer());
|
jTable.getColumn("Consumed by").setCellRenderer(new MyTableCellRenderer());
|
||||||
jTable.getColumn("Declared by").setCellRenderer(new MyTableCellRenderer());
|
jTable.getColumn("Declared by").setCellRenderer(new MyTableCellRenderer());
|
||||||
|
|
||||||
// jTable.getColumn("Name").setPreferredWidth((this.getSize().width - 30) / 5);
|
|
||||||
// jTable.getColumn("Type").setPreferredWidth((this.getSize().width - 30) / 5);
|
|
||||||
// jTable.getColumn("Produced by").setPreferredWidth((this.getSize().width - 30) / 5);
|
|
||||||
// jTable.getColumn("Consumed by").setPreferredWidth((this.getSize().width - 30) / 5);
|
|
||||||
// jTable.getColumn("Declared by").setPreferredWidth((this.getSize().width - 30) / 5);
|
|
||||||
int columnWidth = (this.getSize().width - 28) / 5;
|
int columnWidth = (this.getSize().width - 28) / 5;
|
||||||
jTable.getColumn("Name").setPreferredWidth(columnWidth);
|
jTable.getColumn("Name").setPreferredWidth(columnWidth);
|
||||||
jTable.getColumn("Type").setPreferredWidth(columnWidth);
|
jTable.getColumn("Type").setPreferredWidth(columnWidth);
|
||||||
|
@ -402,29 +410,49 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.method.equals("LIBRARY_CLASS")) {
|
if (this.method.equals("LIBRARY_CLASS")) {
|
||||||
Vector<LibraryClassId> vLibraryClass = Find.getAllLibraryClassForFind();
|
lcv = Find.getAllLibraryClassVector();
|
||||||
|
vLibraryClassFindResult = Find.getAllLibraryClassForFind(lcv);
|
||||||
|
|
||||||
if (vLibraryClass.size() > 0) {
|
if (vLibraryClassFindResult.size() > 0) {
|
||||||
|
for (int index = 0; index < vLibraryClassFindResult.size(); index++) {
|
||||||
for (int index = 0; index < vLibraryClass.size(); index++) {
|
|
||||||
Vector<String> v = new Vector<String>();
|
Vector<String> v = new Vector<String>();
|
||||||
v.addElement(vLibraryClass.elementAt(index).getName());
|
v.addElement(vLibraryClassFindResult.elementAt(index).getName());
|
||||||
v.addElement(vLibraryClass.elementAt(index).getType());
|
v.addElement(vLibraryClassFindResult.elementAt(index).getType());
|
||||||
String strProducedModules = vLibraryClass.elementAt(index).getProducedModules();
|
|
||||||
|
//
|
||||||
|
// Generate Produced Modules List
|
||||||
|
//
|
||||||
|
String strProducedModules = "";
|
||||||
|
Vector<ModuleIdentification> vModule = vLibraryClassFindResult.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) {
|
if (strProducedModules.indexOf("<br>") == 0) {
|
||||||
strProducedModules = strProducedModules.substring("<br>".length());
|
strProducedModules = strProducedModules.substring("<br>".length());
|
||||||
}
|
}
|
||||||
int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");
|
int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");
|
||||||
v.addElement("<html>" + strProducedModules + "</html>");
|
v.addElement("<html>" + strProducedModules + "</html>");
|
||||||
|
|
||||||
String strConsumedModules = vLibraryClass.elementAt(index).getConsumedModules();
|
//
|
||||||
|
// Generate Consumed Modules List
|
||||||
|
//
|
||||||
|
String strConsumedModules = "";
|
||||||
|
vModule = vLibraryClassFindResult.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) {
|
if (strConsumedModules.indexOf("<br>") == 0) {
|
||||||
strConsumedModules = strConsumedModules.substring("<br>".length());
|
strConsumedModules = strConsumedModules.substring("<br>".length());
|
||||||
}
|
}
|
||||||
int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");
|
int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");
|
||||||
v.addElement("<html>" + strConsumedModules + "</html>");
|
v.addElement("<html>" + strConsumedModules + "</html>");
|
||||||
|
|
||||||
v.addElement(vLibraryClass.elementAt(index).getDeclaredBy());
|
v.addElement(vLibraryClassFindResult.elementAt(index).getDeclaredBy().getName());
|
||||||
|
|
||||||
model.addRow(v);
|
model.addRow(v);
|
||||||
jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
|
jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
|
||||||
|
@ -443,9 +471,12 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
||||||
|
*
|
||||||
|
*/
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
if (arg0.getSource() == this.jButtonClose) {
|
if (arg0.getSource() == this.jButtonClose) {
|
||||||
|
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -468,6 +499,39 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL
|
||||||
Tools.resizeTableColumn(this.jTable, this.getSize().width - 28);
|
Tools.resizeTableColumn(this.jTable, this.getSize().width - 28);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void valueChanged(ListSelectionEvent arg0) {
|
||||||
|
if (arg0.getValueIsAdjusting()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
|
||||||
|
if (lsm.isSelectionEmpty()) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
selectedRow = lsm.getMinSelectionIndex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void mouseClicked(MouseEvent arg0) {
|
||||||
|
if (arg0.getClickCount() == 2) {
|
||||||
|
if (this.selectedRow < 0) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
if (this.method.equals("LIBRARY_CLASS")) {
|
||||||
|
FindResultDetailInfo frdi = new FindResultDetailInfo(vLibraryClassFindResult.elementAt(selectedRow));
|
||||||
|
frdi.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
|
* @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
|
||||||
*
|
*
|
||||||
|
@ -480,7 +544,7 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL
|
||||||
|
|
||||||
class MyTableCellRenderer extends DefaultTableCellRenderer {
|
class MyTableCellRenderer extends DefaultTableCellRenderer {
|
||||||
///
|
///
|
||||||
///
|
/// Define Class Serial Version UID
|
||||||
///
|
///
|
||||||
private static final long serialVersionUID = -2082787479305255946L;
|
private static final long serialVersionUID = -2082787479305255946L;
|
||||||
|
|
||||||
|
@ -490,4 +554,23 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void mousePressed(MouseEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseReleased(MouseEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseEntered(MouseEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseExited(MouseEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,408 @@
|
||||||
|
/** @file
|
||||||
|
|
||||||
|
The file is used to show detailed information of one of find results
|
||||||
|
|
||||||
|
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.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ComponentEvent;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JTextArea;
|
||||||
|
|
||||||
|
import org.tianocore.FrameworkModulesDocument.FrameworkModules;
|
||||||
|
import org.tianocore.LibrariesDocument.Libraries;
|
||||||
|
import org.tianocore.LibrariesDocument.Libraries.Instance;
|
||||||
|
import org.tianocore.LibraryClassDocument.LibraryClass;
|
||||||
|
import org.tianocore.ModuleSADocument.ModuleSA;
|
||||||
|
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
|
||||||
|
import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
|
||||||
|
import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
|
||||||
|
import org.tianocore.frameworkwizard.common.DataType;
|
||||||
|
import org.tianocore.frameworkwizard.common.GlobalData;
|
||||||
|
import org.tianocore.frameworkwizard.common.Tools;
|
||||||
|
import org.tianocore.frameworkwizard.common.ui.IFrame;
|
||||||
|
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||||
|
import org.tianocore.frameworkwizard.platform.PlatformIdentification;
|
||||||
|
import org.tianocore.frameworkwizard.workspace.Workspace;
|
||||||
|
import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
|
||||||
|
|
||||||
|
public class FindResultDetailInfo extends IFrame {
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Define class Serial Version UID
|
||||||
|
///
|
||||||
|
private static final long serialVersionUID = -4888295869041881282L;
|
||||||
|
|
||||||
|
private JPanel jContentPane = null;
|
||||||
|
|
||||||
|
private JScrollPane jScrollPane = null;
|
||||||
|
|
||||||
|
private JTextArea jTextArea = null;
|
||||||
|
|
||||||
|
private JButton jButtonClose = null;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Not for UI
|
||||||
|
//
|
||||||
|
private static String TAB = " ";
|
||||||
|
|
||||||
|
private String reportContent = "";
|
||||||
|
|
||||||
|
private WorkspaceTools wt = new WorkspaceTools();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method initializes jScrollPane
|
||||||
|
*
|
||||||
|
* @return javax.swing.JScrollPane
|
||||||
|
*/
|
||||||
|
private JScrollPane getJScrollPane() {
|
||||||
|
if (jScrollPane == null) {
|
||||||
|
jScrollPane = new JScrollPane();
|
||||||
|
jScrollPane.setBounds(new java.awt.Rectangle(5, 5, 535, 280));
|
||||||
|
jScrollPane.setPreferredSize(new java.awt.Dimension(535, 280));
|
||||||
|
jScrollPane.setViewportView(getJTextArea());
|
||||||
|
}
|
||||||
|
return jScrollPane;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method initializes jTextArea
|
||||||
|
*
|
||||||
|
* @return javax.swing.JTextArea
|
||||||
|
*/
|
||||||
|
private JTextArea getJTextArea() {
|
||||||
|
if (jTextArea == null) {
|
||||||
|
jTextArea = new JTextArea();
|
||||||
|
jTextArea.setEditable(false);
|
||||||
|
}
|
||||||
|
return jTextArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method initializes jButtonClose
|
||||||
|
*
|
||||||
|
* @return javax.swing.JButton
|
||||||
|
*/
|
||||||
|
private JButton getJButtonClose() {
|
||||||
|
if (jButtonClose == null) {
|
||||||
|
jButtonClose = new JButton();
|
||||||
|
jButtonClose.setBounds(new java.awt.Rectangle(240, 290, 80, 20));
|
||||||
|
jButtonClose.setPreferredSize(new java.awt.Dimension(80, 20));
|
||||||
|
jButtonClose.addActionListener(this);
|
||||||
|
jButtonClose.setText("Close");
|
||||||
|
}
|
||||||
|
return jButtonClose;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
@param lci
|
||||||
|
|
||||||
|
**/
|
||||||
|
public FindResultDetailInfo(FindResultId frid) {
|
||||||
|
super();
|
||||||
|
init();
|
||||||
|
this.setTitle(frid.getName());
|
||||||
|
this.jTextArea.setText(createReport(frid));
|
||||||
|
this.jTextArea.setSelectionStart(0);
|
||||||
|
this.jTextArea.setSelectionEnd(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String createReport(FindResultId frid) {
|
||||||
|
String tmp = "";
|
||||||
|
String name = frid.getName();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write Class Name
|
||||||
|
//
|
||||||
|
writeReportLn(name);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write Provided Package
|
||||||
|
//
|
||||||
|
writeReportLn(TAB + "Provided by: " + frid.getDeclaredBy().getName() + " ("
|
||||||
|
+ Tools.getRelativePath(frid.getDeclaredBy().getPath(), Workspace.getCurrentWorkspace()) + ")");
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write Header File
|
||||||
|
//
|
||||||
|
PackageSurfaceArea spd = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(frid.getDeclaredBy());
|
||||||
|
tmp = Tools.getRelativePath(frid.getDeclaredBy().getPath(), Workspace.getCurrentWorkspace());
|
||||||
|
writeReportLn(TAB + "Header File: " + Tools.getFilePathOnly(tmp)
|
||||||
|
+ wt.getHeaderFileFromPackageByLibraryClassName(spd, name));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write Supported Module Types
|
||||||
|
//
|
||||||
|
writeReportLn(TAB + "Supported Module Types: " + Tools.convertVectorToString(frid.getModuleType()));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write Supported Arch
|
||||||
|
//
|
||||||
|
writeReportLn(TAB + "Supported Architectures: " + Tools.convertVectorToString(frid.getArch()));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write Help Text
|
||||||
|
//
|
||||||
|
writeReportLn(TAB + "Help Text: ");
|
||||||
|
writeReportLn(TAB + TAB + frid.getHelp());
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write an empty line
|
||||||
|
//
|
||||||
|
writeReportLn("");
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write Instances
|
||||||
|
//
|
||||||
|
writeReportLn("Library Instances:");
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write Instances One by One
|
||||||
|
//
|
||||||
|
for (int index = 0; index < frid.getProducedModules().size(); index++) {
|
||||||
|
ModuleIdentification mid = frid.getProducedModules().get(index);
|
||||||
|
ModuleSurfaceArea msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(mid);
|
||||||
|
if (msa != null) {
|
||||||
|
//
|
||||||
|
// Write Instance Name
|
||||||
|
//
|
||||||
|
if (msa.getMsaHeader() != null) {
|
||||||
|
writeReportLn(TAB + msa.getMsaHeader().getModuleName());
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write Msa File Name
|
||||||
|
//
|
||||||
|
writeReportLn(TAB + TAB + "Provided by: "
|
||||||
|
+ Tools.getRelativePath(mid.getPath(), Workspace.getCurrentWorkspace()));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Find the produced library class
|
||||||
|
//
|
||||||
|
if (msa.getLibraryClassDefinitions() != null) {
|
||||||
|
for (int indexL = 0; indexL < msa.getLibraryClassDefinitions().getLibraryClassList().size(); indexL++) {
|
||||||
|
LibraryClass lc = msa.getLibraryClassDefinitions().getLibraryClassList().get(indexL);
|
||||||
|
if (lc.getKeyword().equals(name)) {
|
||||||
|
//
|
||||||
|
// Write Supported Module Types
|
||||||
|
//
|
||||||
|
writeReportLn(TAB + TAB + "Supported Module Types: "
|
||||||
|
+ Tools.convertListToString(lc.getSupModuleList()));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write Supported Arch
|
||||||
|
//
|
||||||
|
writeReportLn(TAB + TAB + "Supported Architectures: "
|
||||||
|
+ Tools.convertListToString(lc.getSupArchList()));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write Help Text
|
||||||
|
//
|
||||||
|
writeReportLn(TAB + TAB + "Help Text: ");
|
||||||
|
writeReportLn(TAB + TAB + (lc.getHelpText() == null ? "" : lc.getHelpText()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write an empty line
|
||||||
|
//
|
||||||
|
writeReportLn("");
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write all modules which consumed this library
|
||||||
|
//
|
||||||
|
writeReportLn("Modules Requiring " + name + ":");
|
||||||
|
for (int index = 0; index < frid.getConsumedModules().size(); index++) {
|
||||||
|
//
|
||||||
|
// Write
|
||||||
|
//
|
||||||
|
writeReportLn(TAB
|
||||||
|
+ frid.getConsumedModules().get(index).getName()
|
||||||
|
+ " ("
|
||||||
|
+ Tools.getRelativePath(frid.getConsumedModules().get(index).getPath(),
|
||||||
|
Workspace.getCurrentWorkspace()) + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write an empty line
|
||||||
|
//
|
||||||
|
writeReportLn("");
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write platforms using the library class instances
|
||||||
|
//
|
||||||
|
writeReportLn("Platforms Using " + name + ":");
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write Instances One by One as Using Platforms
|
||||||
|
//
|
||||||
|
for (int index = 0; index < frid.getProducedModules().size(); index++) {
|
||||||
|
ModuleIdentification mid = frid.getProducedModules().get(index);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write Instance Name
|
||||||
|
//
|
||||||
|
writeReportLn(TAB + mid.getName());
|
||||||
|
|
||||||
|
//
|
||||||
|
// Go through each platform one by one
|
||||||
|
//
|
||||||
|
for (int indexOfPlatform = 0; indexOfPlatform < GlobalData.openingPlatformList.size(); indexOfPlatform++) {
|
||||||
|
PlatformSurfaceArea fpd = GlobalData.openingPlatformList.getOpeningPlatformByIndex(indexOfPlatform)
|
||||||
|
.getXmlFpd();
|
||||||
|
PlatformIdentification pid = GlobalData.openingPlatformList.getOpeningPlatformByIndex(indexOfPlatform)
|
||||||
|
.getId();
|
||||||
|
Vector<ModuleIdentification> vModuleSa = new Vector<ModuleIdentification>();
|
||||||
|
if (fpd != null) {
|
||||||
|
FrameworkModules fm = fpd.getFrameworkModules();
|
||||||
|
if (fm != null) {
|
||||||
|
for (int indexOfModule = 0; indexOfModule < fm.getModuleSAList().size(); indexOfModule++) {
|
||||||
|
ModuleSA msa = fm.getModuleSAList().get(indexOfModule);
|
||||||
|
if (msa != null) {
|
||||||
|
Libraries l = msa.getLibraries();
|
||||||
|
if (l != null) {
|
||||||
|
if (l.getInstanceList() != null) {
|
||||||
|
for (int indexOfInstance = 0; indexOfInstance < l.getInstanceList().size(); indexOfInstance++) {
|
||||||
|
Instance i = l.getInstanceList().get(indexOfInstance);
|
||||||
|
if (mid.equals(i.getModuleGuid(), i.getModuleVersion(), i.getPackageGuid(),
|
||||||
|
i.getPackageVersion())) {
|
||||||
|
ModuleIdentification moduleSaId = GlobalData
|
||||||
|
.findIdByGuidVersion(
|
||||||
|
msa
|
||||||
|
.getModuleGuid(),
|
||||||
|
msa
|
||||||
|
.getModuleVersion(),
|
||||||
|
msa
|
||||||
|
.getPackageGuid(),
|
||||||
|
msa
|
||||||
|
.getPackageVersion());
|
||||||
|
if (moduleSaId != null) {
|
||||||
|
vModuleSa.addElement(moduleSaId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get finded moduleSa in this spd
|
||||||
|
//
|
||||||
|
if (vModuleSa.size() > 0) {
|
||||||
|
writeReportLn(TAB + TAB + pid.getName() + " ("
|
||||||
|
+ Tools.getRelativePath(pid.getPath(), Workspace.getCurrentWorkspace()) + ")");
|
||||||
|
for (int indexOfModuleSa = 0; indexOfModuleSa < vModuleSa.size(); indexOfModuleSa++) {
|
||||||
|
writeReportLn(TAB
|
||||||
|
+ TAB
|
||||||
|
+ TAB
|
||||||
|
+ vModuleSa.elementAt(indexOfModuleSa).getName()
|
||||||
|
+ " ("
|
||||||
|
+ Tools.getRelativePath(vModuleSa.elementAt(indexOfModuleSa).getPath(),
|
||||||
|
Workspace.getCurrentWorkspace()) + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
writeReportLn("");
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.reportContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method initializes this
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private void init() {
|
||||||
|
this.setSize(550, 380);
|
||||||
|
this.setContentPane(getJContentPane());
|
||||||
|
this.setTitle("JFrame");
|
||||||
|
this.setResizable(true);
|
||||||
|
this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
|
||||||
|
this.centerWindow();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method initializes jContentPane
|
||||||
|
*
|
||||||
|
* @return javax.swing.JPanel
|
||||||
|
*/
|
||||||
|
private JPanel getJContentPane() {
|
||||||
|
if (jContentPane == null) {
|
||||||
|
jContentPane = new JPanel();
|
||||||
|
jContentPane.setLayout(null);
|
||||||
|
jContentPane.setSize(new java.awt.Dimension(550, 350));
|
||||||
|
jContentPane.add(getJScrollPane(), null);
|
||||||
|
jContentPane.add(getJButtonClose(), null);
|
||||||
|
|
||||||
|
jContentPane.setPreferredSize(new java.awt.Dimension(550, 340));
|
||||||
|
}
|
||||||
|
return jContentPane;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
|
||||||
|
*
|
||||||
|
* Override windowClosing to popup warning message to confirm quit
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void windowClosing(WindowEvent arg0) {
|
||||||
|
this.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
|
||||||
|
*
|
||||||
|
* Override componentResized to resize all components when frame's size is changed
|
||||||
|
*/
|
||||||
|
public void componentResized(ComponentEvent arg0) {
|
||||||
|
int intCurrentWidth = this.getJContentPane().getWidth();
|
||||||
|
int intCurrentHeight = this.getJContentPane().getHeight();
|
||||||
|
int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
|
||||||
|
int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
|
||||||
|
|
||||||
|
Tools.resizeComponent(this.jScrollPane, intCurrentWidth, intCurrentHeight, intPreferredWidth,
|
||||||
|
intPreferredHeight);
|
||||||
|
Tools.centerComponent(this.jButtonClose, intCurrentWidth, intCurrentHeight, intPreferredHeight,
|
||||||
|
DataType.SPACE_TO_BOTTOM_FOR_CLOSE_BUTTON);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
|
if (arg0.getSource() == this.jButtonClose) {
|
||||||
|
this.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeReportLn(String line) {
|
||||||
|
this.reportContent = this.reportContent + line + DataType.LINE_SEPARATOR;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,124 @@
|
||||||
|
/** @file
|
||||||
|
|
||||||
|
The file is used to define GUID 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.module.Identifications.ModuleIdentification;
|
||||||
|
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||||
|
|
||||||
|
public class FindResultId {
|
||||||
|
|
||||||
|
private String name = "";
|
||||||
|
|
||||||
|
private String type = "";
|
||||||
|
|
||||||
|
private Vector<String> arch = new Vector<String>();
|
||||||
|
|
||||||
|
private Vector<String> moduleType = new Vector<String>();
|
||||||
|
|
||||||
|
private String help = "";
|
||||||
|
|
||||||
|
private Vector<ModuleIdentification> producedModules = new Vector<ModuleIdentification>();
|
||||||
|
|
||||||
|
private Vector<ModuleIdentification> consumedModules = new Vector<ModuleIdentification>();
|
||||||
|
|
||||||
|
private PackageIdentification declaredBy = null;
|
||||||
|
|
||||||
|
public FindResultId(String strName, String strType, Vector<String> vArch, String strHelp, Vector<String> vModuleType, PackageIdentification pDeclaredBy) {
|
||||||
|
this.name = (strName == null ? "" : strName);
|
||||||
|
this.type = (strType == null ? "" : strType);
|
||||||
|
this.arch = (vArch == null ? this.arch : vArch);
|
||||||
|
this.help = (strHelp == null ? "" : strHelp);
|
||||||
|
this.moduleType = (vModuleType == null ? this.moduleType : vModuleType);
|
||||||
|
this.declaredBy = pDeclaredBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector<String> getArch() {
|
||||||
|
return arch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArch(Vector<String> arch) {
|
||||||
|
this.arch = arch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector<ModuleIdentification> getConsumedModules() {
|
||||||
|
return consumedModules;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConsumedModules(Vector<ModuleIdentification> consumedModules) {
|
||||||
|
this.consumedModules = consumedModules;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addConsumedModules(ModuleIdentification consumedModule) {
|
||||||
|
if (consumedModule != null) {
|
||||||
|
this.consumedModules.addElement(consumedModule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PackageIdentification getDeclaredBy() {
|
||||||
|
return declaredBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeclaredBy(PackageIdentification declaredBy) {
|
||||||
|
this.declaredBy = declaredBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHelp() {
|
||||||
|
return help;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHelp(String help) {
|
||||||
|
this.help = help;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector<ModuleIdentification> getProducedModules() {
|
||||||
|
return producedModules;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProducedModules(Vector<ModuleIdentification> producedModules) {
|
||||||
|
this.producedModules = producedModules;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addProducedModules(ModuleIdentification producedModule) {
|
||||||
|
if (producedModule != null) {
|
||||||
|
this.producedModules.addElement(producedModule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector<String> getModuleType() {
|
||||||
|
return moduleType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModuleType(Vector<String> moduleType) {
|
||||||
|
this.moduleType = moduleType;
|
||||||
|
}
|
||||||
|
}
|
|
@ -23,9 +23,16 @@ public class LibraryClassVector {
|
||||||
for (int index = 0; index < vLibraryClass.size(); index++) {
|
for (int index = 0; index < vLibraryClass.size(); index++) {
|
||||||
if (vLibraryClass.elementAt(index).getLibraryClassName().equals(lib.getLibraryClassName())
|
if (vLibraryClass.elementAt(index).getLibraryClassName().equals(lib.getLibraryClassName())
|
||||||
&& vLibraryClass.elementAt(index).getUsage().equals(lib.getUsage())) {
|
&& vLibraryClass.elementAt(index).getUsage().equals(lib.getUsage())) {
|
||||||
|
if (vLibraryClass.elementAt(index).getBelongModule() != null && lib.getBelongModule() != null) {
|
||||||
|
if (vLibraryClass.elementAt(index).getBelongModule().equals(lib.getBelongModule())) {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (vLibraryClass.elementAt(index).getBelongModule() == null && lib.getBelongModule() == null) {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;
|
||||||
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
|
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
|
||||||
import org.tianocore.frameworkwizard.common.DataType;
|
import org.tianocore.frameworkwizard.common.DataType;
|
||||||
import org.tianocore.frameworkwizard.common.OpenFile;
|
import org.tianocore.frameworkwizard.common.OpenFile;
|
||||||
|
import org.tianocore.frameworkwizard.common.Tools;
|
||||||
import org.tianocore.frameworkwizard.common.Identifications.Identification;
|
import org.tianocore.frameworkwizard.common.Identifications.Identification;
|
||||||
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||||
|
|
||||||
|
@ -134,6 +135,31 @@ public class ModuleIdentification extends Identification {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean equals(String moduleGuid, String moduleVersion, String packageGuid, String packageVersion) {
|
||||||
|
boolean b = false;
|
||||||
|
if (this.getGuid().equals(moduleGuid) && this.getPackageId().getGuid().equals(packageGuid)) {
|
||||||
|
b = true;
|
||||||
|
//
|
||||||
|
// Check Version
|
||||||
|
//
|
||||||
|
if (moduleVersion != null) {
|
||||||
|
if (!Tools.isEmpty(moduleVersion)) {
|
||||||
|
if (!moduleVersion.equals(this.getVersion())) {
|
||||||
|
b = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (packageVersion != null) {
|
||||||
|
if (!Tools.isEmpty(packageVersion)) {
|
||||||
|
if (!packageVersion.equals(this.getPackageId().getVersion())) {
|
||||||
|
b = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isLibrary() {
|
public boolean isLibrary() {
|
||||||
return isLibrary;
|
return isLibrary;
|
||||||
}
|
}
|
||||||
|
|
|
@ -506,32 +506,6 @@ public class LibraryClassDefsDlg extends IDialog {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Check if the library is produced
|
|
||||||
//
|
|
||||||
String strUsage = this.jComboBoxUsage.getSelectedItem().toString();
|
|
||||||
//
|
|
||||||
// Check only when the library class is consumed
|
|
||||||
//
|
|
||||||
if (strUsage.equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED) || strUsage.equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
|
|
||||||
LibraryClassVector v = Find.getAllLibraryClassVector();
|
|
||||||
boolean isFind = false;
|
|
||||||
for (int index = 0; index < v.size(); index++) {
|
|
||||||
LibraryClassIdentification lid = v.getLibraryClass(index);
|
|
||||||
if (lid.getLibraryClassName().equals(this.jComboBoxLibraryClassName.getSelectedItem().toString())) {
|
|
||||||
if (lid.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
|
|
||||||
|| lid.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
|
|
||||||
isFind = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!isFind) {
|
|
||||||
Log.wrn("Update Library Class Definitions", "This Library Class has no instance yet.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check RecommendedInstanceVersion
|
// Check RecommendedInstanceVersion
|
||||||
//
|
//
|
||||||
|
@ -562,6 +536,32 @@ public class LibraryClassDefsDlg extends IDialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check if the library is produced
|
||||||
|
//
|
||||||
|
String strUsage = this.jComboBoxUsage.getSelectedItem().toString();
|
||||||
|
//
|
||||||
|
// Check only when the library class is consumed
|
||||||
|
//
|
||||||
|
if (strUsage.equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED) || strUsage.equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
|
||||||
|
LibraryClassVector v = Find.getAllLibraryClassVector();
|
||||||
|
boolean isFind = false;
|
||||||
|
for (int index = 0; index < v.size(); index++) {
|
||||||
|
LibraryClassIdentification lid = v.getLibraryClass(index);
|
||||||
|
if (lid.getLibraryClassName().equals(this.jComboBoxLibraryClassName.getSelectedItem().toString())) {
|
||||||
|
if (lid.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
|
||||||
|
|| lid.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
|
||||||
|
isFind = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isFind) {
|
||||||
|
Log.wrn("Update Library Class Definitions", "This Library Class has no instance yet. It may have some errors in build time.");
|
||||||
|
//return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -666,10 +666,11 @@ public class WorkspaceTools {
|
||||||
//
|
//
|
||||||
// Check id
|
// Check id
|
||||||
//
|
//
|
||||||
|
if (mid != null) {
|
||||||
if (mid.equals(id)) {
|
if (mid.equals(id)) {
|
||||||
return GlobalData.vPackageList.elementAt(indexI);
|
return GlobalData.vPackageList.elementAt(indexI);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -809,19 +810,10 @@ public class WorkspaceTools {
|
||||||
//
|
//
|
||||||
PackageIdentification pid = GlobalData.openingModuleList.getIdByPath(path).getPackageId();
|
PackageIdentification pid = GlobalData.openingModuleList.getIdByPath(path).getPackageId();
|
||||||
PackageSurfaceArea spd = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(pid);
|
PackageSurfaceArea spd = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(pid);
|
||||||
if (spd != null) {
|
String headerFile = getHeaderFileFromPackageByLibraryClassName(spd, name);
|
||||||
if (spd.getLibraryClassDeclarations() != null) {
|
if (!Tools.isEmpty(headerFile)) {
|
||||||
LibraryClassDeclarations lcdl = spd.getLibraryClassDeclarations();
|
|
||||||
for (int indexOfLibOfSpd = 0; indexOfLibOfSpd < lcdl.sizeOfLibraryClassArray(); indexOfLibOfSpd++) {
|
|
||||||
if (lcdl.getLibraryClassList().get(indexOfLibOfSpd).getName().equals(name)) {
|
|
||||||
v.addElement(Tools.convertPathToCurrentOsType(Tools.getFilePathOnly(pid.getPath())
|
v.addElement(Tools.convertPathToCurrentOsType(Tools.getFilePathOnly(pid.getPath())
|
||||||
+ DataType.FILE_SEPARATOR
|
+ DataType.FILE_SEPARATOR + headerFile));
|
||||||
+ lcdl.getLibraryClassList()
|
|
||||||
.get(indexOfLibOfSpd)
|
|
||||||
.getIncludeHeader()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -920,4 +912,20 @@ public class WorkspaceTools {
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getHeaderFileFromPackageByLibraryClassName(PackageSurfaceArea spd, String name) {
|
||||||
|
String headerFile = "";
|
||||||
|
if (spd != null) {
|
||||||
|
if (spd.getLibraryClassDeclarations() != null) {
|
||||||
|
LibraryClassDeclarations lcdl = spd.getLibraryClassDeclarations();
|
||||||
|
for (int indexOfLibOfSpd = 0; indexOfLibOfSpd < lcdl.sizeOfLibraryClassArray(); indexOfLibOfSpd++) {
|
||||||
|
if (lcdl.getLibraryClassList().get(indexOfLibOfSpd).getName().equals(name)) {
|
||||||
|
return lcdl.getLibraryClassList().get(indexOfLibOfSpd).getIncludeHeader();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return headerFile;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue