]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java
1. Fix EDKT323 (Only dependent packages' ppis can be added to module's ppi section)
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / module / ui / dialog / LibraryClassDefsDlg.java
index cb89109d3dc05ade3d1c5fb8086c3c663d2aa75c..87708b836c7b248ee8f774dd8f54250bd3481c36 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
  \r
- The file is used to create, update Library Class Definition of MSA/MBD file\r
+ The file is used to create, update Library Class Definition section of the MSA file\r
  \r
  Copyright (c) 2006, Intel Corporation\r
  All rights reserved. This program and the accompanying materials\r
@@ -35,14 +35,17 @@ import org.tianocore.frameworkwizard.common.ui.IDialog;
 import org.tianocore.frameworkwizard.common.ui.IFrame;\r
 import org.tianocore.frameworkwizard.common.ui.StarLabel;\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.packaging.PackageIdentification;\r
 import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
 \r
 /**\r
- The class is used to create, update Library Class Definition of MSA/MBD file\r
- It extends IInternalFrame\r
\r
- **/\r
+ * The class is used to create, update Library Class Definition section of the MSA file\r
+ * \r
+ * It extends IDialog\r
+ * \r
+ */\r
 public class LibraryClassDefsDlg extends IDialog {\r
 \r
     ///\r
@@ -96,7 +99,7 @@ public class LibraryClassDefsDlg extends IDialog {
     private JTextField jTextFieldHelpText = null;\r
 \r
     private ArchCheckBox jArchCheckBox = null;\r
-    \r
+\r
     private JButton jButtonOk = null;\r
 \r
     private JButton jButtonCancel = null;\r
@@ -119,7 +122,7 @@ public class LibraryClassDefsDlg extends IDialog {
     private JComboBox getJComboBoxLibraryClassName() {\r
         if (jComboBoxLibraryClassName == null) {\r
             jComboBoxLibraryClassName = new JComboBox();\r
-            jComboBoxLibraryClassName.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
+            jComboBoxLibraryClassName.setBounds(new java.awt.Rectangle(168, 12, 320, 20));\r
             jComboBoxLibraryClassName.setPreferredSize(new Dimension(320, 20));\r
             jComboBoxLibraryClassName.setEnabled(true);\r
         }\r
@@ -135,7 +138,7 @@ public class LibraryClassDefsDlg extends IDialog {
     private JComboBox getJComboBoxUsage() {\r
         if (jComboBoxUsage == null) {\r
             jComboBoxUsage = new JComboBox();\r
-            jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
+            jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 37, 320, 20));\r
             jComboBoxUsage.setPreferredSize(new Dimension(320, 20));\r
         }\r
         return jComboBoxUsage;\r
@@ -193,7 +196,7 @@ public class LibraryClassDefsDlg extends IDialog {
     private JButton getJButtonGenerateGuid() {\r
         if (jButtonGenerateGuid == null) {\r
             jButtonGenerateGuid = new JButton();\r
-            jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 110, 65, 20));\r
+            jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 112, 65, 20));\r
             jButtonGenerateGuid.setPreferredSize(new java.awt.Dimension(65, 20));\r
             jButtonGenerateGuid.setText("GEN");\r
             jButtonGenerateGuid.setVisible(false);\r
@@ -210,8 +213,10 @@ public class LibraryClassDefsDlg extends IDialog {
     private JTextField getJTextFieldFeatureFlag() {\r
         if (jTextFieldFeatureFlag == null) {\r
             jTextFieldFeatureFlag = new JTextField();\r
-            jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 85, 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
         }\r
         return jTextFieldFeatureFlag;\r
     }\r
@@ -237,7 +242,7 @@ public class LibraryClassDefsDlg extends IDialog {
     private JScrollPane getJScrollPaneModuleList() {\r
         if (jScrollPaneModuleList == null) {\r
             jScrollPaneModuleList = new JScrollPane();\r
-            jScrollPaneModuleList.setBounds(new java.awt.Rectangle(160, 135, 320, 80));\r
+            jScrollPaneModuleList.setBounds(new java.awt.Rectangle(168, 112, 320, 80));\r
             jScrollPaneModuleList.setPreferredSize(new java.awt.Dimension(320, 80));\r
             jScrollPaneModuleList.setViewportView(getICheckBoxListSupModuleList());\r
         }\r
@@ -253,7 +258,7 @@ public class LibraryClassDefsDlg extends IDialog {
     private JTextField getJTextFieldHelpText() {\r
         if (jTextFieldHelpText == null) {\r
             jTextFieldHelpText = new JTextField();\r
-            jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 60, 320, 20));\r
+            jTextFieldHelpText.setBounds(new java.awt.Rectangle(168, 62, 320, 20));\r
             jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));\r
         }\r
         return jTextFieldHelpText;\r
@@ -268,7 +273,7 @@ public class LibraryClassDefsDlg extends IDialog {
     private JButton getJButtonOk() {\r
         if (jButtonOk == null) {\r
             jButtonOk = new JButton();\r
-            jButtonOk.setBounds(new java.awt.Rectangle(290, 225, 90, 20));\r
+            jButtonOk.setBounds(new java.awt.Rectangle(300, 232, 90, 20));\r
             jButtonOk.setText("Ok");\r
             jButtonOk.addActionListener(this);\r
         }\r
@@ -284,7 +289,7 @@ public class LibraryClassDefsDlg extends IDialog {
     private JButton getJButtonCancel() {\r
         if (jButtonCancel == null) {\r
             jButtonCancel = new JButton();\r
-            jButtonCancel.setBounds(new java.awt.Rectangle(390, 225, 90, 20));\r
+            jButtonCancel.setBounds(new java.awt.Rectangle(400, 232, 90, 20));\r
             jButtonCancel.setText("Cancel");\r
             jButtonCancel.addActionListener(this);\r
         }\r
@@ -299,9 +304,9 @@ public class LibraryClassDefsDlg extends IDialog {
      This is the default constructor\r
      \r
      **/\r
-    public LibraryClassDefsDlg(LibraryClassIdentification inLibraryClassIdentification, IFrame iFrame) {\r
+    public LibraryClassDefsDlg(LibraryClassIdentification inLibraryClassIdentification, IFrame iFrame, ModuleIdentification mid) {\r
         super(iFrame, true);\r
-        init(inLibraryClassIdentification);\r
+        init(inLibraryClassIdentification, mid);\r
     }\r
 \r
     /**\r
@@ -311,7 +316,7 @@ public class LibraryClassDefsDlg extends IDialog {
     private void init() {\r
         this.setContentPane(getJScrollPane());\r
         this.setTitle("Library Class Definitions");\r
-        this.setBounds(new java.awt.Rectangle(0, 0, 500, 295));\r
+        this.setBounds(new java.awt.Rectangle(0, 0, 505, 305));\r
         initFrame();\r
         this.setViewMode(false);\r
         this.centerWindow();\r
@@ -321,9 +326,18 @@ public class LibraryClassDefsDlg extends IDialog {
      This method initializes this\r
      \r
      **/\r
-    private void init(LibraryClassIdentification inLibraryClassIdentification) {\r
+    private void init(LibraryClassIdentification inLibraryClassIdentification, ModuleIdentification mid) {\r
         init();\r
         this.lcid = inLibraryClassIdentification;\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
+        }\r
+        \r
+        Tools.generateComboBoxByVector(this.jComboBoxLibraryClassName,\r
+                                       wt.getAllLibraryClassDefinitionsFromPackages(wt.getPackageDependenciesOfModule(mid)));\r
+\r
         if (lcid != null) {\r
             this.jComboBoxLibraryClassName.setSelectedItem(lcid.getLibraryClassName());\r
             this.jComboBoxUsage.setSelectedItem(lcid.getUsage());\r
@@ -359,37 +373,38 @@ public class LibraryClassDefsDlg extends IDialog {
     private JPanel getJContentPane() {\r
         if (jContentPane == null) {\r
             jArchCheckBox = new ArchCheckBox();\r
-            jArchCheckBox.setBounds(new java.awt.Rectangle(160, 110, 320, 20));\r
+            jArchCheckBox.setBounds(new java.awt.Rectangle(168, 87, 320, 20));\r
             jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));\r
             jLabelHelpText = new JLabel();\r
-            jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 140, 20));\r
+            jLabelHelpText.setBounds(new java.awt.Rectangle(12, 62, 168, 20));\r
             jLabelHelpText.setText("Help Text");\r
             jLabelModuleList = new JLabel();\r
-            jLabelModuleList.setBounds(new java.awt.Rectangle(15, 135, 140, 20));\r
-            jLabelModuleList.setText("Sup Module List");\r
+            jLabelModuleList.setBounds(new java.awt.Rectangle(12, 112, 168, 20));\r
+            jLabelModuleList.setText("Supported Module Types");\r
             jLabelArch = new JLabel();\r
-            jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20));\r
-            jLabelArch.setText("Sup Arch List");\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(15, 85, 140, 20));\r
-            jLabelFeatureFlag.setText("Feature Flag");\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
-            jLabelRecommendedInstanceGuid.setBounds(new java.awt.Rectangle(15, 110, 200, 20));\r
+            jLabelRecommendedInstanceGuid.setBounds(new java.awt.Rectangle(12, 87, 200, 20));\r
             jLabelRecommendedInstanceGuid.setText("Recommended Instance Guid");\r
             jLabelRecommendedInstanceGuid.setVisible(false);\r
             jLabelRecommendedInstanceVersion = new JLabel();\r
-            jLabelRecommendedInstanceVersion.setBounds(new java.awt.Rectangle(15, 85, 200, 20));\r
+            jLabelRecommendedInstanceVersion.setBounds(new java.awt.Rectangle(12, 87, 200, 20));\r
             jLabelRecommendedInstanceVersion.setText("Recommended Instance Version");\r
             jLabelRecommendedInstanceVersion.setVisible(false);\r
             jLabelLibraryClassName = new JLabel();\r
-            jLabelLibraryClassName.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
+            jLabelLibraryClassName.setBounds(new java.awt.Rectangle(12, 12, 168, 20));\r
             jLabelLibraryClassName.setText("Library Class Name");\r
             jLabelUsage = new JLabel();\r
-            jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
+            jLabelUsage.setBounds(new java.awt.Rectangle(12, 37, 168, 20));\r
             jLabelUsage.setText("Usage");\r
             jContentPane = new JPanel();\r
             jContentPane.setLayout(null);\r
-            jContentPane.setPreferredSize(new java.awt.Dimension(490, 245));\r
+            jContentPane.setPreferredSize(new java.awt.Dimension(495, 255));\r
 \r
             jContentPane.add(getJComboBoxLibraryClassName(), null);\r
             jContentPane.add(jLabelUsage, null);\r
@@ -404,9 +419,9 @@ public class LibraryClassDefsDlg extends IDialog {
             jContentPane.add(getJTextFieldFeatureFlag(), null);\r
             jContentPane.add(jLabelArch, null);\r
             jStarLabel1 = new StarLabel();\r
-            jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
+            jStarLabel1.setLocation(new java.awt.Point(2, 10));\r
             jStarLabel2 = new StarLabel();\r
-            jStarLabel2.setLocation(new java.awt.Point(0, 35));\r
+            jStarLabel2.setLocation(new java.awt.Point(2, 35));\r
 \r
             jContentPane.add(jStarLabel1, null);\r
             jContentPane.add(jStarLabel2, null);\r
@@ -426,7 +441,6 @@ public class LibraryClassDefsDlg extends IDialog {
      \r
      **/\r
     private void initFrame() {\r
-        Tools.generateComboBoxByVector(jComboBoxLibraryClassName, wt.getAllLibraryClassDefinitionsFromWorkspace());\r
         Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVLibraryUsage());\r
         this.iCheckBoxListModule.setAllItems(ed.getVFrameworkModuleTypes());\r
     }\r
@@ -468,7 +482,7 @@ public class LibraryClassDefsDlg extends IDialog {
         // Check LibraryClass\r
         //\r
         if (this.jComboBoxLibraryClassName.getSelectedItem() == null) {\r
-            Log.wrn("Update Library Class Definitions", "No Library Class can be added");\r
+            Log.wrn("Update Library Class Definitions", "Please select one Library Class");\r
             return false;\r
         }\r
         if (!DataValidation.isLibraryClass(this.jComboBoxLibraryClassName.getSelectedItem().toString())) {\r