\r
import java.util.Vector;\r
\r
-\r
public class LibraryClassVector {\r
private Vector<LibraryClassIdentification> vLibraryClass = new Vector<LibraryClassIdentification>();\r
- \r
+\r
public int findLibraryClass(LibraryClassIdentification lib) {\r
- return findLibraryClass(lib.getLibraryClassName());\r
+ for (int index = 0; index < vLibraryClass.size(); index++) {\r
+ if (vLibraryClass.elementAt(index).getLibraryClassName().equals(lib.getLibraryClassName())\r
+ && vLibraryClass.elementAt(index).getUsage().equals(lib.getUsage())) {\r
+ return index;\r
+ }\r
+ }\r
+ return -1;\r
}\r
- \r
+\r
public int findLibraryClass(String name) {\r
for (int index = 0; index < vLibraryClass.size(); index++) {\r
if (vLibraryClass.elementAt(index).getLibraryClassName().equals(name)) {\r
}\r
return -1;\r
}\r
- \r
+\r
public LibraryClassIdentification getLibraryClass(int index) {\r
if (index > -1) {\r
return vLibraryClass.elementAt(index);\r
return null;\r
}\r
}\r
- \r
+\r
public void addLibraryClass(LibraryClassIdentification lib) {\r
if (findLibraryClass(lib) == -1) {\r
vLibraryClass.addElement(lib);\r
}\r
}\r
- \r
+\r
public void setLibraryClass(LibraryClassIdentification lib, int index) {\r
vLibraryClass.setElementAt(lib, index);\r
}\r
- \r
+\r
public void removeLibraryClass(LibraryClassIdentification lib) {\r
int index = findLibraryClass(lib);\r
if (index > -1) {\r
vLibraryClass.removeElementAt(index);\r
}\r
}\r
- \r
+\r
public void removeLibraryClass(int index) {\r
if (index > -1 && index < this.size()) {\r
vLibraryClass.removeElementAt(index);\r
public void setVLibraryClass(Vector<LibraryClassIdentification> libraryClass) {\r
vLibraryClass = libraryClass;\r
}\r
- \r
+\r
public Vector<String> getLibraryClassName() {\r
Vector<String> v = new Vector<String>();\r
for (int index = 0; index < this.vLibraryClass.size(); index++) {\r
}\r
return v;\r
}\r
- \r
+\r
public int size() {\r
return this.vLibraryClass.size();\r
}\r
- \r
+\r
public Vector<String> toStringVector(int index) {\r
Vector<String> v = new Vector<String>();\r
v.addElement(getLibraryClass(index).getLibraryClassName());\r
import org.tianocore.frameworkwizard.common.EnumerationData;\r
import org.tianocore.frameworkwizard.common.Log;\r
import org.tianocore.frameworkwizard.common.Tools;\r
+import org.tianocore.frameworkwizard.common.find.Find;\r
import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;\r
import org.tianocore.frameworkwizard.common.ui.IDialog;\r
import org.tianocore.frameworkwizard.common.ui.IFrame;\r
import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;\r
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification;\r
+import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;\r
import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
\r
private JTextField getJTextFieldFeatureFlag() {\r
if (jTextFieldFeatureFlag == null) {\r
jTextFieldFeatureFlag = new JTextField();\r
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168,197,320,20));\r
+ jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 197, 320, 20));\r
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));\r
jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");\r
jTextFieldFeatureFlag.setEnabled(false);\r
This is the default constructor\r
\r
**/\r
- public LibraryClassDefsDlg(LibraryClassIdentification inLibraryClassIdentification, IFrame iFrame, ModuleIdentification mid) {\r
+ public LibraryClassDefsDlg(LibraryClassIdentification inLibraryClassIdentification, IFrame iFrame,\r
+ ModuleIdentification mid) {\r
super(iFrame, true);\r
init(inLibraryClassIdentification, mid);\r
}\r
private void init(LibraryClassIdentification inLibraryClassIdentification, ModuleIdentification mid) {\r
init();\r
this.lcid = inLibraryClassIdentification;\r
- \r
+\r
//\r
// Init arch with module's arch\r
//\r
this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));\r
- \r
+\r
//\r
// Get defined library classes from dependent packages\r
//\r
Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);\r
if (vpid.size() <= 0) {\r
- Log.wrn("Init Library Class", "This module hasn't defined any package dependency, so there is no library class can be added");\r
+ Log.wrn("Init Library Class",\r
+ "This module hasn't defined any package dependency, so there is no library class can be added");\r
}\r
- \r
- Tools.generateComboBoxByVector(this.jComboBoxLibraryClassName,\r
- wt.getAllLibraryClassDefinitionsFromPackages(wt.getPackageDependenciesOfModule(mid)));\r
+\r
+ Tools\r
+ .generateComboBoxByVector(\r
+ this.jComboBoxLibraryClassName,\r
+ wt\r
+ .getAllLibraryClassDefinitionsFromPackages(wt\r
+ .getPackageDependenciesOfModule(mid)));\r
\r
if (lcid != null) {\r
this.jComboBoxLibraryClassName.setSelectedItem(lcid.getLibraryClassName());\r
jLabelArch.setBounds(new java.awt.Rectangle(12, 87, 168, 20));\r
jLabelArch.setText("Supported Architectures");\r
jLabelFeatureFlag = new JLabel();\r
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12,197,168,20));\r
+ jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 197, 168, 20));\r
jLabelFeatureFlag.setText("Feature Flag Expression");\r
jLabelFeatureFlag.setEnabled(false);\r
jLabelRecommendedInstanceGuid = new JLabel();\r
return false;\r
}\r
\r
+ //\r
+ // Check if the library is produced\r
+ //\r
+ String strUsage = this.jComboBoxUsage.getSelectedItem().toString();\r
+ //\r
+ // Check only when the library class is consumed\r
+ //\r
+ if (strUsage.equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED) || strUsage.equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {\r
+ LibraryClassVector v = Find.getAllLibraryClassVector();\r
+ boolean isFind = false;\r
+ for (int index = 0; index < v.size(); index++) {\r
+ LibraryClassIdentification lid = v.getLibraryClass(index);\r
+ if (lid.getLibraryClassName().equals(this.jComboBoxLibraryClassName.getSelectedItem().toString())) {\r
+ if (lid.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)\r
+ || lid.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {\r
+ isFind = true;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ if (!isFind) {\r
+ Log.wrn("Update Library Class Definitions", "This Library Class has no instance yet.");\r
+ return false;\r
+ }\r
+ }\r
+ \r
//\r
// Check RecommendedInstanceVersion\r
//\r