X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fmodule%2Fui%2Fdialog%2FLibraryClassDefsDlg.java;h=c475b4ab1bdcbeff159832fa15d0ca4454fcfc3e;hb=214b0d1914b48d651b25e58f321ddb77a46903b8;hp=00fe724ae2ab35ea2a62a5e67fdbb925e16dacdf;hpb=06a19ceec7b8b78f4698073ce4054b26dc4a74bd;p=mirror_edk2.git diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java index 00fe724ae2..c475b4ab1b 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java @@ -1,6 +1,6 @@ /** @file - The file is used to create, update Library Class Definition of MSA/MBD file + The file is used to create, update Library Class Definition section of the MSA file Copyright (c) 2006, Intel Corporation All rights reserved. This program and the accompanying materials @@ -35,14 +35,17 @@ import org.tianocore.frameworkwizard.common.ui.IDialog; import org.tianocore.frameworkwizard.common.ui.IFrame; import org.tianocore.frameworkwizard.common.ui.StarLabel; import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList; +import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification; import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification; +import org.tianocore.frameworkwizard.packaging.PackageIdentification; import org.tianocore.frameworkwizard.workspace.WorkspaceTools; /** - The class is used to create, update Library Class Definition of MSA/MBD file - It extends IInternalFrame - - **/ + * The class is used to create, update Library Class Definition section of the MSA file + * + * It extends IDialog + * + */ public class LibraryClassDefsDlg extends IDialog { /// @@ -96,7 +99,7 @@ public class LibraryClassDefsDlg extends IDialog { private JTextField jTextFieldHelpText = null; private ArchCheckBox jArchCheckBox = null; - + private JButton jButtonOk = null; private JButton jButtonCancel = null; @@ -119,7 +122,7 @@ public class LibraryClassDefsDlg extends IDialog { private JComboBox getJComboBoxLibraryClassName() { if (jComboBoxLibraryClassName == null) { jComboBoxLibraryClassName = new JComboBox(); - jComboBoxLibraryClassName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); + jComboBoxLibraryClassName.setBounds(new java.awt.Rectangle(168, 12, 320, 20)); jComboBoxLibraryClassName.setPreferredSize(new Dimension(320, 20)); jComboBoxLibraryClassName.setEnabled(true); } @@ -135,7 +138,7 @@ public class LibraryClassDefsDlg extends IDialog { private JComboBox getJComboBoxUsage() { if (jComboBoxUsage == null) { jComboBoxUsage = new JComboBox(); - jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); + jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 37, 320, 20)); jComboBoxUsage.setPreferredSize(new Dimension(320, 20)); } return jComboBoxUsage; @@ -193,7 +196,7 @@ public class LibraryClassDefsDlg extends IDialog { private JButton getJButtonGenerateGuid() { if (jButtonGenerateGuid == null) { jButtonGenerateGuid = new JButton(); - jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 110, 65, 20)); + jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 112, 65, 20)); jButtonGenerateGuid.setPreferredSize(new java.awt.Dimension(65, 20)); jButtonGenerateGuid.setText("GEN"); jButtonGenerateGuid.setVisible(false); @@ -210,8 +213,10 @@ public class LibraryClassDefsDlg extends IDialog { private JTextField getJTextFieldFeatureFlag() { if (jTextFieldFeatureFlag == null) { jTextFieldFeatureFlag = new JTextField(); - jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 85, 320, 20)); + jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168,197,320,20)); jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + jTextFieldFeatureFlag.setEnabled(false); } return jTextFieldFeatureFlag; } @@ -237,7 +242,7 @@ public class LibraryClassDefsDlg extends IDialog { private JScrollPane getJScrollPaneModuleList() { if (jScrollPaneModuleList == null) { jScrollPaneModuleList = new JScrollPane(); - jScrollPaneModuleList.setBounds(new java.awt.Rectangle(160, 135, 320, 80)); + jScrollPaneModuleList.setBounds(new java.awt.Rectangle(168, 112, 320, 80)); jScrollPaneModuleList.setPreferredSize(new java.awt.Dimension(320, 80)); jScrollPaneModuleList.setViewportView(getICheckBoxListSupModuleList()); } @@ -253,7 +258,7 @@ public class LibraryClassDefsDlg extends IDialog { private JTextField getJTextFieldHelpText() { if (jTextFieldHelpText == null) { jTextFieldHelpText = new JTextField(); - jTextFieldHelpText.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); + jTextFieldHelpText.setBounds(new java.awt.Rectangle(168, 62, 320, 20)); jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20)); } return jTextFieldHelpText; @@ -268,7 +273,7 @@ public class LibraryClassDefsDlg extends IDialog { private JButton getJButtonOk() { if (jButtonOk == null) { jButtonOk = new JButton(); - jButtonOk.setBounds(new java.awt.Rectangle(290, 225, 90, 20)); + jButtonOk.setBounds(new java.awt.Rectangle(300, 232, 90, 20)); jButtonOk.setText("Ok"); jButtonOk.addActionListener(this); } @@ -284,7 +289,7 @@ public class LibraryClassDefsDlg extends IDialog { private JButton getJButtonCancel() { if (jButtonCancel == null) { jButtonCancel = new JButton(); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 225, 90, 20)); + jButtonCancel.setBounds(new java.awt.Rectangle(400, 232, 90, 20)); jButtonCancel.setText("Cancel"); jButtonCancel.addActionListener(this); } @@ -299,9 +304,9 @@ public class LibraryClassDefsDlg extends IDialog { This is the default constructor **/ - public LibraryClassDefsDlg(LibraryClassIdentification inLibraryClassIdentification, IFrame iFrame) { + public LibraryClassDefsDlg(LibraryClassIdentification inLibraryClassIdentification, IFrame iFrame, ModuleIdentification mid) { super(iFrame, true); - init(inLibraryClassIdentification); + init(inLibraryClassIdentification, mid); } /** @@ -311,7 +316,7 @@ public class LibraryClassDefsDlg extends IDialog { private void init() { this.setContentPane(getJScrollPane()); this.setTitle("Library Class Definitions"); - this.setBounds(new java.awt.Rectangle(0, 0, 500, 295)); + this.setBounds(new java.awt.Rectangle(0, 0, 505, 305)); initFrame(); this.setViewMode(false); this.centerWindow(); @@ -321,9 +326,26 @@ public class LibraryClassDefsDlg extends IDialog { This method initializes this **/ - private void init(LibraryClassIdentification inLibraryClassIdentification) { + private void init(LibraryClassIdentification inLibraryClassIdentification, ModuleIdentification mid) { init(); this.lcid = inLibraryClassIdentification; + + // + // Init arch with module's arch + // + this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid)); + + // + // Get defined library classes from dependent packages + // + Vector vpid = wt.getPackageDependenciesOfModule(mid); + if (vpid.size() <= 0) { + Log.wrn("Init Library Class", "This module hasn't defined any package dependency, so there is no library class can be added"); + } + + Tools.generateComboBoxByVector(this.jComboBoxLibraryClassName, + wt.getAllLibraryClassDefinitionsFromPackages(wt.getPackageDependenciesOfModule(mid))); + if (lcid != null) { this.jComboBoxLibraryClassName.setSelectedItem(lcid.getLibraryClassName()); this.jComboBoxUsage.setSelectedItem(lcid.getUsage()); @@ -359,37 +381,38 @@ public class LibraryClassDefsDlg extends IDialog { private JPanel getJContentPane() { if (jContentPane == null) { jArchCheckBox = new ArchCheckBox(); - jArchCheckBox.setBounds(new java.awt.Rectangle(160, 110, 320, 20)); + jArchCheckBox.setBounds(new java.awt.Rectangle(168, 87, 320, 20)); jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); jLabelHelpText = new JLabel(); - jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 140, 20)); + jLabelHelpText.setBounds(new java.awt.Rectangle(12, 62, 168, 20)); jLabelHelpText.setText("Help Text"); jLabelModuleList = new JLabel(); - jLabelModuleList.setBounds(new java.awt.Rectangle(15, 135, 140, 20)); - jLabelModuleList.setText("Sup Module List"); + jLabelModuleList.setBounds(new java.awt.Rectangle(12, 112, 168, 20)); + jLabelModuleList.setText("Supported Module Types"); jLabelArch = new JLabel(); - jLabelArch.setBounds(new java.awt.Rectangle(15, 110, 140, 20)); - jLabelArch.setText("Sup Arch List"); + jLabelArch.setBounds(new java.awt.Rectangle(12, 87, 168, 20)); + jLabelArch.setText("Supported Architectures"); jLabelFeatureFlag = new JLabel(); - jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20)); - jLabelFeatureFlag.setText("Feature Flag"); + jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12,197,168,20)); + jLabelFeatureFlag.setText("Feature Flag Expression"); + jLabelFeatureFlag.setEnabled(false); jLabelRecommendedInstanceGuid = new JLabel(); - jLabelRecommendedInstanceGuid.setBounds(new java.awt.Rectangle(15, 110, 200, 20)); + jLabelRecommendedInstanceGuid.setBounds(new java.awt.Rectangle(12, 87, 200, 20)); jLabelRecommendedInstanceGuid.setText("Recommended Instance Guid"); jLabelRecommendedInstanceGuid.setVisible(false); jLabelRecommendedInstanceVersion = new JLabel(); - jLabelRecommendedInstanceVersion.setBounds(new java.awt.Rectangle(15, 85, 200, 20)); + jLabelRecommendedInstanceVersion.setBounds(new java.awt.Rectangle(12, 87, 200, 20)); jLabelRecommendedInstanceVersion.setText("Recommended Instance Version"); jLabelRecommendedInstanceVersion.setVisible(false); jLabelLibraryClassName = new JLabel(); - jLabelLibraryClassName.setBounds(new java.awt.Rectangle(15, 10, 140, 20)); + jLabelLibraryClassName.setBounds(new java.awt.Rectangle(12, 12, 168, 20)); jLabelLibraryClassName.setText("Library Class Name"); jLabelUsage = new JLabel(); - jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 140, 20)); + jLabelUsage.setBounds(new java.awt.Rectangle(12, 37, 168, 20)); jLabelUsage.setText("Usage"); jContentPane = new JPanel(); jContentPane.setLayout(null); - jContentPane.setPreferredSize(new java.awt.Dimension(490, 245)); + jContentPane.setPreferredSize(new java.awt.Dimension(495, 255)); jContentPane.add(getJComboBoxLibraryClassName(), null); jContentPane.add(jLabelUsage, null); @@ -404,9 +427,9 @@ public class LibraryClassDefsDlg extends IDialog { jContentPane.add(getJTextFieldFeatureFlag(), null); jContentPane.add(jLabelArch, null); jStarLabel1 = new StarLabel(); - jStarLabel1.setLocation(new java.awt.Point(0, 10)); + jStarLabel1.setLocation(new java.awt.Point(2, 10)); jStarLabel2 = new StarLabel(); - jStarLabel2.setLocation(new java.awt.Point(0, 35)); + jStarLabel2.setLocation(new java.awt.Point(2, 35)); jContentPane.add(jStarLabel1, null); jContentPane.add(jStarLabel2, null); @@ -426,7 +449,6 @@ public class LibraryClassDefsDlg extends IDialog { **/ private void initFrame() { - Tools.generateComboBoxByVector(jComboBoxLibraryClassName, wt.getAllLibraryClassDefinitionsFromWorkspace()); Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVLibraryUsage()); this.iCheckBoxListModule.setAllItems(ed.getVFrameworkModuleTypes()); } @@ -468,11 +490,11 @@ public class LibraryClassDefsDlg extends IDialog { // Check LibraryClass // if (this.jComboBoxLibraryClassName.getSelectedItem() == null) { - Log.err("No Library Class can be added"); + Log.wrn("Update Library Class Definitions", "Please select one Library Class"); return false; } if (!DataValidation.isLibraryClass(this.jComboBoxLibraryClassName.getSelectedItem().toString())) { - Log.err("Incorrect data type for Library Class"); + Log.wrn("Update Library Class Definitions", "Incorrect data type for Library Class"); return false; } @@ -501,7 +523,7 @@ public class LibraryClassDefsDlg extends IDialog { // if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { - Log.err("Incorrect data type for Feature Flag"); + Log.wrn("Update Library Class Definitions", "Incorrect data type for Feature Flag"); return false; } }