Modify error message contents when an improper library instance was selected for a module.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2292 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -159,12 +159,12 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
|||||||
classConsumed = null;
|
classConsumed = null;
|
||||||
jTabbedPane.setSelectedIndex(0);
|
jTabbedPane.setSelectedIndex(0);
|
||||||
initPcdBuildDefinition(i);
|
initPcdBuildDefinition(i);
|
||||||
ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
|
moduleId = WorkspaceProfile.getModuleId(moduleKey);
|
||||||
if (mi == null) {
|
if (moduleId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int tabIndex = jTabbedPane.indexOfTab("Libraries");
|
int tabIndex = jTabbedPane.indexOfTab("Libraries");
|
||||||
if (mi.isLibrary()) {
|
if (moduleId.isLibrary()) {
|
||||||
jTabbedPane.setEnabledAt(tabIndex, false);
|
jTabbedPane.setEnabledAt(tabIndex, false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -199,7 +199,6 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
|||||||
libClassTableModel.setRowCount(0);
|
libClassTableModel.setRowCount(0);
|
||||||
libInstanceTableModel.setRowCount(0);
|
libInstanceTableModel.setRowCount(0);
|
||||||
selectedInstancesTableModel.setRowCount(0);
|
selectedInstancesTableModel.setRowCount(0);
|
||||||
moduleId = WorkspaceProfile.getModuleId(moduleKey);
|
|
||||||
Vector<String> errorMsg = new Vector<String>();
|
Vector<String> errorMsg = new Vector<String>();
|
||||||
try {
|
try {
|
||||||
//
|
//
|
||||||
@ -350,7 +349,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
|||||||
//
|
//
|
||||||
// Get dependency pkg list into which we will search lib instances.
|
// Get dependency pkg list into which we will search lib instances.
|
||||||
//
|
//
|
||||||
depPkgList = SurfaceAreaQuery.getDependencePkg(null, mi);
|
//depPkgList = SurfaceAreaQuery.getDependencePkg(null, mi);
|
||||||
//
|
//
|
||||||
// Get the lib class consumed, produced by this module itself.
|
// Get the lib class consumed, produced by this module itself.
|
||||||
//
|
//
|
||||||
@ -416,7 +415,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
|||||||
Iterator<LibraryClassDescriptor> lic = this.classConsumed.keySet().iterator();
|
Iterator<LibraryClassDescriptor> lic = this.classConsumed.keySet().iterator();
|
||||||
while (lic.hasNext()) {
|
while (lic.hasNext()) {
|
||||||
LibraryClassDescriptor cls = lic.next();
|
LibraryClassDescriptor cls = lic.next();
|
||||||
if (isBoundedClass(cls)) {
|
if (isBoundedClass(cls, errorMsg)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ArrayList<String> instances = getInstancesForClass(cls, depPkgList);
|
ArrayList<String> instances = getInstancesForClass(cls, depPkgList);
|
||||||
@ -438,15 +437,28 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
|||||||
* @param cls
|
* @param cls
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private boolean isBoundedClass (LibraryClassDescriptor cls) {
|
private boolean isBoundedClass (LibraryClassDescriptor cls, Vector<String> errorMsg) {
|
||||||
if (this.classProduced.containsKey(cls)) {
|
// if (this.classProduced.containsKey(cls)) {
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
|
Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
|
||||||
while (lcdi.hasNext()) {
|
while (lcdi.hasNext()) {
|
||||||
LibraryClassDescriptor lcd = lcdi.next();
|
LibraryClassDescriptor lcd = lcdi.next();
|
||||||
if (cls.isSubSetByArchs(lcd) && cls.isSubSetByModTypes(lcd)) {
|
if (cls.className.equals(lcd.className)) {
|
||||||
return true;
|
if (cls.isSubSetByArchs(lcd) && cls.isSubSetByModTypes(lcd)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ArrayList<String> producedBy = this.classProduced.get(lcd);
|
||||||
|
String instancesName = "";
|
||||||
|
for (int i = 0; i < producedBy.size(); ++i) {
|
||||||
|
ModuleIdentification mi = WorkspaceProfile.getModuleId(producedBy.get(i));
|
||||||
|
instancesName += mi.getName();
|
||||||
|
instancesName += " ";
|
||||||
|
}
|
||||||
|
String msg = new ImproperInstanceException(lcd.className, instancesName, lcd.supArchs, lcd.supModTypes).getMessage();
|
||||||
|
errorMsg.add(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,7 +485,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
|||||||
isPotential = true;
|
isPotential = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasBeenProduced(lcd)) {
|
if (isPotential && hasBeenProduced(lcd)) {
|
||||||
isPotential = false;
|
isPotential = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -492,7 +504,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
|||||||
Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
|
Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
|
||||||
while (lcdi.hasNext()) {
|
while (lcdi.hasNext()) {
|
||||||
LibraryClassDescriptor lcd = lcdi.next();
|
LibraryClassDescriptor lcd = lcdi.next();
|
||||||
if (cls.hasInterSectionWith(lcd)) {
|
if (cls.isSubSetByArchs(lcd) && cls.isSubSetByModTypes(lcd)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -565,6 +577,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showClassToResolved(){
|
private void showClassToResolved(){
|
||||||
|
Vector<String> errorMsg = new Vector<String>();
|
||||||
libClassTableModel.setRowCount(0);
|
libClassTableModel.setRowCount(0);
|
||||||
libInstanceTableModel.setRowCount(0);
|
libInstanceTableModel.setRowCount(0);
|
||||||
if (classConsumed == null || classConsumed.size() == 0) {
|
if (classConsumed == null || classConsumed.size() == 0) {
|
||||||
@ -578,11 +591,18 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isBoundedClass(lcd)){
|
if (!isBoundedClass(lcd, errorMsg)){
|
||||||
libClassTableModel.addRow(s);
|
libClassTableModel.addRow(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (errorMsg.size() > 0) {
|
||||||
|
String errors = "";
|
||||||
|
for (int i = 0; i < errorMsg.size(); ++i) {
|
||||||
|
errors += " " + errorMsg.get(i) + "\n";
|
||||||
|
}
|
||||||
|
JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), errors);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getModuleArch () {
|
private String getModuleArch () {
|
||||||
@ -2030,6 +2050,37 @@ class MultipleInstanceException extends Exception {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ImproperInstanceException extends Exception {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -5279700566993277033L;
|
||||||
|
private String className = null;
|
||||||
|
private String libInstance = null;
|
||||||
|
private String instanceSupArch = null;
|
||||||
|
private String instanceSupModType = null;
|
||||||
|
|
||||||
|
ImproperInstanceException (String libClass, String instance1, String arch, String type) {
|
||||||
|
super();
|
||||||
|
className = libClass;
|
||||||
|
libInstance = instance1;
|
||||||
|
instanceSupArch = arch;
|
||||||
|
instanceSupModType = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.lang.Throwable#getMessage()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return " Library Class " + className + " Produced by Library Instance: "
|
||||||
|
+ libInstance + "\nOnly Supports " + instanceSupArch + " and Module Type " + instanceSupModType + ".\n This instance should be removed.\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
class NoInstanceException extends Exception {
|
class NoInstanceException extends Exception {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user