From: hche10x Date: Fri, 28 Jul 2006 05:03:19 +0000 (+0000) Subject: 1. Change ToolCode from text field to drop down list, and user can enter their custom... X-Git-Tag: edk2-stable201903~24739 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=a929458e6682db26d87d4ebe80150e13820d3e50 1. Change ToolCode from text field to drop down list, and user can enter their customizing tool command. 2. Fix some coding style issue git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1133 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java index 2b6b25f9be..3c960b4699 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java @@ -2599,10 +2599,12 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele **/ private void doubleClickModuleTreeNode() { - Identification id = iTree.getSelectNode().getId(); - int intCategory = iTree.getSelectCategory(); + Identification id = null; + int intCategory = -1; String path = null; try { + id = iTree.getSelectNode().getId(); + intCategory = iTree.getSelectCategory(); // // If the node is not opened yet // Insert top level elements first @@ -2894,8 +2896,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele try { wt.addPackageToDatabase(smb.getPid()); } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); + Log.err("addPackageToDatabase", e.getMessage()); } vPackageList.addElement(smb.getPid()); @@ -2932,8 +2933,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele try { wt.addPlatformToDatabase(smb.getFid()); } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); + Log.err("addPlatformToDatabase", e.getMessage()); } vPlatformList.addElement(smb.getFid()); // diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java index bf050e0f64..126bd1dcc2 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java @@ -84,6 +84,8 @@ public class EnumerationData { public Vector vSourceFilesFileType = new Vector(); + public Vector vToolCode = new Vector(); + // // Used by Package Dependencies // @@ -203,6 +205,7 @@ public class EnumerationData { // initSourceFilesToolChainFamily(); initSourceFilesFileType(); + initToolCode(); // // Used by Package Dependencies @@ -491,6 +494,18 @@ public class EnumerationData { vSourceFilesFileType.addElement("EFI"); } + private void initToolCode() { + vToolCode.removeAllElements(); + vToolCode.addElement(DataType.EMPTY_SELECT_ITEM); + vToolCode.addElement("CC"); + vToolCode.addElement("DLINK"); + vToolCode.addElement("SLINK"); + vToolCode.addElement("PP"); + vToolCode.addElement("ASM"); + vToolCode.addElement("ASMLINK"); + vToolCode.addElement("ASL"); + } + private void initPackageUsage() { vPackageUsage.removeAllElements(); vPackageUsage.addElement("ALWAYS_CONSUMED"); @@ -1010,4 +1025,12 @@ public class EnumerationData { public void setVPackageUsage(Vector packageUsage) { vPackageUsage = packageUsage; } + + public Vector getVToolCode() { + return vToolCode; + } + + public void setVToolCode(Vector toolCode) { + vToolCode = toolCode; + } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/FileOperation.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/FileOperation.java index b0802a60e8..7f15de8f89 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/FileOperation.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/FileOperation.java @@ -40,26 +40,8 @@ public class FileOperation { **/ public static void newFolder(String folderPath) throws Exception { folderPath = Tools.convertPathToCurrentOsType(folderPath); - String temp = ""; - while (folderPath.length() > 0) { - if (folderPath.indexOf(DataType.FILE_SEPARATOR) > -1) { - temp = temp + folderPath.substring(0, folderPath.indexOf(DataType.FILE_SEPARATOR)); - if (temp.endsWith(":")) { - temp = Tools.addFileSeparator(temp); - folderPath = folderPath.substring(folderPath.indexOf(DataType.FILE_SEPARATOR) + DataType.FILE_SEPARATOR.length()); - continue; - } - temp = Tools.addFileSeparator(temp); - folderPath = folderPath.substring(folderPath.indexOf(DataType.FILE_SEPARATOR) + DataType.FILE_SEPARATOR.length()); - } else { - temp = Tools.addFileSeparator(temp) + folderPath; - folderPath = ""; - } - File f = new File(temp); - if (!f.exists()) { - f.mkdir(); - } - } + File f = new File(folderPath); + f.mkdirs(); } /** diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java index 59204a8adb..7cb2e9d526 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java @@ -320,7 +320,7 @@ public class Tools { **/ public static void showInformationMessage(String arg0) { - JOptionPane.showConfirmDialog(null, arg0, "Error", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showConfirmDialog(null, arg0, "Info", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE); } /** diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IComboBox.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IComboBox.java index 13d7771e3a..bba08664bb 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IComboBox.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IComboBox.java @@ -92,7 +92,8 @@ public class IComboBox extends JComboBox implements KeyListener, MouseListener, this.addKeyListener(this); this.getEditor().getEditorComponent().addKeyListener(this); this.getEditor().getEditorComponent().addFocusListener(this); - this.setToolTipText("Double Click to add an entry and finished by press ENTER. Press DELETE can remove selected entry."); + this.setToolTipText("Double Click to add an entry and finished by press ENTER.
" + + "Press DELETE can remove selected entry."); } public void keyPressed(KeyEvent arg0) { @@ -122,6 +123,7 @@ public class IComboBox extends JComboBox implements KeyListener, MouseListener, } this.setEditable(false); } + if (arg0.getKeyCode() == KeyEvent.VK_ESCAPE) { closeEdit(); } @@ -160,7 +162,6 @@ public class IComboBox extends JComboBox implements KeyListener, MouseListener, this.setEditable(true); this.getEditor().setItem(""); } - } public void mouseEntered(MouseEvent arg0) { @@ -190,8 +191,5 @@ public class IComboBox extends JComboBox implements KeyListener, MouseListener, private void closeEdit() { this.setEditable(false); this.getEditor().setItem(""); - if (this.getItemCount() > 0) { - this.setSelectedIndex(0); - } } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDefinitions.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDefinitions.java index fa0963d6d8..a427b2f770 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDefinitions.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDefinitions.java @@ -65,9 +65,9 @@ public class ModuleDefinitions extends IInternalFrame { private StarLabel jStarLabel2 = null; private StarLabel jStarLabel3 = null; - + private OpeningModuleType omt = null; - + private ClonedFrom cf = null; private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null; @@ -136,12 +136,12 @@ public class ModuleDefinitions extends IInternalFrame { if (iCheckBoxListArch == null) { iCheckBoxListArch = new ICheckBoxList(); iCheckBoxListArch.addFocusListener(this); - iCheckBoxListArch.setToolTipText("Deselecting a checkbox will restrict this module
" + - "for use with the selected architectures,
" + - "based on the list of items that are checked.
" + - "If all boxes are checked,
" + - "then the module will support all
" + - "current AND FUTURE architectures"); + iCheckBoxListArch.setToolTipText("Deselecting a checkbox will restrict this module
" + + "for use with the selected architectures,
" + + "based on the list of items that are checked.
" + + "If all boxes are checked,
" + + "then the module will support all
" + + "current AND FUTURE architectures"); } return iCheckBoxListArch; } @@ -157,14 +157,14 @@ public class ModuleDefinitions extends IInternalFrame { jComboBoxBinaryModule.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); jComboBoxBinaryModule.setPreferredSize(new java.awt.Dimension(320, 20)); jComboBoxBinaryModule.addFocusListener(this); - jComboBoxBinaryModule.setToolTipText("Modules are either source modules
" + - "which can be compiled or binary
" + - "modules which are linked.
" + - "A module cannot contain both.
" + - "The GUID numbers should be identical
" + - "for a binary and source MSA,
" + - "but the BINARY MSA should have
" + - "a higher version number."); + jComboBoxBinaryModule.setToolTipText("Modules are either source modules
" + + "which can be compiled or binary
" + + "modules which are linked.
" + + "A module cannot contain both.
" + + "The GUID numbers should be identical
" + + "for a binary and source MSA,
" + + "but the BINARY MSA should have
" + + "a higher version number."); } return jComboBoxBinaryModule; } @@ -231,7 +231,7 @@ public class ModuleDefinitions extends IInternalFrame { this.omt = inOmt; this.msa = omt.getXmlMsa(); if (msa.getModuleDefinitions() != null) { - this.cf = msa.getModuleDefinitions().getClonedFrom(); + this.cf = msa.getModuleDefinitions().getClonedFrom(); } init(msa.getModuleDefinitions()); this.setVisible(true); @@ -283,7 +283,7 @@ public class ModuleDefinitions extends IInternalFrame { this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures()); Tools.generateComboBoxByVector(jComboBoxBinaryModule, ed.getVBoolean()); } - + private boolean check() { if (isEmpty(this.jTextFieldOutputFileBasename.getText())) { Log.wrn("Update Definitions", "Output File Basename couldn't be empty!"); @@ -332,7 +332,7 @@ public class ModuleDefinitions extends IInternalFrame { } else { md.setBinaryModule(true); } - + // // Set ClonedFrom field // @@ -344,9 +344,9 @@ public class ModuleDefinitions extends IInternalFrame { // Save Arch list // md.setSupportedArchitectures(this.iCheckBoxListArch.getAllCheckedItemsString()); - + msa.setModuleDefinitions(md); - + this.omt.setSaved(false); } catch (Exception e) { diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java index d7a4e13813..e70933499a 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java @@ -313,7 +313,7 @@ public class ModuleEvents extends IInternalFrame { } return jContentPane; } - + private void showEdit(int index) { EventsDlg dlg = new EventsDlg(vid.getEvents(index), new IFrame()); int result = dlg.showDialog(); diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java index f7088403f2..b62338b211 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java @@ -307,7 +307,7 @@ public class ModuleProtocols extends IInternalFrame { } return jContentPane; } - + private void showEdit(int index) { ProtocolsDlg dlg = new ProtocolsDlg(vid.getProtocols(index), new IFrame()); int result = dlg.showDialog(); @@ -450,7 +450,7 @@ public class ModuleProtocols extends IInternalFrame { Log.err("Update Protocols", e.getMessage()); } } - + /* (non-Javadoc) * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent) * diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java index b2fee47a48..644302f55e 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java @@ -348,7 +348,8 @@ public class ModuleSourceFiles extends IInternalFrame { } private void showEdit(int index) { - SourceFilesDlg sfd = new SourceFilesDlg(this.vSourceFiles.getSourceFiles(index), new IFrame(), omt.getId().getPath()); + SourceFilesDlg sfd = new SourceFilesDlg(this.vSourceFiles.getSourceFiles(index), new IFrame(), omt.getId() + .getPath()); int result = sfd.showDialog(); if (result == DataType.RETURN_TYPE_OK) { if (index == -1) { diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java index c161b5de4c..4f6cc955ff 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java @@ -1052,7 +1052,7 @@ public class MsaHeader extends IInternalFrame { } } } - + this.save(); } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BootModesDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BootModesDlg.java index 1ff4c8bb99..f7cc1a9a45 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BootModesDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BootModesDlg.java @@ -50,371 +50,386 @@ import org.tianocore.frameworkwizard.module.Identifications.BootModes.BootModesI */ public class BootModesDlg extends IDialog { - // / - // / Define class Serial Version UID - // / - private static final long serialVersionUID = -3888558623432442561L; + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = -3888558623432442561L; - // - // Define class members - // - private JPanel jContentPane = null; + // + // Define class members + // + private JPanel jContentPane = null; - private JLabel jLabelBootModeName = null; + private JLabel jLabelBootModeName = null; - private JComboBox jComboBoxBootModeName = null; + private JComboBox jComboBoxBootModeName = null; - private JLabel jLabelUsage = null; + private JLabel jLabelUsage = null; - private JComboBox jComboBoxUsage = null; + private JComboBox jComboBoxUsage = null; - private StarLabel jStarLabel1 = null; + private StarLabel jStarLabel1 = null; - private StarLabel jStarLabel2 = null; + private StarLabel jStarLabel2 = null; - private JLabel jLabelFeatureFlag = null; + private JLabel jLabelFeatureFlag = null; - private JTextField jTextFieldFeatureFlag = null; + private JTextField jTextFieldFeatureFlag = null; - private JLabel jLabelArch = null; + private JLabel jLabelArch = null; - private JScrollPane jScrollPane = null; + private JScrollPane jScrollPane = null; - private JLabel jLabelHelpText = null; + private JLabel jLabelHelpText = null; - private JTextArea jTextAreaHelpText = null; + private JTextArea jTextAreaHelpText = null; - private JScrollPane jScrollPaneHelpText = null; + private JScrollPane jScrollPaneHelpText = null; - private ArchCheckBox jArchCheckBox = null; + private ArchCheckBox jArchCheckBox = null; - private JButton jButtonOk = null; + private JButton jButtonOk = null; - private JButton jButtonCancel = null; + private JButton jButtonCancel = null; - // - // Not used by UI - // - private BootModesIdentification id = null; + // + // Not used by UI + // + private BootModesIdentification id = null; + + private EnumerationData ed = new EnumerationData(); + + /** + * This method initializes jComboBoxBootModeName + * + * @return javax.swing.JComboBox jComboBoxBootModeName + * + */ + private JComboBox getJComboBoxBootModeName() { + if (jComboBoxBootModeName == null) { + jComboBoxBootModeName = new JComboBox(); + jComboBoxBootModeName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); + jComboBoxBootModeName.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxBootModeName + .setToolTipText("" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "
FULLBoot with full configuration
MINIMALBoot with minimal configuration
NO_CHANGEBoot assuming no configuration changes
DIAGNOSTICSBoot with full configuration plus diagnostics
DEFAULTBoot with default settings
BOOT_ON_S#_RESUMEwhere # is 2, 3, 4 or 5
FLASH_UPDATEBoot on flash update
RECOVERYBoot in recovery mode
"); + } + return jComboBoxBootModeName; + } - private EnumerationData ed = new EnumerationData(); + /** + * This method initializes jComboBoxUsage + * + * @return javax.swing.JComboBox jComboBoxUsage + * + */ + private JComboBox getJComboBoxUsage() { + if (jComboBoxUsage == null) { + jComboBoxUsage = new JComboBox(); + jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); + jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxUsage + .setToolTipText("" + + "" + + "" + + "" + + "" + + "
ALWAYS_CONSUMEDIndicates Supports the specified boot mode
SOMETIMES_CONSUMEDIndicates Supports the specified boot mode on some execution paths
ALWAYS_PRODUCEDAlways changes the boot mode
SOMETIMES_PRODUCEDChange the boot mode sometimes
"); + } + return jComboBoxUsage; + } - /** - * This method initializes jComboBoxBootModeName - * - * @return javax.swing.JComboBox jComboBoxBootModeName - * - */ - private JComboBox getJComboBoxBootModeName() { - if (jComboBoxBootModeName == null) { - jComboBoxBootModeName = new JComboBox(); - jComboBoxBootModeName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); - jComboBoxBootModeName.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxBootModeName.setToolTipText("
FULLBoot with full configuration
MINIMALBoot with minimal configuration
NO_CHANGEBoot assuming no configuration changes
DIAGNOSTICSBoot with full configuration plus diagnostics
DEFAULTBoot with default settings
BOOT_ON_S#_RESUMEwhere # is 2, 3, 4 or 5
FLASH_UPDATEBoot on flash update
RECOVERYBoot in recovery mode
"); + /** + * This method initializes jTextFieldFeatureFlag + * + * @return javax.swing.JTextField + */ + private JTextField getJTextFieldFeatureFlag() { + if (jTextFieldFeatureFlag == null) { + jTextFieldFeatureFlag = new JTextField(); + jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 320, 20)); + jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + } + return jTextFieldFeatureFlag; } - return jComboBoxBootModeName; - } - - /** - * This method initializes jComboBoxUsage - * - * @return javax.swing.JComboBox jComboBoxUsage - * - */ - private JComboBox getJComboBoxUsage() { - if (jComboBoxUsage == null) { - jComboBoxUsage = new JComboBox(); - jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); - jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxUsage.setToolTipText("
ALWAYS_CONSUMEDIndicates Supports the specified boot mode
SOMETIMES_CONSUMEDIndicates Supports the specified boot mode on some execution paths
ALWAYS_PRODUCEDAlways changes the boot mode
SOMETIMES_PRODUCEDChange the boot mode sometimes
"); + + /** + * This method initializes jScrollPane + * + * @return javax.swing.JScrollPane + */ + private JScrollPane getJScrollPane() { + if (jScrollPane == null) { + jScrollPane = new JScrollPane(); + jScrollPane.setViewportView(getJContentPane()); + } + return jScrollPane; } - return jComboBoxUsage; - } - - /** - * This method initializes jTextFieldFeatureFlag - * - * @return javax.swing.JTextField - */ - private JTextField getJTextFieldFeatureFlag() { - if (jTextFieldFeatureFlag == null) { - jTextFieldFeatureFlag = new JTextField(); - jTextFieldFeatureFlag - .setBounds(new java.awt.Rectangle(160, 105, 320, 20)); - jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + + /** + * This method initializes jTextAreaHelpText + * + * @return javax.swing.JTextArea + * + */ + private JTextArea getJTextAreaHelpText() { + if (jTextAreaHelpText == null) { + jTextAreaHelpText = new JTextArea(); + jTextAreaHelpText.setLineWrap(true); + jTextAreaHelpText.setWrapStyleWord(true); + } + return jTextAreaHelpText; } - return jTextFieldFeatureFlag; - } - - /** - * This method initializes jScrollPane - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setViewportView(getJContentPane()); + + /** + * This method initializes jScrollPaneHelpText + * + * @return javax.swing.JScrollPane + * + */ + private JScrollPane getJScrollPaneHelpText() { + if (jScrollPaneHelpText == null) { + jScrollPaneHelpText = new JScrollPane(); + jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setLocation(new java.awt.Point(160, 60)); + jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + } + return jScrollPaneHelpText; } - return jScrollPane; - } - - /** - * This method initializes jTextAreaHelpText - * - * @return javax.swing.JTextArea - * - */ - private JTextArea getJTextAreaHelpText() { - if (jTextAreaHelpText == null) { - jTextAreaHelpText = new JTextArea(); - jTextAreaHelpText.setLineWrap(true); - jTextAreaHelpText.setWrapStyleWord(true); + + /** + * This method initializes jButtonOk + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonOk() { + if (jButtonOk == null) { + jButtonOk = new JButton(); + jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20)); + jButtonOk.setText("Ok"); + jButtonOk.addActionListener(this); + } + return jButtonOk; } - return jTextAreaHelpText; - } - - /** - * This method initializes jScrollPaneHelpText - * - * @return javax.swing.JScrollPane - * - */ - private JScrollPane getJScrollPaneHelpText() { - if (jScrollPaneHelpText == null) { - jScrollPaneHelpText = new JScrollPane(); - jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); - jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); - jScrollPaneHelpText.setLocation(new java.awt.Point(160, 60)); - jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + + /** + * This method initializes jButtonCancel + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonCancel() { + if (jButtonCancel == null) { + jButtonCancel = new JButton(); + jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20)); + jButtonCancel.setText("Cancel"); + jButtonCancel.addActionListener(this); + } + return jButtonCancel; } - return jScrollPaneHelpText; - } - - /** - * This method initializes jButtonOk - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20)); - jButtonOk.setText("Ok"); - jButtonOk.addActionListener(this); + + public static void main(String[] args) { } - return jButtonOk; - } - - /** - * This method initializes jButtonCancel - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20)); - jButtonCancel.setText("Cancel"); - jButtonCancel.addActionListener(this); + + /** + * This method initializes this + * + */ + private void init() { + this.setSize(500, 230); + this.setContentPane(getJScrollPane()); + this.setTitle("Boot Modes"); + initFrame(); + this.setViewMode(false); + this.centerWindow(); } - return jButtonCancel; - } - - public static void main(String[] args) { - } - - /** - * This method initializes this - * - */ - private void init() { - this.setSize(500, 230); - this.setContentPane(getJScrollPane()); - this.setTitle("Boot Modes"); - initFrame(); - this.setViewMode(false); - this.centerWindow(); - } - - /** - * This method initializes this Fill values to all fields if these values are - * not empty - * - * @param inBootModesId - * - */ - private void init(BootModesIdentification inBootModesId) { - init(); - this.id = inBootModesId; - - if (this.id != null) { - this.jComboBoxBootModeName.setSelectedItem(id.getName()); - this.jComboBoxUsage.setSelectedItem(id.getUsage()); - this.jTextAreaHelpText.setText(id.getHelp()); - this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); - this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + + /** + * This method initializes this Fill values to all fields if these values are + * not empty + * + * @param inBootModesId + * + */ + private void init(BootModesIdentification inBootModesId) { + init(); + this.id = inBootModesId; + + if (this.id != null) { + this.jComboBoxBootModeName.setSelectedItem(id.getName()); + this.jComboBoxUsage.setSelectedItem(id.getUsage()); + this.jTextAreaHelpText.setText(id.getHelp()); + this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); + this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + } } - } - - /** - * This is the override edit constructor - * - * @param inBootModesIdentification - * @param iFrame - * - */ - public BootModesDlg(BootModesIdentification inBootModesIdentification, IFrame iFrame) { - super(iFrame, true); - init(inBootModesIdentification); - } - - /** - * Disable all components when the mode is view - * - * @param isView - * true - The view mode; false - The non-view mode - * - */ - public void setViewMode(boolean isView) { - if (isView) { - this.jComboBoxBootModeName.setEnabled(!isView); - this.jComboBoxUsage.setEnabled(!isView); + + /** + * This is the override edit constructor + * + * @param inBootModesIdentification + * @param iFrame + * + */ + public BootModesDlg(BootModesIdentification inBootModesIdentification, IFrame iFrame) { + super(iFrame, true); + init(inBootModesIdentification); } - } - - /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel jContentPane - * - */ - private JPanel getJContentPane() { - if (jContentPane == null) { - jStarLabel1 = new StarLabel(); - jStarLabel1.setLocation(new java.awt.Point(2, 10)); - jLabelBootModeName = new JLabel(); - jLabelBootModeName.setText("Boot Mode Name"); - jLabelBootModeName.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); - jStarLabel2 = new StarLabel(); - jStarLabel2.setLocation(new java.awt.Point(2, 35)); - jLabelUsage = new JLabel(); - jLabelUsage.setText("Usage"); - jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); - jLabelHelpText = new JLabel(); - jLabelHelpText.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); - jLabelHelpText.setText("Help Text"); - jLabelFeatureFlag = new JLabel(); - jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 145, 20)); - jLabelFeatureFlag.setText("Feature Flag Expression"); - jLabelArch = new JLabel(); - jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); - jLabelArch.setText("Supported Archectures"); - jArchCheckBox = new ArchCheckBox(); - jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20)); - jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); - - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.setPreferredSize(new java.awt.Dimension(485, 185)); - - jContentPane.add(jLabelBootModeName, null); - jContentPane.add(getJComboBoxBootModeName(), null); - jContentPane.add(jLabelUsage, null); - jContentPane.add(getJComboBoxUsage(), null); - - jContentPane.add(jStarLabel1, null); - jContentPane.add(jStarLabel2, null); - jContentPane.add(jLabelFeatureFlag, null); - jContentPane.add(getJTextFieldFeatureFlag(), null); - jContentPane.add(jLabelArch, null); - - jContentPane.add(jLabelHelpText, null); - jContentPane.add(getJScrollPaneHelpText(), null); - jContentPane.add(jArchCheckBox, null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); + + /** + * Disable all components when the mode is view + * + * @param isView + * true - The view mode; false - The non-view mode + * + */ + public void setViewMode(boolean isView) { + if (isView) { + this.jComboBoxBootModeName.setEnabled(!isView); + this.jComboBoxUsage.setEnabled(!isView); + } } - return jContentPane; - } - - /** - * This method initializes BootModeName groups and Usage type - * - */ - private void initFrame() { - Tools.generateComboBoxByVector(jComboBoxBootModeName, ed.getVBootModeNames()); - Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage()); - } - - /* - * (non-Javadoc) - * - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - * - * Override actionPerformed to listen all actions - * - */ - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - if (checkAdd()) { - getCurrentBootModes(); - this.returnType = DataType.RETURN_TYPE_OK; - this.setVisible(false); - } + + /** + * This method initializes jContentPane + * + * @return javax.swing.JPanel jContentPane + * + */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jStarLabel1 = new StarLabel(); + jStarLabel1.setLocation(new java.awt.Point(2, 10)); + jLabelBootModeName = new JLabel(); + jLabelBootModeName.setText("Boot Mode Name"); + jLabelBootModeName.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); + jStarLabel2 = new StarLabel(); + jStarLabel2.setLocation(new java.awt.Point(2, 35)); + jLabelUsage = new JLabel(); + jLabelUsage.setText("Usage"); + jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); + jLabelHelpText = new JLabel(); + jLabelHelpText.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); + jLabelHelpText.setText("Help Text"); + jLabelFeatureFlag = new JLabel(); + jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 145, 20)); + jLabelFeatureFlag.setText("Feature Flag Expression"); + jLabelArch = new JLabel(); + jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); + jLabelArch.setText("Supported Archectures"); + jArchCheckBox = new ArchCheckBox(); + jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20)); + jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); + + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.setPreferredSize(new java.awt.Dimension(485, 185)); + + jContentPane.add(jLabelBootModeName, null); + jContentPane.add(getJComboBoxBootModeName(), null); + jContentPane.add(jLabelUsage, null); + jContentPane.add(getJComboBoxUsage(), null); + + jContentPane.add(jStarLabel1, null); + jContentPane.add(jStarLabel2, null); + jContentPane.add(jLabelFeatureFlag, null); + jContentPane.add(getJTextFieldFeatureFlag(), null); + jContentPane.add(jLabelArch, null); + + jContentPane.add(jLabelHelpText, null); + jContentPane.add(getJScrollPaneHelpText(), null); + jContentPane.add(jArchCheckBox, null); + jContentPane.add(getJButtonOk(), null); + jContentPane.add(getJButtonCancel(), null); + } + return jContentPane; } - if (arg0.getSource() == jButtonCancel) { - this.returnType = DataType.RETURN_TYPE_CANCEL; - this.setVisible(false); + /** + * This method initializes BootModeName groups and Usage type + * + */ + private void initFrame() { + Tools.generateComboBoxByVector(jComboBoxBootModeName, ed.getVBootModeNames()); + Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage()); } - } - - /** - * Data validation for all fields - * - * @retval true - All datas are valid - * @retval false - At least one data is invalid - * - */ - public boolean checkAdd() { - // - // Check if all fields have correct data types - // - // - // Check FeatureFlag - // - if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { - if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { - Log.wrn("Update Boot Modes", "Incorrect data type for Feature Flag"); - return false; - } + /* + * (non-Javadoc) + * + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + * + * Override actionPerformed to listen all actions + * + */ + public void actionPerformed(ActionEvent arg0) { + if (arg0.getSource() == jButtonOk) { + if (checkAdd()) { + getCurrentBootModes(); + this.returnType = DataType.RETURN_TYPE_OK; + this.setVisible(false); + } + } + + if (arg0.getSource() == jButtonCancel) { + this.returnType = DataType.RETURN_TYPE_CANCEL; + this.setVisible(false); + } + } + + /** + * Data validation for all fields + * + * @retval true - All datas are valid + * @retval false - At least one data is invalid + * + */ + public boolean checkAdd() { + // + // Check if all fields have correct data types + // + + // + // Check FeatureFlag + // + if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { + if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { + Log.wrn("Update Boot Modes", "Incorrect data type for Feature Flag"); + return false; + } + } + + return true; + } + + private BootModesIdentification getCurrentBootModes() { + String arg0 = this.jComboBoxBootModeName.getSelectedItem().toString(); + String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); + + String arg2 = this.jTextFieldFeatureFlag.getText(); + Vector arg3 = this.jArchCheckBox.getSelectedItemsVector(); + String arg4 = this.jTextAreaHelpText.getText(); + id = new BootModesIdentification(arg0, arg1, arg2, arg3, arg4); + return id; } - return true; - } - - private BootModesIdentification getCurrentBootModes() { - String arg0 = this.jComboBoxBootModeName.getSelectedItem().toString(); - String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); - - String arg2 = this.jTextFieldFeatureFlag.getText(); - Vector arg3 = this.jArchCheckBox.getSelectedItemsVector(); - String arg4 = this.jTextAreaHelpText.getText(); - id = new BootModesIdentification(arg0, arg1, arg2, arg3, arg4); - return id; - } - - public BootModesIdentification getId() { - return id; - } - - public void setId(BootModesIdentification id) { - this.id = id; - } + public BootModesIdentification getId() { + return id; + } + + public void setId(BootModesIdentification id) { + this.id = id; + } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/DataHubsDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/DataHubsDlg.java index 56a856e49d..05bd139257 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/DataHubsDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/DataHubsDlg.java @@ -50,390 +50,393 @@ import org.tianocore.frameworkwizard.module.Identifications.DataHubs.DataHubsIde */ public class DataHubsDlg extends IDialog { - // / - // / Define class Serial Version UID - // / - private static final long serialVersionUID = -3667906991966638892L; + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = -3667906991966638892L; - // - // Define class members - // - private JPanel jContentPane = null; - - private JLabel jLabelUsage = null; + // + // Define class members + // + private JPanel jContentPane = null; - private JComboBox jComboBoxUsage = null; + private JLabel jLabelUsage = null; - private JLabel jLabelDataHubRecord = null; + private JComboBox jComboBoxUsage = null; - private JTextField jTextFieldDataHubRecord = null; + private JLabel jLabelDataHubRecord = null; - private StarLabel jStarLabel1 = null; + private JTextField jTextFieldDataHubRecord = null; - private StarLabel jStarLabel2 = null; + private StarLabel jStarLabel1 = null; - private JLabel jLabelFeatureFlag = null; + private StarLabel jStarLabel2 = null; - private JTextField jTextFieldFeatureFlag = null; + private JLabel jLabelFeatureFlag = null; - private JLabel jLabelArch = null; + private JTextField jTextFieldFeatureFlag = null; - private JScrollPane jScrollPane = null; + private JLabel jLabelArch = null; - private JLabel jLabelHelpText = null; + private JScrollPane jScrollPane = null; - private JTextArea jTextAreaHelpText = null; + private JLabel jLabelHelpText = null; - private JScrollPane jScrollPaneHelpText = null; + private JTextArea jTextAreaHelpText = null; - private ArchCheckBox jArchCheckBox = null; + private JScrollPane jScrollPaneHelpText = null; - private JButton jButtonOk = null; + private ArchCheckBox jArchCheckBox = null; - private JButton jButtonCancel = null; + private JButton jButtonOk = null; - // - // Not used by UI - // - private DataHubsIdentification id = null; + private JButton jButtonCancel = null; - private EnumerationData ed = new EnumerationData(); + // + // Not used by UI + // + private DataHubsIdentification id = null; + + private EnumerationData ed = new EnumerationData(); + + /** + * This method initializes jTextFieldDataHubRecord + * + * @return javax.swing.JTextField jTextFieldDataHubRecord + * + */ + private JTextField getJTextFieldDataHubRecord() { + if (jTextFieldDataHubRecord == null) { + jTextFieldDataHubRecord = new JTextField(); + jTextFieldDataHubRecord.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); + jTextFieldDataHubRecord.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldDataHubRecord.setToolTipText("Enter the C Name of the Data Hub Record"); + } + return jTextFieldDataHubRecord; + } - /** - * This method initializes jTextFieldDataHubRecord - * - * @return javax.swing.JTextField jTextFieldDataHubRecord - * - */ - private JTextField getJTextFieldDataHubRecord() { - if (jTextFieldDataHubRecord == null) { - jTextFieldDataHubRecord = new JTextField(); - jTextFieldDataHubRecord - .setBounds(new java.awt.Rectangle(160, 10, 320, 20)); - jTextFieldDataHubRecord.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldDataHubRecord - .setToolTipText("Enter the C Name of the Data Hub Record"); + /** + * This method initializes jComboBoxUsage + * + * @return javax.swing.JComboBox jComboBoxUsage + * + */ + private JComboBox getJComboBoxUsage() { + if (jComboBoxUsage == null) { + jComboBoxUsage = new JComboBox(); + jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); + jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxUsage + .setToolTipText("" + + "" + + "" + + "" + + "" + + "
ALWAYS_CONSUMEDModule always consumes a Data Hub Entry
via registering a filter driver.
SOMETIMES_CONSUMEDModule will use a Data Hub Entry if it exists
via registering a filter driver
ALWAYS_PRODUCEDAlways logs data into the Data Hub
SOMETIMES_PRODUCEDLog data into the Data Hub under
certain circumstances
"); + } + return jComboBoxUsage; } - return jTextFieldDataHubRecord; - } - - /** - * This method initializes jComboBoxUsage - * - * @return javax.swing.JComboBox jComboBoxUsage - * - */ - private JComboBox getJComboBoxUsage() { - if (jComboBoxUsage == null) { - jComboBoxUsage = new JComboBox(); - jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); - jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxUsage - .setToolTipText("
ALWAYS_CONSUMEDModule always consumes a Data Hub Entry
via registering a filter driver.
SOMETIMES_CONSUMEDModule will use a Data Hub Entry if it exists
via registering a filter driver
ALWAYS_PRODUCEDAlways logs data into the Data Hub
SOMETIMES_PRODUCEDLog data into the Data Hub under
certain circumstances
"); + + /** + * This method initializes jTextFieldFeatureFlag + * + * @return javax.swing.JTextField + */ + private JTextField getJTextFieldFeatureFlag() { + if (jTextFieldFeatureFlag == null) { + jTextFieldFeatureFlag = new JTextField(); + jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 320, 20)); + jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + } + return jTextFieldFeatureFlag; } - return jComboBoxUsage; - } - - /** - * This method initializes jTextFieldFeatureFlag - * - * @return javax.swing.JTextField - */ - private JTextField getJTextFieldFeatureFlag() { - if (jTextFieldFeatureFlag == null) { - jTextFieldFeatureFlag = new JTextField(); - jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 320, 20)); - jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + + /** + * This method initializes jScrollPane + * + * @return javax.swing.JScrollPane + */ + private JScrollPane getJScrollPane() { + if (jScrollPane == null) { + jScrollPane = new JScrollPane(); + jScrollPane.setViewportView(getJContentPane()); + } + return jScrollPane; } - return jTextFieldFeatureFlag; - } - - /** - * This method initializes jScrollPane - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setViewportView(getJContentPane()); + + /** + * This method initializes jTextAreaHelpText + * + * @return javax.swing.JTextArea + * + */ + private JTextArea getJTextAreaHelpText() { + if (jTextAreaHelpText == null) { + jTextAreaHelpText = new JTextArea(); + jTextAreaHelpText.setLineWrap(true); + jTextAreaHelpText.setWrapStyleWord(true); + } + return jTextAreaHelpText; } - return jScrollPane; - } - - /** - * This method initializes jTextAreaHelpText - * - * @return javax.swing.JTextArea - * - */ - private JTextArea getJTextAreaHelpText() { - if (jTextAreaHelpText == null) { - jTextAreaHelpText = new JTextArea(); - jTextAreaHelpText.setLineWrap(true); - jTextAreaHelpText.setWrapStyleWord(true); + + /** + * This method initializes jScrollPaneHelpText + * + * @return javax.swing.JScrollPane + * + */ + private JScrollPane getJScrollPaneHelpText() { + if (jScrollPaneHelpText == null) { + jScrollPaneHelpText = new JScrollPane(); + jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setLocation(new java.awt.Point(160, 60)); + jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + } + return jScrollPaneHelpText; } - return jTextAreaHelpText; - } - - /** - * This method initializes jScrollPaneHelpText - * - * @return javax.swing.JScrollPane - * - */ - private JScrollPane getJScrollPaneHelpText() { - if (jScrollPaneHelpText == null) { - jScrollPaneHelpText = new JScrollPane(); - jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); - jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320,40)); - jScrollPaneHelpText.setLocation(new java.awt.Point(160,60)); - jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + + /** + * This method initializes jButtonOk + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonOk() { + if (jButtonOk == null) { + jButtonOk = new JButton(); + jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20)); + jButtonOk.setText("Ok"); + jButtonOk.addActionListener(this); + } + return jButtonOk; } - return jScrollPaneHelpText; - } - /** - * This method initializes jButtonOk - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20)); - jButtonOk.setText("Ok"); - jButtonOk.addActionListener(this); + + /** + * This method initializes jButtonCancel + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonCancel() { + if (jButtonCancel == null) { + jButtonCancel = new JButton(); + jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20)); + jButtonCancel.setText("Cancel"); + jButtonCancel.addActionListener(this); + } + return jButtonCancel; } - return jButtonOk; - } - - /** - * This method initializes jButtonCancel - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20)); - jButtonCancel.setText("Cancel"); - jButtonCancel.addActionListener(this); + + public static void main(String[] args) { + } - return jButtonCancel; - } - - public static void main(String[] args) { - - } - - /** - * This method initializes this - * - */ - private void init() { - this.setSize(500, 230); - this.setContentPane(getJScrollPane()); - this.setTitle("Data Hubs"); - initFrame(); - this.setViewMode(false); - this.centerWindow(); - } - - /** - * This method initializes this Fill values to all fields if these values are - * not empty - * - * @param inDataHubsId - * - */ - private void init(DataHubsIdentification inDataHubsId) { - init(); - this.id = inDataHubsId; - - if (this.id != null) { - this.jTextFieldDataHubRecord.setText(id.getName()); - this.jComboBoxUsage.setSelectedItem(id.getUsage()); - this.jTextAreaHelpText.setText(id.getHelp()); - this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); - this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + + /** + * This method initializes this + * + */ + private void init() { + this.setSize(500, 230); + this.setContentPane(getJScrollPane()); + this.setTitle("Data Hubs"); + initFrame(); + this.setViewMode(false); + this.centerWindow(); } - } - - /** - * This is the override edit constructor - * - * @param inDataHubsIdentification - * @param iFrame - * - */ - public DataHubsDlg(DataHubsIdentification inDataHubsIdentification, - IFrame iFrame) { - super(iFrame, true); - init(inDataHubsIdentification); - } - - /** - * Disable all components when the mode is view - * - * @param isView - * true - The view mode; false - The non-view mode - * - */ - public void setViewMode(boolean isView) { - if (isView) { - this.jTextFieldDataHubRecord.setEnabled(!isView); - this.jComboBoxUsage.setEnabled(!isView); + + /** + * This method initializes this Fill values to all fields if these values are + * not empty + * + * @param inDataHubsId + * + */ + private void init(DataHubsIdentification inDataHubsId) { + init(); + this.id = inDataHubsId; + + if (this.id != null) { + this.jTextFieldDataHubRecord.setText(id.getName()); + this.jComboBoxUsage.setSelectedItem(id.getUsage()); + this.jTextAreaHelpText.setText(id.getHelp()); + this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); + this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + } } - } - - /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel jContentPane - * - */ - private JPanel getJContentPane() { - if (jContentPane == null) { - jStarLabel1 = new StarLabel(); - jStarLabel1.setLocation(new java.awt.Point(2, 10)); - jLabelDataHubRecord = new JLabel(); - jLabelDataHubRecord.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); - jLabelDataHubRecord.setText("Data Hub Record"); - jStarLabel2 = new StarLabel(); - jStarLabel2.setLocation(new java.awt.Point(2, 35)); - jLabelUsage = new JLabel(); - jLabelUsage.setText("Usage"); - jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); - jLabelHelpText = new JLabel(); - jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 145, 20)); - jLabelHelpText.setText("Help Text"); - jLabelFeatureFlag = new JLabel(); - jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 145, 20)); - jLabelFeatureFlag.setText("Feature Flag Expression"); - jLabelArch = new JLabel(); - jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); - jLabelArch.setText("Supported Architectures"); - jArchCheckBox = new ArchCheckBox(); - jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20)); - jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); - - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.setPreferredSize(new java.awt.Dimension(485, 185)); - - jContentPane.add(jLabelDataHubRecord, null); - jContentPane.add(jLabelUsage, null); - jContentPane.add(jLabelFeatureFlag, null); - jContentPane.add(jLabelArch, null); - - jContentPane.add(getJTextFieldDataHubRecord(), null); - jContentPane.add(getJComboBoxUsage(), null); - jContentPane.add(getJTextFieldFeatureFlag(), null); - - jContentPane.add(jStarLabel1, null); - jContentPane.add(jStarLabel2, null); - - jContentPane.add(jLabelHelpText, null); - jContentPane.add(getJScrollPaneHelpText(), null); - jContentPane.add(jArchCheckBox, null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); + + /** + * This is the override edit constructor + * + * @param inDataHubsIdentification + * @param iFrame + * + */ + public DataHubsDlg(DataHubsIdentification inDataHubsIdentification, IFrame iFrame) { + super(iFrame, true); + init(inDataHubsIdentification); } - return jContentPane; - } - - /** - * This method initializes Usage type - * - */ - private void initFrame() { - Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVDataHubUsage()); - } - - /* - * (non-Javadoc) - * - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - * - * Override actionPerformed to listen all actions - * - */ - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - if (checkAdd()) { - getCurrentDataHubs(); - this.returnType = DataType.RETURN_TYPE_OK; - this.setVisible(false); - } + + /** + * Disable all components when the mode is view + * + * @param isView + * true - The view mode; false - The non-view mode + * + */ + public void setViewMode(boolean isView) { + if (isView) { + this.jTextFieldDataHubRecord.setEnabled(!isView); + this.jComboBoxUsage.setEnabled(!isView); + } } - if (arg0.getSource() == jButtonCancel) { - this.returnType = DataType.RETURN_TYPE_CANCEL; - this.setVisible(false); + /** + * This method initializes jContentPane + * + * @return javax.swing.JPanel jContentPane + * + */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jStarLabel1 = new StarLabel(); + jStarLabel1.setLocation(new java.awt.Point(2, 10)); + jLabelDataHubRecord = new JLabel(); + jLabelDataHubRecord.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); + jLabelDataHubRecord.setText("Data Hub Record"); + jStarLabel2 = new StarLabel(); + jStarLabel2.setLocation(new java.awt.Point(2, 35)); + jLabelUsage = new JLabel(); + jLabelUsage.setText("Usage"); + jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); + jLabelHelpText = new JLabel(); + jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 145, 20)); + jLabelHelpText.setText("Help Text"); + jLabelFeatureFlag = new JLabel(); + jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 145, 20)); + jLabelFeatureFlag.setText("Feature Flag Expression"); + jLabelArch = new JLabel(); + jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); + jLabelArch.setText("Supported Architectures"); + jArchCheckBox = new ArchCheckBox(); + jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20)); + jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); + + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.setPreferredSize(new java.awt.Dimension(485, 185)); + + jContentPane.add(jLabelDataHubRecord, null); + jContentPane.add(jLabelUsage, null); + jContentPane.add(jLabelFeatureFlag, null); + jContentPane.add(jLabelArch, null); + + jContentPane.add(getJTextFieldDataHubRecord(), null); + jContentPane.add(getJComboBoxUsage(), null); + jContentPane.add(getJTextFieldFeatureFlag(), null); + + jContentPane.add(jStarLabel1, null); + jContentPane.add(jStarLabel2, null); + + jContentPane.add(jLabelHelpText, null); + jContentPane.add(getJScrollPaneHelpText(), null); + jContentPane.add(jArchCheckBox, null); + jContentPane.add(getJButtonOk(), null); + jContentPane.add(getJButtonCancel(), null); + } + return jContentPane; } - } - - /** - * Data validation for all fields - * - * @retval true - All datas are valid - * @retval false - At least one data is invalid - * - */ - public boolean checkAdd() { - // - // Check if all fields have correct data types - // - // - // Check DataHubRecord - // - if (isEmpty(this.jTextFieldDataHubRecord.getText())) { - Log.wrn("Update Hubs", "Data Hub Record must not be empty"); - return false; + /** + * This method initializes Usage type + * + */ + private void initFrame() { + Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVDataHubUsage()); } - if (!isEmpty(this.jTextFieldDataHubRecord.getText())) { - if (!DataValidation.isC_NameType(this.jTextFieldDataHubRecord.getText())) { - Log.wrn("Update Hubs", "Incorrect data type for Data Hub Record"); - return false; - } + /* + * (non-Javadoc) + * + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + * + * Override actionPerformed to listen all actions + * + */ + public void actionPerformed(ActionEvent arg0) { + if (arg0.getSource() == jButtonOk) { + if (checkAdd()) { + getCurrentDataHubs(); + this.returnType = DataType.RETURN_TYPE_OK; + this.setVisible(false); + } + } + + if (arg0.getSource() == jButtonCancel) { + this.returnType = DataType.RETURN_TYPE_CANCEL; + this.setVisible(false); + } } - // - // Check FeatureFlag - // - if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { - if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { - Log.wrn("Update Hubs", "Incorrect data type for Feature Flag"); - return false; - } + /** + * Data validation for all fields + * + * @retval true - All datas are valid + * @retval false - At least one data is invalid + * + */ + public boolean checkAdd() { + // + // Check if all fields have correct data types + // + + // + // Check DataHubRecord + // + if (isEmpty(this.jTextFieldDataHubRecord.getText())) { + Log.wrn("Update Hubs", "Data Hub Record must not be empty"); + return false; + } + + if (!isEmpty(this.jTextFieldDataHubRecord.getText())) { + if (!DataValidation.isC_NameType(this.jTextFieldDataHubRecord.getText())) { + Log.wrn("Update Hubs", "Incorrect data type for Data Hub Record"); + return false; + } + } + + // + // Check FeatureFlag + // + if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { + if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { + Log.wrn("Update Hubs", "Incorrect data type for Feature Flag"); + return false; + } + } + + return true; } - return true; - } + private DataHubsIdentification getCurrentDataHubs() { + String arg0 = this.jTextFieldDataHubRecord.getText(); + String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); - private DataHubsIdentification getCurrentDataHubs() { - String arg0 = this.jTextFieldDataHubRecord.getText(); - String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); + String arg2 = this.jTextFieldFeatureFlag.getText(); + Vector arg3 = this.jArchCheckBox.getSelectedItemsVector(); + String arg4 = this.jTextAreaHelpText.getText(); - String arg2 = this.jTextFieldFeatureFlag.getText(); - Vector arg3 = this.jArchCheckBox.getSelectedItemsVector(); - String arg4 = this.jTextAreaHelpText.getText(); + id = new DataHubsIdentification(arg0, arg1, arg2, arg3, arg4); + return id; + } - id = new DataHubsIdentification(arg0, arg1, arg2, arg3, arg4); - return id; - } - - public DataHubsIdentification getId() { - return id; - } + public DataHubsIdentification getId() { + return id; + } - public void setId(DataHubsIdentification id) { - this.id = id; - } + public void setId(DataHubsIdentification id) { + this.id = id; + } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/EventsDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/EventsDlg.java index 477393cc65..00938840a8 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/EventsDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/EventsDlg.java @@ -46,467 +46,472 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools; */ public class EventsDlg extends IDialog { - // / - // / Define class Serial Version UID - // / - private static final long serialVersionUID = -4396143706422842331L; + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = -4396143706422842331L; - // - // Define class members - // - private JPanel jContentPane = null; + // + // Define class members + // + private JPanel jContentPane = null; - private JLabel jLabelEventType = null; + private JLabel jLabelEventType = null; - private JLabel jLabelC_Name = null; + private JLabel jLabelC_Name = null; - private JComboBox jComboBoxGuidC_Name = null; + private JComboBox jComboBoxGuidC_Name = null; - private JLabel jLabelUsage = null; + private JLabel jLabelUsage = null; - private JLabel jLabelGroup = null; + private JLabel jLabelGroup = null; - private JComboBox jComboBoxUsage = null; + private JComboBox jComboBoxUsage = null; - private JComboBox jComboBoxEventGroup = null; + private JComboBox jComboBoxEventGroup = null; - private StarLabel jStarLabel1 = null; + private StarLabel jStarLabel1 = null; - private StarLabel jStarLabel2 = null; + private StarLabel jStarLabel2 = null; - private StarLabel jStarLabel3 = null; + private StarLabel jStarLabel3 = null; - private StarLabel jStarLabel4 = null; + private StarLabel jStarLabel4 = null; - private JComboBox jComboBoxEventsType = null; + private JComboBox jComboBoxEventsType = null; - private JScrollPane jScrollPane = null; + private JScrollPane jScrollPane = null; - private JLabel jLabelArch = null; + private JLabel jLabelArch = null; - private JLabel jLabelHelpText = null; + private JLabel jLabelHelpText = null; - private JTextArea jTextAreaHelpText = null; + private JTextArea jTextAreaHelpText = null; - private JScrollPane jScrollPaneHelpText = null; + private JScrollPane jScrollPaneHelpText = null; - private JLabel jLabelFeatureFlag = null; + private JLabel jLabelFeatureFlag = null; - private JTextField jTextFieldFeatureFlag = null; + private JTextField jTextFieldFeatureFlag = null; - private ArchCheckBox jArchCheckBox = null; + private ArchCheckBox jArchCheckBox = null; - private JButton jButtonOk = null; + private JButton jButtonOk = null; - private JButton jButtonCancel = null; + private JButton jButtonCancel = null; - // - // Not used by UI - // - private EventsIdentification id = null; + // + // Not used by UI + // + private EventsIdentification id = null; + + private EnumerationData ed = new EnumerationData(); + + private WorkspaceTools wt = new WorkspaceTools(); + + /** + * This method initializes jComboBoxType + * + * @return javax.swing.JComboBox jComboBoxType + * + */ + private JComboBox getJComboBoxEventsType() { + if (jComboBoxEventsType == null) { + jComboBoxEventsType = new JComboBox(); + jComboBoxEventsType.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); + jComboBoxEventsType.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxEventsType + .setToolTipText("Select CreateEvents if the Module has an event that is waiting to be signaled.
" + + "Select SignalEvents if the Module will signal all events in an event group.
" + + "NOTE: Signal events are named by GUID."); + } + return jComboBoxEventsType; + } - private EnumerationData ed = new EnumerationData(); + /** + * This method initializes jTextFieldC_Name + * + * @return javax.swing.JTextField jTextFieldC_Name + * + */ + private JComboBox getJComboBoxGuidC_Name() { + if (jComboBoxGuidC_Name == null) { + jComboBoxGuidC_Name = new JComboBox(); + jComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); + jComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Event"); + } + return jComboBoxGuidC_Name; + } - private WorkspaceTools wt = new WorkspaceTools(); + /** + * This method initializes jComboBoxEventsType + * + * @return javax.swing.JComboBox + */ + private JComboBox getJComboBoxEventGroup() { + if (jComboBoxEventGroup == null) { + jComboBoxEventGroup = new JComboBox(); + jComboBoxEventGroup.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); + jComboBoxEventGroup.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxEventGroup.setToolTipText("Select Type of Event: Guid or Timer."); + + } + return jComboBoxEventGroup; + } - /** - * This method initializes jComboBoxType - * - * @return javax.swing.JComboBox jComboBoxType - * - */ - private JComboBox getJComboBoxEventsType() { - if (jComboBoxEventsType == null) { - jComboBoxEventsType = new JComboBox(); - jComboBoxEventsType.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); - jComboBoxEventsType.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxEventsType - .setToolTipText("Select CreateEvents if the Module has an event that is waiting to be signaled.
Select SignalEvents if the Module will signal all events in an event group.
NOTE: Signal events are named by GUID."); + /** + * This method initializes jComboBoxUsage + * + * @return javax.swing.JComboBox jComboBoxUsage + * + */ + private JComboBox getJComboBoxUsage() { + if (jComboBoxUsage == null) { + jComboBoxUsage = new JComboBox(); + jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 85, 320, 20)); + jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxUsage + .setToolTipText("" + + "" + + "" + + "" + + "" + + "" + + "
Create Events
ALWAYS_CONSUMEDModule registers a notification function and REQUIRES that it be
" + + "executed for the module to fully function.
SOMETIMES_CONSUMEDModule registers a notification function and calls the function
" + + "when it is signaled
Signal Events
ALWAYS_PRODUCEDModule will Always signal the event
SOMETIMES_PRODUCEDModule will sometimes signal the event
"); + } + return jComboBoxUsage; } - return jComboBoxEventsType; - } - - /** - * This method initializes jTextFieldC_Name - * - * @return javax.swing.JTextField jTextFieldC_Name - * - */ - private JComboBox getJComboBoxGuidC_Name() { - if (jComboBoxGuidC_Name == null) { - jComboBoxGuidC_Name = new JComboBox(); - jComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); - jComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Event"); + + /** + * This method initializes jScrollPane + * + * @return javax.swing.JScrollPane + */ + private JScrollPane getJScrollPane() { + if (jScrollPane == null) { + jScrollPane = new JScrollPane(); + jScrollPane.setViewportView(getJContentPane()); + } + return jScrollPane; } - return jComboBoxGuidC_Name; - } - - /** - * This method initializes jComboBoxEventsType - * - * @return javax.swing.JComboBox - */ - private JComboBox getJComboBoxEventGroup() { - if (jComboBoxEventGroup == null) { - jComboBoxEventGroup = new JComboBox(); - jComboBoxEventGroup.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); - jComboBoxEventGroup.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxEventGroup - .setToolTipText("Select Type of Event: Guid or Timer."); + /** + * This method initializes jTextFieldFeatureFlag + * + * @return javax.swing.JTextField + */ + private JTextField getJTextFieldFeatureFlag() { + if (jTextFieldFeatureFlag == null) { + jTextFieldFeatureFlag = new JTextField(); + jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 155, 320, 20)); + jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + } + return jTextFieldFeatureFlag; } - return jComboBoxEventGroup; - } - - /** - * This method initializes jComboBoxUsage - * - * @return javax.swing.JComboBox jComboBoxUsage - * - */ - private JComboBox getJComboBoxUsage() { - if (jComboBoxUsage == null) { - jComboBoxUsage = new JComboBox(); - jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 85, 320, 20)); - jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxUsage - .setToolTipText("
Create Events
ALWAYS_CONSUMEDModule registers a notification function and REQUIRES that it be
executed for the module to fully function.
SOMETIMES_CONSUMEDModule registers a notification function and calls the function
when it is signaled
Signal Events
ALWAYS_PRODUCEDModule will Always signal the event
SOMETIMES_PRODUCEDModule will sometimes signal the event
"); + + /** + * This method initializes jTextAreaHelpText + * + * @return javax.swing.JTextArea + * + */ + private JTextArea getJTextAreaHelpText() { + if (jTextAreaHelpText == null) { + jTextAreaHelpText = new JTextArea(); + jTextAreaHelpText.setLineWrap(true); + jTextAreaHelpText.setWrapStyleWord(true); + } + return jTextAreaHelpText; } - return jComboBoxUsage; - } - - /** - * This method initializes jScrollPane - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setViewportView(getJContentPane()); + + /** + * This method initializes jScrollPaneHelpText + * + * @return javax.swing.JScrollPane + * + */ + private JScrollPane getJScrollPaneHelpText() { + if (jScrollPaneHelpText == null) { + jScrollPaneHelpText = new JScrollPane(); + jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setLocation(new java.awt.Point(160, 110)); + jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + } + return jScrollPaneHelpText; } - return jScrollPane; - } - - /** - * This method initializes jTextFieldFeatureFlag - * - * @return javax.swing.JTextField - */ - private JTextField getJTextFieldFeatureFlag() { - if (jTextFieldFeatureFlag == null) { - jTextFieldFeatureFlag = new JTextField(); - jTextFieldFeatureFlag - .setBounds(new java.awt.Rectangle(160, 155, 320, 20)); - jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldFeatureFlag - .setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + + /** + * This method initializes jButtonOk + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonOk() { + if (jButtonOk == null) { + jButtonOk = new JButton(); + jButtonOk.setBounds(new java.awt.Rectangle(290, 202, 90, 20)); + jButtonOk.setText("Ok"); + jButtonOk.addActionListener(this); + } + return jButtonOk; } - return jTextFieldFeatureFlag; - } - - /** - * This method initializes jTextAreaHelpText - * - * @return javax.swing.JTextArea - * - */ - private JTextArea getJTextAreaHelpText() { - if (jTextAreaHelpText == null) { - jTextAreaHelpText = new JTextArea(); - jTextAreaHelpText.setLineWrap(true); - jTextAreaHelpText.setWrapStyleWord(true); + + /** + * This method initializes jButtonCancel + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonCancel() { + if (jButtonCancel == null) { + jButtonCancel = new JButton(); + jButtonCancel.setBounds(new java.awt.Rectangle(390, 202, 90, 20)); + jButtonCancel.setText("Cancel"); + jButtonCancel.addActionListener(this); + } + return jButtonCancel; } - return jTextAreaHelpText; - } - - /** - * This method initializes jScrollPaneHelpText - * - * @return javax.swing.JScrollPane - * - */ - private JScrollPane getJScrollPaneHelpText() { - if (jScrollPaneHelpText == null) { - jScrollPaneHelpText = new JScrollPane(); - jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPaneHelpText.setSize(new java.awt.Dimension(320,40)); - jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320,40)); - jScrollPaneHelpText.setLocation(new java.awt.Point(160,110)); - jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + + public static void main(String[] args) { + } - return jScrollPaneHelpText; - } - - /** - * This method initializes jButtonOk - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setBounds(new java.awt.Rectangle(290, 202, 90, 20)); - jButtonOk.setText("Ok"); - jButtonOk.addActionListener(this); + + /** + * This method initializes this + * + */ + private void init() { + this.setSize(500, 275); + this.setContentPane(getJScrollPane()); + this.setTitle("Events"); + initFrame(); + this.setViewMode(false); + this.centerWindow(); } - return jButtonOk; - } - - /** - * This method initializes jButtonCancel - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 202, 90, 20)); - jButtonCancel.setText("Cancel"); - jButtonCancel.addActionListener(this); + + /** + * This method initializes this Fill values to all fields if these values are + * not empty + * + * @param inEventsId + * + */ + private void init(EventsIdentification inEventsId) { + init(); + this.id = inEventsId; + + if (this.id != null) { + this.jComboBoxGuidC_Name.setSelectedItem(id.getName()); + this.jComboBoxEventsType.setSelectedItem(id.getType()); + this.jComboBoxUsage.setSelectedItem(id.getUsage()); + this.jTextAreaHelpText.setText(id.getHelp()); + + jTextFieldFeatureFlag.setText(id.getFeatureFlag()); + this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + this.jComboBoxEventGroup.setSelectedItem(id.getGroup()); + } } - return jButtonCancel; - } - - public static void main(String[] args) { - - } - - /** - * This method initializes this - * - */ - private void init() { - this.setSize(500, 275); - this.setContentPane(getJScrollPane()); - this.setTitle("Events"); - initFrame(); - this.setViewMode(false); - this.centerWindow(); - } - - /** - * This method initializes this Fill values to all fields if these values are - * not empty - * - * @param inEventsId - * - */ - private void init(EventsIdentification inEventsId) { - init(); - this.id = inEventsId; - - if (this.id != null) { - this.jComboBoxGuidC_Name.setSelectedItem(id.getName()); - this.jComboBoxEventsType.setSelectedItem(id.getType()); - this.jComboBoxUsage.setSelectedItem(id.getUsage()); - this.jTextAreaHelpText.setText(id.getHelp()); - - jTextFieldFeatureFlag.setText(id.getFeatureFlag()); - this.jArchCheckBox.setSelectedItems(id.getSupArchList()); - this.jComboBoxEventGroup.setSelectedItem(id.getGroup()); + + /** + * This is the override edit constructor + * + * @param inEventsIdentification + * @param iFrame + * + */ + public EventsDlg(EventsIdentification inEventsIdentification, IFrame iFrame) { + super(iFrame, true); + init(inEventsIdentification); } - } - - /** - * This is the override edit constructor - * - * @param inEventsIdentification - * @param iFrame - * - */ - public EventsDlg(EventsIdentification inEventsIdentification, IFrame iFrame) { - super(iFrame, true); - init(inEventsIdentification); - } - - /** - * Disable all components when the mode is view - * - * @param isView - * true - The view mode; false - The non-view mode - * - */ - public void setViewMode(boolean isView) { - if (isView) { - this.jComboBoxGuidC_Name.setEnabled(!isView); - this.jComboBoxUsage.setEnabled(!isView); + + /** + * Disable all components when the mode is view + * + * @param isView + * true - The view mode; false - The non-view mode + * + */ + public void setViewMode(boolean isView) { + if (isView) { + this.jComboBoxGuidC_Name.setEnabled(!isView); + this.jComboBoxUsage.setEnabled(!isView); + } } - } - - /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel jContentPane - * - */ - private JPanel getJContentPane() { - if (jContentPane == null) { - jStarLabel1 = new StarLabel(); - jStarLabel1.setLocation(new java.awt.Point(2, 10)); - jLabelEventType = new JLabel(); - jLabelEventType.setText("Select Event Type"); - jLabelEventType.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); - - jStarLabel2 = new StarLabel(); - jStarLabel2.setLocation(new java.awt.Point(2, 35)); - jLabelC_Name = new JLabel(); - jLabelC_Name.setText("Guid C Name"); - jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); - - jStarLabel3 = new StarLabel(); - jStarLabel3.setLocation(new java.awt.Point(2, 60)); - jLabelGroup = new JLabel(); - jLabelGroup.setText("Event Group Type"); - jLabelGroup.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); - - jStarLabel4 = new StarLabel(); - jStarLabel4.setLocation(new java.awt.Point(2, 85)); - jLabelUsage = new JLabel(); - jLabelUsage.setText("Usage"); - jLabelUsage.setBounds(new java.awt.Rectangle(15, 85, 140, 20)); - - jLabelHelpText = new JLabel(); - jLabelHelpText.setBounds(new java.awt.Rectangle(15, 110, 145, 20)); - jLabelHelpText.setText("Help Text"); - - jLabelFeatureFlag = new JLabel(); - jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 155, 145, 20)); - jLabelFeatureFlag.setText("Feature Flag Expression"); - - jLabelArch = new JLabel(); - jLabelArch.setBounds(new java.awt.Rectangle(15, 180, 145, 20)); - jLabelArch.setText("Supported Architectures"); - jArchCheckBox = new ArchCheckBox(); - jArchCheckBox.setBounds(new java.awt.Rectangle(160, 180, 320, 20)); - jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); - - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.setPreferredSize(new java.awt.Dimension(485, 230)); - - jContentPane.add(jStarLabel1, null); - jContentPane.add(jLabelEventType, null); - jContentPane.add(getJComboBoxEventsType(), null); - jContentPane.add(jStarLabel2, null); - jContentPane.add(jLabelC_Name, null); - jContentPane.add(getJComboBoxGuidC_Name(), null); - jContentPane.add(jStarLabel3, null); - jContentPane.add(jLabelGroup, null); - jContentPane.add(getJComboBoxEventGroup(), null); - jContentPane.add(jStarLabel4, null); - jContentPane.add(jLabelUsage, null); - jContentPane.add(getJComboBoxUsage(), null); - jContentPane.add(jLabelHelpText, null); - jContentPane.add(getJScrollPaneHelpText(), null); - jContentPane.add(jLabelFeatureFlag, null); - jContentPane.add(getJTextFieldFeatureFlag(), null); - jContentPane.add(jLabelArch, null); - jContentPane.add(jArchCheckBox, null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); + /** + * This method initializes jContentPane + * + * @return javax.swing.JPanel jContentPane + * + */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jStarLabel1 = new StarLabel(); + jStarLabel1.setLocation(new java.awt.Point(2, 10)); + jLabelEventType = new JLabel(); + jLabelEventType.setText("Select Event Type"); + jLabelEventType.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); + + jStarLabel2 = new StarLabel(); + jStarLabel2.setLocation(new java.awt.Point(2, 35)); + jLabelC_Name = new JLabel(); + jLabelC_Name.setText("Guid C Name"); + jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); + + jStarLabel3 = new StarLabel(); + jStarLabel3.setLocation(new java.awt.Point(2, 60)); + jLabelGroup = new JLabel(); + jLabelGroup.setText("Event Group Type"); + jLabelGroup.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); + + jStarLabel4 = new StarLabel(); + jStarLabel4.setLocation(new java.awt.Point(2, 85)); + jLabelUsage = new JLabel(); + jLabelUsage.setText("Usage"); + jLabelUsage.setBounds(new java.awt.Rectangle(15, 85, 140, 20)); + + jLabelHelpText = new JLabel(); + jLabelHelpText.setBounds(new java.awt.Rectangle(15, 110, 145, 20)); + jLabelHelpText.setText("Help Text"); + + jLabelFeatureFlag = new JLabel(); + jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 155, 145, 20)); + jLabelFeatureFlag.setText("Feature Flag Expression"); + + jLabelArch = new JLabel(); + jLabelArch.setBounds(new java.awt.Rectangle(15, 180, 145, 20)); + jLabelArch.setText("Supported Architectures"); + jArchCheckBox = new ArchCheckBox(); + jArchCheckBox.setBounds(new java.awt.Rectangle(160, 180, 320, 20)); + jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); + + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.setPreferredSize(new java.awt.Dimension(485, 230)); + + jContentPane.add(jStarLabel1, null); + jContentPane.add(jLabelEventType, null); + jContentPane.add(getJComboBoxEventsType(), null); + jContentPane.add(jStarLabel2, null); + jContentPane.add(jLabelC_Name, null); + jContentPane.add(getJComboBoxGuidC_Name(), null); + jContentPane.add(jStarLabel3, null); + jContentPane.add(jLabelGroup, null); + jContentPane.add(getJComboBoxEventGroup(), null); + jContentPane.add(jStarLabel4, null); + jContentPane.add(jLabelUsage, null); + jContentPane.add(getJComboBoxUsage(), null); + jContentPane.add(jLabelHelpText, null); + jContentPane.add(getJScrollPaneHelpText(), null); + jContentPane.add(jLabelFeatureFlag, null); + jContentPane.add(getJTextFieldFeatureFlag(), null); + jContentPane.add(jLabelArch, null); + jContentPane.add(jArchCheckBox, null); + jContentPane.add(getJButtonOk(), null); + jContentPane.add(getJButtonCancel(), null); + + } + return jContentPane; } - return jContentPane; - } - - /** - * This method initializes events groups and usage type - * - */ - private void initFrame() { - Tools.generateComboBoxByVector(jComboBoxEventsType, ed.getVEventType()); - Tools.generateComboBoxByVector(jComboBoxEventGroup, ed.getVEventGroup()); - Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVEventUsage()); - Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt - .getAllGuidDeclarationsFromWorkspace()); - } - - /* - * (non-Javadoc) - * - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - * - * Override actionPerformed to listen all actions - * - */ - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - if (checkAdd()) { - getCurrentEvents(); - this.returnType = DataType.RETURN_TYPE_OK; - this.setVisible(false); - } + + /** + * This method initializes events groups and usage type + * + */ + private void initFrame() { + Tools.generateComboBoxByVector(jComboBoxEventsType, ed.getVEventType()); + Tools.generateComboBoxByVector(jComboBoxEventGroup, ed.getVEventGroup()); + Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVEventUsage()); + Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt.getAllGuidDeclarationsFromWorkspace()); } - if (arg0.getSource() == jButtonCancel) { - this.returnType = DataType.RETURN_TYPE_CANCEL; - this.setVisible(false); + /* + * (non-Javadoc) + * + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + * + * Override actionPerformed to listen all actions + * + */ + public void actionPerformed(ActionEvent arg0) { + if (arg0.getSource() == jButtonOk) { + if (checkAdd()) { + getCurrentEvents(); + this.returnType = DataType.RETURN_TYPE_OK; + this.setVisible(false); + } + } + + if (arg0.getSource() == jButtonCancel) { + this.returnType = DataType.RETURN_TYPE_CANCEL; + this.setVisible(false); + } } - } - - /** - * Data validation for all fields - * - * @retval true - All datas are valid - * @retval false - At least one data is invalid - * - */ - public boolean checkAdd() { - // - // Check if all fields have correct data types - // - // - // Check Name - // - if (isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) { - Log.wrn("Update Events", "Event Name couldn't be empty"); - return false; + /** + * Data validation for all fields + * + * @retval true - All datas are valid + * @retval false - At least one data is invalid + * + */ + public boolean checkAdd() { + // + // Check if all fields have correct data types + // + + // + // Check Name + // + if (isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) { + Log.wrn("Update Events", "Event Name couldn't be empty"); + return false; + } + + if (!isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) { + if (!DataValidation.isC_NameType(this.jComboBoxGuidC_Name.getSelectedItem().toString())) { + Log.wrn("Update Events", "Incorrect data type for Event Name"); + return false; + } + } + + // + // Check FeatureFlag + // + if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { + if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { + Log.wrn("Update Events", "Incorrect data type for Feature Flag"); + return false; + } + } + + return true; } - if (!isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) { - if (!DataValidation.isC_NameType(this.jComboBoxGuidC_Name - .getSelectedItem().toString())) { - Log.wrn("Update Events", "Incorrect data type for Event Name"); - return false; - } + private EventsIdentification getCurrentEvents() { + String arg0 = this.jComboBoxGuidC_Name.getSelectedItem().toString(); + String arg1 = this.jComboBoxEventsType.getSelectedItem().toString(); + String arg2 = this.jComboBoxUsage.getSelectedItem().toString(); + + String arg3 = this.jTextFieldFeatureFlag.getText(); + Vector arg4 = this.jArchCheckBox.getSelectedItemsVector(); + String arg5 = this.jTextAreaHelpText.getText(); + String arg6 = this.jComboBoxEventGroup.getSelectedItem().toString(); + id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + return id; } - // - // Check FeatureFlag - // - if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { - if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { - Log.wrn("Update Events", "Incorrect data type for Feature Flag"); - return false; - } + public EventsIdentification getId() { + return id; } - return true; - } - - private EventsIdentification getCurrentEvents() { - String arg0 = this.jComboBoxGuidC_Name.getSelectedItem().toString(); - String arg1 = this.jComboBoxEventsType.getSelectedItem().toString(); - String arg2 = this.jComboBoxUsage.getSelectedItem().toString(); - - String arg3 = this.jTextFieldFeatureFlag.getText(); - Vector arg4 = this.jArchCheckBox.getSelectedItemsVector(); - String arg5 = this.jTextAreaHelpText.getText(); - String arg6 = this.jComboBoxEventGroup.getSelectedItem().toString(); - id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6); - return id; - } - - public EventsIdentification getId() { - return id; - } - - public void setId(EventsIdentification id) { - this.id = id; - } + public void setId(EventsIdentification id) { + this.id = id; + } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ExternsDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ExternsDlg.java index bca2a5c179..7198b29eff 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ExternsDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ExternsDlg.java @@ -224,7 +224,7 @@ public class ExternsDlg extends IDialog implements ItemListener { if (id.getType().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) { this.jComboBoxPcdIsDriver.setSelectedItem(id.getName()); } else { - this.jTextFieldC_Name.setText(id.getName()); + this.jTextFieldC_Name.setText(id.getName()); } this.jComboBoxType.setSelectedItem(id.getType()); this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); @@ -380,7 +380,7 @@ public class ExternsDlg extends IDialog implements ItemListener { if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_PCD_IS_DRIVER)) { arg0 = this.jComboBoxPcdIsDriver.getSelectedItem().toString(); } else { - arg0 = this.jTextFieldC_Name.getText(); + arg0 = this.jTextFieldC_Name.getText(); } String arg1 = this.jComboBoxType.getSelectedItem().toString(); diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java index 7bfff4dad7..7b42c44ad5 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java @@ -44,373 +44,379 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools; */ public class GuidsDlg extends IDialog { - // / - // / Define class Serial Version UID - // / - private static final long serialVersionUID = 6710858997766979803L; + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = 6710858997766979803L; - // - // Define class members - // - private JPanel jContentPane = null; - - private JLabel jLabelC_Name = null; + // + // Define class members + // + private JPanel jContentPane = null; - private JComboBox jComboBoxCName = null; + private JLabel jLabelC_Name = null; - private JLabel jLabelUsage = null; + private JComboBox jComboBoxCName = null; - private JComboBox jComboBoxUsage = null; + private JLabel jLabelUsage = null; - private StarLabel jStarLabel1 = null; + private JComboBox jComboBoxUsage = null; - private StarLabel jStarLabel2 = null; + private StarLabel jStarLabel1 = null; - private JLabel jLabelFeatureFlag = null; + private StarLabel jStarLabel2 = null; - private JTextField jTextFieldFeatureFlag = null; + private JLabel jLabelFeatureFlag = null; - private JLabel jLabelArch = null; + private JTextField jTextFieldFeatureFlag = null; - private JScrollPane jScrollPane = null; + private JLabel jLabelArch = null; - private JLabel jLabelHelpText = null; + private JScrollPane jScrollPane = null; - private JTextArea jTextAreaHelpText = null; + private JLabel jLabelHelpText = null; - private JScrollPane jScrollPaneHelpText = null; - - private ArchCheckBox jArchCheckBox = null; + private JTextArea jTextAreaHelpText = null; - private JButton jButtonOk = null; + private JScrollPane jScrollPaneHelpText = null; - private JButton jButtonCancel = null; + private ArchCheckBox jArchCheckBox = null; - // - // Not used by UI - // - private GuidsIdentification id = null; + private JButton jButtonOk = null; - private EnumerationData ed = new EnumerationData(); + private JButton jButtonCancel = null; - private WorkspaceTools wt = new WorkspaceTools(); + // + // Not used by UI + // + private GuidsIdentification id = null; + + private EnumerationData ed = new EnumerationData(); + + private WorkspaceTools wt = new WorkspaceTools(); + + /** + * This method initializes jTextFieldC_Name + * + * @return javax.swing.JTextField jTextFieldC_Name + * + */ + private JComboBox getJComboBoxCName() { + if (jComboBoxCName == null) { + jComboBoxCName = new JComboBox(); + jComboBoxCName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); + jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxCName.setToolTipText("Select the C Name of the GUID"); + } + return jComboBoxCName; + } - /** - * This method initializes jTextFieldC_Name - * - * @return javax.swing.JTextField jTextFieldC_Name - * - */ - private JComboBox getJComboBoxCName() { - if (jComboBoxCName == null) { - jComboBoxCName = new JComboBox(); - jComboBoxCName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); - jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxCName.setToolTipText("Select the C Name of the GUID"); + /** + * This method initializes jComboBoxUsage + * + * @return javax.swing.JComboBox jComboBoxUsage + * + */ + private JComboBox getJComboBoxUsage() { + if (jComboBoxUsage == null) { + jComboBoxUsage = new JComboBox(); + jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); + jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxUsage + .setToolTipText("" + + "" + + "" + + "" + + "" + + "" + + "
ALWAYS_CONSUMEDModule always consumes the GUID
SOMETIMES_CONSUMEDModule will use the GUID only if it is present
ALWAYS_PRODUCEDModule always produces the GUID
SOMETIMES_PRODUCEDModule will sometimes produce the GUID
DEFAULTDefault is the the GUID that specified the
instance of the package
"); + } + return jComboBoxUsage; } - return jComboBoxCName; - } - - /** - * This method initializes jComboBoxUsage - * - * @return javax.swing.JComboBox jComboBoxUsage - * - */ - private JComboBox getJComboBoxUsage() { - if (jComboBoxUsage == null) { - jComboBoxUsage = new JComboBox(); - jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); - jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxUsage.setToolTipText("
ALWAYS_CONSUMEDModule always consumes the GUID
SOMETIMES_CONSUMEDModule will use the GUID only if it is present
ALWAYS_PRODUCEDModule always produces the GUID
SOMETIMES_PRODUCEDModule will sometimes produce the GUID
DEFAULTDefault is the the GUID that specified the
instance of the package
"); + + /** + * This method initializes jTextFieldFeatureFlag + * + * @return javax.swing.JTextField + * + */ + private JTextField getJTextFieldFeatureFlag() { + if (jTextFieldFeatureFlag == null) { + jTextFieldFeatureFlag = new JTextField(); + jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 320, 20)); + jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + } + return jTextFieldFeatureFlag; } - return jComboBoxUsage; - } - - /** - * This method initializes jTextFieldFeatureFlag - * - * @return javax.swing.JTextField - * - */ - private JTextField getJTextFieldFeatureFlag() { - if (jTextFieldFeatureFlag == null) { - jTextFieldFeatureFlag = new JTextField(); - jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 320, 20)); - jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + + /** + * This method initializes jScrollPane + * + * @return javax.swing.JScrollPane + */ + private JScrollPane getJScrollPane() { + if (jScrollPane == null) { + jScrollPane = new JScrollPane(); + jScrollPane.setViewportView(getJContentPane()); + } + return jScrollPane; } - return jTextFieldFeatureFlag; - } - - /** - * This method initializes jScrollPane - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setViewportView(getJContentPane()); + + /** + * This method initializes jTextAreaHelpText + * + * @return javax.swing.JTextArea + * + */ + private JTextArea getJTextAreaHelpText() { + if (jTextAreaHelpText == null) { + jTextAreaHelpText = new JTextArea(); + jTextAreaHelpText.setLineWrap(true); + jTextAreaHelpText.setWrapStyleWord(true); + } + return jTextAreaHelpText; } - return jScrollPane; - } - - /** - * This method initializes jTextAreaHelpText - * - * @return javax.swing.JTextArea - * - */ - private JTextArea getJTextAreaHelpText() { - if (jTextAreaHelpText == null) { - jTextAreaHelpText = new JTextArea(); - jTextAreaHelpText.setLineWrap(true); - jTextAreaHelpText.setWrapStyleWord(true); + + /** + * + * This method initializes jScrollPaneHelpText + * + * @return javax.swing.JScrollPane jScrollPaneHelpText + * + **/ + private JScrollPane getJScrollPaneHelpText() { + if (jScrollPaneHelpText == null) { + jScrollPaneHelpText = new JScrollPane(); + jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setLocation(new java.awt.Point(160, 60)); + jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + } + return jScrollPaneHelpText; } - return jTextAreaHelpText; - } - - /** - * - * This method initializes jScrollPaneHelpText - * - * @return javax.swing.JScrollPane jScrollPaneHelpText - * - **/ - private JScrollPane getJScrollPaneHelpText() { - if (jScrollPaneHelpText == null){ - jScrollPaneHelpText = new JScrollPane(); - jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); - jScrollPaneHelpText.setLocation(new java.awt.Point(160,60)); - jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + + /** + * This method initializes jButtonOk + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonOk() { + if (jButtonOk == null) { + jButtonOk = new JButton(); + jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20)); + jButtonOk.setText("Ok"); + jButtonOk.addActionListener(this); + } + return jButtonOk; } - return jScrollPaneHelpText; - } - /** - * This method initializes jButtonOk - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20)); - jButtonOk.setText("Ok"); - jButtonOk.addActionListener(this); + + /** + * This method initializes jButtonCancel + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonCancel() { + if (jButtonCancel == null) { + jButtonCancel = new JButton(); + jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20)); + jButtonCancel.setText("Cancel"); + jButtonCancel.addActionListener(this); + } + return jButtonCancel; } - return jButtonOk; - } - - /** - * This method initializes jButtonCancel - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20)); - jButtonCancel.setText("Cancel"); - jButtonCancel.addActionListener(this); + + public static void main(String[] args) { + } - return jButtonCancel; - } - - public static void main(String[] args) { - - } - - /** - * - * This method initializes this - * - */ - private void init() { - this.setSize(500, 230); - this.setContentPane(getJScrollPane()); - this.setTitle("Guids"); - initFrame(); - this.setViewMode(false); - this.centerWindow(); - } - - /** - * - * This method initializes this Fill values to all fields if these values are - * not empty - * - * @param inGuidsId - * - */ - private void init(GuidsIdentification inGuidsId) { - init(); - this.id = inGuidsId; - - if (this.id != null) { - this.jComboBoxCName.setSelectedItem(id.getName()); - this.jComboBoxUsage.setSelectedItem(id.getUsage()); - this.jTextAreaHelpText.setText(id.getHelp()); - this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); - this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + + /** + * + * This method initializes this + * + */ + private void init() { + this.setSize(500, 230); + this.setContentPane(getJScrollPane()); + this.setTitle("Guids"); + initFrame(); + this.setViewMode(false); + this.centerWindow(); } - } - - /** - * This is the override edit constructor - * - * @param inGuidsIdentification - * @param iFrame - * - */ - public GuidsDlg(GuidsIdentification inGuidsIdentification, IFrame iFrame) { - super(iFrame, true); - init(inGuidsIdentification); - } - - /** - * Disable all components when the mode is view - * - * @param isView - * true - The view mode; false - The non-view mode - * - */ - public void setViewMode(boolean isView) { - if (isView) { - this.jComboBoxUsage.setEnabled(!isView); + + /** + * + * This method initializes this Fill values to all fields if these values are + * not empty + * + * @param inGuidsId + * + */ + private void init(GuidsIdentification inGuidsId) { + init(); + this.id = inGuidsId; + + if (this.id != null) { + this.jComboBoxCName.setSelectedItem(id.getName()); + this.jComboBoxUsage.setSelectedItem(id.getUsage()); + this.jTextAreaHelpText.setText(id.getHelp()); + this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); + this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + } } - } - - /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel jContentPane - * - */ - private JPanel getJContentPane() { - if (jContentPane == null) { - jStarLabel1 = new StarLabel(); - jStarLabel1.setLocation(new java.awt.Point(2, 10)); - jLabelC_Name = new JLabel(); - jLabelC_Name.setText("Select GUID's C Name"); - jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); - - jStarLabel2 = new StarLabel(); - jStarLabel2.setLocation(new java.awt.Point(2, 35)); - jLabelUsage = new JLabel(); - jLabelUsage.setText("Usage"); - jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); - - jLabelHelpText = new JLabel(); - jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 145, 20)); - jLabelHelpText.setText("Help Text"); - - jLabelFeatureFlag = new JLabel(); - jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 145, 20)); - jLabelFeatureFlag.setText("Feature Flag Expression"); - - jLabelArch = new JLabel(); - jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); - jLabelArch.setText("Supported Architectures"); - jArchCheckBox = new ArchCheckBox(); - jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20)); - jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); - - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.setPreferredSize(new java.awt.Dimension(490, 165)); - - jContentPane.add(jStarLabel1, null); - jContentPane.add(jLabelC_Name, null); - jContentPane.add(getJComboBoxCName(), null); - jContentPane.add(jStarLabel2, null); - jContentPane.add(jLabelUsage, null); - jContentPane.add(getJComboBoxUsage(), null); - jContentPane.add(jLabelHelpText, null); - jContentPane.add(getJScrollPaneHelpText(), null); - jContentPane.add(jLabelFeatureFlag, null); - jContentPane.add(getJTextFieldFeatureFlag(), null); - jContentPane.add(jLabelArch, null); - jContentPane.add(jArchCheckBox, null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); + + /** + * This is the override edit constructor + * + * @param inGuidsIdentification + * @param iFrame + * + */ + public GuidsDlg(GuidsIdentification inGuidsIdentification, IFrame iFrame) { + super(iFrame, true); + init(inGuidsIdentification); } - return jContentPane; - } - - /** - * This method initializes Usage type - * - */ - private void initFrame() { - Tools.generateComboBoxByVector(jComboBoxCName, wt - .getAllGuidDeclarationsFromWorkspace()); - Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVGuidUsage()); - } - - /* - * (non-Javadoc) - * - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - * - * Override actionPerformed to listen all actions - * - */ - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - if (checkAdd()) { - getCurrentGuids(); - this.returnType = DataType.RETURN_TYPE_OK; - this.setVisible(false); - } + + /** + * Disable all components when the mode is view + * + * @param isView + * true - The view mode; false - The non-view mode + * + */ + public void setViewMode(boolean isView) { + if (isView) { + this.jComboBoxUsage.setEnabled(!isView); + } } - if (arg0.getSource() == jButtonCancel) { - this.returnType = DataType.RETURN_TYPE_CANCEL; - this.setVisible(false); + /** + * This method initializes jContentPane + * + * @return javax.swing.JPanel jContentPane + * + */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jStarLabel1 = new StarLabel(); + jStarLabel1.setLocation(new java.awt.Point(2, 10)); + jLabelC_Name = new JLabel(); + jLabelC_Name.setText("Select GUID's C Name"); + jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); + + jStarLabel2 = new StarLabel(); + jStarLabel2.setLocation(new java.awt.Point(2, 35)); + jLabelUsage = new JLabel(); + jLabelUsage.setText("Usage"); + jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); + + jLabelHelpText = new JLabel(); + jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 145, 20)); + jLabelHelpText.setText("Help Text"); + + jLabelFeatureFlag = new JLabel(); + jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 145, 20)); + jLabelFeatureFlag.setText("Feature Flag Expression"); + + jLabelArch = new JLabel(); + jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); + jLabelArch.setText("Supported Architectures"); + jArchCheckBox = new ArchCheckBox(); + jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20)); + jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); + + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.setPreferredSize(new java.awt.Dimension(490, 165)); + + jContentPane.add(jStarLabel1, null); + jContentPane.add(jLabelC_Name, null); + jContentPane.add(getJComboBoxCName(), null); + jContentPane.add(jStarLabel2, null); + jContentPane.add(jLabelUsage, null); + jContentPane.add(getJComboBoxUsage(), null); + jContentPane.add(jLabelHelpText, null); + jContentPane.add(getJScrollPaneHelpText(), null); + jContentPane.add(jLabelFeatureFlag, null); + jContentPane.add(getJTextFieldFeatureFlag(), null); + jContentPane.add(jLabelArch, null); + jContentPane.add(jArchCheckBox, null); + jContentPane.add(getJButtonOk(), null); + jContentPane.add(getJButtonCancel(), null); + } + return jContentPane; } - } - - /** - * Data validation for all fields - * - * @retval true - All datas are valid - * @retval false - At least one data is invalid - * - */ - public boolean checkAdd() { - // - // Check if all fields have correct data types - // - // - // Check Name - // - if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) { - if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem() - .toString())) { - Log.wrn("Update Guids", "Incorrect data type for Guid Name"); - return false; - } + /** + * This method initializes Usage type + * + */ + private void initFrame() { + Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllGuidDeclarationsFromWorkspace()); + Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVGuidUsage()); } - // - // Check FeatureFlag - // - if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { - if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { - Log.wrn("Update Guids", "Incorrect data type for Feature Flag"); - return false; - } + /* + * (non-Javadoc) + * + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + * + * Override actionPerformed to listen all actions + * + */ + public void actionPerformed(ActionEvent arg0) { + if (arg0.getSource() == jButtonOk) { + if (checkAdd()) { + getCurrentGuids(); + this.returnType = DataType.RETURN_TYPE_OK; + this.setVisible(false); + } + } + + if (arg0.getSource() == jButtonCancel) { + this.returnType = DataType.RETURN_TYPE_CANCEL; + this.setVisible(false); + } } - return true; - } + /** + * Data validation for all fields + * + * @retval true - All datas are valid + * @retval false - At least one data is invalid + * + */ + public boolean checkAdd() { + // + // Check if all fields have correct data types + // + + // + // Check Name + // + if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) { + if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) { + Log.wrn("Update Guids", "Incorrect data type for Guid Name"); + return false; + } + } + + // + // Check FeatureFlag + // + if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { + if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { + Log.wrn("Update Guids", "Incorrect data type for Feature Flag"); + return false; + } + } + + return true; + } -private GuidsIdentification getCurrentGuids() { + private GuidsIdentification getCurrentGuids() { String arg0 = this.jComboBoxCName.getSelectedItem().toString(); String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); @@ -420,11 +426,13 @@ private GuidsIdentification getCurrentGuids() { id = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4); return id; - } public GuidsIdentification getId() { - return id; - } + } - public void setId(GuidsIdentification id) { - this.id = id; - } + public GuidsIdentification getId() { + return id; + } + + public void setId(GuidsIdentification id) { + this.id = id; + } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HiiPackagesDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HiiPackagesDlg.java index 5db8cd5957..1997ab4c8a 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HiiPackagesDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HiiPackagesDlg.java @@ -44,409 +44,407 @@ import org.tianocore.frameworkwizard.module.Identifications.HiiPackages.HiiPacka */ public class HiiPackagesDlg extends IDialog { - // / - // / Define class Serial Version UID - // / - private static final long serialVersionUID = -6851574146786158116L; + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = -6851574146786158116L; - // - // Define class members - // - private JPanel jContentPane = null; - - private JLabel jLabelName = null; + // + // Define class members + // + private JPanel jContentPane = null; - private JTextField jTextFieldName = null; + private JLabel jLabelName = null; - private JLabel jLabelUsage = null; + private JTextField jTextFieldName = null; - private JComboBox jComboBoxUsage = null; + private JLabel jLabelUsage = null; - private StarLabel jStarLabel1 = null; + private JComboBox jComboBoxUsage = null; - private StarLabel jStarLabel2 = null; + private StarLabel jStarLabel1 = null; - private JLabel jLabelFeatureFlag = null; + private StarLabel jStarLabel2 = null; - private JTextField jTextFieldFeatureFlag = null; + private JLabel jLabelFeatureFlag = null; - private JLabel jLabelArch = null; + private JTextField jTextFieldFeatureFlag = null; - private JScrollPane jScrollPane = null; + private JLabel jLabelArch = null; - private JLabel jLabelHelpText = null; + private JScrollPane jScrollPane = null; - private JTextArea jTextAreaHelpText = null; + private JLabel jLabelHelpText = null; - private JScrollPane jScrollPaneHelpText = null; + private JTextArea jTextAreaHelpText = null; - private ArchCheckBox jArchCheckBox = null; + private JScrollPane jScrollPaneHelpText = null; - private JButton jButtonOk = null; + private ArchCheckBox jArchCheckBox = null; - private JButton jButtonCancel = null; + private JButton jButtonOk = null; - // - // Not used by UI - // - private HiiPackagesIdentification id = null; + private JButton jButtonCancel = null; - private EnumerationData ed = new EnumerationData(); + // + // Not used by UI + // + private HiiPackagesIdentification id = null; + + private EnumerationData ed = new EnumerationData(); + + /** + * + * This method initializes jTextFieldName + * + * @return javax.swing.JTextField jTextFieldName + * + */ + private JTextField getJTextFieldName() { + if (jTextFieldName == null) { + jTextFieldName = new JTextField(); + jTextFieldName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); + jTextFieldName.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldName.setToolTipText("Enter the C Name of the HII Package"); + } + return jTextFieldName; + } - /** - * - * This method initializes jTextFieldName - * - * @return javax.swing.JTextField jTextFieldName - * - */ - private JTextField getJTextFieldName() { - if (jTextFieldName == null) { - jTextFieldName = new JTextField(); - jTextFieldName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); - jTextFieldName.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldName.setToolTipText("Enter the C Name of the HII Package"); + /** + * + * This method initializes jComboBoxUsage + * + * @return javax.swing.JComboBox jComboBoxUsage + * + */ + private JComboBox getJComboBoxUsage() { + if (jComboBoxUsage == null) { + jComboBoxUsage = new JComboBox(); + jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); + jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxUsage + .setToolTipText("" + + "" + + "" + + "
ALWAYS_PRODUCEDHii is always registered
SOMETIMES_PRODUCEDSome executions paths will require the Hii to be registered
"); + } + return jComboBoxUsage; } - return jTextFieldName; - } - - /** - * - * This method initializes jComboBoxUsage - * - * @return javax.swing.JComboBox jComboBoxUsage - * - */ - private JComboBox getJComboBoxUsage() { - if (jComboBoxUsage == null) { - jComboBoxUsage = new JComboBox(); - jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); - jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxUsage - .setToolTipText("
ALWAYS_PRODUCEDHii is always registered
SOMETIMES_PRODUCEDSome executions paths will require the Hii to be registered
"); + + /** + * + * This method initializes jTextFieldFeatureFlag + * + * @return javax.swing.JTextField + */ + private JTextField getJTextFieldFeatureFlag() { + if (jTextFieldFeatureFlag == null) { + jTextFieldFeatureFlag = new JTextField(); + jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 320, 20)); + jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + } + return jTextFieldFeatureFlag; } - return jComboBoxUsage; - } - - /** - * - * This method initializes jTextFieldFeatureFlag - * - * @return javax.swing.JTextField - */ - private JTextField getJTextFieldFeatureFlag() { - if (jTextFieldFeatureFlag == null) { - jTextFieldFeatureFlag = new JTextField(); - jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 320, 20)); - jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldFeatureFlag - .setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + + /** + * + * This method initializes jScrollPane + * + * @return javax.swing.JScrollPane + * + */ + private JScrollPane getJScrollPane() { + if (jScrollPane == null) { + jScrollPane = new JScrollPane(); + jScrollPane.setViewportView(getJContentPane()); + } + return jScrollPane; } - return jTextFieldFeatureFlag; - } - - /** - * - * This method initializes jScrollPane - * - * @return javax.swing.JScrollPane - * - */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setViewportView(getJContentPane()); + + /** + * + * This method initializes jTextAreaHelpText + * + * @return javax.swing.JTextArea jTextAreaHelpText + * + */ + private JTextArea getJTextAreaHelpText() { + if (jTextAreaHelpText == null) { + jTextAreaHelpText = new JTextArea(); + jTextAreaHelpText.setLineWrap(true); + jTextAreaHelpText.setWrapStyleWord(true); + } + return jTextAreaHelpText; } - return jScrollPane; - } - - /** - * - * This method initializes jTextAreaHelpText - * - * @return javax.swing.JTextArea jTextAreaHelpText - * - */ - private JTextArea getJTextAreaHelpText() { - if (jTextAreaHelpText == null) { - jTextAreaHelpText = new JTextArea(); - jTextAreaHelpText.setLineWrap(true); - jTextAreaHelpText.setWrapStyleWord(true); + + /** + * + * This method initializes jScrollPaneHelpText + * + * @return javax.swing.JScrollPane + * + */ + private JScrollPane getJScrollPaneHelpText() { + if (jScrollPaneHelpText == null) { + jScrollPaneHelpText = new JScrollPane(); + jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setLocation(new java.awt.Point(160, 60)); + jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + } + return jScrollPaneHelpText; } - return jTextAreaHelpText; - } - - /** - * - * This method initializes jScrollPaneHelpText - * - * @return javax.swing.JScrollPane - * - */ - private JScrollPane getJScrollPaneHelpText() { - if (jScrollPaneHelpText == null) { - jScrollPaneHelpText = new JScrollPane(); - jScrollPaneHelpText - .setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); - jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); - jScrollPaneHelpText.setLocation(new java.awt.Point(160, 60)); - jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + + /** + * + * This method initializes jButtonOk + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonOk() { + if (jButtonOk == null) { + jButtonOk = new JButton(); + jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20)); + jButtonOk.setText("Ok"); + jButtonOk.addActionListener(this); + } + return jButtonOk; } - return jScrollPaneHelpText; - } - - /** - * - * This method initializes jButtonOk - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20)); - jButtonOk.setText("Ok"); - jButtonOk.addActionListener(this); + + /** + * + * This method initializes jButtonCancel + * + * @return javax.swing.JButton + * + **/ + private JButton getJButtonCancel() { + if (jButtonCancel == null) { + jButtonCancel = new JButton(); + jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20)); + jButtonCancel.setText("Cancel"); + jButtonCancel.addActionListener(this); + } + return jButtonCancel; } - return jButtonOk; - } - - /** - * - * This method initializes jButtonCancel - * - * @return javax.swing.JButton - * - **/ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20)); - jButtonCancel.setText("Cancel"); - jButtonCancel.addActionListener(this); + + public static void main(String[] args) { + } - return jButtonCancel; - } - - public static void main(String[] args) { - - } - - /** - * - * This method initializes this - * - **/ - private void init() { - this.setSize(500, 230); - this.setContentPane(getJScrollPane()); - this.setTitle("Hii Packages"); - initFrame(); - this.setViewMode(false); - this.centerWindow(); - } - - /** - * This method initializes this Fill values to all fields if these values are - * not empty - * - * @param inHiiPackagesId - * - **/ - private void init(HiiPackagesIdentification inHiiPackagesId) { - init(); - this.id = inHiiPackagesId; - - if (this.id != null) { - this.jTextFieldName.setText(id.getName()); - this.jComboBoxUsage.setSelectedItem(id.getUsage()); - this.jTextAreaHelpText.setText(id.getHelp()); - this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); - this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + + /** + * + * This method initializes this + * + **/ + private void init() { + this.setSize(500, 230); + this.setContentPane(getJScrollPane()); + this.setTitle("Hii Packages"); + initFrame(); + this.setViewMode(false); + this.centerWindow(); } - } - - /** - * This is the override edit constructor - * - * @param inHiiPackagesIdentification - * @param iFrame - * - **/ - public HiiPackagesDlg(HiiPackagesIdentification inHiiPackagesIdentification, - IFrame iFrame) { - super(iFrame, true); - init(inHiiPackagesIdentification); - } - - /** - * - * Disable all components when the mode is view - * - * @param isView - * true - The view mode; false - The non-view mode - * - **/ - public void setViewMode(boolean isView) { - if (isView) { - this.jTextFieldName.setEnabled(!isView); - this.jComboBoxUsage.setEnabled(!isView); + + /** + * This method initializes this Fill values to all fields if these values are + * not empty + * + * @param inHiiPackagesId + * + **/ + private void init(HiiPackagesIdentification inHiiPackagesId) { + init(); + this.id = inHiiPackagesId; + + if (this.id != null) { + this.jTextFieldName.setText(id.getName()); + this.jComboBoxUsage.setSelectedItem(id.getUsage()); + this.jTextAreaHelpText.setText(id.getHelp()); + this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); + this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + } } - } - - /** - * - * This method initializes jContentPane - * - * @return javax.swing.JPanel jContentPane - * - */ - private JPanel getJContentPane() { - if (jContentPane == null) { - jStarLabel1 = new StarLabel(); - jStarLabel1.setLocation(new java.awt.Point(2, 10)); - jLabelName = new JLabel(); - jLabelName.setText("Hii Package C Name"); - jLabelName.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); - jStarLabel2 = new StarLabel(); - jStarLabel2.setLocation(new java.awt.Point(2, 35)); - jLabelUsage = new JLabel(); - jLabelUsage.setText("Usage"); - jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); - jLabelHelpText = new JLabel(); - jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 145, 20)); - jLabelHelpText.setText("Help Text"); - jLabelFeatureFlag = new JLabel(); - jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 145, 20)); - jLabelFeatureFlag.setText("Feature Flag Expression"); - jLabelArch = new JLabel(); - jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); - jLabelArch.setText("Supported Architectures"); - jArchCheckBox = new ArchCheckBox(); - jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20)); - jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); - - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.setPreferredSize(new java.awt.Dimension(485, 185)); - - jContentPane.add(jStarLabel1, null); - jContentPane.add(jLabelName, null); - jContentPane.add(getJTextFieldName(), null); - - jContentPane.add(jStarLabel2, null); - jContentPane.add(jLabelUsage, null); - jContentPane.add(getJComboBoxUsage(), null); - - jContentPane.add(jLabelHelpText, null); - jContentPane.add(getJScrollPaneHelpText(), null); - - jContentPane.add(jLabelFeatureFlag, null); - jContentPane.add(getJTextFieldFeatureFlag(), null); - - jContentPane.add(jLabelArch, null); - jContentPane.add(jArchCheckBox, null); - - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); + + /** + * This is the override edit constructor + * + * @param inHiiPackagesIdentification + * @param iFrame + * + **/ + public HiiPackagesDlg(HiiPackagesIdentification inHiiPackagesIdentification, IFrame iFrame) { + super(iFrame, true); + init(inHiiPackagesIdentification); } - return jContentPane; - } - - /** - * - * This method initializes Usage type - * - */ - private void initFrame() { - Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHiiPackageUsage()); - } - - /* - * (non-Javadoc) - * - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - * - * Override actionPerformed to listen all actions - * - */ - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - if (checkAdd()) { - getCurrentHiiPackages(); - this.returnType = DataType.RETURN_TYPE_OK; - this.setVisible(false); - } + + /** + * + * Disable all components when the mode is view + * + * @param isView + * true - The view mode; false - The non-view mode + * + **/ + public void setViewMode(boolean isView) { + if (isView) { + this.jTextFieldName.setEnabled(!isView); + this.jComboBoxUsage.setEnabled(!isView); + } } - if (arg0.getSource() == jButtonCancel) { - this.returnType = DataType.RETURN_TYPE_CANCEL; - this.setVisible(false); + /** + * + * This method initializes jContentPane + * + * @return javax.swing.JPanel jContentPane + * + */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jStarLabel1 = new StarLabel(); + jStarLabel1.setLocation(new java.awt.Point(2, 10)); + jLabelName = new JLabel(); + jLabelName.setText("Hii Package C Name"); + jLabelName.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); + jStarLabel2 = new StarLabel(); + jStarLabel2.setLocation(new java.awt.Point(2, 35)); + jLabelUsage = new JLabel(); + jLabelUsage.setText("Usage"); + jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); + jLabelHelpText = new JLabel(); + jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 145, 20)); + jLabelHelpText.setText("Help Text"); + jLabelFeatureFlag = new JLabel(); + jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 145, 20)); + jLabelFeatureFlag.setText("Feature Flag Expression"); + jLabelArch = new JLabel(); + jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); + jLabelArch.setText("Supported Architectures"); + jArchCheckBox = new ArchCheckBox(); + jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20)); + jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); + + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.setPreferredSize(new java.awt.Dimension(485, 185)); + + jContentPane.add(jStarLabel1, null); + jContentPane.add(jLabelName, null); + jContentPane.add(getJTextFieldName(), null); + + jContentPane.add(jStarLabel2, null); + jContentPane.add(jLabelUsage, null); + jContentPane.add(getJComboBoxUsage(), null); + + jContentPane.add(jLabelHelpText, null); + jContentPane.add(getJScrollPaneHelpText(), null); + + jContentPane.add(jLabelFeatureFlag, null); + jContentPane.add(getJTextFieldFeatureFlag(), null); + + jContentPane.add(jLabelArch, null); + jContentPane.add(jArchCheckBox, null); + + jContentPane.add(getJButtonOk(), null); + jContentPane.add(getJButtonCancel(), null); + } + return jContentPane; } - } - - /** - * - * Data validation for all fields - * - * @retval true - All datas are valid - * @retval false - At least one data is invalid - * - */ - public boolean checkAdd() { - // - // Check if all fields have correct data types - // - // - // Check Hii Package Name - // - if (isEmpty(this.jTextFieldName.getText())) { - Log.wrn("Update Hii Packages", - "Hii Package Name Record must not be empty"); - return false; + /** + * + * This method initializes Usage type + * + */ + private void initFrame() { + Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHiiPackageUsage()); } - if (!isEmpty(this.jTextFieldName.getText())) { - if (!DataValidation.isC_NameType(this.jTextFieldName.getText())) { - Log.wrn("Update Hii Packages", - "Incorrect data type for Hii Package Name"); - return false; - } + /* + * (non-Javadoc) + * + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + * + * Override actionPerformed to listen all actions + * + */ + public void actionPerformed(ActionEvent arg0) { + if (arg0.getSource() == jButtonOk) { + if (checkAdd()) { + getCurrentHiiPackages(); + this.returnType = DataType.RETURN_TYPE_OK; + this.setVisible(false); + } + } + + if (arg0.getSource() == jButtonCancel) { + this.returnType = DataType.RETURN_TYPE_CANCEL; + this.setVisible(false); + } } - // - // Check FeatureFlag - // - if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { - if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { - Log.wrn("Update Hii Packages", "Incorrect data type for Feature Flag"); - return false; - } + /** + * + * Data validation for all fields + * + * @retval true - All datas are valid + * @retval false - At least one data is invalid + * + */ + public boolean checkAdd() { + // + // Check if all fields have correct data types + // + + // + // Check Hii Package Name + // + if (isEmpty(this.jTextFieldName.getText())) { + Log.wrn("Update Hii Packages", "Hii Package Name Record must not be empty"); + return false; + } + + if (!isEmpty(this.jTextFieldName.getText())) { + if (!DataValidation.isC_NameType(this.jTextFieldName.getText())) { + Log.wrn("Update Hii Packages", "Incorrect data type for Hii Package Name"); + return false; + } + } + + // + // Check FeatureFlag + // + if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { + if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { + Log.wrn("Update Hii Packages", "Incorrect data type for Feature Flag"); + return false; + } + } + + return true; } - return true; - } + private HiiPackagesIdentification getCurrentHiiPackages() { + String arg0 = this.jTextFieldName.getText(); + String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); - private HiiPackagesIdentification getCurrentHiiPackages() { - String arg0 = this.jTextFieldName.getText(); - String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); + String arg2 = this.jTextFieldFeatureFlag.getText(); + Vector arg3 = this.jArchCheckBox.getSelectedItemsVector(); + String arg4 = this.jTextAreaHelpText.getText(); - String arg2 = this.jTextFieldFeatureFlag.getText(); - Vector arg3 = this.jArchCheckBox.getSelectedItemsVector(); - String arg4 = this.jTextAreaHelpText.getText(); + id = new HiiPackagesIdentification(arg0, arg1, arg2, arg3, arg4); + return id; + } - id = new HiiPackagesIdentification(arg0, arg1, arg2, arg3, arg4); - return id; - } - - public HiiPackagesIdentification getId() { - return id; - } + public HiiPackagesIdentification getId() { + return id; + } - public void setId(HiiPackagesIdentification id) { - this.id = id; - } + public void setId(HiiPackagesIdentification id) { + this.id = id; + } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HobsDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HobsDlg.java index f6a76eed0c..a320969292 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HobsDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HobsDlg.java @@ -43,428 +43,440 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools; */ public class HobsDlg extends IDialog { - // / - // / Define class Serial Version UID - // / - private static final long serialVersionUID = -553473437579358325L; + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = -553473437579358325L; - // - // Define class members - // - private JPanel jContentPane = null; + // + // Define class members + // + private JPanel jContentPane = null; - private JLabel jLabelC_Name = null; + private JLabel jLabelC_Name = null; - private JComboBox jComboBoxGuidC_Name = null; + private JComboBox jComboBoxGuidC_Name = null; - private JLabel jLabelUsage = null; + private JLabel jLabelUsage = null; - private JLabel jLabelHobType = null; + private JLabel jLabelHobType = null; - private JComboBox jComboBoxUsage = null; + private JComboBox jComboBoxUsage = null; - private JComboBox jComboBoxHobType = null; + private JComboBox jComboBoxHobType = null; - private StarLabel jStarLabel1 = null; + private StarLabel jStarLabel1 = null; - private StarLabel jStarLabel2 = null; + private StarLabel jStarLabel2 = null; - private StarLabel jStarLabel3 = null; + private StarLabel jStarLabel3 = null; - private JLabel jLabelArch = null; + private JLabel jLabelArch = null; - private JScrollPane jScrollPane = null; + private JScrollPane jScrollPane = null; - private JLabel jLabelFeatureFlag = null; + private JLabel jLabelFeatureFlag = null; - private JTextField jTextFieldFeatureFlag = null; + private JTextField jTextFieldFeatureFlag = null; - private JLabel jLabelHelpText = null; + private JLabel jLabelHelpText = null; - private JTextArea jTextAreaHelpText = null; + private JTextArea jTextAreaHelpText = null; - private JScrollPane jScrollPaneHelpText = null; + private JScrollPane jScrollPaneHelpText = null; - private ArchCheckBox jArchCheckBox = null; + private ArchCheckBox jArchCheckBox = null; - private JButton jButtonOk = null; + private JButton jButtonOk = null; - private JButton jButtonCancel = null; + private JButton jButtonCancel = null; - // - // Not used by UI - // - private HobsIdentification id = null; + // + // Not used by UI + // + private HobsIdentification id = null; + + private EnumerationData ed = new EnumerationData(); + + private WorkspaceTools wt = new WorkspaceTools(); + + /** + * This method initializes jTextField + * + * @return javax.swing.JTextField jTextFieldC_Name + * + */ + private JComboBox getJComboBoxGuidC_Name() { + if (jComboBoxGuidC_Name == null) { + jComboBoxGuidC_Name = new JComboBox(); + jComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); + jComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Hob"); + } + return jComboBoxGuidC_Name; + } - private EnumerationData ed = new EnumerationData(); + /** + * This method initializes jComboBoxHobType + * + * @return javax.swing.JComboBox jComboBoxHobType + * + */ + private JComboBox getJComboBoxHobType() { + if (jComboBoxHobType == null) { + jComboBoxHobType = new JComboBox(); + jComboBoxHobType.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); + jComboBoxHobType.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxHobType + .setToolTipText("" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "
PHITEFI_HOB_TYPE_HANDOFF
MEMORY_ALLOCATIONEFI_HOB_TYPE_MEMORY_ALLOCATION and $BaseName
RESOURCE_DESCRIPTOREFI_HOB_TYPE_RESOURCE_DESCRIPTOR
GUID_EXTENTIONEFI_HOB_TYPE_GUID_EXTENSION and BaseName of GUID
FIRMWARE_VOLUMEEFI_HOB_TYPE_FV
CPUEFI_HOB_TYPE_CPU
POOLEFI_HOB_TYPE_PEI_MEMORY_POOL
CAPSULE_VOLUMEEFI_HOB_TYPE_CV
"); + } + return jComboBoxHobType; + } - private WorkspaceTools wt = new WorkspaceTools(); + /** + * This method initializes jComboBoxUsage + * + * @return javax.swing.JComboBox jComboBoxUsage + * + */ + private JComboBox getJComboBoxUsage() { + if (jComboBoxUsage == null) { + jComboBoxUsage = new JComboBox(); + jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); + jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxUsage + .setToolTipText("" + + "" + + "" + + "" + + "" + + "
ALWAYS_CONSUMEDHOB must be present in the system
SOMETIMES_CONSUMEDHOB will be used if it's present
ALWAYS_PRODUCEDHOB is always produced
SOMETIMES_PRODUCEDHOB will sometimes be produced by the module
"); + } + return jComboBoxUsage; + } - /** - * This method initializes jTextField - * - * @return javax.swing.JTextField jTextFieldC_Name - * - */ - private JComboBox getJComboBoxGuidC_Name() { - if (jComboBoxGuidC_Name == null) { - jComboBoxGuidC_Name = new JComboBox(); - jComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); - jComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Hob"); + /** + * This method initializes jScrollPane + * + * @return javax.swing.JScrollPane + */ + private JScrollPane getJScrollPane() { + if (jScrollPane == null) { + jScrollPane = new JScrollPane(); + jScrollPane.setViewportView(getJContentPane()); + } + return jScrollPane; } - return jComboBoxGuidC_Name; - } - - /** - * This method initializes jComboBoxHobType - * - * @return javax.swing.JComboBox jComboBoxHobType - * - */ - private JComboBox getJComboBoxHobType() { - if (jComboBoxHobType == null) { - jComboBoxHobType = new JComboBox(); - jComboBoxHobType.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); - jComboBoxHobType.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxHobType.setToolTipText("
PHITEFI_HOB_TYPE_HANDOFF
MEMORY_ALLOCATIONEFI_HOB_TYPE_MEMORY_ALLOCATION and $BaseName
RESOURCE_DESCRIPTOREFI_HOB_TYPE_RESOURCE_DESCRIPTOR
GUID_EXTENTIONEFI_HOB_TYPE_GUID_EXTENSION and BaseName of GUID
FIRMWARE_VOLUMEEFI_HOB_TYPE_FV
CPUEFI_HOB_TYPE_CPU
POOLEFI_HOB_TYPE_PEI_MEMORY_POOL
CAPSULE_VOLUMEEFI_HOB_TYPE_CV
"); + + /** + * This method initializes jTextFieldFeatureFlag + * + * @return javax.swing.JTextField + */ + private JTextField getJTextFieldFeatureFlag() { + if (jTextFieldFeatureFlag == null) { + jTextFieldFeatureFlag = new JTextField(); + jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 130, 320, 20)); + jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + } + return jTextFieldFeatureFlag; } - return jComboBoxHobType; - } - - /** - * This method initializes jComboBoxUsage - * - * @return javax.swing.JComboBox jComboBoxUsage - * - */ - private JComboBox getJComboBoxUsage() { - if (jComboBoxUsage == null) { - jComboBoxUsage = new JComboBox(); - jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); - jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxUsage.setToolTipText("
ALWAYS_CONSUMEDHOB must be present in the system
SOMETIMES_CONSUMEDHOB will be used if it's present
ALWAYS_PRODUCEDHOB is always produced
SOMETIMES_PRODUCEDHOB will sometimes be produced by the module
"); + + /** + * This method initializes jTextFieldHelpText + * + * @return javax.swing.JTextField + * + */ + private JTextArea getJTextAreaHelpText() { + if (jTextAreaHelpText == null) { + jTextAreaHelpText = new JTextArea(); + jTextAreaHelpText.setLineWrap(true); + jTextAreaHelpText.setWrapStyleWord(true); + } + return jTextAreaHelpText; } - return jComboBoxUsage; - } - - /** - * This method initializes jScrollPane - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setViewportView(getJContentPane()); + + /** + * This method initializes jScrollPaneHelpText + * + * @return javax.swing.JScrollPane + */ + private JScrollPane getJScrollPaneHelpText() { + if (jScrollPaneHelpText == null) { + jScrollPaneHelpText = new JScrollPane(); + jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setLocation(new java.awt.Point(160, 85)); + jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + } + return jScrollPaneHelpText; } - return jScrollPane; - } - - /** - * This method initializes jTextFieldFeatureFlag - * - * @return javax.swing.JTextField - */ - private JTextField getJTextFieldFeatureFlag() { - if (jTextFieldFeatureFlag == null) { - jTextFieldFeatureFlag = new JTextField(); - jTextFieldFeatureFlag - .setBounds(new java.awt.Rectangle(160, 130, 320, 20)); - jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + + /** + * This method initializes jButtonOk + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonOk() { + if (jButtonOk == null) { + jButtonOk = new JButton(); + jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20)); + jButtonOk.setText("Ok"); + jButtonOk.addActionListener(this); + } + return jButtonOk; } - return jTextFieldFeatureFlag; - } - - /** - * This method initializes jTextFieldHelpText - * - * @return javax.swing.JTextField - * - */ - private JTextArea getJTextAreaHelpText() { - if (jTextAreaHelpText == null) { - jTextAreaHelpText = new JTextArea(); - jTextAreaHelpText.setLineWrap(true); - jTextAreaHelpText.setWrapStyleWord(true); + + /** + * This method initializes jButtonCancel + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonCancel() { + if (jButtonCancel == null) { + jButtonCancel = new JButton(); + jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20)); + jButtonCancel.setText("Cancel"); + jButtonCancel.addActionListener(this); + } + return jButtonCancel; } - return jTextAreaHelpText; - } - - /** - * This method initializes jScrollPaneHelpText - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPaneHelpText() { - if (jScrollPaneHelpText == null) { - jScrollPaneHelpText = new JScrollPane(); - jScrollPaneHelpText - .setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); - jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); - jScrollPaneHelpText.setLocation(new java.awt.Point(160, 85)); - jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + + public static void main(String[] args) { + } - return jScrollPaneHelpText; - } - - /** - * This method initializes jButtonOk - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20)); - jButtonOk.setText("Ok"); - jButtonOk.addActionListener(this); + + /** + * This method initializes this + * + */ + private void init() { + this.setSize(500, 255); + this.setContentPane(getJScrollPane()); + this.setTitle("Hobs"); + initFrame(); + this.setViewMode(false); + this.centerWindow(); } - return jButtonOk; - } - - /** - * This method initializes jButtonCancel - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20)); - jButtonCancel.setText("Cancel"); - jButtonCancel.addActionListener(this); + + /** + * This method initializes this Fill values to all fields if these values are + * not empty + * + * @param inHobsId + * + */ + private void init(HobsIdentification inHobsId) { + init(); + this.id = inHobsId; + + if (this.id != null) { + this.jComboBoxGuidC_Name.setSelectedItem(id.getName()); + this.jComboBoxHobType.setSelectedItem(id.getType()); + this.jComboBoxUsage.setSelectedItem(id.getUsage()); + this.jTextAreaHelpText.setText(id.getHelp()); + this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); + this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + } } - return jButtonCancel; - } - - public static void main(String[] args) { - - } - - /** - * This method initializes this - * - */ - private void init() { - this.setSize(500, 255); - this.setContentPane(getJScrollPane()); - this.setTitle("Hobs"); - initFrame(); - this.setViewMode(false); - this.centerWindow(); - } - - /** - * This method initializes this Fill values to all fields if these values are - * not empty - * - * @param inHobsId - * - */ - private void init(HobsIdentification inHobsId) { - init(); - this.id = inHobsId; - - if (this.id != null) { - this.jComboBoxGuidC_Name.setSelectedItem(id.getName()); - this.jComboBoxHobType.setSelectedItem(id.getType()); - this.jComboBoxUsage.setSelectedItem(id.getUsage()); - this.jTextAreaHelpText.setText(id.getHelp()); - this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); - this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + + /** + * This is the override edit constructor + * + * @param inHobsIdentification + * @param iFrame + * + */ + public HobsDlg(HobsIdentification inHobsIdentification, IFrame iFrame) { + super(iFrame, true); + init(inHobsIdentification); } - } - - /** - * This is the override edit constructor - * - * @param inHobsIdentification - * @param iFrame - * - */ - public HobsDlg(HobsIdentification inHobsIdentification, IFrame iFrame) { - super(iFrame, true); - init(inHobsIdentification); - } - - /** - * Disable all components when the mode is view - * - * @param isView - * true - The view mode; false - The non-view mode - * - */ - public void setViewMode(boolean isView) { - if (isView) { - this.jComboBoxGuidC_Name.setEnabled(!isView); - this.jComboBoxUsage.setEnabled(!isView); - this.jComboBoxHobType.setEnabled(!isView); + + /** + * Disable all components when the mode is view + * + * @param isView + * true - The view mode; false - The non-view mode + * + */ + public void setViewMode(boolean isView) { + if (isView) { + this.jComboBoxGuidC_Name.setEnabled(!isView); + this.jComboBoxUsage.setEnabled(!isView); + this.jComboBoxHobType.setEnabled(!isView); + } } - } - - /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel jContentPane - * - */ - public JPanel getJContentPane() { - if (jContentPane == null) { - jStarLabel1 = new StarLabel(); - jStarLabel1.setLocation(new java.awt.Point(2, 10)); - jLabelC_Name = new JLabel(); - jLabelC_Name.setText("Hob's Guid C Name"); - jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); - - jStarLabel2 = new StarLabel(); - jStarLabel2.setLocation(new java.awt.Point(2, 35)); - jLabelHobType = new JLabel(); - jLabelHobType.setText("Hob Type"); - jLabelHobType.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); - - jStarLabel3 = new StarLabel(); - jStarLabel3.setLocation(new java.awt.Point(2, 60)); - jLabelUsage = new JLabel(); - jLabelUsage.setText("Usage"); - jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); - - jLabelHelpText = new JLabel(); - jLabelHelpText.setBounds(new java.awt.Rectangle(15, 85, 145, 20)); - jLabelHelpText.setText("Help Text"); - - jLabelFeatureFlag = new JLabel(); - jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); - jLabelFeatureFlag.setText("Feature Flag Expression"); - - jLabelArch = new JLabel(); - jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20)); - jLabelArch.setText("Supported Architectures"); - jArchCheckBox = new ArchCheckBox(); - jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20)); - jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); - - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.setPreferredSize(new java.awt.Dimension(485, 210)); - - jContentPane.add(jStarLabel1, null); - jContentPane.add(jLabelC_Name, null); - jContentPane.add(getJComboBoxGuidC_Name(), null); - jContentPane.add(jStarLabel2, null); - jContentPane.add(jLabelHobType, null); - jContentPane.add(getJComboBoxHobType(), null); - jContentPane.add(jStarLabel3, null); - jContentPane.add(jLabelUsage, null); - jContentPane.add(getJComboBoxUsage(), null); - jContentPane.add(jLabelHelpText, null); - jContentPane.add(getJScrollPaneHelpText(), null); - jContentPane.add(jLabelFeatureFlag, null); - jContentPane.add(getJTextFieldFeatureFlag(), null); - jContentPane.add(jLabelArch, null); - jContentPane.add(jArchCheckBox, null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); + + /** + * This method initializes jContentPane + * + * @return javax.swing.JPanel jContentPane + * + */ + public JPanel getJContentPane() { + if (jContentPane == null) { + jStarLabel1 = new StarLabel(); + jStarLabel1.setLocation(new java.awt.Point(2, 10)); + jLabelC_Name = new JLabel(); + jLabelC_Name.setText("Hob's Guid C Name"); + jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); + + jStarLabel2 = new StarLabel(); + jStarLabel2.setLocation(new java.awt.Point(2, 35)); + jLabelHobType = new JLabel(); + jLabelHobType.setText("Hob Type"); + jLabelHobType.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); + + jStarLabel3 = new StarLabel(); + jStarLabel3.setLocation(new java.awt.Point(2, 60)); + jLabelUsage = new JLabel(); + jLabelUsage.setText("Usage"); + jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); + + jLabelHelpText = new JLabel(); + jLabelHelpText.setBounds(new java.awt.Rectangle(15, 85, 145, 20)); + jLabelHelpText.setText("Help Text"); + + jLabelFeatureFlag = new JLabel(); + jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); + jLabelFeatureFlag.setText("Feature Flag Expression"); + + jLabelArch = new JLabel(); + jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20)); + jLabelArch.setText("Supported Architectures"); + jArchCheckBox = new ArchCheckBox(); + jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20)); + jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); + + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.setPreferredSize(new java.awt.Dimension(485, 210)); + + jContentPane.add(jStarLabel1, null); + jContentPane.add(jLabelC_Name, null); + jContentPane.add(getJComboBoxGuidC_Name(), null); + jContentPane.add(jStarLabel2, null); + jContentPane.add(jLabelHobType, null); + jContentPane.add(getJComboBoxHobType(), null); + jContentPane.add(jStarLabel3, null); + jContentPane.add(jLabelUsage, null); + jContentPane.add(getJComboBoxUsage(), null); + jContentPane.add(jLabelHelpText, null); + jContentPane.add(getJScrollPaneHelpText(), null); + jContentPane.add(jLabelFeatureFlag, null); + jContentPane.add(getJTextFieldFeatureFlag(), null); + jContentPane.add(jLabelArch, null); + jContentPane.add(jArchCheckBox, null); + jContentPane.add(getJButtonOk(), null); + jContentPane.add(getJButtonCancel(), null); + } + return jContentPane; } - return jContentPane; - } - - /** - * This method initializes Usage type and Hob type - * - */ - private void initFrame() { - Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHobUsage()); - Tools.generateComboBoxByVector(jComboBoxHobType, ed.getVHobType()); - Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt - .getAllGuidDeclarationsFromWorkspace()); - } - - /* - * (non-Javadoc) - * - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - * - * Override actionPerformed to listen all actions - * - */ - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - if (checkAdd()) { - getCurrentHobs(); - this.returnType = DataType.RETURN_TYPE_OK; - this.setVisible(false); - } + + /** + * This method initializes Usage type and Hob type + * + */ + private void initFrame() { + Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHobUsage()); + Tools.generateComboBoxByVector(jComboBoxHobType, ed.getVHobType()); + Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt.getAllGuidDeclarationsFromWorkspace()); } - if (arg0.getSource() == jButtonCancel) { - this.returnType = DataType.RETURN_TYPE_CANCEL; - this.setVisible(false); + /* + * (non-Javadoc) + * + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + * + * Override actionPerformed to listen all actions + * + */ + public void actionPerformed(ActionEvent arg0) { + if (arg0.getSource() == jButtonOk) { + if (checkAdd()) { + getCurrentHobs(); + this.returnType = DataType.RETURN_TYPE_OK; + this.setVisible(false); + } + } + + if (arg0.getSource() == jButtonCancel) { + this.returnType = DataType.RETURN_TYPE_CANCEL; + this.setVisible(false); + } } - } - - /** - * Data validation for all fields - * - * @retval true - All datas are valid - * @retval false - At least one data is invalid - * - */ - public boolean checkAdd() { - // - // Check if all fields have correct data types - // - // - // Check Name - // - if (isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) { - Log.wrn("Update Hobs", "Hob Guid C Name must not be empty"); - return false; + /** + * Data validation for all fields + * + * @retval true - All datas are valid + * @retval false - At least one data is invalid + * + */ + public boolean checkAdd() { + // + // Check if all fields have correct data types + // + + // + // Check Name + // + if (isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) { + Log.wrn("Update Hobs", "Hob Guid C Name must not be empty"); + return false; + } + + if (!isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) { + if (!DataValidation.isC_NameType(this.jComboBoxGuidC_Name.getSelectedItem().toString())) { + Log.wrn("Update Hobs", "Incorrect data type for Hob Name"); + return false; + } + } + + // + // Check FeatureFlag + // + if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { + if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { + Log.wrn("Update Hobs", "Incorrect data type for Feature Flag"); + return false; + } + } + + return true; } - if (!isEmpty(this.jComboBoxGuidC_Name.getSelectedItem().toString())) { - if (!DataValidation.isC_NameType(this.jComboBoxGuidC_Name - .getSelectedItem().toString())) { - Log.wrn("Update Hobs", "Incorrect data type for Hob Name"); - return false; - } + private HobsIdentification getCurrentHobs() { + String arg0 = this.jComboBoxGuidC_Name.getSelectedItem().toString(); + String arg1 = this.jComboBoxHobType.getSelectedItem().toString(); + String arg2 = this.jComboBoxUsage.getSelectedItem().toString(); + + String arg3 = this.jTextFieldFeatureFlag.getText(); + Vector arg4 = this.jArchCheckBox.getSelectedItemsVector(); + String arg5 = this.jTextAreaHelpText.getText(); + id = new HobsIdentification(arg0, arg1, arg2, arg3, arg4, arg5); + return id; } - // - // Check FeatureFlag - // - if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { - if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { - Log.wrn("Update Hobs", "Incorrect data type for Feature Flag"); - return false; - } + public HobsIdentification getId() { + return id; } - return true; - } - - private HobsIdentification getCurrentHobs() { - String arg0 = this.jComboBoxGuidC_Name.getSelectedItem().toString(); - String arg1 = this.jComboBoxHobType.getSelectedItem().toString(); - String arg2 = this.jComboBoxUsage.getSelectedItem().toString(); - - String arg3 = this.jTextFieldFeatureFlag.getText(); - Vector arg4 = this.jArchCheckBox.getSelectedItemsVector(); - String arg5 = this.jTextAreaHelpText.getText(); - id = new HobsIdentification(arg0, arg1, arg2, arg3, arg4, arg5); - return id; - } - - public HobsIdentification getId() { - return id; - } - - public void setId(HobsIdentification id) { - this.id = id; - } + public void setId(HobsIdentification id) { + this.id = id; + } } 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 e7474a52c8..c4080aee64 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 @@ -96,7 +96,7 @@ public class LibraryClassDefsDlg extends IDialog { private JTextField jTextFieldHelpText = null; private ArchCheckBox jArchCheckBox = null; - + private JButton jButtonOk = null; private JButton jButtonCancel = null; @@ -212,6 +212,7 @@ public class LibraryClassDefsDlg extends IDialog { jTextFieldFeatureFlag = new JTextField(); jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 85, 320, 20)); jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); } return jTextFieldFeatureFlag; } @@ -372,7 +373,7 @@ public class LibraryClassDefsDlg extends IDialog { jLabelArch.setText("Supported Architectures"); jLabelFeatureFlag = new JLabel(); jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 85, 140, 20)); - jLabelFeatureFlag.setText("Feature Flag"); + jLabelFeatureFlag.setText("Feature Flag Expression"); jLabelRecommendedInstanceGuid = new JLabel(); jLabelRecommendedInstanceGuid.setBounds(new java.awt.Rectangle(15, 110, 200, 20)); jLabelRecommendedInstanceGuid.setText("Recommended Instance Guid"); diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java index 753b0e2ed5..e0a0f34c01 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java @@ -46,519 +46,505 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools; */ public class PCDsDlg extends IDialog implements ItemListener { - // / - // / Define class Serial Version UID - // / - private static final long serialVersionUID = 2227717658188438696L; + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = 2227717658188438696L; - // - // Define class members - // - private JPanel jContentPane = null; - - private JLabel jLabelItemType = null; - - private JLabel jLabelC_Name = null; + // + // Define class members + // + private JPanel jContentPane = null; - private JComboBox jComboBoxItemType = null; + private JLabel jLabelItemType = null; - private JComboBox jComboBoxCName = null; + private JLabel jLabelC_Name = null; - private JLabel jLabelDefaultValue = null; + private JComboBox jComboBoxItemType = null; - private JTextField jTextFieldDefaultValue = null; + private JComboBox jComboBoxCName = null; - private StarLabel jStarLabel1 = null; + private JLabel jLabelDefaultValue = null; - private StarLabel jStarLabel2 = null; + private JTextField jTextFieldDefaultValue = null; - private StarLabel jStarLabel3 = null; + private StarLabel jStarLabel1 = null; - private JLabel jLabelHelpText = null; + private StarLabel jStarLabel2 = null; - private JTextArea jTextAreaHelpText = null; + private StarLabel jStarLabel3 = null; - private JScrollPane jScrollPane = null; + private JLabel jLabelHelpText = null; - private JLabel jLabelTokenSpaceGuid = null; + private JTextArea jTextAreaHelpText = null; - private JTextField jTextFieldTokenSpaceGuid = null; + private JScrollPane jScrollPane = null; - private JLabel jLabelFeatureFlag = null; + private JLabel jLabelTokenSpaceGuid = null; - private JTextField jTextFieldFeatureFlag = null; + private JTextField jTextFieldTokenSpaceGuid = null; - private JLabel jLabelArch = null; + private JLabel jLabelFeatureFlag = null; - private ArchCheckBox jArchCheckBox = null; + private JTextField jTextFieldFeatureFlag = null; - private JButton jButtonOk = null; + private JLabel jLabelArch = null; - private JButton jButtonCancel = null; + private ArchCheckBox jArchCheckBox = null; - private JScrollPane jScrollPaneHelpText = null; + private JButton jButtonOk = null; - // - // Not used by UI - // - private PcdCodedIdentification id = null; + private JButton jButtonCancel = null; - private WorkspaceTools wt = new WorkspaceTools(); + private JScrollPane jScrollPaneHelpText = null; - private PcdVector pcd = wt.getAllPcdDeclarationsFromWorkspace(); + // + // Not used by UI + // + private PcdCodedIdentification id = null; + + private WorkspaceTools wt = new WorkspaceTools(); + + private PcdVector pcd = wt.getAllPcdDeclarationsFromWorkspace(); + + /** + * This method initializes jComboBoxItemType + * + * @return javax.swing.JComboBox jComboBoxItemType + * + */ + private JComboBox getJComboBoxItemType() { + if (jComboBoxItemType == null) { + jComboBoxItemType = new JComboBox(); + jComboBoxItemType.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); + jComboBoxItemType.setPreferredSize(new java.awt.Dimension(320, 20)); + } + return jComboBoxItemType; + } - /** - * This method initializes jComboBoxItemType - * - * @return javax.swing.JComboBox jComboBoxItemType - * - */ - private JComboBox getJComboBoxItemType() { - if (jComboBoxItemType == null) { - jComboBoxItemType = new JComboBox(); - jComboBoxItemType.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); - jComboBoxItemType.setPreferredSize(new java.awt.Dimension(320, 20)); + /** + * This method initializes jTextFieldC_Name + * + * @return javax.swing.JTextField jTextFieldC_Name + * + */ + private JComboBox getJComboBoxCName() { + if (jComboBoxCName == null) { + jComboBoxCName = new JComboBox(); + jComboBoxCName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); + jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxCName.addItemListener(this); + } + return jComboBoxCName; } - return jComboBoxItemType; - } - - /** - * This method initializes jTextFieldC_Name - * - * @return javax.swing.JTextField jTextFieldC_Name - * - */ - private JComboBox getJComboBoxCName() { - if (jComboBoxCName == null) { - jComboBoxCName = new JComboBox(); - jComboBoxCName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); - jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxCName.addItemListener(this); + + /** + * This method initializes jTextFieldDefaultValue + * + * @return javax.swing.JTextField jTextFieldDefaultValue + * + */ + private JTextField getJTextFieldDefaultValue() { + if (jTextFieldDefaultValue == null) { + jTextFieldDefaultValue = new JTextField(); + jTextFieldDefaultValue.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); + jTextFieldDefaultValue.setPreferredSize(new java.awt.Dimension(320, 20)); + } + return jTextFieldDefaultValue; } - return jComboBoxCName; - } - - /** - * This method initializes jTextFieldDefaultValue - * - * @return javax.swing.JTextField jTextFieldDefaultValue - * - */ - private JTextField getJTextFieldDefaultValue() { - if (jTextFieldDefaultValue == null) { - jTextFieldDefaultValue = new JTextField(); - jTextFieldDefaultValue - .setBounds(new java.awt.Rectangle(160, 60, 320, 20)); - jTextFieldDefaultValue.setPreferredSize(new java.awt.Dimension(320, 20)); + + /** + * This method initializes jTextAreaHelpText + * + * @return javax.swing.JTextArea + */ + private JTextArea getJTextAreaHelpText() { + if (jTextAreaHelpText == null) { + jTextAreaHelpText = new JTextArea(); + jTextAreaHelpText.setLineWrap(true); + jTextAreaHelpText.setWrapStyleWord(true); + } + return jTextAreaHelpText; } - return jTextFieldDefaultValue; - } - - /** - * This method initializes jTextAreaHelpText - * - * @return javax.swing.JTextArea - */ - private JTextArea getJTextAreaHelpText() { - if (jTextAreaHelpText == null) { - jTextAreaHelpText = new JTextArea(); - jTextAreaHelpText.setLineWrap(true); - jTextAreaHelpText.setWrapStyleWord(true); + + /** + * This method initializes jScrollPaneHelpText + * + * @return javax.swing.JScrollPane + * + */ + private JScrollPane getJScrollPaneHelpText() { + if (jScrollPaneHelpText == null) { + jScrollPaneHelpText = new JScrollPane(); + jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setLocation(new java.awt.Point(160, 85)); + jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + } + return jScrollPaneHelpText; } - return jTextAreaHelpText; - } - - /** - * This method initializes jScrollPaneHelpText - * - * @return javax.swing.JScrollPane - * - */ - private JScrollPane getJScrollPaneHelpText() { - if (jScrollPaneHelpText == null) { - jScrollPaneHelpText = new JScrollPane(); - jScrollPaneHelpText - .setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); - jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); - jScrollPaneHelpText.setLocation(new java.awt.Point(160, 85)); - jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + + /** + * This method initializes jScrollPane + * + * @return javax.swing.JScrollPane + */ + private JScrollPane getJScrollPane() { + if (jScrollPane == null) { + jScrollPane = new JScrollPane(); + jScrollPane.setViewportView(getJContentPane()); + } + return jScrollPane; } - return jScrollPaneHelpText; - } - - /** - * This method initializes jScrollPane - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setViewportView(getJContentPane()); + + /** + * This method initializes jTextFieldTokenSpaceGuid + * + * @return javax.swing.JTextField + */ + private JTextField getJTextFieldTokenSpaceGuid() { + if (jTextFieldTokenSpaceGuid == null) { + jTextFieldTokenSpaceGuid = new JTextField(); + jTextFieldTokenSpaceGuid.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); + jTextFieldTokenSpaceGuid.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldTokenSpaceGuid.setVisible(false); + } + return jTextFieldTokenSpaceGuid; } - return jScrollPane; - } - - /** - * This method initializes jTextFieldTokenSpaceGuid - * - * @return javax.swing.JTextField - */ - private JTextField getJTextFieldTokenSpaceGuid() { - if (jTextFieldTokenSpaceGuid == null) { - jTextFieldTokenSpaceGuid = new JTextField(); - jTextFieldTokenSpaceGuid.setBounds(new java.awt.Rectangle(160, 60, 320, - 20)); - jTextFieldTokenSpaceGuid - .setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldTokenSpaceGuid.setVisible(false); + + /** + * This method initializes jTextFieldFeatureFlag + * + * @return javax.swing.JTextField + */ + private JTextField getJTextFieldFeatureFlag() { + if (jTextFieldFeatureFlag == null) { + jTextFieldFeatureFlag = new JTextField(); + jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 130, 320, 20)); + jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + } + return jTextFieldFeatureFlag; } - return jTextFieldTokenSpaceGuid; - } - - /** - * This method initializes jTextFieldFeatureFlag - * - * @return javax.swing.JTextField - */ - private JTextField getJTextFieldFeatureFlag() { - if (jTextFieldFeatureFlag == null) { - jTextFieldFeatureFlag = new JTextField(); - jTextFieldFeatureFlag - .setBounds(new java.awt.Rectangle(160, 130, 320, 20)); - jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + + /** + * This method initializes jButtonOk + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonOk() { + if (jButtonOk == null) { + jButtonOk = new JButton(); + jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20)); + jButtonOk.setText("Ok"); + jButtonOk.addActionListener(this); + } + return jButtonOk; } - return jTextFieldFeatureFlag; - } - - /** - * This method initializes jButtonOk - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20)); - jButtonOk.setText("Ok"); - jButtonOk.addActionListener(this); + + /** + * This method initializes jButtonCancel + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonCancel() { + if (jButtonCancel == null) { + jButtonCancel = new JButton(); + jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20)); + jButtonCancel.setText("Cancel"); + jButtonCancel.addActionListener(this); + } + return jButtonCancel; } - return jButtonOk; - } - - /** - * This method initializes jButtonCancel - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20)); - jButtonCancel.setText("Cancel"); - jButtonCancel.addActionListener(this); + + public static void main(String[] args) { + } - return jButtonCancel; - } - - public static void main(String[] args) { - - } - - /** - * This method initializes this - * - */ - private void init() { - this.setSize(500, 255); - this.setContentPane(getJScrollPane()); - this.setTitle("Pcd Coded"); - initFrame(); - this.setViewMode(false); - this.centerWindow(); - } - - /** - * This method initializes this Fill values to all fields if these values are - * not empty - * - * @param inPcdCodedId - * - */ - private void init(PcdCodedIdentification inPcdCodedId) { - init(); - this.id = inPcdCodedId; - - if (this.id != null) { - this.jComboBoxCName.setSelectedItem(id.getName()); - this.jTextFieldTokenSpaceGuid.setText(id.getGuid()); - this.jTextFieldDefaultValue.setText(id.getValue()); - this.jTextAreaHelpText.setText(id.getHelp()); - this.jComboBoxItemType.setSelectedItem(id.getType()); - this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); - this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + + /** + * This method initializes this + * + */ + private void init() { + this.setSize(500, 255); + this.setContentPane(getJScrollPane()); + this.setTitle("Pcd Coded"); + initFrame(); + this.setViewMode(false); + this.centerWindow(); } - } - - /** - * This is the override edit constructor - * - * @param inPcdCodedId - * @param iFrame - * - */ - public PCDsDlg(PcdCodedIdentification inPcdCodedId, IFrame iFrame) { - super(iFrame, true); - init(inPcdCodedId); - } - - /** - * Disable all components when the mode is view - * - * @param isView - * true - The view mode; false - The non-view mode - * - */ - public void setViewMode(boolean isView) { - if (isView) { - this.jTextFieldDefaultValue.setEnabled(!isView); - this.jComboBoxItemType.setEnabled(!isView); + + /** + * This method initializes this Fill values to all fields if these values are + * not empty + * + * @param inPcdCodedId + * + */ + private void init(PcdCodedIdentification inPcdCodedId) { + init(); + this.id = inPcdCodedId; + + if (this.id != null) { + this.jComboBoxCName.setSelectedItem(id.getName()); + this.jTextFieldTokenSpaceGuid.setText(id.getGuid()); + this.jTextFieldDefaultValue.setText(id.getValue()); + this.jTextAreaHelpText.setText(id.getHelp()); + this.jComboBoxItemType.setSelectedItem(id.getType()); + this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); + this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + } } - } - - /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel jContentPane - * - */ - private JPanel getJContentPane() { - if (jContentPane == null) { - jStarLabel1 = new StarLabel(); - jStarLabel1.setLocation(new java.awt.Point(2, 10)); - jLabelC_Name = new JLabel(); - jLabelC_Name.setText("PCD C Name"); - jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); - - jStarLabel2 = new StarLabel(); - jStarLabel2.setLocation(new java.awt.Point(2, 35)); - jLabelItemType = new JLabel(); - jLabelItemType.setText("PCD Item Type"); - jLabelItemType.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); - - jLabelDefaultValue = new JLabel(); - jLabelDefaultValue.setText("Default Value"); - jLabelDefaultValue.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); - - jStarLabel3 = new StarLabel(); - jStarLabel3.setLocation(new java.awt.Point(2, 85)); - jLabelHelpText = new JLabel(); - jLabelHelpText.setText("Help Text"); - jLabelHelpText.setBounds(new java.awt.Rectangle(15, 85, 145, 20)); - - jLabelFeatureFlag = new JLabel(); - jLabelFeatureFlag.setText("Feature Flag Expression"); - jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 140, 20)); - - jLabelTokenSpaceGuid = new JLabel(); - jLabelTokenSpaceGuid.setText("Token Space C Name"); - jLabelTokenSpaceGuid.setVisible(false); - - jLabelArch = new JLabel(); - jLabelArch.setText("Supported Architectures"); - jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20)); - jArchCheckBox = new ArchCheckBox(); - jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); - jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20)); - - // Hidden field - jLabelTokenSpaceGuid.setBounds(new java.awt.Rectangle(15, 60, 140, 20)); - - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.setPreferredSize(new java.awt.Dimension(485, 210)); - - jContentPane.add(jStarLabel1, null); - jContentPane.add(jLabelC_Name, null); - jContentPane.add(getJComboBoxCName(), null); - jContentPane.add(jStarLabel2, null); - jContentPane.add(jLabelItemType, null); - jContentPane.add(getJComboBoxItemType(), null); - jContentPane.add(jLabelDefaultValue, null); - jContentPane.add(getJTextFieldDefaultValue(), null); - jContentPane.add(jStarLabel3, null); - jContentPane.add(jLabelHelpText, null); - jContentPane.add(getJScrollPaneHelpText(), null); - jContentPane.add(jLabelFeatureFlag, null); - jContentPane.add(getJTextFieldFeatureFlag(), null); - jContentPane.add(jLabelArch, null); - jContentPane.add(jArchCheckBox, null); - // Hidden - jContentPane.add(getJTextFieldTokenSpaceGuid(), null); - jContentPane.add(jLabelTokenSpaceGuid, null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); + + /** + * This is the override edit constructor + * + * @param inPcdCodedId + * @param iFrame + * + */ + public PCDsDlg(PcdCodedIdentification inPcdCodedId, IFrame iFrame) { + super(iFrame, true); + init(inPcdCodedId); } - return jContentPane; - } - - /** - * This method initializes Usage type, Item type and Datum type - * - */ - private void initFrame() { - for (int index = 0; index < pcd.size(); index++) { - jComboBoxCName.addItem(pcd.getPcd(index)); + + /** + * Disable all components when the mode is view + * + * @param isView + * true - The view mode; false - The non-view mode + * + */ + public void setViewMode(boolean isView) { + if (isView) { + this.jTextFieldDefaultValue.setEnabled(!isView); + this.jComboBoxItemType.setEnabled(!isView); + } } - // Tools.generateComboBoxByVector(jComboBoxItemType, ed.getVPcdItemTypes()); - } - - - /* - * (non-Javadoc) - * - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - * - * Override actionPerformed to listen all actions - * - */ - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - if (checkAdd()) { - getCurrentPcdCoded(); - this.returnType = DataType.RETURN_TYPE_OK; - this.setVisible(false); - } + /** + * This method initializes jContentPane + * + * @return javax.swing.JPanel jContentPane + * + */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jStarLabel1 = new StarLabel(); + jStarLabel1.setLocation(new java.awt.Point(2, 10)); + jLabelC_Name = new JLabel(); + jLabelC_Name.setText("PCD C Name"); + jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); + + jStarLabel2 = new StarLabel(); + jStarLabel2.setLocation(new java.awt.Point(2, 35)); + jLabelItemType = new JLabel(); + jLabelItemType.setText("PCD Item Type"); + jLabelItemType.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); + + jLabelDefaultValue = new JLabel(); + jLabelDefaultValue.setText("Default Value"); + jLabelDefaultValue.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); + + jStarLabel3 = new StarLabel(); + jStarLabel3.setLocation(new java.awt.Point(2, 85)); + jLabelHelpText = new JLabel(); + jLabelHelpText.setText("Help Text"); + jLabelHelpText.setBounds(new java.awt.Rectangle(15, 85, 145, 20)); + + jLabelFeatureFlag = new JLabel(); + jLabelFeatureFlag.setText("Feature Flag Expression"); + jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 140, 20)); + + jLabelTokenSpaceGuid = new JLabel(); + jLabelTokenSpaceGuid.setText("Token Space C Name"); + jLabelTokenSpaceGuid.setVisible(false); + + jLabelArch = new JLabel(); + jLabelArch.setText("Supported Architectures"); + jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20)); + jArchCheckBox = new ArchCheckBox(); + jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); + jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20)); + + // Hidden field + jLabelTokenSpaceGuid.setBounds(new java.awt.Rectangle(15, 60, 140, 20)); + + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.setPreferredSize(new java.awt.Dimension(485, 210)); + + jContentPane.add(jStarLabel1, null); + jContentPane.add(jLabelC_Name, null); + jContentPane.add(getJComboBoxCName(), null); + jContentPane.add(jStarLabel2, null); + jContentPane.add(jLabelItemType, null); + jContentPane.add(getJComboBoxItemType(), null); + jContentPane.add(jLabelDefaultValue, null); + jContentPane.add(getJTextFieldDefaultValue(), null); + jContentPane.add(jStarLabel3, null); + jContentPane.add(jLabelHelpText, null); + jContentPane.add(getJScrollPaneHelpText(), null); + jContentPane.add(jLabelFeatureFlag, null); + jContentPane.add(getJTextFieldFeatureFlag(), null); + jContentPane.add(jLabelArch, null); + jContentPane.add(jArchCheckBox, null); + // Hidden + jContentPane.add(getJTextFieldTokenSpaceGuid(), null); + jContentPane.add(jLabelTokenSpaceGuid, null); + jContentPane.add(getJButtonOk(), null); + jContentPane.add(getJButtonCancel(), null); + } + return jContentPane; } - if (arg0.getSource() == jButtonCancel) { - this.returnType = DataType.RETURN_TYPE_CANCEL; - this.setVisible(false); + /** + * This method initializes Usage type, Item type and Datum type + * + */ + private void initFrame() { + for (int index = 0; index < pcd.size(); index++) { + jComboBoxCName.addItem(pcd.getPcd(index)); + } + + // Tools.generateComboBoxByVector(jComboBoxItemType, ed.getVPcdItemTypes()); } - } - - /** - * Data validation for all fields - * - * @retval true - All datas are valid - * @retval false - At least one data is invalid - * - */ - public boolean checkAdd() { - // - // Check if all fields have correct data types - // - // - // Check C_Name - // - if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) { - if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem() - .toString())) { - Log.wrn("Update PcdCoded", "Incorrect data type for C Name"); - return false; - } + /* + * (non-Javadoc) + * + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + * + * Override actionPerformed to listen all actions + * + */ + public void actionPerformed(ActionEvent arg0) { + if (arg0.getSource() == jButtonOk) { + if (checkAdd()) { + getCurrentPcdCoded(); + this.returnType = DataType.RETURN_TYPE_OK; + this.setVisible(false); + } + } + + if (arg0.getSource() == jButtonCancel) { + this.returnType = DataType.RETURN_TYPE_CANCEL; + this.setVisible(false); + } } - // - // Check TokenSpaceGuid - // - if (!isEmpty(this.jTextFieldTokenSpaceGuid.getText())) { - if (!DataValidation.isC_NameType(this.jTextFieldTokenSpaceGuid.getText())) { - Log - .wrn("Update PcdCoded", - "Incorrect data type for the selected pcd entry, please check in in spd file"); - return false; - } + /** + * Data validation for all fields + * + * @retval true - All datas are valid + * @retval false - At least one data is invalid + * + */ + public boolean checkAdd() { + // + // Check if all fields have correct data types + // + + // + // Check C_Name + // + if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) { + if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) { + Log.wrn("Update PcdCoded", "Incorrect data type for C Name"); + return false; + } + } + + // + // Check TokenSpaceGuid + // + if (!isEmpty(this.jTextFieldTokenSpaceGuid.getText())) { + if (!DataValidation.isC_NameType(this.jTextFieldTokenSpaceGuid.getText())) { + Log.wrn("Update PcdCoded", + "Incorrect data type for the selected pcd entry, please check in in spd file"); + return false; + } + } + + // + // Check DefaultValue + // + if (!isEmpty(this.jTextFieldDefaultValue.getText())) { + if (!DataValidation.isDefaultValueType(this.jTextFieldDefaultValue.getText())) { + Log.wrn("Update PcdCoded", "Incorrect data type for Default Value"); + return false; + } + } + + // + // Check HelpText + // + if (isEmpty(this.jTextAreaHelpText.getText())) { + Log.wrn("Update PcdCoded", "Help Text should not be empty"); + return false; + } + + // + // Check FeatureFlag + // + if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { + if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { + Log.wrn("Update PcdCoded", "Incorrect data type for Feature Flag"); + return false; + } + } + + return true; } - // - // Check DefaultValue - // - if (!isEmpty(this.jTextFieldDefaultValue.getText())) { - if (!DataValidation.isDefaultValueType(this.jTextFieldDefaultValue - .getText())) { - Log.wrn("Update PcdCoded", "Incorrect data type for Default Value"); - return false; - } + private PcdCodedIdentification getCurrentPcdCoded() { + String arg0 = this.jComboBoxCName.getSelectedItem().toString(); + String arg1 = this.jTextFieldTokenSpaceGuid.getText(); + + String arg2 = this.jTextFieldFeatureFlag.getText(); + Vector arg3 = this.jArchCheckBox.getSelectedItemsVector(); + + String arg4 = this.jTextFieldDefaultValue.getText(); + String arg5 = this.jTextAreaHelpText.getText(); + String arg6 = this.jComboBoxItemType.getSelectedItem().toString(); + id = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + return id; } - // - // Check HelpText - // - if (isEmpty(this.jTextAreaHelpText.getText())) { - Log.wrn("Update PcdCoded", "Help Text should not be empty"); - return false; + public PcdCodedIdentification getId() { + return id; } - // - // Check FeatureFlag - // - if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { - if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { - Log.wrn("Update PcdCoded", "Incorrect data type for Feature Flag"); - return false; - } + public void setId(PcdCodedIdentification id) { + this.id = id; } - return true; - } - - private PcdCodedIdentification getCurrentPcdCoded() { - String arg0 = this.jComboBoxCName.getSelectedItem().toString(); - String arg1 = this.jTextFieldTokenSpaceGuid.getText(); - - String arg2 = this.jTextFieldFeatureFlag.getText(); - Vector arg3 = this.jArchCheckBox.getSelectedItemsVector(); - - String arg4 = this.jTextFieldDefaultValue.getText(); - String arg5 = this.jTextAreaHelpText.getText(); - String arg6 = this.jComboBoxItemType.getSelectedItem().toString(); - id = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6); - return id; - } - - public PcdCodedIdentification getId() { - return id; - } - - public void setId(PcdCodedIdentification id) { - this.id = id; - } - - /* - * (non-Javadoc) - * - * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent) - * - * Reflesh the frame when selected item changed - * - */ - public void itemStateChanged(ItemEvent arg0) { - int index = this.jComboBoxCName.getSelectedIndex(); - if (arg0.getSource() == this.jComboBoxCName - && arg0.getStateChange() == ItemEvent.SELECTED) { - if (pcd.getPcd(index).getGuidCName() == null - || isEmpty(pcd.getPcd(index).getGuidCName()) - || pcd.getPcd(index).getType() == null - || pcd.getPcd(index).getHelp() == null - || isEmpty(pcd.getPcd(index).getHelp())) { - Log - .wrn("select pcd entry when editing msa", - "The selected is defined incorrectly.\r\nPlease check it in spd file"); - } else { - this.jTextFieldTokenSpaceGuid.setText(pcd.getPcd(index).getGuidCName()); - Tools.generateComboBoxByVector(this.jComboBoxItemType, pcd - .getPcd(index).getType()); - this.jTextAreaHelpText.setText(pcd.getPcd(index).getHelp()); - this.jTextAreaHelpText.setSelectionStart(0); - this.jTextAreaHelpText.setSelectionEnd(0); - } + /* + * (non-Javadoc) + * + * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent) + * + * Reflesh the frame when selected item changed + * + */ + public void itemStateChanged(ItemEvent arg0) { + int index = this.jComboBoxCName.getSelectedIndex(); + if (arg0.getSource() == this.jComboBoxCName && arg0.getStateChange() == ItemEvent.SELECTED) { + if (pcd.getPcd(index).getGuidCName() == null || isEmpty(pcd.getPcd(index).getGuidCName()) + || pcd.getPcd(index).getType() == null || pcd.getPcd(index).getHelp() == null + || isEmpty(pcd.getPcd(index).getHelp())) { + Log.wrn("select pcd entry when editing msa", + "The selected is defined incorrectly.\r\nPlease check it in spd file"); + } else { + this.jTextFieldTokenSpaceGuid.setText(pcd.getPcd(index).getGuidCName()); + Tools.generateComboBoxByVector(this.jComboBoxItemType, pcd.getPcd(index).getType()); + this.jTextAreaHelpText.setText(pcd.getPcd(index).getHelp()); + this.jTextAreaHelpText.setSelectionStart(0); + this.jTextAreaHelpText.setSelectionEnd(0); + } + } } - } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PackageDepDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PackageDepDlg.java index 15acd94f8c..ca1e5c8671 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PackageDepDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PackageDepDlg.java @@ -45,69 +45,67 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools; * */ public class PackageDepDlg extends IDialog implements ItemListener { - // / - // / Define class Serial Version UID - // / - private static final long serialVersionUID = 3465193035145152131L; + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = 3465193035145152131L; - // - // Define class members - // - private JPanel jContentPane = null; + // + // Define class members + // + private JPanel jContentPane = null; - private JLabel jLabelPackageName = null; + private JLabel jLabelPackageName = null; - private StarLabel jStarLabel1 = null; + private StarLabel jStarLabel1 = null; - private JComboBox jComboBoxPackageName = null; + private JComboBox jComboBoxPackageName = null; - private JLabel jLabelPackageGuid = null; + private JLabel jLabelPackageGuid = null; - private JTextField jTextFieldPackageGuid = null; + private JTextField jTextFieldPackageGuid = null; - private JButton jButtonGenerateGuid = null; + private JLabel jLabelPackageVersion = null; - private JLabel jLabelPackageVersion = null; + private JTextField jTextFieldPackageVersion = null; - private JTextField jTextFieldPackageVersion = null; + private JLabel jLabelFeatureFlag = null; - private JLabel jLabelFeatureFlag = null; + private JTextField jTextFieldFeatureFlag = null; - private JTextField jTextFieldFeatureFlag = null; + private JScrollPane jScrollPane = null; - private JScrollPane jScrollPane = null; + private JLabel jLabelArch = null; - private JLabel jLabelArch = null; + private ArchCheckBox jArchCheckBox = null; - private ArchCheckBox jArchCheckBox = null; + private JButton jButtonOk = null; - private JButton jButtonOk = null; + private JButton jButtonCancel = null; - private JButton jButtonCancel = null; + // + // Not used by UI + // + private PackageDependenciesIdentification pdid = null; - // - // Not used by UI - // - private PackageDependenciesIdentification pdid = null; + private WorkspaceTools wt = new WorkspaceTools(); - private WorkspaceTools wt = new WorkspaceTools(); + private Vector vPackage = wt.getAllPackages(); - private Vector vPackage = wt.getAllPackages(); - - /** - * This method initializes jComboBoxPackageName - * - * @return javax.swing.JComboBox - */ + /** + * This method initializes jComboBoxPackageName + * + * @return javax.swing.JComboBox + */ private JComboBox getJComboBoxPackageName() { - if (jComboBoxPackageName == null) { - jComboBoxPackageName = new JComboBox(); - jComboBoxPackageName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); - jComboBoxPackageName.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxPackageName.setToolTipText("If your Module requires a package list that here."); - jComboBoxPackageName.addItemListener(this); - } - return jComboBoxPackageName; + if (jComboBoxPackageName == null) { + jComboBoxPackageName = new JComboBox(); + jComboBoxPackageName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); + jComboBoxPackageName.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxPackageName.setToolTipText("If your Module requires a package list that here."); + jComboBoxPackageName.addItemListener(this); + } + return jComboBoxPackageName; } /** @@ -126,23 +124,6 @@ public class PackageDepDlg extends IDialog implements ItemListener { return jTextFieldPackageGuid; } - /** - * This method initializes jButtonGenerateGuid - * - * @return javax.swing.JButton - */ - private JButton getJButtonGenerateGuid() { - if (jButtonGenerateGuid == null) { - jButtonGenerateGuid = new JButton(); - jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 35, 65, 20)); - jButtonGenerateGuid.setPreferredSize(new java.awt.Dimension(65, 20)); - jButtonGenerateGuid.setText("GEN"); - jButtonGenerateGuid.addActionListener(this); - jButtonGenerateGuid.setVisible(false); - } - return jButtonGenerateGuid; - } - /** * This method initializes jTextFieldPackageVersion * @@ -154,7 +135,11 @@ public class PackageDepDlg extends IDialog implements ItemListener { jTextFieldPackageVersion.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); jTextFieldPackageVersion.setPreferredSize(new java.awt.Dimension(320, 20)); jTextFieldPackageVersion - .setToolTipText("If this module depends on a specific version of a package, enter the package version here. If the module can use the latest version that does not break backward compatibility, leave this field blank"); + .setToolTipText("If this module depends on a specific version of a package,
" + + "enter the package version here.
" + + "If the module can use the latest version
" + + "that does not break backward compatibility,
" + + "leave this field blank"); } return jTextFieldPackageVersion; } @@ -281,36 +266,36 @@ public class PackageDepDlg extends IDialog implements ItemListener { */ private JPanel getJContentPane() { if (jContentPane == null) { - jStarLabel1 = new StarLabel(); - jStarLabel1.setLocation(new java.awt.Point(2, 10)); - jLabelPackageName = new JLabel(); - jLabelPackageName.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); - jLabelPackageName.setText("Package Name"); - - jLabelPackageVersion = new JLabel(); - jLabelPackageVersion.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); - jLabelPackageVersion.setText("Package Version"); - - jLabelPackageGuid = new JLabel(); - jLabelPackageGuid.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); - jLabelPackageGuid.setText("Package Guid"); - jLabelPackageGuid.setVisible(false); - - jLabelFeatureFlag = new JLabel(); - jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); - jLabelFeatureFlag.setText("Feature Flag Expression"); - - jLabelArch = new JLabel(); - jLabelArch.setBounds(new java.awt.Rectangle(15, 85, 145, 20)); - jLabelArch.setText("Supported Architectures"); - jArchCheckBox = new ArchCheckBox(); - jArchCheckBox.setBounds(new java.awt.Rectangle(160, 85, 320, 20)); - jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); + jStarLabel1 = new StarLabel(); + jStarLabel1.setLocation(new java.awt.Point(2, 10)); + jLabelPackageName = new JLabel(); + jLabelPackageName.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); + jLabelPackageName.setText("Package Name"); + + jLabelPackageVersion = new JLabel(); + jLabelPackageVersion.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); + jLabelPackageVersion.setText("Package Version"); + + jLabelPackageGuid = new JLabel(); + jLabelPackageGuid.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); + jLabelPackageGuid.setText("Package Guid"); + jLabelPackageGuid.setVisible(false); + + jLabelFeatureFlag = new JLabel(); + jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); + jLabelFeatureFlag.setText("Feature Flag Expression"); + + jLabelArch = new JLabel(); + jLabelArch.setBounds(new java.awt.Rectangle(15, 85, 145, 20)); + jLabelArch.setText("Supported Architectures"); + jArchCheckBox = new ArchCheckBox(); + jArchCheckBox.setBounds(new java.awt.Rectangle(160, 85, 320, 20)); + jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); jContentPane = new JPanel(); jContentPane.setLayout(null); jContentPane.setPreferredSize(new java.awt.Dimension(485, 145)); - + jContentPane.add(jStarLabel1, null); jContentPane.add(jLabelPackageName, null); jContentPane.add(getJComboBoxPackageName(), null); @@ -378,12 +363,12 @@ public class PackageDepDlg extends IDialog implements ItemListener { // // Check PackageGuid // - // if (!isEmpty(this.jTextFieldPackageGuid.getText())) { -// if (!DataValidation.isGuid(this.jTextFieldPackageGuid.getText())) { -// Log.err("Incorrect data type for Package Guid"); -// return false; -// } -// } + // if (!isEmpty(this.jTextFieldPackageGuid.getText())) { + // if (!DataValidation.isGuid(this.jTextFieldPackageGuid.getText())) { + // Log.err("Incorrect data type for Package Guid"); + // return false; + // } + // } // // Check PackageVersion @@ -407,7 +392,6 @@ public class PackageDepDlg extends IDialog implements ItemListener { return true; } - private PackageDependenciesIdentification getCurrentPackageDependencies() { String arg0 = this.jComboBoxPackageName.getSelectedItem().toString(); diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java index feb38c82ca..1e937e0b3c 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java @@ -46,394 +46,391 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools; */ public class PpisDlg extends IDialog implements ItemListener { - // / - // / Define class Serial Version UID - // / - private static final long serialVersionUID = -4284901202357037724L; + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = -4284901202357037724L; - // - // Define class members - // - private JPanel jContentPane = null; - - private JLabel jLabelC_Name = null; - - private JComboBox jComboBoxCName = null; + // + // Define class members + // + private JPanel jContentPane = null; - private JTextField jTextFieldFeatureFlag = null; + private JLabel jLabelC_Name = null; - private JLabel jLabelFeatureFlag = null; + private JComboBox jComboBoxCName = null; - private JLabel jLabelUsage = null; + private JTextField jTextFieldFeatureFlag = null; - private JComboBox jComboBoxUsage = null; + private JLabel jLabelFeatureFlag = null; - private JLabel jLabelPpiType = null; + private JLabel jLabelUsage = null; - private StarLabel jStarLabel1 = null; + private JComboBox jComboBoxUsage = null; - private StarLabel jStarLabel2 = null; + private JLabel jLabelPpiType = null; - private StarLabel jStarLabel3 = null; + private StarLabel jStarLabel1 = null; - private JComboBox jComboBoxPpiType = null; + private StarLabel jStarLabel2 = null; - private JLabel jLabelArch = null; + private StarLabel jStarLabel3 = null; - private JScrollPane jScrollPane = null; + private JComboBox jComboBoxPpiType = null; - private JLabel jLabelHelpText = null; + private JLabel jLabelArch = null; - private JTextArea jTextAreaHelpText = null; + private JScrollPane jScrollPane = null; - private JScrollPane jScrollPaneHelpText = null; + private JLabel jLabelHelpText = null; - private ArchCheckBox jArchCheckBox = null; + private JTextArea jTextAreaHelpText = null; - private JButton jButtonOk = null; + private JScrollPane jScrollPaneHelpText = null; - private JButton jButtonCancel = null; + private ArchCheckBox jArchCheckBox = null; - // - // Not used by UI - // - private PpisIdentification id = null; + private JButton jButtonOk = null; - private WorkspaceTools wt = new WorkspaceTools(); + private JButton jButtonCancel = null; - private EnumerationData ed = new EnumerationData(); + // + // Not used by UI + // + private PpisIdentification id = null; + + private WorkspaceTools wt = new WorkspaceTools(); + + private EnumerationData ed = new EnumerationData(); + + /** + * This method initializes jComboBoxPpiType + * + * @return javax.swing.JComboBox + */ + private JComboBox getJComboBoxPpiType() { + if (jComboBoxPpiType == null) { + jComboBoxPpiType = new JComboBox(); + jComboBoxPpiType.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); + jComboBoxPpiType.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxPpiType.addItemListener(this); + jComboBoxPpiType + .setToolTipText("PPIs are named by GUID.
PPI Notify is consumed via a register PPI Notify mechanism"); + } + return jComboBoxPpiType; + } - /** - * This method initializes jComboBoxPpiType - * - * @return javax.swing.JComboBox - */ - private JComboBox getJComboBoxPpiType() { - if (jComboBoxPpiType == null) { - jComboBoxPpiType = new JComboBox(); - jComboBoxPpiType.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); - jComboBoxPpiType.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxPpiType.addItemListener(this); - jComboBoxPpiType.setToolTipText("PPIs are named by GUID.
PPI Notify is consumed via a register PPI Notify mechanism"); + /** + * This method initializes jTextFieldC_Name + * + * @return javax.swing.JTextField jTextFieldC_Name + * + */ + private JComboBox getJComboBoxCName() { + if (jComboBoxCName == null) { + jComboBoxCName = new JComboBox(); + jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); + jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxCName.setToolTipText("Select Guid C Name of PPI"); + } + return jComboBoxCName; } - return jComboBoxPpiType; - } - - /** - * This method initializes jTextFieldC_Name - * - * @return javax.swing.JTextField jTextFieldC_Name - * - */ - private JComboBox getJComboBoxCName() { - if (jComboBoxCName == null) { - jComboBoxCName = new JComboBox(); - jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); - jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxCName.setToolTipText("Select Guid C Name of PPI"); + + /** + * This method initializes jComboBoxUsage + * + * @return javax.swing.JComboBox jComboBoxUsage + * + */ + private JComboBox getJComboBoxUsage() { + if (jComboBoxUsage == null) { + jComboBoxUsage = new JComboBox(); + jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); + jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxUsage + .setToolTipText("
PPI
ALWAYS_CONSUMEDModule always consumes the PPI
SOMETIMES_CONSUMEDModule sometimes consumes the PPI
ALWAYS_PRODUCEDModule always produces the PPI
SOMETIMES_PRODUCEDModule sometimes produces the PPI
PPI Notify
SOMETIMES_CONSUMEDModule will consume the PPI if it is produced. Consumption
is defined by executing the PPI notify function
"); + } + return jComboBoxUsage; } - return jComboBoxCName; - } - - /** - * This method initializes jComboBoxUsage - * - * @return javax.swing.JComboBox jComboBoxUsage - * - */ - private JComboBox getJComboBoxUsage() { - if (jComboBoxUsage == null) { - jComboBoxUsage = new JComboBox(); - jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); - jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxUsage.setToolTipText("
PPI
ALWAYS_CONSUMEDModule always consumes the PPI
SOMETIMES_CONSUMEDModule sometimes consumes the PPI
ALWAYS_PRODUCEDModule always produces the PPI
SOMETIMES_PRODUCEDModule sometimes produces the PPI
PPI Notify
SOMETIMES_CONSUMEDModule will consume the PPI if it is produced. Consumption
is defined by executing the PPI notify function
"); + + /** + * This method initializes jTextFieldFeatureFlag + * + * @return javax.swing.JTextField jTextFieldFeatureFlag + * + */ + private JTextField getJTextFieldFeatureFlag() { + if (jTextFieldFeatureFlag == null) { + jTextFieldFeatureFlag = new JTextField(); + jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 130, 320, 20)); + jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + } + return jTextFieldFeatureFlag; } - return jComboBoxUsage; - } - - /** - * This method initializes jTextFieldFeatureFlag - * - * @return javax.swing.JTextField jTextFieldFeatureFlag - * - */ - private JTextField getJTextFieldFeatureFlag() { - if (jTextFieldFeatureFlag == null) { - jTextFieldFeatureFlag = new JTextField(); - jTextFieldFeatureFlag - .setBounds(new java.awt.Rectangle(160, 130, 320, 20)); - jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldFeatureFlag - .setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + + /** + * This method initializes jScrollPane + * + * @return javax.swing.JScrollPane + */ + private JScrollPane getJScrollPane() { + if (jScrollPane == null) { + jScrollPane = new JScrollPane(); + jScrollPane.setViewportView(getJContentPane()); + } + return jScrollPane; } - return jTextFieldFeatureFlag; - } - - /** - * This method initializes jScrollPane - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setViewportView(getJContentPane()); + + /** + * This method initializes jTextAreaHelpText + * + * @return javax.swing.JTextArea + * + */ + private JTextArea getJTextAreaHelpText() { + if (jTextAreaHelpText == null) { + jTextAreaHelpText = new JTextArea(); + jTextAreaHelpText.setLineWrap(true); + jTextAreaHelpText.setWrapStyleWord(true); + } + return jTextAreaHelpText; } - return jScrollPane; - } - - /** - * This method initializes jTextAreaHelpText - * - * @return javax.swing.JTextArea - * - */ - private JTextArea getJTextAreaHelpText() { - if (jTextAreaHelpText == null) { - jTextAreaHelpText = new JTextArea(); - jTextAreaHelpText.setLineWrap(true); - jTextAreaHelpText.setWrapStyleWord(true); + + /** + * This method initializes jScrollPaneHelpText + * + * @return javax.swing.JScrollPane + * + */ + private JScrollPane getJScrollPaneHelpText() { + if (jScrollPaneHelpText == null) { + jScrollPaneHelpText = new JScrollPane(); + jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setLocation(new java.awt.Point(160, 85)); + jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + } + return jScrollPaneHelpText; } - return jTextAreaHelpText; - } - - /** - * This method initializes jScrollPaneHelpText - * - * @return javax.swing.JScrollPane - * - */ - private JScrollPane getJScrollPaneHelpText() { - if (jScrollPaneHelpText == null) { - jScrollPaneHelpText = new JScrollPane(); - jScrollPaneHelpText - .setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); - jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); - jScrollPaneHelpText.setLocation(new java.awt.Point(160, 85)); - jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + + /** + * This method initializes jButtonOk + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonOk() { + if (jButtonOk == null) { + jButtonOk = new JButton(); + jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20)); + jButtonOk.setText("Ok"); + jButtonOk.addActionListener(this); + } + return jButtonOk; } - return jScrollPaneHelpText; - } - - /** - * This method initializes jButtonOk - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20)); - jButtonOk.setText("Ok"); - jButtonOk.addActionListener(this); + + /** + * This method initializes jButtonCancel + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonCancel() { + if (jButtonCancel == null) { + jButtonCancel = new JButton(); + jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20)); + jButtonCancel.setText("Cancel"); + jButtonCancel.addActionListener(this); + } + return jButtonCancel; } - return jButtonOk; - } - - /** - * This method initializes jButtonCancel - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20)); - jButtonCancel.setText("Cancel"); - jButtonCancel.addActionListener(this); + + public static void main(String[] args) { + } - return jButtonCancel; - } - - public static void main(String[] args) { - - } - - /** - * This method initializes this - * - */ - private void init() { - this.setSize(500, 255); - this.setContentPane(getJScrollPane()); - this.setTitle("PPI Definitions"); - initFrame(); - this.centerWindow(); - } - - /** - * This method initializes this Fill values to all fields if these values are - * not empty - * - * @param inProtocolsId - * - */ - private void init(PpisIdentification inPpisId) { - init(); - this.id = inPpisId; - - if (this.id != null) { - this.jComboBoxCName.setSelectedItem(id.getName()); - this.jComboBoxPpiType.setSelectedItem(id.getType()); - this.jComboBoxUsage.setSelectedItem(id.getUsage()); - this.jTextAreaHelpText.setText(id.getHelp()); - this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); - this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + + /** + * This method initializes this + * + */ + private void init() { + this.setSize(500, 255); + this.setContentPane(getJScrollPane()); + this.setTitle("PPI Definitions"); + initFrame(); + this.centerWindow(); } - } - - /** - * This is the override edit constructor - * - * @param inProtocolsIdentification - * @param iFrame - * - */ - public PpisDlg(PpisIdentification inPpisIdentification, IFrame iFrame) { - super(iFrame, true); - init(inPpisIdentification); - } - - /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel jContentPane - * - */ - private JPanel getJContentPane() { - if (jContentPane == null) { - jStarLabel1 = new StarLabel(); - jStarLabel1.setLocation(new java.awt.Point(2, 10)); - jLabelPpiType = new JLabel(); - jLabelPpiType.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); - jLabelPpiType.setText("Select Ppi Type"); - - jStarLabel2 = new StarLabel(); - jStarLabel2.setLocation(new java.awt.Point(2, 35)); - jLabelC_Name = new JLabel(); - jLabelC_Name.setText("PPI GUID C Name"); - jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); - - jStarLabel3 = new StarLabel(); - jStarLabel3.setLocation(new java.awt.Point(2, 60)); - jLabelUsage = new JLabel(); - jLabelUsage.setText("Usage"); - jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); - - jLabelHelpText = new JLabel(); - jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 145, 20)); - jLabelHelpText.setText("Help Text"); - - jLabelFeatureFlag = new JLabel(); - jLabelFeatureFlag.setText("Feature Flag Expression"); - jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); - - jLabelArch = new JLabel(); - jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20)); - jLabelArch.setText("Supported Architectures"); - jArchCheckBox = new ArchCheckBox(); - jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20)); - jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); - - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.setPreferredSize(new java.awt.Dimension(485, 210)); - - jContentPane.add(jStarLabel1, null); - jContentPane.add(jLabelPpiType, null); - jContentPane.add(getJComboBoxPpiType(), null); - jContentPane.add(jStarLabel2, null); - jContentPane.add(jLabelC_Name, null); - jContentPane.add(getJComboBoxCName(), null); - jContentPane.add(jStarLabel3, null); - jContentPane.add(jLabelUsage, null); - jContentPane.add(getJComboBoxUsage(), null); - jContentPane.add(jLabelHelpText, null); - jContentPane.add(getJScrollPaneHelpText(), null); - jContentPane.add(jLabelFeatureFlag, null); - jContentPane.add(getJTextFieldFeatureFlag(), null); - jContentPane.add(jLabelArch, null); - jContentPane.add(jArchCheckBox, null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); + + /** + * This method initializes this Fill values to all fields if these values are + * not empty + * + * @param inProtocolsId + * + */ + private void init(PpisIdentification inPpisId) { + init(); + this.id = inPpisId; + + if (this.id != null) { + this.jComboBoxCName.setSelectedItem(id.getName()); + this.jComboBoxPpiType.setSelectedItem(id.getType()); + this.jComboBoxUsage.setSelectedItem(id.getUsage()); + this.jTextAreaHelpText.setText(id.getHelp()); + this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); + this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + } } - return jContentPane; - } - - /** - * This method initializes Usage type - * - */ - private void initFrame() { - Tools.generateComboBoxByVector(jComboBoxCName, wt - .getAllPpiDeclarationsFromWorkspace()); - Tools.generateComboBoxByVector(jComboBoxPpiType, ed.getVPpiType()); - Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage()); - } - - /* - * (non-Javadoc) - * - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - * - * Override actionPerformed to listen all actions - * - */ - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - if (checkAdd()) { - getCurrentPpis(); - this.returnType = DataType.RETURN_TYPE_OK; - this.setVisible(false); - } + + /** + * This is the override edit constructor + * + * @param inProtocolsIdentification + * @param iFrame + * + */ + public PpisDlg(PpisIdentification inPpisIdentification, IFrame iFrame) { + super(iFrame, true); + init(inPpisIdentification); } - if (arg0.getSource() == jButtonCancel) { - this.returnType = DataType.RETURN_TYPE_CANCEL; - this.setVisible(false); + /** + * This method initializes jContentPane + * + * @return javax.swing.JPanel jContentPane + * + */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jStarLabel1 = new StarLabel(); + jStarLabel1.setLocation(new java.awt.Point(2, 10)); + jLabelPpiType = new JLabel(); + jLabelPpiType.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); + jLabelPpiType.setText("Select Ppi Type"); + + jStarLabel2 = new StarLabel(); + jStarLabel2.setLocation(new java.awt.Point(2, 35)); + jLabelC_Name = new JLabel(); + jLabelC_Name.setText("PPI GUID C Name"); + jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); + + jStarLabel3 = new StarLabel(); + jStarLabel3.setLocation(new java.awt.Point(2, 60)); + jLabelUsage = new JLabel(); + jLabelUsage.setText("Usage"); + jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); + + jLabelHelpText = new JLabel(); + jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 145, 20)); + jLabelHelpText.setText("Help Text"); + + jLabelFeatureFlag = new JLabel(); + jLabelFeatureFlag.setText("Feature Flag Expression"); + jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); + + jLabelArch = new JLabel(); + jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20)); + jLabelArch.setText("Supported Architectures"); + jArchCheckBox = new ArchCheckBox(); + jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20)); + jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); + + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.setPreferredSize(new java.awt.Dimension(485, 210)); + + jContentPane.add(jStarLabel1, null); + jContentPane.add(jLabelPpiType, null); + jContentPane.add(getJComboBoxPpiType(), null); + jContentPane.add(jStarLabel2, null); + jContentPane.add(jLabelC_Name, null); + jContentPane.add(getJComboBoxCName(), null); + jContentPane.add(jStarLabel3, null); + jContentPane.add(jLabelUsage, null); + jContentPane.add(getJComboBoxUsage(), null); + jContentPane.add(jLabelHelpText, null); + jContentPane.add(getJScrollPaneHelpText(), null); + jContentPane.add(jLabelFeatureFlag, null); + jContentPane.add(getJTextFieldFeatureFlag(), null); + jContentPane.add(jLabelArch, null); + jContentPane.add(jArchCheckBox, null); + jContentPane.add(getJButtonOk(), null); + jContentPane.add(getJButtonCancel(), null); + } + return jContentPane; } - } - - /** - * Data validation for all fields - * - * @retval true - All datas are valid - * @retval false - At least one data is invalid - * - */ - public boolean checkAdd() { - // - // Check if all fields have correct data types - // - // - // Check Name - // - if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) { - if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem() - .toString())) { - Log.wrn("Update Ppis", "Incorrect data type for Ppi/PpiNotify Name"); - return false; - } + /** + * This method initializes Usage type + * + */ + private void initFrame() { + Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllPpiDeclarationsFromWorkspace()); + Tools.generateComboBoxByVector(jComboBoxPpiType, ed.getVPpiType()); + Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage()); } - // - // Check FeatureFlag - // - if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { - if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { - Log.wrn("Update Ppis", "Incorrect data type for Feature Flag"); - return false; - } + /* + * (non-Javadoc) + * + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + * + * Override actionPerformed to listen all actions + * + */ + public void actionPerformed(ActionEvent arg0) { + if (arg0.getSource() == jButtonOk) { + if (checkAdd()) { + getCurrentPpis(); + this.returnType = DataType.RETURN_TYPE_OK; + this.setVisible(false); + } + } + + if (arg0.getSource() == jButtonCancel) { + this.returnType = DataType.RETURN_TYPE_CANCEL; + this.setVisible(false); + } } - return true; - } + /** + * Data validation for all fields + * + * @retval true - All datas are valid + * @retval false - At least one data is invalid + * + */ + public boolean checkAdd() { + // + // Check if all fields have correct data types + // + + // + // Check Name + // + if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) { + if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) { + Log.wrn("Update Ppis", "Incorrect data type for Ppi/PpiNotify Name"); + return false; + } + } + + // + // Check FeatureFlag + // + if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { + if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { + Log.wrn("Update Ppis", "Incorrect data type for Feature Flag"); + return false; + } + } + + return true; + } -private PpisIdentification getCurrentPpis() { + private PpisIdentification getCurrentPpis() { String arg0 = this.jComboBoxCName.getSelectedItem().toString(); String arg1 = this.jComboBoxPpiType.getSelectedItem().toString(); String arg2 = this.jComboBoxUsage.getSelectedItem().toString(); @@ -444,32 +441,30 @@ private PpisIdentification getCurrentPpis() { id = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5); return id; - } /* - * (non-Javadoc) - * - * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent) - * - * Reflesh the frame when selected item changed - * - */ - public void itemStateChanged(ItemEvent arg0) { - if (arg0.getSource() == this.jComboBoxPpiType - && arg0.getStateChange() == ItemEvent.SELECTED) { - if (this.jComboBoxPpiType.getSelectedItem().toString().equals( - ed.getVPpiType().get(0))) { - Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVPpiUsage()); - } else { - Tools.generateComboBoxByVector(this.jComboBoxUsage, ed - .getVPpiNotifyUsage()); - } + } /* + * (non-Javadoc) + * + * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent) + * + * Reflesh the frame when selected item changed + * + */ + + public void itemStateChanged(ItemEvent arg0) { + if (arg0.getSource() == this.jComboBoxPpiType && arg0.getStateChange() == ItemEvent.SELECTED) { + if (this.jComboBoxPpiType.getSelectedItem().toString().equals(ed.getVPpiType().get(0))) { + Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVPpiUsage()); + } else { + Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVPpiNotifyUsage()); + } + } } - } - public PpisIdentification getId() { - return id; - } + public PpisIdentification getId() { + return id; + } - public void setId(PpisIdentification id) { - this.id = id; - } + public void setId(PpisIdentification id) { + this.id = id; + } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java index 8b303dee0d..894955188c 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java @@ -48,461 +48,449 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools; */ public class ProtocolsDlg extends IDialog implements ItemListener { - // / - // / Define class Serial Version UID - // / - private static final long serialVersionUID = -9084913640747858848L; + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = -9084913640747858848L; - // - // Define class members - // - private JPanel jContentPane = null; + // + // Define class members + // + private JPanel jContentPane = null; - private JLabel jLabelC_Name = null; + private JLabel jLabelC_Name = null; - private JLabel jLabelFeatureFlag = null; + private JLabel jLabelFeatureFlag = null; - private JTextField jTextFieldFeatureFlag = null; + private JTextField jTextFieldFeatureFlag = null; - private JLabel jLabelUsage = null; + private JLabel jLabelUsage = null; - private JComboBox jComboBoxUsage = null; + private JComboBox jComboBoxUsage = null; - private StarLabel jStarLabel1 = null; + private StarLabel jStarLabel1 = null; - private StarLabel jStarLabel2 = null; + private StarLabel jStarLabel2 = null; - private StarLabel jStarLabel3 = null; + private StarLabel jStarLabel3 = null; - private JLabel jLabelProtocolType = null; + private JLabel jLabelProtocolType = null; - private JLabel jLabelArch = null; + private JLabel jLabelArch = null; - private JScrollPane jScrollPane = null; + private JScrollPane jScrollPane = null; - private JComboBox jComboBoxProtocolType = null; + private JComboBox jComboBoxProtocolType = null; - private JComboBox jComboBoxCName = null; + private JComboBox jComboBoxCName = null; - private JLabel jLabelHelpText = null; + private JLabel jLabelHelpText = null; - private JTextArea jTextAreaHelpText = null; + private JTextArea jTextAreaHelpText = null; - private JScrollPane jScrollPaneHelpText = null; + private JScrollPane jScrollPaneHelpText = null; - private ArchCheckBox jArchCheckBox = null; + private ArchCheckBox jArchCheckBox = null; - private JButton jButtonOk = null; + private JButton jButtonOk = null; - private JButton jButtonCancel = null; + private JButton jButtonCancel = null; - // - // Not used by UI - // - private ProtocolsIdentification id = null; + // + // Not used by UI + // + private ProtocolsIdentification id = null; + + private WorkspaceTools wt = new WorkspaceTools(); + + private EnumerationData ed = new EnumerationData(); + + /** + * This method initializes jTextFieldFeatureFlag + * + * @return javax.swing.JTextField jTextFieldFeatureFlag + * + */ + private JTextField getJTextFieldFeatureFlag() { + if (jTextFieldFeatureFlag == null) { + jTextFieldFeatureFlag = new JTextField(); + jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 130, 320, 20)); + jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + } + return jTextFieldFeatureFlag; + } - private WorkspaceTools wt = new WorkspaceTools(); + /** + * This method initializes jComboBoxUsage + * + * @return javax.swing.JComboBox jComboBoxUsage + * + */ + private JComboBox getJComboBoxProtocolUsage() { + if (jComboBoxUsage == null) { + jComboBoxUsage = new JComboBox(); + jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); + jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxUsage + .setToolTipText("" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "
Protocol
ALWAYS_CONSUMEDModule always consumes the protocol
SOMETIMES_CONSUMESModule sometimes consumes the protocol
ALWAYS_PRODUCEDModule always produces the protocol
SOMETIMES_PRODUCEDModule sometimes produces the protocol
TO_STARTThe protocol is consumed by a Driver Binding protocol Start
function. The protocol is used in EFI 1.10 driver model
BY_STARTProtocol is produced by a Driver Binding protocol Start
function. The protocol is used in EFI 1.10 driver model
Protocol Notify
SOMETIMES_CONSUMEDModule will consume the protocol if it is produced.
Consumption is defined by executing the protocol notify
function.
"); + } + return jComboBoxUsage; + } - private EnumerationData ed = new EnumerationData(); + /** + * This method initializes jScrollPane + * + * @return javax.swing.JScrollPane + */ + private JScrollPane getJScrollPane() { + if (jScrollPane == null) { + jScrollPane = new JScrollPane(); + jScrollPane.setViewportView(getJContentPane()); + } + return jScrollPane; + } - /** - * This method initializes jTextFieldFeatureFlag - * - * @return javax.swing.JTextField jTextFieldFeatureFlag - * - */ - private JTextField getJTextFieldFeatureFlag() { - if (jTextFieldFeatureFlag == null) { - jTextFieldFeatureFlag = new JTextField(); - jTextFieldFeatureFlag - .setBounds(new java.awt.Rectangle(160, 130, 320, 20)); - jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldFeatureFlag - .setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + /** + * This method initializes jComboBoxProtocolType + * + * @return javax.swing.JComboBox + */ + private JComboBox getJComboBoxProtocolType() { + if (jComboBoxProtocolType == null) { + jComboBoxProtocolType = new JComboBox(); + jComboBoxProtocolType.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); + jComboBoxProtocolType.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxProtocolType.addItemListener(this); + jComboBoxProtocolType + .setToolTipText("Select Protocol Type
Protocol Notify is a register protocol notify mechanism."); + } + return jComboBoxProtocolType; } - return jTextFieldFeatureFlag; - } - - /** - * This method initializes jComboBoxUsage - * - * @return javax.swing.JComboBox jComboBoxUsage - * - */ - private JComboBox getJComboBoxProtocolUsage() { - if (jComboBoxUsage == null) { - jComboBoxUsage = new JComboBox(); - jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); - jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxUsage - .setToolTipText("" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "
Protocol
ALWAYS_CONSUMEDModule always consumes the protocol
SOMETIMES_CONSUMESModule sometimes consumes the protocol
ALWAYS_PRODUCEDModule always produces the protocol
SOMETIMES_PRODUCEDModule sometimes produces the protocol
TO_STARTThe protocol is consumed by a Driver Binding protocol Start
function. The protocol is used in EFI 1.10 driver model
BY_STARTProtocol is produced by a Driver Binding protocol Start
function. The protocol is used in EFI 1.10 driver model
Protocol Notify
SOMETIMES_CONSUMEDModule will consume the protocol if it is produced.
Consumption is defined by executing the protocol notify
function.
"); + + /** + * This method initializes jComboBoxCName + * + * @return javax.swing.JComboBox + */ + private JComboBox getJComboBoxCName() { + if (jComboBoxCName == null) { + jComboBoxCName = new JComboBox(); + jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); + jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxCName.setToolTipText("Select Guid C Name of the Protocol"); + + } + return jComboBoxCName; } - return jComboBoxUsage; - } - - /** - * This method initializes jScrollPane - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setViewportView(getJContentPane()); + + /** + * This method initializes jTextAreaHelpText + * + * @return javax.swing.JTextArea + * + */ + private JTextArea getJTextAreaHelpText() { + if (jTextAreaHelpText == null) { + jTextAreaHelpText = new JTextArea(); + jTextAreaHelpText.setLineWrap(true); + jTextAreaHelpText.setWrapStyleWord(true); + } + return jTextAreaHelpText; } - return jScrollPane; - } - - /** - * This method initializes jComboBoxProtocolType - * - * @return javax.swing.JComboBox - */ - private JComboBox getJComboBoxProtocolType() { - if (jComboBoxProtocolType == null) { - jComboBoxProtocolType = new JComboBox(); - jComboBoxProtocolType.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); - jComboBoxProtocolType.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxProtocolType.addItemListener(this); - jComboBoxProtocolType - .setToolTipText("Select Protocol Type
Protocol Notify is a register protocol notify mechanism."); + + /** + * This method initializes jScrollPaneHelpText + * + * @return javax.swing.JScrollPane + * + */ + private JScrollPane getJScrollPaneHelpText() { + if (jScrollPaneHelpText == null) { + jScrollPaneHelpText = new JScrollPane(); + jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setLocation(new java.awt.Point(160, 85)); + jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + } + return jScrollPaneHelpText; } - return jComboBoxProtocolType; - } - - /** - * This method initializes jComboBoxCName - * - * @return javax.swing.JComboBox - */ - private JComboBox getJComboBoxCName() { - if (jComboBoxCName == null) { - jComboBoxCName = new JComboBox(); - jComboBoxCName.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); - jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxCName.setToolTipText("Select Guid C Name of the Protocol"); + /** + * This method initializes jButtonOk + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonOk() { + if (jButtonOk == null) { + jButtonOk = new JButton(); + jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20)); + jButtonOk.setText("Ok"); + jButtonOk.addActionListener(this); + } + return jButtonOk; } - return jComboBoxCName; - } - - /** - * This method initializes jTextAreaHelpText - * - * @return javax.swing.JTextArea - * - */ - private JTextArea getJTextAreaHelpText() { - if (jTextAreaHelpText == null) { - jTextAreaHelpText = new JTextArea(); - jTextAreaHelpText.setLineWrap(true); - jTextAreaHelpText.setWrapStyleWord(true); + + /** + * This method initializes jButtonCancel + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonCancel() { + if (jButtonCancel == null) { + jButtonCancel = new JButton(); + jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20)); + jButtonCancel.setText("Cancel"); + jButtonCancel.addActionListener(this); + } + return jButtonCancel; } - return jTextAreaHelpText; - } - - /** - * This method initializes jScrollPaneHelpText - * - * @return javax.swing.JScrollPane - * - */ - private JScrollPane getJScrollPaneHelpText() { - if (jScrollPaneHelpText == null) { - jScrollPaneHelpText = new JScrollPane(); - jScrollPaneHelpText - .setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); - jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); - jScrollPaneHelpText.setLocation(new java.awt.Point(160, 85)); - jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + + public static void main(String[] args) { + } - return jScrollPaneHelpText; - } - - /** - * This method initializes jButtonOk - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20)); - jButtonOk.setText("Ok"); - jButtonOk.addActionListener(this); + + /** + * This method initializes this + * + */ + private void init() { + this.setSize(500, 255); + this.setContentPane(getJScrollPane()); + this.setTitle("Protocols"); + initFrame(); + this.setViewMode(false); + this.centerWindow(); } - return jButtonOk; - } - - /** - * This method initializes jButtonCancel - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20)); - jButtonCancel.setText("Cancel"); - jButtonCancel.addActionListener(this); + + /** + * This method initializes this Fill values to all fields if these values are + * not empty + * + * @param inProtocolsId + * + */ + private void init(ProtocolsIdentification inProtocolsId) { + init(); + this.id = inProtocolsId; + + if (this.id != null) { + this.jComboBoxCName.setSelectedItem(id.getName()); + this.jComboBoxProtocolType.setSelectedItem(id.getType()); + this.jComboBoxUsage.setSelectedItem(id.getUsage()); + this.jTextAreaHelpText.setText(id.getHelp()); + this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); + this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + } } - return jButtonCancel; - } - - public static void main(String[] args) { - - } - - /** - * This method initializes this - * - */ - private void init() { - this.setSize(500, 255); - this.setContentPane(getJScrollPane()); - this.setTitle("Protocols"); - initFrame(); - this.setViewMode(false); - this.centerWindow(); - } - - /** - * This method initializes this Fill values to all fields if these values are - * not empty - * - * @param inProtocolsId - * - */ - private void init(ProtocolsIdentification inProtocolsId) { - init(); - this.id = inProtocolsId; - - if (this.id != null) { - this.jComboBoxCName.setSelectedItem(id.getName()); - this.jComboBoxProtocolType.setSelectedItem(id.getType()); - this.jComboBoxUsage.setSelectedItem(id.getUsage()); - this.jTextAreaHelpText.setText(id.getHelp()); - this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); - this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + + /** + * This is the override edit constructor + * + * @param inProtocolsIdentification + * @param iFrame + * + */ + public ProtocolsDlg(ProtocolsIdentification inProtocolsIdentification, IFrame iFrame) { + super(iFrame, true); + init(inProtocolsIdentification); } - } - - /** - * This is the override edit constructor - * - * @param inProtocolsIdentification - * @param iFrame - * - */ - public ProtocolsDlg(ProtocolsIdentification inProtocolsIdentification, - IFrame iFrame) { - super(iFrame, true); - init(inProtocolsIdentification); - } - - /** - * Disable all components when the mode is view - * - * @param isView - * true - The view mode; false - The non-view mode - * - */ - public void setViewMode(boolean isView) { - if (isView) { - this.jComboBoxUsage.setEnabled(!isView); - this.jTextFieldFeatureFlag.setEnabled(!isView); + + /** + * Disable all components when the mode is view + * + * @param isView + * true - The view mode; false - The non-view mode + * + */ + public void setViewMode(boolean isView) { + if (isView) { + this.jComboBoxUsage.setEnabled(!isView); + this.jTextFieldFeatureFlag.setEnabled(!isView); + } } - } - - /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel jContentPane - * - */ - private JPanel getJContentPane() { - if (jContentPane == null) { - jStarLabel1 = new StarLabel(); - jStarLabel1.setLocation(new java.awt.Point(2, 10)); - jLabelProtocolType = new JLabel(); - jLabelProtocolType.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); - jLabelProtocolType.setText("Select Protocol Type"); - - jStarLabel2 = new StarLabel(); - jStarLabel2.setLocation(new java.awt.Point(2, 35)); - jLabelC_Name = new JLabel(); - jLabelC_Name.setText("Protocol Guid C Name"); - jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); - - jStarLabel3 = new StarLabel(); - jStarLabel3.setLocation(new java.awt.Point(2, 60)); - jLabelUsage = new JLabel(); - jLabelUsage.setText("Usage"); - jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); - - jLabelHelpText = new JLabel(); - jLabelHelpText.setBounds(new java.awt.Rectangle(15, 85, 145, 20)); - jLabelHelpText.setText("Help Text"); - - jLabelFeatureFlag = new JLabel(); - jLabelFeatureFlag.setText("Feature Flag Expression"); - jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); - - jLabelArch = new JLabel(); - jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20)); - jLabelArch.setText("Supported Architectures"); - jArchCheckBox = new ArchCheckBox(); - jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20)); - jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); - - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.setPreferredSize(new java.awt.Dimension(485, 210)); - - jContentPane.add(jStarLabel1, null); - jContentPane.add(jLabelProtocolType, null); - jContentPane.add(getJComboBoxProtocolType(), null); - jContentPane.add(jStarLabel2, null); - jContentPane.add(jLabelC_Name, null); - jContentPane.add(getJComboBoxCName(), null); - jContentPane.add(jStarLabel3, null); - jContentPane.add(jLabelUsage, null); - jContentPane.add(getJComboBoxProtocolUsage(), null); - jContentPane.add(jLabelHelpText, null); - jContentPane.add(getJScrollPaneHelpText(), null); - jContentPane.add(jLabelFeatureFlag, null); - jContentPane.add(getJTextFieldFeatureFlag(), null); - jContentPane.add(jLabelArch, null); - jContentPane.add(jArchCheckBox, null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); + + /** + * This method initializes jContentPane + * + * @return javax.swing.JPanel jContentPane + * + */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jStarLabel1 = new StarLabel(); + jStarLabel1.setLocation(new java.awt.Point(2, 10)); + jLabelProtocolType = new JLabel(); + jLabelProtocolType.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); + jLabelProtocolType.setText("Select Protocol Type"); + + jStarLabel2 = new StarLabel(); + jStarLabel2.setLocation(new java.awt.Point(2, 35)); + jLabelC_Name = new JLabel(); + jLabelC_Name.setText("Protocol Guid C Name"); + jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); + + jStarLabel3 = new StarLabel(); + jStarLabel3.setLocation(new java.awt.Point(2, 60)); + jLabelUsage = new JLabel(); + jLabelUsage.setText("Usage"); + jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); + + jLabelHelpText = new JLabel(); + jLabelHelpText.setBounds(new java.awt.Rectangle(15, 85, 145, 20)); + jLabelHelpText.setText("Help Text"); + + jLabelFeatureFlag = new JLabel(); + jLabelFeatureFlag.setText("Feature Flag Expression"); + jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); + + jLabelArch = new JLabel(); + jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20)); + jLabelArch.setText("Supported Architectures"); + jArchCheckBox = new ArchCheckBox(); + jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20)); + jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); + + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.setPreferredSize(new java.awt.Dimension(485, 210)); + + jContentPane.add(jStarLabel1, null); + jContentPane.add(jLabelProtocolType, null); + jContentPane.add(getJComboBoxProtocolType(), null); + jContentPane.add(jStarLabel2, null); + jContentPane.add(jLabelC_Name, null); + jContentPane.add(getJComboBoxCName(), null); + jContentPane.add(jStarLabel3, null); + jContentPane.add(jLabelUsage, null); + jContentPane.add(getJComboBoxProtocolUsage(), null); + jContentPane.add(jLabelHelpText, null); + jContentPane.add(getJScrollPaneHelpText(), null); + jContentPane.add(jLabelFeatureFlag, null); + jContentPane.add(getJTextFieldFeatureFlag(), null); + jContentPane.add(jLabelArch, null); + jContentPane.add(jArchCheckBox, null); + jContentPane.add(getJButtonOk(), null); + jContentPane.add(getJButtonCancel(), null); + } + return jContentPane; } - return jContentPane; - } - - /** - * This method initializes Usage type - * - */ - private void initFrame() { - Tools - .generateComboBoxByVector(jComboBoxProtocolType, ed.getVProtocolType()); - Tools.generateComboBoxByVector(jComboBoxCName, wt - .getAllProtocolDeclarationsFromWorkspace()); - Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVProtocolUsage()); - } - - /* - * (non-Javadoc) - * - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - * - * Override actionPerformed to listen all actions - * - */ - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - if (checkAdd()) { - getCurrentProtocols(); - this.returnType = DataType.RETURN_TYPE_OK; - this.setVisible(false); - } + + /** + * This method initializes Usage type + * + */ + private void initFrame() { + Tools.generateComboBoxByVector(jComboBoxProtocolType, ed.getVProtocolType()); + Tools.generateComboBoxByVector(jComboBoxCName, wt.getAllProtocolDeclarationsFromWorkspace()); + Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVProtocolUsage()); } - if (arg0.getSource() == jButtonCancel) { - this.returnType = DataType.RETURN_TYPE_CANCEL; - this.setVisible(false); + /* + * (non-Javadoc) + * + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + * + * Override actionPerformed to listen all actions + * + */ + public void actionPerformed(ActionEvent arg0) { + if (arg0.getSource() == jButtonOk) { + if (checkAdd()) { + getCurrentProtocols(); + this.returnType = DataType.RETURN_TYPE_OK; + this.setVisible(false); + } + } + + if (arg0.getSource() == jButtonCancel) { + this.returnType = DataType.RETURN_TYPE_CANCEL; + this.setVisible(false); + } } - } - - /** - * Data validation for all fields - * - * @retval true - All datas are valid - * @retval false - At least one data is invalid - * - */ - public boolean checkAdd() { - // - // Check if all fields have correct data types - // - // - // Check Name - // - if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) { - if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem() - .toString())) { - Log.wrn("Update Protocols", - "Incorrect data type for Protocol/ProtocolNotify Name"); - return false; - } + /** + * Data validation for all fields + * + * @retval true - All datas are valid + * @retval false - At least one data is invalid + * + */ + public boolean checkAdd() { + // + // Check if all fields have correct data types + // + + // + // Check Name + // + if (!isEmpty(this.jComboBoxCName.getSelectedItem().toString())) { + if (!DataValidation.isC_NameType(this.jComboBoxCName.getSelectedItem().toString())) { + Log.wrn("Update Protocols", "Incorrect data type for Protocol/ProtocolNotify Name"); + return false; + } + } + + // + // Check FeatureFlag + // + if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { + if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { + Log.wrn("Update Protocols", "Incorrect data type for Feature Flag"); + return false; + } + } + + return true; } - // - // Check FeatureFlag - // - if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { - if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { - Log.wrn("Update Protocols", "Incorrect data type for Feature Flag"); - return false; - } + private ProtocolsIdentification getCurrentProtocols() { + String arg0 = this.jComboBoxCName.getSelectedItem().toString(); + String arg1 = this.jComboBoxProtocolType.getSelectedItem().toString(); + String arg2 = this.jComboBoxUsage.getSelectedItem().toString(); + + String arg3 = this.jTextFieldFeatureFlag.getText(); + Vector arg4 = this.jArchCheckBox.getSelectedItemsVector(); + String arg5 = this.jTextAreaHelpText.getText(); + id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5); + return id; } - return true; - } - - private ProtocolsIdentification getCurrentProtocols() { - String arg0 = this.jComboBoxCName.getSelectedItem().toString(); - String arg1 = this.jComboBoxProtocolType.getSelectedItem().toString(); - String arg2 = this.jComboBoxUsage.getSelectedItem().toString(); - - String arg3 = this.jTextFieldFeatureFlag.getText(); - Vector arg4 = this.jArchCheckBox.getSelectedItemsVector(); - String arg5 = this.jTextAreaHelpText.getText(); - id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5); - return id; - } - - /* - * (non-Javadoc) - * - * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent) - * - * Reflesh the frame when selected item changed - * - */ - - public void itemStateChanged(ItemEvent arg0) { - if (arg0.getSource() == this.jComboBoxProtocolType - && arg0.getStateChange() == ItemEvent.SELECTED) { - if (this.jComboBoxProtocolType.getSelectedItem().toString().equals( - ed.getVProtocolType().get(0))) { - Tools.generateComboBoxByVector(this.jComboBoxUsage, ed - .getVProtocolUsage()); - } else { - Tools.generateComboBoxByVector(this.jComboBoxUsage, ed - .getVProtocolNotifyUsage()); - } + /* + * (non-Javadoc) + * + * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent) + * + * Reflesh the frame when selected item changed + * + */ + + public void itemStateChanged(ItemEvent arg0) { + if (arg0.getSource() == this.jComboBoxProtocolType && arg0.getStateChange() == ItemEvent.SELECTED) { + if (this.jComboBoxProtocolType.getSelectedItem().toString().equals(ed.getVProtocolType().get(0))) { + Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVProtocolUsage()); + } else { + Tools.generateComboBoxByVector(this.jComboBoxUsage, ed.getVProtocolNotifyUsage()); + } + } } - } - public ProtocolsIdentification getId() { - return id; - } + public ProtocolsIdentification getId() { + return id; + } - public void setId(ProtocolsIdentification id) { - this.id = id; - } + public void setId(ProtocolsIdentification id) { + this.id = id; + } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java index f5c321df8e..062d637384 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java @@ -27,9 +27,11 @@ import javax.swing.JTextField; import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.DataValidation; +import org.tianocore.frameworkwizard.common.EnumerationData; import org.tianocore.frameworkwizard.common.Log; import org.tianocore.frameworkwizard.common.Tools; import org.tianocore.frameworkwizard.common.ui.ArchCheckBox; +import org.tianocore.frameworkwizard.common.ui.IComboBox; import org.tianocore.frameworkwizard.common.ui.IDialog; import org.tianocore.frameworkwizard.common.ui.IFrame; import org.tianocore.frameworkwizard.common.ui.StarLabel; @@ -76,6 +78,8 @@ public class SourceFilesDlg extends IDialog { private JTextField jTextFieldToolCode = null; + private IComboBox iComboBoxToolCode = null; + private JTextField jTextFieldToolChainFamily = null; private JLabel jLabelFeatureFlag = null; @@ -83,7 +87,7 @@ public class SourceFilesDlg extends IDialog { private JTextField jTextFieldFeatureFlag = null; private ArchCheckBox jArchCheckBox = null; - + private JButton jButtonOk = null; private JButton jButtonCancel = null; @@ -95,6 +99,8 @@ public class SourceFilesDlg extends IDialog { private String msaFileName = ""; + private EnumerationData ed = new EnumerationData(); + /** This method initializes jTextFieldFileName @@ -156,6 +162,19 @@ public class SourceFilesDlg extends IDialog { return jTextFieldTagName; } + private IComboBox getIComboBoxToolCode() { + if (iComboBoxToolCode == null) { + iComboBoxToolCode = new IComboBox(); + iComboBoxToolCode.setBounds(new java.awt.Rectangle(140, 60, 340, 20)); + iComboBoxToolCode.setPreferredSize(new java.awt.Dimension(340, 20)); + iComboBoxToolCode.setToolTipText("You may select a specific tool command from drop down list,
" + + "or you can DOUBLE-CLICK this fild to enter your customizing
" + + "tool command.
" + + "Press ENTER to save your input or press ESCAPE to quit"); + } + return iComboBoxToolCode; + } + /** * This method initializes jTextFieldToolCode * @@ -167,6 +186,7 @@ public class SourceFilesDlg extends IDialog { jTextFieldToolCode.setBounds(new java.awt.Rectangle(140, 60, 340, 20)); jTextFieldToolCode.setPreferredSize(new java.awt.Dimension(340, 20)); jTextFieldToolCode.setToolTipText("You may specify a specific tool command, such as ASM"); + jTextFieldToolCode.setVisible(false); } return jTextFieldToolCode; } @@ -274,7 +294,32 @@ public class SourceFilesDlg extends IDialog { if (inSourceFilesIdentifications != null) { this.jTextFieldFileName.setText(inSourceFilesIdentifications.getFilename()); this.jTextFieldTagName.setText(inSourceFilesIdentifications.getTagName()); - this.jTextFieldToolCode.setText(inSourceFilesIdentifications.getToolCode()); + + // + // Generate Tool Code selection list + // + Vector v = ed.getVToolCode(); + boolean isFind = false; + String strToolCode = inSourceFilesIdentifications.getToolCode(); + + // + // If the input value is not in the default list, add it to the list + // + if (strToolCode != null) { + for (int index = 0; index < v.size(); index++) { + if (v.elementAt(index).equals(strToolCode)) { + isFind = true; + break; + } + } + if (!isFind && !isEmpty(strToolCode)) { + v.addElement(strToolCode); + } + } + + Tools.generateComboBoxByVector(iComboBoxToolCode, v); + this.iComboBoxToolCode.setSelectedItem(strToolCode); + this.jTextFieldToolChainFamily.setText(inSourceFilesIdentifications.getToolChainFamily()); jTextFieldFeatureFlag.setText(inSourceFilesIdentifications.getFeatureFlag()); this.jArchCheckBox.setSelectedItems(inSourceFilesIdentifications.getSupArchList()); @@ -341,6 +386,7 @@ public class SourceFilesDlg extends IDialog { jContentPane.add(getJTextFieldTagName(), null); jContentPane.add(jLabelToolCode, null); jContentPane.add(getJTextFieldToolCode(), null); + jContentPane.add(getIComboBoxToolCode(), null); jContentPane.add(getJTextFieldToolChainFamily(), null); jContentPane.add(jLabelFeatureFlag, null); jContentPane.add(getJTextFieldFeatureFlag(), null); @@ -380,13 +426,16 @@ public class SourceFilesDlg extends IDialog { String name = this.jTextFieldFileName.getText(); String s[] = name.split(";"); String tagName = this.jTextFieldTagName.getText(); - String toolCode = this.jTextFieldToolCode.getText(); + String toolCode = this.iComboBoxToolCode.getSelectedItem().toString(); + if (toolCode.equals(DataType.EMPTY_SELECT_ITEM)) { + toolCode = ""; + } String tcf = this.jTextFieldToolChainFamily.getText(); String featureFlag = this.jTextFieldFeatureFlag.getText(); Vector arch = this.jArchCheckBox.getSelectedItemsVector(); sfid = new SourceFilesIdentification[s.length]; for (int index = 0; index < s.length; index++) { - sfid[index] = new SourceFilesIdentification(s[index], tagName, toolCode, tcf, featureFlag, arch); + sfid[index] = new SourceFilesIdentification(s[index], tagName, toolCode, tcf, featureFlag, arch); } return sfid; } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SystemTablesDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SystemTablesDlg.java index 465a428060..f2b92ba7ef 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SystemTablesDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SystemTablesDlg.java @@ -47,375 +47,378 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools; */ public class SystemTablesDlg extends IDialog { - // / - // / Define class Serial Version UID - // / - private static final long serialVersionUID = 7488769180379442276L; + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = 7488769180379442276L; - // - // Define class members - // - private JPanel jContentPane = null; - - private JLabel jLabelEntry = null; + // + // Define class members + // + private JPanel jContentPane = null; - private JLabel jLabelUsage = null; + private JLabel jLabelEntry = null; - private JComboBox jComboBoxUsage = null; + private JLabel jLabelUsage = null; - private StarLabel jStarLabel1 = null; + private JComboBox jComboBoxUsage = null; - private StarLabel jStarLabel2 = null; + private StarLabel jStarLabel1 = null; - private JComboBox jComboBoxGuidC_Name = null; + private StarLabel jStarLabel2 = null; - private JLabel jLabelFeatureFlag = null; + private JComboBox jComboBoxGuidC_Name = null; - private JTextField jTextFieldFeatureFlag = null; + private JLabel jLabelFeatureFlag = null; - private JLabel jLabelArch = null; + private JTextField jTextFieldFeatureFlag = null; - private JScrollPane jScrollPane = null; + private JLabel jLabelArch = null; - private JLabel jLabelHelpText = null; + private JScrollPane jScrollPane = null; - private JTextArea jTextAreaHelpText = null; + private JLabel jLabelHelpText = null; - private JScrollPane jScrollPaneHelpText = null; + private JTextArea jTextAreaHelpText = null; - private ArchCheckBox jArchCheckBox = null; + private JScrollPane jScrollPaneHelpText = null; - private JButton jButtonOk = null; + private ArchCheckBox jArchCheckBox = null; - private JButton jButtonCancel = null; + private JButton jButtonOk = null; - // - // Not used by UI - // - private SystemTablesIdentification id = null; + private JButton jButtonCancel = null; - private EnumerationData ed = new EnumerationData(); + // + // Not used by UI + // + private SystemTablesIdentification id = null; + + private EnumerationData ed = new EnumerationData(); + + private WorkspaceTools wt = new WorkspaceTools(); + + /** + * This method initializes jComboBoxGuidC_Name + * + * @return javax.swing.JComboBox jComboBoxGuidC_Name + * + */ + private JComboBox getJComboBoxGuidC_Name() { + if (jComboBoxGuidC_Name == null) { + jComboBoxGuidC_Name = new JComboBox(); + jComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); + jComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the System Table"); + } + return jComboBoxGuidC_Name; + } - private WorkspaceTools wt = new WorkspaceTools(); + /** + * This method initializes jComboBoxUsage + * + * @return javax.swing.JComboBox jComboBoxUsage + * + */ + private JComboBox getJComboBoxUsage() { + if (jComboBoxUsage == null) { + jComboBoxUsage = new JComboBox(); + jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); + jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxUsage + .setToolTipText("" + + "" + + "" + + "" + + "" + + "
ALWAYS_CONSUMEDModule requires a GUIDed entry in the system table
SOMETIMES_CONSUMEDModule consumes a GUIDed entry in the system
table if it is present
ALWAYS_PRODUCEDModule always produces a GUIDed entry in the system table
SOMETIMES_PRODUCEDModule produces a GUIDed entry in the system table
for some of its execution flows.
"); + } + return jComboBoxUsage; + } - /** - * This method initializes jComboBoxGuidC_Name - * - * @return javax.swing.JComboBox jComboBoxGuidC_Name - * - */ - private JComboBox getJComboBoxGuidC_Name() { - if (jComboBoxGuidC_Name == null) { - jComboBoxGuidC_Name = new JComboBox(); - jComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); - jComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxGuidC_Name - .setToolTipText("Select the GUID C Name of the System Table"); + /** + * This method initializes jTextFieldFeatureFlag + * + * @return javax.swing.JTextField + */ + private JTextField getJTextFieldFeatureFlag() { + if (jTextFieldFeatureFlag == null) { + jTextFieldFeatureFlag = new JTextField(); + jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 320, 20)); + jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + } + return jTextFieldFeatureFlag; } - return jComboBoxGuidC_Name; - } - - /** - * This method initializes jComboBoxUsage - * - * @return javax.swing.JComboBox jComboBoxUsage - * - */ - private JComboBox getJComboBoxUsage() { - if (jComboBoxUsage == null) { - jComboBoxUsage = new JComboBox(); - jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); - jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxUsage - .setToolTipText("
ALWAYS_CONSUMEDModule requires a GUIDed entry in the system table
SOMETIMES_CONSUMEDModule consumes a GUIDed entry in the system
table if it is present
ALWAYS_PRODUCEDModule always produces a GUIDed entry in the system table
SOMETIMES_PRODUCEDModule produces a GUIDed entry in the system table
for some of its execution flows.
"); + + /** + * This method initializes jScrollPane + * + * @return javax.swing.JScrollPane + */ + private JScrollPane getJScrollPane() { + if (jScrollPane == null) { + jScrollPane = new JScrollPane(); + jScrollPane.setViewportView(getJContentPane()); + } + return jScrollPane; } - return jComboBoxUsage; - } - - /** - * This method initializes jTextFieldFeatureFlag - * - * @return javax.swing.JTextField - */ - private JTextField getJTextFieldFeatureFlag() { - if (jTextFieldFeatureFlag == null) { - jTextFieldFeatureFlag = new JTextField(); - jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 105, 320, 20)); - jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + + /** + * This method initializes jTextAreaHelpText + * + * @return javax.swing.JTextArea + * + */ + private JTextArea getJTextAreaHelpText() { + if (jTextAreaHelpText == null) { + jTextAreaHelpText = new JTextArea(); + jTextAreaHelpText.setLineWrap(true); + jTextAreaHelpText.setWrapStyleWord(true); + } + return jTextAreaHelpText; } - return jTextFieldFeatureFlag; - } - - /** - * This method initializes jScrollPane - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setViewportView(getJContentPane()); + + /** + * This method initializes jScrollPaneHelpText + * + * @returns javax.swing.JScrollPane jScrollPaneHelpText + */ + private JScrollPane getJScrollPaneHelpText() { + if (jScrollPaneHelpText == null) { + jScrollPaneHelpText = new JScrollPane(); + jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setLocation(new java.awt.Point(160, 60)); + jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + } + return jScrollPaneHelpText; } - return jScrollPane; - } - - /** - * This method initializes jTextAreaHelpText - * - * @return javax.swing.JTextArea - * - */ - private JTextArea getJTextAreaHelpText() { - if (jTextAreaHelpText == null) { - jTextAreaHelpText = new JTextArea(); - jTextAreaHelpText.setLineWrap(true); - jTextAreaHelpText.setWrapStyleWord(true); + + /** + * This method initializes jButtonOk + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonOk() { + if (jButtonOk == null) { + jButtonOk = new JButton(); + jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20)); + jButtonOk.setText("Ok"); + jButtonOk.addActionListener(this); + } + return jButtonOk; } - return jTextAreaHelpText; - } - - /** - * This method initializes jScrollPaneHelpText - * - * @returns javax.swing.JScrollPane jScrollPaneHelpText - */ - private JScrollPane getJScrollPaneHelpText(){ - if (jScrollPaneHelpText == null){ - jScrollPaneHelpText = new JScrollPane(); - jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); - jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320,40)); - jScrollPaneHelpText.setLocation(new java.awt.Point(160, 60)); - jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + + /** + * This method initializes jButtonCancel + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonCancel() { + if (jButtonCancel == null) { + jButtonCancel = new JButton(); + jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20)); + jButtonCancel.setText("Cancel"); + jButtonCancel.addActionListener(this); + } + return jButtonCancel; } - return jScrollPaneHelpText; - } - /** - * This method initializes jButtonOk - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setBounds(new java.awt.Rectangle(290, 157, 90, 20)); - jButtonOk.setText("Ok"); - jButtonOk.addActionListener(this); + + public static void main(String[] args) { + } - return jButtonOk; - } - - /** - * This method initializes jButtonCancel - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 157, 90, 20)); - jButtonCancel.setText("Cancel"); - jButtonCancel.addActionListener(this); + + /** + * This method initializes this + * + */ + private void init() { + this.setSize(500, 230); + this.setContentPane(getJScrollPane()); + this.setTitle("System Tables"); + initFrame(); + this.setViewMode(false); + this.centerWindow(); } - return jButtonCancel; - } - - public static void main(String[] args) { - - } - - /** - * This method initializes this - * - */ - private void init() { - this.setSize(500, 230); - this.setContentPane(getJScrollPane()); - this.setTitle("System Tables"); - initFrame(); - this.setViewMode(false); - this.centerWindow(); - } - - /** - * This method initializes this Fill values to all fields if these values are - * not empty - * - * @param inSystemTablesId - * - */ - private void init(SystemTablesIdentification inSystemTablesId) { - init(); - this.id = inSystemTablesId; - - if (this.id != null) { - this.jComboBoxGuidC_Name.setSelectedItem(id.getName()); - this.jComboBoxUsage.setSelectedItem(id.getUsage()); - this.jTextAreaHelpText.setText(id.getHelp()); - this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); - this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + + /** + * This method initializes this Fill values to all fields if these values are + * not empty + * + * @param inSystemTablesId + * + */ + private void init(SystemTablesIdentification inSystemTablesId) { + init(); + this.id = inSystemTablesId; + + if (this.id != null) { + this.jComboBoxGuidC_Name.setSelectedItem(id.getName()); + this.jComboBoxUsage.setSelectedItem(id.getUsage()); + this.jTextAreaHelpText.setText(id.getHelp()); + this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); + this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + } } - } - - /** - * This is the override edit constructor - * - * @param inBootModesIdentification - * @param iFrame - * - */ - public SystemTablesDlg( - SystemTablesIdentification inSystemTablesIdentification, IFrame iFrame) { - super(iFrame, true); - init(inSystemTablesIdentification); - } - - /** - * Disable all components when the mode is view - * - * @param isView - * true - The view mode; false - The non-view mode - * - */ - public void setViewMode(boolean isView) { - if (isView) { - this.jComboBoxUsage.setEnabled(!isView); + + /** + * This is the override edit constructor + * + * @param inBootModesIdentification + * @param iFrame + * + */ + public SystemTablesDlg(SystemTablesIdentification inSystemTablesIdentification, IFrame iFrame) { + super(iFrame, true); + init(inSystemTablesIdentification); } - } - - /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel jContentPane - * - */ - private JPanel getJContentPane() { - if (jContentPane == null) { - jStarLabel1 = new StarLabel(); - jStarLabel1.setLocation(new java.awt.Point(2, 10)); - jLabelEntry = new JLabel(); - jLabelEntry.setText("Table's GUID C Name"); - jLabelEntry.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); - jStarLabel2 = new StarLabel(); - jStarLabel2.setLocation(new java.awt.Point(2, 35)); - jLabelUsage = new JLabel(); - jLabelUsage.setText("Usage"); - jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); - jLabelHelpText = new JLabel(); - jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 145, 20)); - jLabelHelpText.setText("Help Text"); - jLabelFeatureFlag = new JLabel(); - jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 140, 20)); - jLabelFeatureFlag.setText("Feature Flag Expression"); - jLabelArch = new JLabel(); - jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); - jLabelArch.setText("Supported Architectures"); - jArchCheckBox = new ArchCheckBox(); - jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20)); - jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); - - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.setPreferredSize(new java.awt.Dimension(485, 185)); - - jContentPane.add(jLabelEntry, null); - jContentPane.add(jLabelFeatureFlag, null); - jContentPane.add(getJTextFieldFeatureFlag(), null); - jContentPane.add(getJComboBoxGuidC_Name(), null); - jContentPane.add(jLabelArch, null); - jContentPane.add(jLabelUsage, null); - jContentPane.add(getJComboBoxUsage(), null); - - jContentPane.add(jStarLabel1, null); - jContentPane.add(jStarLabel2, null); - - jContentPane.add(jLabelHelpText, null); - jContentPane.add(getJScrollPaneHelpText(), null); - jContentPane.add(jArchCheckBox, null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); + + /** + * Disable all components when the mode is view + * + * @param isView + * true - The view mode; false - The non-view mode + * + */ + public void setViewMode(boolean isView) { + if (isView) { + this.jComboBoxUsage.setEnabled(!isView); + } } - return jContentPane; - } - - /** - * This method initializes Usage type - * - */ - private void initFrame() { - Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVSystemTableUsage()); - Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt - .getAllGuidDeclarationsFromWorkspace()); - } - - /* - * (non-Javadoc) - * - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - * - * Override actionPerformed to listen all actions - * - */ - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - if (checkAdd()) { - getCurrentSystemTables(); - this.returnType = DataType.RETURN_TYPE_OK; - this.setVisible(false); - } + + /** + * This method initializes jContentPane + * + * @return javax.swing.JPanel jContentPane + * + */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jStarLabel1 = new StarLabel(); + jStarLabel1.setLocation(new java.awt.Point(2, 10)); + jLabelEntry = new JLabel(); + jLabelEntry.setText("Table's GUID C Name"); + jLabelEntry.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); + jStarLabel2 = new StarLabel(); + jStarLabel2.setLocation(new java.awt.Point(2, 35)); + jLabelUsage = new JLabel(); + jLabelUsage.setText("Usage"); + jLabelUsage.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); + jLabelHelpText = new JLabel(); + jLabelHelpText.setBounds(new java.awt.Rectangle(14, 60, 145, 20)); + jLabelHelpText.setText("Help Text"); + jLabelFeatureFlag = new JLabel(); + jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 105, 140, 20)); + jLabelFeatureFlag.setText("Feature Flag Expression"); + jLabelArch = new JLabel(); + jLabelArch.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); + jLabelArch.setText("Supported Architectures"); + jArchCheckBox = new ArchCheckBox(); + jArchCheckBox.setBounds(new java.awt.Rectangle(160, 130, 320, 20)); + jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); + + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.setPreferredSize(new java.awt.Dimension(485, 185)); + + jContentPane.add(jLabelEntry, null); + jContentPane.add(jLabelFeatureFlag, null); + jContentPane.add(getJTextFieldFeatureFlag(), null); + jContentPane.add(getJComboBoxGuidC_Name(), null); + jContentPane.add(jLabelArch, null); + jContentPane.add(jLabelUsage, null); + jContentPane.add(getJComboBoxUsage(), null); + + jContentPane.add(jStarLabel1, null); + jContentPane.add(jStarLabel2, null); + + jContentPane.add(jLabelHelpText, null); + jContentPane.add(getJScrollPaneHelpText(), null); + jContentPane.add(jArchCheckBox, null); + jContentPane.add(getJButtonOk(), null); + jContentPane.add(getJButtonCancel(), null); + } + return jContentPane; } - if (arg0.getSource() == jButtonCancel) { - this.returnType = DataType.RETURN_TYPE_CANCEL; - this.setVisible(false); + /** + * This method initializes Usage type + * + */ + private void initFrame() { + Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVSystemTableUsage()); + Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt.getAllGuidDeclarationsFromWorkspace()); } - } - - /** - * Data validation for all fields - * - * @retval true - All datas are valid - * @retval false - At least one data is invalid - * - */ - public boolean checkAdd() { - // - // Check if all fields have correct data types - // - // - // Check FeatureFlag - // - if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { - if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { - Log.wrn("Update System Tables", "Incorrect data type for Feature Flag"); - return false; - } + /* + * (non-Javadoc) + * + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + * + * Override actionPerformed to listen all actions + * + */ + public void actionPerformed(ActionEvent arg0) { + if (arg0.getSource() == jButtonOk) { + if (checkAdd()) { + getCurrentSystemTables(); + this.returnType = DataType.RETURN_TYPE_OK; + this.setVisible(false); + } + } + + if (arg0.getSource() == jButtonCancel) { + this.returnType = DataType.RETURN_TYPE_CANCEL; + this.setVisible(false); + } } - return true; - } + /** + * Data validation for all fields + * + * @retval true - All datas are valid + * @retval false - At least one data is invalid + * + */ + public boolean checkAdd() { + // + // Check if all fields have correct data types + // + + // + // Check FeatureFlag + // + if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { + if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { + Log.wrn("Update System Tables", "Incorrect data type for Feature Flag"); + return false; + } + } + + return true; + } - private SystemTablesIdentification getCurrentSystemTables() { - String arg0 = this.jComboBoxGuidC_Name.getSelectedItem().toString(); - String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); + private SystemTablesIdentification getCurrentSystemTables() { + String arg0 = this.jComboBoxGuidC_Name.getSelectedItem().toString(); + String arg1 = this.jComboBoxUsage.getSelectedItem().toString(); - String arg2 = this.jTextFieldFeatureFlag.getText(); - Vector arg3 = this.jArchCheckBox.getSelectedItemsVector(); - String arg4 = this.jTextAreaHelpText.getText(); + String arg2 = this.jTextFieldFeatureFlag.getText(); + Vector arg3 = this.jArchCheckBox.getSelectedItemsVector(); + String arg4 = this.jTextAreaHelpText.getText(); - id = new SystemTablesIdentification(arg0, arg1, arg2, arg3, arg4); - return id; - } + id = new SystemTablesIdentification(arg0, arg1, arg2, arg3, arg4); + return id; + } - public SystemTablesIdentification getId() { - return id; - } + public SystemTablesIdentification getId() { + return id; + } - public void setId(SystemTablesIdentification id) { - this.id = id; - } + public void setId(SystemTablesIdentification id) { + this.id = id; + } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/VariablesDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/VariablesDlg.java index 9323ac3898..0761d30693 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/VariablesDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/VariablesDlg.java @@ -45,432 +45,428 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools; */ public class VariablesDlg extends IDialog { - // / - // / Define class Serial Version UID - // / - private static final long serialVersionUID = -6998982978030439446L; + // / + // / Define class Serial Version UID + // / + private static final long serialVersionUID = -6998982978030439446L; - // - // Define class members - // - private JPanel jContentPane = null; + // + // Define class members + // + private JPanel jContentPane = null; - private JLabel jLabelVariableName = null; + private JLabel jLabelVariableName = null; - private JTextField jTextFieldVariableName = null; + private JTextField jTextFieldVariableName = null; - private JLabel jLabelUsage = null; + private JLabel jLabelUsage = null; - private JComboBox jComboBoxUsage = null; + private JComboBox jComboBoxUsage = null; - private StarLabel jStarLabel1 = null; + private StarLabel jStarLabel1 = null; - private StarLabel jStarLabel2 = null; - - private StarLabel jStarLabel3 = null; + private StarLabel jStarLabel2 = null; - private JScrollPane jScrollPane = null; + private StarLabel jStarLabel3 = null; - private JLabel jLabelGuidCName = null; + private JScrollPane jScrollPane = null; - private JComboBox jComboBoxGuidC_Name = null; + private JLabel jLabelGuidCName = null; - private JTextField jTextFieldFeatureFlag = null; + private JComboBox jComboBoxGuidC_Name = null; - private JLabel jLabelFeatureFlag = null; + private JTextField jTextFieldFeatureFlag = null; - private JLabel jLabelArch = null; + private JLabel jLabelFeatureFlag = null; - private JLabel jLabelHelpText = null; + private JLabel jLabelArch = null; - private JTextArea jTextAreaHelpText = null; + private JLabel jLabelHelpText = null; - private JScrollPane jScrollPaneHelpText = null; + private JTextArea jTextAreaHelpText = null; - private ArchCheckBox jArchCheckBox = null; + private JScrollPane jScrollPaneHelpText = null; - private JButton jButtonOk = null; + private ArchCheckBox jArchCheckBox = null; - private JButton jButtonCancel = null; + private JButton jButtonOk = null; - // - // Not used by UI - // - private VariablesIdentification id = null; + private JButton jButtonCancel = null; - private EnumerationData ed = new EnumerationData(); + // + // Not used by UI + // + private VariablesIdentification id = null; + + private EnumerationData ed = new EnumerationData(); + + private WorkspaceTools wt = new WorkspaceTools(); + + /** + * This method initializes jTextFieldString + * + * @return javax.swing.JTextField jTextFieldString + * + */ + private JTextField getJTextFieldString() { + if (jTextFieldVariableName == null) { + jTextFieldVariableName = new JTextField(); + jTextFieldVariableName.setSize(new java.awt.Dimension(320, 20)); + jTextFieldVariableName.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldVariableName.setLocation(new java.awt.Point(160, 10)); + jTextFieldVariableName + .setToolTipText("Enter a Hex Word Array, you must provide leading Zeros. 0x000a, 0x0010, 0x00FF"); + } + return jTextFieldVariableName; + } - private WorkspaceTools wt = new WorkspaceTools(); + /** + * This method initializes jComboBoxUsage + * + * @return javax.swing.JComboBox jComboBoxUsage + * + */ + private JComboBox getJComboBoxUsage() { + if (jComboBoxUsage == null) { + jComboBoxUsage = new JComboBox(); + jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); + jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxUsage + .setToolTipText("" + + "" + + "" + + "" + + "" + + "
ALWAYS_CONSUMEDThe module requires the variable entry to be set
SOMETIMES_CONSUMEDThe module will use the variable entry if it is set.
ALWAYS_PRODUCEDThe module will always write the variable.
SOMETIMES_PRODUCEDThe module will sometimes write the variable.
"); + } + return jComboBoxUsage; + } - /** - * This method initializes jTextFieldString - * - * @return javax.swing.JTextField jTextFieldString - * - */ - private JTextField getJTextFieldString() { - if (jTextFieldVariableName == null) { - jTextFieldVariableName = new JTextField(); - jTextFieldVariableName.setSize(new java.awt.Dimension(320, 20)); - jTextFieldVariableName.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldVariableName.setLocation(new java.awt.Point(160, 10)); - jTextFieldVariableName - .setToolTipText("Enter a Hex Word Array, you must provide leading Zeros. 0x000a, 0x0010, 0x00FF"); + /** + * This method initializes jScrollPane + * + * @return javax.swing.JScrollPane + */ + private JScrollPane getJScrollPane() { + if (jScrollPane == null) { + jScrollPane = new JScrollPane(); + jScrollPane.setViewportView(getJContentPane()); + } + return jScrollPane; } - return jTextFieldVariableName; - } - - /** - * This method initializes jComboBoxUsage - * - * @return javax.swing.JComboBox jComboBoxUsage - * - */ - private JComboBox getJComboBoxUsage() { - if (jComboBoxUsage == null) { - jComboBoxUsage = new JComboBox(); - jComboBoxUsage.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); - jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxUsage - .setToolTipText("" - + "" - + "" - + "
ALWAYS_CONSUMEDThe module requires the variable entry to be set
SOMETIMES_CONSUMEDThe module will use the variable entry if it’s set.
ALWAYS_PRODUCEDThe module will always write the variable.
SOMETIMES_PRODUCEDThe module will sometimes write the variable.
"); + + /** + * This method initializes jTextFieldFeatureFlag + * + * @return javax.swing.JTextField jTextFieldFeatureFlag + * + */ + private JTextField getJTextFieldFeatureFlag() { + if (jTextFieldFeatureFlag == null) { + jTextFieldFeatureFlag = new JTextField(); + jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 130, 320, 20)); + jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); + jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + } + return jTextFieldFeatureFlag; } - return jComboBoxUsage; - } - - /** - * This method initializes jScrollPane - * - * @return javax.swing.JScrollPane - */ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setViewportView(getJContentPane()); + + /** + * This method initializes jTextFieldHelpText + * + * @return javax.swing.JTextField + * + */ + private JTextArea getJTextAreaHelpText() { + if (jTextAreaHelpText == null) { + jTextAreaHelpText = new JTextArea(); + jTextAreaHelpText.setLineWrap(true); + jTextAreaHelpText.setWrapStyleWord(true); + jTextAreaHelpText.setToolTipText("Enter information on how to use this Variable."); + } + return jTextAreaHelpText; } - return jScrollPane; - } - - /** - * This method initializes jTextFieldFeatureFlag - * - * @return javax.swing.JTextField jTextFieldFeatureFlag - * - */ - private JTextField getJTextFieldFeatureFlag() { - if (jTextFieldFeatureFlag == null) { - jTextFieldFeatureFlag = new JTextField(); - jTextFieldFeatureFlag - .setBounds(new java.awt.Rectangle(160, 130, 320, 20)); - jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); - jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); + + private JScrollPane getJScrollPaneHelpText() { + if (jScrollPaneHelpText == null) { + jScrollPaneHelpText = new JScrollPane(); + jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + jScrollPaneHelpText.setSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320, 40)); + jScrollPaneHelpText.setLocation(new java.awt.Point(160, 85)); + jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + } + return jScrollPaneHelpText; } - return jTextFieldFeatureFlag; - } - - /** - * This method initializes jTextFieldHelpText - * - * @return javax.swing.JTextField - * - */ - private JTextArea getJTextAreaHelpText() { - if (jTextAreaHelpText == null) { - jTextAreaHelpText = new JTextArea(); - jTextAreaHelpText.setLineWrap(true); - jTextAreaHelpText.setWrapStyleWord(true); - jTextAreaHelpText - .setToolTipText("Enter information on how to use this Variable."); + + /** + * This method initializes jComboBoxGuidC_Name + * + * @return javax.swing.JComboBox jComboBoxGuidC_Name + * + */ + private JComboBox getJComboBoxGuidC_Name() { + if (jComboBoxGuidC_Name == null) { + jComboBoxGuidC_Name = new JComboBox(); + jComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); + jComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20)); + jComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Variable."); + } + return jComboBoxGuidC_Name; } - return jTextAreaHelpText; - } - - - private JScrollPane getJScrollPaneHelpText() { - if (jScrollPaneHelpText == null) { - jScrollPaneHelpText = new JScrollPane(); - jScrollPaneHelpText.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPaneHelpText.setSize(new java.awt.Dimension(320,40)); - jScrollPaneHelpText.setPreferredSize(new java.awt.Dimension(320,40)); - jScrollPaneHelpText.setLocation(new java.awt.Point(160,85)); - jScrollPaneHelpText.setViewportView(getJTextAreaHelpText()); + + /** + * This method initializes jButtonOk + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonOk() { + if (jButtonOk == null) { + jButtonOk = new JButton(); + jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20)); + jButtonOk.setText("Ok"); + jButtonOk.addActionListener(this); + } + return jButtonOk; } - return jScrollPaneHelpText; - } - /** - * This method initializes jComboBoxGuidC_Name - * - * @return javax.swing.JComboBox jComboBoxGuidC_Name - * - */ - private JComboBox getJComboBoxGuidC_Name() { - if (jComboBoxGuidC_Name == null) { - jComboBoxGuidC_Name = new JComboBox(); - jComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); - jComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20)); - jComboBoxGuidC_Name - .setToolTipText("Select the GUID C Name of the Variable."); + + /** + * This method initializes jButtonCancel + * + * @return javax.swing.JButton + * + */ + private JButton getJButtonCancel() { + if (jButtonCancel == null) { + jButtonCancel = new JButton(); + jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20)); + jButtonCancel.setText("Cancel"); + jButtonCancel.addActionListener(this); + } + return jButtonCancel; + } + + public static void main(String[] args) { + } - return jComboBoxGuidC_Name; - } - - /** - * This method initializes jButtonOk - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setBounds(new java.awt.Rectangle(290, 182, 90, 20)); - jButtonOk.setText("Ok"); - jButtonOk.addActionListener(this); + + /** + * This method initializes this + * + */ + private void init() { + this.setSize(500, 255); + this.setContentPane(getJScrollPane()); + this.setTitle("Variables"); + initFrame(); + this.setViewMode(false); + this.centerWindow(); } - return jButtonOk; - } - - /** - * This method initializes jButtonCancel - * - * @return javax.swing.JButton - * - */ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 182, 90, 20)); - jButtonCancel.setText("Cancel"); - jButtonCancel.addActionListener(this); + + /** + * This method initializes this Fill values to all fields if these values are + * not empty + * + * @param inVariablesId + * + */ + private void init(VariablesIdentification inVariablesId) { + init(); + this.id = inVariablesId; + + if (this.id != null) { + this.jTextFieldVariableName.setText(id.getName()); + this.jComboBoxGuidC_Name.setSelectedItem(id.getGuid()); + this.jComboBoxUsage.setSelectedItem(id.getUsage()); + this.jTextAreaHelpText.setText(id.getHelp()); + this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); + this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + } } - return jButtonCancel; - } - - public static void main(String[] args) { - - } - - /** - * This method initializes this - * - */ - private void init() { - this.setSize(500, 255); - this.setContentPane(getJScrollPane()); - this.setTitle("Variables"); - initFrame(); - this.setViewMode(false); - this.centerWindow(); - } - - /** - * This method initializes this Fill values to all fields if these values are - * not empty - * - * @param inVariablesId - * - */ - private void init(VariablesIdentification inVariablesId) { - init(); - this.id = inVariablesId; - - if (this.id != null) { - this.jTextFieldVariableName.setText(id.getName()); - this.jComboBoxGuidC_Name.setSelectedItem(id.getGuid()); - this.jComboBoxUsage.setSelectedItem(id.getUsage()); - this.jTextAreaHelpText.setText(id.getHelp()); - this.jTextFieldFeatureFlag.setText(id.getFeatureFlag()); - this.jArchCheckBox.setSelectedItems(id.getSupArchList()); + + /** + * This is the override edit constructor + * + * @param inVariablesIdentification + * @param iFrame + * + */ + public VariablesDlg(VariablesIdentification inVariablesIdentification, IFrame iFrame) { + super(iFrame, true); + init(inVariablesIdentification); } - } - - /** - * This is the override edit constructor - * - * @param inVariablesIdentification - * @param iFrame - * - */ - public VariablesDlg(VariablesIdentification inVariablesIdentification, - IFrame iFrame) { - super(iFrame, true); - init(inVariablesIdentification); - } - - /** - * Disable all components when the mode is view - * - * @param isView - * true - The view mode; false - The non-view mode - * - */ - public void setViewMode(boolean isView) { - if (isView) { - this.jTextFieldVariableName.setEnabled(!isView); - this.jComboBoxUsage.setEnabled(!isView); + + /** + * Disable all components when the mode is view + * + * @param isView + * true - The view mode; false - The non-view mode + * + */ + public void setViewMode(boolean isView) { + if (isView) { + this.jTextFieldVariableName.setEnabled(!isView); + this.jComboBoxUsage.setEnabled(!isView); + } } - } - - /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel jContentPane - * - */ - private JPanel getJContentPane() { - if (jContentPane == null) { - jStarLabel1 = new StarLabel(); - jStarLabel1.setLocation(new java.awt.Point(2, 10)); - jLabelVariableName = new JLabel(); - jLabelVariableName.setText("Variable Name"); - jLabelVariableName.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); - - jStarLabel2 = new StarLabel(); - jStarLabel2.setLocation(new java.awt.Point(2, 35)); - jLabelGuidCName = new JLabel(); - jLabelGuidCName.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); - jLabelGuidCName.setText("Variable Guid C Name"); - - jStarLabel3 = new StarLabel(); - jStarLabel3.setLocation(new java.awt.Point(2, 60)); - jLabelUsage = new JLabel(); - jLabelUsage.setText("Usage"); - jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); - - jLabelHelpText = new JLabel(); - jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 145, 20)); - jLabelHelpText.setText("Help Text"); - - jLabelFeatureFlag = new JLabel(); - jLabelFeatureFlag.setText("Feature Flag Expression"); - jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); - - jLabelArch = new JLabel(); - jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20)); - jLabelArch.setText("Supported Architectures"); - jArchCheckBox = new ArchCheckBox(); - jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20)); - jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); - - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.setPreferredSize(new java.awt.Dimension(485, 210)); - - jContentPane.add(jStarLabel1, null); - jContentPane.add(jLabelVariableName, null); - jContentPane.add(getJTextFieldString(), null); - jContentPane.add(jStarLabel2, null); - jContentPane.add(jLabelGuidCName, null); - jContentPane.add(getJComboBoxGuidC_Name(), null); - jContentPane.add(jStarLabel3, null); - jContentPane.add(jLabelUsage, null); - jContentPane.add(getJComboBoxUsage(), null); - jContentPane.add(jLabelHelpText, null); - jContentPane.add(getJScrollPaneHelpText(), null); - jContentPane.add(jLabelFeatureFlag, null); - jContentPane.add(getJTextFieldFeatureFlag(), null); - jContentPane.add(jLabelArch, null); - jContentPane.add(jArchCheckBox, null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); + + /** + * This method initializes jContentPane + * + * @return javax.swing.JPanel jContentPane + * + */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jStarLabel1 = new StarLabel(); + jStarLabel1.setLocation(new java.awt.Point(2, 10)); + jLabelVariableName = new JLabel(); + jLabelVariableName.setText("Variable Name"); + jLabelVariableName.setBounds(new java.awt.Rectangle(15, 10, 145, 20)); + + jStarLabel2 = new StarLabel(); + jStarLabel2.setLocation(new java.awt.Point(2, 35)); + jLabelGuidCName = new JLabel(); + jLabelGuidCName.setBounds(new java.awt.Rectangle(15, 35, 145, 20)); + jLabelGuidCName.setText("Variable Guid C Name"); + + jStarLabel3 = new StarLabel(); + jStarLabel3.setLocation(new java.awt.Point(2, 60)); + jLabelUsage = new JLabel(); + jLabelUsage.setText("Usage"); + jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 145, 20)); + + jLabelHelpText = new JLabel(); + jLabelHelpText.setBounds(new java.awt.Rectangle(14, 85, 145, 20)); + jLabelHelpText.setText("Help Text"); + + jLabelFeatureFlag = new JLabel(); + jLabelFeatureFlag.setText("Feature Flag Expression"); + jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 130, 145, 20)); + + jLabelArch = new JLabel(); + jLabelArch.setBounds(new java.awt.Rectangle(15, 155, 145, 20)); + jLabelArch.setText("Supported Architectures"); + jArchCheckBox = new ArchCheckBox(); + jArchCheckBox.setBounds(new java.awt.Rectangle(160, 155, 320, 20)); + jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20)); + + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.setPreferredSize(new java.awt.Dimension(485, 210)); + + jContentPane.add(jStarLabel1, null); + jContentPane.add(jLabelVariableName, null); + jContentPane.add(getJTextFieldString(), null); + jContentPane.add(jStarLabel2, null); + jContentPane.add(jLabelGuidCName, null); + jContentPane.add(getJComboBoxGuidC_Name(), null); + jContentPane.add(jStarLabel3, null); + jContentPane.add(jLabelUsage, null); + jContentPane.add(getJComboBoxUsage(), null); + jContentPane.add(jLabelHelpText, null); + jContentPane.add(getJScrollPaneHelpText(), null); + jContentPane.add(jLabelFeatureFlag, null); + jContentPane.add(getJTextFieldFeatureFlag(), null); + jContentPane.add(jLabelArch, null); + jContentPane.add(jArchCheckBox, null); + jContentPane.add(getJButtonOk(), null); + jContentPane.add(getJButtonCancel(), null); + } + return jContentPane; } - return jContentPane; - } - - /* - * (non-Javadoc) - * - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - * - * Override actionPerformed to listen all actions - * - */ - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - if (checkAdd()) { - getCurrentVariables(); - this.returnType = DataType.RETURN_TYPE_OK; - this.setVisible(false); - } + + /* + * (non-Javadoc) + * + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + * + * Override actionPerformed to listen all actions + * + */ + public void actionPerformed(ActionEvent arg0) { + if (arg0.getSource() == jButtonOk) { + if (checkAdd()) { + getCurrentVariables(); + this.returnType = DataType.RETURN_TYPE_OK; + this.setVisible(false); + } + } + + if (arg0.getSource() == jButtonCancel) { + this.returnType = DataType.RETURN_TYPE_CANCEL; + this.setVisible(false); + } } - if (arg0.getSource() == jButtonCancel) { - this.returnType = DataType.RETURN_TYPE_CANCEL; - this.setVisible(false); + /** + * This method initializes Usage type + * + */ + private void initFrame() { + Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage()); + Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt.getAllGuidDeclarationsFromWorkspace()); } - } - - /** - * This method initializes Usage type - * - */ - private void initFrame() { - Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPpiUsage()); - Tools.generateComboBoxByVector(jComboBoxGuidC_Name, wt - .getAllGuidDeclarationsFromWorkspace()); - } - - /** - * Data validation for all fields - * - * @retval true - All datas are valid - * @retval false - At least one data is invalid - * - */ - public boolean checkAdd() { - // - // Check if all fields have correct data types - // - // - // Check VariableName - // - if (isEmpty(this.jTextFieldVariableName.getText())) { - Log.wrn("Update Variables", "Variable Name must not be empty"); - return false; + /** + * Data validation for all fields + * + * @retval true - All datas are valid + * @retval false - At least one data is invalid + * + */ + public boolean checkAdd() { + // + // Check if all fields have correct data types + // + + // + // Check VariableName + // + if (isEmpty(this.jTextFieldVariableName.getText())) { + Log.wrn("Update Variables", "Variable Name must not be empty"); + return false; + } + + if (!isEmpty(this.jTextFieldVariableName.getText())) { + if (!DataValidation.isHexWordArrayType(this.jTextFieldVariableName.getText())) { + Log.wrn("Update Variables", "Incorrect data type for Variable Name"); + return false; + } + } + + // + // Check FeatureFlag + // + if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { + if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { + Log.wrn("Update Variables", "Incorrect data type for Feature Flag"); + return false; + } + } + + return true; } - if (!isEmpty(this.jTextFieldVariableName.getText())) { - if (!DataValidation.isHexWordArrayType(this.jTextFieldVariableName - .getText())) { - Log.wrn("Update Variables", "Incorrect data type for Variable Name"); - return false; - } + private VariablesIdentification getCurrentVariables() { + String arg0 = this.jTextFieldVariableName.getText(); + String arg1 = this.jComboBoxGuidC_Name.getSelectedItem().toString(); + String arg2 = this.jComboBoxUsage.getSelectedItem().toString(); + + String arg3 = this.jTextFieldFeatureFlag.getText(); + Vector arg4 = this.jArchCheckBox.getSelectedItemsVector(); + String arg5 = this.jTextAreaHelpText.getText(); + + id = new VariablesIdentification(arg0, arg1, arg2, arg3, arg4, arg5); + return id; } - // - // Check FeatureFlag - // - if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { - if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { - Log.wrn("Update Variables", "Incorrect data type for Feature Flag"); - return false; - } + public VariablesIdentification getId() { + return id; } - return true; - } - - private VariablesIdentification getCurrentVariables() { - String arg0 = this.jTextFieldVariableName.getText(); - String arg1 = this.jComboBoxGuidC_Name.getSelectedItem().toString(); - String arg2 = this.jComboBoxUsage.getSelectedItem().toString(); - - String arg3 = this.jTextFieldFeatureFlag.getText(); - Vector arg4 = this.jArchCheckBox.getSelectedItemsVector(); - String arg5 = this.jTextAreaHelpText.getText(); - - id = new VariablesIdentification(arg0, arg1, arg2, arg3, arg4, arg5); - return id; - } - - public VariablesIdentification getId() { - return id; - } - - public void setId(VariablesIdentification id) { - this.id = id; - } + public void setId(VariablesIdentification id) { + this.id = id; + } }