diff options
Diffstat (limited to 'Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard')
186 files changed, 0 insertions, 74671 deletions
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/About.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/About.java deleted file mode 100644 index 95c06b8200..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/About.java +++ /dev/null @@ -1,161 +0,0 @@ -/** @file
-
- To show a about window with copyright information
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.WindowEvent;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import javax.swing.ImageIcon;
-
-/**
- The class is used to show a about window with copyright information
- It extends IDialog
-
- **/
-public class About extends IDialog {
-
- ///
- /// Define Class Serial Version UID
- ///
- private static final long serialVersionUID = 2958136136667310962L;
-
- ///
- /// Define Class Members
- ///
- private JPanel jContentPane = null;
-
- private JLabel jLabel = null;
-
- private JLabel jLabel1 = null;
-
- private JLabel jLabel2 = null;
-
- private JButton jButtonOK = null;
-
- private JLabel jLabelImage = null;
-
- /**
- This method initializes jButtonOK
-
- @return javax.swing.JButton jButtonOK
-
- **/
- private JButton getJButtonOK() {
- if (jButtonOK == null) {
- jButtonOK = new JButton();
- jButtonOK.setBounds(new java.awt.Rectangle(115, 200, 90, 20));
- jButtonOK.setText("OK");
- jButtonOK.addActionListener(this);
- }
- return jButtonOK;
- }
-
- /**
- This is the default constructor
-
- **/
- public About() {
- super();
- init();
- }
-
- /**
- This is the default constructor
-
- **/
- public About(IFrame parentFrame, boolean modal) {
- super(parentFrame, modal);
- init();
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(320, 265);
- this.setContentPane(getJContentPane());
- this.setTitle("About");
- this.getRootPane().setDefaultButton(jButtonOK);
- this.centerWindow();
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelImage = new JLabel();
- jLabelImage.setBounds(new java.awt.Rectangle(63, 20, 193, 58));
- jLabelImage.setIcon(new ImageIcon(getClass().getResource("/resources/images/logo.gif")));
-
- jLabel2 = new JLabel();
- jLabel2.setBounds(new java.awt.Rectangle(25, 160, 270, 20));
- jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jLabel2.setText("All rights reserved");
- jLabel1 = new JLabel();
- jLabel1.setBounds(new java.awt.Rectangle(25, 130, 270, 20));
- jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jLabel1.setText("Copyright (c) 2006, Intel Corporation");
- jLabel = new JLabel();
- jLabel.setToolTipText("");
- jLabel.setBounds(new java.awt.Rectangle(25, 90, 270, 20));
- jLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jLabel.setText(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION);
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setSize(new java.awt.Dimension(320, 235));
- jContentPane.add(jLabel, null);
- jContentPane.add(jLabel1, null);
- jContentPane.add(jLabel2, null);
- jContentPane.add(getJButtonOK(), null);
- jContentPane.add(jLabelImage, null);
- }
- 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) {
- returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- /**
- Dispose when windows is closing
-
- @param arg0
-
- **/
- public void windowClosing(WindowEvent arg0) {
- this.dispose();
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java deleted file mode 100644 index f4aebe0483..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java +++ /dev/null @@ -1,1291 +0,0 @@ -/** @file
-
- The file is used to clone workspace, module, package and platform
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard;
-
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.util.Vector;
-
-import javax.swing.JFileChooser;
-import javax.swing.JPanel;
-import javax.swing.JLabel;
-import javax.swing.JTextField;
-import javax.swing.JButton;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.ModuleDefinitionsDocument.ModuleDefinitions;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.PackageDefinitionsDocument.PackageDefinitions;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PlatformDefinitionsDocument.PlatformDefinitions;
-import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.FileOperation;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.IFileFilter;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.OpenFile;
-import org.tianocore.frameworkwizard.common.SaveFile;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-import javax.swing.JComboBox;
-
-/**
- The class is used to provide functions to clone workspace, module, package and platform
- It extends IDialog
-
- **/
-public class Clone extends IDialog {
-
- ///
- /// Define Class Serial Version UID
- ///
- private static final long serialVersionUID = -5469299324965727137L;
-
- ///
- /// Define Class Members
- ///
- private JPanel jContentPane = null;
-
- private JLabel jLabelType = null;
-
- private JTextField jTextFieldType = null;
-
- private JLabel jLabelSource = null;
-
- private JTextField jTextFieldSource = null;
-
- private JButton jButtonBrowse = null;
-
- private JLabel jLabelDestinationFile = null;
-
- private JTextField jTextFieldFilePath = null;
-
- private JLabel jLabelBaseName = null;
-
- private JTextField jTextFieldBaseName = null;
-
- private JLabel jLabelGuid = null;
-
- private JTextField jTextFieldGuid = null;
-
- private JLabel jLabelVersion = null;
-
- private JTextField jTextFieldVersion = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonGenerateGuid = null;
-
- private JLabel jLabelBelong = null;
-
- private JComboBox jComboBoxExistingPackage = null;
-
- ///
- /// Define members not for UI
- ///
-
- private int mode = -1;
-
- private Vector<PackageIdentification> packages = null;
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private Identification oldId = null;
-
- private Identification newId = null;
-
- private ModuleIdentification mid = null;
-
- private PackageIdentification pid = null;
-
- private PlatformIdentification fid = null;
-
- /**
- This method initializes jTextFieldType
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldType() {
- if (jTextFieldType == null) {
- jTextFieldType = new JTextField();
- jTextFieldType.setBounds(new java.awt.Rectangle(210, 10, 320, 20));
- jTextFieldType.setEditable(false);
- }
- return jTextFieldType;
- }
-
- /**
- This method initializes jTextFieldSource
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldSource() {
- if (jTextFieldSource == null) {
- jTextFieldSource = new JTextField();
- jTextFieldSource.setBounds(new java.awt.Rectangle(210, 35, 320, 20));
- jTextFieldSource.setEditable(false);
- }
- return jTextFieldSource;
- }
-
- /**
- This method initializes jButtonBrowse
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonBrowse() {
- if (jButtonBrowse == null) {
- jButtonBrowse = new JButton();
- jButtonBrowse.setBounds(new java.awt.Rectangle(445, 85, 85, 20));
- jButtonBrowse.setText("Browse");
- jButtonBrowse.addActionListener(this);
- }
- return jButtonBrowse;
- }
-
- /**
- This method initializes jTextFieldDestinationFile
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldFilePath() {
- if (jTextFieldFilePath == null) {
- jTextFieldFilePath = new JTextField();
- jTextFieldFilePath.setBounds(new java.awt.Rectangle(210, 85, 230, 20));
- }
- return jTextFieldFilePath;
- }
-
- /**
- This method initializes jTextFieldBaseName
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldBaseName() {
- if (jTextFieldBaseName == null) {
- jTextFieldBaseName = new JTextField();
- jTextFieldBaseName.setBounds(new java.awt.Rectangle(210, 110, 320, 20));
- }
- return jTextFieldBaseName;
- }
-
- /**
- This method initializes jTextFieldGuid
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldGuid() {
- if (jTextFieldGuid == null) {
- jTextFieldGuid = new JTextField();
- jTextFieldGuid.setBounds(new java.awt.Rectangle(210, 135, 230, 20));
- }
- return jTextFieldGuid;
- }
-
- /**
- This method initializes jTextFieldVersion
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldVersion() {
- if (jTextFieldVersion == null) {
- jTextFieldVersion = new JTextField();
- jTextFieldVersion.setBounds(new java.awt.Rectangle(210, 160, 320, 20));
- }
- return jTextFieldVersion;
- }
-
- /**
- This method initializes jButtonOk
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(285, 200, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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(405, 200, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes jButtonGenerateGuid
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonGenerateGuid() {
- if (jButtonGenerateGuid == null) {
- jButtonGenerateGuid = new JButton();
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(445, 135, 85, 20));
- jButtonGenerateGuid.setText("Gen");
- jButtonGenerateGuid.addActionListener(this);
- }
- return jButtonGenerateGuid;
- }
-
- /**
- This method initializes jComboBoxExistingPackage
-
- @return javax.swing.JComboBox
-
- **/
- private JComboBox getJComboBoxExistingPackage() {
- if (jComboBoxExistingPackage == null) {
- jComboBoxExistingPackage = new JComboBox();
- jComboBoxExistingPackage.setBounds(new java.awt.Rectangle(210, 60, 320, 20));
- }
- return jComboBoxExistingPackage;
- }
-
- /**
- This is the default constructor
-
- **/
- public Clone() {
- super();
- init();
- }
-
- /**
- This is the override constructor
-
- @param parentFrame The parent frame which starts this frame
- @param modal To identify the frame's modal
- @param fileType To identify the clone target type
- @param identification The clone target's identification
-
- **/
- public Clone(IFrame parentFrame, boolean modal, int fileType, Identification identification) {
- super(parentFrame, modal);
- this.mode = fileType;
- if (identification != null) {
- this.oldId = new Identification(identification.getName(), identification.getGuid(),
- identification.getVersion(), identification.getPath());
- this.newId = new Identification(identification.getName(), identification.getGuid(),
- identification.getVersion(), identification.getPath());
- }
- init(mode);
- }
-
- /**
- Query all existing packages and fill them into combox
-
- **/
- private void initExistingPackage() {
- packages = wt.getAllPackages();
- for (int index = 0; index < packages.size(); index++) {
- this.jComboBoxExistingPackage.addItem(packages.elementAt(index).getName());
- }
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(550, 260);
- this.setContentPane(getJContentPane());
- this.setTitle("Clone");
- this.centerWindow();
- }
-
- /**
- This method initializes this with given clone target type.
- Customize the frame interface via different clone target type.
-
- @param mode To identify the clone target type
-
- **/
- private void init(int mode) {
- init();
- //
- // For MODULE_SURFACE_AREA
- //
- if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- this.jTextFieldType.setText(DataType.MODULE_SURFACE_AREA);
- String s = oldId.getPath();
- s = Tools.getRelativePath(s, Tools.getFilePathOnly(wt.getPackageIdByModuleId(oldId).getPath()));
- this.jTextFieldSource.setText(Tools.convertPathToCurrentOsType(s));
- initExistingPackage();
- this.jButtonBrowse.setVisible(false);
- this.jTextFieldFilePath
- .setToolTipText("<html>Input the module's relative path and filename, for example:<br>Application\\HelloWorld\\HelloWorld.msa</html>");
- this.jTextFieldFilePath.setSize(320, this.jTextFieldFilePath.getSize().height);
- this.jLabelDestinationFile.setText("New Module Path and Filename");
- }
- //
- // For PACKAGE_SURFACE_AREA
- //
- if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- this.jTextFieldType.setText(DataType.PACKAGE_SURFACE_AREA);
- String s = oldId.getPath();
- s = Tools.getRelativePath(oldId.getPath(), Workspace.getCurrentWorkspace());
- this.jTextFieldSource.setText(Tools.convertPathToCurrentOsType(s));
- this.jLabelBelong.setEnabled(false);
- this.jComboBoxExistingPackage.setEnabled(false);
- this.jButtonBrowse.setVisible(false);
- this.jTextFieldFilePath
- .setToolTipText("<html>Input the package's relative path and file name, for example:<br>MdePkg\\MdePkg.spd</html>");
- this.jTextFieldFilePath.setSize(320, this.jTextFieldFilePath.getSize().height);
- this.jLabelDestinationFile.setText("New Package Path and Filename");
-
- //
- // Check if the package can be cloned
- //
- PackageSurfaceArea spd = GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(GlobalData.openingPackageList
- .getIdByPath(this.oldId
- .getPath()));
- if (spd != null) {
- if (spd.getPackageDefinitions() != null) {
- if (!spd.getPackageDefinitions().getRePackage()) {
- Log.wrn("Clone Package", "This package can't repackaged and cloned");
- this.jTextFieldBaseName.setEnabled(false);
- this.jTextFieldFilePath.setEnabled(false);
- this.jTextFieldGuid.setEnabled(false);
- this.jTextFieldVersion.setEnabled(false);
- this.jButtonGenerateGuid.setEnabled(false);
- this.jButtonOk.setEnabled(false);
- }
- }
- }
- }
- //
- // For PLATFORM_SURFACE_AREA
- //
- if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- this.jTextFieldType.setText(DataType.PLATFORM_SURFACE_AREA);
- this.jTextFieldSource.setText(oldId.getPath());
- this.jLabelBelong.setEnabled(false);
- this.jComboBoxExistingPackage.setEnabled(false);
- this.jTextFieldFilePath
- .setToolTipText("<html>Select the platform's relative path and filename. For example:<br>C:\\MyWorkspace\\EdkNt32Pkg\\Nt32.fpd</html>");
- this.jLabelDestinationFile.setText("New Platform Path and Filename");
- }
- //
- // For WORKSPACE
- //
- if (mode == DataType.RETURN_TYPE_WORKSPACE) {
- this.jTextFieldType.setText(DataType.WORKSPACE);
- this.jTextFieldSource.setText(Workspace.getCurrentWorkspace());
- this.jLabelBelong.setEnabled(false);
- this.jComboBoxExistingPackage.setEnabled(false);
- this.jLabelBaseName.setEnabled(false);
- this.jTextFieldBaseName.setEditable(false);
- this.jLabelGuid.setEnabled(false);
- this.jTextFieldGuid.setEnabled(false);
- this.jButtonGenerateGuid.setEnabled(false);
- this.jLabelVersion.setEnabled(false);
- this.jTextFieldVersion.setEnabled(false);
- this.jTextFieldFilePath
- .setToolTipText("<html>Input the workspace path, for example:<br>C:\\MyWorkspace</html>");
- this.jLabelDestinationFile.setText("New Workspace Path");
- }
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelBelong = new JLabel();
- jLabelBelong.setBounds(new java.awt.Rectangle(15, 60, 190, 20));
- jLabelBelong.setText("Clone Package");
- jLabelVersion = new JLabel();
- jLabelVersion.setBounds(new java.awt.Rectangle(15, 160, 190, 20));
- jLabelVersion.setText("Version");
- jLabelGuid = new JLabel();
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 135, 190, 20));
- jLabelGuid.setText("Guid");
- jLabelBaseName = new JLabel();
- jLabelBaseName.setBounds(new java.awt.Rectangle(15, 110, 190, 20));
- jLabelBaseName.setText("Base Name");
- jLabelDestinationFile = new JLabel();
- jLabelDestinationFile.setBounds(new java.awt.Rectangle(15, 85, 190, 20));
- jLabelDestinationFile.setText("Destination File Name");
- jLabelSource = new JLabel();
- jLabelSource.setBounds(new java.awt.Rectangle(15, 35, 190, 20));
- jLabelSource.setText("Source");
- jLabelType = new JLabel();
- jLabelType.setBounds(new java.awt.Rectangle(15, 10, 190, 20));
- jLabelType.setText("Type");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setSize(new java.awt.Dimension(540, 227));
- jContentPane.add(jLabelType, null);
- jContentPane.add(getJTextFieldType(), null);
- jContentPane.add(jLabelSource, null);
- jContentPane.add(getJTextFieldSource(), null);
- jContentPane.add(jLabelDestinationFile, null);
- jContentPane.add(getJTextFieldFilePath(), null);
- jContentPane.add(jLabelBaseName, null);
- jContentPane.add(getJTextFieldBaseName(), null);
- jContentPane.add(jLabelGuid, null);
- jContentPane.add(getJTextFieldGuid(), null);
- jContentPane.add(jLabelVersion, null);
- jContentPane.add(getJTextFieldVersion(), null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonBrowse(), null);
- jContentPane.add(getJButtonGenerateGuid(), null);
- jContentPane.add(jLabelBelong, null);
- jContentPane.add(getJComboBoxExistingPackage(), null);
- }
- 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() == jButtonCancel) {
- this.setVisible(false);
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- }
-
- if (arg0.getSource() == jButtonOk) {
- if (this.check()) {
- try {
- //
- // Save to file
- //
- this.save();
- } catch (IOException e) {
- Log.wrn("Clone", e.getMessage());
- Log.err("Clone", e.getMessage());
- return;
- } catch (XmlException e) {
- Log.wrn("Clone", e.getMessage());
- Log.err("Clone", e.getMessage());
- return;
- } catch (Exception e) {
- Log.wrn("Clone", e.getMessage());
- Log.err("Clone", e.getMessage());
- return;
- }
- } else {
- return;
- }
- this.setVisible(false);
- }
-
- if (arg0.getSource() == this.jButtonGenerateGuid) {
- this.jTextFieldGuid.setText(Tools.generateUuidString());
- }
-
- //
- // Use different file ext for different clone target type
- //
- if (arg0.getSource() == this.jButtonBrowse) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
-
- if (mode == DataType.RETURN_TYPE_WORKSPACE) {
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
- fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- }
- if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- fc.setCurrentDirectory(new File(packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex())
- .getPath()));
- fc.addChoosableFileFilter(new IFileFilter(DataType.MODULE_SURFACE_AREA_EXT));
- }
- if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
- fc.addChoosableFileFilter(new IFileFilter(DataType.PACKAGE_SURFACE_AREA_EXT));
- }
- if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
- fc.addChoosableFileFilter(new IFileFilter(DataType.PLATFORM_SURFACE_AREA_EXT));
- }
- int result = fc.showSaveDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- this.jTextFieldFilePath.setText(Tools.addPathExt(fc.getSelectedFile().getPath(), mode));
- }
- }
- }
-
- /**
- Check name, guid and version.
- If all of them are valid, save information to new id
-
- @retval true All name, guid and version are valid
- @retval false Any one of name, guid and version is invalid
-
- **/
- private boolean checkId(int mode) {
- String name = this.jTextFieldBaseName.getText();
- String guid = this.jTextFieldGuid.getText();
- String version = this.jTextFieldVersion.getText();
-
- //
- // Check Basename
- //
- if (isEmpty(name)) {
- Log.wrn("Clone", "The Name is required!");
- return false;
- }
- if (!DataValidation.isBaseName(name)) {
- Log
- .wrn("Clone",
- "<html>Incorrect data type for the Name, it must<br>be a single word, starting with an alpha character.</html>");
- return false;
- }
-
- //
- // Check Guid
- //
- if (isEmpty(guid)) {
- Log.wrn("Clone", "A Guid is required!!");
- return false;
- }
- if (!DataValidation.isGuid(guid)) {
- Log
- .wrn(
- "Clone",
- "<html>Incorrect data type for Guid, which must<br>be in registry format (8-4-4-4-12) for example:<br>d3adb123-eef1-466d-39ac-02febcaf5997</html>");
- return false;
- }
-
- //
- // Check Version
- //
- if (isEmpty(version)) {
- Log.wrn("Clone", "A Version must be entered!");
- return false;
- }
- if (!DataValidation.isVersion(version)) {
- Log
- .wrn(
- "Clone",
- "<html>Incorrect data type for Version, which must<br>be one or more digits, optionally followed by sequence<br>of one or more dot, one or more digits; examples:<br>1.0 1.0.1 12.25.256</html>");
- return false;
- }
-
- if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- String packageGuid = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getGuid();
- String packageVersion = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getVersion();
- if (GlobalData.findModuleId(guid, version, packageGuid, packageVersion) != null) {
- Log.wrn("Clone", "A module with same Guid and same Version already exists, please selece a new Guid or Version!");
- return false;
- }
- }
-
- if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- if (GlobalData.findPackageId(guid, version) != null) {
- Log.wrn("Clone", "A package with same Guid and same Version already exists, please selece a new Guid or Version!");
- return false;
- }
- }
-
- if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- if (GlobalData.findPlatformId(guid, version) != null) {
- Log.wrn("Clone", "A platform with same Guid and same Version already exists, please selece a new Guid or Version!");
- return false;
- }
- }
-
- //
- // Save information to id
- //
- newId.setName(this.jTextFieldBaseName.getText());
- newId.setGuid(this.jTextFieldGuid.getText());
- newId.setVersion(this.jTextFieldVersion.getText());
- newId.setPath(this.jTextFieldFilePath.getText());
-
- return true;
- }
-
- /**
- Check before save
-
- @retval true All check points are passed
- @retval false Any one of check points is failed
-
- **/
- private boolean check() {
- String src = this.oldId.getPath();
- String trg = this.jTextFieldFilePath.getText();
- File srcFile = new File(src);
- File trgFile = new File(trg);
-
- //
- // Common Check
- //
- if (!srcFile.exists()) {
- Log.wrn("Clone", "The source file does not exist!");
- return false;
- }
- if (isEmpty(trg)) {
- Log.wrn("Clone", "The destination file path must be entered!");
- return false;
- }
- if (src.equals(trg)) {
- Log.wrn("Clone", "The source and destination can not be same!");
- return false;
- }
- if (trgFile.exists()) {
- Log.wrn("Clone", "The destination already exists!");
- return false;
- }
-
- //
- // Check for workspace
- //
- if (mode == DataType.RETURN_TYPE_WORKSPACE) {
- if (trg.indexOf(src + DataType.FILE_SEPARATOR) == 0) {
- Log.wrn("Clone", "The new workspace can not be located within the current workspace!");
- return false;
- }
- }
-
- //
- // Check for Module
- //
- if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- trg = this.getModulePath();
- if (Tools.getFilePathOnly(src).equals(Tools.getFilePathOnly(trg))) {
- Log.wrn("Clone", "The source and destination paths for cloning a module must be different!");
- return false;
- }
- trgFile = new File(trg);
- if (trgFile.exists()) {
- Log.wrn("Clone", "The target module already exists!");
- return false;
- }
-
- //
- // Check if path already exists
- // Currently we allow user to add multiple msa files in one same directory
- // Remove this checkpoint
- //
-// if (GlobalData.isDuplicateRelativePath(Tools.getFilePathOnly(trg), mode)) {
-// Log.wrn("Clone", "There already exists a same directory with a module");
-// return false;
-// }
-
- return checkId(mode);
- }
-
- //
- // Check for Package
- //
- if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- if (trg.indexOf(DataType.DOS_FILE_SEPARATOR) == -1 && trg.indexOf(DataType.UNIX_FILE_SEPARATOR) == -1) {
- Log.wrn("Clone", "The package name must include a path!");
- return false;
- }
- trg = this.getPackagePath();
- if (Tools.getFilePathOnly(src).equals(Tools.getFilePathOnly(trg))) {
- Log.wrn("Clone", "The source and destination paths for cloning a package must be different!");
- return false;
- }
- trgFile = new File(trg);
- if (trgFile.exists()) {
- Log.wrn("Clone", "The target package already exists!");
- return false;
- }
- if (GlobalData.isDuplicateRelativePath(Tools.getFilePathOnly(trg), mode)) {
- Log.wrn("Clone", "There already exists a same directory with a package");
- return false;
- }
-
- return checkId(mode);
- }
-
- //
- // Check for Platform
- //
- if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- if (trg.indexOf(Workspace.getCurrentWorkspace()) != 0) {
- Log.wrn("Clone", "The platform clone must be located in the current workspace!");
- return false;
- }
- if (Tools.getFilePathOnly(src).equals(Tools.getFilePathOnly(trg))) {
- Log.wrn("Clone", "The source and destination paths for cloning a platform must be different!");
- return false;
- }
- trgFile = new File(trg);
- if (trgFile.exists()) {
- Log.wrn("Clone", "The target platform already exists.");
- return false;
- }
- if (GlobalData.isDuplicateRelativePath(Tools.getFilePathOnly(trg), mode)) {
- Log.wrn("Clone", "There already exists a same directory with a platform");
- return false;
- }
-
- return checkId(mode);
- }
-
- return true;
- }
-
- /**
- Save clone target to new location
-
- @throws IOException
- @throws XmlException
- @throws Exception
-
- **/
- private void save() throws IOException, XmlException, Exception {
- String src = this.oldId.getPath();
- String trg = this.jTextFieldFilePath.getText();
- Vector<String> vFiles = new Vector<String>();
-
- //
- // Clone Workspace
- //
- if (mode == DataType.RETURN_TYPE_WORKSPACE) {
- FileOperation.copyFolder(src, trg);
- this.returnType = DataType.RETURN_TYPE_WORKSPACE;
- }
-
- //
- // Clone Module Surface Area
- //
- if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- //
- // Get target path from source path
- //
- trg = getModulePath();
- newId.setPath(trg);
- vFiles = wt.getAllFilesPathOfModule(src);
-
- String oldPackagePath = GlobalData.openingModuleList.getIdByPath(src).getPackageId().getPath();
- String newPackagePath = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getPath();
-
- //
- // First copy all files to new directory
- //
- FileOperation.copyFile(src, trg);
- for (int index = 1; index < vFiles.size(); index++) {
- String oldFile = vFiles.get(index);
- String newFile = "";
- if (oldFile.indexOf(Tools.getFilePathOnly(src)) > -1) {
- //
- // The file is not include header
- //
- newFile = oldFile.replace(Tools.getFilePathOnly(src), Tools.getFilePathOnly(trg));
- } else if (oldFile.indexOf(Tools.getFilePathOnly(oldPackagePath)) > -1) {
- //
- // The file is include header
- //
- newFile = oldFile.replace(Tools.getFilePathOnly(oldPackagePath),
- Tools.getFilePathOnly(newPackagePath));
- }
-
- FileOperation.copyFile(oldFile, newFile);
- }
-
- //
- // Create new msa file
- //
- ModuleSurfaceArea msa = null;
- msa = OpenFile.openMsaFile(src);
-
- //
- // Update to memory
- //
- msa.getMsaHeader().setModuleName(newId.getName());
- msa.getMsaHeader().setGuidValue(newId.getGuid());
- msa.getMsaHeader().setVersion(newId.getVersion());
-
- //
- // Update <Cloned> Section
- //
- updateModuleClonedId(msa, oldId);
-
- //
- // Save to file
- //
- SaveFile.saveMsaFile(trg, msa);
-
- //
- // Update to platformId
- //
- this.setMid(new ModuleIdentification(newId,
- packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex())));
-
- //
- // Open belonging package
- //
- PackageSurfaceArea psa = PackageSurfaceArea.Factory.newInstance();
- psa = OpenFile.openSpdFile(mid.getPackageId().getPath());
-
- //
- // Update the db file
- //
- wt.addModuleToPackage(mid, psa);
-
- //
- // Update GlobalData
- //
- GlobalData.vModuleList.addElement(mid);
- GlobalData.openingModuleList.insertToOpeningModuleList(mid, msa);
-
- this.returnType = DataType.RETURN_TYPE_MODULE_SURFACE_AREA;
- }
-
- //
- // Clone Package Surface Area
- //
- if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- //
- // Get target path from source path
- //
- trg = this.getPackagePath();
- newId.setPath(trg);
- vFiles = wt.getAllFilesPathOfPakcage(src);
-
- //
- // First copy all files to new directory
- //
- FileOperation.copyFile(src, trg);
- for (int index = 1; index < vFiles.size(); index++) {
- String oldFile = vFiles.get(index);
- String newFile = vFiles.get(index).replace(Tools.getFilePathOnly(src), Tools.getFilePathOnly(trg));
- FileOperation.copyFile(oldFile, newFile);
- }
-
- //
- // Create new spd file
- //
- PackageSurfaceArea spd = null;
- spd = OpenFile.openSpdFile(src);
-
- //
- // Update to memory
- //
- spd.getSpdHeader().setPackageName(newId.getName());
- spd.getSpdHeader().setGuidValue(newId.getGuid());
- spd.getSpdHeader().setVersion(newId.getVersion());
-
- //
- // Update <Cloned> Section
- //
- updatePackageClonedId(spd, oldId);
-
- //
- // Save to file
- //
- SaveFile.saveSpdFile(trg, spd);
-
- //
- // Update to platformId
- //
- this.setPid(new PackageIdentification(newId));
-
- //
- // Update the db file
- //
- wt.addPackageToDatabase(pid);
-
- //
- // Update GlobalData
- //
- GlobalData.vPackageList.addElement(pid);
- GlobalData.openingPackageList.insertToOpeningPackageList(pid, spd);
-
- //
- // Add all cloned modules
- //
- Vector<String> modulePaths = GlobalData.getAllModulesOfPackage(pid.getPath());
- String modulePath = null;
- ModuleSurfaceArea msa = null;
-
- for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {
- try {
- modulePath = modulePaths.get(indexJ);
- msa = OpenFile.openMsaFile(modulePath);
- } catch (IOException e) {
- Log.err("Open Module Surface Area " + modulePath, e.getMessage());
- continue;
- } catch (XmlException e) {
- Log.err("Open Module Surface Area " + modulePath, e.getMessage());
- continue;
- } catch (Exception e) {
- Log.err("Open Module Surface Area " + modulePath, "Invalid file type");
- continue;
- }
- Identification id = Tools.getId(modulePath, msa);
- mid = new ModuleIdentification(id, pid);
- GlobalData.vModuleList.addElement(mid);
- GlobalData.openingModuleList.insertToOpeningModuleList(mid, msa);
- }
-
- this.returnType = DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA;
- }
-
- //
- // Clone Platform Surface Area
- //
- if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- PlatformSurfaceArea fpd = null;
- fpd = OpenFile.openFpdFile(src);
-
- //
- // Update to memory
- //
- fpd.getPlatformHeader().setPlatformName(newId.getName());
- fpd.getPlatformHeader().setGuidValue(newId.getGuid());
- fpd.getPlatformHeader().setVersion(newId.getVersion());
-
- //
- // Update Cloned From element
- //
- updatePlatformClonedId(fpd, oldId);
-
- //
- // Save to file
- //
- SaveFile.saveFpdFile(trg, fpd);
-
- //
- // Update to platformId
- //
- this.setFid(new PlatformIdentification(newId));
-
- //
- // Update the db file
- //
- wt.addPlatformToDatabase(fid);
-
- //
- // Update GlobalData
- //
- GlobalData.vPlatformList.addElement(fid);
- GlobalData.openingPlatformList.insertToOpeningPlatformList(fid, fpd);
-
- this.returnType = DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA;
- }
- vFiles = null;
- }
-
- /**
- Get the path of selected package
-
- @return String The path of selected package
-
- **/
- private String getSelectPackagePath() {
- return Tools.getFilePathOnly(packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getPath());
- }
-
- /**
- Get the path of source module
- Since the path of source module is relative, make it up to full path.
-
- @return String The full path of source module
-
- **/
- private String getModulePath() {
- String trg = this.jTextFieldFilePath.getText();
- trg = Tools.addPathExt(trg, mode);
- trg = Tools.addFileSeparator(getSelectPackagePath()) + trg;
- Tools.convertPathToCurrentOsType(trg);
- return trg;
- }
-
- /**
- Get the path of source package
- Since the path of source package is relative, make it up to full path.
-
- @return String The full path of source package
-
- **/
- private String getPackagePath() {
- String trg = this.jTextFieldFilePath.getText();
- trg = Tools.addPathExt(trg, mode);
- trg = Tools.addFileSeparator(Workspace.getCurrentWorkspace()) + trg;
- trg = Tools.convertPathToCurrentOsType(trg);
- return trg;
- }
-
- /**
- Set msa file's <Cloned> section via given identification
-
- @param msa ModuleSurfaceArea for clone target
- @param id Identification of clone source
-
- **/
- private void updateModuleClonedId(ModuleSurfaceArea msa, Identification id) {
- //
- // Get PlatformDefinitions First
- //
- ModuleDefinitions pd = null;
- if (msa.getModuleDefinitions() == null) {
- pd = ModuleDefinitions.Factory.newInstance();
- msa.addNewModuleDefinitions();
- } else {
- pd = msa.getModuleDefinitions();
- }
-
- //
- // Get ClonedFrom then
- //
- ModuleDefinitions.ClonedFrom cf = null;
- BigInteger count = new BigInteger("-1");
- if (pd.getClonedFrom() == null) {
- cf = ModuleDefinitions.ClonedFrom.Factory.newInstance();
- } else {
- cf = pd.getClonedFrom();
- if (cf != null) {
- for (int index = 0; index < cf.getClonedList().size(); index++) {
- if (cf.getClonedList().get(index).getId() != null) {
- count = count.max(cf.getClonedList().get(index).getId());
- }
- }
- }
- }
-
- //
- // Set new Cloned item
- //
- ModuleDefinitions.ClonedFrom.Cloned c = ModuleDefinitions.ClonedFrom.Cloned.Factory.newInstance();
- c.setModuleGuid(id.getGuid());
- c.setModuleVersion(id.getVersion());
- c.setPackageGuid(wt.getPackageIdByModuleId(oldId).getGuid());
- c.setPackageVersion(wt.getPackageIdByModuleId(oldId).getVersion());
- c.setId(count.add(new BigInteger("1")));
- String guid = wt.getModuleFarGuid(oldId);
- if (guid != null && !guid.equals("")) {
- c.setFarGuid(guid);
- }
-
- cf.addNewCloned();
- cf.setClonedArray(cf.getClonedList().size() - 1, c);
- pd.addNewClonedFrom();
- pd.setClonedFrom(cf);
- msa.setModuleDefinitions(pd);
- }
-
- /**
- Set spd file's <Cloned> section via given identification
-
- @param spd PackageSurfaceArea for clone target
- @param id Identification of clone source
-
- **/
- private void updatePackageClonedId(PackageSurfaceArea spd, Identification id) {
- //
- // Get PlatformDefinitions First
- //
- PackageDefinitions pd = null;
- if (spd.getPackageDefinitions() == null) {
- pd = PackageDefinitions.Factory.newInstance();
- spd.addNewPackageDefinitions();
- } else {
- pd = spd.getPackageDefinitions();
- }
-
- //
- // Get ClonedFrom then
- //
- PackageDefinitions.ClonedFrom cf = null;
- BigInteger count = new BigInteger("-1");
- if (pd.getClonedFrom() == null) {
- cf = PackageDefinitions.ClonedFrom.Factory.newInstance();
- } else {
- cf = pd.getClonedFrom();
- if (cf != null) {
- for (int index = 0; index < cf.getClonedList().size(); index++) {
- if (cf.getClonedList().get(index).getId() != null) {
- count = count.max(cf.getClonedList().get(index).getId());
- }
- }
- }
- }
-
- //
- // Set new Cloned item
- //
- PackageDefinitions.ClonedFrom.Cloned c = PackageDefinitions.ClonedFrom.Cloned.Factory.newInstance();
- c.setPackageGuid(id.getGuid());
- c.setPackageVersion(id.getVersion());
- c.setId(count.add(new BigInteger("1")));
- String guid = wt.getPackageFarGuid(oldId);
- if (guid != null && !guid.equals("")) {
- c.setFarGuid(guid);
- }
-
- cf.addNewCloned();
- cf.setClonedArray(cf.getClonedList().size() - 1, c);
- pd.addNewClonedFrom();
- pd.setClonedFrom(cf);
- spd.setPackageDefinitions(pd);
- }
-
- /**
- Set fpd file's <Cloned> section via given identification
-
- @param fpd PlatformSurfaceArea for clone target
- @param id Identification of clone source
-
- **/
- private void updatePlatformClonedId(PlatformSurfaceArea fpd, Identification id) {
- //
- // Get PlatformDefinitions First
- //
- PlatformDefinitions pd = null;
- if (fpd.getPlatformDefinitions() == null) {
- pd = PlatformDefinitions.Factory.newInstance();
- fpd.addNewPlatformDefinitions();
- } else {
- pd = fpd.getPlatformDefinitions();
- }
-
- //
- // Get ClonedFrom then
- //
- PlatformDefinitions.ClonedFrom cf = null;
- BigInteger count = new BigInteger("-1");
- if (pd.getClonedFrom() == null) {
- cf = PlatformDefinitions.ClonedFrom.Factory.newInstance();
- } else {
- cf = pd.getClonedFrom();
- if (cf != null) {
- for (int index = 0; index < cf.getClonedList().size(); index++) {
- if (cf.getClonedList().get(index).getId() != null) {
- count = count.max(cf.getClonedList().get(index).getId());
- }
- }
- }
- }
-
- //
- // Set new Cloned item
- //
- PlatformDefinitions.ClonedFrom.Cloned c = PlatformDefinitions.ClonedFrom.Cloned.Factory.newInstance();
- c.setPlatformGuid(id.getGuid());
- c.setPlatformVersion(id.getVersion());
- c.setId(count.add(new BigInteger("1")));
- String guid = wt.getPlatformFarGuid(oldId);
- if (guid != null && !guid.equals("")) {
- c.setFarGuid(guid);
- }
-
- cf.addNewCloned();
- cf.setClonedArray(cf.getClonedList().size() - 1, c);
- pd.addNewClonedFrom();
- pd.setClonedFrom(cf);
- fpd.setPlatformDefinitions(pd);
- }
-
- /**
- Get PlatformIdentification
-
- @return PlatformIdentification
-
- **/
- public PlatformIdentification getFid() {
- return fid;
- }
-
- /**
- Set PlatformIdentification
-
- @param fid PlatformIdentification
-
- **/
- public void setFid(PlatformIdentification fid) {
- this.fid = fid;
- }
-
- /**
- Get ModuleIdentification
-
- @return ModuleIdentification
-
- **/
- public ModuleIdentification getMid() {
- return mid;
- }
-
- /**
- Set ModuleIdentification
-
- @param mid ModuleIdentification
-
- **/
- public void setMid(ModuleIdentification mid) {
- this.mid = mid;
- }
-
- /**
- Get PackageIdentification
-
- @return PackageIdentification
-
- **/
- public PackageIdentification getPid() {
- return pid;
- }
-
- /**
- Set PackageIdentification
-
- @param pid PackageIdentification
-
- **/
- public void setPid(PackageIdentification pid) {
- this.pid = pid;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java deleted file mode 100644 index 69d47423a5..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java +++ /dev/null @@ -1,3789 +0,0 @@ -/** @file
-
- The main GUI for module editor.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.WindowEvent;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JDesktopPane;
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JInternalFrame;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JSplitPane;
-import javax.swing.JTabbedPane;
-import javax.swing.ToolTipManager;
-import javax.swing.event.MenuEvent;
-import javax.swing.event.MenuListener;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.event.TreeSelectionListener;
-import javax.swing.tree.TreePath;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.IFileFilter;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.SaveFile;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.find.FindResult;
-import org.tianocore.frameworkwizard.common.ui.IDefaultMutableTreeNode;
-import org.tianocore.frameworkwizard.common.ui.IDesktopManager;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.ITree;
-import org.tianocore.frameworkwizard.far.createui.CreateStepOne;
-import org.tianocore.frameworkwizard.far.deleteui.DeleteStepOne;
-import org.tianocore.frameworkwizard.far.installui.InstallStepOne;
-import org.tianocore.frameworkwizard.far.updateui.UpdateStepOne;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.ui.ModuleBootModes;
-import org.tianocore.frameworkwizard.module.ui.ModuleBuildOptions;
-import org.tianocore.frameworkwizard.module.ui.ModuleDataHubs;
-import org.tianocore.frameworkwizard.module.ui.ModuleEvents;
-import org.tianocore.frameworkwizard.module.ui.ModuleExterns;
-import org.tianocore.frameworkwizard.module.ui.ModuleGuids;
-import org.tianocore.frameworkwizard.module.ui.ModuleHiiPackages;
-import org.tianocore.frameworkwizard.module.ui.ModuleHobs;
-import org.tianocore.frameworkwizard.module.ui.ModuleLibraryClassDefinitions;
-import org.tianocore.frameworkwizard.module.ui.ModulePCDs;
-import org.tianocore.frameworkwizard.module.ui.ModulePackageDependencies;
-import org.tianocore.frameworkwizard.module.ui.ModulePpis;
-import org.tianocore.frameworkwizard.module.ui.ModuleProtocols;
-import org.tianocore.frameworkwizard.module.ui.ModuleSourceFiles;
-import org.tianocore.frameworkwizard.module.ui.ModuleSystemTables;
-import org.tianocore.frameworkwizard.module.ui.ModuleVariables;
-import org.tianocore.frameworkwizard.module.ui.MsaHeader;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.packaging.ui.SpdGuidDecls;
-import org.tianocore.frameworkwizard.packaging.ui.SpdHeader;
-import org.tianocore.frameworkwizard.packaging.ui.SpdLibClassDecls;
-import org.tianocore.frameworkwizard.packaging.ui.SpdMsaFiles;
-import org.tianocore.frameworkwizard.packaging.ui.SpdPackageHeaders;
-import org.tianocore.frameworkwizard.packaging.ui.SpdPcdDefs;
-import org.tianocore.frameworkwizard.packaging.ui.SpdPpiDecls;
-import org.tianocore.frameworkwizard.packaging.ui.SpdProtocolDecls;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.platform.ui.FpdBuildOptions;
-import org.tianocore.frameworkwizard.platform.ui.FpdDynamicPcdBuildDefinitions;
-import org.tianocore.frameworkwizard.platform.ui.FpdFlash;
-import org.tianocore.frameworkwizard.platform.ui.FpdFrameworkModules;
-import org.tianocore.frameworkwizard.platform.ui.FpdHeader;
-import org.tianocore.frameworkwizard.platform.ui.FpdPlatformDefs;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-import org.tianocore.frameworkwizard.workspace.ui.SwitchWorkspace;
-import org.tianocore.frameworkwizard.toolchain.Preferences;
-
-/**
- The class is used to show main GUI of FrameworkWizard
- It extends IFrame implements MouseListener, TreeSelectionListener, ComponentListener and MenuListener
-
- **/
-public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListener, TreeSelectionListener,
- MenuListener {
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -7103240960573031772L;
-
- //
- // Set ToolTipText Show Time
- //
- static { ToolTipManager.sharedInstance().setDismissDelay(18000); }
-
- ///
- /// Used to record current operation target
- ///
- private int currentOpeningModuleIndex = -1;
-
- private int currentOpeningPackageIndex = -1;
-
- private int currentOpeningPlatformIndex = -1;
-
- ///
- /// Used to generate tree structure
- ///
- private IDefaultMutableTreeNode dmtnRoot = null;
-
- private IDefaultMutableTreeNode dmtnModuleDescription = null;
-
- private IDefaultMutableTreeNode dmtnPackageDescription = null;
-
- private IDefaultMutableTreeNode dmtnPlatformDescription = null;
-
- ///
- /// Used for UI
- ///
- private JPanel jContentPane = null;
-
- private JMenuBar jMenuBar = null;
-
- private JMenu jMenuFile = null;
-
- private JMenuItem jMenuItemFileNew = null;
-
- private JMenuItem jMenuItemFileRefresh = null;
-
- private JMenuItem jMenuItemFileSaveAs = null;
-
- private JMenuItem jMenuItemFileExit = null;
-
- private JMenu jMenuEdit = null;
-
- private JDesktopPane jDesktopPaneModule = null;
-
- private JDesktopPane jDesktopPanePackage = null;
-
- private JDesktopPane jDesktopPanePlatform = null;
-
- private JTabbedPane jTabbedPaneTree = null;
-
- private JTabbedPane jTabbedPaneEditor = null;
-
- private IDesktopManager iDesktopManager = new IDesktopManager();
-
- private JScrollPane jScrollPaneTree = null;
-
- private ITree iTree = null;
-
- private JMenu jMenuHelp = null;
-
- private JMenuItem jMenuItemHelpAbout = null;
-
- private JMenuItem jMenuItemEditDelete = null;
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private JMenuItem jMenuItemFileSave = null;
-
- private JMenuItem jMenuItemFileClose = null;
-
- private JMenu jMenuTools = null;
-
- private JMenu jMenuWindow = null;
-
- private JPanel jPanelOperation = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private JMenuItem jMenuItemFileOpen = null;
-
- private JMenuItem jMenuItemFileCloseAll = null;
-
- private JMenuItem jMenuItemFileSaveAll = null;
-
- private JMenuItem jMenuItemFilePageSetup = null;
-
- private JMenuItem jMenuItemFilePrint = null;
-
- private JMenuItem jMenuItemFileImport = null;
-
- private JMenuItem jMenuItemFileProperties = null;
-
- private JMenu jMenuFileRecentFiles = null;
-
- private JSplitPane jSplitPane = null;
-
- private JMenuItem jMenuItemEditUndo = null;
-
- private JMenuItem jMenuItemEditRedo = null;
-
- private JMenuItem jMenuItemEditCut = null;
-
- private JMenuItem jMenuItemEditCopy = null;
-
- private JMenuItem jMenuItemEditPaste = null;
-
- private JMenuItem jMenuItemEditSelectAll = null;
-
- private JMenuItem jMenuItemEditFindNext = null;
-
- private JMenu jMenuView = null;
-
- private JMenu jMenuViewToolbars = null;
-
- private JCheckBoxMenuItem jCheckBoxMenuItemViewToolbarsFile = null;
-
- private JCheckBoxMenuItem jCheckBoxMenuItemViewToolbarsEdit = null;
-
- private JCheckBoxMenuItem jCheckBoxMenuItemViewToolbarsWindow = null;
-
- private JMenuItem jMenuItemViewStandard = null;
-
- private JMenuItem jMenuItemViewAdvanced = null;
-
- private JMenu jMenuProject = null;
-
- private JMenuItem jMenuItemProjectAdmin = null;
-
- private JMenuItem jMenuItemProjectChangeWorkspace = null;
-
- private JMenuItem jMenuItemToolsBuildPreferences = null;
-
- // private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsDebug = null;
-
- // private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsRelease = null;
-
- private JMenuItem jMenuItemToolsToolChainConfiguration = null;
-
- private JMenuItem jMenuItemToolsClone = null;
-
- private JMenuItem jMenuItemToolsCodeScan = null;
-
- private JMenuItem jMenuItemWindowDisplaySide = null;
-
- private JMenuItem jMenuItemWindowDisplayTopBottom = null;
-
- private JMenuItem jMenuItemViewXML = null;
-
- private JMenuItem jMenuItemWindowTabView = null;
-
- private JMenuItem jMenuItemWindowSource = null;
-
- private JMenuItem jMenuItemWindowXML = null;
-
- private JMenuItem jMenuItemWindowPreferences = null;
-
- private JMenuItem jMenuItemHelpContents = null;
-
- private JMenuItem jMenuItemHelpIndex = null;
-
- private JMenuItem jMenuItemHelpSearch = null;
-
- private JMenuItem jMenuItemProjectInstallFar = null;
-
- private JMenuItem jMenuItemProjectUpdateFar = null;
-
- private JMenuItem jMenuItemProjectRemoveFar = null;
-
- private JMenuItem jMenuItemProjectCreateFar = null;
-
- private JMenu jMenuEditFind = null;
-
- private JMenuItem jMenuItemEditFindPcd = null;
-
- private JMenuItem jMenuItemEditFindLibraryClass = null;
-
- private JMenuItem jMenuItemEditFindPpi = null;
-
- private JMenuItem jMenuItemEditFindProtocol = null;
-
- private JMenuItem jMenuItemEditFindGuid = null;
-
- private JMenuItem jMenuItemEditFindLibraryInstance = null;
-
- ///
- /// A static definition for this class itself
- ///
- private static FrameworkWizardUI fwui = null;
-
- private JMenuItem jMenuItemToolsGenerateGuidsXref = null;
-
- /**
- If the class hasn't an instnace, new one.
-
- @return FrameworkWizardUI The instance of this class
-
- **/
- public static FrameworkWizardUI getInstance(String[] args) {
- if (fwui == null) {
- fwui = new FrameworkWizardUI(args);
- }
- return fwui;
- }
-
- /**
- If the class hasn't an instnace, new one.
-
- @return FrameworkWizardUI The instance of this class
-
- **/
- public static FrameworkWizardUI getInstance() {
- return fwui;
- }
-
- /**
- This method initializes jMenuBar
-
- @return javax.swing.JMenuBar Main menu bar for the entire GUI
-
- **/
- private JMenuBar getjJMenuBar() {
- if (jMenuBar == null) {
- jMenuBar = new JMenuBar();
- jMenuBar.setPreferredSize(new java.awt.Dimension(0, 18));
- jMenuBar.add(getJMenuFile());
- jMenuBar.add(getJMenuEdit());
- jMenuBar.add(getJMenuView());
- jMenuBar.add(getJMenuProject());
- jMenuBar.add(getJMenuTools());
- jMenuBar.add(getJMenuWindow());
- jMenuBar.add(getJMenuHelp());
- }
- return jMenuBar;
- }
-
- /**
- This method initializes jSplitPane
-
- @return javax.swing.JSplitPane
-
- **/
- private JSplitPane getJSplitPane() {
- if (jSplitPane == null) {
- jSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, getJTabbedPaneTree(), getJTabbedPaneEditor());
- jSplitPane.setBounds(new java.awt.Rectangle(0, 1, DataType.MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_HEIGHT));
- jSplitPane.addComponentListener(this);
- }
- return jSplitPane;
- }
-
- /**
- This method initializes jTabbedPaneEditor
-
- @return javax.swing.JTabbedPane
-
- **/
- private JTabbedPane getJTabbedPaneEditor() {
- if (jTabbedPaneEditor == null) {
- jTabbedPaneEditor = new JTabbedPane();
- jTabbedPaneEditor.setBounds(new java.awt.Rectangle(DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_X,
- DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
- jTabbedPaneEditor
- .setMinimumSize(new java.awt.Dimension(
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
- jTabbedPaneEditor.addTab("Module", null, getJDesktopPaneModule(), null);
- jTabbedPaneEditor.addTab("Package", null, getJDesktopPanePackage(), null);
- jTabbedPaneEditor.addTab("Platform", null, getJDesktopPanePlatform(), null);
- }
- return jTabbedPaneEditor;
- }
-
- /**
- This method initializes jTabbedPaneTree
-
- @return javax.swing.JTabbedPane
-
- **/
- private JTabbedPane getJTabbedPaneTree() {
- if (jTabbedPaneTree == null) {
- jTabbedPaneTree = new JTabbedPane();
- jTabbedPaneTree
- .setPreferredSize(new java.awt.Dimension(
- DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT));
- jTabbedPaneTree
- .setMinimumSize(new java.awt.Dimension(DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT));
- jTabbedPaneTree.addTab("Workspace Explorer", null, getJScrollPaneTree(), null);
- }
- return jTabbedPaneTree;
- }
-
- /**
- This method initializes jMenuFile
-
- @return javax.swing.JMenu jMenuModule
-
- **/
- private JMenu getJMenuFile() {
- if (jMenuFile == null) {
- //
- // Set jMenuFile's attributes
- //
- jMenuFile = new JMenu();
- jMenuFile.setText("File");
- jMenuFile.setMnemonic('F');
- jMenuFile.addMenuListener(this);
-
- //
- // Add sub menu items
- //
- jMenuFile.add(getJMenuItemFileNew());
- jMenuFile.add(getJMenuItemFileOpen());
- jMenuFile.add(getJMenuItemFileClose());
- jMenuFile.add(getJMenuItemFileCloseAll());
- jMenuFile.addSeparator();
-
- jMenuFile.add(getJMenuFileRecentFiles());
- jMenuFile.add(getJMenuItemFileSave());
- jMenuFile.add(getJMenuItemFileSaveAs());
- jMenuFile.add(getJMenuItemFileSaveAll());
- jMenuFile.addSeparator();
-
- jMenuFile.add(getJMenuItemFileRefresh());
- jMenuFile.addSeparator();
-
- jMenuFile.add(getJMenuItemFilePageSetup());
- jMenuFile.add(getJMenuItemFilePrint());
- jMenuFile.add(getJMenuItemFileImport());
- jMenuFile.add(getJMenuItemFileProperties());
-
- jMenuFile.add(getJMenuItemFileExit());
- }
- return jMenuFile;
- }
-
- /**
- This method initializes jMenuItemFileSaveAs
-
- @return javax.swing.JMenuItem jMenuItemFileSaveAs
-
- **/
- private JMenuItem getJMenuItemFileSaveAs() {
- if (jMenuItemFileSaveAs == null) {
- jMenuItemFileSaveAs = new JMenuItem();
- jMenuItemFileSaveAs.setText("Save As...");
- jMenuItemFileSaveAs.setMnemonic('a');
- jMenuItemFileSaveAs.addActionListener(this);
- jMenuItemFileSaveAs.setEnabled(false);
- jMenuItemFileSaveAs.setVisible(false);
- }
- return jMenuItemFileSaveAs;
- }
-
- /**
- This method initializes jMenuItemFileRefresh
-
- @return javax.swing.JMenuItem jMenuItemFileRefresh
-
- **/
- private JMenuItem getJMenuItemFileRefresh() {
- if (jMenuItemFileRefresh == null) {
- jMenuItemFileRefresh = new JMenuItem();
- jMenuItemFileRefresh.setText("Refresh");
- jMenuItemFileRefresh.setMnemonic('R');
- jMenuItemFileRefresh.addActionListener(this);
- jMenuItemFileRefresh.setVisible(true);
- }
- return jMenuItemFileRefresh;
- }
-
- /**
- This method initializes jMenuItemModuleExit
-
- @return javax.swing.JMenuItem jMenuItemModuleExit
-
- **/
- private JMenuItem getJMenuItemFileExit() {
- if (jMenuItemFileExit == null) {
- jMenuItemFileExit = new JMenuItem();
- jMenuItemFileExit.setText("Exit");
- jMenuItemFileExit.setMnemonic('x');
- jMenuItemFileExit.addActionListener(this);
- }
- return jMenuItemFileExit;
- }
-
- /**
- This method initializes jMenuEdit
-
- @return javax.swing.JMenu jMenuEdit
-
- **/
- private JMenu getJMenuEdit() {
- if (jMenuEdit == null) {
- //
- // Set jMenuEdit's attributes
- //
- jMenuEdit = new JMenu();
- jMenuEdit.setText("Edit");
- jMenuEdit.setMnemonic('E');
- jMenuEdit.setVisible(true);
-
- //
- // Add sub menu items
- //
- jMenuEdit.add(getJMenuItemEditUndo());
- jMenuEdit.add(getJMenuItemEditRedo());
- //jMenuEdit.addSeparator();
-
- jMenuEdit.add(getJMenuItemEditCut());
- jMenuEdit.add(getJMenuItemEditCopy());
- jMenuEdit.add(getJMenuItemEditPaste());
- jMenuEdit.add(getJMenuItemEditDelete());
- //jMenuEdit.addSeparator();
-
- jMenuEdit.add(getJMenuItemEditSelectAll());
- jMenuEdit.add(getJMenuEditFind());
- jMenuEdit.add(getJMenuItemEditFindNext());
- //jMenuEdit.addSeparator();
- }
- return jMenuEdit;
- }
-
- /**
- This method initializes jDesktopPane
-
- @return javax.swing.JDesktopPane jDesktopPane
-
- **/
- private JDesktopPane getJDesktopPaneModule() {
- if (jDesktopPaneModule == null) {
- jDesktopPaneModule = new JDesktopPane();
- jDesktopPaneModule
- .setBounds(new java.awt.Rectangle(DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_X,
- DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
- jDesktopPaneModule
- .setMinimumSize(new java.awt.Dimension(
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
- jDesktopPaneModule.setDesktopManager(iDesktopManager);
- jDesktopPaneModule.addComponentListener(this);
- }
- return jDesktopPaneModule;
- }
-
- /**
- This method initializes jDesktopPane
-
- @return javax.swing.JDesktopPane jDesktopPane
-
- **/
- private JDesktopPane getJDesktopPanePackage() {
- if (jDesktopPanePackage == null) {
- jDesktopPanePackage = new JDesktopPane();
- jDesktopPanePackage
- .setBounds(new java.awt.Rectangle(DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_X,
- DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
- jDesktopPanePackage
- .setMinimumSize(new java.awt.Dimension(
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
- jDesktopPanePackage.setDesktopManager(iDesktopManager);
- jDesktopPanePackage.addComponentListener(this);
- }
- return jDesktopPanePackage;
- }
-
- /**
- This method initializes jDesktopPane
-
- @return javax.swing.JDesktopPane jDesktopPane
-
- **/
- private JDesktopPane getJDesktopPanePlatform() {
- if (jDesktopPanePlatform == null) {
- jDesktopPanePlatform = new JDesktopPane();
- jDesktopPanePlatform
- .setBounds(new java.awt.Rectangle(
- DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_X,
- DataType.MAIN_FRAME_EDITOR_PANEL_LOCATION_Y,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
- jDesktopPanePlatform
- .setMinimumSize(new java.awt.Dimension(
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT));
- jDesktopPanePlatform.setDesktopManager(iDesktopManager);
- jDesktopPanePlatform.addComponentListener(this);
- }
- return jDesktopPanePlatform;
- }
-
- /**
- This method initializes jScrollPaneTree
-
- @return javax.swing.JScrollPane jScrollPaneTree
-
- **/
- private JScrollPane getJScrollPaneTree() {
- if (jScrollPaneTree == null) {
- jScrollPaneTree = new JScrollPane();
- jScrollPaneTree
- .setPreferredSize(new java.awt.Dimension(
- DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH,
- DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT));
- jScrollPaneTree
- .setMinimumSize(new java.awt.Dimension(
- DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH / 2,
- DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT));
- jScrollPaneTree.setViewportView(getITree());
- }
- return jScrollPaneTree;
- }
-
- /**
- This method initializes iTree
-
- @return org.tianocore.packaging.common.ui.ITree iTree
-
- **/
- private ITree getITree() {
- //
- //Before open a real module, use an empty root node for the tree
- //
- makeEmptyTree();
- return iTree;
- }
-
- /**
- This method initializes jMenuHelp
-
- @return javax.swing.JMenu jMenuHelp
-
- **/
- private JMenu getJMenuHelp() {
- if (jMenuHelp == null) {
- //
- // Set jMenuHelp's attributes
- //
- jMenuHelp = new JMenu();
- jMenuHelp.setText("Help");
- jMenuHelp.setMnemonic('H');
-
- //
- // Add sub menu items
- //
- jMenuHelp.add(getJMenuItemHelpContents());
- jMenuHelp.add(getJMenuItemHelpIndex());
- jMenuHelp.add(getJMenuItemHelpSearch());
-
- jMenuHelp.add(getJMenuItemHelpAbout());
- }
- return jMenuHelp;
- }
-
- /**
- This method initializes jMenuItemHelpAbout
-
- @return javax.swing.JMenuItem jMenuItemHelpAbout
-
- **/
- private JMenuItem getJMenuItemHelpAbout() {
- if (jMenuItemHelpAbout == null) {
- jMenuItemHelpAbout = new JMenuItem();
- jMenuItemHelpAbout.setText("About");
- jMenuItemHelpAbout.setMnemonic('A');
- jMenuItemHelpAbout.addActionListener(this);
- }
- return jMenuItemHelpAbout;
- }
-
- /**
- This method initializes jMenuItemEditDelete
-
- @return javax.swing.JMenuItem jMenuItemEditDelete
-
- **/
- private JMenuItem getJMenuItemEditDelete() {
- if (jMenuItemEditDelete == null) {
- jMenuItemEditDelete = new JMenuItem();
- jMenuItemEditDelete.setText("Delete");
- jMenuItemEditDelete.setMnemonic('D');
- jMenuItemEditDelete.setVisible(false);
- jMenuItemEditDelete.setEnabled(false);
- jMenuItemEditDelete.addActionListener(this);
- //
- //Disabled first when no module is open
- //
- jMenuItemEditDelete.setEnabled(false);
- }
- return jMenuItemEditDelete;
- }
-
- /**
- This method initializes jMenuFileNew
-
- @return javax.swing.JMenuItem jMenuFileNew
-
- **/
- private JMenuItem getJMenuItemFileNew() {
- if (jMenuItemFileNew == null) {
- jMenuItemFileNew = new JMenuItem();
- jMenuItemFileNew.setText("New...");
- jMenuItemFileNew.setMnemonic('N');
- jMenuItemFileNew.addActionListener(this);
- }
- return jMenuItemFileNew;
- }
-
- /**
- This method initializes jMenuItemFileSave
-
- @return javax.swing.JMenuItem jMenuItemModuleSave
-
- **/
- private JMenuItem getJMenuItemFileSave() {
- if (jMenuItemFileSave == null) {
- jMenuItemFileSave = new JMenuItem();
- jMenuItemFileSave.setText("Save");
- jMenuItemFileSave.setMnemonic('S');
- jMenuItemFileSave.addActionListener(this);
- jMenuItemFileSave.setEnabled(true);
- }
- return jMenuItemFileSave;
- }
-
- /**
- This method initializes jMenuItemModuleClose
-
- @return javax.swing.JMenuItem jMenuItemModuleClose
-
- **/
- private JMenuItem getJMenuItemFileClose() {
- if (jMenuItemFileClose == null) {
- jMenuItemFileClose = new JMenuItem();
- jMenuItemFileClose.setText("Close");
- jMenuItemFileClose.setMnemonic('C');
- jMenuItemFileClose.setEnabled(true);
- jMenuItemFileClose.addActionListener(this);
- }
- return jMenuItemFileClose;
- }
-
- /**
- This method initializes jMenuTools
- Reserved
-
- @return javax.swing.JMenu jMenuTools
-
- **/
- private JMenu getJMenuTools() {
- if (jMenuTools == null) {
- //
- // Set jMenuTools's attributes
- //
- jMenuTools = new JMenu();
- jMenuTools.setText("Tools");
- jMenuTools.setMnemonic('T');
- jMenuTools.addMenuListener(this);
-
- //
- // Add sub menu items
- //
-
- jMenuTools.add(getJMenuItemToolsClone());
- jMenuTools.add(getJMenuItemToolsCodeScan());
- jMenuTools.addSeparator();
-
- jMenuTools.add(getJMenuItemToolsToolChainConfiguration());
- jMenuTools.add(getJMenuItemToolsBuildPreferences());
- jMenuTools.addSeparator();
-
- jMenuTools.add(getJMenuItemToolsGenerateGuidsXref());
- }
- return jMenuTools;
- }
-
- /**
- This method initializes jMenuWindow
- Reserved
-
- @return javax.swing.JMenu jMenuWindow
-
- **/
- private JMenu getJMenuWindow() {
- if (jMenuWindow == null) {
- //
- // Set jMenuWindow's attribute
- //
- jMenuWindow = new JMenu();
- jMenuWindow.setText("Window");
- jMenuWindow.setMnemonic('W');
- jMenuWindow.setVisible(false);
-
- //
- // Add sub menu items
- //
- jMenuWindow.add(getJMenuItemWindowDisplaySide());
- jMenuWindow.add(getJMenuItemWindowDisplayTopBottom());
- jMenuWindow.addSeparator();
-
- jMenuWindow.add(getJMenuItemWindowTabView());
- jMenuWindow.addSeparator();
-
- jMenuWindow.add(getJMenuItemWindowSource());
- jMenuWindow.add(getJMenuItemWindowXML());
- jMenuWindow.addSeparator();
-
- jMenuWindow.add(getJMenuItemWindowPreferences());
- }
- return jMenuWindow;
- }
-
- /**
- This method initializes jPanelOperation
- Reserved
-
- @return javax.swing.JPanel jPanelOperation
-
- **/
- private JPanel getJPanelOperation() {
- if (jPanelOperation == null) {
- jPanelOperation = new JPanel();
- jPanelOperation.setLayout(null);
- jPanelOperation.setBounds(new java.awt.Rectangle(295, 520, 500, 25));
- jPanelOperation.add(getJButtonOk(), null);
- jPanelOperation.add(getJButtonCancel(), null);
- jPanelOperation.setVisible(false);
- }
- return jPanelOperation;
- }
-
- /**
- This method initializes jButtonOk
- Reserved
-
- @return javax.swing.JButton jButtonOk
-
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(395, 2, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.setEnabled(false);
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This method initializes jButtonCancel
- Reserved
-
- @return javax.swing.JButton jButtonCancel
-
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(395, 2, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.setEnabled(false);
- jButtonCancel.addActionListener(this);
- jButtonCancel.setVisible(false);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes jMenuItemFileOpen
-
- @return javax.swing.JMenuItem jMenuItemFileOpen
-
- **/
- private JMenuItem getJMenuItemFileOpen() {
- if (jMenuItemFileOpen == null) {
- jMenuItemFileOpen = new JMenuItem();
- jMenuItemFileOpen.setText("Open...");
- jMenuItemFileOpen.setMnemonic('O');
- jMenuItemFileOpen.addActionListener(this);
- }
- return jMenuItemFileOpen;
- }
-
- /**
- This method initializes jMenuItemFileCloseAll
-
- @return javax.swing.JMenuItem jMenuItemFileOpen
-
- **/
- private JMenuItem getJMenuItemFileCloseAll() {
- if (jMenuItemFileCloseAll == null) {
- jMenuItemFileCloseAll = new JMenuItem();
- jMenuItemFileCloseAll.setText("Close All");
- jMenuItemFileCloseAll.setMnemonic('A');
- jMenuItemFileCloseAll.setEnabled(true);
- jMenuItemFileCloseAll.addActionListener(this);
- }
- return jMenuItemFileCloseAll;
- }
-
- /**
- This method initializes jMenuItemFileSaveAll
-
- @return javax.swing.JMenuItem jMenuItemFileSaveAll
-
- **/
- private JMenuItem getJMenuItemFileSaveAll() {
- if (jMenuItemFileSaveAll == null) {
- jMenuItemFileSaveAll = new JMenuItem();
- jMenuItemFileSaveAll.setText("Save All");
- jMenuItemFileSaveAll.setMnemonic('v');
- jMenuItemFileSaveAll.setEnabled(true);
- jMenuItemFileSaveAll.addActionListener(this);
- }
- return jMenuItemFileSaveAll;
- }
-
- /**
- This method initializes jMenuItemFilePageSetup
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemFilePageSetup() {
- if (jMenuItemFilePageSetup == null) {
- jMenuItemFilePageSetup = new JMenuItem();
- jMenuItemFilePageSetup.setText("Page Setup");
- jMenuItemFilePageSetup.setMnemonic('u');
- jMenuItemFilePageSetup.setEnabled(false);
- jMenuItemFilePageSetup.addActionListener(this);
- jMenuItemFilePageSetup.setVisible(false);
- }
- return jMenuItemFilePageSetup;
- }
-
- /**
- This method initializes jMenuItemFilePrint
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemFilePrint() {
- if (jMenuItemFilePrint == null) {
- jMenuItemFilePrint = new JMenuItem();
- jMenuItemFilePrint.setText("Print");
- jMenuItemFilePrint.setMnemonic('P');
- jMenuItemFilePrint.setEnabled(false);
- jMenuItemFilePrint.addActionListener(this);
- jMenuItemFilePrint.setVisible(false);
- }
- return jMenuItemFilePrint;
- }
-
- /**
- This method initializes jMenuItemFileImport
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemFileImport() {
- if (jMenuItemFileImport == null) {
- jMenuItemFileImport = new JMenuItem();
- jMenuItemFileImport.setText("Import");
- jMenuItemFileImport.setMnemonic('I');
- jMenuItemFileImport.setEnabled(false);
- jMenuItemFileImport.addActionListener(this);
- jMenuItemFileImport.setVisible(false);
- }
- return jMenuItemFileImport;
- }
-
- /**
- This method initializes jMenuItemFileProperties
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemFileProperties() {
- if (jMenuItemFileProperties == null) {
- jMenuItemFileProperties = new JMenuItem();
- jMenuItemFileProperties.setText("Properties");
- jMenuItemFileProperties.setMnemonic('t');
- jMenuItemFileProperties.setEnabled(false);
- jMenuItemFileProperties.addActionListener(this);
- jMenuItemFileProperties.setVisible(false);
- }
- return jMenuItemFileProperties;
- }
-
- /**
- This method initializes jMenuFileRecentFiles
-
- @return javax.swing.JMenu
-
- **/
- private JMenu getJMenuFileRecentFiles() {
- if (jMenuFileRecentFiles == null) {
- jMenuFileRecentFiles = new JMenu();
- jMenuFileRecentFiles.setText("Recent Files");
- jMenuFileRecentFiles.setMnemonic('F');
- jMenuFileRecentFiles.setEnabled(false);
- jMenuFileRecentFiles.addActionListener(this);
- jMenuFileRecentFiles.setVisible(false);
- }
- return jMenuFileRecentFiles;
- }
-
- /**
- This method initializes jMenuItemEditUndo
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemEditUndo() {
- if (jMenuItemEditUndo == null) {
- jMenuItemEditUndo = new JMenuItem();
- jMenuItemEditUndo.setText("Undo");
- jMenuItemEditUndo.setMnemonic('U');
- jMenuItemEditUndo.setEnabled(false);
- jMenuItemEditUndo.setVisible(false);
- jMenuItemEditUndo.addActionListener(this);
- }
- return jMenuItemEditUndo;
- }
-
- /**
- This method initializes jMenuItemEditRedo
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemEditRedo() {
- if (jMenuItemEditRedo == null) {
- jMenuItemEditRedo = new JMenuItem();
- jMenuItemEditRedo.setText("Redo");
- jMenuItemEditRedo.setMnemonic('R');
- jMenuItemEditRedo.setEnabled(false);
- jMenuItemEditRedo.setVisible(false);
- jMenuItemEditRedo.addActionListener(this);
- }
- return jMenuItemEditRedo;
- }
-
- /**
- This method initializes jMenuItemEditCut
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemEditCut() {
- if (jMenuItemEditCut == null) {
- jMenuItemEditCut = new JMenuItem();
- jMenuItemEditCut.setText("Cut");
- jMenuItemEditCut.setMnemonic('t');
- jMenuItemEditCut.setEnabled(false);
- jMenuItemEditCut.setVisible(false);
- jMenuItemEditCut.addActionListener(this);
- }
- return jMenuItemEditCut;
- }
-
- /**
- This method initializes jMenuItemEditCopy
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemEditCopy() {
- if (jMenuItemEditCopy == null) {
- jMenuItemEditCopy = new JMenuItem();
- jMenuItemEditCopy.setText("Copy");
- jMenuItemEditCopy.setMnemonic('C');
- jMenuItemEditCopy.setEnabled(false);
- jMenuItemEditCopy.setVisible(false);
- jMenuItemEditCopy.addActionListener(this);
- }
- return jMenuItemEditCopy;
- }
-
- /**
- This method initializes jMenuItemEditPaste
-
- return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemEditPaste() {
- if (jMenuItemEditPaste == null) {
- jMenuItemEditPaste = new JMenuItem();
- jMenuItemEditPaste.setText("Paste");
- jMenuItemEditPaste.setMnemonic('P');
- jMenuItemEditPaste.setEnabled(false);
- jMenuItemEditPaste.setVisible(false);
- jMenuItemEditPaste.addActionListener(this);
- }
- return jMenuItemEditPaste;
- }
-
- /**
- This method initializes jMenuItem
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemEditSelectAll() {
- if (jMenuItemEditSelectAll == null) {
- jMenuItemEditSelectAll = new JMenuItem();
- jMenuItemEditSelectAll.setText("Select All");
- jMenuItemEditSelectAll.setMnemonic('A');
- jMenuItemEditSelectAll.setEnabled(false);
- jMenuItemEditSelectAll.setVisible(false);
- jMenuItemEditSelectAll.addActionListener(this);
- }
- return jMenuItemEditSelectAll;
- }
-
- /**
- This method initializes jMenuItemEditFindNext
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemEditFindNext() {
- if (jMenuItemEditFindNext == null) {
- jMenuItemEditFindNext = new JMenuItem();
- jMenuItemEditFindNext.setText("Find Next");
- jMenuItemEditFindNext.setMnemonic('n');
- jMenuItemEditFindNext.setEnabled(false);
- jMenuItemEditFindNext.setVisible(false);
- jMenuItemEditFindNext.addActionListener(this);
- }
- return jMenuItemEditFindNext;
- }
-
- /**
- This method initializes jMenuView
-
- @return javax.swing.JMenu
-
- **/
- private JMenu getJMenuView() {
- if (jMenuView == null) {
- //
- // Set jMenuView's attributes
- //
- jMenuView = new JMenu();
- jMenuView.setText("View");
- jMenuView.setMnemonic('V');
- jMenuView.setVisible(false);
-
- //
- // Add sub menu items
- //
- jMenuView.add(getJMenuViewToolbars());
- jMenuView.add(getJMenuItemViewAdvanced());
- jMenuView.add(getJMenuItemViewStandard());
- jMenuView.add(getJMenuItemViewXML());
- }
- return jMenuView;
- }
-
- /**
- This method initializes jMenuViewToolbars
-
- @return javax.swing.JMenu
-
- **/
- private JMenu getJMenuViewToolbars() {
- if (jMenuViewToolbars == null) {
- jMenuViewToolbars = new JMenu();
- jMenuViewToolbars.setText("Toolbars");
- jMenuViewToolbars.setMnemonic('T');
-
- jMenuViewToolbars.add(getJCheckBoxMenuItemViewToolbarsFile());
- jMenuViewToolbars.add(getJCheckBoxMenuItemViewToolbarsEdit());
- jMenuViewToolbars.add(getJCheckBoxMenuItemViewToolbarsWindow());
- }
- return jMenuViewToolbars;
- }
-
- /**
- This method initializes jCheckBoxMenuItemViewToolbarsFile
-
- @return javax.swing.JCheckBoxMenuItem
-
- **/
- private JCheckBoxMenuItem getJCheckBoxMenuItemViewToolbarsFile() {
- if (jCheckBoxMenuItemViewToolbarsFile == null) {
- jCheckBoxMenuItemViewToolbarsFile = new JCheckBoxMenuItem();
- jCheckBoxMenuItemViewToolbarsFile.setText("File");
- jCheckBoxMenuItemViewToolbarsFile.setEnabled(false);
- jCheckBoxMenuItemViewToolbarsFile.addActionListener(this);
- }
- return jCheckBoxMenuItemViewToolbarsFile;
- }
-
- /**
- This method initializes jCheckBoxMenuItemViewToolbarsEdit
-
- @return javax.swing.JCheckBoxMenuItem
-
- **/
- private JCheckBoxMenuItem getJCheckBoxMenuItemViewToolbarsEdit() {
- if (jCheckBoxMenuItemViewToolbarsEdit == null) {
- jCheckBoxMenuItemViewToolbarsEdit = new JCheckBoxMenuItem();
- jCheckBoxMenuItemViewToolbarsEdit.setText("Edit");
- jCheckBoxMenuItemViewToolbarsEdit.setEnabled(false);
- jCheckBoxMenuItemViewToolbarsEdit.addActionListener(this);
- }
- return jCheckBoxMenuItemViewToolbarsEdit;
- }
-
- /**
- This method initializes jCheckBoxMenuItemViewToolbarsWindow
-
- @return javax.swing.JCheckBoxMenuItem
-
- **/
- private JCheckBoxMenuItem getJCheckBoxMenuItemViewToolbarsWindow() {
- if (jCheckBoxMenuItemViewToolbarsWindow == null) {
- jCheckBoxMenuItemViewToolbarsWindow = new JCheckBoxMenuItem();
- jCheckBoxMenuItemViewToolbarsWindow.setText("Window");
- jCheckBoxMenuItemViewToolbarsWindow.setEnabled(false);
- jCheckBoxMenuItemViewToolbarsWindow.addActionListener(this);
- }
- return jCheckBoxMenuItemViewToolbarsWindow;
- }
-
- /**
- This method initializes jMenuItemStandard
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemViewStandard() {
- if (jMenuItemViewStandard == null) {
- jMenuItemViewStandard = new JMenuItem();
- jMenuItemViewStandard.setText("Standard");
- jMenuItemViewStandard.setMnemonic('S');
- jMenuItemViewStandard.setEnabled(false);
- jMenuItemViewStandard.addActionListener(this);
- }
- return jMenuItemViewStandard;
- }
-
- /**
- This method initializes jMenuItemAdvanced
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemViewAdvanced() {
- if (jMenuItemViewAdvanced == null) {
- jMenuItemViewAdvanced = new JMenuItem();
- jMenuItemViewAdvanced.setText("Advanced");
- jMenuItemViewAdvanced.setMnemonic('A');
- jMenuItemViewAdvanced.setEnabled(false);
- jMenuItemViewAdvanced.addActionListener(this);
- }
- return jMenuItemViewAdvanced;
- }
-
- /**
- This method initializes jMenuProject
-
- @return javax.swing.JMenu
-
- **/
- private JMenu getJMenuProject() {
- if (jMenuProject == null) {
- //
- // Set jMenuProject's attributes
- //
- jMenuProject = new JMenu();
- jMenuProject.setText("Project");
- jMenuProject.setMnemonic('P');
-
- //
- // Add sub menu items
- //
- jMenuProject.add(getJMenuItemProjectAdmin());
-
- jMenuProject.add(getJMenuItemProjectChangeWorkspace());
- jMenuProject.addSeparator();
-
- jMenuProject.add(getJMenuItemProjectCreateFar());
- jMenuProject.add(getJMenuItemProjectInstallFar());
- jMenuProject.add(getJMenuItemProjectUpdateFar());
- jMenuProject.add(getJMenuItemProjectRemoveFar());
-
- }
- return jMenuProject;
- }
-
- /**
- This method initializes jMenuItemProjectAdmin
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemProjectAdmin() {
- if (jMenuItemProjectAdmin == null) {
- jMenuItemProjectAdmin = new JMenuItem();
- jMenuItemProjectAdmin.setText("Admin...");
- jMenuItemProjectAdmin.setMnemonic('A');
- jMenuItemProjectAdmin.setEnabled(false);
- jMenuItemProjectAdmin.addActionListener(this);
- jMenuItemProjectAdmin.setVisible(false);
- }
- return jMenuItemProjectAdmin;
- }
-
- /**
- This method initializes jMenuItemProjectChangeWorkspace
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemProjectChangeWorkspace() {
- if (jMenuItemProjectChangeWorkspace == null) {
- jMenuItemProjectChangeWorkspace = new JMenuItem();
- jMenuItemProjectChangeWorkspace.setText("Change WORKSPACE...");
- jMenuItemProjectChangeWorkspace.setMnemonic('W');
- jMenuItemProjectChangeWorkspace.setEnabled(true);
- jMenuItemProjectChangeWorkspace.addActionListener(this);
- }
- return jMenuItemProjectChangeWorkspace;
- }
-
- /**
- This method initializes jMenuProjectBuildPreferences
-
- @return javax.swing.JMenu
-
- **/
- private JMenuItem getJMenuItemToolsBuildPreferences() {
- if (jMenuItemToolsBuildPreferences == null) {
- jMenuItemToolsBuildPreferences = new JMenuItem();
- jMenuItemToolsBuildPreferences.setText("Build Preferences...");
- jMenuItemToolsBuildPreferences.setMnemonic('P');
- jMenuItemToolsBuildPreferences.setEnabled(true);
- jMenuItemToolsBuildPreferences.addActionListener(this);
- }
- return jMenuItemToolsBuildPreferences;
- }
-
- /**
- This method initializes jMenuItemToolsToolChainConfiguration
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemToolsToolChainConfiguration() {
- if (jMenuItemToolsToolChainConfiguration == null) {
- jMenuItemToolsToolChainConfiguration = new JMenuItem();
- jMenuItemToolsToolChainConfiguration.setText("Tool Chain Configuration...");
- jMenuItemToolsToolChainConfiguration.setMnemonic('C');
- jMenuItemToolsToolChainConfiguration.addActionListener(this);
- }
- return jMenuItemToolsToolChainConfiguration;
- }
-
- /**
- This method initializes jMenuItemToolsClone
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemToolsClone() {
- if (jMenuItemToolsClone == null) {
- jMenuItemToolsClone = new JMenuItem();
- jMenuItemToolsClone.setText("Clone...");
- jMenuItemToolsClone.setMnemonic('l');
- jMenuItemToolsClone.setEnabled(true);
- jMenuItemToolsClone.addActionListener(this);
- }
- return jMenuItemToolsClone;
- }
-
- /**
- This method initializes jMenuItemToolsCodeScan
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemToolsCodeScan() {
- if (jMenuItemToolsCodeScan == null) {
- jMenuItemToolsCodeScan = new JMenuItem();
- jMenuItemToolsCodeScan.setText("Code Scan...");
- jMenuItemToolsCodeScan.setMnemonic('S');
- jMenuItemToolsCodeScan.setEnabled(false);
- jMenuItemToolsCodeScan.addActionListener(this);
- jMenuItemToolsCodeScan.setVisible(false);
- }
- return jMenuItemToolsCodeScan;
- }
-
- /**
- This method initializes jMenuItemWindowSplitVertical
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemWindowDisplaySide() {
- if (jMenuItemWindowDisplaySide == null) {
- jMenuItemWindowDisplaySide = new JMenuItem();
- jMenuItemWindowDisplaySide.setText("Display Side by Side");
- jMenuItemWindowDisplaySide.setMnemonic('S');
- jMenuItemWindowDisplaySide.setEnabled(false);
- jMenuItemWindowDisplaySide.addActionListener(this);
- }
- return jMenuItemWindowDisplaySide;
- }
-
- /**
- This method initializes jMenuItemWindowSplitHorizontal
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemWindowDisplayTopBottom() {
- if (jMenuItemWindowDisplayTopBottom == null) {
- jMenuItemWindowDisplayTopBottom = new JMenuItem();
- jMenuItemWindowDisplayTopBottom.setText("Display Top and Bottom");
- jMenuItemWindowDisplayTopBottom.setMnemonic('B');
- jMenuItemWindowDisplayTopBottom.setEnabled(false);
- jMenuItemWindowDisplayTopBottom.addActionListener(this);
- }
- return jMenuItemWindowDisplayTopBottom;
- }
-
- /**
- This method initializes jMenuItemViewXML
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemViewXML() {
- if (jMenuItemViewXML == null) {
- jMenuItemViewXML = new JMenuItem();
- jMenuItemViewXML.setText("XML");
- jMenuItemViewXML.setMnemonic('X');
- jMenuItemViewXML.setEnabled(false);
- jMenuItemViewXML.addActionListener(this);
- }
- return jMenuItemViewXML;
- }
-
- /**
- This method initializes jMenuItemWindowTabView
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemWindowTabView() {
- if (jMenuItemWindowTabView == null) {
- jMenuItemWindowTabView = new JMenuItem();
- jMenuItemWindowTabView.setText("Tab View");
- jMenuItemWindowTabView.setMnemonic('T');
- jMenuItemWindowTabView.setEnabled(false);
- jMenuItemWindowTabView.addActionListener(this);
- }
- return jMenuItemWindowTabView;
- }
-
- /**
- This method initializes jMenuItemWindowSource
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemWindowSource() {
- if (jMenuItemWindowSource == null) {
- jMenuItemWindowSource = new JMenuItem();
- jMenuItemWindowSource.setText("Source");
- jMenuItemWindowSource.setMnemonic('S');
- jMenuItemWindowSource.setEnabled(false);
- jMenuItemWindowSource.addActionListener(this);
- }
- return jMenuItemWindowSource;
- }
-
- /**
- This method initializes jMenuItemWindowXML
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemWindowXML() {
- if (jMenuItemWindowXML == null) {
- jMenuItemWindowXML = new JMenuItem();
- jMenuItemWindowXML.setText("XML");
- jMenuItemWindowXML.setMnemonic('X');
- jMenuItemWindowXML.setEnabled(false);
- jMenuItemWindowXML.addActionListener(this);
- }
- return jMenuItemWindowXML;
- }
-
- /**
- This method initializes jMenuItemWindowPreferences
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemWindowPreferences() {
- if (jMenuItemWindowPreferences == null) {
- jMenuItemWindowPreferences = new JMenuItem();
- jMenuItemWindowPreferences.setText("Preferences");
- jMenuItemWindowPreferences.setMnemonic('P');
- jMenuItemWindowPreferences.setEnabled(false);
- jMenuItemWindowPreferences.addActionListener(this);
- }
- return jMenuItemWindowPreferences;
- }
-
- /**
- This method initializes jMenuItemHelpContents
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemHelpContents() {
- if (jMenuItemHelpContents == null) {
- jMenuItemHelpContents = new JMenuItem();
- jMenuItemHelpContents.setText("Contents");
- jMenuItemHelpContents.setMnemonic('C');
- jMenuItemHelpContents.setEnabled(false);
- jMenuItemHelpContents.addActionListener(this);
- jMenuItemHelpContents.setVisible(false);
- }
- return jMenuItemHelpContents;
- }
-
- /**
- This method initializes jMenuItemHelpIndex
-
- @return javax.swing.JMenuItem
-
- **/
- private JMenuItem getJMenuItemHelpIndex() {
- if (jMenuItemHelpIndex == null) {
- jMenuItemHelpIndex = new JMenuItem();
- jMenuItemHelpIndex.setText("Index");
- jMenuItemHelpIndex.setMnemonic('I');
- jMenuItemHelpIndex.setEnabled(false);
- jMenuItemHelpIndex.addActionListener(this);
- jMenuItemHelpIndex.setVisible(false);
- }
- return jMenuItemHelpIndex;
- }
-
- /**
- This method initializes jMenuItemHelpSearch
-
- @return javax.swing.JMenuItem
-
- */
- private JMenuItem getJMenuItemHelpSearch() {
- if (jMenuItemHelpSearch == null) {
- jMenuItemHelpSearch = new JMenuItem();
- jMenuItemHelpSearch.setText("Search");
- jMenuItemHelpSearch.setMnemonic('S');
- jMenuItemHelpSearch.setEnabled(false);
- jMenuItemHelpSearch.addActionListener(this);
- jMenuItemHelpSearch.setVisible(false);
- }
- return jMenuItemHelpSearch;
- }
-
- /**
- * This method initializes jMenuItemToolsInstallPackage
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemProjectInstallFar() {
- if (jMenuItemProjectInstallFar == null) {
- jMenuItemProjectInstallFar = new JMenuItem();
- jMenuItemProjectInstallFar.setText("Install FAR...");
- jMenuItemProjectInstallFar.setMnemonic('I');
- jMenuItemProjectInstallFar.setEnabled(true);
- jMenuItemProjectInstallFar.addActionListener(this);
- }
- return jMenuItemProjectInstallFar;
- }
-
- /**
- * This method initializes jMenuItemToolsUpdatePackage
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemProjectUpdateFar() {
- if (jMenuItemProjectUpdateFar == null) {
- jMenuItemProjectUpdateFar = new JMenuItem();
- jMenuItemProjectUpdateFar.setText("Update FAR...");
- jMenuItemProjectUpdateFar.setMnemonic('U');
- jMenuItemProjectUpdateFar.setEnabled(true);
- jMenuItemProjectUpdateFar.addActionListener(this);
- jMenuItemProjectUpdateFar.setVisible(true);
- }
- return jMenuItemProjectUpdateFar;
- }
-
- /**
- * This method initializes jMenuItemRemovePackage
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemProjectRemoveFar() {
- if (jMenuItemProjectRemoveFar == null) {
- jMenuItemProjectRemoveFar = new JMenuItem();
- jMenuItemProjectRemoveFar.setText("Remove FAR...");
- jMenuItemProjectRemoveFar.setMnemonic('R');
- jMenuItemProjectRemoveFar.setEnabled(true);
- jMenuItemProjectRemoveFar.addActionListener(this);
- }
- return jMenuItemProjectRemoveFar;
- }
-
- /**
- * This method initializes jMenuItemProjectCreateFar
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemProjectCreateFar() {
- if (jMenuItemProjectCreateFar == null) {
- jMenuItemProjectCreateFar = new JMenuItem();
- jMenuItemProjectCreateFar.setText("Create FAR...");
- jMenuItemProjectCreateFar.setMnemonic('C');
- jMenuItemProjectCreateFar.addActionListener(this);
- }
- return jMenuItemProjectCreateFar;
- }
-
- /**
- * This method initializes jMenuEditFind
- *
- * @return javax.swing.JMenu
- */
- private JMenu getJMenuEditFind() {
- if (jMenuEditFind == null) {
- jMenuEditFind = new JMenu();
- jMenuEditFind.setText("Find");
- jMenuEditFind.setMnemonic('F');
-
- jMenuEditFind.add(getJMenuItemEditFindPpi());
- jMenuEditFind.add(getJMenuItemEditFindProtocol());
- jMenuEditFind.add(getJMenuItemEditFindGuid());
- jMenuEditFind.add(getJMenuItemEditFindPcd());
- jMenuEditFind.add(getJMenuItemEditFindLibraryClass());
- jMenuEditFind.add(getJMenuItemEditFindLibraryInstance());
- }
- return jMenuEditFind;
- }
-
- /**
- * This method initializes jMenuItemEditFindPcd
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemEditFindPcd() {
- if (jMenuItemEditFindPcd == null) {
- jMenuItemEditFindPcd = new JMenuItem();
- jMenuItemEditFindPcd.setText("All PCD entries");
- jMenuItemEditFindPcd.setMnemonic('P');
- jMenuItemEditFindPcd.addActionListener(this);
- }
- return jMenuItemEditFindPcd;
- }
-
- /**
- * This method initializes jMenuItemEditFindLibraryClass
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemEditFindLibraryClass() {
- if (jMenuItemEditFindLibraryClass == null) {
- jMenuItemEditFindLibraryClass = new JMenuItem();
- jMenuItemEditFindLibraryClass.setText("All Library Classes");
- jMenuItemEditFindLibraryClass.setMnemonic('C');
- jMenuItemEditFindLibraryClass.addActionListener(this);
- }
- return jMenuItemEditFindLibraryClass;
- }
-
- /**
- * This method initializes jMenuItemEditFindPpi
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemEditFindPpi() {
- if (jMenuItemEditFindPpi == null) {
- jMenuItemEditFindPpi = new JMenuItem();
- jMenuItemEditFindPpi.setText("All PPIs");
- jMenuItemEditFindPpi.setMnemonic('I');
- jMenuItemEditFindPpi.addActionListener(this);
- }
- return jMenuItemEditFindPpi;
- }
-
- /**
- * This method initializes jMenuItemEditFindProtocol
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemEditFindProtocol() {
- if (jMenuItemEditFindProtocol == null) {
- jMenuItemEditFindProtocol = new JMenuItem();
- jMenuItemEditFindProtocol.setText("All Protocols");
- jMenuItemEditFindProtocol.setMnemonic('r');
- jMenuItemEditFindProtocol.addActionListener(this);
- }
- return jMenuItemEditFindProtocol;
- }
-
- /**
- * This method initializes jMenuItemEditFindGuid
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemEditFindGuid() {
- if (jMenuItemEditFindGuid == null) {
- jMenuItemEditFindGuid = new JMenuItem();
- jMenuItemEditFindGuid.setText("All GUIDs");
- jMenuItemEditFindGuid.setMnemonic('G');
- jMenuItemEditFindGuid.addActionListener(this);
- }
- return jMenuItemEditFindGuid;
- }
-
- /**
- * This method initializes jMenuItemEditFindLibraryInstance
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemEditFindLibraryInstance() {
- if (jMenuItemEditFindLibraryInstance == null) {
- jMenuItemEditFindLibraryInstance = new JMenuItem();
- jMenuItemEditFindLibraryInstance.setText("All Library Instances");
- jMenuItemEditFindLibraryInstance.setMnemonic('n');
- jMenuItemEditFindLibraryInstance.addActionListener(this);
- jMenuItemEditFindLibraryInstance.setVisible(false);
- }
- return jMenuItemEditFindLibraryInstance;
- }
-
- /**
- * This method initializes jMenuItemProjectGenerateGuidsXref
- *
- * @return javax.swing.JMenuItem
- */
- private JMenuItem getJMenuItemToolsGenerateGuidsXref() {
- if (jMenuItemToolsGenerateGuidsXref == null) {
- jMenuItemToolsGenerateGuidsXref = new JMenuItem();
- jMenuItemToolsGenerateGuidsXref.setText("Generate guids.xref...");
- jMenuItemToolsGenerateGuidsXref.setMnemonic('G');
- jMenuItemToolsGenerateGuidsXref.addActionListener(this);
- }
- return jMenuItemToolsGenerateGuidsXref;
- }
-
- /* (non-Javadoc)
- * @see org.tianocore.packaging.common.ui.IFrame#main(java.lang.String[])
- *
- * Main class, start the GUI
- *
- */
- public static void main(String[] args) {
- //
- // Start Main UI
- //
- FrameworkWizardUI module = FrameworkWizardUI.getInstance(args);
- module.setVisible(true);
- }
-
- /**
- This is the default constructor
-
- **/
- public FrameworkWizardUI(String[] args) {
- super();
- init(args);
- }
-
- /**
- This method initializes this
-
-
- **/
- private void init(String[] args) {
- //
- // Set current workspace and check
- // Check if exists WORKSPACE
- //
- Workspace.setCurrentWorkspace(System.getenv("WORKSPACE"));
- this.checkWorkspace();
-
- //
- // Show splash screen
- //
- SplashScreen ss = new SplashScreen();
- ss.setVisible(true);
-
- //
- // Go through args to check if enable log
- //
- for (int index = 0; index < args.length; index++) {
- if (args[index].equals("--log") || args[index].equals("-l")) {
- Log.setSaveLog(true);
- }
- }
-
- //
- // Init Global Data
- //
- GlobalData.init();
-
- //
- // Close splash screen
- //
- ss.dispose();
-
- //
- // Init the frame
- //
- this.setSize(DataType.MAIN_FRAME_PREFERRED_SIZE_WIDTH, DataType.MAIN_FRAME_PREFERRED_SIZE_HEIGHT);
- this.setResizable(true);
- this.setJMenuBar(getjJMenuBar());
- this.setContentPane(getJContentPane());
- this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- ["
- + Workspace.getCurrentWorkspace() + "]");
- this.setExitType(1);
-
- //
- // max the window
- //
- this.setExtendedState(JFrame.MAXIMIZED_BOTH);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJPanelOperation(), null);
- jContentPane.add(getJSplitPane(), null);
- }
- 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) {
- //
- // Operations of Menu
- //
- if (arg0.getSource() == this.jMenuItemFileNew) {
- this.fileNew();
- }
-
- if (arg0.getSource() == this.jMenuItemFileOpen) {
- this.open();
- }
-
- if (arg0.getSource() == this.jMenuItemFileClose) {
- this.close();
- }
-
- if (arg0.getSource() == this.jMenuItemFileCloseAll) {
- this.closeAll();
- this.refresh();
- this.makeEmptyTree();
- }
-
- if (arg0.getSource() == this.jMenuItemFileSave) {
- this.save();
- }
-
- if (arg0.getSource() == this.jMenuItemFileSaveAs) {
- this.saveAs();
- }
-
- if (arg0.getSource() == this.jMenuItemFileSaveAll) {
- this.saveAll();
- }
-
- if (arg0.getSource() == this.jMenuItemFileRefresh) {
- if (this.closeAll() == 0) {
- this.refresh();
- this.makeEmptyTree();
- }
- }
-
- if (arg0.getSource() == this.jMenuItemFileExit) {
- this.exit();
- }
-
- if (arg0.getSource() == this.jMenuItemEditFindPpi) {
- this.findPpi();
- }
-
- if (arg0.getSource() == this.jMenuItemEditFindProtocol) {
- this.findProtocol();
- }
-
- if (arg0.getSource() == this.jMenuItemEditFindGuid) {
- this.findGuid();
- }
-
- if (arg0.getSource() == this.jMenuItemEditFindPcd) {
- this.findPcd();
- }
-
- if (arg0.getSource() == this.jMenuItemEditFindLibraryClass) {
- this.findLibraryClass();
- }
-
- if (arg0.getSource() == this.jMenuItemEditFindLibraryInstance) {
- this.findLibraryInstance();
- }
-
- if (arg0.getSource() == jMenuItemToolsBuildPreferences) {
- configBuildPreferences();
- }
-
- if (arg0.getSource() == this.jMenuItemProjectChangeWorkspace) {
- this.changeWorkspace();
- }
-
- if (arg0.getSource() == this.jMenuItemProjectCreateFar) {
- this.createFar();
- }
-
- if (arg0.getSource() == this.jMenuItemProjectInstallFar) {
- this.installFar();
- }
-
- if (arg0.getSource() == this.jMenuItemProjectRemoveFar) {
- this.removeFar();
- }
-
- if (arg0.getSource() == this.jMenuItemProjectUpdateFar) {
- this.updateFar();
- }
-
- if (arg0.getSource() == this.jMenuItemToolsClone) {
- this.cloneItem();
- }
-
- if (arg0.getSource() == this.jMenuItemToolsToolChainConfiguration) {
- this.setupToolChainConfiguration();
- }
-
- if (arg0.getSource() == this.jMenuItemToolsGenerateGuidsXref) {
- this.generateGuidsXref();
- }
-
- if (arg0.getSource() == this.jMenuItemHelpAbout) {
- About a = new About(this, true);
- int result = a.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- a.dispose();
- }
- }
- }
-
- /**
- Create an empty tree if no file is open
-
- **/
- private void makeEmptyTree() {
- //
- // Make root
- //
- dmtnRoot = new IDefaultMutableTreeNode("WORKSPACE", IDefaultMutableTreeNode.WORKSPACE, false, null, null);
-
- //
- // Make Module Description
- //
- dmtnModuleDescription = new IDefaultMutableTreeNode("Modules", IDefaultMutableTreeNode.MODULE_DESCRIPTION,
- false, null, dmtnRoot);
-
- //
- // First add package
- //
- if (GlobalData.vPackageList.size() > 0) {
- for (int index = 0; index < GlobalData.vPackageList.size(); index++) {
- IDefaultMutableTreeNode dmtnModulePackage = null;
- IDefaultMutableTreeNode dmtnModulePackageLibrary = null;
- IDefaultMutableTreeNode dmtnModulePackageModule = null;
-
- dmtnModulePackage = new IDefaultMutableTreeNode(GlobalData.vPackageList.elementAt(index).getName(),
- IDefaultMutableTreeNode.MODULE_PACKAGE, false,
- GlobalData.vPackageList.elementAt(index),
- this.dmtnModuleDescription);
- dmtnModulePackageLibrary = new IDefaultMutableTreeNode("Library",
- IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY,
- false, GlobalData.vPackageList.elementAt(index),
- this.dmtnModuleDescription);
- dmtnModulePackageModule = new IDefaultMutableTreeNode("Module",
- IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
- false, GlobalData.vPackageList.elementAt(index),
- this.dmtnModuleDescription);
- //
- // And then add each module in its package
- //
- Vector<ModuleIdentification> vModule = wt.getAllModules(GlobalData.vPackageList.elementAt(index));
- for (int indexJ = 0; indexJ < vModule.size(); indexJ++) {
- if (vModule.get(indexJ).isLibrary()) {
- dmtnModulePackageLibrary.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
- IDefaultMutableTreeNode.MODULE, false,
- vModule.get(indexJ),
- this.dmtnModuleDescription));
- } else {
- dmtnModulePackageModule.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
- IDefaultMutableTreeNode.MODULE, false,
- vModule.get(indexJ),
- this.dmtnModuleDescription));
- }
- }
- if (dmtnModulePackageModule.getChildCount() > 0) {
- dmtnModulePackage.add(dmtnModulePackageModule);
- }
- if (dmtnModulePackageLibrary.getChildCount() > 0) {
- dmtnModulePackage.add(dmtnModulePackageLibrary);
- }
-
- dmtnModuleDescription.add(dmtnModulePackage);
- }
- }
-
- //
- // Make Package Description
- //
- dmtnPackageDescription = new IDefaultMutableTreeNode("Packages", IDefaultMutableTreeNode.PACKAGE_DESCRIPTION,
- false, null, this.dmtnRoot);
- if (GlobalData.vPackageList.size() > 0) {
- for (int index = 0; index < GlobalData.vPackageList.size(); index++) {
- dmtnPackageDescription.add(new IDefaultMutableTreeNode(GlobalData.vPackageList.elementAt(index)
- .getName(),
- IDefaultMutableTreeNode.PACKAGE, false,
- GlobalData.vPackageList.elementAt(index),
- this.dmtnPackageDescription));
- }
- }
-
- //
- // Make Platform Description
- //
- dmtnPlatformDescription = new IDefaultMutableTreeNode("Platforms",
- IDefaultMutableTreeNode.PLATFORM_DESCRIPTION, false,
- null, this.dmtnRoot);
- if (GlobalData.vPlatformList.size() > 0) {
- for (int index = 0; index < GlobalData.vPlatformList.size(); index++) {
- dmtnPlatformDescription.add(new IDefaultMutableTreeNode(GlobalData.vPlatformList.elementAt(index)
- .getName(),
- IDefaultMutableTreeNode.PLATFORM, false,
- GlobalData.vPlatformList.elementAt(index),
- this.dmtnPlatformDescription));
- }
- }
-
- //
- // Add sub nodes to root node
- //
- dmtnRoot.add(dmtnModuleDescription);
- dmtnRoot.add(dmtnPackageDescription);
- dmtnRoot.add(dmtnPlatformDescription);
- iTree = new ITree(dmtnRoot);
- iTree.addMouseListener(this);
- iTree.addKeyListener(this);
- jScrollPaneTree.setViewportView(iTree);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
- *
- * Override windowClosing to popup warning message to confirm quit
- *
- */
- public void windowClosing(WindowEvent arg0) {
- this.exit();
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- * Override mouseClicked to check if need display popup menu
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- //
- // When double click
- //
- if (arg0.getClickCount() == 2) {
- doubleClickModuleTreeNode();
- }
- }
-
- public void mouseEntered(MouseEvent arg0) {
- // TODO Auto-generated method stub
- }
-
- public void mouseExited(MouseEvent arg0) {
- // TODO Auto-generated method stub
- }
-
- public void mousePressed(MouseEvent arg0) {
- // TODO Auto-generated method stub
- }
-
- public void mouseReleased(MouseEvent arg0) {
- // TODO Auto-generated method stub
- }
-
- /**
- Remove all Internal Frame of Module Desktop Pane
-
- **/
- private void cleanDesktopPaneModule() {
- if (jDesktopPaneModule != null) {
- JInternalFrame[] iif = this.jDesktopPaneModule.getAllFrames();
- for (int index = 0; index < iif.length; index++) {
- iif[index].dispose();
- }
- }
- }
-
- /**
- Remove all Internal Frame of package Desktop Pane
-
- **/
- private void cleanDesktopPanePackage() {
- if (jDesktopPanePlatform != null) {
- JInternalFrame[] iif = this.jDesktopPanePackage.getAllFrames();
- for (int index = 0; index < iif.length; index++) {
- iif[index].dispose();
- }
- }
- }
-
- /**
- Remove all Internal Frame of platform Desktop Pane
-
- **/
- private void cleanDesktopPanePlatform() {
- if (jDesktopPanePlatform != null) {
- JInternalFrame[] iif = this.jDesktopPanePlatform.getAllFrames();
- for (int index = 0; index < iif.length; index++) {
- iif[index].dispose();
- }
- }
- }
-
- /**
- Remove all Internal Frame of all Desktop Panes
-
- **/
- private void cleanDesktopPane() {
- cleanDesktopPaneModule();
- cleanDesktopPanePackage();
- cleanDesktopPanePlatform();
- }
-
- /**
- Set file filter as input ext
-
- @param ext
- @return
-
- **/
- private int getNewFilePath(String ext) {
- JFileChooser fc = new JFileChooser(Workspace.getCurrentWorkspace());
- fc.setAcceptAllFileFilterUsed(false);
- fc.addChoosableFileFilter(new IFileFilter(ext));
- return fc.showSaveDialog(new JPanel());
- }
-
- /**
- Add a module to tree
-
- @param mid The module node to be added
-
- **/
- private void addModuleToTree(ModuleIdentification mid) {
- //
- // Add new MsaHeader node to the tree
- //
- IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(mid.getName(), IDefaultMutableTreeNode.MODULE,
- false, mid, this.dmtnModuleDescription);
- //
- // First find the module belongs to which package
- //
- IDefaultMutableTreeNode packageNode = iTree.getNodeById(dmtnModuleDescription, mid.getPackageId(),
- IDefaultMutableTreeNode.MODULE_PACKAGE);
- //
- // To check if has module node or library node
- //
- IDefaultMutableTreeNode parentModuleNode = null;
- IDefaultMutableTreeNode parentLibraryNode = null;
- boolean hasModule = false;
- boolean hasLibrary = false;
- for (int index = 0; index < packageNode.getChildCount(); index++) {
- IDefaultMutableTreeNode iNode = (IDefaultMutableTreeNode) packageNode.getChildAt(index);
- if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY) {
- hasLibrary = true;
- parentLibraryNode = iNode;
- }
- if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE) {
- hasModule = true;
- parentModuleNode = iNode;
- }
- }
-
- //
- // If is a module
- //
- if (!mid.isLibrary()) {
- //
- // Create parent node first if has no parent node
- //
- if (!hasModule) {
- parentModuleNode = new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
- false, mid.getPackageId(), this.dmtnModuleDescription);
- iTree.addNode(packageNode, parentModuleNode);
- }
-
- iTree.addNode(parentModuleNode, node);
- }
-
- //
- // If is a Library
- //
- if (mid.isLibrary()) {
- //
- // Create parent node first if has no parent node
- //
- if (!hasLibrary) {
- parentLibraryNode = new IDefaultMutableTreeNode("Library",
- IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY, false,
- mid.getPackageId(), this.dmtnModuleDescription);
- iTree.addNode(packageNode, parentLibraryNode);
- }
-
- iTree.addNode(parentLibraryNode, node);
- }
- }
-
- /**
- Open Module
-
- @param path input file path
-
- **/
- private void openModule(String path, IDefaultMutableTreeNode belongNode) {
- ModuleIdentification id = GlobalData.openingModuleList.getIdByPath(path);
- if (id == null) {
- //
- // The module is not in existing packages
- //
- Log.wrn("Open Module", "The module does not belong to any package in the current workspace!");
- return;
- }
-
- //
- // Make the node selected
- //
- iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(belongNode, id, IDefaultMutableTreeNode.MODULE)));
-
- //
- // Update opening Module list information
- //
- if (!iTree.getSelectNode().isOpening()) {
- //
- // Insert sub node of module
- //
- insertModuleTreeNode(id, belongNode);
- iTree.getSelectNode().setOpening(true);
-
- //
- // Update opening module list
- //
- GlobalData.openingModuleList.setModuleOpen(id, true);
- Set<TreePath> temp = GlobalData.openingModuleList.getTreePathById(id);
- temp.add(iTree.getSelectionPath());
- GlobalData.openingModuleList.setTreePathById(id, temp);
- }
- //
- // Select msa header node and show it in editor panel
- //
- iTree
- .setSelectionPath(iTree
- .getPathOfNode(iTree
- .getNodeById(belongNode, id, IDefaultMutableTreeNode.MSA_HEADER)));
- showModuleElement(IDefaultMutableTreeNode.MSA_HEADER, GlobalData.openingModuleList.getOpeningModuleById(id));
- this.currentOpeningModuleIndex = GlobalData.openingModuleList.findIndexOfListById(id);
- }
-
- /**
- Open Package
-
- @param path input file path
-
- **/
- private void openPackage(String path) {
- PackageIdentification id = GlobalData.openingPackageList.getIdByPath(path);
- if (id == null) {
- //
- // The package is not in current workspace
- //
- Log.wrn("Open Package", "The package has not been installed in the current workspace!");
- return;
- }
-
- //
- // Make the node selected
- //
- iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPackageDescription, id,
- IDefaultMutableTreeNode.PACKAGE)));
- //
- // Update opening package list information
- //
- if (!GlobalData.openingPackageList.getPackageOpen(id)) {
- //
- // Insert sub node of module
- //
- insertPackageTreeNode(id);
- iTree.getSelectNode().setOpening(true);
-
- //
- // Update opening module list
- //
- GlobalData.openingPackageList.setPackageOpen(id, true);
- Set<TreePath> temp = GlobalData.openingPackageList.getTreePathById(id);
- temp.add(iTree.getSelectionPath());
- GlobalData.openingPackageList.setTreePathById(id, temp);
- }
- //
- // Show spd header in editor panel
- //
- iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPackageDescription, id,
- IDefaultMutableTreeNode.SPD_HEADER)));
- showPackageElement(IDefaultMutableTreeNode.SPD_HEADER, GlobalData.openingPackageList.getOpeningPackageById(id));
- this.currentOpeningPackageIndex = GlobalData.openingPackageList.findIndexOfListById(id);
- }
-
- /**
- Open Package
-
- @param path input file path
-
- **/
- private void openPlatform(String path) {
- PlatformIdentification id = GlobalData.openingPlatformList.getIdByPath(path);
- if (id == null) {
- //
- // The platform is not in current workspace
- //
- Log.wrn("Open Platform", "The platform has not been installed in the current workspace!");
- return;
- }
-
- //
- // Make the node selected
- //
- iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPlatformDescription, id,
- IDefaultMutableTreeNode.PLATFORM)));
- //
- // Update opening package list information
- //
- if (!GlobalData.openingPlatformList.getPlatformOpen(id)) {
- //
- // Insert sub node of module
- //
- insertPlatformTreeNode(id);
- iTree.getSelectNode().setOpening(true);
-
- //
- // Update opening module list
- //
- GlobalData.openingPlatformList.setPlatformOpen(id, true);
- Set<TreePath> temp = GlobalData.openingPlatformList.getTreePathById(id);
- temp.add(iTree.getSelectionPath());
- GlobalData.openingPlatformList.setTreePathById(id, temp);
- }
- //
- // Show fpd header in editor panel
- //
- iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPlatformDescription, id,
- IDefaultMutableTreeNode.FPD_PLATFORMHEADER)));
- showPlatformElement(IDefaultMutableTreeNode.FPD_PLATFORMHEADER,
- GlobalData.openingPlatformList.getOpeningPlatformById(id));
- this.currentOpeningPlatformIndex = GlobalData.openingPlatformList.findIndexOfListById(id);
- }
-
- /**
- Save module
-
- **/
- private void saveModule(int index) {
- OpeningModuleType omt = GlobalData.openingModuleList.getOpeningModuleByIndex(index);
- if (omt.isNew()) {
- if (getNewFilePath(DataType.MODULE_SURFACE_AREA_EXT) != JFileChooser.APPROVE_OPTION) {
- return;
- }
- }
- try {
- SaveFile.saveMsaFile(omt.getId().getPath(), omt.getXmlMsa());
- GlobalData.openingModuleList.setNew(omt.getId(), false);
- GlobalData.openingModuleList.setModuleSaved(omt.getId(), true);
- } catch (Exception e) {
- Log.wrn("Save Module", e.getMessage());
- Log.err("Save Module", e.getMessage());
- }
- }
-
- /**
- Save package
-
- **/
- private void savePackage(int index) {
- OpeningPackageType opt = GlobalData.openingPackageList.getOpeningPackageByIndex(index);
- if (opt.isNew()) {
- if (getNewFilePath(DataType.PACKAGE_SURFACE_AREA_EXT) != JFileChooser.APPROVE_OPTION) {
- return;
- }
- }
- try {
- SaveFile.saveSpdFile(opt.getId().getPath(), opt.getXmlSpd());
- GlobalData.openingPackageList.setNew(opt.getId(), false);
- GlobalData.openingPackageList.setPackageSaved(opt.getId(), true);
- } catch (Exception e) {
- Log.wrn("Save Package", e.getMessage());
- Log.err("Save Package", e.getMessage());
- }
- }
-
- /**
- Save platform
-
- **/
- private void savePlatform(int index) {
- OpeningPlatformType opt = GlobalData.openingPlatformList.getOpeningPlatformByIndex(index);
- if (opt.isNew()) {
- if (getNewFilePath(DataType.PACKAGE_SURFACE_AREA_EXT) != JFileChooser.APPROVE_OPTION) {
- return;
- }
- }
- try {
- SaveFile.saveFpdFile(opt.getId().getPath(), opt.getXmlFpd());
- GlobalData.openingPlatformList.setNew(opt.getId(), false);
- GlobalData.openingPlatformList.setPlatformSaved(opt.getId(), true);
- } catch (Exception e) {
- Log.wrn("Save Package", e.getMessage());
- Log.err("Save Package", e.getMessage());
- }
- }
-
- public void componentResized(ComponentEvent arg0) {
- if (this.jSplitPane != null) {
- this.jSplitPane.setSize(this.getWidth() - DataType.MAIN_FRAME_WIDTH_SPACING,
- this.getHeight() - DataType.MAIN_FRAME_HEIGHT_SPACING);
- this.jSplitPane.validate();
- resizeDesktopPanel();
- }
- }
-
- /**
- Resize JDesktopPanel
-
- */
- private void resizeDesktopPanel() {
- resizeDesktopPanel(this.jDesktopPaneModule);
- resizeDesktopPanel(this.jDesktopPanePackage);
- resizeDesktopPanel(this.jDesktopPanePlatform);
- }
-
- /**
- Resize JDesktopPanel
-
- */
- private void resizeDesktopPanel(JDesktopPane jdk) {
- JInternalFrame[] iif = jdk.getAllFrames();
- for (int index = 0; index < iif.length; index++) {
- iif[index].setSize(jdk.getWidth(), jdk.getHeight());
- }
- }
-
- private void insertModuleTreeNode(Identification id, IDefaultMutableTreeNode belongNode) {
- iTree.addNode(new IDefaultMutableTreeNode("Module Header", IDefaultMutableTreeNode.MSA_HEADER, true, id,
- belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Source Files", IDefaultMutableTreeNode.MSA_SOURCEFILES, true, id,
- belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Library Class Definitions",
- IDefaultMutableTreeNode.MSA_LIBRARYCLASSDEFINITIONS, true, id,
- belongNode));
- iTree
- .addNode(new IDefaultMutableTreeNode("Package Dependencies",
- IDefaultMutableTreeNode.MSA_PACKAGEDEPENDENCIES, true, id, belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Protocols", IDefaultMutableTreeNode.MSA_PROTOCOLS, true, id,
- belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Events", IDefaultMutableTreeNode.MSA_EVENTS, true, id, belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Hobs", IDefaultMutableTreeNode.MSA_HOBS, true, id, belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Ppis", IDefaultMutableTreeNode.MSA_PPIS, true, id, belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Variables", IDefaultMutableTreeNode.MSA_VARIABLES, true, id,
- belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Boot Modes", IDefaultMutableTreeNode.MSA_BOOTMODES, true, id,
- belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("System Tables", IDefaultMutableTreeNode.MSA_SYSTEMTABLES, true, id,
- belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Data Hubs", IDefaultMutableTreeNode.MSA_DATAHUBS, true, id,
- belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Hii Packages", IDefaultMutableTreeNode.MSA_HIIPACKAGES, true, id,
- belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Guids", IDefaultMutableTreeNode.MSA_GUIDS, true, id, belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("External Defintions", IDefaultMutableTreeNode.MSA_EXTERNS, true, id,
- belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Pcd Coded", IDefaultMutableTreeNode.MSA_PCDS, true, id, belongNode));
- iTree.addNode(new IDefaultMutableTreeNode("Build Options", IDefaultMutableTreeNode.MSA_BUILDOPTIONS, true, id, belongNode));
- }
-
- private void insertPackageTreeNode(Identification id) {
- IDefaultMutableTreeNode idmtTemp = this.dmtnPackageDescription;
- iTree.addNode(new IDefaultMutableTreeNode("Package Header", IDefaultMutableTreeNode.SPD_HEADER, true, id,
- idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Library Class Declarations",
- IDefaultMutableTreeNode.SPD_LIBRARYCLASSDECLARATIONS, true, id,
- idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Msa Files", IDefaultMutableTreeNode.SPD_MSAFILES, false, id,
- idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Package Includes", IDefaultMutableTreeNode.SPD_PACKAGEHEADERS, true,
- id, idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Guid Declarations", IDefaultMutableTreeNode.SPD_GUIDDECLARATIONS,
- true, id, idmtTemp));
- iTree
- .addNode(new IDefaultMutableTreeNode("Protocol Declarations",
- IDefaultMutableTreeNode.SPD_PROTOCOLDECLARATIONS, true, id, idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Ppi Declarations", IDefaultMutableTreeNode.SPD_PPIDECLARATIONS,
- true, id, idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Pcd Declarations", IDefaultMutableTreeNode.SPD_PCDDECLARATIONS,
- true, id, idmtTemp));
- //
- // Add modules in this package
- //
- IDefaultMutableTreeNode dmtnModulePackageLibrary = null;
- IDefaultMutableTreeNode dmtnModulePackageModule = null;
-
- dmtnModulePackageLibrary = new IDefaultMutableTreeNode("Library",
- IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY, false,
- id, idmtTemp);
- dmtnModulePackageModule = new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
- false, id, idmtTemp);
-
- Vector<ModuleIdentification> vModule = wt.getAllModules(new PackageIdentification(id));
- for (int indexJ = 0; indexJ < vModule.size(); indexJ++) {
- if (vModule.get(indexJ).isLibrary()) {
- dmtnModulePackageLibrary.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
- IDefaultMutableTreeNode.MODULE, false,
- vModule.get(indexJ), idmtTemp));
- } else {
- dmtnModulePackageModule.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
- IDefaultMutableTreeNode.MODULE, false,
- vModule.get(indexJ), idmtTemp));
- }
- }
- if (dmtnModulePackageModule.getChildCount() > 0) {
- iTree.addNode(dmtnModulePackageModule);
- }
- if (dmtnModulePackageLibrary.getChildCount() > 0) {
- iTree.addNode(dmtnModulePackageLibrary);
- }
- }
-
- private void insertPlatformTreeNode(Identification id) {
- IDefaultMutableTreeNode idmtTemp = this.dmtnPlatformDescription;
- iTree.addNode(new IDefaultMutableTreeNode("Platform Header", IDefaultMutableTreeNode.FPD_PLATFORMHEADER, true,
- id, idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Platform Definitions",
- IDefaultMutableTreeNode.FPD_PLATFORMDEFINITIONS, true, id, idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Flash Information", IDefaultMutableTreeNode.FPD_FLASH, true, id,
- idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Framework Modules", IDefaultMutableTreeNode.FPD_FRAMEWORKMODULES,
- true, id, idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Dynamic PCD Build Declarations",
- IDefaultMutableTreeNode.FPD_PCDDYNAMICBUILDDECLARATIONS, true, id,
- idmtTemp));
- iTree.addNode(new IDefaultMutableTreeNode("Build Options", IDefaultMutableTreeNode.FPD_BUILDOPTIONS, true, id,
- idmtTemp));
-
- //
- // Add modules in this platform
- //
- IDefaultMutableTreeNode dmtnModulePackageLibrary = null;
- IDefaultMutableTreeNode dmtnModulePackageModule = null;
-
- dmtnModulePackageLibrary = new IDefaultMutableTreeNode("Library",
- IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY, false,
- id, idmtTemp);
- dmtnModulePackageModule = new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
- false, id, idmtTemp);
-
- Vector<ModuleIdentification> vModule = wt.getAllModules(new PlatformIdentification(id));
- for (int indexJ = 0; indexJ < vModule.size(); indexJ++) {
- if (vModule.get(indexJ).isLibrary()) {
- dmtnModulePackageLibrary.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
- IDefaultMutableTreeNode.MODULE, false,
- vModule.get(indexJ), idmtTemp));
- } else {
- dmtnModulePackageModule.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
- IDefaultMutableTreeNode.MODULE, false,
- vModule.get(indexJ), idmtTemp));
- }
- }
- if (dmtnModulePackageModule.getChildCount() > 0) {
- iTree.addNode(dmtnModulePackageModule);
- }
- if (dmtnModulePackageLibrary.getChildCount() > 0) {
- iTree.addNode(dmtnModulePackageLibrary);
- }
- }
-
- /**
- Operate when double click a tree node
-
- **/
- private void doubleClickModuleTreeNode() {
- Identification id = null;
- int intCategory = -1;
- String path = null;
- IDefaultMutableTreeNode belongNode = null;
-
- try {
- //
- // Get selected tree node
- //
- if (iTree.getSelectNode() != null) {
- id = iTree.getSelectNode().getId();
- }
-
- //
- // If id is null, return directly
- //
- if (id == null) {
- return;
- }
-
- intCategory = iTree.getSelectCategory();
- belongNode = iTree.getSelectNode().getBelongNode();
-
- //
- // If the node is not opened yet
- // Insert top level elements first
- //
- if (intCategory == IDefaultMutableTreeNode.MODULE) {
- path = iTree.getSelectNode().getId().getPath();
- openModule(path, belongNode);
- return;
- }
- if (intCategory == IDefaultMutableTreeNode.PACKAGE) {
- path = iTree.getSelectNode().getId().getPath();
- openPackage(path);
- return;
- }
- if (intCategory == IDefaultMutableTreeNode.PLATFORM) {
- path = iTree.getSelectNode().getId().getPath();
- openPlatform(path);
- return;
- }
-
- //
- // Show editor panel
- //
- if (intCategory >= IDefaultMutableTreeNode.MSA_HEADER && intCategory < IDefaultMutableTreeNode.SPD_HEADER) {
- showModuleElement(intCategory,
- GlobalData.openingModuleList.getOpeningModuleById(new ModuleIdentification(id)));
- this.currentOpeningModuleIndex = GlobalData.openingModuleList
- .findIndexOfListById(new ModuleIdentification(
- id));
- }
- if (intCategory >= IDefaultMutableTreeNode.SPD_HEADER
- && intCategory < IDefaultMutableTreeNode.FPD_PLATFORMHEADER) {
- showPackageElement(intCategory,
- GlobalData.openingPackageList.getOpeningPackageById(new PackageIdentification(id)));
- this.currentOpeningPackageIndex = GlobalData.openingPackageList
- .findIndexOfListById(new PackageIdentification(
- id));
- }
- if (intCategory >= IDefaultMutableTreeNode.FPD_PLATFORMHEADER) {
- showPlatformElement(
- intCategory,
- GlobalData.openingPlatformList
- .getOpeningPlatformById(new PlatformIdentification(id)));
- this.currentOpeningPlatformIndex = GlobalData.openingPlatformList
- .findIndexOfListById(new PlatformIdentification(
- id));
- }
- } catch (Exception e) {
- Log.err("double click category: " + intCategory);
- Log.err("double click belong node: " + belongNode.toString());
- Log.err("double click id path: " + id);
- Log.err("double click exception: " + e.getMessage());
- }
- }
-
- /**
- Show content of editor panel via selected element
-
- @param elementType
- @param fpd
-
- **/
- private void showPlatformElement(int elementType, OpeningPlatformType fpd) {
- this.cleanDesktopPanePlatform();
-
- switch (elementType) {
- case IDefaultMutableTreeNode.FPD_PLATFORMDEFINITIONS:
- FpdPlatformDefs frmFpdPlatformDefs = new FpdPlatformDefs(fpd);
- getJDesktopPanePlatform().add(frmFpdPlatformDefs, 1);
- break;
- case IDefaultMutableTreeNode.FPD_PLATFORMHEADER:
- FpdHeader frmFpdHeader = new FpdHeader(fpd);
- getJDesktopPanePlatform().add(frmFpdHeader, 1);
- break;
- case IDefaultMutableTreeNode.FPD_FLASH:
- FpdFlash frmFpdFlash = new FpdFlash(fpd);
- getJDesktopPanePlatform().add(frmFpdFlash, 1);
- break;
- case IDefaultMutableTreeNode.FPD_FRAMEWORKMODULES:
- FpdFrameworkModules frmFpdFrameworkModules = new FpdFrameworkModules(fpd);
- getJDesktopPanePlatform().add(frmFpdFrameworkModules, 1);
- break;
- case IDefaultMutableTreeNode.FPD_PCDDYNAMICBUILDDECLARATIONS:
- FpdDynamicPcdBuildDefinitions frmFpdDynamicPcdBuildDefinitions = new FpdDynamicPcdBuildDefinitions(fpd);
- getJDesktopPanePlatform().add(frmFpdDynamicPcdBuildDefinitions, 1);
- break;
- case IDefaultMutableTreeNode.FPD_BUILDOPTIONS:
- FpdBuildOptions frmFpdBuildOptions = new FpdBuildOptions(fpd);
- getJDesktopPanePlatform().add(frmFpdBuildOptions, 1);
- break;
- }
- this.jTabbedPaneEditor.setSelectedIndex(2);
- resizeDesktopPanel();
- }
-
- /**
- Show content of editor panel via selected element
-
- @param elementType
- @param spd
-
- */
- private void showPackageElement(int elementType, OpeningPackageType spd) {
- this.cleanDesktopPanePackage();
- Tools.dirForNewSpd = spd.getId().getPath();
- switch (elementType) {
- case IDefaultMutableTreeNode.SPD_HEADER:
- SpdHeader frmSpdHeader = new SpdHeader(spd);
- getJDesktopPanePackage().add(frmSpdHeader, 1);
- break;
- case IDefaultMutableTreeNode.SPD_LIBRARYCLASSDECLARATIONS:
- SpdLibClassDecls frmSlcd = new SpdLibClassDecls(spd, this);
- getJDesktopPanePackage().add(frmSlcd, 1);
- break;
- case IDefaultMutableTreeNode.SPD_MSAFILES:
- SpdMsaFiles frmSmf = new SpdMsaFiles(spd, this);
- getJDesktopPanePackage().add(frmSmf, 1);
- break;
- case IDefaultMutableTreeNode.SPD_PACKAGEHEADERS:
- SpdPackageHeaders frmSph = new SpdPackageHeaders(spd, this);
- getJDesktopPanePackage().add(frmSph, 1);
- break;
- case IDefaultMutableTreeNode.SPD_GUIDDECLARATIONS:
- SpdGuidDecls frmSgd = new SpdGuidDecls(spd, this);
- getJDesktopPanePackage().add(frmSgd, 1);
- break;
- case IDefaultMutableTreeNode.SPD_PROTOCOLDECLARATIONS:
- SpdProtocolDecls frmSprod = new SpdProtocolDecls(spd, this);
- getJDesktopPanePackage().add(frmSprod, 1);
- break;
- case IDefaultMutableTreeNode.SPD_PPIDECLARATIONS:
- SpdPpiDecls frmSppid = new SpdPpiDecls(spd, this);
- getJDesktopPanePackage().add(frmSppid, 1);
- break;
- case IDefaultMutableTreeNode.SPD_PCDDECLARATIONS:
- SpdPcdDefs frmSpcdd = new SpdPcdDefs(spd, this);
- getJDesktopPanePackage().add(frmSpcdd, 1);
- break;
- }
- this.jTabbedPaneEditor.setSelectedIndex(1);
- resizeDesktopPanel();
- }
-
- /**
- Show content of editor panel via selected element
-
- @param elementType
- @param msa
-
- */
- private void showModuleElement(int elementType, OpeningModuleType msa) {
- this.cleanDesktopPaneModule();
- switch (elementType) {
- case IDefaultMutableTreeNode.MSA_HEADER:
- MsaHeader frmMsaHeader = new MsaHeader(msa);
- getJDesktopPaneModule().add(frmMsaHeader, 1);
- break;
- case IDefaultMutableTreeNode.MSA_LIBRARYCLASSDEFINITIONS:
- ModuleLibraryClassDefinitions frmMlcd = new ModuleLibraryClassDefinitions(msa, this);
- getJDesktopPaneModule().add(frmMlcd, 1);
- break;
- case IDefaultMutableTreeNode.MSA_PACKAGEDEPENDENCIES:
- ModulePackageDependencies frmMpd = new ModulePackageDependencies(msa, this);
- getJDesktopPaneModule().add(frmMpd, 1);
- break;
- case IDefaultMutableTreeNode.MSA_SOURCEFILES:
- ModuleSourceFiles frmMsf = new ModuleSourceFiles(msa, this);
- getJDesktopPaneModule().add(frmMsf, 1);
- break;
- case IDefaultMutableTreeNode.MSA_PROTOCOLS:
- ModuleProtocols frmMp = new ModuleProtocols(msa, this);
- getJDesktopPaneModule().add(frmMp, 1);
- break;
- case IDefaultMutableTreeNode.MSA_EVENTS:
- ModuleEvents frmMe = new ModuleEvents(msa, this);
- getJDesktopPaneModule().add(frmMe, 1);
- break;
- case IDefaultMutableTreeNode.MSA_HOBS:
- ModuleHobs frmMh = new ModuleHobs(msa, this);
- getJDesktopPaneModule().add(frmMh, 1);
- break;
- case IDefaultMutableTreeNode.MSA_PPIS:
- ModulePpis frmMpp = new ModulePpis(msa, this);
- getJDesktopPaneModule().add(frmMpp, 1);
- break;
- case IDefaultMutableTreeNode.MSA_VARIABLES:
- ModuleVariables frmMv = new ModuleVariables(msa, this);
- getJDesktopPaneModule().add(frmMv, 1);
- break;
- case IDefaultMutableTreeNode.MSA_BOOTMODES:
- ModuleBootModes frmMbm = new ModuleBootModes(msa, this);
- getJDesktopPaneModule().add(frmMbm, 1);
- break;
- case IDefaultMutableTreeNode.MSA_SYSTEMTABLES:
- ModuleSystemTables frmMst = new ModuleSystemTables(msa, this);
- getJDesktopPaneModule().add(frmMst, 1);
- break;
- case IDefaultMutableTreeNode.MSA_DATAHUBS:
- ModuleDataHubs frmMdh = new ModuleDataHubs(msa, this);
- getJDesktopPaneModule().add(frmMdh, 1);
- break;
- case IDefaultMutableTreeNode.MSA_HIIPACKAGES:
- ModuleHiiPackages frmMf = new ModuleHiiPackages(msa, this);
- getJDesktopPaneModule().add(frmMf, 1);
- break;
- case IDefaultMutableTreeNode.MSA_GUIDS:
- ModuleGuids frmGuid = new ModuleGuids(msa, this);
- getJDesktopPaneModule().add(frmGuid, 1);
- break;
- case IDefaultMutableTreeNode.MSA_EXTERNS:
- ModuleExterns frmMex = new ModuleExterns(msa, this);
- getJDesktopPaneModule().add(frmMex, 1);
- break;
- case IDefaultMutableTreeNode.MSA_PCDS:
- ModulePCDs frmPcd = new ModulePCDs(msa, this);
- getJDesktopPaneModule().add(frmPcd, 1);
- break;
- case IDefaultMutableTreeNode.MSA_BUILDOPTIONS:
- ModuleBuildOptions frmMbo = new ModuleBuildOptions(msa, this);
- getJDesktopPaneModule().add(frmMbo, 1);
- break;
- }
- this.jTabbedPaneEditor.setSelectedIndex(0);
- resizeDesktopPanel();
- }
-
- //
- // Define operations of menu
- //
- /**
- New a file
-
- **/
- private void fileNew() {
- int result = -1;
- //
- // Selece new file type
- //
- NewFileChooser nfc = new NewFileChooser(this, true);
- result = nfc.showDialog();
-
- if (result == DataType.RETURN_TYPE_CANCEL) {
- nfc.dispose();
- return;
- } else if (result == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- //
- // To new a module
- //
- SelectModuleBelong smb = new SelectModuleBelong(this, true, result);
- result = smb.showDialog();
-
- if (result == DataType.RETURN_TYPE_CANCEL) {
- nfc.dispose();
- smb.dispose();
- return;
- } else if (result == DataType.RETURN_TYPE_OK) {
- ModuleIdentification mid = smb.getMid();
- if (mid != null) {
- //
- // Update package of workspace first
- //
- PackageSurfaceAreaDocument.PackageSurfaceArea psa = null;
- if (GlobalData.openingPackageList.existsPackage(mid.getPackageId())) {
- psa = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(mid.getPackageId());
- }
- try {
- wt.addModuleToPackage(mid, psa);
- } catch (IOException e) {
- Log.wrn("Update MsaFiles in Package", e.getMessage());
- Log.err("Update MsaFiles in Package", e.getMessage());
- return;
- } catch (XmlException e) {
- Log.wrn("Update MsaFiles in Package", e.getMessage());
- Log.err("Update MsaFiles in Package", e.getMessage());
- return;
- } catch (Exception e) {
- Log.wrn("Update MsaFiles in Package", e.getMessage());
- Log.err("Update MsaFiles in Package", e.getMessage());
- return;
- }
-
- //
- // Update Global Data
- //
- GlobalData.openingModuleList.insertToOpeningModuleList(mid, smb.getMsa());
- GlobalData.vModuleList.addElement(mid);
-
- //
- // Create new node on the tree
- //
- addModuleToTree(mid);
-
- //
- // Open the node
- //
- this.openModule(mid.getPath(), this.dmtnModuleDescription);
- }
- }
- } else if (result == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- //
- // To new a package
- //
- SelectModuleBelong smb = new SelectModuleBelong(this, true, result);
- result = smb.showDialog();
-
- if (result == DataType.RETURN_TYPE_CANCEL) {
- nfc.dispose();
- smb.dispose();
- return;
- } else if (result == DataType.RETURN_TYPE_OK) {
- PackageIdentification pid = smb.getPid();
- if (pid != null) {
- try {
- wt.addPackageToDatabase(smb.getPid());
- } catch (Exception e) {
- Log.err("addPackageToDatabase", e.getMessage());
- }
-
- //
- // Update Global Data
- //
- GlobalData.openingPackageList.insertToOpeningPackageList(pid, smb.getSpd());
- GlobalData.vPackageList.addElement(pid);
-
- //
- // Add to Module Description node
- //
- IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(pid.getName(),
- IDefaultMutableTreeNode.MODULE_PACKAGE,
- false, pid, this.dmtnModuleDescription);
-
- iTree.addNode(dmtnModuleDescription, node);
-
- //
- // Add new SpdHeader node to the tree
- //
- node = new IDefaultMutableTreeNode(pid.getName(), IDefaultMutableTreeNode.PACKAGE, true, pid,
- this.dmtnPackageDescription);
- iTree.addNode(dmtnPackageDescription, node);
-
- this.openPackage(pid.getPath());
- }
- }
- } else if (result == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- //
- // To new a platform
- //
- SelectModuleBelong smb = new SelectModuleBelong(this, true, result);
- result = smb.showDialog();
-
- if (result == DataType.RETURN_TYPE_CANCEL) {
- nfc.dispose();
- smb.dispose();
- return;
- } else if (result == DataType.RETURN_TYPE_OK) {
- PlatformIdentification fid = smb.getFid();
- if (fid != null) {
- try {
- wt.addPlatformToDatabase(fid);
- } catch (Exception e) {
- Log.err("addPlatformToDatabase", e.getMessage());
- }
-
- //
- // Update global data
- //
- GlobalData.openingPlatformList.insertToOpeningPlatformList(fid, smb.getFpd());
- GlobalData.vPlatformList.addElement(fid);
- //
- // Add new SpdHeader node to the tree
- //
- IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(fid.getName(),
- IDefaultMutableTreeNode.PLATFORM, true,
- fid, this.dmtnPlatformDescription);
- iTree.addNode(dmtnPlatformDescription, node);
- this.openPlatform(fid.getPath());
- }
- }
- }
- }
-
- /**
- Open a file
-
- **/
- private void open() {
- JFileChooser fc = new JFileChooser(Workspace.getCurrentWorkspace());
- fc.setAcceptAllFileFilterUsed(false);
- IFileFilter iffM = new IFileFilter(DataType.MODULE_SURFACE_AREA_EXT);
- IFileFilter iffP = new IFileFilter(DataType.PACKAGE_SURFACE_AREA_EXT);
- IFileFilter iffF = new IFileFilter(DataType.PLATFORM_SURFACE_AREA_EXT);
- fc.addChoosableFileFilter(iffM);
- fc.addChoosableFileFilter(iffP);
- fc.addChoosableFileFilter(iffF);
- fc.setFileFilter(iffM);
-
- int result = fc.showOpenDialog(new JPanel());
-
- if (result == JFileChooser.APPROVE_OPTION) {
- String path = fc.getSelectedFile().getPath();
- String match = path.substring(path.length() - 4);
- if (match.equals(DataType.FILE_EXT_SEPARATOR + DataType.MODULE_SURFACE_AREA_EXT)) {
- openModule(path, this.dmtnModuleDescription);
- } else if (match.equals(DataType.FILE_EXT_SEPARATOR + DataType.PACKAGE_SURFACE_AREA_EXT)) {
- openPackage(path);
- } else if (match.equals(DataType.FILE_EXT_SEPARATOR + DataType.PLATFORM_SURFACE_AREA_EXT)) {
- openPlatform(path);
- }
- }
- }
-
- /**
- Close files
-
- **/
- private void close() {
- TreePath item = null;
- switch (this.jTabbedPaneEditor.getSelectedIndex()) {
- //
- // Current is module
- //
- case 0:
- if (this.currentOpeningModuleIndex > -1) {
- if (!GlobalData.openingModuleList.getModuleSaved(currentOpeningModuleIndex)) {
- int result = showSaveDialog();
- if (result == JOptionPane.YES_OPTION) {
- this.save();
- }
- if (result == JOptionPane.NO_OPTION) {
- // Do nothing
- }
- if (result == JOptionPane.CANCEL_OPTION) {
- return;
- }
- }
-
- //
- // Remove all tree paths for the module
- //
- Set<TreePath> openingTreePaths = GlobalData.openingModuleList
- .getTreePathByIndex(currentOpeningModuleIndex);
- Iterator<TreePath> openingTreePathsIter = openingTreePaths.iterator();
- while (openingTreePathsIter.hasNext()) {
- item = openingTreePathsIter.next();
- iTree.getNodeByPath(item).setOpening(false);
- iTree.removeNodeChildrenByPath(item);
- }
-
- GlobalData.openingModuleList.reload(this.currentOpeningModuleIndex);
- GlobalData.openingModuleList.setModuleOpen(this.currentOpeningModuleIndex, false);
- GlobalData.openingModuleList.setModuleSaved(this.currentOpeningModuleIndex, true);
-
- this.cleanDesktopPaneModule();
- this.currentOpeningModuleIndex = -1;
- }
- break;
- //
- // Current is package
- //
- case 1:
- if (this.currentOpeningPackageIndex > -1) {
- if (!GlobalData.openingPackageList.getPackageSaved(currentOpeningPackageIndex)) {
- int result = showSaveDialog();
- if (result == JOptionPane.YES_OPTION) {
- this.save();
- }
- if (result == JOptionPane.NO_OPTION) {
- // Do nothing
- }
- if (result == JOptionPane.CANCEL_OPTION) {
- return;
- }
- }
-
- //
- // Remove all tree paths for the module
- //
- Set<TreePath> openingTreePaths = GlobalData.openingPackageList
- .getTreePathByIndex(currentOpeningPackageIndex);
- Iterator<TreePath> openingTreePathsIter = openingTreePaths.iterator();
- while (openingTreePathsIter.hasNext()) {
- item = openingTreePathsIter.next();
- iTree.getNodeByPath(item).setOpening(false);
- iTree.removeNodeChildrenByPath(item);
- }
-
- GlobalData.openingPackageList.reload(this.currentOpeningPackageIndex);
- GlobalData.openingPackageList.setPackageOpen(this.currentOpeningPackageIndex, false);
- GlobalData.openingPackageList.setPackageSaved(this.currentOpeningPackageIndex, true);
- this.cleanDesktopPanePackage();
- this.currentOpeningPackageIndex = -1;
- }
- break;
- //
- // Current is platform
- //
- case 2:
- if (this.currentOpeningPlatformIndex > -1) {
- if (!GlobalData.openingPlatformList.getPlatformSaved(currentOpeningPlatformIndex)) {
- int result = showSaveDialog();
- if (result == JOptionPane.YES_OPTION) {
- this.save();
- }
- if (result == JOptionPane.NO_OPTION) {
- // Do nothing
- }
- if (result == JOptionPane.CANCEL_OPTION) {
- return;
- }
- }
-
- //
- // Remove all tree paths for the module
- //
- Set<TreePath> openingTreePaths = GlobalData.openingPlatformList
- .getTreePathByIndex(currentOpeningPlatformIndex);
- Iterator<TreePath> openingTreePathsIter = openingTreePaths.iterator();
- while (openingTreePathsIter.hasNext()) {
- item = openingTreePathsIter.next();
- iTree.getNodeByPath(item).setOpening(false);
- iTree.removeNodeChildrenByPath(item);
- }
-
- GlobalData.openingPlatformList.reload(this.currentOpeningPlatformIndex);
- GlobalData.openingPlatformList.setPlatformOpen(this.currentOpeningPlatformIndex, false);
- GlobalData.openingPlatformList.setPlatformSaved(this.currentOpeningPlatformIndex, true);
- this.cleanDesktopPanePlatform();
- this.currentOpeningPlatformIndex = -1;
- }
- break;
- }
- }
-
- /**
- Close all opening files and clean all showing internal frame
-
- **/
- private int closeAll() {
- int result = JOptionPane.NO_OPTION;
- if (!GlobalData.openingModuleList.isSaved() || !GlobalData.openingPackageList.isSaved()
- || !GlobalData.openingPlatformList.isSaved()) {
- result = showSaveDialog();
- }
- if (result == JOptionPane.YES_OPTION) {
- this.saveAll();
- }
- if (result == JOptionPane.NO_OPTION) {
- //
- // Do nothing
- //
- }
- if (result == JOptionPane.CANCEL_OPTION || result == JOptionPane.CLOSED_OPTION) {
- return -1;
- }
- this.cleanDesktopPane();
- GlobalData.openingModuleList.closeAll();
- GlobalData.openingPackageList.closeAll();
- GlobalData.openingPlatformList.closeAll();
-
- return 0;
- }
-
- /**
- Refresh all global data from disk to memory
-
- **/
- private void refresh() {
- GlobalData.init();
- }
-
- /**
- Save currentModule when press button OK
-
- **/
- private void save() {
- switch (this.jTabbedPaneEditor.getSelectedIndex()) {
- case 0:
- if (this.currentOpeningModuleIndex > -1) {
- saveModule(this.currentOpeningModuleIndex);
- }
- break;
- case 1:
- if (this.currentOpeningPackageIndex > -1) {
- savePackage(this.currentOpeningPackageIndex);
- }
- break;
- case 2:
- if (this.currentOpeningPlatformIndex > -1) {
- savePlatform(this.currentOpeningPlatformIndex);
- }
- break;
- }
- }
-
- private void saveAs() {
-
- }
-
- private void saveAll() {
- //
- // Save all modules
- //
- for (int index = 0; index < GlobalData.openingModuleList.size(); index++) {
- if (!GlobalData.openingModuleList.getModuleSaved(index)) {
- saveModule(index);
- }
- }
-
- //
- // Save all packages
- //
- for (int index = 0; index < GlobalData.openingPackageList.size(); index++) {
- if (!GlobalData.openingPackageList.getPackageSaved(index)) {
- savePackage(index);
- }
- }
-
- //
- // Save all platforms
- //
- for (int index = 0; index < GlobalData.openingPlatformList.size(); index++) {
- if (!GlobalData.openingPlatformList.getPlatformSaved(index)) {
- savePlatform(index);
- }
- }
- }
-
- /**
- To save changed items before exit.
-
- **/
- private void exit() {
- int result = JOptionPane.NO_OPTION;
- if (!GlobalData.openingModuleList.isSaved() || !GlobalData.openingPackageList.isSaved()
- || !GlobalData.openingPlatformList.isSaved()) {
- result = showSaveDialog();
- }
- if (result == JOptionPane.YES_OPTION) {
- this.saveAll();
- } else if (result == JOptionPane.NO_OPTION) {
- // Do nothing
- } else if (result == JOptionPane.CANCEL_OPTION || result == JOptionPane.CLOSED_OPTION) {
- return;
- }
- this.dispose();
- System.exit(0);
- }
-
- /**
- To find all defined PPIs in workspace
-
- **/
- private void findPpi() {
- FindResult fr = FindResult.getInstance("PPI");
- fr.setVisible(true);
- }
-
- /**
- To find all defined PROTOCOLs in workspace
-
- **/
- private void findProtocol() {
- FindResult fr = FindResult.getInstance("PROTOCOL");
- fr.setVisible(true);
- }
-
- /**
- To find all defined PROTOCOLs in workspace
-
- **/
- private void findGuid() {
- FindResult fr = FindResult.getInstance("GUID");
- fr.setVisible(true);
- }
-
- /**
- To find all defined PROTOCOLs in workspace
-
- **/
- private void findPcd() {
- FindResult fr = FindResult.getInstance("PCD");
- fr.setVisible(true);
- }
-
- /**
- To find all defined Library Classes in workspace
-
- **/
- private void findLibraryClass() {
- FindResult fr = FindResult.getInstance("LIBRARY_CLASS");
- fr.setVisible(true);
- }
-
- /**
- To find all defined Library Instances in workspace
-
- **/
- private void findLibraryInstance() {
- FindResult fr = FindResult.getInstance("LIBRARY_INSTANCE");
- fr.setVisible(true);
- }
-
- /**
- Switch current workspace to others
-
- **/
- private void changeWorkspace() {
- SwitchWorkspace sw = new SwitchWorkspace(this, true);
- int result = sw.showDialog();
- if (result == DataType.RETURN_TYPE_CANCEL) {
- return;
- } else if (result == DataType.RETURN_TYPE_OK) {
- //
- // Reinit whole window
- //
- this.closeAll();
- this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- ["
- + Workspace.getCurrentWorkspace() + "]");
- //
- // Refrash the tree
- //
- this.refresh();
- this.makeEmptyTree();
- }
- sw.dispose();
- }
-
- /**
- To create a Far file from current workspace
-
- **/
- private void createFar() {
- CreateStepOne cso = new CreateStepOne(this, true);
- int result = cso.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- String strReturn = "Far Creation Completed!";
- JOptionPane.showConfirmDialog(this, strReturn, "Done", JOptionPane.DEFAULT_OPTION,
- JOptionPane.INFORMATION_MESSAGE);
- }
- cso.dispose();
- }
-
- /**
- To install a Far file to current workspace
-
- **/
- private void installFar() {
- InstallStepOne iso = new InstallStepOne(this, true);
- int result = iso.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- String strReturn = "<html>Far Installalation completed!<br>Refreshing the WORKSPACE!</html>";
- JOptionPane.showConfirmDialog(this, strReturn, "Done", JOptionPane.DEFAULT_OPTION,
- JOptionPane.INFORMATION_MESSAGE);
- this.closeAll();
- this.refresh();
- this.makeEmptyTree();
- }
- iso.dispose();
- }
-
- /**
- To remove a Far's items from current workspace
-
- **/
- private void removeFar() {
- DeleteStepOne dso = new DeleteStepOne(this, true);
- int result = dso.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- String strReturn = "<html>Far Deletion completed!<br>Refreshing the WORKSPACE!</html>";
- JOptionPane.showConfirmDialog(this, strReturn, "Done", JOptionPane.DEFAULT_OPTION,
- JOptionPane.INFORMATION_MESSAGE);
- this.closeAll();
- this.refresh();
- this.makeEmptyTree();
- }
- dso.dispose();
- }
-
- /**
- To update an existing Far file
-
- **/
- private void updateFar() {
- UpdateStepOne uso = new UpdateStepOne(this, true);
- int result = uso.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- String strReturn = "<html>Far Update completed!<br>Refreshing the WORKSPACE!</html>";
- JOptionPane.showConfirmDialog(this, strReturn, "Done", JOptionPane.DEFAULT_OPTION,
- JOptionPane.INFORMATION_MESSAGE);
- this.closeAll();
- this.refresh();
- this.makeEmptyTree();
- }
- uso.dispose();
- }
-
- /**
- Show Tool Chain Configuration Dialog to setup Tool Chain
-
- **/
- private void setupToolChainConfiguration() {
- ToolChainConfig tcc = ToolChainConfig.getInstance();
- tcc.showDialog();
- }
-
- private void configBuildPreferences() {
- Preferences bt = Preferences.getInstance();
- bt.showDialog();
- }
-
- /**
- Clone selected item
-
- **/
- private void cloneItem() {
- int mode = -1;
-
- //
- // Check if there is any item can be cloned
- //
- if (iTree.getSelectionPath() == null) {
- Log.wrn("Clone", "Please select a target to clone!");
- return;
- }
- int category = iTree.getSelectCategory();
- Identification id = iTree.getSelectNode().getId();
-
- if (category == IDefaultMutableTreeNode.WORKSPACE) {
- mode = DataType.RETURN_TYPE_WORKSPACE;
- id = null;
- }
- if ((category == IDefaultMutableTreeNode.MODULE)
- || (category >= IDefaultMutableTreeNode.MSA_HEADER && category < IDefaultMutableTreeNode.SPD_HEADER)) {
- mode = DataType.RETURN_TYPE_MODULE_SURFACE_AREA;
- }
- if ((category == IDefaultMutableTreeNode.PACKAGE)
- || (category >= IDefaultMutableTreeNode.SPD_HEADER && category < IDefaultMutableTreeNode.FPD_PLATFORMHEADER)) {
- mode = DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA;
- }
- if ((category == IDefaultMutableTreeNode.PLATFORM) || (category >= IDefaultMutableTreeNode.FPD_PLATFORMHEADER)) {
- mode = DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA;
- }
-
- Clone c = new Clone(this, true, mode, id);
- int result = c.showDialog();
-
- if (result == DataType.RETURN_TYPE_CANCEL) {
- c.dispose();
- }
- if (result == DataType.RETURN_TYPE_WORKSPACE) {
- Tools.showInformationMessage("Workspace Clone Completed!");
- }
- if (result == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- Tools.showInformationMessage("Module Clone Completed!");
- addModuleToTree(c.getMid());
- }
- if (result == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- Tools.showInformationMessage("Package Clone Completed!");
- //
- // Add new SpdHeader node to the tree
- //
- IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(GlobalData.vPackageList.lastElement().getName(),
- IDefaultMutableTreeNode.PACKAGE, false,
- GlobalData.vPackageList.lastElement(),
- this.dmtnPackageDescription);
- iTree.addNode(this.dmtnPackageDescription, node);
- }
- if (result == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- Tools.showInformationMessage("Platform Surface Area Clone Finished");
- //
- // Add new SpdHeader node to the tree
- //
- IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(
- GlobalData.vPlatformList.lastElement().getName(),
- IDefaultMutableTreeNode.PLATFORM, false,
- GlobalData.vPlatformList.lastElement(),
- this.dmtnPlatformDescription);
- iTree.addNode(this.dmtnPlatformDescription, node);
- }
- if (result == DataType.RETURN_TYPE_OK) {
-
- }
- }
-
- public void valueChanged(TreeSelectionEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void menuCanceled(MenuEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void menuDeselected(MenuEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void menuSelected(MenuEvent arg0) {
- if (arg0.getSource() == jMenuFile) {
- //
- // Enable close/close all if some files are opened
- //
- switch (this.jTabbedPaneEditor.getSelectedIndex()) {
- case 0:
- jMenuItemFileClose
- .setEnabled(GlobalData.openingModuleList
- .getModuleOpen(this.currentOpeningModuleIndex));
- jMenuItemFileSave
- .setEnabled(!GlobalData.openingModuleList
- .getModuleSaved(this.currentOpeningModuleIndex));
- break;
- case 1:
- jMenuItemFileClose
- .setEnabled(GlobalData.openingPackageList
- .getPackageOpen(this.currentOpeningPackageIndex));
- jMenuItemFileSave
- .setEnabled(!GlobalData.openingPackageList
- .getPackageSaved(this.currentOpeningPackageIndex));
- break;
- case 2:
- jMenuItemFileClose
- .setEnabled(GlobalData.openingPlatformList
- .getPlatformOpen(this.currentOpeningPlatformIndex));
- jMenuItemFileSave
- .setEnabled(!GlobalData.openingPlatformList
- .getPlatformSaved(this.currentOpeningPlatformIndex));
- break;
- }
- jMenuItemFileCloseAll.setEnabled(GlobalData.openingModuleList.isOpen()
- || GlobalData.openingPackageList.isOpen()
- || GlobalData.openingPlatformList.isOpen());
-
- //
- // Enable save/save all if some files are changed
- //
- jMenuItemFileSaveAll.setEnabled(!GlobalData.openingModuleList.isSaved()
- || !GlobalData.openingPackageList.isSaved()
- || !GlobalData.openingPlatformList.isSaved());
- }
-
- if (arg0.getSource() == jMenuTools) {
- //
- // Enable clone when select some items
- //
- if (iTree.getSelectionPath() == null) {
- jMenuItemToolsClone.setEnabled(false);
- } else {
- int category = iTree.getSelectCategory();
- if (category == IDefaultMutableTreeNode.MODULE_DESCRIPTION
- || category == IDefaultMutableTreeNode.PACKAGE_DESCRIPTION
- || category == IDefaultMutableTreeNode.PLATFORM_DESCRIPTION
- || category == IDefaultMutableTreeNode.MODULE_PACKAGE
- || category == IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY
- || category == IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE) {
- jMenuItemToolsClone.setEnabled(false);
- } else {
- jMenuItemToolsClone.setEnabled(true);
- }
- }
- }
- }
-
- public void keyTyped(KeyEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void keyPressed(KeyEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void keyReleased(KeyEvent arg0) {
- if (arg0.getSource() == this.iTree) {
- if (arg0.getKeyCode() == KeyEvent.VK_ENTER) {
- this.doubleClickModuleTreeNode();
- }
- }
- }
-
- /**
- Search whole workspace and find all module's name and guid, and save them to a file
-
- **/
- private void generateGuidsXref() {
- //
- // Init File Chooser
- //
- JFileChooser fc = new JFileChooser();
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
- fc.setSelectedFile(new File(Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR
- + DataType.GUIDS_XREF_FILE_NAME));
- fc.setMultiSelectionEnabled(false);
-
- //
- // Get guids xref and save to file
- //
- int result = fc.showSaveDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- Vector<String> v = wt.getAllModuleGuidXref();
- if (v.size() < 1) {
- Log.wrn("No guids found!!!");
- return;
- }
- File f = fc.getSelectedFile();
- if (!f.exists()) {
- try {
- f.createNewFile();
- } catch (IOException e) {
- Log.wrn("Fail to create file", e.getMessage());
- Log.err("Fail to create file when generating guids.xref", e.getMessage());
- }
- }
- FileWriter fw = null;
- BufferedWriter bw = null;
- try {
- fw = new FileWriter(f);
- bw = new BufferedWriter(fw);
- for (int index = 0; index < v.size(); index++) {
- bw.write(v.get(index));
- bw.newLine();
- }
- bw.flush();
- fw.flush();
- bw.close();
- fw.close();
- } catch (IOException e) {
- Log.wrn("Fail to write file", e.getMessage());
- Log.err("Fail to write file when generating guids.xref", e.getMessage());
- return;
- }
-
- JOptionPane.showConfirmDialog(this, "File is created", "Generate guids.xref", JOptionPane.DEFAULT_OPTION,
- JOptionPane.INFORMATION_MESSAGE);
- }
- }
-
- /**
- Check if WORKSPACE Environment is valid
-
- **/
- private void checkWorkspace() {
- switch (Workspace.checkCurrentWorkspace()) {
- case Workspace.WORKSPACE_VALID:
- break;
- case Workspace.WORKSPACE_NOT_DEFINED:
- JOptionPane
- .showConfirmDialog(
- this,
- "WORKSPACE Environment Variable Is Not Defined, Please select a valid WORKSPACE directory. "
- + DataType.LINE_SEPARATOR
- + DataType.LINE_SEPARATOR
- + "NOTICE:"
- + DataType.LINE_SEPARATOR
- + "This does not change the System Environment Variable."
- + DataType.LINE_SEPARATOR
- + "It only applies to where the Wizard will manage modification and file creations.",
- "Error", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
- SwitchWorkspace sw = new SwitchWorkspace(this, true);
- int result = sw.showDialog();
- if (result == DataType.RETURN_TYPE_CANCEL) {
- this.dispose();
- System.exit(0);
- } else if (result == DataType.RETURN_TYPE_OK) {
- sw.dispose();
- break;
- }
- case Workspace.WORKSPACE_NOT_EXIST:
- JOptionPane.showConfirmDialog(this, "Defined WORKSPACE Is Not Existed", "Error",
- JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
- this.dispose();
- System.exit(0);
- case Workspace.WORKSPACE_NOT_DIRECTORY:
- JOptionPane.showConfirmDialog(this, "Defined WORKSPACE Is Not A Directory", "Error",
- JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
- this.dispose();
- System.exit(0);
- case Workspace.WORKSPACE_NOT_VALID:
- JOptionPane.showConfirmDialog(this, "WORKSPACE Environment Variable Is Not Valid", "Error",
- JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
- this.dispose();
- System.exit(0);
- case Workspace.WORKSPACE_NO_TARGET_FILE:
- JOptionPane.showConfirmDialog(this, "Target.txt File Is Not Existed", "Error", JOptionPane.DEFAULT_OPTION,
- JOptionPane.ERROR_MESSAGE);
- this.dispose();
- System.exit(0);
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/NewFileChooser.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/NewFileChooser.java deleted file mode 100644 index 18cbdb8a8b..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/NewFileChooser.java +++ /dev/null @@ -1,228 +0,0 @@ -/** @file
-
- The file is used to show a new file chooser dialog
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.ButtonGroup;
-import javax.swing.JPanel;
-import javax.swing.JButton;
-import javax.swing.JRadioButton;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-
-public class NewFileChooser extends IDialog {
-
- /**
- Define class members
-
- **/
- private static final long serialVersionUID = -3657926400683618281L;
-
- private JPanel jContentPane = null;
-
- private JButton jButtonNext = null;
-
- private JButton jButtonCancel = null;
-
- private JRadioButton jRadioButtonModule = null;
-
- private JRadioButton jRadioButtonPackage = null;
-
- private JRadioButton jRadioButtonPlatform = null;
-
- private JRadioButton jRadioButtonBuildXml = null;
-
- private final ButtonGroup buttonGroup = new ButtonGroup();
-
- /**
- This is the default constructor
-
- **/
- public NewFileChooser() {
- super();
- init();
- }
-
- /**
- This is the default constructor
-
- **/
- public NewFileChooser(IFrame parentFrame, boolean modal) {
- super(parentFrame, modal);
- init();
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonOk() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(90, 150, 80, 20));
- jButtonNext.setText("Next");
- jButtonNext.addActionListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(180, 150, 80, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jRadioButtonModule
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonModule() {
- if (jRadioButtonModule == null) {
- jRadioButtonModule = new JRadioButton();
- jRadioButtonModule.setText(DataType.MODULE_SURFACE_AREA);
- jRadioButtonModule.setBounds(new java.awt.Rectangle(20, 20, 240, 20));
- jRadioButtonModule.setSelected(true);
- }
- return jRadioButtonModule;
- }
-
- /**
- * This method initializes jRadioButtonPackage
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonPackage() {
- if (jRadioButtonPackage == null) {
- jRadioButtonPackage = new JRadioButton();
- jRadioButtonPackage.setText(DataType.PACKAGE_SURFACE_AREA);
- jRadioButtonPackage.setBounds(new java.awt.Rectangle(20, 50, 240, 20));
- }
- return jRadioButtonPackage;
- }
-
- /**
- * This method initializes jRadioButtonPlatform
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonPlatform() {
- if (jRadioButtonPlatform == null) {
- jRadioButtonPlatform = new JRadioButton();
- jRadioButtonPlatform.setText(DataType.PLATFORM_SURFACE_AREA);
- jRadioButtonPlatform.setBounds(new java.awt.Rectangle(20, 80, 240, 20));
- }
- return jRadioButtonPlatform;
- }
-
- /**
- * This method initializes jRadioButtonBuildXml
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonBuildXml() {
- if (jRadioButtonBuildXml == null) {
- jRadioButtonBuildXml = new JRadioButton();
- jRadioButtonBuildXml.setText(DataType.ANT_BUILD_FILE);
- jRadioButtonBuildXml.setBounds(new java.awt.Rectangle(20, 110, 240, 20));
- jRadioButtonBuildXml.setVisible(false);
- }
- return jRadioButtonBuildXml;
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- NewFileChooser nfc = new NewFileChooser();
- nfc.setVisible(true);
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void init() {
- this.setSize(310, 220);
- this.setContentPane(getJContentPane());
- this.setTitle("Select New File Type");
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJRadioButtonModule(), null);
- jContentPane.add(getJRadioButtonPackage(), null);
- jContentPane.add(getJRadioButtonPlatform(), null);
- jContentPane.add(getJRadioButtonBuildXml(), null);
- buttonGroup.add(this.getJRadioButtonModule());
- buttonGroup.add(this.getJRadioButtonPackage());
- buttonGroup.add(this.getJRadioButtonPlatform());
- buttonGroup.add(this.getJRadioButtonBuildXml());
- }
- 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() == jButtonCancel) {
- this.setVisible(false);
- returnType = DataType.RETURN_TYPE_CANCEL;
- }
-
- if (arg0.getSource() == jButtonNext) {
- this.setVisible(false);
- if (this.jRadioButtonModule.isSelected()) {
- returnType = DataType.RETURN_TYPE_MODULE_SURFACE_AREA;
- }
- if (this.jRadioButtonPackage.isSelected()) {
- returnType = DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA;
- }
- if (this.jRadioButtonPlatform.isSelected()) {
- returnType = DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA;
- }
- if (this.jRadioButtonBuildXml.isSelected()) {
- returnType = DataType.RETURN_TYPE_BUILD_XML;
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SelectModuleBelong.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SelectModuleBelong.java deleted file mode 100644 index 6572067efe..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SelectModuleBelong.java +++ /dev/null @@ -1,809 +0,0 @@ -/** @file
-
- The file is used to let user choose to create module in an existing package
- or to create a new package first.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.util.Vector;
-
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JFileChooser;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-
-import org.tianocore.ModuleTypeDef;
-import org.tianocore.MsaHeaderDocument;
-import org.tianocore.SpdHeaderDocument;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PlatformHeaderDocument.PlatformHeader;
-import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.IFileFilter;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.SaveFile;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-import javax.swing.JRadioButton;
-
-public class SelectModuleBelong extends IDialog {
-
- /**
- Define class members
-
- **/
- private static final long serialVersionUID = 4171355136991448972L;
-
- private JPanel jContentPane = null;
-
- private JComboBox jComboBoxExistingPackage = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private Vector<PackageIdentification> packages = null;
-
- private JLabel jLabelPackage = null;
-
- private JLabel jLabelFilePath = null;
-
- private JTextField jTextFieldFilePath = null;
-
- private JButton jButtonBrowse = null;
-
- private JLabel jLabelName = null;
-
- private JTextField jTextFieldName = null;
-
- private JLabel jLabelGuid = null;
-
- private JTextField jTextFieldGuid = null;
-
- private JButton jButtonGen = null;
-
- private JLabel jLabelVersion = null;
-
- private JTextField jTextFieldVersion = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private StarLabel jStarLabel4 = null;
-
- private StarLabel jStarLabel5 = null;
-
- private ButtonGroup bg = new ButtonGroup();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private ModuleIdentification mid = null;
-
- private PackageIdentification pid = null;
-
- private PlatformIdentification fid = null;
-
- private ModuleSurfaceArea msa = null;
-
- private PackageSurfaceArea spd = null;
-
- private PlatformSurfaceArea fpd = null;
-
- private int mode = -1;
-
- private JLabel jLabelIsLibrary = null;
-
- private JRadioButton jRadioButtonYes = null;
-
- private JRadioButton jRadioButtonNo = null;
-
- /**
- * This method initializes jComboBoxExistingPackage
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxExistingPackage() {
- if (jComboBoxExistingPackage == null) {
- jComboBoxExistingPackage = new JComboBox();
- jComboBoxExistingPackage.setBounds(new java.awt.Rectangle(140, 10, 340, 20));
- }
- return jComboBoxExistingPackage;
- }
-
- /**
- * This method initializes jButtonNext
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(310, 165, 80, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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(395, 165, 80, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jTextFieldFilePath
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFilePath() {
- if (jTextFieldFilePath == null) {
- jTextFieldFilePath = new JTextField();
- jTextFieldFilePath.setBounds(new java.awt.Rectangle(140, 60, 250, 20));
- }
- return jTextFieldFilePath;
- }
-
- /**
- * This method initializes jButtonBrowse
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonBrowse() {
- if (jButtonBrowse == null) {
- jButtonBrowse = new JButton();
- jButtonBrowse.setBounds(new java.awt.Rectangle(395, 60, 85, 20));
- jButtonBrowse.setText("Browse");
- jButtonBrowse.addActionListener(this);
- }
- return jButtonBrowse;
- }
-
- /**
- * This method initializes jTextFieldModuleName
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldName() {
- if (jTextFieldName == null) {
- jTextFieldName = new JTextField();
- jTextFieldName.setBounds(new java.awt.Rectangle(140, 85, 340, 20));
- }
- return jTextFieldName;
- }
-
- /**
- * This method initializes jTextFieldGuid
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldGuid() {
- if (jTextFieldGuid == null) {
- jTextFieldGuid = new JTextField();
- jTextFieldGuid.setBounds(new java.awt.Rectangle(140, 110, 250, 20));
- }
- return jTextFieldGuid;
- }
-
- /**
- * This method initializes jButtonGen
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonGen() {
- if (jButtonGen == null) {
- jButtonGen = new JButton();
- jButtonGen.setBounds(new java.awt.Rectangle(395, 110, 85, 20));
- jButtonGen.setText("GEN");
- jButtonGen.addActionListener(this);
- }
- return jButtonGen;
- }
-
- /**
- * This method initializes jTextFieldVersion
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldVersion() {
- if (jTextFieldVersion == null) {
- jTextFieldVersion = new JTextField();
- jTextFieldVersion.setBounds(new java.awt.Rectangle(140, 135, 340, 20));
- }
- return jTextFieldVersion;
- }
-
- /**
- * This method initializes jRadioButtonYes
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonYes() {
- if (jRadioButtonYes == null) {
- jRadioButtonYes = new JRadioButton();
- jRadioButtonYes.setBounds(new java.awt.Rectangle(140, 35, 100, 20));
- jRadioButtonYes.setSelected(false);
- jRadioButtonYes.setText("Yes");
- }
- return jRadioButtonYes;
- }
-
- /**
- * This method initializes jRadioButtonNo
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonNo() {
- if (jRadioButtonNo == null) {
- jRadioButtonNo = new JRadioButton();
- jRadioButtonNo.setBounds(new java.awt.Rectangle(300, 35, 110, 20));
- jRadioButtonNo.setSelected(true);
- jRadioButtonNo.setText("No");
- }
- return jRadioButtonNo;
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- SelectModuleBelong smb = new SelectModuleBelong();
- smb.setVisible(true);
- }
-
- /**
- * This is the default constructor
- */
- public SelectModuleBelong() {
- super();
- init();
- }
-
- /**
- * This is the default constructor
- */
- public SelectModuleBelong(IFrame parentFrame, boolean modal, int fileType) {
- super(parentFrame, modal);
- this.mode = fileType;
- init();
- initExistingPackage();
- if (mode != DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- this.jStarLabel1.setVisible(false);
- this.jLabelPackage.setVisible(false);
- this.jComboBoxExistingPackage.setVisible(false);
- this.jLabelIsLibrary.setVisible(false);
- this.jRadioButtonYes.setVisible(false);
- this.jRadioButtonNo.setVisible(false);
- upLocation(this.jStarLabel2, 50);
- upLocation(this.jStarLabel3, 50);
- upLocation(this.jStarLabel4, 50);
- upLocation(this.jStarLabel5, 50);
- upLocation(this.jLabelFilePath, 50);
- upLocation(this.jLabelName, 50);
- upLocation(this.jLabelGuid, 50);
- upLocation(this.jLabelVersion, 50);
- upLocation(this.jTextFieldFilePath, 50);
- upLocation(this.jTextFieldName, 50);
- upLocation(this.jTextFieldGuid, 50);
- upLocation(this.jTextFieldVersion, 50);
- upLocation(this.jButtonBrowse, 50);
- upLocation(this.jButtonGen, 50);
- }
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void init() {
- this.setSize(500, 230);
- this.setContentPane(getJContentPane());
- this.setTitle("New");
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelIsLibrary = new JLabel();
- jLabelIsLibrary.setBounds(new java.awt.Rectangle(15, 35, 120, 20));
- jLabelIsLibrary.setText("Is this a Library");
- jLabelVersion = new JLabel();
- jLabelVersion.setBounds(new java.awt.Rectangle(15, 135, 120, 20));
- jLabelVersion.setText("Version");
- jLabelGuid = new JLabel();
- jLabelGuid.setBounds(new java.awt.Rectangle(15, 110, 120, 20));
- jLabelGuid.setText("Guid");
- jLabelName = new JLabel();
- jLabelName.setBounds(new java.awt.Rectangle(15, 85, 120, 20));
- jLabelName.setText("Module Name");
- jLabelFilePath = new JLabel();
- jLabelFilePath.setBounds(new java.awt.Rectangle(15, 60, 120, 20));
- jLabelFilePath.setText("File Path");
- jLabelPackage = new JLabel();
- jLabelPackage.setBounds(new java.awt.Rectangle(15, 10, 120, 20));
- jLabelPackage.setText("Choose a Package");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setSize(new java.awt.Dimension(490, 198));
- jContentPane.add(getJComboBoxExistingPackage(), null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(jLabelPackage, null);
- jContentPane.add(jLabelFilePath, null);
- jContentPane.add(getJTextFieldFilePath(), null);
- jContentPane.add(getJButtonBrowse(), null);
- jContentPane.add(jLabelName, null);
- jContentPane.add(getJTextFieldName(), null);
- jContentPane.add(jLabelGuid, null);
- jContentPane.add(getJTextFieldGuid(), null);
- jContentPane.add(getJButtonGen(), null);
- jContentPane.add(jLabelVersion, null);
- jContentPane.add(getJTextFieldVersion(), null);
-
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, 10));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(0, 60));
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(0, 85));
- jStarLabel4 = new StarLabel();
- jStarLabel4.setLocation(new java.awt.Point(0, 110));
- jStarLabel5 = new StarLabel();
- jStarLabel5.setLocation(new java.awt.Point(0, 135));
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(jStarLabel5, null);
- jContentPane.add(jLabelIsLibrary, null);
- jContentPane.add(getJRadioButtonYes(), null);
- jContentPane.add(getJRadioButtonNo(), null);
- bg.add(getJRadioButtonNo());
- bg.add(getJRadioButtonYes());
- }
- return jContentPane;
- }
-
- /**
- Query all existing packages and fill them into combox
-
- **/
- private void initExistingPackage() {
- packages = wt.getAllPackages();
- for (int index = 0; index < packages.size(); index++) {
- this.jComboBoxExistingPackage.addItem(packages.elementAt(index).getName());
- }
- }
-
- /* (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() == jButtonCancel) {
- this.setVisible(false);
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- }
-
- if (arg0.getSource() == jButtonOk) {
- if (this.check()) {
- this.save();
- } else {
- return;
- }
- this.setVisible(false);
- this.returnType = DataType.RETURN_TYPE_OK;
- }
-
- if (arg0.getSource() == this.jButtonGen) {
- this.jTextFieldGuid.setText(Tools.generateUuidString());
- }
-
- if (arg0.getSource() == this.jButtonBrowse) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
-
- if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- fc.setCurrentDirectory(new File(packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex())
- .getPath()));
- fc.addChoosableFileFilter(new IFileFilter(DataType.MODULE_SURFACE_AREA_EXT));
- }
- if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
- fc.addChoosableFileFilter(new IFileFilter(DataType.PACKAGE_SURFACE_AREA_EXT));
- }
- if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
- fc.addChoosableFileFilter(new IFileFilter(DataType.PLATFORM_SURFACE_AREA_EXT));
- }
- int result = fc.showSaveDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- this.jTextFieldFilePath.setText(Tools.addPathExt(fc.getSelectedFile().getPath(), mode));
- }
- }
- }
-
- /**
- Data validation for all fields
-
- @retval true - All datas are valid
- @retval false - At least one data is invalid
-
- **/
- public boolean check() {
- String path = this.jTextFieldFilePath.getText();
- path = Tools.addPathExt(path, mode);
- String guid = this.jTextFieldGuid.getText();
- String version = this.jTextFieldVersion.getText();
-
- //
- // Check if all required fields are not empty
- //
- if (isEmpty(path)) {
- Log.wrn("New File", "A File Path must be entered!");
- return false;
- }
- if (isEmpty(this.jTextFieldName.getText())) {
- Log.wrn("New File", "A Name must be entered");
- return false;
- }
- if (isEmpty(guid)) {
- Log.wrn("New File", "The Guid must be entered!");
- return false;
- }
- if (isEmpty(version)) {
- Log.wrn("New File", "A Version number must be entered!");
- return false;
- }
-
- //
- // Check if all fields have correct data types
- //
- if (!DataValidation.isBaseName(this.jTextFieldName.getText())) {
- Log.wrn("New File", "Incorrect data type for the Name!");
- return false;
- }
- if (!DataValidation.isGuid((guid))) {
- Log.wrn("New File", "Incorrect data type for Guid, which must be in registry format! (8-4-4-4-12)");
- return false;
- }
-
- //
- // Check if path is valid
- //
- File f = new File(path);
- if (!f.isAbsolute()) {
- Log.wrn("New File", "Please type a complete file path!");
- return false;
- }
- f = null;
-
- if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- //
- // Check if the module is already existed in current package
- //
- String packagePath = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getPath();
- String modulePath = Tools.convertPathToCurrentOsType(path);
- Vector<String> msaFile = wt.getAllModulesOfPackage(packagePath);
-
- for (int index = 0; index < msaFile.size(); index++) {
- if (msaFile.elementAt(index).equals(modulePath)) {
- Log.wrn("New File", "This module is already exists in the selected package!");
- return false;
- }
- }
-
- //
- // Check if the module is in selected package
- //
- if (Tools.getFilePathOnly(modulePath).indexOf(Tools.getFilePathOnly(packagePath)) < 0) {
- Log.wrn("New File", "This module should be in the directory of selected package!");
- return false;
- }
-
- //
- // Check if Guid+Version is unique
- //
- String packageGuid = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getGuid();
- String packageVersion = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getVersion();
- if (GlobalData.findModuleId(guid, version, packageGuid, packageVersion) != null) {
- Log.wrn("New File", "A module with same Guid and same Version already exists, please selece a new Guid or Version!");
- return false;
- }
- }
-
- if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- //
- // Check if the package is already existed in database
- //
- path = Tools.convertPathToCurrentOsType(path);
- Vector<PackageIdentification> vPackageList = wt.getAllPackages();
- if (vPackageList != null && vPackageList.size() > 0) {
- for (int index = 0; index < vPackageList.size(); index++) {
- if (vPackageList.get(index).getPath().equals(path)) {
- Log.wrn("New File", "This package is already exists in this workspace!");
- return false;
- }
- }
- }
-
- //
- // Check if path already exists
- //
- if (GlobalData.isDuplicateRelativePath(Tools.getFilePathOnly(path), mode)) {
- Log.wrn("New File", "There already exists a same directory with a package");
- return false;
- }
-
- //
- // Check if Guid+Version is unique
- //
- if (GlobalData.findPackageId(guid, version) != null) {
- Log.wrn("New File", "A package with same Guid and same Version already exists, please selece a new Guid or Version!");
- return false;
- }
- }
-
- if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- //
- // Check if the platform is already existed in database
- //
- path = Tools.convertPathToCurrentOsType(path);
- Vector<PlatformIdentification> vPlatfromList = wt.getAllPlatforms();
- if (vPlatfromList != null && vPlatfromList.size() > 0) {
- for (int index = 0; index < vPlatfromList.size(); index++) {
- if (vPlatfromList.get(index).getPath().equals(path)) {
- Log.wrn("New File", "This platform is already exists in this workspace!");
- return false;
- }
- }
- }
-
- //
- // Check if path already exists
- //
- if (GlobalData.isDuplicateRelativePath(Tools.getFilePathOnly(path), mode)) {
- Log.wrn("New File", "There already exists a same directory with a platform");
- return false;
- }
-
- //
- // Check if Guid+Version is unique
- //
- if (GlobalData.findPlatformId(guid, version) != null) {
- Log.wrn("New File", "A platform with same Guid and same Version already exists, please selece a new Guid or Version!");
- return false;
- }
- }
-
- return true;
- }
-
- /**
- Save file
-
- **/
- public void save() {
- if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- this.saveModule();
- }
- if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- this.savePackage();
- }
- if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- this.savePlatform();
- }
- }
-
- /**
- Save all components of Msa Header
-
- **/
- private void saveModule() {
- msa = null;
- String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());
-
- //
- // Save to memory
- //
- try {
- MsaHeaderDocument.MsaHeader msaHeader = null;
-
- msa = ModuleSurfaceArea.Factory.newInstance();
- msaHeader = MsaHeaderDocument.MsaHeader.Factory.newInstance();
-
- msaHeader.setModuleName(this.jTextFieldName.getText());
- msaHeader.setGuidValue(this.jTextFieldGuid.getText());
- msaHeader.setVersion(this.jTextFieldVersion.getText());
- msaHeader.setModuleType(ModuleTypeDef.BASE);
-
- msa.setMsaHeader(msaHeader);
- } catch (Exception e) {
- Log.err("Save ModuleSurfaceArea Document", e.getMessage());
- return;
- }
-
- //
- // Save to real file
- //
- try {
- SaveFile.saveMsaFile(path, msa);
- } catch (Exception e) {
- Log.wrn("Save Module to file system", e.getMessage());
- Log.err("Save Module to file system", e.getMessage());
- return;
- }
-
- //
- // Save to identification
- //
- mid = new ModuleIdentification(this.jTextFieldName.getText(), this.jTextFieldGuid.getText(),
- this.jTextFieldVersion.getText(), path, jRadioButtonYes.isSelected());
- mid.setPackageId(packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()));
- }
-
- /**
- Save all components of Spd Header
-
- **/
- private void savePackage() {
- spd = null;
- String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());
-
- //
- // Save to memory
- //
- try {
- SpdHeaderDocument.SpdHeader spdHeader = null;
-
- spd = PackageSurfaceArea.Factory.newInstance();
- spdHeader = SpdHeaderDocument.SpdHeader.Factory.newInstance();
-
- spdHeader.setPackageName(this.jTextFieldName.getText());
- spdHeader.setGuidValue(this.jTextFieldGuid.getText());
- spdHeader.setVersion(this.jTextFieldVersion.getText());
-
- spd.setSpdHeader(spdHeader);
- } catch (Exception e) {
- Log.wrn("Save Package Surface Area Description Document", e.getMessage());
- return;
- }
-
- //
- // Save to real file
- //
- try {
- SaveFile.saveSpdFile(path, spd);
-
- } catch (Exception e) {
- Log.wrn("Save Package to file system", e.getMessage());
- Log.err("Save Package to file system", e.getMessage());
- return;
- }
-
- //
- // Save to identification
- //
- pid = new PackageIdentification(this.jTextFieldName.getText(), this.jTextFieldGuid.getText(),
- this.jTextFieldVersion.getText(), path);
- }
-
- /**
- Save all components of Fpd Header
-
- **/
- private void savePlatform() {
- fpd = null;
- String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());
-
- //
- // Save to memory
- //
- try {
- PlatformHeader fpdHeader = null;
-
- fpd = PlatformSurfaceArea.Factory.newInstance();
- fpdHeader = PlatformHeader.Factory.newInstance();
-
- fpdHeader.setPlatformName(this.jTextFieldName.getText());
- fpdHeader.setGuidValue(this.jTextFieldGuid.getText());
- fpdHeader.setVersion(this.jTextFieldVersion.getText());
-
- fpd.setPlatformHeader(fpdHeader);
- } catch (Exception e) {
- Log.wrn("Save Framework Platform Description Document", e.getMessage());
- return;
- }
-
- //
- // Save to real file
- //
- try {
- SaveFile.saveFpdFile(path, fpd);
-
- } catch (Exception e) {
- Log.wrn("Save Platform to file system", e.getMessage());
- Log.err("Save Platform to file system", e.getMessage());
- return;
- }
-
- //
- // Save to identification
- //
- fid = new PlatformIdentification(this.jTextFieldName.getText(), this.jTextFieldGuid.getText(),
- this.jTextFieldVersion.getText(), path);
- }
-
- public ModuleIdentification getMid() {
- return mid;
- }
-
- public PlatformIdentification getFid() {
- return fid;
- }
-
- public PackageIdentification getPid() {
- return pid;
- }
-
- private void upLocation(Component c, int size) {
- c.setLocation(c.getLocation().x, c.getLocation().y - size);
- }
-
- public PlatformSurfaceArea getFpd() {
- return fpd;
- }
-
- public ModuleSurfaceArea getMsa() {
- return msa;
- }
-
- public PackageSurfaceArea getSpd() {
- return spd;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SplashScreen.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SplashScreen.java deleted file mode 100644 index 16fa4911de..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SplashScreen.java +++ /dev/null @@ -1,106 +0,0 @@ -/** @file
-
- To show a splash screen when starting
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard;
-
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JRootPane;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-
-public class SplashScreen extends IFrame {
-
- ///
- /// Serial Version UID
- ///
- private static final long serialVersionUID = 1077736364497801470L;
-
- private JPanel jContentPane = null; // @jve:decl-index=0:visual-constraint="10,54"
-
- private JLabel jLabelImage = null;
-
- private JLabel jLabel = null;
-
- private JLabel jLabel1 = null;
-
- private JLabel jLabel2 = null;
-
-
- /**
- * This is the default constructor
- */
- public SplashScreen() {
- super();
- init();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void init() {
- this.setSize(320, 205);
- this.setUndecorated(true);
- this.setContentPane(getJContentPane());
- this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
- this.setTitle("Init");
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelImage = new JLabel();
- jLabelImage.setBounds(new java.awt.Rectangle(63, 20, 193, 58));
- jLabelImage.setIcon(new ImageIcon(getClass().getResource("/resources/images/logo.gif")));
-
- jLabel2 = new JLabel();
- jLabel2.setBounds(new java.awt.Rectangle(25, 120, 270, 20));
- jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jLabel2.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 14));
- jLabel2.setText("Initializing...");
- jLabel1 = new JLabel();
- jLabel1.setBounds(new java.awt.Rectangle(3,166,270,20));
- jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
- jLabel1.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 8));
- jLabel1.setText("Copyright (c) 2006, Intel Corporation");
- jLabel = new JLabel();
- jLabel.setToolTipText("");
- jLabel.setBounds(new java.awt.Rectangle(25, 90, 270, 20));
- jLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- jLabel.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 18));
- jLabel.setText(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION);
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setSize(new java.awt.Dimension(320,199));
- jContentPane.setBackground(java.awt.SystemColor.inactiveCaptionText);
- jContentPane.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
- jContentPane.add(jLabel, null);
- jContentPane.add(jLabel1, null);
- jContentPane.add(jLabel2, null);
- jContentPane.add(jLabelImage, null);
- }
- return jContentPane;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfig.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfig.java deleted file mode 100644 index cef7e85531..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfig.java +++ /dev/null @@ -1,508 +0,0 @@ -/** @file
-
- The file is used to setup tool chain configuration
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.WindowEvent;
-import java.io.File;
-import java.io.IOException;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IFileFilter;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.ToolChainConfigId;
-import org.tianocore.frameworkwizard.common.Identifications.ToolChainConfigVector;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-public class ToolChainConfig extends IFrame implements ListSelectionListener, TableModelListener{
-
- ///
- /// Define Class Members
- ///
- private static final long serialVersionUID = 1486930966278269085L;
-
- private JPanel jContentPane = null;
-
- private JScrollPane jScrollPane = null;
-
- private DefaultTableModel model = null;
-
- private JTable jTable = null;
-
- private JButton jButtonOpen = null;
-
- private JButton jButtonSave = null;
-
- private JButton jButtonClose = null;
-
- private String toolsDir = Tools.addFileSeparator(Workspace.getCurrentWorkspace()) + "Tools"
- + DataType.FILE_SEPARATOR + "Conf";
-
- private String currentFile = Tools.addFileSeparator(toolsDir) + "tools_def.template";
-
- private ToolChainConfigVector vtcc = new ToolChainConfigVector();
-
- private JLabel jLabelName = null;
-
- private JTextField jTextFieldName = null;
-
- private JLabel jLabelValue = null;
-
- private JTextField jTextFieldValue = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private int selectedRow = -1;
-
- private JButton jButtonHelp = null;
-
- private static ToolChainConfig tcc = null;
-
- private ToolChainConfigHelp tcch = null;
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
-
- **/
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(15, 15, 555, 345));
- jScrollPane.setViewportView(getJTable());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
-
- **/
- private JTable getJTable() {
- if (jTable == null) {
- model = new DefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Property");
- model.addColumn("Value");
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- }
- return jTable;
- }
-
- /**
- This method initializes jButtonOpen
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonOpen() {
- if (jButtonOpen == null) {
- jButtonOpen = new JButton();
- jButtonOpen.setBounds(new java.awt.Rectangle(40, 405, 120, 20));
- jButtonOpen.setText("Open File");
- jButtonOpen.addActionListener(this);
- }
- return jButtonOpen;
- }
-
- /**
- This method initializes jButtonSave
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonSave() {
- if (jButtonSave == null) {
- jButtonSave = new JButton();
- jButtonSave.setBounds(new java.awt.Rectangle(170, 405, 120, 20));
- jButtonSave.setText("Save File");
- jButtonSave.addActionListener(this);
- }
- return jButtonSave;
- }
-
- /**
- This method initializes jButtonClose
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonClose() {
- if (jButtonClose == null) {
- jButtonClose = new JButton();
- jButtonClose.setBounds(new java.awt.Rectangle(490, 405, 80, 20));
- jButtonClose.setText("Close");
- jButtonClose.addActionListener(this);
- }
- return jButtonClose;
- }
-
- /**
- This method initializes jTextFieldName
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldName() {
- if (jTextFieldName == null) {
- jTextFieldName = new JTextField();
- jTextFieldName.setBounds(new java.awt.Rectangle(60, 365, 140, 20));
- }
- return jTextFieldName;
- }
-
- /**
- This method initializes jTextFieldValue
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldValue() {
- if (jTextFieldValue == null) {
- jTextFieldValue = new JTextField();
- jTextFieldValue.setBounds(new java.awt.Rectangle(250, 365, 140, 20));
- }
- return jTextFieldValue;
- }
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(400, 365, 80, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(490, 365, 80, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- * This method initializes jButtonHelp
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonHelp() {
- if (jButtonHelp == null) {
- jButtonHelp = new JButton();
- jButtonHelp.setBounds(new java.awt.Rectangle(300,405,120,20));
- jButtonHelp.setText("Help");
- jButtonHelp.addActionListener(this);
- }
- return jButtonHelp;
- }
-
- /**
-
- @param args
-
- **/
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
- public static ToolChainConfig getInstance() {
- if (tcc == null) {
- tcc = new ToolChainConfig();
- }
- return tcc;
- }
-
- /**
- * This is the default constructor
- */
- public ToolChainConfig() {
- super();
- init();
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(600, 480);
- this.setContentPane(getJContentPane());
- this.setTitle("Tool Chain Configuration");
- this.centerWindow();
-
- //
- // Read default file
- //
- File f = new File(currentFile);
- if (f.exists()) {
- try {
- vtcc.removeAll();
- vtcc.parseFile(this.currentFile);
- this.setTitle("Tool Chain Configuration" + " [" + currentFile + "]");
- } catch (IOException e) {
- Log.log(this.currentFile + "Read Error", e.getMessage());
- e.printStackTrace();
- }
- } else {
- Log.log("File Open Error: ", this.currentFile + " File Not Found");
- }
-
- showTable();
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelValue = new JLabel();
- jLabelValue.setBounds(new java.awt.Rectangle(205, 365, 40, 20));
- jLabelValue.setText("Value");
- jLabelName = new JLabel();
- jLabelName.setBounds(new java.awt.Rectangle(15, 365, 40, 20));
- jLabelName.setText("Name");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(getJButtonOpen(), null);
- jContentPane.add(getJButtonSave(), null);
- jContentPane.add(getJButtonClose(), null);
- jContentPane.add(jLabelName, null);
- jContentPane.add(getJTextFieldName(), null);
- jContentPane.add(jLabelValue, null);
- jContentPane.add(getJTextFieldValue(), null);
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonHelp(), null);
- }
- 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() == jButtonClose) {
- this.exit();
- }
-
- if (arg0.getSource() == jButtonOpen) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
- IFileFilter iff = new IFileFilter(DataType.TEXT_FILE_EXT);
- fc.addChoosableFileFilter(iff);
- fc.setCurrentDirectory(new File(toolsDir));
-
- int result = fc.showOpenDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- try {
- vtcc.removeAll();
- vtcc.parseFile(fc.getSelectedFile().getPath());
- currentFile = fc.getSelectedFile().getPath();
- this.setTitle("Tool Chain Configuration" + " [" + currentFile + "]");
- } catch (IOException e) {
- Log.wrn(this.currentFile + "Read Error", e.getMessage());
- Log.err(this.currentFile + "Read Error", e.getMessage());
- return;
- }
- this.showTable();
- }
- }
-
- if (arg0.getSource() == jButtonSave) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
- IFileFilter iff = new IFileFilter(DataType.TEXT_FILE_EXT);
- fc.addChoosableFileFilter(iff);
- fc.setCurrentDirectory(new File(toolsDir));
-
- int result = fc.showSaveDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- currentFile = fc.getSelectedFile().getPath();
- currentFile = Tools.addPathExt(currentFile, DataType.RETURN_TYPE_TEXT);
- try {
- vtcc.saveFile(currentFile);
- } catch (IOException e) {
- Log.wrn(this.currentFile + "Write Error", e.getMessage());
- Log.err(this.currentFile + "Write Error", e.getMessage());
- return;
- }
- }
- }
-
- if (arg0.getSource() == jButtonAdd) {
- if (check()) {
- String[] row = { jTextFieldName.getText(), jTextFieldValue.getText() };
- this.vtcc.addToolChainConfigs(new ToolChainConfigId(row[0], row[1]));
- this.model.addRow(row);
- }
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
- if (selectedRow > -1) {
- this.model.removeRow(selectedRow);
- this.vtcc.removeToolChainConfigs(selectedRow);
- selectedRow = -1;
- }
- }
-
- if (arg0.getSource() == jButtonHelp) {
- tcch = ToolChainConfigHelp.getInstance();
- tcch.setVisible(true);
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vtcc.size() > 0) {
- for (int index = 0; index < vtcc.size(); index++) {
- model.addRow(vtcc.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- //this.jScrollPane.setViewportView(this.jTable);
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Check if name or value is empty
-
- @return
-
- **/
- private boolean check() {
- if (isEmpty(this.jTextFieldName.getText())) {
- Log.wrn("Add Tool Chain", "The Property Name must be entered!");
- return false;
- }
-
- if (isEmpty(this.jTextFieldValue.getText())) {
- Log.wrn("Add Tool Chain", "The Property Value must be entered!");
- return false;
- }
- return true;
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- public void tableChanged(TableModelEvent arg0) {
- int row = arg0.getFirstRow();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
- this.vtcc.getToolChainConfigs(row).setName(m.getValueAt(row, 0).toString());
- this.vtcc.getToolChainConfigs(row).setValue(m.getValueAt(row, 1).toString());
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
- *
- * Override windowClosing to popup warning message to confirm quit
- *
- */
- public void windowClosing(WindowEvent arg0) {
- this.exit();
- }
-
- private void exit() {
- this.setVisible(false);
- if (tcch != null) {
- tcch.dispose();
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfigHelp.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfigHelp.java deleted file mode 100644 index 0156cc902f..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfigHelp.java +++ /dev/null @@ -1,139 +0,0 @@ -package org.tianocore.frameworkwizard;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JTextPane;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import javax.swing.JButton;
-
-
-public class ToolChainConfigHelp extends JFrame implements ActionListener {
-
- ///
- ///
- ///
- private static final long serialVersionUID = -6315081029366587222L;
-
- private JPanel jContentPane = null;
-
- private String helpContent = "";
-
- private JTextPane jTextPane = null;
-
- private JButton jButtonClose = null;
-
- private static ToolChainConfigHelp tcch = null;
-
- /**
- * This method initializes jTextPane
- *
- * @return javax.swing.JTextPane
- */
- private JTextPane getJTextPane() {
- if (jTextPane == null) {
- jTextPane = new JTextPane();
- jTextPane.setBounds(new java.awt.Rectangle(10,10,600,420));
- jTextPane.setBackground(new java.awt.Color(238,238,238));
- jTextPane.setEditable(false);
- helpContent = helpContent
- + "The template for the Property is: TARGET_TAGNAME_ARCH_COMMAND_ATTR" + DataType.UNIX_LINE_SEPARATOR
- + "The Value, is either a full path, full path and filename or a reserved word." + DataType.UNIX_LINE_SEPARATOR
- + DataType.UNIX_LINE_SEPARATOR
- + DataType.UNIX_LINE_SEPARATOR
- + "TARGET - DEBUG and RELEASE are predefined, however the user may define one or more of their own TARGET types in this file." + DataType.UNIX_LINE_SEPARATOR
- + DataType.UNIX_LINE_SEPARATOR
- + "TAGNAME - HOST, MSFT, GCC, INTC are predefined, however the user may define one or more of their own TAGNAME keywords in this file." + DataType.UNIX_LINE_SEPARATOR
- + DataType.UNIX_LINE_SEPARATOR
- + "ARCH - EDK II supports IA32, X64, IPF and EBC at this time." + DataType.UNIX_LINE_SEPARATOR
- + DataType.UNIX_LINE_SEPARATOR
- + "COMMAND - Predefined command codes are listed in the tools_def.txt file, however the user can specify additional command codes for their one, non-standard tools." + DataType.UNIX_LINE_SEPARATOR
- + DataType.UNIX_LINE_SEPARATOR
- + "ATTR - Predefined Attributes are listed in the tools_def.txt file." + DataType.UNIX_LINE_SEPARATOR
- + DataType.UNIX_LINE_SEPARATOR
- + "NOTE: The TAGNAME: HOST is reserved and MUST be defined in order to build the included Tiano tools from their C source files. These tools have been built and tested using both Microsoft and GCC tool chains." + DataType.UNIX_LINE_SEPARATOR
- + DataType.UNIX_LINE_SEPARATOR
- + "NOTE: The \"*\" symbol may be used as a wildcard character in most of these fields, refer to the tools_def.txt and the \"EDK II Build and Packaging Architecture Specification\" for more details." + DataType.UNIX_LINE_SEPARATOR
- + DataType.UNIX_LINE_SEPARATOR;
-
- jTextPane.setText(helpContent);
- }
- return jTextPane;
- }
-
- /**
- * This method initializes jButtonClose
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonClose() {
- if (jButtonClose == null) {
- jButtonClose = new JButton();
- jButtonClose.setBounds(new java.awt.Rectangle(480,450,80,20));
- jButtonClose.setText("Close");
- jButtonClose.addActionListener(this);
- }
- return jButtonClose;
- }
-
- public static ToolChainConfigHelp getInstance() {
- if (tcch == null) {
- tcch = new ToolChainConfigHelp();
- }
- return tcch;
- }
-
- /**
-
- @param args
-
- **/
- public static void main(String[] args) {
- ToolChainConfigHelp tcch = new ToolChainConfigHelp();
- tcch.setVisible(true);
- }
-
- /**
- * This is the default constructor
- */
- public ToolChainConfigHelp() {
- super();
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(625, 520);
- this.setResizable(false);
- this.setTitle("How to Modify a Tool Chain Configuration");
- this.setContentPane(getJContentPane());
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextPane(), null);
- jContentPane.add(getJButtonClose(), null);
- }
- return jContentPane;
- }
-
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonClose) {
- this.dispose();
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java deleted file mode 100644 index 03a64a69a6..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java +++ /dev/null @@ -1,304 +0,0 @@ -/** @file
-
- The file is used to define all used final variables
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common;
-
-/**
- The class is used to define all used final variables
-
- **/
-public class DataType {
-
- /**
-
- @param args
-
- **/
- public static void main(String[] args) {
-
- }
-
- //
- // Define all return types
- //
- public static final int RETURN_TYPE_OK = 1;
-
- public static final int RETURN_TYPE_CANCEL = 2;
-
- public static final int RETURN_TYPE_NEXT = 3;
-
- public static final int RETURN_TYPE_BACK = 4;
-
- public static final int RETURN_TYPE_MODULE_SURFACE_AREA = 11;
-
- public static final int RETURN_TYPE_PACKAGE_SURFACE_AREA = 12;
-
- public static final int RETURN_TYPE_PLATFORM_SURFACE_AREA = 13;
-
- public static final int RETURN_TYPE_BUILD_XML = 14;
-
- public static final int RETURN_TYPE_WORKSPACE = 15;
-
- public static final int RETURN_TYPE_TEXT = 16;
-
- public static final int RETURN_TYPE_FAR_SURFACE_AREA = 17;
-
-
- //
- // Define all used final variables
- //
- public static final String DOS_LINE_SEPARATOR = "\r\n";
-
- public static final String UNIX_LINE_SEPARATOR = "\n";
-
- public static final String LINE_SEPARATOR = UNIX_LINE_SEPARATOR;
-
- public static final String HTML_LINE_SEPARATOR = "<br>";
-
- public static final String EMPTY_SELECT_ITEM = "----";
-
- public static final String DOS_FILE_SEPARATOR = "\\";
-
- public static final String UNIX_FILE_SEPARATOR = "/";
-
- //
- // Define xml files ext
- //
- public static final String COPY_OF = "Copy of ";
-
- public static final String FILE_EXT_SEPARATOR = ".";
-
- public static final String WORKSPACE = "Workspace";
-
- public static final String MODULE_SURFACE_AREA = "Module Surface Area Description";
-
- public static final String MODULE_SURFACE_AREA_EXT = "msa";
-
- public static final String MODULE_SURFACE_AREA_EXT_DESCRIPTION = MODULE_SURFACE_AREA + " (*."
- + MODULE_SURFACE_AREA_EXT + ")";
-
- public static final String PACKAGE_SURFACE_AREA = "Package Surface Area Description";
-
- public static final String PACKAGE_SURFACE_AREA_EXT = "spd";
-
- public static final String PACKAGE_SURFACE_AREA_EXT_DESCRIPTION = PACKAGE_SURFACE_AREA + " (*."
- + PACKAGE_SURFACE_AREA_EXT + ")";
-
- public static final String PLATFORM_SURFACE_AREA = "Platform Surface Area Description";
-
- public static final String PLATFORM_SURFACE_AREA_EXT = "fpd";
-
- public static final String PLATFORM_SURFACE_AREA_EXT_DESCRIPTION = PLATFORM_SURFACE_AREA + " (*."
- + PLATFORM_SURFACE_AREA_EXT + ")";
-
- public static final String ANT_BUILD_FILE = "ANT Build File";
-
- public static final String ANT_BUILD_FILE_EXT = "xml";
-
- public static final String ANT_BUILD_FILE_EXT_DESCRIPTION = ANT_BUILD_FILE + " (*." + ANT_BUILD_FILE_EXT + ")";
-
- public static final String TEXT_FILE = "Text File";
-
- public static final String TEXT_FILE_EXT = "txt";
-
- public static final String TEXT_FILE_EXT_DESCRIPTION = TEXT_FILE + " (*." + TEXT_FILE_EXT + ")";
-
- public static final String FAR_SURFACE_AREA = "Framework Archive";
-
- public static final String FAR_SURFACE_AREA_EXT = "far";
-
- public static final String FAR_SURFACE_AREA_EXT_DESCRIPTION = FAR_SURFACE_AREA + " (*." + FAR_SURFACE_AREA_EXT + ")";
- //
- // Define file separator for current OS
- //
- public static String FILE_SEPARATOR = System.getProperty("file.separator");
-
- //
- // Defien all used frame, container component's sizes
- //
- public static final int MAIN_FRAME_PREFERRED_SIZE_WIDTH = 800;
-
- public static final int MAIN_FRAME_PREFERRED_SIZE_HEIGHT = 600;
-
- public static final int MAIN_FRAME_MAX_SIZE_WIDTH = 1920;
-
- public static final int MAIN_FRAME_MAX_SIZE_HEIGHT = 1200;
-
- public static final int MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_WIDTH = 790;
-
- public static final int MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_HEIGHT = 545;
-
- public static final int MAIN_FRAME_WIDTH_SPACING = MAIN_FRAME_PREFERRED_SIZE_WIDTH
- - MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_WIDTH;
-
- public static final int MAIN_FRAME_HEIGHT_SPACING = MAIN_FRAME_PREFERRED_SIZE_HEIGHT
- - MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_HEIGHT;
-
- public static final int MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH = 273;
-
- public static final int MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT = 545;
-
- public static final int MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH = 515;
-
- public static final int MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT = 545;
-
- public static final int MAIN_FRAME_EDITOR_PANEL_LOCATION_X = 260;
-
- public static final int MAIN_FRAME_EDITOR_PANEL_LOCATION_Y = 1;
-
- public static final int SPACE_TO_RIGHT_FOR_GENERATE_BUTTON = 10;
-
- public static final int SPACE_TO_RIGHT_FOR_OK_BUTTON = 10;
-
- public static final int SPACE_TO_RIGHT_FOR_ADD_BUTTON = 200;
-
- public static final int SPACE_TO_RIGHT_FOR_REMOVE_BUTTON = 105;
-
- public static final int SPACE_TO_RIGHT_FOR_UPDATE_BUTTON = 10;
-
- public static final int SPACE_TO_BOTTOM_FOR_ADD_BUTTON = 30;
-
- public static final int SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON = 30;
-
- public static final int SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON = 30;
-
- public static final int SPACE_TO_RIGHT_FOR_CLOSE_BUTTON = 240;
-
- public static final int SPACE_TO_BOTTOM_FOR_CLOSE_BUTTON = 25;
-
- public static final int SPACE_TO_RIGHT_FOR_PROTOCOL_NOTIFY = 25;
-
- public static final int LEFT_WIDTH = 160;
-
- public static final int LEFT_HEIGHT = 20;
-
- public static final int RIGHT_WIDTH = 320;
-
- public static final int RIGHT_HEIGHT = 20;
-
- public static final int RIGHT_MULTIPLE_HEIGHT = 4 * RIGHT_HEIGHT;
-
- public static final int BUTTON_GEN_WIDTH = 65;
-
- public static final int BUTTON_GEN_HEIGHT = 20;
-
- public static final int BUTTON_BROWSE_WIDTH = 65;
-
- public static final int BUTTON_BROWSE_HEIGHT = 20;
-
- public static final int BUTTON_ADD_WIDTH = 80;
-
- public static final int BUTTON_ADD_HEIGHT = 20;
-
- public static final int BUTTON_UPDATE_WIDTH = 80;
-
- public static final int BUTTON_UPDATE_HEIGHT = 20;
-
- public static final int BUTTON_REMOVE_WIDTH = 80;
-
- public static final int BUTTON_REMOVE_HEIGHT = 20;
-
- public static final int SCROLLBAR_WIDTH = 18;
-
- public static final int SCROLLBAR_HEIGHT = 18;
-
- //
- // Common Help Text
- // First defined here
- // Will be replaced by resource file later
- //
- public static final String SUP_ARCH_LIST_HELP_TEXT = "<html>Selecting a checkbox is a restriction of only the selected architectures;<br>If none of boxes are selected, all architectures are supported.<html>";
-
- //
- // Project name and version
- //
- public static final String PROJECT_NAME = "Framework Wizard";
-
- public static final String PROJECT_VERSION = "1.0";
-
- //
- // Sort Type
- //
- public static final int SORT_TYPE_ASCENDING = 1;
-
- public static final int SORT_TYPE_DESCENDING = 2;
-
- //
- // Module Type
- //
- public static final String MODULE_TYPE_LIBRARY = "Library";
-
- public static final String MODULE_TYPE_MODULE = "Module";
-
- //
- // Hex String Header
- //
- public static final String HEX_STRING_HEADER = "0x";
-
- //
- // The String of Boolean
- //
- public static final String TRUE = "True";
-
- public static final String FALSE = "False";
-
- //
- // The String for USAGE type
- //
- public final static String USAGE_TYPE_ALWAYS_CONSUMED = "ALWAYS_CONSUMED";
-
- public final static String USAGE_TYPE_SOMETIMES_CONSUMED = "SOMETIMES_CONSUMED";
-
- public final static String USAGE_TYPE_ALWAYS_PRODUCED = "ALWAYS_PRODUCED";
-
- public final static String USAGE_TYPE_SOMETIMES_PRODUCED = "SOMETIMES_PRODUCED";
-
- public final static String USAGE_TYPE_PRIVATE = "PRIVATE";
-
- public final static String USAGE_TYPE_TO_START = "TO_START";
-
- public final static String USAGE_TYPE_BY_START = "BY_START";
-
- //
- // The String for PCD type
- //
- public final static String PCD_ITEM_TYPE_FEATURE_FLAG = "FEATURE_FLAG";
-
- public final static String PCD_ITEM_TYPE_FIXED_AT_BUILD = "FIXED_AT_BUILD";
-
- public final static String PCD_ITEM_TYPE_PATCHABLE_IN_MODULE = "PATCHABLE_IN_MODULE";
-
- public final static String PCD_ITEM_TYPE_DYNAMIC = "DYNAMIC";
-
- public final static String PCD_ITEM_TYPE_DYNAMIC_EX = "DYNAMIC_EX";
-
- //
- // The String for PPI type
- //
- public final static String PPI_TYPE_PPI = "Ppi";
-
- public final static String PPI_TYPE_PPI_NOTIFY = "Ppi Notify";
-
- //
- // The String for Protocol type
- //
- public final static String PROTOCOL_TYPE_PROTOCOL = "Protocol";
-
- public final static String PROTOCOL_TYPE_PROTOCOL_NOTIFY = "Protocol Notify";
-
- //
- // The default file name for guids.xref file
- //
- public final static String GUIDS_XREF_FILE_NAME = "guids.xref";
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataValidation.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataValidation.java deleted file mode 100644 index 82724d4338..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataValidation.java +++ /dev/null @@ -1,746 +0,0 @@ -/** @file
-
- The file is used to provides all kinds of Data Validation interface
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.common;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- The class is used to provides all kinds of data validation interface
-
- <p>All provided interfaces are in static mode</p>
-
- **/
-public class DataValidation {
-
- /**
- Reserved for test
-
- @param args
-
- **/
- public static void main(String[] args) {
-
- }
-
- //
- // The below is used to check common data types
- //
-
- /**
- Check if the imput data is int
-
- @param strInt The input string which needs validation
-
- @retval true - The input is Int
- @retval false - The input is not Int
-
- **/
- public static boolean isInt(String strInt) {
- return isMatch("^-?[0-9]\\d*$", strInt);
- }
-
- /**
- Check if the input data is int and it is in the valid scope
- The scope is provided by String
-
- @param strNumber The input string which needs validation
- @param BeginNumber The left boundary of the scope
- @param EndNumber The right boundary of the scope
-
- @retval true - The input is Int and in the scope;
- @retval false - The input is not Int or not in the scope
-
- **/
- public static boolean isInt(String strNumber, int BeginNumber, int EndNumber) {
- //
- //Check if the input data is int first
- //
- if (!isInt(strNumber)) {
- return false;
- }
- //
- //And then check if the data is between the scope
- //
- Integer intTemp = new Integer(strNumber);
- if ((intTemp.intValue() < BeginNumber) || (intTemp.intValue() > EndNumber)) {
- return false;
- }
- return true;
- }
-
- /**
- Check if the input data is long int and it is in the valid scope
- The scope is provided by String
-
- @param strNumber The input string which needs validation
- @param BeginNumber The left boundary of the scope
- @param EndNumber The right boundary of the scope
-
- @retval true - The input is Int and in the scope;
- @retval false - The input is not Int or not in the scope
-
- **/
- public static boolean isLongInt(String strNumber, long BeginNumber, long EndNumber) throws Exception{
- //
- //Check if the input data is int first
- //
- if (!isInt(strNumber)) {
- return false;
- }
- //
- //And then check if the data is between the scope
- //
- try {
- Long intTemp = new Long(strNumber);
- if ((intTemp.longValue() < BeginNumber) || (intTemp.longValue() > EndNumber)) {
- return false;
- }
- }
- catch (Exception e) {
- throw e;
- }
-
- return true;
- }
- /**
- Check if the input data is int and it is in the valid scope
- The scope is provided by String
-
- @param strNumber The input string which needs validation
- @param strBeginNumber The left boundary of the scope
- @param strEndNumber The right boundary of the scope
-
- @retval true - The input is Int and in the scope;
- @retval false - The input is not Int or not in the scope
-
- **/
- public static boolean isInt(String strNumber, String strBeginNumber, String strEndNumber) {
- //
- //Check if all input data are int
- //
- if (!isInt(strNumber)) {
- return false;
- }
- if (!isInt(strBeginNumber)) {
- return false;
- }
- if (!isInt(strEndNumber)) {
- return false;
- }
- //
- //And then check if the data is between the scope
- //
- Integer intI = new Integer(strNumber);
- Integer intJ = new Integer(strBeginNumber);
- Integer intK = new Integer(strEndNumber);
- if ((intI.intValue() < intJ.intValue()) || (intI.intValue() > intK.intValue())) {
- return false;
- }
- return true;
- }
-
- /**
- Use regex to check if the input data is in valid format
-
- @param strPattern The input regex
- @param strMatcher The input data need be checked
-
- @retval true - The data matches the regex
- @retval false - The data doesn't match the regex
-
- **/
- public static boolean isMatch(String strPattern, String strMatcher) {
- Pattern pattern = Pattern.compile(strPattern);
- Matcher matcher = pattern.matcher(strMatcher);
-
- return matcher.find();
- }
-
- //
- // The below is used to check common customized data types
- //
-
- /**
- Check if the input data is UiNameType
-
- @param arg0 The input string need be checked
-
- @retval true - The input is UiNameType
- @retval false - The input is not UiNameType
-
- **/
- public static boolean isUiNameType(String arg0) {
- if (arg0.length() < 1) {
- return false;
- }
- return isMatch("[^ ].*", arg0);
- }
-
- /**
- Check if the input data is GuidType2
-
- @param arg0 The input string need be checked
-
- @retval true - The input is GuidType2
- @retval false - The input is not GuidType2
-
- **/
- public static boolean isGuidType2(String arg0) {
- return isMatch("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", arg0);
- }
-
- /**
- Check if the input data is Guid
-
- @param strGuid The input string need be checked
-
- @retval true - The input is Guid
- @retval false - The input is not Guid
-
- **/
- public static boolean isGuid(String arg0) {
- return isGuidType2(arg0);
- }
-
- /**
- Check if the input data is Version
-
- @param arg0 The input string need be checked
-
- @retval true - The input is Version
- @retval false - The input is not Version
-
- **/
- public static boolean isVersionDataType(String arg0) {
- return isMatch("\\d+(\\.\\d+)*", arg0);
- }
-
- /**
- Check if the input data is Sentence
-
- @param strSentence The input string need be checked
-
- @retval true - The input is Sentence
- @retval false - The input is not Sentence
-
- **/
- public static boolean isSentence(String arg0) {
- return isMatch("(\\w+\\W*)+( )+(\\W*\\w*\\W*\\s*)*", arg0);
- }
-
- /**
- Check if the input data is FileNameConventio
-
- @param strSentence The input string need be checked
-
- @retval true - The input is FileNameConventio
- @retval false - The input is not FileNameConventio
-
- **/
- public static boolean isFileNameConvention(String arg0) {
- return isMatch("[a-zA-Z](\\.?[-_a-zA-Z0-9]+)*", arg0);
- }
-
- /**
- Check if the input data is KeywordType
-
- @param strSentence The input string need be checked
-
- @retval true - The input is KeywordType
- @retval false - The input is not KeywordType
-
- **/
- public static boolean isKeywordType(String arg0) {
- return isMatch("[a-zA-Z]+(_*[a-zA-Z0-9]*)*", arg0);
- }
-
- /**
- Check if the input data is FeatureFlagExpressionType
-
- @param strSentence The input string need be checked
-
- @retval true - The input is FeatureFlagExpressionType
- @retval false - The input is not FeatureFlagExpressionType
-
- **/
- public static boolean isFeatureFlagExpressionType(String arg0) {
- return (arg0.length() >= 1);
- }
-
- /**
- Check if the input data is FeatureFlag
-
- @param strSentence The input string need be checked
-
- @retval true - The input is FeatureFlag
- @retval false - The input is not FeatureFlag
-
- **/
- public static boolean isFeatureFlag(String arg0) {
- return isFeatureFlagExpressionType(arg0);
- }
-
- /**
- Check if the input data is PathAndFilename
-
- @param strSentence The input string need be checked
-
- @retval true - The input is PathAndFilename
- @retval false - The input is not PathAndFilename
-
- **/
- public static boolean isPathAndFilename(String arg0) {
- return !arg0.equals("");
- }
-
- /**
- Check if the input data is ToolsNameConvention
-
- @param strSentence The input string need be checked
-
- @retval true - The input is ToolsNameConvention
- @retval false - The input is not ToolsNameConvention
-
- **/
- public static boolean isToolsNameConvention(String arg0) {
- return isMatch("[a-zA-Z][a-zA-Z0-9]*", arg0);
- }
-
- /**
- Check if the input data is C_NameType
-
- @param strSentence The input string need be checked
-
- @retval true - The input is C_NameType
- @retval false - The input is not C_NameType
-
- **/
- public static boolean isC_NameType(String arg0) {
- return isMatch("(_)*[a-zA-Z]+((_)*[a-zA-Z0-9]*)*", arg0);
- }
-
- /**
- Check if the input data is HexWordArrayType
-
- @param strSentence The input string need be checked
-
- @retval true - The input is HexWordArrayType
- @retval false - The input is not HexWordArrayType
-
- **/
- public static boolean isHexWordArrayType(String arg0) {
- return arg0.length() >=6 && isMatch("((\\s)*0x([a-fA-F0-9]){4}(,)?(\\s)*)+", arg0);
- }
-
- /**
- Check if the input data is Hex64BitDataType
-
- @param strSentence The input string need be checked
-
- @retval true - The input is Hex64BitDataType
- @retval false - The input is not Hex64BitDataType
-
- **/
- public static boolean isHex64BitDataType(String arg0) {
- return isMatch("(0x)?[a-fA-F0-9]{1,16}", arg0);
- }
-
- /**
- Check if the input data is UnicodeString
-
- @param strSentence The input string need be checked
-
- @retval true - The input is UnicodeString
- @retval false - The input is not UnicodeString
-
- **/
- public static boolean isUnicodeString(String arg0) {
- return arg0.length() >= 3 && isMatch("(\\s)*L(\\:)?\"[^\"]*\"(\\s)*", arg0);
- }
-
- /**
- Check if the input data is HexByteArrayType
-
- @param strSentence The input string need be checked
-
- @retval true - The input is HexByteArrayType
- @retval false - The input is not HexByteArrayType
-
- **/
- public static boolean isHexByteArrayType(String arg0) {
- return arg0.length() >= 4 && isMatch("((\\s)*0x([a-fA-F0-9]){2}(,)?(\\s)*)+", arg0);
- }
-
-
- /**
- Check if the input data is DateType
-
- @param strDateType The input string need be checked
-
- @retval true - The input is DateType
- @retval false - The input is not DateType
-
- **/
- public static boolean isDateType(String strDateType) {
- return isMatch("[1-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9] [0-2][0-9]:[0-5][0-9]", strDateType);
- }
-
- /**
- Check if the input data is DosPath
-
- @param strDosPath The input string need be checked
-
- @retval true - The input is DosPath
- @retval false - The input is not DosPath
-
- **/
- public static boolean isDosPath(String strDosPath) {
- return isMatch("([a-zA-Z]:\\\\)?(((\\\\?_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\\\\)?)*", strDosPath);
- }
-
- /**
- Check if the input data is UnixPath
-
- @param strUnixPath The input string need be checked
-
- @retval true - The input is UnixPath
- @retval false - The input is not UnixPath
-
- **/
- public static boolean isUnixPath(String strUnixPath) {
- return isMatch("(\\/)?(((_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\\/)?)*", strUnixPath);
- }
-
- /**
- Check if the input data is DirectoryNamingConvention
-
- @param strDirectoryNamingConvention The input string need be checked
-
- @retval true - The input is DirectoryNamingConvention
- @retval false - The input is not DirectoryNamingConvention
-
- **/
- public static boolean isDirectoryNamingConvention(String strDirectoryNamingConvention) {
- return (isDosPath(strDirectoryNamingConvention) || isUnixPath(strDirectoryNamingConvention));
- }
-
- /**
- Check if the input data is HexDoubleWordDataType
-
- @param strHexDoubleWordDataType The input string need be checked
-
- @retval true - The input is HexDoubleWordDataType
- @retval false - The input is not HexDoubleWordDataType
-
- **/
- public static boolean isHexDoubleWordDataType(String strHexDoubleWordDataType) {
- return isMatch("0x[a-fA-F0-9]{1,8}", strHexDoubleWordDataType);
- }
-
- /**
- Check if the input data is V1
-
- @param strV1 The input string need be checked
-
- @retval true - The input is V1
- @retval false - The input is not V1
-
- **/
- public static boolean isV1(String strV1) {
- return isMatch("((%[A-Z](_*[A-Z0-9]*)*%)+((((\\\\)?_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\\\\)?)*)", strV1);
- }
-
- /**
- Check if the input data is V2
-
- @param strV2 The input string need be checked
-
- @retval true - The input is V2
- @retval false - The input is not V2
-
- **/
- public static boolean isV2(String strV2) {
- return isMatch(
- "(($[A-Z](_*[A-Z0-9]*)*)+||($\\([A-Z](_*[A-Z0-9]*)*\\))+||($\\{[A-Z](_*[A-Z0-9]*)*\\})+)+(\\/)?(((((_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\\/)?)*)*)",
- strV2);
- }
-
- /**
- Check if the input data is VariableConvention
-
- @param strVariableConvention The input string need be checked
-
- @retval true - The input is VariableConvention
- @retval false - The input is not VariableConvention
-
- **/
- public static boolean isVariableConvention(String strVariableConvention) {
- return (isV1(strVariableConvention) || isV2(strVariableConvention));
- }
-
- /**
- Check if the input data is UCName
-
- @param strUCName The input string need be checked
-
- @retval true - The input is UCName
- @retval false - The input is not UCName
-
- **/
- public static boolean isUCName(String strUCName) {
- return isMatch("[A-Z]+(_*[A-Z0-9]*( )*)*", strUCName);
- }
-
- /**
- Check if the input data is HexByteDataType
-
- @param strHex64BitDataType The input string need be checked
-
- @retval true - The input is HexByteDataType
- @retval false - The input is not HexByteDataType
-
- **/
- public static boolean isHexByteDataType(String strHex64BitDataType) {
- return isMatch("(0x)?[a-fA-F0-9]{1,2}", strHex64BitDataType);
- }
-
- /**
- Check if the input data is HexWordDataType
-
- @param strHexWordDataType The input string need be checked
-
- @retval true - The input is HexWordDataType
- @retval false - The input is not HexWordDataType
-
- **/
- public static boolean isHexWordDataType(String strHexWordDataType) {
- return isMatch("0x[a-fA-F0-9]{1,4}", strHexWordDataType);
- }
-
- /**
- Check if the input data is OverrideID
-
- @param strOverrideID The input string need be checked
-
- @retval true - The input is OverrideID
- @retval false - The input is not OverrideID
-
- **/
- public static boolean isOverrideID(String strOverrideID) {
- return isInt(strOverrideID);
- }
-
- /**
- Check if the input data is Supported Architectures
-
- @param strSupportedArchitectures
- @retval true - The input is Supported Architectures
- @retval false - The input isn't Supported Architectures
-
- */
- public static boolean isSupportedArchitectures(String strSupportedArchitectures) {
- return isMatch("(ALL){1}|(((IA32)|((X64)|(IPF)|(EBC)){1}((,((IA32)|(X64)|(IPF)|(EBC)){1} ){0,2}))){1}",
- strSupportedArchitectures);
- }
-
- //
- //The below is used to check msaheader data type
- //
-
- /**
- Check if the input data is BaseName
-
- @param strBaseName The input string need be checked
-
- @retval true - The input is BaseName
- @retval false - The input is not BaseName
-
- **/
- public static boolean isBaseName(String arg0) {
- return isUiNameType(arg0);
- }
-
- /**
- Check if the input data is Version
-
- @param arg0 The input string need be checked
-
- @retval true - The input is Version
- @retval false - The input is not Version
-
- **/
- public static boolean isVersion(String arg0) {
- return isVersionDataType(arg0);
- }
-
- /**
- Check if the input data is Abstract
-
- @param strAbstract The input string need be checked
-
- @retval true - The input is Abstract
- @retval false - The input is not Abstract
-
- **/
- public static boolean isAbstract(String arg0) {
- return isSentence(arg0);
- }
-
- /**
- Check if the input data is Copyright
-
- @param strCopyright The input string need be checked
-
- @retval true - The input is Copyright
- @retval false - The input is not Copyright
-
- **/
- public static boolean isCopyright(String arg0) {
- return !arg0.equals("");
- }
-
- /**
- Check if the input data is Specification
-
- @param strCopyright The input string need be checked
-
- @retval true - The input is Specification
- @retval false - The input is not Specification
-
- **/
- public static boolean isSpecification(String arg0) {
- return isSentence(arg0);
- }
-
- //
- // The below is used to check ModuleDefinitions data types
- //
- /**
- Check if the input data is OutputFileBasename
-
- @param strCopyright The input string need be checked
-
- @retval true - The input is OutputFileBasename
- @retval false - The input is not OutputFileBasename
-
- **/
- public static boolean isOutputFileBasename(String arg0) {
- return isFileNameConvention(arg0);
- }
-
- //
- // The below is used to check LibraryClass data types
- //
- /**
- Check if the input data is LibraryClass
-
- @param strCopyright The input string need be checked
-
- @retval true - The input is LibraryClass
- @retval false - The input is not LibraryClass
-
- **/
- public static boolean isLibraryClass(String arg0) {
- return isKeywordType(arg0);
- }
-
- /**
- Check if the input data is RecommendedInstanceVersion
-
- @param strCopyright The input string need be checked
-
- @retval true - The input is RecommendedInstanceVersion
- @retval false - The input is not RecommendedInstanceVersion
-
- **/
- public static boolean isRecommendedInstanceVersion(String arg0) {
- return isVersionDataType(arg0);
- }
-
- //
- // The below is used to check sourcefiles data types
- //
-
- /**
- Check if the input data is Filename
-
- @param strPath The input string need be checked
-
- @retval true - The input is Filename
- @retval false - The input is not Filename
-
- **/
- public static boolean isFilename(String arg0) {
- return isPathAndFilename(arg0);
- }
-
- /**
- Check if the input data is TagName
-
- @param strPath The input string need be checked
-
- @retval true - The input is TagName
- @retval false - The input is not TagName
-
- **/
- public static boolean isTagName(String arg0) {
- return isToolsNameConvention(arg0);
- }
-
- /**
- Check if the input data is ToolCode
-
- @param strPath The input string need be checked
-
- @retval true - The input is ToolCode
- @retval false - The input is not ToolCode
-
- **/
- public static boolean isToolCode(String arg0) {
- return isToolsNameConvention(arg0);
- }
-
- /**
- Check if the input data is ToolChainFamily
-
- @param strPath The input string need be checked
-
- @retval true - The input is ToolChainFamily
- @retval false - The input is not ToolChainFamily
-
- **/
- public static boolean isToolChainFamily(String arg0) {
- return isToolsNameConvention(arg0);
- }
-
- //
- // The below is used to check pcdcoded data types
- //
- /**
- Check if the input data is DefaultValueType
-
- @param strPath The input string need be checked
-
- @retval true - The input is DefaultValueType
- @retval false - The input is not DefaultValueType
-
- **/
- public static boolean isDefaultValueType(String arg0) {
- return isHex64BitDataType(arg0) || isUnicodeString(arg0) || isHexByteArrayType(arg0);
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java deleted file mode 100644 index 7eae384c7d..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/EnumerationData.java +++ /dev/null @@ -1,1123 +0,0 @@ -/** @file
-
- The file is used to init all JComboBox items
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common;
-
-import java.util.Vector;
-
-public class EnumerationData {
- //
- // Static data for externs definitions
- //
- public final static String EXTERNS_PCD_IS_DRIVER = "Pcd Is Driver";
-
- public final static String EXTERNS_SPECIFICATION = "Specification";
-
- public final static String EXTERNS_IMAGE = "Image";
-
- public final static String EXTERNS_MODULE_ENTRY_POINT = "ModuleEntryPoint";
-
- public final static String EXTERNS_MODULE_UNLOAD_IMAGE = "ModuleUnloadImage";
-
- public final static String EXTERNS_LIBRARY = "Library";
-
- public final static String EXTERNS_CONSTRUCTOR = "Constructor";
-
- public final static String EXTERNS_DESTRUCTOR = "Destructor";
-
- public final static String EXTERNS_DRIVER = "Driver";
-
- public final static String EXTERNS_DRIVER_BINDING = "DriverBinding";
-
- public final static String EXTERNS_COMPONENT_NAME = "ComponentName";
-
- public final static String EXTERNS_DRIVER_CONFIG = "DriverConfig";
-
- public final static String EXTERNS_DRIVER_DIAG = "DriverDiag";
-
- public final static String EXTERNS_CALL_BACK = "Call Back";
-
- public final static String EXTERNS_VIRTUAL_ADDRESS_MAP_CALL_BACK = "VirtualAddressMap";
-
- public final static String EXTERNS_EXIT_BOOT_SERVICES_CALL_BACK = "ExitBootServices";
-
- //
- // Static data for guid type
- //
- public final static String GUID_TYPE_DATA_HUB_RECORD = "DATA_HUB_RECORD";
-
- public final static String GUID_TYPE_EFI_EVENT = "EFI_EVENT";
-
- public final static String GUID_TYPE_EFI_SYSTEM_CONFIGURATION_TABLE = "EFI_SYSTEM_CONFIGURATION_TABLE";
-
- public final static String GUID_TYPE_EFI_VARIABLE = "EFI_VARIABLE";
-
- public final static String GUID_TYPE_GUID = "GUID";
-
- public final static String GUID_TYPE_HII_PACKAGE_LIST = "HII_PACKAGE_LIST";
-
- public final static String GUID_TYPE_HOB = "HOB";
-
- public final static String GUID_TYPE_TOKEN_SPACE_GUID = "TOKEN_SPACE_GUID";
-
- //
- // Static data for build targets
- //
- public final static String BUILD_TARGET_DEBUG = "DEBUG";
-
- public final static String BUILD_TARGET_RELEASE = "RELEASE";
-
- //
- // Common data
- //
- public Vector<String> vSupportedArchitectures = new Vector<String>();
-
- public Vector<String> vEnabled = new Vector<String>();
-
- public Vector<String> vBoolean = new Vector<String>();
-
- //
- // Used by Msa Header
- //
- public Vector<String> vModuleType = new Vector<String>();
-
- public Vector<String> vCompontentType = new Vector<String>();
-
- //
- // Used by Library Class Definitions
- //
- public Vector<String> vLibraryUsage = new Vector<String>();
-
- public Vector<String> vFrameworkModuleTypes = new Vector<String>();
-
- public Vector<String> vLibClassDef = new Vector<String>();
-
- public Vector<String> vLibClassDefBase = new Vector<String>();
-
- public Vector<String> vLibClassDefPei = new Vector<String>();
-
- public Vector<String> vLibClassDefPeim = new Vector<String>();
-
- public Vector<String> vLibClassDefDxeCore = new Vector<String>();
-
- public Vector<String> vLibClassDefDxeDriver = new Vector<String>();
-
- public Vector<String> vLibClassDefDxeSmmDriver = new Vector<String>();
-
- public Vector<String> vLibClassDefUefiDriver = new Vector<String>();
-
- //
- // Used by Source Files
- //
- public Vector<String> vSourceFilesToolChainFamily = new Vector<String>();
-
- public Vector<String> vSourceFilesFileType = new Vector<String>();
-
- public Vector<String> vToolCode = new Vector<String>();
-
- //
- // Used by Package Dependencies
- //
- public Vector<String> vPackageUsage = new Vector<String>();
-
- //
- // Used by Protocols
- //
- public Vector<String> vProtocolUsage = new Vector<String>();
-
- public Vector<String> vProtocolNotifyUsage = new Vector<String>();
-
- public Vector<String> vProtocolType = new Vector<String>();
-
- //
- // Used by Events
- //
- public Vector<String> vEventType = new Vector<String>();
-
- public Vector<String> vEventUsage = new Vector<String>();
-
- public Vector<String> vEventGroup = new Vector<String>();
-
- //
- // Used by Hobs
- //
- public Vector<String> vHobType = new Vector<String>();
-
- public Vector<String> vHobUsage = new Vector<String>();
-
- //
- // Used by Ppis
- //
- public Vector<String> vPpiType = new Vector<String>();
-
- public Vector<String> vPpiUsage = new Vector<String>();
-
- public Vector<String> vPpiNotifyUsage = new Vector<String>();
-
- //
- // Used by Variable
- //
- public Vector<String> vVariableUsage = new Vector<String>();
-
- //
- // Used by Boot Mode
- //
- public Vector<String> vBootModeNames = new Vector<String>();
-
- public Vector<String> vBootModeUsage = new Vector<String>();
-
- //
- // Used by System Tables
- //
- public Vector<String> vSystemTableUsage = new Vector<String>();
-
- //
- // Used by Data Hubs
- //
- public Vector<String> vDataHubUsage = new Vector<String>();
-
- //
- // Used by Hii Packages
- //
- public Vector<String> vHiiPackageUsage = new Vector<String>();
-
- //
- // Used by Guid
- //
- public Vector<String> vGuidUsage = new Vector<String>();
-
- //
- // Used by Externs
- //
- public Vector<String> vExternTypes = new Vector<String>();
-
- public Vector<String> vPcdDriverTypes = new Vector<String>();
-
- //
- // Used by Pcd
- //
- public Vector<String> vPcdItemTypes = new Vector<String>();
-
- public Vector<String> vPcdUsage = new Vector<String>();
-
- //
- // Used by Build Options
- //
- public Vector<String> vBuildTargets = new Vector<String>();
-
- public EnumerationData() {
- init();
- }
-
- private void init() {
- //
- // Init common data first
- //
- initSupportedArchitectures();
- initEnabled();
- initBoolean();
-
- //
- // Used by Msa header
- //
- initModuleType();
-
- //
- // Used by Library Class Definitions
- //
- initLibraryUsage();
- initFrameworkModuleTypes();
- initLibClassDefBase();
- initLibClassDefPei();
- initLibClassDefPeim();
- initLibClassDefDxeCore();
- initLibClassDefDxeDriver();
- initLibClassDefDxeSmmDriver();
- initLibClassDefUefiDriver();
- initLibClassDef();
-
- //
- // Used by Library Class Definitions
- //
- initSourceFilesToolChainFamily();
- initSourceFilesFileType();
- initToolCode();
-
- //
- // Used by Package Dependencies
- //
- initPackageUsage();
-
- //
- // Used by Protocols
- //
- initProtocolType();
- initProtocolUsage();
- initProtocolNotifyUsage();
-
- //
- // Used by Events
- //
- initEventType();
- initEventUsage();
- initEventGroup();
-
- //
- // Used by Hobs
- //
- initHobType();
- initHobUsage();
-
- //
- // Used by Ppis
- //
- initPpiType();
- initPpiUsage();
- initPpiNotifyUsage();
-
- //
- // Used by Variable
- //
- initVariableUsage();
-
- //
- // Used by Boot Mode
- //
- initBootModeNames();
- initBootModeUsage();
-
- //
- // Used by System Tables
- //
- initSystemTableUsage();
-
- //
- // Used by Data Hubs
- //
- initDataHubUsage();
-
- //
- // Used by Hii Packages
- //
- initHiiPackages();
-
- //
- // Used by Guid
- //
- initGuidUsage();
-
- //
- // Used by Externs
- //
- initExternTypes();
- initPcdDriverTypes();
-
- //
- // Used by Pcd
- //
- initPcdItemTypes();
- initPcdUsage();
-
- //
- // Used by Build Option
- //
- initBuildTargets();
- }
-
- private void initEnabled() {
- vEnabled.removeAllElements();
- vEnabled.addElement("Disabled");
- vEnabled.addElement("Enabled");
- }
-
- private void initBoolean() {
- vBoolean.removeAllElements();
- vBoolean.addElement(DataType.FALSE);
- vBoolean.addElement(DataType.TRUE);
- }
-
- private void initModuleType() {
- vModuleType.removeAllElements();
- vModuleType.addElement("BASE");
- vModuleType.addElement("SEC");
- vModuleType.addElement("PEI_CORE");
- vModuleType.addElement("PEIM");
- vModuleType.addElement("DXE_CORE");
- vModuleType.addElement("DXE_DRIVER");
- vModuleType.addElement("DXE_RUNTIME_DRIVER");
- vModuleType.addElement("DXE_SAL_DRIVER");
- vModuleType.addElement("DXE_SMM_DRIVER");
- vModuleType.addElement("TOOL");
- vModuleType.addElement("UEFI_DRIVER");
- vModuleType.addElement("UEFI_APPLICATION");
- vModuleType.addElement("USER_DEFINED");
- Sort.sortVectorString(vModuleType, DataType.SORT_TYPE_ASCENDING);
- }
-
- // private void initComponentType() {
- // vCompontentType.removeAllElements();
- // vCompontentType.addElement("APRIORI");
- // vCompontentType.addElement("LIBRARY");
- // vCompontentType.addElement("FV_IMAGE_FILE");
- // vCompontentType.addElement("BS_DRIVER");
- // vCompontentType.addElement("RT_DRIVER");
- // vCompontentType.addElement("SAL_RT_DRIVER");
- // vCompontentType.addElement("PE32_PEIM");
- // vCompontentType.addElement("PIC_PEIM");
- // vCompontentType.addElement("COMBINED_PEIM_DRIVER");
- // vCompontentType.addElement("PEI_CORE");
- // vCompontentType.addElement("DXE_CORE");
- // vCompontentType.addElement("APPLICATION");
- // vCompontentType.addElement("BS_DRIVER_EFI");
- // vCompontentType.addElement("SHELLAPP");
- // }
-
- private void initSupportedArchitectures() {
- vSupportedArchitectures.removeAllElements();
- vSupportedArchitectures.addElement("EBC");
- vSupportedArchitectures.addElement("IA32");
- vSupportedArchitectures.addElement("X64");
- vSupportedArchitectures.addElement("IPF");
- vSupportedArchitectures.addElement("ARM");
- vSupportedArchitectures.addElement("PPC");
- }
-
- private void initLibraryUsage() {
- vLibraryUsage.removeAllElements();
- vLibraryUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vLibraryUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vLibraryUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vLibraryUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vLibraryUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initFrameworkModuleTypes() {
- vFrameworkModuleTypes.removeAllElements();
- vFrameworkModuleTypes.addElement("BASE");
- vFrameworkModuleTypes.addElement("SEC");
- vFrameworkModuleTypes.addElement("PEI_CORE");
- vFrameworkModuleTypes.addElement("PEIM");
- vFrameworkModuleTypes.addElement("DXE_CORE");
- vFrameworkModuleTypes.addElement("DXE_DRIVER");
- vFrameworkModuleTypes.addElement("DXE_RUNTIME_DRIVER");
- vFrameworkModuleTypes.addElement("DXE_SAL_DRIVER");
- vFrameworkModuleTypes.addElement("DXE_SMM_DRIVER");
- vFrameworkModuleTypes.addElement("UEFI_DRIVER");
- vFrameworkModuleTypes.addElement("UEFI_APPLICATION");
- vFrameworkModuleTypes.addElement("USER_DEFINED");
- Sort.sortVectorString(vFrameworkModuleTypes, DataType.SORT_TYPE_ASCENDING);
- }
-
- private void initLibClassDef() {
- vLibClassDef.removeAllElements();
- for (int index = 0; index < vLibClassDefBase.size(); index++) {
- vLibClassDef.addElement(vLibClassDefBase.elementAt(index));
- }
- for (int index = 0; index < vLibClassDefPei.size(); index++) {
- vLibClassDef.addElement(vLibClassDefPei.elementAt(index));
- }
- for (int index = 0; index < vLibClassDefPeim.size(); index++) {
- vLibClassDef.addElement(vLibClassDefPeim.elementAt(index));
- }
- for (int index = 0; index < vLibClassDefDxeCore.size(); index++) {
- vLibClassDef.addElement(vLibClassDefDxeCore.elementAt(index));
- }
- for (int index = 0; index < vLibClassDefDxeDriver.size(); index++) {
- vLibClassDef.addElement(vLibClassDefDxeDriver.elementAt(index));
- }
- for (int index = 0; index < vLibClassDefDxeSmmDriver.size(); index++) {
- vLibClassDef.addElement(vLibClassDefDxeSmmDriver.elementAt(index));
- }
- for (int index = 0; index < vLibClassDefUefiDriver.size(); index++) {
- vLibClassDef.addElement(vLibClassDefUefiDriver.elementAt(index));
- }
- }
-
- private void initLibClassDefBase() {
- vLibClassDefBase.removeAllElements();
- vLibClassDefBase.addElement("BaseLib");
- vLibClassDefBase.addElement("BaseMemoryLib");
- vLibClassDefBase.addElement("CacheMaintenanceLib");
- vLibClassDefBase.addElement("DebugLib");
- vLibClassDefBase.addElement("IoLib");
- vLibClassDefBase.addElement("PcdLib");
- vLibClassDefBase.addElement("PciCf8Lib");
- vLibClassDefBase.addElement("PciExpressLib");
- vLibClassDefBase.addElement("PciLib");
- vLibClassDefBase.addElement("PeCoffGetEntryPointLib");
- vLibClassDefBase.addElement("PeCoffLib");
- vLibClassDefBase.addElement("PerformanceLib");
- vLibClassDefBase.addElement("PrintLib");
- vLibClassDefBase.addElement("SmbusLib");
- vLibClassDefBase.addElement("TimerLib");
- }
-
- private void initLibClassDefPei() {
- vLibClassDefPei.removeAllElements();
- vLibClassDefPei.addElement("PeiCoreEntryPoint");
- }
-
- private void initLibClassDefPeim() {
- vLibClassDefPeim.removeAllElements();
- vLibClassDefPeim.addElement("BaseMemoryLib");
- vLibClassDefPeim.addElement("DebugLib");
- vLibClassDefPeim.addElement("HobLib");
- vLibClassDefPeim.addElement("IoLib");
- vLibClassDefPeim.addElement("MemoryAllocationLib");
- vLibClassDefPeim.addElement("PcdLib");
- vLibClassDefPeim.addElement("PeiCoreLib");
- vLibClassDefPeim.addElement("PeiServicesTablePointerLib");
- vLibClassDefPeim.addElement("PeimEntryPoint");
- vLibClassDefPeim.addElement("ReportStatusCodeLib");
- vLibClassDefPeim.addElement("ResourcePublicationLib");
- vLibClassDefPeim.addElement("SmbusLib");
- }
-
- private void initLibClassDefDxeCore() {
- vLibClassDefDxeCore.removeAllElements();
- vLibClassDefDxeCore.addElement("DxeCoreEntryPoint");
- vLibClassDefDxeCore.addElement("HobLib");
- }
-
- private void initLibClassDefDxeDriver() {
- vLibClassDefDxeDriver.removeAllElements();
- vLibClassDefDxeDriver.addElement("DxeServicesTableLib");
- vLibClassDefDxeDriver.addElement("HiiLib");
- vLibClassDefDxeDriver.addElement("HobLib");
- vLibClassDefDxeDriver.addElement("IoLib");
- vLibClassDefDxeDriver.addElement("MemoryAllocationLib");
- vLibClassDefDxeDriver.addElement("PcdLib");
- vLibClassDefDxeDriver.addElement("ReportStatusCodeLib");
- vLibClassDefDxeDriver.addElement("SmbusLib");
- vLibClassDefDxeDriver.addElement("UefiBootServicesTableLib");
- vLibClassDefDxeDriver.addElement("UefiDecompressLib");
- vLibClassDefDxeDriver.addElement("UefiRuntimeServicesTableLib");
- }
-
- private void initLibClassDefDxeSmmDriver() {
- vLibClassDefDxeSmmDriver.removeAllElements();
- vLibClassDefDxeSmmDriver.addElement("DxeSmmDriverEntryPoint");
- }
-
- private void initLibClassDefUefiDriver() {
- vLibClassDefUefiDriver.removeAllElements();
- vLibClassDefUefiDriver.addElement("BaseMemoryLib");
- vLibClassDefUefiDriver.addElement("DebugLib");
- vLibClassDefUefiDriver.addElement("DevicePathLib");
- vLibClassDefUefiDriver.addElement("UefiDriverEntryPoint");
- vLibClassDefUefiDriver.addElement("UefiDriverModelLib");
- vLibClassDefUefiDriver.addElement("UefiLib");
- }
-
- private void initSourceFilesToolChainFamily() {
- vSourceFilesToolChainFamily.removeAllElements();
- vSourceFilesToolChainFamily.addElement("MSFT");
- vSourceFilesToolChainFamily.addElement("INTC");
- vSourceFilesToolChainFamily.addElement("GCC");
- }
-
- private void initSourceFilesFileType() {
- vSourceFilesFileType.removeAllElements();
- vSourceFilesFileType.addElement("CCODE");
- vSourceFilesFileType.addElement("CHEADER");
- vSourceFilesFileType.addElement("ASMHEADER");
- vSourceFilesFileType.addElement("ASM");
- vSourceFilesFileType.addElement("UNI");
- vSourceFilesFileType.addElement("TXT");
- vSourceFilesFileType.addElement("DXS");
- vSourceFilesFileType.addElement("BMP");
- vSourceFilesFileType.addElement("VFR");
- vSourceFilesFileType.addElement("BINARY");
- vSourceFilesFileType.addElement("FV");
- vSourceFilesFileType.addElement("FFS");
- vSourceFilesFileType.addElement("EFI");
- }
-
- private void initToolCode() {
- vToolCode.removeAllElements();
- vToolCode.addElement(DataType.EMPTY_SELECT_ITEM);
- // vToolCode.addElement("Build_CCode");
- // vToolCode.addElement("Build_AUTOGEN");
- // vToolCode.addElement("Build_DPX");
- // vToolCode.addElement("Build_ASM");
- // vToolCode.addElement("Build_Assembly");
- // vToolCode.addElement("Build_Gcc_Assembly");
- // vToolCode.addElement("Build_IPF_Assembly_Code");
- // vToolCode.addElement("Build_IPF_PP_Code");
- // vToolCode.addElement("Build_Library");
- // vToolCode.addElement("Build_UNI");
- // vToolCode.addElement("Build_Unicode_Database");
- // vToolCode.addElement("Build_VFR");
- // vToolCode.addElement("Build_DUMMY");
- 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(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vPackageUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- }
-
- private void initProtocolUsage() {
- vProtocolUsage.removeAllElements();
- vProtocolUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vProtocolUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vProtocolUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vProtocolUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vProtocolUsage.addElement(DataType.USAGE_TYPE_TO_START);
- vProtocolUsage.addElement(DataType.USAGE_TYPE_BY_START);
- vProtocolUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initProtocolType() {
- vProtocolType.removeAllElements();
- vProtocolType.addElement(DataType.PROTOCOL_TYPE_PROTOCOL);
- vProtocolType.addElement(DataType.PROTOCOL_TYPE_PROTOCOL_NOTIFY);
- }
-
- private void initEventType() {
- vEventType.removeAllElements();
- vEventType.addElement("CreateEvents");
- vEventType.addElement("SignalEvents");
- }
-
- private void initEventUsage() {
- vEventUsage.removeAllElements();
- vEventUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vEventUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vEventUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vEventUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vEventUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initEventGroup() {
- vEventGroup.removeAllElements();
- vEventGroup.addElement("EVENT_GROUP_GUID");
- vEventGroup.addElement("EVENT_TYPE_PERIODIC_TIMER");
- vEventGroup.addElement("EVENT_TYPE_RELATIVE_TIMER");
- }
-
- private void initHobType() {
- vHobType.removeAllElements();
- vHobType.addElement("PHIT");
- vHobType.addElement("MEMORY_ALLOCATION");
- vHobType.addElement("RESOURCE_DESCRIPTOR");
- vHobType.addElement("GUID_EXTENSION");
- vHobType.addElement("FIRMWARE_VOLUME");
- vHobType.addElement("CPU");
- vHobType.addElement("POOL");
- vHobType.addElement("CAPSULE_VOLUME");
- }
-
- private void initHobUsage() {
- vHobUsage.removeAllElements();
- vHobUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vHobUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vHobUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vHobUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vHobUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initPpiType() {
- vPpiType.removeAllElements();
- vPpiType.addElement(DataType.PPI_TYPE_PPI);
- vPpiType.addElement(DataType.PPI_TYPE_PPI_NOTIFY);
- }
-
- private void initPpiUsage() {
- vPpiUsage.removeAllElements();
- vPpiUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vPpiUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vPpiUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vPpiUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vPpiUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initPpiNotifyUsage() {
- vPpiNotifyUsage.removeAllElements();
- vPpiNotifyUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- }
-
- private void initProtocolNotifyUsage() {
- vProtocolNotifyUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- }
-
- private void initVariableUsage() {
- vVariableUsage.removeAllElements();
- vVariableUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vVariableUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vVariableUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vVariableUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vVariableUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initBootModeNames() {
- vBootModeNames.removeAllElements();
- vBootModeNames.addElement("FULL");
- vBootModeNames.addElement("MINIMAL");
- vBootModeNames.addElement("NO_CHANGE");
- vBootModeNames.addElement("DIAGNOSTICS");
- vBootModeNames.addElement("DEFAULT");
- vBootModeNames.addElement("S2_RESUME");
- vBootModeNames.addElement("S3_RESUME");
- vBootModeNames.addElement("S4_RESUME");
- vBootModeNames.addElement("S5_RESUME");
- vBootModeNames.addElement("FLASH_UPDATE");
- vBootModeNames.addElement("RECOVERY_FULL");
- vBootModeNames.addElement("RECOVERY_MINIMAL");
- vBootModeNames.addElement("RECOVERY_NO_CHANGE");
- vBootModeNames.addElement("RECOVERY_DIAGNOSTICS");
- vBootModeNames.addElement("RECOVERY_DEFAULT");
- vBootModeNames.addElement("RECOVERY_S2_RESUME");
- vBootModeNames.addElement("RECOVERY_S3_RESUME");
- vBootModeNames.addElement("RECOVERY_S4_RESUME");
- vBootModeNames.addElement("RECOVERY_S5_RESUME");
- vBootModeNames.addElement("RECOVERY_FLASH_UPDATE");
- }
-
- private void initBootModeUsage() {
- vBootModeUsage.removeAllElements();
- vBootModeUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vBootModeUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vBootModeUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vBootModeUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- }
-
- private void initSystemTableUsage() {
- vSystemTableUsage.removeAllElements();
- vSystemTableUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vSystemTableUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vSystemTableUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vSystemTableUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vSystemTableUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initDataHubUsage() {
- vDataHubUsage.removeAllElements();
- vDataHubUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vDataHubUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vDataHubUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vDataHubUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vDataHubUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initHiiPackages() {
- vHiiPackageUsage.removeAllElements();
- vHiiPackageUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vHiiPackageUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vHiiPackageUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initGuidUsage() {
- vGuidUsage.removeAllElements();
- vGuidUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vGuidUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vGuidUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vGuidUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- vGuidUsage.addElement(DataType.USAGE_TYPE_PRIVATE);
- }
-
- private void initExternTypes() {
- vExternTypes.removeAllElements();
-
- vExternTypes.addElement(EnumerationData.EXTERNS_SPECIFICATION);
- vExternTypes.addElement(EnumerationData.EXTERNS_IMAGE);
- vExternTypes.addElement(EnumerationData.EXTERNS_DRIVER);
- vExternTypes.addElement(EnumerationData.EXTERNS_LIBRARY);
- vExternTypes.addElement(EnumerationData.EXTERNS_CALL_BACK);
- }
-
- private void initPcdDriverTypes() {
- vPcdDriverTypes.removeAllElements();
- vPcdDriverTypes.addElement("PEI_PCD_DRIVER");
- vPcdDriverTypes.addElement("DXE_PCD_DRIVER");
- }
-
- private void initPcdItemTypes() {
- vPcdItemTypes.removeAllElements();
- vPcdItemTypes.addElement(DataType.PCD_ITEM_TYPE_FEATURE_FLAG);
- vPcdItemTypes.addElement(DataType.PCD_ITEM_TYPE_FIXED_AT_BUILD);
- vPcdItemTypes.addElement(DataType.PCD_ITEM_TYPE_PATCHABLE_IN_MODULE);
- vPcdItemTypes.addElement(DataType.PCD_ITEM_TYPE_DYNAMIC);
- vPcdItemTypes.addElement(DataType.PCD_ITEM_TYPE_DYNAMIC_EX);
- }
-
- private void initPcdUsage() {
- vPcdUsage.removeAllElements();
- vPcdUsage.addElement(DataType.USAGE_TYPE_ALWAYS_CONSUMED);
- vPcdUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_CONSUMED);
- vPcdUsage.addElement(DataType.USAGE_TYPE_ALWAYS_PRODUCED);
- vPcdUsage.addElement(DataType.USAGE_TYPE_SOMETIMES_PRODUCED);
- }
-
- private void initBuildTargets() {
- vBuildTargets.removeAllElements();
- vBuildTargets.addElement(EnumerationData.BUILD_TARGET_DEBUG);
- vBuildTargets.addElement(EnumerationData.BUILD_TARGET_RELEASE);
- }
-
- public Vector<String> getvCompontentType() {
- return vCompontentType;
- }
-
- public void setvCompontentType(Vector<String> componentType) {
- vCompontentType = componentType;
- }
-
- public Vector<String> getVModuleType() {
- return vModuleType;
- }
-
- public void setVModuleType(Vector<String> moduleType) {
- vModuleType = moduleType;
- }
-
- public Vector<String> getVLibraryUsage() {
- return vLibraryUsage;
- }
-
- public void setVLibClassDefUsage(Vector<String> libClassDefUsage) {
- vLibraryUsage = libClassDefUsage;
- }
-
- public Vector<String> getVLibClassDef() {
- return vLibClassDef;
- }
-
- public void setVLibClassDef(Vector<String> libClassDef) {
- vLibClassDef = libClassDef;
- }
-
- public Vector<String> getVCompontentType() {
- return vCompontentType;
- }
-
- public void setVCompontentType(Vector<String> compontentType) {
- vCompontentType = compontentType;
- }
-
- public Vector<String> getVLibClassDefBase() {
- return vLibClassDefBase;
- }
-
- public void setVLibClassDefBase(Vector<String> libClassDefBase) {
- vLibClassDefBase = libClassDefBase;
- }
-
- public Vector<String> getVLibClassDefDxeCore() {
- return vLibClassDefDxeCore;
- }
-
- public void setVLibClassDefDxeCore(Vector<String> libClassDefDxeCore) {
- vLibClassDefDxeCore = libClassDefDxeCore;
- }
-
- public Vector<String> getVLibClassDefDxeDriver() {
- return vLibClassDefDxeDriver;
- }
-
- public void setVLibClassDefDxeDriver(Vector<String> libClassDefDxeDriver) {
- vLibClassDefDxeDriver = libClassDefDxeDriver;
- }
-
- public Vector<String> getVLibClassDefDxeSmmDriver() {
- return vLibClassDefDxeSmmDriver;
- }
-
- public void setVLibClassDefDxeSmmDriver(Vector<String> libClassDefDxeSmmDriver) {
- vLibClassDefDxeSmmDriver = libClassDefDxeSmmDriver;
- }
-
- public Vector<String> getVLibClassDefPei() {
- return vLibClassDefPei;
- }
-
- public void setVLibClassDefPei(Vector<String> libClassDefPei) {
- vLibClassDefPei = libClassDefPei;
- }
-
- public Vector<String> getVLibClassDefPeim() {
- return vLibClassDefPeim;
- }
-
- public void setVLibClassDefPeim(Vector<String> libClassDefPeim) {
- vLibClassDefPeim = libClassDefPeim;
- }
-
- public Vector<String> getVLibClassDefUefiDriver() {
- return vLibClassDefUefiDriver;
- }
-
- public void setVLibClassDefUefiDriver(Vector<String> libClassDefUefiDriver) {
- vLibClassDefUefiDriver = libClassDefUefiDriver;
- }
-
- public Vector<String> getVSourceFilesFileType() {
- return vSourceFilesFileType;
- }
-
- public void setVSourceFilesFileType(Vector<String> sourceFilesFileType) {
- vSourceFilesFileType = sourceFilesFileType;
- }
-
- public Vector<String> getVSourceFilesToolChainFamily() {
- return vSourceFilesToolChainFamily;
- }
-
- public void setVSourceFilesToolChainFamily(Vector<String> sourceFilesToolChainFamily) {
- vSourceFilesToolChainFamily = sourceFilesToolChainFamily;
- }
-
- public void setVLibraryUsage(Vector<String> libraryUsage) {
- vLibraryUsage = libraryUsage;
- }
-
- public Vector<String> getVProtocolNotifyUsage() {
- return vProtocolNotifyUsage;
- }
-
- public void setVProtocolNotifyUsage(Vector<String> protocolNotifyUsage) {
- vProtocolNotifyUsage = protocolNotifyUsage;
- }
-
- public Vector<String> getVProtocolUsage() {
- return vProtocolUsage;
- }
-
- public void setVProtocolUsage(Vector<String> protocolUsage) {
- vProtocolUsage = protocolUsage;
- }
-
- public Vector<String> getVSupportedArchitectures() {
- return vSupportedArchitectures;
- }
-
- public void setVSupportedArchitectures(Vector<String> supportedArchitectures) {
- vSupportedArchitectures = supportedArchitectures;
- }
-
- public Vector<String> getVProtocolType() {
- return vProtocolType;
- }
-
- public void setVProtocolType(Vector<String> protocolType) {
- vProtocolType = protocolType;
- }
-
- public Vector<String> getVEventGroup() {
- return vEventGroup;
- }
-
- public void setVEventGroup(Vector<String> eventGroup) {
- vEventGroup = eventGroup;
- }
-
- public Vector<String> getVEventType() {
- return vEventType;
- }
-
- public void setVEventType(Vector<String> eventType) {
- vEventType = eventType;
- }
-
- public Vector<String> getVEventUsage() {
- return vEventUsage;
- }
-
- public void setVEventUsage(Vector<String> eventUsage) {
- vEventUsage = eventUsage;
- }
-
- public Vector<String> getVEnabled() {
- return vEnabled;
- }
-
- public void setVEnabled(Vector<String> enabled) {
- vEnabled = enabled;
- }
-
- public Vector<String> getVHobType() {
- return vHobType;
- }
-
- public void setVHobType(Vector<String> hobType) {
- vHobType = hobType;
- }
-
- public Vector<String> getVHobUsage() {
- return vHobUsage;
- }
-
- public void setVHobUsage(Vector<String> hobUsage) {
- vHobUsage = hobUsage;
- }
-
- public Vector<String> getVPpiNotifyUsage() {
- return vPpiNotifyUsage;
- }
-
- public void setVPpiNotifyUsage(Vector<String> ppiNotifyUsage) {
- vPpiNotifyUsage = ppiNotifyUsage;
- }
-
- public Vector<String> getVPpiType() {
- return vPpiType;
- }
-
- public void setVPpiType(Vector<String> ppiType) {
- vPpiType = ppiType;
- }
-
- public Vector<String> getVPpiUsage() {
- return vPpiUsage;
- }
-
- public void setVPpiUsage(Vector<String> ppiUsage) {
- vPpiUsage = ppiUsage;
- }
-
- public Vector<String> getVVariableUsage() {
- return vVariableUsage;
- }
-
- public void setVVariableUsage(Vector<String> variableUsage) {
- vVariableUsage = variableUsage;
- }
-
- public Vector<String> getVBootModeNames() {
- return vBootModeNames;
- }
-
- public void setVBootModeNames(Vector<String> bootModeNames) {
- vBootModeNames = bootModeNames;
- }
-
- public Vector<String> getVBootModeUsage() {
- return vBootModeUsage;
- }
-
- public void setVBootModeUsage(Vector<String> bootModeUsage) {
- vBootModeUsage = bootModeUsage;
- }
-
- public Vector<String> getVSystemTableUsage() {
- return vSystemTableUsage;
- }
-
- public void setVSystemTableUsage(Vector<String> systemTableUsage) {
- vSystemTableUsage = systemTableUsage;
- }
-
- public Vector<String> getVDataHubUsage() {
- return vDataHubUsage;
- }
-
- public void setVDataHubUsage(Vector<String> dataHubUsage) {
- vDataHubUsage = dataHubUsage;
- }
-
- public Vector<String> getVGuidUsage() {
- return vGuidUsage;
- }
-
- public void setVGuidUsage(Vector<String> guidUsage) {
- vGuidUsage = guidUsage;
- }
-
- public Vector<String> getVHiiPackageUsage() {
- return vHiiPackageUsage;
- }
-
- public void setVHiiPackageUsage(Vector<String> hiiPackageUsage) {
- vHiiPackageUsage = hiiPackageUsage;
- }
-
- public Vector<String> getVPcdItemTypes() {
- return vPcdItemTypes;
- }
-
- public void setVPcdItemTypes(Vector<String> pcdItemTypes) {
- vPcdItemTypes = pcdItemTypes;
- }
-
- public Vector<String> getVExternTypes() {
- return vExternTypes;
- }
-
- public void setVExternTypes(Vector<String> externTypes) {
- vExternTypes = externTypes;
- }
-
- public Vector<String> getVPcdDriverTypes() {
- return vPcdDriverTypes;
- }
-
- public void setVPcdDriverTypes(Vector<String> pcdDriverTypes) {
- vPcdDriverTypes = pcdDriverTypes;
- }
-
- public Vector<String> getVBoolean() {
- return vBoolean;
- }
-
- public void setVBoolean(Vector<String> boolean1) {
- vBoolean = boolean1;
- }
-
- public Vector<String> getVFrameworkModuleTypes() {
- return vFrameworkModuleTypes;
- }
-
- public void setVFrameworkModuleTypes(Vector<String> frameworkModuleTypes) {
- vFrameworkModuleTypes = frameworkModuleTypes;
- }
-
- public Vector<String> getVPackageUsage() {
- return vPackageUsage;
- }
-
- public void setVPackageUsage(Vector<String> packageUsage) {
- vPackageUsage = packageUsage;
- }
-
- public Vector<String> getVToolCode() {
- return vToolCode;
- }
-
- public void setVToolCode(Vector<String> toolCode) {
- vToolCode = toolCode;
- }
-
- public Vector<String> getVPcdUsage() {
- return vPcdUsage;
- }
-
- public void setVPcdUsage(Vector<String> pcdUsage) {
- vPcdUsage = pcdUsage;
- }
-
- public Vector<String> getVBuildTargets() {
- return vBuildTargets;
- }
-
- public void setVBuildTargets(Vector<String> buildTargets) {
- vBuildTargets = buildTargets;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/FileOperation.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/FileOperation.java deleted file mode 100644 index 7f15de8f89..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/FileOperation.java +++ /dev/null @@ -1,193 +0,0 @@ -/** @file
-
- The file is used to provides interfaces for file operations
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-
-public class FileOperation {
-
- /**
-
- @param args
- * @throws Exception
-
- **/
- public static void main(String[] args) throws Exception {
- FileOperation.newFolder("C:\\aaa\\aaa\\aaa\\aaa\\aaa");
- }
-
- /**
- To new a folder
-
- @param folderPath The folder path to be created
- @throws Exception
-
- **/
- public static void newFolder(String folderPath) throws Exception {
- folderPath = Tools.convertPathToCurrentOsType(folderPath);
- File f = new File(folderPath);
- f.mkdirs();
- }
-
- /**
- Delete a file
-
- @param filePath The file path to be deleted
- @throws Exception
-
- **/
- public static void delFile(String filePath) throws Exception {
- File f = new File(filePath);
- if (f.exists()) {
- f.delete();
- }
- }
-
- /**
- Delete a folder and all its files
-
- @param filePath The name of the folder which need be deleted
- @throws Exception
-
- **/
- public static void delFolder(String filePath) throws Exception {
- File f = new File(filePath);
- if (!f.exists()) {
- return;
- }
- if (!f.isDirectory()) {
- return;
- }
- delFolder(f);
- }
-
- /**
- Delete a folder and all its files
-
- @param fleFolderName The name of the folder which need be deleted
-
- @retval true - Delete successfully
- @retval false - Delete successfully
-
- **/
- private static boolean delFolder(File fileName) throws Exception {
- boolean blnIsDeleted = true;
-
- File[] aryAllFiles = fileName.listFiles();
-
- for (int indexI = 0; indexI < aryAllFiles.length; indexI++) {
- if (blnIsDeleted) {
- if (aryAllFiles[indexI].isDirectory()) {
- //
- //If is a directory, recursively call this function to delete sub folders
- //
- blnIsDeleted = delFolder(aryAllFiles[indexI]);
- } else if (aryAllFiles[indexI].isFile()) {
- //
- //If is a file, delete it
- //
- if (!aryAllFiles[indexI].delete()) {
- blnIsDeleted = false;
- }
- }
- }
- }
- if (blnIsDeleted) {
- fileName.delete();
- }
- return blnIsDeleted;
- }
-
- /**
- Copy a file
-
- @param oldPath
- @param newPath
- @throws Exception
-
- **/
- public static void copyFile(String oldPath, String newPath) throws Exception {
- oldPath = Tools.convertPathToCurrentOsType(oldPath);
- newPath = Tools.convertPathToCurrentOsType(newPath);
-
- int byteCount = 0;
- File oldFile = new File(oldPath);
-
- File newFile = new File(Tools.getFilePathOnly(newPath));
- if (!newFile.exists()) {
- newFolder(Tools.getFilePathOnly(newPath));
- }
-
- if (oldFile.exists()) {
- InputStream is = new FileInputStream(oldPath);
- FileOutputStream fos = new FileOutputStream(newPath);
- byte[] buffer = new byte[1024];
-
- while ((byteCount = is.read(buffer)) != -1) {
- fos.write(buffer, 0, byteCount);
- }
-
- is.close();
- }
- }
-
- /**
- Copy a folder
-
- @param oldPath
- @param newPath
- @throws Exception
-
- **/
- public static void copyFolder(String oldPath, String newPath) throws Exception {
- File oldFile = new File(oldPath);
-
- //
- // Create new file path first
- //
- newFolder(newPath);
-
- String[] files = oldFile.list();
- File temp = null;
- for (int index = 0; index < files.length; index++) {
- if (oldPath.endsWith(DataType.FILE_SEPARATOR)) {
- temp = new File(oldPath + files[index]);
- } else {
- temp = new File(oldPath + DataType.FILE_SEPARATOR + files[index]);
- }
-
- if (temp.isFile()) {
- FileInputStream fis = new FileInputStream(temp);
- FileOutputStream fos = new FileOutputStream(newPath + DataType.FILE_SEPARATOR
- + (temp.getName()).toString());
- byte[] b = new byte[1024 * 5];
- int len;
- while ((len = fis.read(b)) != -1) {
- fos.write(b, 0, len);
- }
- fos.flush();
- fos.close();
- fis.close();
- }
- if (temp.isDirectory()) {
- copyFolder(oldPath + DataType.FILE_SEPARATOR + files[index], newPath + DataType.FILE_SEPARATOR
- + files[index]);
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/GlobalData.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/GlobalData.java deleted file mode 100644 index ed175e5343..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/GlobalData.java +++ /dev/null @@ -1,300 +0,0 @@ -/** @file
- The file is used to provide initializing global data.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
- **/
-package org.tianocore.frameworkwizard.common;
-
-import java.io.IOException;
-import java.util.Vector;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.FrameworkDatabaseDocument.FrameworkDatabase;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.MsaFilesDocument.MsaFiles;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleList;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageList;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformList;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-public class GlobalData {
-
- public static FrameworkDatabase fdb = null;
-
- public static OpeningModuleList openingModuleList = new OpeningModuleList();
-
- public static OpeningPackageList openingPackageList = new OpeningPackageList();
-
- public static OpeningPlatformList openingPlatformList = new OpeningPlatformList();
-
- public static Vector<ModuleIdentification> vModuleList = new Vector<ModuleIdentification>();
-
- public static Vector<PackageIdentification> vPackageList = new Vector<PackageIdentification>();
-
- public static Vector<PlatformIdentification> vPlatformList = new Vector<PlatformIdentification>();
-
- public static void init() {
- initDatabase();
- initPackage();
- initPlatform();
- initModule();
- }
-
- public static void initDatabase() {
- String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();
- strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);
- try {
- fdb = OpenFile.openFrameworkDb(strFrameworkDbFilePath);
- } catch (XmlException e) {
- Log.err("Open Framework Database " + strFrameworkDbFilePath, e.getMessage());
- return;
- } catch (Exception e) {
- Log.err("Open Framework Database " + strFrameworkDbFilePath, "Invalid file type");
- return;
- }
- }
-
- public static void initModule() {
- vModuleList = new Vector<ModuleIdentification>();
- openingModuleList = new OpeningModuleList();
-
- ModuleSurfaceArea msa = null;
- Vector<String> modulePaths = new Vector<String>();
- Identification id = null;
- ModuleIdentification mid = null;
- String packagePath = null;
- String modulePath = null;
-
- //
- // For each package, get all modules list
- //
- if (vPackageList.size() > 0) {
- for (int indexI = 0; indexI < vPackageList.size(); indexI++) {
- packagePath = vPackageList.elementAt(indexI).getPath();
- modulePaths = getAllModulesOfPackage(packagePath);
-
- for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {
- try {
- modulePath = modulePaths.get(indexJ);
- msa = OpenFile.openMsaFile(modulePath);
-
- } catch (IOException e) {
- Log.err("Open Module Surface Area " + modulePath, e.getMessage());
- continue;
- } catch (XmlException e) {
- Log.err("Open Module Surface Area " + modulePath, e.getMessage());
- continue;
- } catch (Exception e) {
- Log.err("Open Module Surface Area " + modulePath, "Invalid file type");
- continue;
- }
- id = Tools.getId(modulePath, msa);
- mid = new ModuleIdentification(id, vPackageList.elementAt(indexI));
- vModuleList.addElement(mid);
- openingModuleList.insertToOpeningModuleList(mid, msa);
- }
- }
- Sort.sortModules(vModuleList, DataType.SORT_TYPE_ASCENDING);
- }
- }
-
- public static void initPackage() {
- vPackageList = new Vector<PackageIdentification>();
- openingPackageList = new OpeningPackageList();
- if (fdb != null) {
- for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) {
- String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR
- + fdb.getPackageList().getFilenameArray(index).getStringValue();
- path = Tools.convertPathToCurrentOsType(path);
- PackageSurfaceArea spd = null;
- PackageIdentification id = null;
- try {
- spd = OpenFile.openSpdFile(path);
- } catch (IOException e) {
- Log.err("Open Package Surface Area " + path, e.getMessage());
- continue;
- } catch (XmlException e) {
- Log.err("Open Package Surface Area " + path, e.getMessage());
- continue;
- } catch (Exception e) {
- Log.err("Open Package Surface Area " + path, "Invalid file type");
- continue;
- }
- id = Tools.getId(path, spd);
- vPackageList.addElement(id);
- openingPackageList.insertToOpeningPackageList(id, spd);
- }
- Sort.sortPackages(vPackageList, DataType.SORT_TYPE_ASCENDING);
- }
- }
-
- public static void initPlatform() {
- vPlatformList = new Vector<PlatformIdentification>();
- openingPlatformList = new OpeningPlatformList();
-
- if (fdb != null) {
- for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) {
- String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR
- + fdb.getPlatformList().getFilenameArray(index).getStringValue();
- path = Tools.convertPathToCurrentOsType(path);
- PlatformSurfaceArea fpd = null;
- PlatformIdentification id = null;
- try {
- fpd = OpenFile.openFpdFile(path);
- } catch (IOException e) {
- Log.err("Open Platform Surface Area " + path, e.getMessage());
- continue;
- } catch (XmlException e) {
- Log.err("Open Platform Surface Area " + path, e.getMessage());
- continue;
- } catch (Exception e) {
- Log.err("Open Platform Surface Area " + path, "Invalid file type");
- continue;
- }
- id = Tools.getId(path, fpd);
- vPlatformList.addElement(new PlatformIdentification(id));
- openingPlatformList.insertToOpeningPlatformList(id, fpd);
- }
- Sort.sortPlatforms(vPlatformList, DataType.SORT_TYPE_ASCENDING);
- }
- }
-
- /**
- Get all modules' paths from one package
-
- @return a Vector with all modules' path
-
- **/
- public static Vector<String> getAllModulesOfPackage(String path) {
- Vector<String> modulePath = new Vector<String>();
- try {
- MsaFiles files = OpenFile.openSpdFile(path).getMsaFiles();
- if (files != null) {
- for (int index = 0; index < files.getFilenameList().size(); index++) {
- String msaPath = files.getFilenameList().get(index);
- msaPath = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + msaPath;
- msaPath = Tools.convertPathToCurrentOsType(msaPath);
- modulePath.addElement(msaPath);
- }
- }
- } catch (IOException e) {
- Log.err("Get all modules from a package " + path, e.getMessage());
- } catch (XmlException e) {
- Log.err("Get all modules from a package " + path, e.getMessage());
- } catch (Exception e) {
- Log.err("Get all modules from a package " + path, e.getMessage());
- }
- return modulePath;
- }
-
- /**
- Get a module id
-
- @param moduleGuid
- @param moduleVersion
- @param packageGuid
- @param packageVersion
- @return
-
- **/
- public static ModuleIdentification findModuleId(String moduleGuid, String moduleVersion, String packageGuid,
- String packageVersion) {
- ModuleIdentification mid = null;
- for (int index = 0; index < vModuleList.size(); index++) {
- if (vModuleList.elementAt(index).equals(moduleGuid, moduleVersion, packageGuid, packageVersion)) {
- mid = vModuleList.elementAt(index);
- break;
- }
- }
- return mid;
- }
-
- /**
- Get a package id
-
- @param packageGuid
- @param packageVersion
- @return
-
- **/
- public static PackageIdentification findPackageId(String packageGuid, String packageVersion) {
- PackageIdentification pid = null;
- for (int index = 0; index < vPackageList.size(); index++) {
- if (vPackageList.elementAt(index).equals(packageGuid, packageVersion)) {
- pid = vPackageList.elementAt(index);
- break;
- }
- }
- return pid;
- }
-
- /**
- Get a platform id
-
- @param platformGuid
- @param platformVersion
- @return
-
- **/
- public static PlatformIdentification findPlatformId(String platformGuid, String platformVersion) {
- PlatformIdentification pid = null;
- for (int index = 0; index < vPlatformList.size(); index++) {
- if (vPlatformList.elementAt(index).equals(platformGuid, platformVersion)) {
- pid = vPlatformList.elementAt(index);
- break;
- }
- }
- return pid;
- }
-
- /**
-
- @param relativePath
- @param mode
- @return
-
- **/
- public static boolean isDuplicateRelativePath(String relativePath, int mode) {
- if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- for (int index = 0; index < vModuleList.size(); index++) {
- String path = vModuleList.elementAt(index).getPath();
- if (Tools.getFilePathOnly(path).equals(relativePath)) {
- return true;
- }
- }
- }
-
- if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- for (int index = 0; index < vPackageList.size(); index++) {
- String path = vPackageList.elementAt(index).getPath();
- if (Tools.getFilePathOnly(path).equals(relativePath)) {
- return true;
- }
- }
- }
-
- if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- for (int index = 0; index < vPlatformList.size(); index++) {
- String path = vPlatformList.elementAt(index).getPath();
- if (Tools.getFilePathOnly(path).equals(relativePath)) {
- return true;
- }
- }
- }
-
- return false;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/IDefaultTableModel.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/IDefaultTableModel.java deleted file mode 100644 index 57ba11b9af..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/IDefaultTableModel.java +++ /dev/null @@ -1,37 +0,0 @@ -/** @file
-
- The file is used to override DefaultTableModel to provides customized interfaces
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common;
-
-import javax.swing.table.DefaultTableModel;
-
-public class IDefaultTableModel extends DefaultTableModel {
-
- ///
- ///
- ///
- private static final long serialVersionUID = -1782544418084080185L;
-
- public IDefaultTableModel() {
- super();
- }
-
- /* (non-Javadoc)
- * @see javax.swing.table.TableModel#isCellEditable(int, int)
- *
- */
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return false;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/IFileFilter.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/IFileFilter.java deleted file mode 100644 index 8194a316c6..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/IFileFilter.java +++ /dev/null @@ -1,91 +0,0 @@ -/** @file
-
- The file is used to override FileFilter to provides customized interfaces
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.common;
-
-import java.io.File;
-
-import javax.swing.filechooser.FileFilter;
-
-/**
- The class is used to override FileFilter to provides customized interfaces
-
- **/
-public class IFileFilter extends FileFilter {
-
- private String strExt;
-
- /**
- Reserved for test
-
- @param args
-
- **/
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- This is the default constructor
-
- @param ext
-
- **/
- public IFileFilter(String ext) {
- this.strExt = ext;
- }
-
- /* (non-Javadoc)
- * @see javax.swing.filechooser.FileFilter#accept(java.io.File)
- *
- * Override method "accept"
- *
- */
- public boolean accept(File file) {
- if (file.isDirectory()) {
- return true;
- }
- String strFileName = file.getName();
- int intIndex = strFileName.lastIndexOf('.');
- if (intIndex > 0 && intIndex < strFileName.length() - 1) {
- String strExtension = strFileName.substring(intIndex + 1).toLowerCase();
- if (strExtension.equals(strExt))
- return true;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see javax.swing.filechooser.FileFilter#getDescription()
- *
- * Override method "getDescription" to config description via different file type
- *
- */
- public String getDescription() {
- if (strExt.equals(DataType.MODULE_SURFACE_AREA_EXT))
- return DataType.MODULE_SURFACE_AREA_EXT_DESCRIPTION;
- if (strExt.equals(DataType.PACKAGE_SURFACE_AREA_EXT))
- return DataType.PACKAGE_SURFACE_AREA_EXT_DESCRIPTION;
- if (strExt.equals(DataType.PLATFORM_SURFACE_AREA_EXT))
- return DataType.PLATFORM_SURFACE_AREA_EXT_DESCRIPTION;
- if (strExt.equals(DataType.TEXT_FILE_EXT))
- return DataType.TEXT_FILE_EXT_DESCRIPTION;
- if (strExt.equals(DataType.FAR_SURFACE_AREA_EXT))
- return DataType.FAR_SURFACE_AREA_EXT_DESCRIPTION;
- return "";
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/Identification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/Identification.java deleted file mode 100644 index 03717b560b..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/Identification.java +++ /dev/null @@ -1,113 +0,0 @@ -/** @file
-
- The file is used to save basic information
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.common.Identifications;
-
-public class Identification {
-
- ///
- /// Define class members
- ///
- private String name;
-
- private String guid;
-
- private String version;
-
- private String path;
-
- public Identification(String name, String guid, String version) {
- this.name = name;
- this.guid = guid;
- this.version = version;
- }
-
- public Identification() {
-
- }
-
- public Identification(String name, String guid, String version, String path) {
- this.name = name;
- this.guid = guid;
- this.version = version;
- this.path = path;
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof Identification) {
- Identification id = (Identification) obj;
- if (path.equals(id.path)) {
- return true;
- }
- return false;
- } else {
- return super.equals(obj);
- }
- }
-
- public boolean equalsWithGuid(Object obj) {
- if (obj instanceof Identification) {
- Identification id = (Identification) obj;
- if (guid.equalsIgnoreCase(id.guid)) {
- if (version == null || id.version == null) {
- return true;
- } else if (version.trim().equalsIgnoreCase("") || id.version.trim().equalsIgnoreCase("")) {
- return true;
- } else if (version.equalsIgnoreCase(id.version)) {
- return true;
- }
- }
- return false;
- } else {
- return super.equals(obj);
- }
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setGuid(String guid) {
- this.guid = guid;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- public String getGuid() {
- return guid;
- }
-
- public String getName() {
- return name;
- }
-
- public String getVersion() {
- return version;
- }
-
- public String getPath() {
- return path;
- }
-
- public int hashCode() {
- return guid.toLowerCase().hashCode();
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningFileType.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningFileType.java deleted file mode 100644 index 9811c19868..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningFileType.java +++ /dev/null @@ -1,71 +0,0 @@ -/** @file
-
- The file is used to define common opening file type
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.common.Identifications;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import javax.swing.tree.TreePath;
-
-
-public class OpeningFileType {
- //
- // Define class members
- //
- private boolean isSaved = true;
-
- private boolean isNew = false;
-
- private boolean isOpen = false;
-
- private Set<TreePath> treePath = new LinkedHashSet<TreePath>();
-
- public OpeningFileType() {
-
- }
-
- public boolean isNew() {
- return isNew;
- }
-
- public void setNew(boolean isNew) {
- this.isNew = isNew;
- }
-
- public boolean isSaved() {
- return isSaved;
- }
-
- public void setSaved(boolean isSaved) {
- this.isSaved = isSaved;
- }
-
- public boolean isOpen() {
- return isOpen;
- }
-
- public void setOpen(boolean isOpen) {
- this.isOpen = isOpen;
- }
-
- public Set<TreePath> getTreePath() {
- return treePath;
- }
-
- public void setTreePath(Set<TreePath> treePath) {
- this.treePath = treePath;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleList.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleList.java deleted file mode 100644 index c98d6f95b5..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleList.java +++ /dev/null @@ -1,231 +0,0 @@ -/** @file
-
- The file is used to define opening module list
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.Identifications;
-
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.tree.TreePath;
-
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-
-public class OpeningModuleList {
- private Vector<OpeningModuleType> vOpeningModuleList = new Vector<OpeningModuleType>();
-
- public OpeningModuleList() {
-
- }
-
- public Vector<OpeningModuleType> getVOpeningModuleList() {
- return vOpeningModuleList;
- }
-
- public void setVOpeningModuleList(Vector<OpeningModuleType> openingModuleList) {
- vOpeningModuleList = openingModuleList;
- }
-
- public void insertToOpeningModuleList(ModuleIdentification id, ModuleSurfaceAreaDocument.ModuleSurfaceArea xmlMsa) {
- vOpeningModuleList.addElement(new OpeningModuleType(id, xmlMsa));
- }
-
- public OpeningModuleType getOpeningModuleByIndex(int index) {
- if (index > -1 && index < vOpeningModuleList.size()) {
- return vOpeningModuleList.elementAt(index);
- }
- return null;
- }
-
- public OpeningModuleType getOpeningModuleById(ModuleIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningModuleList.elementAt(index);
- }
- return null;
- }
-
- public int findIndexOfListById(ModuleIdentification id) {
- for (int index = 0; index < vOpeningModuleList.size(); index++) {
- if (vOpeningModuleList.elementAt(index).getId().equals(id)) {
- return index;
- }
- }
- return -1;
- }
-
- public void removeFromOpeningModuleListByIndex(int index) {
- if (index > -1 && index < vOpeningModuleList.size()) {
- vOpeningModuleList.removeElementAt(index);
- }
- }
-
- public void removeFromOpeningModuleListById(ModuleIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- vOpeningModuleList.removeElementAt(findIndexOfListById(id));
- }
- }
-
- public void removeAllFromOpeningModuleList() {
- vOpeningModuleList.removeAllElements();
- }
-
- public ModuleSurfaceAreaDocument.ModuleSurfaceArea getModuleSurfaceAreaFromId(ModuleIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningModuleList.elementAt(index).getXmlMsa();
- }
- return null;
- }
-
- public boolean existsModule(ModuleIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return true;
- }
- return false;
- }
-
- public void setModuleSaved(ModuleIdentification id, boolean isSaved) {
- setModuleSaved(findIndexOfListById(id), isSaved);
- }
-
- public void setModuleSaved(int index, boolean isSaved) {
- if (index > -1) {
- vOpeningModuleList.elementAt(index).setSaved(isSaved);
- }
- }
-
- public boolean getModuleSaved(ModuleIdentification id) {
- return getModuleSaved(findIndexOfListById(id));
- }
-
- public boolean getModuleSaved(int index) {
- if (index > -1) {
- return vOpeningModuleList.elementAt(index).isSaved();
- }
- return true;
- }
-
- public void setModuleOpen(ModuleIdentification id, boolean isOpen) {
- setModuleOpen(findIndexOfListById(id), isOpen);
- }
-
- public void setModuleOpen(int index, boolean isOpen) {
- if (index > -1) {
- vOpeningModuleList.elementAt(index).setOpen(isOpen);
- }
- }
-
- public boolean getModuleOpen(ModuleIdentification id) {
- return getModuleOpen(findIndexOfListById(id));
- }
-
- public boolean getModuleOpen(int index) {
- if (index > -1) {
- return vOpeningModuleList.elementAt(index).isOpen();
- }
- return false;
- }
-
- public void setTreePathById(ModuleIdentification id, Set<TreePath> treePath) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- vOpeningModuleList.elementAt(index).setTreePath(treePath);
- }
- }
-
- public Set<TreePath> getTreePathById(ModuleIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningModuleList.elementAt(index).getTreePath();
- }
- return null;
- }
-
- public Set<TreePath> getTreePathByIndex(int index) {
- if (index > -1) {
- return vOpeningModuleList.elementAt(index).getTreePath();
- }
- return null;
- }
-
- public ModuleIdentification getIdByPath(String path) {
- ModuleIdentification id = new ModuleIdentification(null, null, null, path);
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningModuleList.elementAt(index).getId();
- }
- return null;
- }
-
- public ModuleIdentification getIdByGuidVersion(String guid, String version) {
- for (int index = 0; index < vOpeningModuleList.size(); index++) {
- ModuleIdentification id = vOpeningModuleList.elementAt(index).getId();
- if (version != null) {
- if (id.getGuid().equals(guid) && id.getVersion().equals(version)) {
- return id;
- }
- } else {
- if (id.getGuid().equals(guid)) {
- return id;
- }
- }
- }
- return null;
- }
-
- public void setNew(ModuleIdentification id, boolean isNew) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- vOpeningModuleList.elementAt(index).setNew(isNew);
- }
- }
-
- public void closeAll() {
- for (int index = 0; index < this.size(); index++) {
- this.setModuleOpen(index, false);
- this.setModuleSaved(index, true);
- }
- }
-
- public int size() {
- return vOpeningModuleList.size();
- }
-
- public boolean isSaved() {
- for (int index = 0; index < this.size(); index++) {
- if (!this.getModuleSaved(index)) {
- return false;
- }
- }
- return true;
- }
-
- public boolean isOpen() {
- for (int index = 0; index < this.size(); index++) {
- if (this.getModuleOpen(index)) {
- return true;
- }
- }
- return false;
- }
-
- public void reload(int index) {
- if (index > -1) {
- vOpeningModuleList.elementAt(index).reload();
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleType.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleType.java deleted file mode 100644 index 3ff29a94d3..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleType.java +++ /dev/null @@ -1,75 +0,0 @@ -/** @file
-
- The file is used to define opening module type
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.common.Identifications;
-
-import java.io.IOException;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.OpenFile;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-
-public class OpeningModuleType extends OpeningFileType{
- //
- // Define class members
- //
- private ModuleSurfaceAreaDocument.ModuleSurfaceArea xmlMsa = null;
-
- private ModuleIdentification id = null;
-
- public OpeningModuleType() {
-
- }
-
- public OpeningModuleType(ModuleIdentification identification, ModuleSurfaceAreaDocument.ModuleSurfaceArea msa) {
- this.id = identification;
- this.xmlMsa = msa;
- }
-
- public ModuleSurfaceAreaDocument.ModuleSurfaceArea getXmlMsa() {
- return xmlMsa;
- }
-
- public void setXmlMsa(ModuleSurfaceAreaDocument.ModuleSurfaceArea xmlMsa) {
- this.xmlMsa = xmlMsa;
- }
-
- public ModuleIdentification getId() {
- return id;
- }
-
- public void setId(ModuleIdentification id) {
- this.id = id;
- }
-
- public void reload() {
- if (this.id != null) {
- String path = id.getPath();
- if (path.length() > 0) {
- try {
- this.xmlMsa = OpenFile.openMsaFile(id.getPath());
- } catch (IOException e) {
- Log.err("Open Module Surface Area " + path, e.getMessage());
- } catch (XmlException e) {
- Log.err("Open Module Surface Area " + path, e.getMessage());
- } catch (Exception e) {
- Log.err("Open Module Surface Area " + path, "Invalid file type");
- }
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageList.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageList.java deleted file mode 100644 index 0db75176ba..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageList.java +++ /dev/null @@ -1,231 +0,0 @@ -/** @file
-
- The file is used to define opening package list
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.Identifications;
-
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.tree.TreePath;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class OpeningPackageList {
- private Vector<OpeningPackageType> vOpeningPackageList = new Vector<OpeningPackageType>();
-
- public OpeningPackageList() {
-
- }
-
- public Vector<OpeningPackageType> getVOpeningPackageList() {
- return vOpeningPackageList;
- }
-
- public void setVOpeningPackageList(Vector<OpeningPackageType> openingPackageList) {
- vOpeningPackageList = openingPackageList;
- }
-
- public void insertToOpeningPackageList(PackageIdentification id, PackageSurfaceAreaDocument.PackageSurfaceArea xmlMsa) {
- vOpeningPackageList.addElement(new OpeningPackageType(id, xmlMsa));
- }
-
- public OpeningPackageType getOpeningPackageByIndex(int index) {
- if (index > -1 && index < vOpeningPackageList.size()) {
- return vOpeningPackageList.elementAt(index);
- }
- return null;
- }
-
- public OpeningPackageType getOpeningPackageById(PackageIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningPackageList.elementAt(index);
- }
- return null;
- }
-
- public int findIndexOfListById(PackageIdentification id) {
- for (int index = 0; index < vOpeningPackageList.size(); index++) {
- if (vOpeningPackageList.elementAt(index).getId().equals(id)) {
- return index;
- }
- }
- return -1;
- }
-
- public void removeFromOpeningPackageListByIndex(int index) {
- if (index > -1 && index < vOpeningPackageList.size()) {
- vOpeningPackageList.removeElementAt(index);
- }
- }
-
- public void removeFromOpeningPackageListById(PackageIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- vOpeningPackageList.removeElementAt(findIndexOfListById(id));
- }
- }
-
- public void removeAllFromOpeningPackageList() {
- vOpeningPackageList.removeAllElements();
- }
-
- public PackageSurfaceAreaDocument.PackageSurfaceArea getPackageSurfaceAreaFromId(PackageIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningPackageList.elementAt(index).getXmlSpd();
- }
- return null;
- }
-
- public boolean existsPackage(PackageIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return true;
- }
- return false;
- }
-
- public void setPackageSaved(PackageIdentification id, boolean isSaved) {
- setPackageSaved(findIndexOfListById(id), isSaved);
- }
-
- public void setPackageSaved(int index, boolean isSaved) {
- if (index > -1) {
- vOpeningPackageList.elementAt(index).setSaved(isSaved);
- }
- }
-
- public boolean getPackageSaved(PackageIdentification id) {
- return getPackageSaved(findIndexOfListById(id));
- }
-
- public boolean getPackageSaved(int index) {
- if (index > -1) {
- return vOpeningPackageList.elementAt(index).isSaved();
- }
- return true;
- }
-
- public void setPackageOpen(PackageIdentification id, boolean isOpem) {
- setPackageOpen(findIndexOfListById(id), isOpem);
- }
-
- public void setPackageOpen(int index, boolean isOpem) {
- if (index > -1) {
- vOpeningPackageList.elementAt(index).setOpen(isOpem);
- }
- }
-
- public boolean getPackageOpen(PackageIdentification id) {
- return getPackageOpen(findIndexOfListById(id));
- }
-
- public boolean getPackageOpen(int index) {
- if (index > -1) {
- return vOpeningPackageList.elementAt(index).isOpen();
- }
- return false;
- }
-
- public void setTreePathById(PackageIdentification id, Set<TreePath> treePath) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- vOpeningPackageList.elementAt(index).setTreePath(treePath);
- }
- }
-
- public Set<TreePath> getTreePathById(PackageIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningPackageList.elementAt(index).getTreePath();
- }
- return null;
- }
-
- public Set<TreePath> getTreePathByIndex(int index) {
- if (index > -1) {
- return vOpeningPackageList.elementAt(index).getTreePath();
- }
- return null;
- }
-
- public PackageIdentification getIdByPath(String path) {
- PackageIdentification id = new PackageIdentification(null, null, null, path);
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningPackageList.elementAt(index).getId();
- }
- return null;
- }
-
- public PackageIdentification getIdByGuidVersion(String guid, String version) {
- for (int index = 0; index < vOpeningPackageList.size(); index++) {
- PackageIdentification id = vOpeningPackageList.elementAt(index).getId();
- if (version != null) {
- if (id.getGuid().equals(guid) && id.getVersion().equals(version)) {
- return id;
- }
- } else {
- if (id.getGuid().equals(guid)) {
- return id;
- }
- }
- }
- return null;
- }
-
- public void setNew(PackageIdentification id, boolean isNew) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- vOpeningPackageList.elementAt(index).setNew(isNew);
- }
- }
-
- public void closeAll() {
- for (int index = 0; index < this.size(); index++) {
- this.setPackageOpen(index, false);
- this.setPackageSaved(index, true);
- }
- }
-
- public int size() {
- return vOpeningPackageList.size();
- }
-
- public boolean isSaved() {
- for (int index = 0; index < this.size(); index++) {
- if (!this.getPackageSaved(index)) {
- return false;
- }
- }
- return true;
- }
-
- public boolean isOpen() {
- for (int index = 0; index < this.size(); index++) {
- if (this.getPackageOpen(index)) {
- return true;
- }
- }
- return false;
- }
-
- public void reload(int index) {
- if (index > -1) {
- vOpeningPackageList.elementAt(index).reload();
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageType.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageType.java deleted file mode 100644 index 22f3ce311d..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageType.java +++ /dev/null @@ -1,74 +0,0 @@ -/** @file
-
- The file is used to define opening package type
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.Identifications;
-
-import java.io.IOException;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.OpenFile;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class OpeningPackageType extends OpeningFileType {
- //
- // Define class members
- //
- private PackageSurfaceAreaDocument.PackageSurfaceArea xmlSpd = null;
-
- private PackageIdentification id = null;
-
- public OpeningPackageType() {
-
- }
-
- public OpeningPackageType(PackageIdentification identification, PackageSurfaceAreaDocument.PackageSurfaceArea spd) {
- this.id = identification;
- this.xmlSpd = spd;
- }
-
- public PackageSurfaceAreaDocument.PackageSurfaceArea getXmlSpd() {
- return xmlSpd;
- }
-
- public void setXmlSpd(PackageSurfaceAreaDocument.PackageSurfaceArea xmlSpd) {
- this.xmlSpd = xmlSpd;
- }
-
- public PackageIdentification getId() {
- return id;
- }
-
- public void setId(PackageIdentification id) {
- this.id = id;
- }
-
- public void reload() {
- if (this.id != null) {
- String path = id.getPath();
- if (path.length() > 0) {
- try {
- this.xmlSpd = OpenFile.openSpdFile(id.getPath());
- } catch (IOException e) {
- Log.err("Open Package Surface Area " + path, e.getMessage());
- } catch (XmlException e) {
- Log.err("Open Package Surface Area " + path, e.getMessage());
- } catch (Exception e) {
- Log.err("Open Package Surface Area " + path, "Invalid file type");
- }
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPlatformList.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPlatformList.java deleted file mode 100644 index a2ce431c0b..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPlatformList.java +++ /dev/null @@ -1,217 +0,0 @@ -/** @file
-
- The file is used to define opening package list
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.Identifications;
-
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.tree.TreePath;
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-public class OpeningPlatformList {
-
- private Vector<OpeningPlatformType> vOpeningPlatformList = new Vector<OpeningPlatformType>();
-
- public OpeningPlatformList() {
-
- }
-
- public Vector<OpeningPlatformType> getVOpeningPlatformList() {
- return vOpeningPlatformList;
- }
-
- public void setVOpeningPlatformList(Vector<OpeningPlatformType> openingPlatformList) {
- vOpeningPlatformList = openingPlatformList;
- }
-
- public void insertToOpeningPlatformList(PlatformIdentification id, PlatformSurfaceAreaDocument.PlatformSurfaceArea xmlFpd) {
- vOpeningPlatformList.addElement(new OpeningPlatformType(id, xmlFpd));
- }
-
- public OpeningPlatformType getOpeningPlatformByIndex(int index) {
- if (index > -1 && index < vOpeningPlatformList.size()) {
- return vOpeningPlatformList.elementAt(index);
- }
- return null;
- }
-
- public OpeningPlatformType getOpeningPlatformById(PlatformIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningPlatformList.elementAt(index);
- }
- return null;
- }
-
- public int findIndexOfListById(PlatformIdentification id) {
- for (int index = 0; index < vOpeningPlatformList.size(); index++) {
- if (vOpeningPlatformList.elementAt(index).getId().equals(id)) {
- return index;
- }
- }
- return -1;
- }
-
- public void removeFromOpeningPlatformListByIndex(int index) {
- if (index > -1 && index < vOpeningPlatformList.size()) {
- vOpeningPlatformList.removeElementAt(index);
- }
- }
-
- public void removeFromOpeningPlatformListById(PlatformIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- vOpeningPlatformList.removeElementAt(findIndexOfListById(id));
- }
- }
-
- public void removeAllFromOpeningPlatformList() {
- vOpeningPlatformList.removeAllElements();
- }
-
- public PlatformSurfaceAreaDocument.PlatformSurfaceArea getPlatformSurfaceAreaFromId(PlatformIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningPlatformList.elementAt(index).getXmlFpd();
- }
- return null;
- }
-
- public boolean existsPlatform(PlatformIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return true;
- }
- return false;
- }
-
-
- public void setPlatformSaved(PlatformIdentification id, boolean isSaved) {
- setPlatformSaved(findIndexOfListById(id), isSaved);
- }
-
- public void setPlatformSaved(int index, boolean isSaved) {
- if (index > -1) {
- vOpeningPlatformList.elementAt(index).setSaved(isSaved);
- }
- }
-
- public boolean getPlatformSaved(PlatformIdentification id) {
- return getPlatformSaved(findIndexOfListById(id));
- }
-
- public boolean getPlatformSaved(int index) {
- if (index > -1) {
- return vOpeningPlatformList.elementAt(index).isSaved();
- }
- return true;
- }
-
- public void setPlatformOpen(PlatformIdentification id, boolean isOpen) {
- setPlatformOpen(findIndexOfListById(id), isOpen);
- }
-
- public void setPlatformOpen(int index, boolean isOpen) {
- if (index > -1) {
- vOpeningPlatformList.elementAt(index).setOpen(isOpen);
- }
- }
-
- public boolean getPlatformOpen(PlatformIdentification id) {
- return getPlatformOpen(findIndexOfListById(id));
- }
-
- public boolean getPlatformOpen(int index) {
- if (index > -1) {
- return vOpeningPlatformList.elementAt(index).isOpen();
- }
- return false;
- }
-
- public void setTreePathById(PlatformIdentification id, Set<TreePath> treePath) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- vOpeningPlatformList.elementAt(index).setTreePath(treePath);
- }
- }
-
- public Set<TreePath> getTreePathById(PlatformIdentification id) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningPlatformList.elementAt(index).getTreePath();
- }
- return null;
- }
-
- public Set<TreePath> getTreePathByIndex(int index) {
- if (index > -1) {
- return vOpeningPlatformList.elementAt(index).getTreePath();
- }
- return null;
- }
-
- public PlatformIdentification getIdByPath(String path) {
- PlatformIdentification id = new PlatformIdentification(null, null, null, path);
- int index = findIndexOfListById(id);
- if (index > -1) {
- return vOpeningPlatformList.elementAt(index).getId();
- }
- return null;
- }
-
- public void setNew(PlatformIdentification id, boolean isNew) {
- int index = findIndexOfListById(id);
- if (index > -1) {
- vOpeningPlatformList.elementAt(index).setNew(isNew);
- }
- }
-
- public void closeAll() {
- for (int index = 0; index < this.size(); index++) {
- this.setPlatformOpen(index, false);
- this.setPlatformSaved(index, true);
- }
- }
-
- public int size() {
- return vOpeningPlatformList.size();
- }
-
- public boolean isSaved() {
- for (int index = 0; index < this.size(); index++) {
- if (!this.getPlatformSaved(index)) {
- return false;
- }
- }
- return true;
- }
-
- public boolean isOpen() {
- for (int index = 0; index < this.size(); index++) {
- if (this.getPlatformOpen(index)) {
- return true;
- }
- }
- return false;
- }
-
- public void reload(int index) {
- if (index > -1) {
- vOpeningPlatformList.elementAt(index).reload();
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPlatformType.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPlatformType.java deleted file mode 100644 index 7a822c91c8..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/OpeningPlatformType.java +++ /dev/null @@ -1,74 +0,0 @@ -/** @file
-
- The file is used to define opening platform type
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.Identifications;
-
-import java.io.IOException;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.OpenFile;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-public class OpeningPlatformType extends OpeningFileType {
- //
- // Define class members
- //
- private PlatformSurfaceAreaDocument.PlatformSurfaceArea xmlFpd = null;
-
- private PlatformIdentification id = null;
-
- public OpeningPlatformType() {
-
- }
-
- public OpeningPlatformType(PlatformIdentification identification, PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
- this.id = identification;
- this.xmlFpd = fpd;
- }
-
- public PlatformSurfaceAreaDocument.PlatformSurfaceArea getXmlFpd() {
- return xmlFpd;
- }
-
- public void setXmlFpd(PlatformSurfaceAreaDocument.PlatformSurfaceArea xmlFpd) {
- this.xmlFpd = xmlFpd;
- }
-
- public PlatformIdentification getId() {
- return id;
- }
-
- public void setId(PlatformIdentification id) {
- this.id = id;
- }
-
- public void reload() {
- if (this.id != null) {
- String path = id.getPath();
- if (path.length() > 0) {
- try {
- this.xmlFpd = OpenFile.openFpdFile(id.getPath());
- } catch (IOException e) {
- Log.err("Open Platform Surface Area " + path, e.getMessage());
- } catch (XmlException e) {
- Log.err("Open Platform Surface Area " + path, e.getMessage());
- } catch (Exception e) {
- Log.err("Open Platform Surface Area " + path, "Invalid file type");
- }
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigId.java deleted file mode 100644 index f446693004..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigId.java +++ /dev/null @@ -1,55 +0,0 @@ -/** @file
-
- The file is used to define Tool Chain Configuration Identification
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.Identifications;
-
-public class ToolChainConfigId {
-
- public static final String COMMENTS = "#";
-
- public static final String EQUALS = "=";
-
- private String name = "";
-
- private String value = "";
-
- public ToolChainConfigId(String strName, String strValue) {
- this.name = strName;
- this.value = strValue;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public boolean equals(ToolChainConfigId id) {
- if (this.name.equals(id.name)) {
- return true;
- } else {
- return false;
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigVector.java deleted file mode 100644 index 49aac3d074..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigVector.java +++ /dev/null @@ -1,155 +0,0 @@ -/** @file
-
- The file is used to define Tool Chain Configuration Vector
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.Identifications;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Vector;
-
-public class ToolChainConfigVector {
-
- private Vector<ToolChainConfigId> vToolChainConfigs = new Vector<ToolChainConfigId>();
-
- public int findToolChainConfigs(ToolChainConfigId sfi) {
- for (int index = 0; index < vToolChainConfigs.size(); index++) {
- if (vToolChainConfigs.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findToolChainConfigs(String name) {
- for (int index = 0; index < vToolChainConfigs.size(); index++) {
- if (vToolChainConfigs.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public ToolChainConfigId getToolChainConfigs(int index) {
- if (index > -1) {
- return vToolChainConfigs.elementAt(index);
- } else {
- return null;
- }
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getToolChainConfigs(index).getName());
- v.addElement(getToolChainConfigs(index).getValue());
- return v;
- }
-
- public void addToolChainConfigs(ToolChainConfigId arg0) {
- vToolChainConfigs.addElement(arg0);
- }
-
- public void updateToolChainConfigs(ToolChainConfigId arg0, int arg1) {
- vToolChainConfigs.setElementAt(arg0, arg1);
- }
-
- public void removeToolChainConfigs(ToolChainConfigId arg0) {
- int index = findToolChainConfigs(arg0);
- if (index > -1) {
- vToolChainConfigs.removeElementAt(index);
- }
- }
-
- public void removeToolChainConfigs(int index) {
- if (index > -1 && index < this.size()) {
- vToolChainConfigs.removeElementAt(index);
- }
- }
-
- public void removeAll() {
- vToolChainConfigs = new Vector<ToolChainConfigId>();
- }
-
- public Vector<String> getToolChainConfigsName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vToolChainConfigs.size(); index++) {
- v.addElement(vToolChainConfigs.get(index).getName());
- }
- return v;
- }
-
- public Vector<String> getToolChainConfigsValue() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vToolChainConfigs.size(); index++) {
- v.addElement(vToolChainConfigs.get(index).getValue());
- }
- return v;
- }
-
- public int size() {
- return this.vToolChainConfigs.size();
- }
-
- public void saveFile(String file) throws IOException {
- if (size() > 0) {
- FileWriter fw = new FileWriter(file);
- BufferedWriter bw = new BufferedWriter(fw);
- for (int index = 0; index < size(); index++) {
- String line = this.getToolChainConfigs(index).getName() + " " + ToolChainConfigId.EQUALS + " "
- + this.getToolChainConfigs(index).getValue();
- bw.write(line);
- bw.newLine();
- }
- bw.flush();
- bw.close();
- fw.close();
- }
- }
-
- /**
-
- @param file
- @throws IOException
- @throws FileNotFoundException
-
- **/
- public void parseFile(String file) throws IOException {
- FileReader fr = new FileReader(file);
- BufferedReader br = new BufferedReader(fr);
- String line = br.readLine();
- while (line != null) {
- parseLine(line);
- line = br.readLine();
- }
- }
-
- /**
- Parse the input string and add name, value to vector
-
- @param line
-
- **/
- private void parseLine(String line) {
- String name = "";
- String value = "";
- if (line.indexOf(ToolChainConfigId.COMMENTS) != 0 && line.indexOf(ToolChainConfigId.EQUALS) > -1) {
- name = line.substring(0, line.indexOf(ToolChainConfigId.EQUALS)).trim();
- value = line.substring(line.indexOf(ToolChainConfigId.EQUALS) + 1).trim();
- this.addToolChainConfigs(new ToolChainConfigId(name, value));
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Log.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Log.java deleted file mode 100644 index 49a7a3615b..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Log.java +++ /dev/null @@ -1,301 +0,0 @@ -/** @file
-
- The file is used to provides static interfaces to save log and error information
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.common;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import javax.swing.JOptionPane;
-
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-/**
- The class is used to provides static interfaces to save log and error information
-
- **/
-public class Log {
- //
- //Log file directory path
- //
- private static String strLogDir = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + "Tools"
- + DataType.FILE_SEPARATOR + "Logs";
-
- //
- //Log file
- //
- private static File fleLogFile = null;
-
- //
- //Wrn file
- //
- private static File fleWrnFile = null;
-
- //
- //Err file
- //
- private static File fleErrFile = null;
-
- //
- //Log file name
- //
- private static String strLogFileName = strLogDir + DataType.FILE_SEPARATOR + "frameworkwizard.log";
-
- //
- //Wrn file name
- //
- private static String strWrnFileName = strLogDir + DataType.FILE_SEPARATOR + "frameworkwizard.wrn";
-
- //
- //Err file name
- //
- private static String strErrFileName = strLogDir + DataType.FILE_SEPARATOR + "frameworkwizard.err";
-
- //
- //Flag for create log or not
- //
- private static boolean isSaveLog = false;
-
- /**
- Main class, used for test
-
- @param args
-
- **/
- public static void main(String[] args) {
- try {
- //Log.log("Test", "test");
- //Log.err("Test1", "test1");
- Log
- .wrn("aaa bbbbbb cccccccccccc ddddddddddd eeeeeeeeee fffffffffff gggggggggggggggggg hhhhhhhhhhhhhhhhhhhhhhhhhhhhh iiiii jjjj kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk lll mmm nn poooooooooooooooooooooooooooooooooooooooooooop");
- Log.wrn("Incorrect data type for ModuleEntryPoint");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- Call writeToLogFile to save log item and log information to log file
-
- @param strItem The log item
- @param strLog The log information
-
- **/
- public static void log(String strItem, String strLog) {
- try {
- writeToLogFile(strItem + ":" + strLog);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- Call writeToLogFile to save log information to log file
-
- @param strLog The log information
-
- **/
- public static void log(String strLog) {
- try {
- writeToLogFile(strLog);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- Call writeToWrnFile to save wrn item and wrn information to wrn file
-
- @param strItem The wrn item
- @param strLog The wrn information
-
- **/
- public static void wrn(String strItem, String strWrn) {
- try {
- writeToWrnFile("Warning when " + strItem + "::" + strWrn);
- showWrnMessage(strWrn);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- Call writeToWrnFile to save wrn information to wrn file
-
- @param strLog The wrn information
-
- **/
- public static void wrn(String strWrn) {
- try {
- writeToWrnFile("Warning::" + strWrn);
- showWrnMessage("Warning::" + strWrn);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- Call writeToErrFile to save err item and err information to err file
-
- @param strItem The err item
- @param strLog The err information
-
- **/
- public static void err(String strItem, String strErr) {
- try {
- writeToErrFile("Error when " + strItem + "::" + strErr);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- Call writeToErrFile to save err information to err file
-
- @param strLog The err information
-
- **/
- public static void err(String strErr) {
- try {
- writeToErrFile("Error::" + strErr);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- Brings up a dialog to show err message
- When the message's length > defined max length, wrap the text to the next line.
-
- @param strErr The input data of err message
-
- **/
- private static void showWrnMessage(String strErr) {
- String strReturn = Tools.wrapStringByWord(strErr);
- JOptionPane.showConfirmDialog(FrameworkWizardUI.getInstance(), strReturn, "Warning",
- JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
- }
-
- /**
- Open log file and write log information
-
- @param strLog The log information
- @throws IOException
-
- **/
- private static void writeToLogFile(String strLog) throws Exception {
- if (isSaveLog) {
- try {
- createLogDir();
- if (fleLogFile == null) {
- fleLogFile = new File(strLogFileName);
- fleLogFile.delete();
- fleLogFile.createNewFile();
- }
- FileOutputStream fos = new FileOutputStream(fleLogFile, true);
- fos.write((Tools.getCurrentDateTime() + DataType.DOS_LINE_SEPARATOR).getBytes());
- fos.write((strLog + DataType.DOS_LINE_SEPARATOR).getBytes());
- fos.flush();
- fos.close();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- /**
- Open wrn file and write wrn information
-
- @param strLog The log information
- * @throws Exception
-
- **/
- private static void writeToWrnFile(String strLog) throws Exception {
- if (isSaveLog) {
- try {
- createLogDir();
- if (fleWrnFile == null) {
- fleWrnFile = new File(strWrnFileName);
- fleWrnFile.delete();
- fleWrnFile.createNewFile();
- }
- FileOutputStream fos = new FileOutputStream(fleWrnFile, true);
- fos.write((Tools.getCurrentDateTime() + DataType.DOS_LINE_SEPARATOR).getBytes());
- fos.write((strLog + DataType.DOS_LINE_SEPARATOR).getBytes());
- fos.flush();
- fos.close();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- /**
- Open err file and write err information
-
- @param strLog The log information
- @throws IOException
-
- **/
- private static void writeToErrFile(String strLog) throws Exception {
- if (isSaveLog) {
- try {
- createLogDir();
- if (fleErrFile == null) {
- fleErrFile = new File(strErrFileName);
- fleErrFile.delete();
- fleErrFile.createNewFile();
- }
- FileOutputStream fos = new FileOutputStream(fleErrFile, true);
- fos.write((Tools.getCurrentDateTime() + DataType.DOS_LINE_SEPARATOR).getBytes());
- fos.write((strLog + DataType.DOS_LINE_SEPARATOR).getBytes());
- fos.flush();
- fos.close();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- /**
- Check if directory for Logs exists or not
- Create the directory if it doesn't exist
- * @throws Exception
-
- **/
- private static void createLogDir() throws Exception {
- File f = new File(strLogDir);
- if (!f.exists()) {
- FileOperation.newFolder(strLogDir);
- }
- }
-
- public static boolean isSaveLog() {
- return isSaveLog;
- }
-
- public static void setSaveLog(boolean isSaveLog) {
- Log.isSaveLog = isSaveLog;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/OpenFile.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/OpenFile.java deleted file mode 100644 index 32eec68258..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/OpenFile.java +++ /dev/null @@ -1,95 +0,0 @@ -/** @file
-
- The file provides interface to open xml file.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
-import org.tianocore.FrameworkDatabaseDocument;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.FrameworkDatabaseDocument.FrameworkDatabase;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
-
-public class OpenFile {
- /**
-
- @param args
-
- **/
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- Open specificed Msa file and read its content
-
- @param strMsaFilePath The input data of Msa File Path
-
- **/
- public static ModuleSurfaceArea openMsaFile(String strMsaFilePath) throws IOException, XmlException, Exception {
- Log.log("Open Msa", strMsaFilePath);
- File msaFile = new File(strMsaFilePath);
- ModuleSurfaceAreaDocument xmlMsaDoc = (ModuleSurfaceAreaDocument) XmlObject.Factory.parse(msaFile);
- return xmlMsaDoc.getModuleSurfaceArea();
- }
-
- /**
- Open specificed Spd file and read its content
-
- @param strSpdFilePath The input data of Spd File Path
-
- **/
- public static PackageSurfaceArea openSpdFile(String strSpdFilePath) throws IOException, XmlException, Exception {
- Log.log("Open Spd", strSpdFilePath);
- File spdFile = new File(strSpdFilePath);
- PackageSurfaceAreaDocument xmlSpdDoc = (PackageSurfaceAreaDocument) XmlObject.Factory.parse(spdFile);
- return xmlSpdDoc.getPackageSurfaceArea();
- }
-
- /**
- Open specificed Fpd file and read its content
-
- @param strFpdFilePath The input data of Fpd File Path
-
- **/
- public static PlatformSurfaceArea openFpdFile(String strFpdFilePath) throws IOException, XmlException,
- Exception {
- Log.log("Open Fpd", strFpdFilePath);
- File fpdFile = new File(strFpdFilePath);
- PlatformSurfaceAreaDocument xmlFpdDoc = null;
- xmlFpdDoc = (PlatformSurfaceAreaDocument) XmlObject.Factory.parse(fpdFile);
- return xmlFpdDoc.getPlatformSurfaceArea();
- }
-
- /**
-
- Open specificed Framework Database file and read its content
-
- */
- public static FrameworkDatabase openFrameworkDb(String strDbFilePath) throws IOException, XmlException, Exception {
- Log.log("Open Framework Database", strDbFilePath);
- File db = new File(strDbFilePath);
- FrameworkDatabaseDocument xmlDb = null;
- xmlDb = (FrameworkDatabaseDocument) XmlObject.Factory.parse(db);
- return xmlDb.getFrameworkDatabase();
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/SaveFile.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/SaveFile.java deleted file mode 100644 index 13e6786ca7..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/SaveFile.java +++ /dev/null @@ -1,334 +0,0 @@ -/** @file
-
- The file provides interface to save xml file.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common;
-
-import java.io.File;
-
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
-import org.tianocore.FrameworkDatabaseDocument;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.FrameworkDatabaseDocument.FrameworkDatabase;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
-
-public class SaveFile {
-
- /**
-
- @param args
-
- **/
- public static void main(String[] args) {
-
- }
-
- private static void createDirectory(String path) throws Exception {
- File f = new File(path);
- path = f.getParent();
- FileOperation.newFolder(path);
- }
-
- /**
- Save file as msa
-
- **/
- public static void saveMsaFile(String path, ModuleSurfaceArea msa) throws Exception {
- //
- // Create the file's directory first
- //
- createDirectory(path);
-
- //
- // Remove all empty top level elements
- //
- XmlObject o = msa.getLibraryClassDefinitions();
- if (o != null) {
- if (msa.getLibraryClassDefinitions().getLibraryClassList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getSourceFiles();
- if (o != null) {
- if (msa.getSourceFiles().getFilenameList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getPackageDependencies();
- if (o != null) {
- if (msa.getPackageDependencies().getPackageList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getProtocols();
- if (o != null) {
- if (msa.getProtocols().getProtocolList().size() <= 0
- && msa.getProtocols().getProtocolNotifyList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getEvents();
- if (o != null) {
- if (msa.getEvents().getCreateEvents() != null || msa.getEvents().getSignalEvents() != null) {
- if (msa.getEvents().getCreateEvents() != null && msa.getEvents().getCreateEvents().getEventTypesList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- if (msa.getEvents().getSignalEvents() != null && msa.getEvents().getSignalEvents().getEventTypesList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- } else {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getHobs();
- if (o != null) {
- if (msa.getHobs().getHobTypesList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getPPIs();
- if (o != null) {
- if (msa.getPPIs().getPpiList().size() <= 0 && msa.getPPIs().getPpiNotifyList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getVariables();
- if (o != null) {
- if (msa.getVariables().getVariableList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getBootModes();
- if (o != null) {
- if (msa.getBootModes().getBootModeList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getSystemTables();
- if (o != null) {
- if (msa.getSystemTables().getSystemTableCNamesList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getDataHubs();
- if (o != null) {
- if (msa.getDataHubs().getDataHubRecordList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getHiiPackages();
- if (o != null) {
- if (msa.getHiiPackages().getHiiPackageList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getGuids();
- if (o != null) {
- if (msa.getGuids().getGuidCNamesList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getExterns();
- if (o != null) {
- if (msa.getExterns().getExternList().size() <= 0 && msa.getExterns().getSpecificationList().size() <= 0
- && msa.getExterns().getPcdIsDriver() == null) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- o = msa.getPcdCoded();
- if (o != null) {
- if (msa.getPcdCoded().getPcdEntryList().size() <= 0) {
- XmlCursor xmlCursor = o.newCursor();
- xmlCursor.removeXml();
- xmlCursor.dispose();
- }
- }
-
- ModuleSurfaceAreaDocument msaDoc = ModuleSurfaceAreaDocument.Factory.newInstance();
- File f = new File(path);
-
- //
- //Init namespace
- //
- XmlCursor cursor = XmlConfig.setupXmlCursor(msa.newCursor());
-
- //
- //Config file format
- //
- XmlOptions options = XmlConfig.setupXmlOptions();
-
- //
- //Create finial doc
- //
- msaDoc.addNewModuleSurfaceArea();
- msaDoc.setModuleSurfaceArea((ModuleSurfaceArea) cursor.getObject());
- //
- //Save the file
- //
- msaDoc.save(f, options);
- cursor.dispose();
- }
-
- /**
- Save file as spd
-
- **/
- public static void saveSpdFile(String path, PackageSurfaceArea spd) throws Exception {
- //
- // Create the file's directory first
- //
- createDirectory(path);
-
- PackageSurfaceAreaDocument spdDoc = PackageSurfaceAreaDocument.Factory.newInstance();
- File f = new File(path);
-
- //
- //Init namespace
- //
- XmlCursor cursor = XmlConfig.setupXmlCursor(spd.newCursor());
-
- //
- //Config file format
- //
- XmlOptions options = XmlConfig.setupXmlOptions();
-
- //
- //Create finial doc
- //
- spdDoc.addNewPackageSurfaceArea();
- spdDoc.setPackageSurfaceArea((PackageSurfaceArea) cursor.getObject());
- //
- //Save the file
- //
- spdDoc.save(f, options);
- cursor.dispose();
- }
-
- /**
- Save file as fpd
-
- **/
- public static void saveFpdFile(String path, PlatformSurfaceArea fpd) throws Exception {
- //
- // Create the file's directory first
- //
- createDirectory(path);
-
- PlatformSurfaceAreaDocument fpdDoc = PlatformSurfaceAreaDocument.Factory.newInstance();
- File f = new File(path);
-
- //
- //Init namespace
- //
- XmlCursor cursor = XmlConfig.setupXmlCursor(fpd.newCursor());
-
- //
- //Config file format
- //
- XmlOptions options = XmlConfig.setupXmlOptions();
-
- //
- //Create finial doc
- //
- fpdDoc.addNewPlatformSurfaceArea();
- fpdDoc.setPlatformSurfaceArea((PlatformSurfaceArea) cursor.getObject());
- //
- //Save the file
- //
- fpdDoc.save(f, options);
- cursor.dispose();
- }
-
- /**
- Save file as framework db
-
- **/
- public static void saveDbFile(String path, FrameworkDatabase db) throws Exception {
- FrameworkDatabaseDocument dbDoc = FrameworkDatabaseDocument.Factory.newInstance();
- File f = new File(path);
-
- //
- //Init namespace
- //
- XmlCursor cursor = XmlConfig.setupXmlCursor(db.newCursor());
-
- //
- //Config file format
- //
- XmlOptions options = XmlConfig.setupXmlOptions();
-
- //
- //Create finial doc
- //
- dbDoc.addNewFrameworkDatabase();
- dbDoc.setFrameworkDatabase((FrameworkDatabase) cursor.getObject());
-
- //
- //Save the file
- //
- dbDoc.save(f, options);
- cursor.dispose();
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Sort.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Sort.java deleted file mode 100644 index 65a345ab5b..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Sort.java +++ /dev/null @@ -1,378 +0,0 @@ -/** @file
-
- The file is used to provide all kinds of sorting method
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.common;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsVector;
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedVector;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdVector;
-import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisVector;
-import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsVector;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-public class Sort {
-
- /**
- Sort all elements in the vector as the specific sort type
-
- @param v The vector need to be sorted
- @param mode Sort type DataType.Sort_Type_Ascendin and DataType.Sort_Type_Descending
-
- **/
- public static void sortVectorString(Vector<String> v, int mode) {
- if (v != null) {
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.get(indexJ).compareTo(v.get(indexI)) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.get(indexI).compareTo(v.get(indexJ)) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- String temp = v.get(indexI);
- v.setElementAt(v.get(indexJ), indexI);
- v.setElementAt(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all elements of vector and return sorted sequence
-
- @param v The vector need to be sorted
- @param mode Sort type DataType.Sort_Type_Ascendin and DataType.Sort_Type_Descending
- @return Vector<Integer> The sorted sequence
-
- **/
- public static Vector<Integer> getVectorSortSequence(Vector<String> v, int mode) {
- Vector<Integer> vSequence = new Vector<Integer>();
- //
- // Init sequence
- //
- if (v != null) {
- for (int index = 0; index < v.size(); index++) {
- vSequence.addElement(index);
- }
- }
-
- //
- // sort and get new sequence
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.get(indexJ).compareTo(v.get(indexI)) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.get(indexI).compareTo(v.get(indexJ)) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- //
- // Swap strings
- //
- String tempStr = v.get(indexI);
- v.setElementAt(v.get(indexJ), indexI);
- v.setElementAt(tempStr, indexJ);
-
- //
- // Swap sequences
- //
- int tempInt = vSequence.get(indexI);
- vSequence.setElementAt(vSequence.get(indexJ), indexI);
- vSequence.setElementAt(tempInt, indexJ);
- }
- }
- }
-
- return vSequence;
- }
-
- /**
- Sort all elements of vector as input sequence
-
- @param v The vector need to be sorted
- @param vSequence The sort sequence should be followed
-
- **/
- public static void sortVectorString(Vector<String> v, Vector<Integer> vSequence) {
- if (v != null && vSequence != null && v.size() == vSequence.size()) {
- Vector<String> tempV = new Vector<String>();
- for (int index = 0; index < v.size(); index++) {
- tempV.addElement(v.get(index));
- }
- for (int index = 0; index < v.size(); index++) {
- v.setElementAt(tempV.get(vSequence.get(index)), index);
- }
- }
- }
-
- /**
- Sort all modules
-
- @param v
- @param mode
-
- **/
- public static void sortModules(Vector<ModuleIdentification> v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.get(indexJ).getName().compareTo(v.get(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.get(indexI).getName().compareTo(v.get(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- ModuleIdentification temp = v.get(indexI);
- v.setElementAt(v.get(indexJ), indexI);
- v.setElementAt(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all packages
-
- @param v
- @param mode
-
- **/
- public static void sortPackages(Vector<PackageIdentification> v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.get(indexJ).getName().compareTo(v.get(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.get(indexI).getName().compareTo(v.get(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- PackageIdentification temp = v.get(indexI);
- v.setElementAt(v.get(indexJ), indexI);
- v.setElementAt(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all platforms
-
- @param v
- @param mode
-
- **/
- public static void sortPlatforms(Vector<PlatformIdentification> v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.get(indexJ).getName().compareTo(v.get(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.get(indexI).getName().compareTo(v.get(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- PlatformIdentification temp = v.get(indexI);
- v.setElementAt(v.get(indexJ), indexI);
- v.setElementAt(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all pcd entries
-
- @param v
- @param mode
-
- **/
- public static void sortPcds(PcdVector v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.getPcd(indexJ).getName().compareTo(v.getPcd(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.getPcd(indexI).getName().compareTo(v.getPcd(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- PcdIdentification temp = v.getPcd(indexI);
- v.setPcd(v.getPcd(indexJ), indexI);
- v.setPcd(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all ppi entries
-
- @param v
- @param mode
-
- **/
- public static void sortPpis(PpisVector v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.getPpis(indexJ).getName().compareTo(v.getPpis(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.getPpis(indexI).getName().compareTo(v.getPpis(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- PpisIdentification temp = v.getPpis(indexI);
- v.setPpis(v.getPpis(indexJ), indexI);
- v.setPpis(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all protocol entries
-
- @param v
- @param mode
-
- **/
- public static void sortProtocols(ProtocolsVector v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.getProtocols(indexJ).getName().compareTo(v.getProtocols(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.getProtocols(indexI).getName().compareTo(v.getProtocols(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- ProtocolsIdentification temp = v.getProtocols(indexI);
- v.setProtocols(v.getProtocols(indexJ), indexI);
- v.setProtocols(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all guid entries
-
- @param v
- @param mode
-
- **/
- public static void sortGuids(GuidsVector v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.getGuids(indexJ).getName().compareTo(v.getGuids(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.getGuids(indexI).getName().compareTo(v.getGuids(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- GuidsIdentification temp = v.getGuids(indexI);
- v.setGuids(v.getGuids(indexJ), indexI);
- v.setGuids(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all pcd coded entries
-
- @param v
- @param mode
-
- **/
- public static void sortPcdCodeds(PcdCodedVector v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.getPcdCoded(indexJ).getName().compareTo(v.getPcdCoded(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.getPcdCoded(indexI).getName().compareTo(v.getPcdCoded(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- PcdCodedIdentification temp = v.getPcdCoded(indexI);
- v.setPcdCoded(v.getPcdCoded(indexJ), indexI);
- v.setPcdCoded(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all pcd coded entries
-
- @param v
- @param mode
-
- **/
- public static void sortLibraryClass(LibraryClassVector v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.getLibraryClass(indexJ).getLibraryClassName().compareTo(
- v.getLibraryClass(indexI)
- .getLibraryClassName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.getLibraryClass(indexI).getLibraryClassName().compareTo(
- v.getLibraryClass(indexJ)
- .getLibraryClassName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- LibraryClassIdentification temp = v.getLibraryClass(indexI);
- v.setLibraryClass(v.getLibraryClass(indexJ), indexI);
- v.setLibraryClass(temp, indexJ);
- }
- }
- }
- }
- }
-
- /**
- Sort all objects of a vector based on the object's "toString"
-
- @param v
- @param mode
-
- **/
- public static void sortObjectVector(Vector<Object> v, int mode) {
- if (v != null) {
- //
- // sort by name
- //
- for (int indexI = 0; indexI < v.size(); indexI++) {
- for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
- if ((v.get(indexJ).toString().compareTo(v.get(indexI).toString()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
- || (v.get(indexI).toString().compareTo(v.get(indexJ).toString()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
- Object temp = v.get(indexI);
- v.setElementAt(v.get(indexJ), indexI);
- v.setElementAt(temp, indexJ);
- }
- }
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java deleted file mode 100644 index 3eb9b85455..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java +++ /dev/null @@ -1,715 +0,0 @@ -/** @file
-
- The file is used to provides some useful interfaces
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.common;
-
-import java.awt.Component;
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-import java.util.Vector;
-
-import javax.swing.DefaultListModel;
-import javax.swing.JComboBox;
-import javax.swing.JList;
-import javax.swing.JOptionPane;
-import javax.swing.JTable;
-
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.MsaHeaderDocument.MsaHeader;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PlatformHeaderDocument.PlatformHeader;
-import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
-import org.tianocore.SpdHeaderDocument.SpdHeader;
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-/**
- The class is used to provides some useful interfaces
-
- **/
-public class Tools {
-
- //
- // The dir user selected to create new package in
- //
- public static String dirForNewSpd = null;
-
- /**
- Get current date and time and format it as "yyyy-MM-dd HH:mm"
-
- @return formatted current date and time
-
- **/
- public static String getCurrentDateTime() {
- Date now = new Date(System.currentTimeMillis());
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
- return sdf.format(now);
- }
-
- /**
- Generate a UUID
-
- @return the created UUID
-
- **/
- public static String generateUuidString() {
- return UUID.randomUUID().toString();
- }
-
- /**
- Use current file separator in the path
-
- @param strPath
- @return
-
- **/
- public static String convertPathToCurrentOsType(String strPath) {
- strPath = strPath.replace(DataType.DOS_FILE_SEPARATOR, DataType.FILE_SEPARATOR);
- strPath = strPath.replace(DataType.UNIX_FILE_SEPARATOR, DataType.FILE_SEPARATOR);
- return strPath;
- }
-
- /**
- Use Unix file separator in the path
-
- @param strPath
- @return
-
- **/
- public static String convertPathToUnixType(String strPath) {
- strPath = strPath.replace(DataType.DOS_FILE_SEPARATOR, DataType.UNIX_FILE_SEPARATOR);
- return strPath;
- }
-
- /**
- Use Dos file separator in the path
-
- @param strPath
- @return
-
- **/
- public static String convertPathToDosType(String strPath) {
- strPath = strPath.replace(DataType.UNIX_FILE_SEPARATOR, DataType.DOS_FILE_SEPARATOR);
- return strPath;
- }
-
- /**
- Get all system properties and output to the console
-
- **/
- public static void getSystemProperties() {
- System.out.println(System.getProperty("java.class.version"));
- System.out.println(System.getProperty("java.class.path"));
- System.out.println(System.getProperty("java.ext.dirs"));
- System.out.println(System.getProperty("os.name"));
- System.out.println(System.getProperty("os.arch"));
- System.out.println(System.getProperty("os.version"));
- System.out.println(System.getProperty("file.separator"));
- System.out.println(System.getProperty("path.separator"));
- System.out.println(System.getProperty("line.separator"));
- System.out.println(System.getProperty("user.name"));
- System.out.println(System.getProperty("user.home"));
- System.out.println(System.getProperty("user.dir"));
- System.out.println(System.getProperty("PATH"));
-
- System.out.println(System.getenv("PROCESSOR_REVISION"));
- }
-
- /**
- Generate selection items for JComboBox by input vector
-
- **/
- public static void generateComboBoxByVector(JComboBox jcb, Vector<String> vector) {
- if (jcb != null) {
- jcb.removeAllItems();
- }
- if (vector != null) {
- for (int index = 0; index < vector.size(); index++) {
- jcb.addItem(vector.elementAt(index));
- }
- }
- }
-
- /**
- Generate selection items for JList by input vector
-
- **/
- public static void generateListByVector(JList jl, Vector<String> vector) {
- if (jl != null) {
- DefaultListModel listModel = (DefaultListModel) jl.getModel();
- listModel.removeAllElements();
-
- if (vector != null) {
- for (int index = 0; index < vector.size(); index++) {
- listModel.addElement(vector.get(index));
- }
- }
-
- if (listModel.size() > 0) {
- jl.setSelectedIndex(0);
- }
- }
- }
-
- /**
- Get path only from a path
-
- @param filePath
- @return
-
- **/
- public static String getFilePathOnly(String filePath) {
- String path = filePath.substring(0, filePath.length() - getFileNameOnly(filePath).length());
- if (path.endsWith(DataType.FILE_SEPARATOR)) {
- path = path.substring(0, path.length() - DataType.FILE_SEPARATOR.length());
- }
-
- return path;
- }
-
- /**
- Get file name from a path
-
- @param filePath
- @return
-
- **/
- public static String getFileNameOnly(String filePath) {
- File f = new File(filePath);
- return f.getAbsoluteFile().getName();
- }
-
- public static String getFileNameWithoutExt(String filePath) {
- filePath = getFileNameOnly(filePath);
- filePath = filePath.substring(0, filePath.lastIndexOf(DataType.FILE_EXT_SEPARATOR));
- return filePath;
- }
-
- /**
- Get relative path
-
- @param wholePath
- @param commonPath
- @return wholePath - commonPath
-
- **/
- public static String getRelativePath(String wholePath, String commonPath) {
- String path = "";
- int i = 0;
- i = wholePath.indexOf(commonPath);
- if (i > -1) {
- i = i + commonPath.length();
- } else {
- return "";
- }
- path = wholePath.substring(i);
- //
- // remove file separator of head
- //
- if (path.indexOf(DataType.DOS_FILE_SEPARATOR) == 0) {
- path = path.substring(0 + DataType.DOS_FILE_SEPARATOR.length());
- }
- if (path.indexOf(DataType.UNIX_FILE_SEPARATOR) == 0) {
- path = path.substring(0 + DataType.DOS_FILE_SEPARATOR.length());
- }
- //
- // remove file separator of rear
- //
- if (path.length() > 0
- && path.indexOf(DataType.DOS_FILE_SEPARATOR) == path.length() - DataType.DOS_FILE_SEPARATOR.length()) {
- path = path.substring(0, path.length() - DataType.DOS_FILE_SEPARATOR.length());
- }
- if (path.length() > 0
- && path.indexOf(DataType.UNIX_FILE_SEPARATOR) == path.length() - DataType.UNIX_FILE_SEPARATOR.length()) {
- path = path.substring(0, path.length() - DataType.DOS_FILE_SEPARATOR.length());
- }
- //
- // convert to UNIX format
- //
- path = Tools.convertPathToUnixType(path);
- return path;
- }
-
- /**
- Convert List ot Vector
-
- @param list
- @return
-
- **/
- public static Vector<String> convertListToVector(List list) {
- Vector<String> v = new Vector<String>();
- if (list != null && list.size() > 0) {
- for (int index = 0; index < list.size(); index++) {
- v.addElement(list.get(index).toString());
- }
- }
- return v;
- }
-
- /**
- Convert a Vector to a String, separator with ", "
-
- @param v
- @return
-
- **/
- public static String convertVectorToString(Vector<String> v) {
- String s = "";
- for (int index = 0; index < v.size(); index++) {
- s = s + v.elementAt(index).toString() + ", ";
- }
- if (s.length() > 0) {
- s = s.substring(0, s.length() - ", ".length());
- }
- return s;
- }
-
- /**
- Convert a List to a String
-
- @param list
- @return
-
- **/
- public static String convertListToString(List list) {
- return Tools.convertVectorToString(Tools.convertListToVector(list));
- }
-
- /**
- If the input path missing ext, append the ext to the path
-
- @param path
- @param type
- @return
-
- **/
- public static String addPathExt(String path, int type) {
- String match = "";
- if (type == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
- match = DataType.FILE_EXT_SEPARATOR + DataType.MODULE_SURFACE_AREA_EXT;
- }
- if (type == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
- match = DataType.FILE_EXT_SEPARATOR + DataType.PACKAGE_SURFACE_AREA_EXT;
- }
- if (type == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
- match = DataType.FILE_EXT_SEPARATOR + DataType.PLATFORM_SURFACE_AREA_EXT;
- }
- if (type == DataType.RETURN_TYPE_TEXT) {
- match = DataType.FILE_EXT_SEPARATOR + DataType.TEXT_FILE_EXT;
- }
- if (type == DataType.RETURN_TYPE_FAR_SURFACE_AREA) {
- match = DataType.FILE_EXT_SEPARATOR + DataType.FAR_SURFACE_AREA_EXT;
- }
- if (path.length() <= match.length()) {
- path = path + match;
- return path;
- }
- if (!(path.substring(path.length() - match.length())).equals(match)) {
- path = path + match;
- }
- return path;
- }
-
- /**
- Show a message box
-
- @param arg0
-
- **/
- public static void showInformationMessage(String arg0) {
- JOptionPane.showConfirmDialog(FrameworkWizardUI.getInstance(), arg0, "Info", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);
- }
-
- /**
- if the string doesn't end with a file separator, append it to the string
-
- @param arg0
- @return
-
- **/
- public static String addFileSeparator(String arg0) {
- if (!arg0.endsWith(DataType.FILE_SEPARATOR)) {
- arg0 = arg0 + DataType.FILE_SEPARATOR;
- }
- return arg0;
- }
-
- /**
- Wrap single line long input string to multiple short line string by word
-
- @param arg0 input string
- @return wraped string
-
- **/
- public static String wrapStringByWord(String arg0) {
- int intMaxLength = 40;
- String strReturn = "";
- String strTemp = "";
- boolean isCopied = true;
-
- if (arg0 == null) {
- return "";
- }
- if (arg0.length() <= 0) {
- return "";
- }
-
- //
- // Convert string to array by " "
- //
- String s[] = arg0.split(" ");
- if (arg0.indexOf(" ") == -1) {
- s[0] = arg0;
- }
-
- //
- // Add each string of array one by one
- //
- for (int index = 0; index < s.length; index++) {
- String ss = s[index];
- isCopied = false;
- //
- // The word length > defined line length
- //
- if (ss.length() > intMaxLength) {
- //
- // Finish previous line
- //
- if (!isCopied) {
- strReturn = strReturn + strTemp + DataType.LINE_SEPARATOR;
- strTemp = "";
- }
- //
- // Separater to short lines
- //
- while (ss.length() > 0) {
- if (ss.length() > intMaxLength) {
- strReturn = strReturn + s[index].substring(0, intMaxLength - 1) + DataType.UNIX_LINE_SEPARATOR;
- ss = ss.substring(intMaxLength);
- isCopied = true;
- } else {
- strTemp = ss;
- ss = "";
- isCopied = false;
- }
- }
- } else {
- if ((strTemp + " " + ss).length() <= intMaxLength) {
- strTemp = strTemp + " " + ss;
- continue;
- } else {
- strReturn = strReturn + strTemp + DataType.LINE_SEPARATOR;
- if ((index == s.length - 1) && (!ss.equals(""))) {
- strReturn = strReturn + ss;
- } else {
- strTemp = ss + " ";
- }
- isCopied = true;
- }
- }
- }
-
- if (!isCopied) {
- strReturn = strReturn + strTemp;
- }
-
- return strReturn;
- }
-
- public static String convertUnicodeHexStringToString(String str) {
- //
- // Handle if str is null or empty
- //
- if (str == null) {
- return "";
- }
- if (str.equals("")) {
- return "";
- }
-
- String returnString = "";
- String[] strArray = str.split(" ");
- for (int index = 0; index < strArray.length; index++) {
- String s = strArray[index];
- if (s.length() == 6 && s.indexOf(DataType.HEX_STRING_HEADER) == 0) {
- s = s.substring(DataType.HEX_STRING_HEADER.length());
- } else {
- Log.err("convertUnicodeHexStringToString", "Incorrect input string: " + str);
- continue;
- }
- //
- // Change hex to dec
- //
- int dec = Integer.parseInt(s, 16);
-
- returnString = returnString + (char) (dec);
- }
- return returnString;
- }
-
- /**
- Convert input string to unicode hex string
-
- @param str input string
- @return unicode hex string
-
- **/
- public static String convertStringToUnicodeHexString(String str) {
- //
- // Handle if str is null or empty
- //
- if (str == null) {
- return "";
- }
- if (str.equals("")) {
- return "";
- }
-
- //
- // convert string to hex string
- //
- String hexString = "";
- for (int index = 0; index < str.length(); index++) {
- int codePoint = str.codePointAt(index);
- String s = Integer.toHexString(codePoint);
- //
- // Make the string to four length
- //
- if (s.length() == 3) {
- s = "0" + s;
- } else if (s.length() == 2) {
- s = "00" + s;
- } else if (s.length() == 1) {
- s = "000" + s;
- }
-
- //
- // Add the string to return hex string
- //
- hexString = hexString + DataType.HEX_STRING_HEADER + s + " ";
- }
-
- //
- // return hex string
- //
- return hexString.trim();
- }
-
- public static ModuleIdentification getId(String path, ModuleSurfaceArea msa) {
- MsaHeader head = msa.getMsaHeader();
- String name = head.getModuleName();
- String guid = head.getGuidValue();
- String version = head.getVersion();
- ModuleIdentification id = new ModuleIdentification(name, guid, version, path);
- return id;
- }
-
- public static PackageIdentification getId(String path, PackageSurfaceArea spd) {
- SpdHeader head = spd.getSpdHeader();
- String name = head.getPackageName();
- String guid = head.getGuidValue();
- String version = head.getVersion();
- PackageIdentification id = new PackageIdentification(name, guid, version, path);
- return id;
- }
-
- public static PlatformIdentification getId(String path, PlatformSurfaceArea fpd) {
- PlatformHeader head = fpd.getPlatformHeader();
- String name = head.getPlatformName();
- String guid = head.getGuidValue();
- String version = head.getVersion();
- PlatformIdentification id = new PlatformIdentification(name, guid, version, path);
- return id;
- }
-
- /**
- * To reset the width of input component via container width
- *
- * @param c
- * @param containerWidth
- *
- */
- public static void resizeComponentWidth(Component c, int containerWidth, int preferredWidth) {
- int newWidth = c.getPreferredSize().width + (containerWidth - preferredWidth);
- if (newWidth < c.getPreferredSize().width) {
- newWidth = c.getPreferredSize().width;
- }
- c.setSize(new java.awt.Dimension(newWidth, c.getHeight()));
- c.validate();
- }
-
- /**
- * To reset the height of input component via container height
- *
- * @param c
- * @param containerHeight
- *
- */
- public static void resizeComponentHeight(Component c, int containerHeight, int preferredHeight) {
- int newHeight = c.getPreferredSize().height + (containerHeight - preferredHeight);
- if (newHeight < c.getPreferredSize().height) {
- newHeight = c.getPreferredSize().height;
- }
- c.setSize(new java.awt.Dimension(c.getWidth(), newHeight));
- c.validate();
- }
-
- /**
- * To reset the size of input component via container size
- *
- * @param c
- * @param containerWidth
- * @param containerHeight
- *
- */
- public static void resizeComponent(Component c, int containerWidth, int containerHeight, int preferredWidth,
- int preferredHeight) {
- resizeComponentWidth(c, containerWidth, preferredWidth);
- resizeComponentHeight(c, containerHeight, preferredHeight);
- }
-
- /**
- To adjust each column's width to meet the table's size
-
- @param t the table need to be adjusted
- @param width the new width of the table
-
- **/
- public static void resizeTableColumn(JTable t, int width) {
- if (t != null) {
- int columnCount = t.getColumnCount();
- for (int index = 0; index < columnCount; index++) {
- t.getColumn(t.getColumnName(index)).setPreferredWidth(width / columnCount);
- }
- }
- }
-
- /**
- * To relocate the input component
- *
- * @param c
- * @param containerWidth
- * @param spaceToRight
- *
- */
- public static void relocateComponentX(Component c, int containerWidth, int preferredWidth, int spaceToRight) {
- int intGapToRight = spaceToRight + c.getPreferredSize().width;
- int newLocationX = containerWidth - intGapToRight;
- if (newLocationX < preferredWidth - intGapToRight) {
- newLocationX = preferredWidth - intGapToRight;
- }
- c.setLocation(newLocationX, c.getLocation().y);
- c.validate();
- }
-
- /**
- * To relocate the input component
- *
- * @param c
- * @param containerHeight
- * @param spaceToBottom
- *
- */
- public static void relocateComponentY(Component c, int containerHeight, int preferredHeight, int spaceToBottom) {
- int intGapToBottom = spaceToBottom + c.getPreferredSize().height;
- int newLocationY = containerHeight - intGapToBottom;
- if (newLocationY < preferredHeight - spaceToBottom) {
- newLocationY = preferredHeight - spaceToBottom;
- }
- c.setLocation(c.getLocation().x, newLocationY);
- c.validate();
- }
-
- /**
- * To relocate the input component
- *
- * @param c
- * @param containerWidth
- * @param containerHeight
- * @param spaceToBottom
- * @param spaceToRight
- *
- */
- public static void relocateComponent(Component c, int containerWidth, int containerHeight, int preferredWidht,
- int preferredHeight, int spaceToRight, int spaceToBottom) {
- relocateComponentX(c, containerWidth, preferredWidht, spaceToRight);
- relocateComponentY(c, containerHeight, preferredHeight, spaceToBottom);
- }
-
- /**
- Move the component to the center of screen
-
- @param c
- @param width
-
- **/
- public static void centerComponent(Component c, int width) {
- c.setLocation(width / 2 - c.getWidth() / 2, c.getLocation().y);
- c.validate();
- }
-
- /**
- Move the component to the center of screen and adjust the y location
-
- @param c
- @param width
-
- **/
- public static void centerComponent(Component c, int width, int containerHeight, int preferredHeight,
- int spaceToBottom) {
- relocateComponentY(c, containerHeight, preferredHeight, spaceToBottom);
- centerComponent(c, width);
- }
-
- /**
- Find the count of searchString in wholeString
-
- @param wholeString
- @param searchString
- @return
-
- **/
- public static int getSpecificStringCount(String wholeString, String searchString) {
- int count = 0;
- count = wholeString.split(searchString).length;
- return count;
- }
-
- /**
- * Check the input data is empty or not
- *
- * @param strValue
- * The input data which need be checked
- *
- * @retval true - The input data is empty
- * @retval fals - The input data is not empty
- *
- */
- public static boolean isEmpty(String strValue) {
- if (strValue == null) {
- return true;
- }
- if (strValue.length() > 0) {
- return false;
- }
- return true;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/XmlConfig.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/XmlConfig.java deleted file mode 100644 index db7b58d1d9..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/XmlConfig.java +++ /dev/null @@ -1,40 +0,0 @@ -/** @file
-
- The file is used to config XML file format
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.common;
-
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlOptions;
-
-public class XmlConfig {
- public static XmlCursor setupXmlCursor(XmlCursor cursor) {
- String uri = "http://www.TianoCore.org/2006/Edk2.0";
- cursor.push();
- cursor.toNextToken();
- cursor.insertNamespace("", uri);
- cursor.insertNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
- cursor.pop();
- return cursor;
- }
-
- public static XmlOptions setupXmlOptions() {
- XmlOptions options = new XmlOptions();
- options.setCharacterEncoding("UTF-8");
- options.setSavePrettyPrint();
- options.setSavePrettyPrintIndent(2);
- return options;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java deleted file mode 100644 index de67728dfc..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java +++ /dev/null @@ -1,1050 +0,0 @@ -/** @file
-
- The file is used to provide Find funtions in workspace
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-import java.util.Vector;
-
-import org.tianocore.GuidDeclarationsDocument.GuidDeclarations;
-import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass;
-import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PcdDeclarationsDocument.PcdDeclarations.PcdEntry;
-import org.tianocore.PpiDeclarationsDocument.PpiDeclarations;
-import org.tianocore.ProtocolDeclarationsDocument.ProtocolDeclarations;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.Sort;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsVector;
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedVector;
-import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisVector;
-import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsVector;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class Find {
-
- private final static String SEPERATOR = ".";
-
- /**
- Get all ppi entries from workspace
-
- @return
-
- **/
- public static PpisVector getAllPpisVector() {
- PpisVector pv = new PpisVector();
- ModuleSurfaceArea msa = null;
- ModuleIdentification mid = null;
- PpisIdentification pid = null;
-
- //
- // Go through each module one by one
- //
- if (GlobalData.openingModuleList.size() > 0) {
- for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {
- msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();
- mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();
-
- if (msa.getPPIs() != null) {
- if (msa.getPPIs().getPpiList().size() > 0) {
- for (int index = 0; index < msa.getPPIs().getPpiList().size(); index++) {
- String arg0 = msa.getPPIs().getPpiList().get(index).getPpiCName();
- String arg1 = DataType.PPI_TYPE_PPI;
- String arg2 = null;
- if (msa.getPPIs().getPpiList().get(index).getUsage() != null) {
- arg2 = msa.getPPIs().getPpiList().get(index).getUsage().toString();
- }
-
- String arg3 = msa.getPPIs().getPpiList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(msa.getPPIs().getPpiList().get(index)
- .getSupArchList());
- String arg5 = msa.getPPIs().getPpiList().get(index).getHelpText();
-
- pid = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- pid.setBelongModule(mid);
-
- //
- // Find which package declares it
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getId();
- if (spd.getPpiDeclarations() != null) {
- for (int indexOfPpis = 0; indexOfPpis < spd.getPpiDeclarations().getEntryList()
- .size(); indexOfPpis++) {
- if (spd.getPpiDeclarations().getEntryList().get(indexOfPpis).getCName()
- .equals(arg0)) {
- pid.setDeclaredBy(packageId);
- break;
- }
- }
- }
- }
- if (pid.getDeclaredBy() == null) {
- pid.setDeclaredBy(new PackageIdentification("", "", "", ""));
- }
-
- pv.addPpis(pid);
- }
- }
- if (msa.getPPIs().getPpiNotifyList().size() > 0) {
- for (int index = 0; index < msa.getPPIs().getPpiNotifyList().size(); index++) {
- String arg0 = msa.getPPIs().getPpiNotifyList().get(index).getPpiNotifyCName();
- String arg1 = DataType.PPI_TYPE_PPI_NOTIFY;
- String arg2 = null;
- if (msa.getPPIs().getPpiNotifyList().get(index).getUsage() != null) {
- arg2 = msa.getPPIs().getPpiNotifyList().get(index).getUsage().toString();
- }
-
- String arg3 = msa.getPPIs().getPpiNotifyList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(msa.getPPIs().getPpiNotifyList().get(index)
- .getSupArchList());
- String arg5 = msa.getPPIs().getPpiNotifyList().get(index).getHelpText();
-
- pid = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- pid.setBelongModule(mid);
-
- //
- // Find which package declares it
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getId();
- if (spd.getPpiDeclarations() != null) {
- for (int indexOfPpis = 0; indexOfPpis < spd.getPpiDeclarations().getEntryList()
- .size(); indexOfPpis++) {
- if (spd.getPpiDeclarations().getEntryList().get(indexOfPpis).getCName()
- .equals(arg0)) {
- pid.setDeclaredBy(packageId);
- break;
- }
- }
- }
- }
- if (pid.getDeclaredBy() == null) {
- pid.setDeclaredBy(new PackageIdentification("", "", "", ""));
- }
-
- pv.addPpis(pid);
- }
- }
- }
- }
- }
- //
- // Go through all defined ppi to find which is not added yet.
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)
- .getId();
- if (spd.getPpiDeclarations() != null) {
- for (int indexOfPpis = 0; indexOfPpis < spd.getPpiDeclarations().getEntryList().size(); indexOfPpis++) {
- boolean isFound = false;
- PpiDeclarations.Entry e = spd.getPpiDeclarations().getEntryList().get(indexOfPpis);
- for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {
- if (e.getCName().equals(pv.getPpis(indexOfPv).getName())) {
- isFound = true;
- break;
- }
- }
- if (!isFound) {
- String arg0 = e.getCName();
- String arg1 = "";
- String arg2 = "";
- String arg3 = "";
- Vector<String> arg4 = Tools.convertListToVector(e.getSupArchList());
- String arg5 = e.getHelpText();
-
- pid = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- pid.setBelongModule(null);
- pid.setDeclaredBy(packageId);
- pv.addPpis(pid);
- }
- }
- }
- }
- Sort.sortPpis(pv, DataType.SORT_TYPE_ASCENDING);
- return pv;
- }
-
- /**
- Re-org all ppi entries for find table
-
- @return
-
- **/
- public static Vector<PpiId> getAllPpisForFind() {
- Vector<PpiId> ppi = new Vector<PpiId>();
- PpisVector pv = Find.getAllPpisVector();
- boolean isAdded = false;
- boolean isProduced = false;
-
- //
- // Go through pv to add item as new format to ppi one by one
- //
- for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {
- isAdded = false;
- PpisIdentification pvId = pv.getPpis(indexOfPv);
-
- //
- // First check if produced or not
- //
- if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
- || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
- isProduced = true;
- } else if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)
- || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
- isProduced = false;
- }
-
- //
- // Get the sting "PackageName.ModuleName"
- //
- String tmp = "";
- if (pvId.getBelongModule() != null) {
- tmp = pvId.getBelongModule().getPackageId().getName() + SEPERATOR + pvId.getBelongModule().getName();
- }
-
- //
- // Check if the item has been added in
- // If added, append package name and new module name
- // If not added, add a new one first
- //
- for (int indexOfPpi = 0; indexOfPpi < ppi.size(); indexOfPpi++) {
- PpiId ppiId = ppi.get(indexOfPpi);
-
- if (pvId.getName().equals(ppiId.getName())) {
- if (isProduced) {
- ppi.get(indexOfPpi).setProducedModules(ppiId.getProducedModules() + "<br>" + tmp);
- } else if (!isProduced) {
- ppi.get(indexOfPpi).setConsumedModules(ppiId.getConsumedModules() + "<br>" + tmp);
- }
- isAdded = true;
- continue;
- }
- }
-
- //
- // Add a new one
- //
- if (!isAdded) {
- if (isProduced) {
- ppi
- .addElement(new PpiId(pvId.getName(), pvId.getType(), tmp, null, pvId.getDeclaredBy().getName()));
- } else if (!isProduced) {
- ppi
- .addElement(new PpiId(pvId.getName(), pvId.getType(), null, tmp, pvId.getDeclaredBy().getName()));
- }
- }
- }
-
- return ppi;
- }
-
- /**
- Get all protocol entries from workspace
-
- @return
-
- **/
- public static ProtocolsVector getAllProtocolsVector() {
- ProtocolsVector pv = new ProtocolsVector();
- ModuleSurfaceArea msa = null;
- ModuleIdentification mid = null;
- ProtocolsIdentification pid = null;
-
- //
- // Go through each module one by one
- //
- if (GlobalData.openingModuleList.size() > 0) {
- for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {
- msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();
- mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();
-
- if (msa.getProtocols() != null) {
- if (msa.getProtocols().getProtocolList().size() > 0) {
- for (int index = 0; index < msa.getProtocols().getProtocolList().size(); index++) {
- String arg0 = msa.getProtocols().getProtocolList().get(index).getProtocolCName();
- String arg1 = DataType.PROTOCOL_TYPE_PROTOCOL;
- String arg2 = null;
- if (msa.getProtocols().getProtocolList().get(index).getUsage() != null) {
- arg2 = msa.getProtocols().getProtocolList().get(index).getUsage().toString();
- }
-
- String arg3 = msa.getProtocols().getProtocolList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(msa.getProtocols().getProtocolList()
- .get(index).getSupArchList());
- String arg5 = msa.getProtocols().getProtocolList().get(index).getHelpText();
-
- pid = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- pid.setBelongModule(mid);
-
- //
- // Find which package declares it
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getId();
- if (spd.getProtocolDeclarations() != null) {
- for (int indexOfProtocols = 0; indexOfProtocols < spd.getProtocolDeclarations()
- .getEntryList().size(); indexOfProtocols++) {
- if (spd.getProtocolDeclarations().getEntryList().get(indexOfProtocols)
- .getCName().equals(arg0)) {
- pid.setDeclaredBy(packageId);
- break;
- }
- }
- }
- }
- if (pid.getDeclaredBy() == null) {
- pid.setDeclaredBy(new PackageIdentification("", "", "", ""));
- }
- pv.addProtocols(pid);
- }
- }
- if (msa.getProtocols().getProtocolNotifyList().size() > 0) {
- for (int index = 0; index < msa.getProtocols().getProtocolNotifyList().size(); index++) {
- String arg0 = msa.getProtocols().getProtocolNotifyList().get(index)
- .getProtocolNotifyCName();
- String arg1 = DataType.PPI_TYPE_PPI_NOTIFY;
- String arg2 = null;
- if (msa.getProtocols().getProtocolNotifyList().get(index).getUsage() != null) {
- arg2 = msa.getProtocols().getProtocolNotifyList().get(index).getUsage().toString();
- }
-
- String arg3 = msa.getProtocols().getProtocolNotifyList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(msa.getProtocols().getProtocolNotifyList()
- .get(index).getSupArchList());
- String arg5 = msa.getProtocols().getProtocolNotifyList().get(index).getHelpText();
-
- pid = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- pid.setBelongModule(mid);
-
- //
- // Find which package declares it
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getId();
- if (spd.getProtocolDeclarations() != null) {
- for (int indexOfProtocols = 0; indexOfProtocols < spd.getProtocolDeclarations()
- .getEntryList().size(); indexOfProtocols++) {
- if (spd.getProtocolDeclarations().getEntryList().get(indexOfProtocols)
- .getCName().equals(arg0)) {
- pid.setDeclaredBy(packageId);
- break;
- }
- }
- }
- }
- if (pid.getDeclaredBy() == null) {
- pid.setDeclaredBy(new PackageIdentification("", "", "", ""));
- }
-
- pv.addProtocols(pid);
- }
- }
- }
- }
- }
- //
- // Go through all defined protocols to find which is not added yet.
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)
- .getId();
- if (spd.getProtocolDeclarations() != null) {
- for (int indexOfProtocols = 0; indexOfProtocols < spd.getProtocolDeclarations().getEntryList().size(); indexOfProtocols++) {
- boolean isFound = false;
- ProtocolDeclarations.Entry e = spd.getProtocolDeclarations().getEntryList().get(indexOfProtocols);
- for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {
- if (e.getCName().equals(pv.getProtocols(indexOfPv).getName())) {
- isFound = true;
- break;
- }
- }
- if (!isFound) {
- String arg0 = e.getCName();
- String arg1 = "";
- String arg2 = "";
- String arg3 = "";
- Vector<String> arg4 = Tools.convertListToVector(e.getSupArchList());
- String arg5 = e.getHelpText();
-
- pid = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- pid.setBelongModule(null);
- pid.setDeclaredBy(packageId);
- pv.addProtocols(pid);
- }
- }
- }
- }
- Sort.sortProtocols(pv, DataType.SORT_TYPE_ASCENDING);
- return pv;
- }
-
- /**
- Re-org all protocol entries for find table
-
- @return
-
- **/
- public static Vector<ProtocolId> getAllProtocolsForFind() {
- Vector<ProtocolId> protocol = new Vector<ProtocolId>();
- ProtocolsVector pv = Find.getAllProtocolsVector();
- boolean isAdded = false;
- boolean isProduced = false;
-
- //
- // Go through pv to add item as new format to ppi one by one
- //
- for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {
- isAdded = false;
- ProtocolsIdentification pvId = pv.getProtocols(indexOfPv);
-
- //
- // First check if produced or not
- //
- if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
- || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
- isProduced = true;
- } else if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)
- || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
- isProduced = false;
- }
-
- //
- // Get the sting "PackageName.ModuleName"
- //
- String tmp = "";
- if (pvId.getBelongModule() != null) {
- tmp = pvId.getBelongModule().getPackageId().getName() + SEPERATOR + pvId.getBelongModule().getName();
- }
-
- //
- // Check if the item has been added in
- // If added, append package name and new module name
- // If not added, add a new one first
- //
- for (int indexOfProtocol = 0; indexOfProtocol < protocol.size(); indexOfProtocol++) {
- ProtocolId protocolId = protocol.get(indexOfProtocol);
-
- if (pvId.getName().equals(protocolId.getName())) {
- if (isProduced) {
- protocol.get(indexOfProtocol)
- .setProducedModules(protocolId.getProducedModules() + "<br>" + tmp);
- } else if (!isProduced) {
- protocol.get(indexOfProtocol)
- .setConsumedModules(protocolId.getConsumedModules() + "<br>" + tmp);
- }
- isAdded = true;
- continue;
- }
- }
-
- //
- // Add a new one
- //
- if (!isAdded) {
- if (isProduced) {
- protocol.addElement(new ProtocolId(pvId.getName(), pvId.getType(), tmp, null, pvId.getDeclaredBy()
- .getName()));
- } else if (!isProduced) {
- protocol.addElement(new ProtocolId(pvId.getName(), pvId.getType(), null, tmp, pvId.getDeclaredBy()
- .getName()));
- }
- }
- }
-
- return protocol;
- }
-
- /**
- Get all protocol entries from workspace
-
- @return
-
- **/
- public static GuidsVector getAllGuidsVector() {
- GuidsVector gv = new GuidsVector();
- ModuleSurfaceArea msa = null;
- ModuleIdentification mid = null;
- GuidsIdentification gid = null;
-
- //
- // Go through each module one by one
- //
- if (GlobalData.openingModuleList.size() > 0) {
- for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {
- msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();
- mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();
-
- if (msa.getGuids() != null) {
- if (msa.getGuids().getGuidCNamesList().size() > 0) {
- for (int index = 0; index < msa.getGuids().getGuidCNamesList().size(); index++) {
- String arg0 = msa.getGuids().getGuidCNamesList().get(index).getGuidCName();
- String arg1 = null;
- if (msa.getGuids().getGuidCNamesList().get(index).getUsage() != null) {
- arg1 = msa.getGuids().getGuidCNamesList().get(index).getUsage().toString();
- }
-
- String arg2 = msa.getGuids().getGuidCNamesList().get(index).getFeatureFlag();
- Vector<String> arg3 = Tools.convertListToVector(msa.getGuids().getGuidCNamesList()
- .get(index).getSupArchList());
- String arg4 = msa.getGuids().getGuidCNamesList().get(index).getHelpText();
-
- gid = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4);
- gid.setBelongModule(mid);
-
- //
- // Find which package declares it
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getId();
- if (spd.getGuidDeclarations() != null) {
- for (int indexOfGuids = 0; indexOfGuids < spd.getGuidDeclarations().getEntryList()
- .size(); indexOfGuids++) {
- if (spd.getGuidDeclarations().getEntryList().get(indexOfGuids).getCName()
- .equals(arg0)) {
- gid.setDeclaredBy(packageId);
- break;
- }
- }
- }
- }
- if (gid.getDeclaredBy() == null) {
- gid.setDeclaredBy(new PackageIdentification("", "", "", ""));
- }
-
- gv.addGuids(gid);
- }
- }
- }
- }
- }
- //
- // Go through all defined guids to find which is not added yet.
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)
- .getId();
- if (spd.getGuidDeclarations() != null) {
- for (int indexOfGuids = 0; indexOfGuids < spd.getGuidDeclarations().getEntryList().size(); indexOfGuids++) {
- boolean isFound = false;
- GuidDeclarations.Entry e = spd.getGuidDeclarations().getEntryList().get(indexOfGuids);
- for (int indexOfGv = 0; indexOfGv < gv.size(); indexOfGv++) {
- if (e.getCName().equals(gv.getGuids(indexOfGv).getName())) {
- isFound = true;
- break;
- }
- }
- if (!isFound) {
- String arg0 = e.getCName();
- String arg1 = "";
- String arg2 = "";
- Vector<String> arg3 = Tools.convertListToVector(e.getSupArchList());
- String arg4 = e.getHelpText();
-
- gid = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4);
- gid.setBelongModule(null);
- gid.setDeclaredBy(packageId);
- gv.addGuids(gid);
- }
- }
- }
- }
- Sort.sortGuids(gv, DataType.SORT_TYPE_ASCENDING);
- return gv;
- }
-
- /**
- Re-org all guid entries for find table
-
- @return
-
- **/
- public static Vector<GuidId> getAllGuidsForFind() {
- Vector<GuidId> guid = new Vector<GuidId>();
- GuidsVector gv = Find.getAllGuidsVector();
- boolean isAdded = false;
- boolean isProduced = false;
-
- //
- // Go through pv to add item as new format to ppi one by one
- //
- for (int indexOfGv = 0; indexOfGv < gv.size(); indexOfGv++) {
- isAdded = false;
- GuidsIdentification gvId = gv.getGuids(indexOfGv);
-
- //
- // First check if produced or not
- //
- if (gvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
- || gvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
- isProduced = true;
- } else if (gvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)
- || gvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
- isProduced = false;
- }
-
- //
- // Get the sting "PackageName.ModuleName"
- //
- String tmp = "";
- if (gvId.getBelongModule() != null) {
- tmp = gvId.getBelongModule().getPackageId().getName() + SEPERATOR + gvId.getBelongModule().getName();
- }
-
- //
- // Check if the item has been added in
- // If added, append package name and new module name
- // If not added, add a new one first
- //
- for (int indexOfGuid = 0; indexOfGuid < guid.size(); indexOfGuid++) {
- GuidId guidId = guid.get(indexOfGuid);
-
- if (gvId.getName().equals(guidId.getName())) {
- if (isProduced) {
- guid.get(indexOfGuid).setProducedModules(guidId.getProducedModules() + "<br>" + tmp);
- } else if (!isProduced) {
- guid.get(indexOfGuid).setConsumedModules(guidId.getConsumedModules() + "<br>" + tmp);
- }
- isAdded = true;
- continue;
- }
- }
-
- //
- // Add a new one
- //
- if (!isAdded) {
- if (isProduced) {
- guid.addElement(new GuidId(gvId.getName(), "GUID", tmp, null, gvId.getDeclaredBy().getName()));
- } else if (!isProduced) {
- guid.addElement(new GuidId(gvId.getName(), "GUID", null, tmp, gvId.getDeclaredBy().getName()));
- }
- }
- }
-
- return guid;
- }
-
- /**
- Get all pcd coded entries from workspace
-
- @return
-
- **/
- public static PcdCodedVector getAllPcdCodedVector() {
- PcdCodedVector pv = new PcdCodedVector();
- ModuleSurfaceArea msa = null;
- ModuleIdentification mid = null;
- PcdCodedIdentification pid = null;
-
- //
- // Go through each module one by one
- //
- if (GlobalData.openingModuleList.size() > 0) {
- for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {
- msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();
- mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();
-
- if (msa.getPcdCoded() != null) {
- if (msa.getPcdCoded().getPcdEntryList().size() > 0) {
- for (int index = 0; index < msa.getPcdCoded().getPcdEntryList().size(); index++) {
-
- String arg0 = msa.getPcdCoded().getPcdEntryList().get(index).getCName();
- String arg1 = msa.getPcdCoded().getPcdEntryList().get(index).getTokenSpaceGuidCName();
-
- String arg2 = msa.getPcdCoded().getPcdEntryList().get(index).getFeatureFlag();
- Vector<String> arg3 = Tools.convertListToVector(msa.getPcdCoded().getPcdEntryList()
- .get(index).getSupArchList());
-
- String arg4 = msa.getPcdCoded().getPcdEntryList().get(index).getDefaultValue();
- String arg5 = msa.getPcdCoded().getPcdEntryList().get(index).getHelpText();
- String arg6 = null;
- if (msa.getPcdCoded().getPcdEntryList().get(index).getPcdItemType() != null) {
- arg6 = msa.getPcdCoded().getPcdEntryList().get(index).getPcdItemType().toString();
- }
- String arg7 = null;
- if (msa.getPcdCoded().getPcdEntryList().get(index).getUsage() != null) {
- arg7 = msa.getPcdCoded().getPcdEntryList().get(index).getUsage().toString();
- }
- pid = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
- pid.setBelongModule(mid);
-
- //
- // Find which package declares it
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getId();
- if (spd.getPcdDeclarations() != null) {
- for (int indexOfPcds = 0; indexOfPcds < spd.getPcdDeclarations().getPcdEntryList()
- .size(); indexOfPcds++) {
- PcdEntry pcdEntry = spd.getPcdDeclarations().getPcdEntryList().get(indexOfPcds);
- if (pcdEntry.getCName().equals(arg0)) {
- pid.setTokenSpaceGuidCName(pcdEntry.getTokenSpaceGuidCName());
- pid.setToken(pcdEntry.getToken().toString());
- pid.setDatumType(pcdEntry.getDatumType().toString());
- pid.setValue(pcdEntry.getDefaultValue());
- pid.setUsage(Tools.convertListToString(pcdEntry.getValidUsage()));
- pid.setHelp(pcdEntry.getHelpText());
- pid.setDeclaredBy(packageId);
- break;
- }
- }
- }
- }
- if (pid.getDeclaredBy() == null) {
- pid.setDeclaredBy(new PackageIdentification("", "", "", ""));
- }
-
- pv.addPcdCoded(pid);
- }
- }
- }
- }
- }
- //
- // Go through all defined pcds to find which is not added yet.
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)
- .getId();
- if (spd.getPcdDeclarations() != null) {
- for (int indexOfPcds = 0; indexOfPcds < spd.getPcdDeclarations().getPcdEntryList().size(); indexOfPcds++) {
- boolean isFound = false;
- PcdEntry e = spd.getPcdDeclarations().getPcdEntryList().get(indexOfPcds);
- for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {
- if (e.getCName().equals(pv.getPcdCoded(indexOfPv).getName())) {
- isFound = true;
- break;
- }
- }
- if (!isFound) {
- pid = new PcdCodedIdentification("", "", "", null, "", "", null, null);
- pid.setName(e.getCName());
- pid.setTokenSpaceGuidCName(e.getTokenSpaceGuidCName());
- pid.setToken(e.getToken().toString());
- pid.setDatumType(e.getDatumType().toString());
- pid.setValue(e.getDefaultValue());
- pid.setUsage(Tools.convertListToString(e.getValidUsage()));
- pid.setHelp(e.getHelpText());
- pid.setDeclaredBy(packageId);
-
- pid.setBelongModule(null);
- pv.addPcdCoded(pid);
- }
- }
- }
- }
- Sort.sortPcdCodeds(pv, DataType.SORT_TYPE_ASCENDING);
- return pv;
- }
-
- /**
-
- @param pv
- @return
-
- **/
- public static Vector<PcdFindResultId> getAllPcdCodedForFind(PcdCodedVector pv) {
- Vector<PcdFindResultId> pcd = new Vector<PcdFindResultId>();
- boolean isAdded = false;
- boolean isProduced = false;
-
- //
- // Go through pv to add item as new format to ppi one by one
- //
- for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {
- isAdded = false;
- PcdCodedIdentification pvId = pv.getPcdCoded(indexOfPv);
-
- //
- // First check if produced or not
- //
- if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
- || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
- isProduced = true;
- } else if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)
- || pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
- isProduced = false;
- }
-
- //
- // Check if the item has been added in
- // If added, append package name and new module name
- // If not added, add a new one first
- //
- for (int indexOfGuid = 0; indexOfGuid < pcd.size(); indexOfGuid++) {
- PcdFindResultId pcdId = pcd.get(indexOfGuid);
-
- if (pvId.getName().equals(pcdId.getName())) {
- if (isProduced) {
- pcd.get(indexOfGuid).addProducedModules(pvId.getBelongModule());
- } else if (!isProduced) {
- pcd.get(indexOfGuid).addConsumedModules(pvId.getBelongModule());
- }
- isAdded = true;
- continue;
- }
- }
-
- //
- // Add a new one
- //
- if (!isAdded) {
- PcdFindResultId pcdId = new PcdFindResultId(pvId.getName(), "PCD", pvId.getSupArchList(),
- pvId.getHelp(), null, pvId.getDeclaredBy());
- pcdId.setTokenSpaceGuidCName(pvId.getTokenSpaceGuidCName());
- pcdId.setToken(pvId.getToken());
- pcdId.setDatumType(pvId.getDatumType());
- pcdId.setValue(pvId.getValue());
- pcdId.setUsage(pvId.getUsage());
-
- pcd.addElement(pcdId);
- }
- }
-
- return pcd;
- }
-
- /**
- Get all library class entries from workspace
-
- @return
-
- **/
- public static LibraryClassVector getAllLibraryClassVector() {
- LibraryClassVector lcv = new LibraryClassVector();
- ModuleSurfaceArea msa = null;
- ModuleIdentification mid = null;
- LibraryClassIdentification lcid = null;
-
- //
- // Go through each module one by one
- //
- if (GlobalData.openingModuleList.size() > 0) {
- for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {
- msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();
- mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();
-
- if (msa.getLibraryClassDefinitions() != null) {
- LibraryClassDefinitions lcd = msa.getLibraryClassDefinitions();
- if (lcd.getLibraryClassList().size() > 0) {
- for (int index = 0; index < lcd.getLibraryClassList().size(); index++) {
- String name = lcd.getLibraryClassList().get(index).getKeyword();
- String usage = null;
- if (lcd.getLibraryClassList().get(index).getUsage() != null) {
- usage = lcd.getLibraryClassList().get(index).getUsage().toString();
- }
- String version = lcd.getLibraryClassList().get(index).getRecommendedInstanceVersion();
- String guid = lcd.getLibraryClassList().get(index).getRecommendedInstanceGuid();
- String featureFlag = lcd.getLibraryClassList().get(index).getFeatureFlag();
- Vector<String> arch = Tools.convertListToVector(lcd.getLibraryClassList().get(index)
- .getSupArchList());
- Vector<String> module = Tools.convertListToVector(lcd.getLibraryClassList().get(index)
- .getSupModuleList());
- String help = lcd.getLibraryClassList().get(index).getHelpText();
- lcid = new LibraryClassIdentification(name, usage, version, guid, arch, featureFlag,
- module, help);
- lcid.setBelongModule(mid);
-
- //
- // Find which package declares it
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList
- .getOpeningPackageByIndex(
- indexOfPackage)
- .getId();
- if (spd.getLibraryClassDeclarations() != null) {
- for (int indexOfLibraryClass = 0; indexOfLibraryClass < spd
- .getLibraryClassDeclarations()
- .getLibraryClassList()
- .size(); indexOfLibraryClass++) {
- LibraryClass lc = spd.getLibraryClassDeclarations().getLibraryClassList()
- .get(indexOfLibraryClass);
- if (lc.getName().equals(name)) {
- lcid.setSupArchList(Tools.convertListToVector(lc.getSupArchList()));
- lcid.setSupModuleList(Tools.convertListToVector(lc.getSupModuleList()));
- lcid.setHelp(lc.getHelpText());
- lcid.setDeclaredBy(packageId);
- break;
- }
- }
- }
- }
- if (lcid.getDeclaredBy() == null) {
- lcid.setDeclaredBy(new PackageIdentification("", "", "", ""));
- }
-
- lcv.addLibraryClass(lcid);
- }
- }
- }
- }
- }
- //
- // Go through all defined pcds to find which is not added yet.
- //
- for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
- PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();
- PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)
- .getId();
- if (spd.getLibraryClassDeclarations() != null) {
- for (int indexOfLibraryClass = 0; indexOfLibraryClass < spd.getLibraryClassDeclarations()
- .getLibraryClassList().size(); indexOfLibraryClass++) {
- boolean isFound = false;
- LibraryClass lc = spd.getLibraryClassDeclarations().getLibraryClassList().get(indexOfLibraryClass);
- for (int indexOfLcv = 0; indexOfLcv < lcv.size(); indexOfLcv++) {
- if (lc.getName().equals(lcv.getLibraryClass(indexOfLcv).getLibraryClassName())) {
- isFound = true;
- break;
- }
- }
- if (!isFound) {
- lcid = new LibraryClassIdentification("", null, "", "", null, "", null, "");
- lcid.setLibraryClassName(lc.getName());
- lcid.setSupArchList(Tools.convertListToVector(lc.getSupArchList()));
- lcid.setSupModuleList(Tools.convertListToVector(lc.getSupModuleList()));
- lcid.setHelp(lc.getHelpText());
- lcid.setDeclaredBy(packageId);
-
- lcid.setBelongModule(null);
- lcv.addLibraryClass(lcid);
- }
- }
- }
- }
- Sort.sortLibraryClass(lcv, DataType.SORT_TYPE_ASCENDING);
- return lcv;
- }
-
- /**
- Re-org all guid entries for find table
-
- @return
-
- **/
- public static Vector<FindResultId> getAllLibraryClassForFind(LibraryClassVector lcv) {
- Vector<FindResultId> libraryClass = new Vector<FindResultId>();
- boolean isAdded = false;
- boolean isProduced = false;
-
- //
- // Go through pv to add item as new format to ppi one by one
- //
- for (int indexOfLcv = 0; indexOfLcv < lcv.size(); indexOfLcv++) {
- isAdded = false;
- LibraryClassIdentification lcvId = lcv.getLibraryClass(indexOfLcv);
-
- //
- // First check if produced or not
- //
- if (lcvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
- || lcvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
- isProduced = true;
- } else if (lcvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)
- || lcvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
- isProduced = false;
- }
-
- //
- // Check if the item has been added in
- // If added, append package name and new module name
- // If not added, add a new one first
- //
- for (int indexOfGuid = 0; indexOfGuid < libraryClass.size(); indexOfGuid++) {
- FindResultId frId = libraryClass.get(indexOfGuid);
-
- if (lcvId.getLibraryClassName().equals(frId.getName())) {
- if (isProduced) {
- libraryClass.get(indexOfGuid).addProducedModules(lcvId.getBelongModule());
- } else if (!isProduced) {
- libraryClass.get(indexOfGuid).addConsumedModules(lcvId.getBelongModule());
- }
- isAdded = true;
- continue;
- }
- }
-
- //
- // Add a new one
- //
- if (!isAdded) {
- libraryClass.addElement(new FindResultId(lcvId.getLibraryClassName(), "Library Class",
- lcvId.getSupArchList(), lcvId.getHelp(),
- lcvId.getSupModuleList(), lcvId.getDeclaredBy()));
- }
- }
-
- return libraryClass;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResult.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResult.java deleted file mode 100644 index de6526b10c..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResult.java +++ /dev/null @@ -1,651 +0,0 @@ -/** @file
-
- The file is used to show a table with all defined PPIs
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.WindowEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.SwingConstants;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableCellRenderer;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedVector;
-
-public class FindResult extends IFrame implements TableModelListener, ListSelectionListener, MouseListener {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -2448484533878401714L;
-
- //
- // Define class members
- //
- private JTable jTable = null;
-
- private JPanel jContentPane = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JButton jButtonClose = null;
-
- //
- // Not used by UI
- //
- private IDefaultTableModel model = null;
-
- private String method = "";
-
- private static FindResult findPpisResult = null;
-
- private static FindResult findProtocolsResult = null;
-
- private static FindResult findGuidsResult = null;
-
- private static FindResult findPcdsResult = null;
-
- private static FindResult findLibraryClassResult = null;
-
- private int selectedRow = -1;
-
- private LibraryClassVector lcv = null;
-
- private Vector<FindResultId> vLibraryClassFindResult = null;
-
- private PcdCodedVector pv = null;
-
- private Vector<PcdFindResultId> vPcdFindResult = null;
-
- private JButton jButtonReload = null;
-
- private JPanel jPanelOperation = null;
-
- /**
- * This is the default constructor
- */
- public FindResult(String method) {
- super();
- init(method);
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void init(String method) {
- this.setSize(600, 500);
- this.setContentPane(getJScrollPane());
- this.setTitle("Find Result");
- this.setResizable(true);
- this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
- this.centerWindow();
-
- //
- // max the window
- //
- //this.setExtendedState(JFrame.MAXIMIZED_BOTH);
- this.method = method;
- this.showTable();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJScrollPaneTable(), null);
- jContentPane.add(getJPanelOperation(), null);
- jContentPane.setPreferredSize(new java.awt.Dimension(585, 445));
- }
- return jContentPane;
- }
-
- /**
- 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 jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(0, 0, 585, 395));
- jScrollPaneTable.setPreferredSize(new Dimension(585, 395));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
-
- model.addColumn("Name");
- model.addColumn("Type");
- model.addColumn("Produced by");
- model.addColumn("Consumed by");
- model.addColumn("Declared by");
-
- jTable.getColumn("Name").setCellRenderer(new MyTableCellRenderer());
- jTable.getColumn("Type").setCellRenderer(new MyTableCellRenderer());
- jTable.getColumn("Produced by").setCellRenderer(new MyTableCellRenderer());
- jTable.getColumn("Consumed by").setCellRenderer(new MyTableCellRenderer());
- jTable.getColumn("Declared by").setCellRenderer(new MyTableCellRenderer());
-
- int columnWidth = (this.getSize().width - 28) / 5;
- jTable.getColumn("Name").setPreferredWidth(columnWidth);
- jTable.getColumn("Type").setPreferredWidth(columnWidth);
- jTable.getColumn("Produced by").setPreferredWidth(columnWidth);
- jTable.getColumn("Consumed by").setPreferredWidth(columnWidth);
- jTable.getColumn("Declared by").setPreferredWidth(columnWidth);
- }
- return jTable;
- }
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonClose() {
- if (jButtonClose == null) {
- jButtonClose = new JButton();
- jButtonClose.setText("Close");
- jButtonClose.addActionListener(this);
- jButtonClose.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonClose.setBounds(new java.awt.Rectangle(90, 0, 80, 20));
- }
- return jButtonClose;
- }
-
- public static FindResult getInstance(String method) {
- if (method.equals("PPI")) {
- if (findPpisResult == null) {
- findPpisResult = new FindResult(method);
- }
- findPpisResult.init(method);
- return findPpisResult;
- }
-
- if (method.equals("PROTOCOL")) {
- if (findProtocolsResult == null) {
- findProtocolsResult = new FindResult(method);
- }
- findProtocolsResult.init(method);
- return findProtocolsResult;
- }
-
- if (method.equals("GUID")) {
- if (findGuidsResult == null) {
- findGuidsResult = new FindResult(method);
- }
- findGuidsResult.init(method);
- return findGuidsResult;
- }
-
- if (method.equals("PCD")) {
- if (findPcdsResult == null) {
- findPcdsResult = new FindResult(method);
- }
- findPcdsResult.init(method);
- return findPcdsResult;
- }
-
- if (method.equals("LIBRARY_CLASS")) {
- if (findLibraryClassResult == null) {
- findLibraryClassResult = new FindResult(method);
- }
- findLibraryClassResult.init(method);
- return findLibraryClassResult;
- }
-
- return null;
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
- this.jTable.repaint();
- this.jTable.updateUI();
-
- if (this.method.equals("PPI")) {
- Vector<PpiId> vPpi = Find.getAllPpisForFind();
-
- if (vPpi.size() > 0) {
-
- for (int index = 0; index < vPpi.size(); index++) {
- Vector<String> v = new Vector<String>();
- v.addElement(vPpi.elementAt(index).getName());
- v.addElement(vPpi.elementAt(index).getType());
- String strProducedModules = vPpi.elementAt(index).getProducedModules();
- if (strProducedModules.indexOf("<br>") == 0) {
- strProducedModules = strProducedModules.substring("<br>".length());
- }
- int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");
- v.addElement("<html>" + strProducedModules + "</html>");
-
- String strConsumedModules = vPpi.elementAt(index).getConsumedModules();
- if (strConsumedModules.indexOf("<br>") == 0) {
- strConsumedModules = strConsumedModules.substring("<br>".length());
- }
- int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");
- v.addElement("<html>" + strConsumedModules + "</html>");
-
- v.addElement(vPpi.elementAt(index).getDeclaredBy());
-
- model.addRow(v);
- jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
- }
- } else {
- Log.wrn("Find PPIs", "No PPI found!!!");
- }
- }
-
- if (this.method.equals("PROTOCOL")) {
- Vector<ProtocolId> vProtocol = Find.getAllProtocolsForFind();
-
- if (vProtocol.size() > 0) {
-
- for (int index = 0; index < vProtocol.size(); index++) {
- Vector<String> v = new Vector<String>();
- v.addElement(vProtocol.elementAt(index).getName());
- v.addElement(vProtocol.elementAt(index).getType());
- String strProducedModules = vProtocol.elementAt(index).getProducedModules();
- if (strProducedModules.indexOf("<br>") == 0) {
- strProducedModules = strProducedModules.substring("<br>".length());
- }
- int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");
- v.addElement("<html>" + strProducedModules + "</html>");
-
- String strConsumedModules = vProtocol.elementAt(index).getConsumedModules();
- if (strConsumedModules.indexOf("<br>") == 0) {
- strConsumedModules = strConsumedModules.substring("<br>".length());
- }
- int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");
- v.addElement("<html>" + strConsumedModules + "</html>");
-
- v.addElement(vProtocol.elementAt(index).getDeclaredBy());
-
- model.addRow(v);
- jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
- }
- } else {
- Log.wrn("Find PROTOCOLs", "No PROTOCOL found!!!");
- }
- }
-
- if (this.method.equals("GUID")) {
- Vector<GuidId> vGuid = Find.getAllGuidsForFind();
-
- if (vGuid.size() > 0) {
-
- for (int index = 0; index < vGuid.size(); index++) {
- Vector<String> v = new Vector<String>();
- v.addElement(vGuid.elementAt(index).getName());
- v.addElement("GUID");
- String strProducedModules = vGuid.elementAt(index).getProducedModules();
- if (strProducedModules.indexOf("<br>") == 0) {
- strProducedModules = strProducedModules.substring("<br>".length());
- }
- int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");
- v.addElement("<html>" + strProducedModules + "</html>");
-
- String strConsumedModules = vGuid.elementAt(index).getConsumedModules();
- if (strConsumedModules.indexOf("<br>") == 0) {
- strConsumedModules = strConsumedModules.substring("<br>".length());
- }
- int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");
- v.addElement("<html>" + strConsumedModules + "</html>");
-
- v.addElement(vGuid.elementAt(index).getDeclaredBy());
-
- model.addRow(v);
- jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
- }
- } else {
- Log.wrn("Find GUIDs", "No GUID found!!!");
- }
- }
-
- if (this.method.equals("PCD")) {
- pv = Find.getAllPcdCodedVector();
- vPcdFindResult = Find.getAllPcdCodedForFind(pv);
-
- if (vPcdFindResult.size() > 0) {
-
- for (int index = 0; index < vPcdFindResult.size(); index++) {
- Vector<String> v = new Vector<String>();
- v.addElement(vPcdFindResult.elementAt(index).getName());
- v.addElement(vPcdFindResult.elementAt(index).getType());
-
- //
- // Generate Produced Modules List
- //
- String strProducedModules = "";
- Vector<ModuleIdentification> vModule = vPcdFindResult.elementAt(index).getProducedModules();
- for (int indexOfPM = 0; indexOfPM < vModule.size(); indexOfPM++) {
- strProducedModules = strProducedModules + "<br>"
- + vModule.get(indexOfPM).getPackageId().getName() + "."
- + vModule.get(indexOfPM).getName();
- }
- if (strProducedModules.indexOf("<br>") == 0) {
- strProducedModules = strProducedModules.substring("<br>".length());
- }
- int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");
- v.addElement("<html>" + strProducedModules + "</html>");
-
- //
- // Generate Consumed Modules List
- //
- String strConsumedModules = "";
- vModule = vPcdFindResult.elementAt(index).getConsumedModules();
- for (int indexOfCM = 0; indexOfCM < vModule.size(); indexOfCM++) {
- strConsumedModules = strConsumedModules + "<br>"
- + vModule.get(indexOfCM).getPackageId().getName() + "."
- + vModule.get(indexOfCM).getName();
- }
- if (strConsumedModules.indexOf("<br>") == 0) {
- strConsumedModules = strConsumedModules.substring("<br>".length());
- }
- int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");
- v.addElement("<html>" + strConsumedModules + "</html>");
-
- //
- // Add declare package name
- //
- v.addElement(vPcdFindResult.elementAt(index).getDeclaredBy().getName());
-
- model.addRow(v);
- jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
- }
- } else {
- Log.wrn("Find PCDs", "No PCD found!!!");
- }
- }
-
- if (this.method.equals("LIBRARY_CLASS")) {
- lcv = Find.getAllLibraryClassVector();
- vLibraryClassFindResult = Find.getAllLibraryClassForFind(lcv);
-
- if (vLibraryClassFindResult.size() > 0) {
- for (int index = 0; index < vLibraryClassFindResult.size(); index++) {
- Vector<String> v = new Vector<String>();
- v.addElement(vLibraryClassFindResult.elementAt(index).getName());
- v.addElement(vLibraryClassFindResult.elementAt(index).getType());
-
- //
- // Generate Produced Modules List
- //
- String strProducedModules = "";
- Vector<ModuleIdentification> vModule = vLibraryClassFindResult.elementAt(index)
- .getProducedModules();
- for (int indexOfPM = 0; indexOfPM < vModule.size(); indexOfPM++) {
- strProducedModules = strProducedModules + "<br>"
- + vModule.get(indexOfPM).getPackageId().getName() + "."
- + vModule.get(indexOfPM).getName();
- }
- if (strProducedModules.indexOf("<br>") == 0) {
- strProducedModules = strProducedModules.substring("<br>".length());
- }
- int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");
- v.addElement("<html>" + strProducedModules + "</html>");
-
- //
- // Generate Consumed Modules List
- //
- String strConsumedModules = "";
- vModule = vLibraryClassFindResult.elementAt(index).getConsumedModules();
- for (int indexOfCM = 0; indexOfCM < vModule.size(); indexOfCM++) {
- strConsumedModules = strConsumedModules + "<br>"
- + vModule.get(indexOfCM).getPackageId().getName() + "."
- + vModule.get(indexOfCM).getName();
- }
- if (strConsumedModules.indexOf("<br>") == 0) {
- strConsumedModules = strConsumedModules.substring("<br>".length());
- }
- int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");
- v.addElement("<html>" + strConsumedModules + "</html>");
-
- v.addElement(vLibraryClassFindResult.elementAt(index).getDeclaredBy().getName());
-
- model.addRow(v);
- jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
- }
- } else {
- Log.wrn("Find Library Classes", "No Library Class found!!!");
- }
- }
-
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == this.jButtonClose) {
- this.dispose();
- }
-
- if (arg0.getSource() == this.jButtonReload) {
- this.showTable();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.centerComponent(this.jPanelOperation, intCurrentWidth, intCurrentHeight, intPreferredHeight,
- DataType.SPACE_TO_BOTTOM_FOR_CLOSE_BUTTON);
- Tools.resizeTableColumn(this.jTable, this.getSize().width - 28);
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- if (this.method.equals("LIBRARY_CLASS")) {
- FindResultDetailInfo frdi = new FindResultDetailInfo(vLibraryClassFindResult.elementAt(selectedRow));
- frdi.setVisible(true);
- }
- if (this.method.equals("PCD")) {
- FindResultDetailInfo frdi = new FindResultDetailInfo(vPcdFindResult.elementAt(selectedRow));
- frdi.setVisible(true);
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
- *
- * Override windowClosing to popup warning message to confirm quit
- *
- */
- public void windowClosing(WindowEvent arg0) {
- this.dispose();
- }
-
- class MyTableCellRenderer extends DefaultTableCellRenderer {
- ///
- /// Define Class Serial Version UID
- ///
- private static final long serialVersionUID = -2082787479305255946L;
-
- public void setValue(Object value) {
- this.setVerticalAlignment(SwingConstants.TOP);
- super.setValue(value);
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * This method initializes jButtonReload
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonReload() {
- if (jButtonReload == null) {
- jButtonReload = new JButton();
- jButtonReload.setText("Reload");
- jButtonReload.addActionListener(this);
- jButtonReload.setBounds(new java.awt.Rectangle(0, 0, 80, 20));
- jButtonReload.setPreferredSize(new java.awt.Dimension(80, 20));
- }
- return jButtonReload;
- }
-
- /**
- * This method initializes jPanelOperation
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelOperation() {
- if (jPanelOperation == null) {
- jPanelOperation = new JPanel();
- jPanelOperation.setLayout(null);
- jPanelOperation.setBounds(new java.awt.Rectangle(300, 415, 170, 20));
- jPanelOperation.setPreferredSize(new java.awt.Dimension(170, 20));
- jPanelOperation.add(getJButtonClose(), null);
- jPanelOperation.add(getJButtonReload(), null);
- }
- return jPanelOperation;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultDetailInfo.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultDetailInfo.java deleted file mode 100644 index 278ac1d964..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultDetailInfo.java +++ /dev/null @@ -1,657 +0,0 @@ -/** @file
-
- The file is used to show detailed information of one of find results
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.WindowEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-
-import org.tianocore.DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions;
-import org.tianocore.DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo;
-import org.tianocore.DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData;
-import org.tianocore.FrameworkModulesDocument.FrameworkModules;
-import org.tianocore.LibrariesDocument.Libraries;
-import org.tianocore.LibrariesDocument.Libraries.Instance;
-import org.tianocore.LibraryClassDocument.LibraryClass;
-import org.tianocore.ModuleSADocument.ModuleSA;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PcdBuildDefinitionDocument.PcdBuildDefinition;
-import org.tianocore.PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData;
-import org.tianocore.PcdCodedDocument.PcdCoded;
-import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class FindResultDetailInfo extends IFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -4888295869041881282L;
-
- private JPanel jContentPane = null;
-
- private JScrollPane jScrollPane = null;
-
- private JTextArea jTextArea = null;
-
- private JButton jButtonClose = null;
-
- //
- // Not for UI
- //
- private static String TAB = " ";
-
- private String reportContent = "";
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(5, 5, 535, 280));
- jScrollPane.setPreferredSize(new java.awt.Dimension(535, 280));
- jScrollPane.setViewportView(getJTextArea());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jButtonClose
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonClose() {
- if (jButtonClose == null) {
- jButtonClose = new JButton();
- jButtonClose.setBounds(new java.awt.Rectangle(240, 290, 80, 20));
- jButtonClose.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonClose.addActionListener(this);
- jButtonClose.setText("Close");
- }
- return jButtonClose;
- }
-
- /**
-
- @param lci
-
- **/
- public FindResultDetailInfo(FindResultId frid) {
- super();
- init();
- this.setTitle(frid.getName());
- this.jTextArea.setText(createReport(frid));
- this.jTextArea.setSelectionStart(0);
- this.jTextArea.setSelectionEnd(0);
- }
-
- /**
-
- @param lci
-
- **/
- public FindResultDetailInfo(PcdFindResultId frid) {
- super();
- init();
- this.setTitle(frid.getName());
- this.jTextArea.setText(createReport(frid));
- this.jTextArea.setSelectionStart(0);
- this.jTextArea.setSelectionEnd(0);
- }
-
- /**
- Create detailed information report for pcd
-
- @param frid
- @return
-
- **/
- private String createReport(PcdFindResultId frid) {
- String name = frid.getName();
-
- //
- // Write Pcd Name
- //
- writeReportLn("PCD C Name: " + name);
-
- //
- // Wrtie Declared package
- //
- writeReportLn("Declared in Package: " + frid.getDeclaredBy().getName() + " ("
- + Tools.getRelativePath(frid.getDeclaredBy().getPath(), Workspace.getCurrentWorkspace()) + ")");
-
- //
- // Write Token Space
- //
- writeReportLn("Token Space: " + frid.getTokenSpaceGuidCName());
-
- //
- // Write Token
- //
- writeReportLn("Token: " + frid.getToken());
-
- //
- // Write Datum Type
- //
- writeReportLn("Datum Type: " + frid.getDatumType());
-
- //
- // Write Default Value
- //
- writeReportLn("Default Value: " + frid.getValue());
-
- //
- // Write Usages
- //
- writeReportLn("Valid Usages: " + frid.getUsage());
-
- //
- // Write Help Text
- //
- writeReportLn("Help Text: ");
- writeReportLn(TAB + frid.getHelp());
-
- //
- // Write an Empty Line
- //
- writeReportLn("");
-
- //
- // Wriet all modules which use this PCD:
- //
- writeReportLn("Modules Coded to Use This PCD: ");
-
- Vector<ModuleIdentification> vModules = frid.getConsumedModules();
- if (vModules != null) {
- for (int index = 0; index < vModules.size(); index++) {
- //
- // Write Module Name and Path
- //
- writeReportLn(TAB + vModules.get(index).getName() + " ("
- + Tools.getRelativePath(vModules.get(index).getPath(), Workspace.getCurrentWorkspace())
- + ")");
-
- //
- // Write Module Pcd Info
- //
- ModuleSurfaceArea msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(vModules.get(index));
- if (msa != null) {
- PcdCoded pcdCoded = msa.getPcdCoded();
- if (pcdCoded != null) {
- for (int indexOfPcd = 0; indexOfPcd < pcdCoded.getPcdEntryList().size(); indexOfPcd++) {
- if (pcdCoded.getPcdEntryList().get(indexOfPcd).getCName().equals(name)) {
- //
- // Write Pcd Item Type
- //
- writeReportLn(TAB + TAB + "PcdItemType: "
- + pcdCoded.getPcdEntryList().get(indexOfPcd).getPcdItemType().toString());
-
- //
- // Write Help Text
- //
- writeReportLn(TAB + TAB + "Help Text: ");
- writeReportLn(TAB + TAB + TAB
- + pcdCoded.getPcdEntryList().get(indexOfPcd).getHelpText());
- }
- }
- }
- }
-
- //
- // Write an Empty Line
- //
- writeReportLn("");
- }
- }
-
- //
- // Write an Empty Line
- //
- writeReportLn("");
-
- //
- // Write All Platforms Specifing this PCD
- //
- writeReportLn("Platforms Specifing this PCD: ");
-
- for (int index = 0; index < GlobalData.openingPlatformList.size(); index++) {
- PlatformSurfaceArea fpd = GlobalData.openingPlatformList.getOpeningPlatformByIndex(index).getXmlFpd();
- PlatformIdentification pid = GlobalData.openingPlatformList.getOpeningPlatformByIndex(index).getId();
-
- String tmp = "";
- //
- // Get Non-Dynamic Pcd
- //
- FrameworkModules fm = fpd.getFrameworkModules();
- if (fm != null) {
- for (int indexOfModuleSa = 0; indexOfModuleSa < fm.getModuleSAList().size(); indexOfModuleSa++) {
- ModuleSA msa = fm.getModuleSAList().get(indexOfModuleSa);
- if (msa != null) {
- PcdBuildDefinition p = msa.getPcdBuildDefinition();
- if (p != null) {
- if (p.getPcdDataList() != null) {
-
- for (int indexOfPcd = 0; indexOfPcd < p.getPcdDataList().size(); indexOfPcd++) {
- PcdData pd = p.getPcdDataList().get(indexOfPcd);
- //
- // Find this PCD
- //
- if (pd.getCName().equals(name)) {
- //
- // Write Module Sa Info
- //
- ModuleIdentification moduleSaId = GlobalData
- .findModuleId(
- msa.getModuleGuid(),
- msa
- .getModuleVersion(),
- msa.getPackageGuid(),
- msa
- .getPackageVersion());
- tmp = tmp
- + TAB
- + TAB
- + "Module: "
- + moduleSaId.getName()
- + " ("
- + Tools.getRelativePath(moduleSaId.getPath(),
- Workspace.getCurrentWorkspace()) + ")"
- + DataType.UNIX_LINE_SEPARATOR;
- tmp = tmp + TAB + TAB + TAB + "Implementation: " + pd.getItemType().toString()
- + DataType.UNIX_LINE_SEPARATOR;
- tmp = tmp + TAB + TAB + TAB + "Specified / Implementation Value: "
- + pd.getValue() + DataType.UNIX_LINE_SEPARATOR;
- tmp = tmp + DataType.UNIX_LINE_SEPARATOR;
- }
- }
- }
- }
- }
- }
- }
-
- //
- // Get Dynamic Pcd
- //
- DynamicPcdBuildDefinitions dpbd = fpd.getDynamicPcdBuildDefinitions();
- if (dpbd != null) {
- for (int indexOfDpbd = 0; indexOfDpbd < dpbd.getPcdBuildDataList().size(); indexOfDpbd++) {
- PcdBuildData pbd = dpbd.getPcdBuildDataList().get(indexOfDpbd);
- if (pbd != null) {
- if (pbd.getCName().equals(name)) {
- //
- // Write Dynamic Pcd Build Definition
- //
- tmp = tmp + TAB + TAB + "Dynamic Pcd Build Definition: " + DataType.UNIX_LINE_SEPARATOR;
- if (pbd.getSkuInfoList() != null) {
- for (int indexOfPcd = 0; indexOfPcd < pbd.getSkuInfoList().size(); indexOfPcd++) {
- SkuInfo si = pbd.getSkuInfoList().get(indexOfPcd);
- if (si != null) {
- tmp = tmp + TAB + TAB + TAB + "Sku Id: " + si.getSkuId().toString()
- + DataType.UNIX_LINE_SEPARATOR;
- tmp = tmp + TAB + TAB + TAB + "Variable Name: " + si.getVariableName()
- + DataType.UNIX_LINE_SEPARATOR;
- tmp = tmp + TAB + TAB + TAB + "Variable GUID: " + si.getVariableGuid()
- + DataType.UNIX_LINE_SEPARATOR;
- tmp = tmp + TAB + TAB + TAB + "Variable Offset: " + si.getVariableOffset()
- + DataType.UNIX_LINE_SEPARATOR;
- tmp = tmp + TAB + TAB + TAB + "Hii Default Value: " + si.getHiiDefaultValue()
- + DataType.UNIX_LINE_SEPARATOR;
- }
- }
- }
- }
- }
- }
- }
-
- //
- // If not empty, write this platform info
- //
- if (!Tools.isEmpty(tmp)) {
- tmp = TAB + "Platform: " + pid.getName() + " ("
- + Tools.getRelativePath(pid.getPath(), Workspace.getCurrentWorkspace()) + ")"
- + DataType.UNIX_LINE_SEPARATOR + tmp;
- this.writeReportLn(tmp);
- }
- }
-
- return reportContent;
- }
-
- //
- // Create detailed information report for library
- //
- /**
-
- @param frid
- @return
-
- **/
- private String createReport(FindResultId frid) {
- String tmp = "";
- String name = frid.getName();
-
- //
- // Write Class Name
- //
- writeReportLn(name);
-
- //
- // Write Provided Package
- //
- writeReportLn(TAB + "Provided by: " + frid.getDeclaredBy().getName() + " ("
- + Tools.getRelativePath(frid.getDeclaredBy().getPath(), Workspace.getCurrentWorkspace()) + ")");
-
- //
- // Write Header File
- //
- PackageSurfaceArea spd = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(frid.getDeclaredBy());
- tmp = Tools.getRelativePath(frid.getDeclaredBy().getPath(), Workspace.getCurrentWorkspace());
- writeReportLn(TAB + "Header File: " + Tools.getFilePathOnly(tmp)
- + wt.getHeaderFileFromPackageByLibraryClassName(spd, name));
-
- //
- // Write Supported Module Types
- //
- writeReportLn(TAB + "Supported Module Types: " + Tools.convertVectorToString(frid.getModuleType()));
-
- //
- // Write Supported Arch
- //
- writeReportLn(TAB + "Supported Architectures: " + Tools.convertVectorToString(frid.getArch()));
-
- //
- // Write Help Text
- //
- writeReportLn(TAB + "Help Text: ");
- writeReportLn(TAB + TAB + frid.getHelp());
-
- //
- // Write an empty line
- //
- writeReportLn("");
-
- //
- // Write Instances
- //
- writeReportLn("Library Instances:");
-
- //
- // Write Instances One by One
- //
- for (int index = 0; index < frid.getProducedModules().size(); index++) {
- ModuleIdentification mid = frid.getProducedModules().get(index);
- ModuleSurfaceArea msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(mid);
- if (msa != null) {
- //
- // Write Instance Name
- //
- if (msa.getMsaHeader() != null) {
- writeReportLn(TAB + msa.getMsaHeader().getModuleName());
- }
-
- //
- // Write Msa File Name
- //
- writeReportLn(TAB + TAB + "Provided by: "
- + Tools.getRelativePath(mid.getPath(), Workspace.getCurrentWorkspace()));
-
- //
- // Find the produced library class
- //
- if (msa.getLibraryClassDefinitions() != null) {
- for (int indexL = 0; indexL < msa.getLibraryClassDefinitions().getLibraryClassList().size(); indexL++) {
- LibraryClass lc = msa.getLibraryClassDefinitions().getLibraryClassList().get(indexL);
- if (lc.getKeyword().equals(name)) {
- //
- // Write Supported Module Types
- //
- writeReportLn(TAB + TAB + "Supported Module Types: "
- + Tools.convertListToString(lc.getSupModuleList()));
-
- //
- // Write Supported Arch
- //
- writeReportLn(TAB + TAB + "Supported Architectures: "
- + Tools.convertListToString(lc.getSupArchList()));
-
- //
- // Write Help Text
- //
- writeReportLn(TAB + TAB + "Help Text: ");
- writeReportLn(TAB + TAB + (lc.getHelpText() == null ? "" : lc.getHelpText()));
- }
- }
- }
-
- }
- }
-
- //
- // Write an empty line
- //
- writeReportLn("");
-
- //
- // Write all modules which consumed this library
- //
- writeReportLn("Modules Requiring " + name + ":");
- for (int index = 0; index < frid.getConsumedModules().size(); index++) {
- //
- // Write
- //
- writeReportLn(TAB
- + frid.getConsumedModules().get(index).getName()
- + " ("
- + Tools.getRelativePath(frid.getConsumedModules().get(index).getPath(),
- Workspace.getCurrentWorkspace()) + ")");
- }
-
- //
- // Write an empty line
- //
- writeReportLn("");
-
- //
- // Write platforms using the library class instances
- //
- writeReportLn("Platforms Using " + name + ":");
-
- //
- // Write Instances One by One as Using Platforms
- //
- for (int index = 0; index < frid.getProducedModules().size(); index++) {
- ModuleIdentification mid = frid.getProducedModules().get(index);
-
- //
- // Write Instance Name
- //
- writeReportLn(TAB + mid.getName());
-
- //
- // Go through each platform one by one
- //
- for (int indexOfPlatform = 0; indexOfPlatform < GlobalData.openingPlatformList.size(); indexOfPlatform++) {
- PlatformSurfaceArea fpd = GlobalData.openingPlatformList.getOpeningPlatformByIndex(indexOfPlatform)
- .getXmlFpd();
- PlatformIdentification pid = GlobalData.openingPlatformList.getOpeningPlatformByIndex(indexOfPlatform)
- .getId();
- Vector<ModuleIdentification> vModuleSa = new Vector<ModuleIdentification>();
- if (fpd != null) {
- FrameworkModules fm = fpd.getFrameworkModules();
- if (fm != null) {
- for (int indexOfModule = 0; indexOfModule < fm.getModuleSAList().size(); indexOfModule++) {
- ModuleSA msa = fm.getModuleSAList().get(indexOfModule);
- if (msa != null) {
- Libraries l = msa.getLibraries();
- if (l != null) {
- if (l.getInstanceList() != null) {
- for (int indexOfInstance = 0; indexOfInstance < l.getInstanceList().size(); indexOfInstance++) {
- Instance i = l.getInstanceList().get(indexOfInstance);
- if (mid.equals(i.getModuleGuid(), i.getModuleVersion(), i.getPackageGuid(),
- i.getPackageVersion())) {
- ModuleIdentification moduleSaId = GlobalData
- .findModuleId(
- msa
- .getModuleGuid(),
- msa
- .getModuleVersion(),
- msa
- .getPackageGuid(),
- msa
- .getPackageVersion());
- if (moduleSaId != null) {
- vModuleSa.addElement(moduleSaId);
- }
- }
- }
- }
- }
- }
- }
-
- //
- // Get finded moduleSa in this spd
- //
- if (vModuleSa.size() > 0) {
- writeReportLn(TAB + TAB + pid.getName() + " ("
- + Tools.getRelativePath(pid.getPath(), Workspace.getCurrentWorkspace()) + ")");
- for (int indexOfModuleSa = 0; indexOfModuleSa < vModuleSa.size(); indexOfModuleSa++) {
- writeReportLn(TAB
- + TAB
- + TAB
- + vModuleSa.elementAt(indexOfModuleSa).getName()
- + " ("
- + Tools.getRelativePath(vModuleSa.elementAt(indexOfModuleSa).getPath(),
- Workspace.getCurrentWorkspace()) + ")");
- }
- }
- }
- }
- }
- writeReportLn("");
- }
-
- return this.reportContent;
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void init() {
- this.setSize(550, 380);
- this.setContentPane(getJContentPane());
- this.setTitle("JFrame");
- this.setResizable(true);
- this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
- this.centerWindow();
-
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setSize(new java.awt.Dimension(550, 350));
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(getJButtonClose(), null);
-
- jContentPane.setPreferredSize(new java.awt.Dimension(550, 340));
- }
- return jContentPane;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
- *
- * Override windowClosing to popup warning message to confirm quit
- *
- */
- public void windowClosing(WindowEvent arg0) {
- this.dispose();
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPane, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.centerComponent(this.jButtonClose, intCurrentWidth, intCurrentHeight, intPreferredHeight,
- DataType.SPACE_TO_BOTTOM_FOR_CLOSE_BUTTON);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == this.jButtonClose) {
- this.dispose();
- }
- }
-
- private void writeReportLn(String line) {
- this.reportContent = this.reportContent + line + DataType.LINE_SEPARATOR;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultId.java deleted file mode 100644 index 3784fb3839..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultId.java +++ /dev/null @@ -1,124 +0,0 @@ -/** @file
-
- The file is used to define GUID Identification used by find function
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class FindResultId {
-
- private String name = "";
-
- private String type = "";
-
- private Vector<String> arch = new Vector<String>();
-
- private Vector<String> moduleType = new Vector<String>();
-
- private String help = "";
-
- private Vector<ModuleIdentification> producedModules = new Vector<ModuleIdentification>();
-
- private Vector<ModuleIdentification> consumedModules = new Vector<ModuleIdentification>();
-
- private PackageIdentification declaredBy = null;
-
- public FindResultId(String strName, String strType, Vector<String> vArch, String strHelp, Vector<String> vModuleType, PackageIdentification pDeclaredBy) {
- this.name = (strName == null ? "" : strName);
- this.type = (strType == null ? "" : strType);
- this.arch = (vArch == null ? this.arch : vArch);
- this.help = (strHelp == null ? "" : strHelp);
- this.moduleType = (vModuleType == null ? this.moduleType : vModuleType);
- this.declaredBy = pDeclaredBy;
- }
-
- public Vector<String> getArch() {
- return arch;
- }
-
- public void setArch(Vector<String> arch) {
- this.arch = arch;
- }
-
- public Vector<ModuleIdentification> getConsumedModules() {
- return consumedModules;
- }
-
- public void setConsumedModules(Vector<ModuleIdentification> consumedModules) {
- this.consumedModules = consumedModules;
- }
-
- public void addConsumedModules(ModuleIdentification consumedModule) {
- if (consumedModule != null) {
- this.consumedModules.addElement(consumedModule);
- }
- }
-
- public PackageIdentification getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(PackageIdentification declaredBy) {
- this.declaredBy = declaredBy;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<ModuleIdentification> getProducedModules() {
- return producedModules;
- }
-
- public void setProducedModules(Vector<ModuleIdentification> producedModules) {
- this.producedModules = producedModules;
- }
-
- public void addProducedModules(ModuleIdentification producedModule) {
- if (producedModule != null) {
- this.producedModules.addElement(producedModule);
- }
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public Vector<String> getModuleType() {
- return moduleType;
- }
-
- public void setModuleType(Vector<String> moduleType) {
- this.moduleType = moduleType;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/GuidId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/GuidId.java deleted file mode 100644 index 2533108e4a..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/GuidId.java +++ /dev/null @@ -1,76 +0,0 @@ -/** @file
-
- The file is used to define GUID Identification used by find function
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-public class GuidId {
-
- private String name = null;
-
- private String type = null;
-
- private String producedModules = null;
-
- private String consumedModules = null;
-
- private String declaredBy = null;
-
- public GuidId(String arg0, String arg1, String arg2, String arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.type = (arg1 == null ? "" : arg1);
- this.producedModules = (arg2 == null ? "" : arg2);
- this.consumedModules = (arg3 == null ? "" : arg3);
- this.declaredBy = (arg4 == null ? "" : arg4);
- }
-
- public String getConsumedModules() {
- return consumedModules;
- }
-
- public void setConsumedModules(String consumedModules) {
- this.consumedModules = consumedModules;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getProducedModules() {
- return producedModules;
- }
-
- public void setProducedModules(String producedModules) {
- this.producedModules = producedModules;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(String declaredBy) {
- this.declaredBy = declaredBy;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/LibraryClassId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/LibraryClassId.java deleted file mode 100644 index a31cb38ade..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/LibraryClassId.java +++ /dev/null @@ -1,76 +0,0 @@ -/** @file
-
- The file is used to define Library Class Identification used by find function
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-public class LibraryClassId {
-
- private String name = null;
-
- private String type = null;
-
- private String producedModules = null;
-
- private String consumedModules = null;
-
- private String declaredBy = null;
-
- public LibraryClassId(String arg0, String arg1, String arg2, String arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.type = (arg1 == null ? "" : arg1);
- this.producedModules = (arg2 == null ? "" : arg2);
- this.consumedModules = (arg3 == null ? "" : arg3);
- this.declaredBy = (arg4 == null ? "" : arg4);
- }
-
- public String getConsumedModules() {
- return consumedModules;
- }
-
- public void setConsumedModules(String consumedModules) {
- this.consumedModules = consumedModules;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getProducedModules() {
- return producedModules;
- }
-
- public void setProducedModules(String producedModules) {
- this.producedModules = producedModules;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(String declaredBy) {
- this.declaredBy = declaredBy;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PcdFindResultId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PcdFindResultId.java deleted file mode 100644 index 88e46c48cf..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PcdFindResultId.java +++ /dev/null @@ -1,76 +0,0 @@ -/** @file
-
- The file is used to define Pcd Identification used by find function
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class PcdFindResultId extends FindResultId {
-
- private String tokenSpaceGuidCName = null;
-
- private String token = null;
-
- private String datumType = null;
-
- private String value = null;
-
- private String usage = null;
-
- public PcdFindResultId(String strName, String strType, Vector<String> vArch, String strHelp, Vector<String> vModuleType, PackageIdentification pDeclaredBy) {
- super(strName, strType, vArch, strHelp, vModuleType, pDeclaredBy);
- }
-
- public String getDatumType() {
- return datumType;
- }
-
- public void setDatumType(String datumType) {
- this.datumType = datumType;
- }
-
- public String getToken() {
- return token;
- }
-
- public void setToken(String token) {
- this.token = token;
- }
-
- public String getTokenSpaceGuidCName() {
- return tokenSpaceGuidCName;
- }
-
- public void setTokenSpaceGuidCName(String tokenSpaceGuidCName) {
- this.tokenSpaceGuidCName = tokenSpaceGuidCName;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PcdId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PcdId.java deleted file mode 100644 index 4982109068..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PcdId.java +++ /dev/null @@ -1,76 +0,0 @@ -/** @file
-
- The file is used to define GUID Identification used by find function
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-public class PcdId {
-
- private String name = null;
-
- private String type = null;
-
- private String producedModules = null;
-
- private String consumedModules = null;
-
- private String declaredBy = null;
-
- public PcdId(String arg0, String arg1, String arg2, String arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.type = (arg1 == null ? "" : arg1);
- this.producedModules = (arg2 == null ? "" : arg2);
- this.consumedModules = (arg3 == null ? "" : arg3);
- this.declaredBy = (arg4 == null ? "" : arg4);
- }
-
- public String getConsumedModules() {
- return consumedModules;
- }
-
- public void setConsumedModules(String consumedModules) {
- this.consumedModules = consumedModules;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getProducedModules() {
- return producedModules;
- }
-
- public void setProducedModules(String producedModules) {
- this.producedModules = producedModules;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(String declaredBy) {
- this.declaredBy = declaredBy;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PpiId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PpiId.java deleted file mode 100644 index d4782c4012..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/PpiId.java +++ /dev/null @@ -1,76 +0,0 @@ -/** @file
-
- The file is used to define PPI Identification used by find function
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-public class PpiId {
-
- private String name = null;
-
- private String type = null;
-
- private String producedModules = null;
-
- private String consumedModules = null;
-
- private String declaredBy = null;
-
- public PpiId(String arg0, String arg1, String arg2, String arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.type = (arg1 == null ? "" : arg1);
- this.producedModules = (arg2 == null ? "" : arg2);
- this.consumedModules = (arg3 == null ? "" : arg3);
- this.declaredBy = (arg4 == null ? "" : arg4);
- }
-
- public String getConsumedModules() {
- return consumedModules;
- }
-
- public void setConsumedModules(String consumedModules) {
- this.consumedModules = consumedModules;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getProducedModules() {
- return producedModules;
- }
-
- public void setProducedModules(String producedModules) {
- this.producedModules = producedModules;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(String declaredBy) {
- this.declaredBy = declaredBy;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/ProtocolId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/ProtocolId.java deleted file mode 100644 index 69bcbec984..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/ProtocolId.java +++ /dev/null @@ -1,76 +0,0 @@ -/** @file
-
- The file is used to define PROTOCOL Identification used by find function
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.find;
-
-public class ProtocolId {
-
- private String name = null;
-
- private String type = null;
-
- private String producedModules = null;
-
- private String consumedModules = null;
-
- private String declaredBy = null;
-
- public ProtocolId(String arg0, String arg1, String arg2, String arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.type = (arg1 == null ? "" : arg1);
- this.producedModules = (arg2 == null ? "" : arg2);
- this.consumedModules = (arg3 == null ? "" : arg3);
- this.declaredBy = (arg4 == null ? "" : arg4);
- }
-
- public String getConsumedModules() {
- return consumedModules;
- }
-
- public void setConsumedModules(String consumedModules) {
- this.consumedModules = consumedModules;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getProducedModules() {
- return producedModules;
- }
-
- public void setProducedModules(String producedModules) {
- this.producedModules = producedModules;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(String declaredBy) {
- this.declaredBy = declaredBy;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java deleted file mode 100644 index d02c121433..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java +++ /dev/null @@ -1,318 +0,0 @@ -/** @file
-
- The file is used to provid 6 kinds of arch in one jpanel
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.common.ui;
-
-import java.util.Vector;
-
-import javax.swing.JCheckBox;
-import javax.swing.JPanel;
-
-import org.tianocore.frameworkwizard.common.DataType;
-
-public class ArchCheckBox extends JPanel {
-
- ///
- /// Define class members
- ///
- private static final long serialVersionUID = 4792669775676953990L;
-
- private JCheckBox jCheckBoxIa32 = null;
-
- private JCheckBox jCheckBoxX64 = null;
-
- private JCheckBox jCheckBoxIpf = null;
-
- private JCheckBox jCheckBoxEbc = null;
-
- private JCheckBox jCheckBoxArm = null;
-
- private JCheckBox jCheckBoxPpc = null;
-
- /**
- * This method initializes jCheckBoxIa32
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxIa32() {
- if (jCheckBoxIa32 == null) {
- jCheckBoxIa32 = new JCheckBox();
- jCheckBoxIa32.setBounds(new java.awt.Rectangle(0, 0, 55, 20));
- jCheckBoxIa32.setText("IA32");
- jCheckBoxIa32.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxIa32;
- }
-
- /**
- * This method initializes jCheckBoxX64
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxX64() {
- if (jCheckBoxX64 == null) {
- jCheckBoxX64 = new JCheckBox();
- jCheckBoxX64.setBounds(new java.awt.Rectangle(55, 0, 53, 20));
- jCheckBoxX64.setText("X64");
- jCheckBoxX64.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxX64;
- }
-
- /**
- * This method initializes jCheckBoxIpf
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxIpf() {
- if (jCheckBoxIpf == null) {
- jCheckBoxIpf = new JCheckBox();
- jCheckBoxIpf.setBounds(new java.awt.Rectangle(108, 0, 52, 20));
- jCheckBoxIpf.setText("IPF");
- jCheckBoxIpf.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxIpf;
- }
-
- /**
- * This method initializes jCheckBoxEbc
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxEbc() {
- if (jCheckBoxEbc == null) {
- jCheckBoxEbc = new JCheckBox();
- jCheckBoxEbc.setBounds(new java.awt.Rectangle(160, 0, 53, 20));
- jCheckBoxEbc.setText("EBC");
- jCheckBoxEbc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxEbc;
- }
-
- /**
- * This method initializes jCheckBoxArm
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxArm() {
- if (jCheckBoxArm == null) {
- jCheckBoxArm = new JCheckBox();
- jCheckBoxArm.setBounds(new java.awt.Rectangle(213, 0, 54, 20));
- jCheckBoxArm.setText("ARM");
- jCheckBoxArm.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxArm;
- }
-
- /**
- * This method initializes jCheckBoxPpc
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxPpc() {
- if (jCheckBoxPpc == null) {
- jCheckBoxPpc = new JCheckBox();
- jCheckBoxPpc.setBounds(new java.awt.Rectangle(267, 0, 53, 20));
- jCheckBoxPpc.setText("PPC");
- jCheckBoxPpc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxPpc;
- }
-
- /**
- * This is the default constructor
- */
- public ArchCheckBox() {
- super();
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(320, 20);
- this.setLayout(null);
- this.add(getJCheckBoxIa32(), null);
- this.add(getJCheckBoxX64(), null);
- this.add(getJCheckBoxIpf(), null);
- this.add(getJCheckBoxEbc(), null);
- this.add(getJCheckBoxArm(), null);
- this.add(getJCheckBoxPpc(), null);
- this.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
-
- public Vector<String> getSelectedItemsVector() {
- Vector<String> v = new Vector<String>();
- if (this.jCheckBoxIa32.isSelected() && this.jCheckBoxIa32.isEnabled()) {
- v.addElement(jCheckBoxIa32.getText());
- }
- if (this.jCheckBoxX64.isSelected() && this.jCheckBoxX64.isEnabled()) {
- v.addElement(jCheckBoxX64.getText());
- }
- if (this.jCheckBoxIpf.isSelected() && this.jCheckBoxIpf.isEnabled()) {
- v.addElement(jCheckBoxIpf.getText());
- }
- if (this.jCheckBoxEbc.isSelected() && this.jCheckBoxEbc.isEnabled()) {
- v.addElement(jCheckBoxEbc.getText());
- }
- if (this.jCheckBoxArm.isSelected() && this.jCheckBoxArm.isEnabled()) {
- v.addElement(jCheckBoxArm.getText());
- }
- if (this.jCheckBoxPpc.isSelected() && this.jCheckBoxPpc.isEnabled()) {
- v.addElement(jCheckBoxPpc.getText());
- }
- return v;
- }
-
- public String getSelectedItemsString() {
- String s = "";
- if (this.jCheckBoxIa32.isSelected() && this.jCheckBoxIa32.isEnabled()) {
- s = s + jCheckBoxIa32.getText() + " ";
- }
- if (this.jCheckBoxX64.isSelected() && this.jCheckBoxX64.isEnabled()) {
- s = s + jCheckBoxX64.getText() + " ";
- }
- if (this.jCheckBoxIpf.isSelected() && this.jCheckBoxIpf.isEnabled()) {
- s = s + jCheckBoxIpf.getText() + " ";
- }
- if (this.jCheckBoxEbc.isSelected() && this.jCheckBoxEbc.isEnabled()) {
- s = s + jCheckBoxEbc.getText() + " ";
- }
- if (this.jCheckBoxArm.isSelected() && this.jCheckBoxArm.isEnabled()) {
- s = s + jCheckBoxArm.getText() + " ";
- }
- if (this.jCheckBoxPpc.isSelected() && this.jCheckBoxPpc.isEnabled()) {
- s = s + jCheckBoxPpc.getText() + " ";
- }
- return s.trim();
- }
-
- public void setAllItemsSelected(boolean isSelected) {
- this.jCheckBoxIa32.setSelected(isSelected);
- this.jCheckBoxX64.setSelected(isSelected);
- this.jCheckBoxIpf.setSelected(isSelected);
- this.jCheckBoxEbc.setSelected(isSelected);
- this.jCheckBoxArm.setSelected(isSelected);
- this.jCheckBoxPpc.setSelected(isSelected);
- }
-
- public void setSelectedItems(Vector<String> v) {
- setAllItemsSelected(false);
- if (v != null) {
- for (int index = 0; index < v.size(); index++) {
- if (v.get(index).equals(this.jCheckBoxIa32.getText())) {
- this.jCheckBoxIa32.setSelected(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxIpf.getText())) {
- this.jCheckBoxIpf.setSelected(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxX64.getText())) {
- this.jCheckBoxX64.setSelected(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxEbc.getText())) {
- this.jCheckBoxEbc.setSelected(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxArm.getText())) {
- this.jCheckBoxArm.setSelected(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxPpc.getText())) {
- this.jCheckBoxPpc.setSelected(true);
- continue;
- }
- }
- }
- }
-
- public void setAllItemsEnabled(boolean isEnabled) {
- this.jCheckBoxIa32.setEnabled(isEnabled);
- this.jCheckBoxX64.setEnabled(isEnabled);
- this.jCheckBoxIpf.setEnabled(isEnabled);
- this.jCheckBoxEbc.setEnabled(isEnabled);
- this.jCheckBoxArm.setEnabled(isEnabled);
- this.jCheckBoxPpc.setEnabled(isEnabled);
- }
-
- public void setEnabledItems(Vector<String> v) {
- setAllItemsEnabled(false);
- if (v != null) {
- for (int index = 0; index < v.size(); index++) {
- if (v.get(index).equals(this.jCheckBoxIa32.getText())) {
- this.jCheckBoxIa32.setEnabled(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxIpf.getText())) {
- this.jCheckBoxIpf.setEnabled(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxX64.getText())) {
- this.jCheckBoxX64.setEnabled(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxEbc.getText())) {
- this.jCheckBoxEbc.setEnabled(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxArm.getText())) {
- this.jCheckBoxArm.setEnabled(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxPpc.getText())) {
- this.jCheckBoxPpc.setEnabled(true);
- continue;
- }
- }
- }
- }
-
- public void setDisabledItems(Vector<String> v) {
- setAllItemsEnabled(true);
- if (v != null) {
- for (int index = 0; index < v.size(); index++) {
- if (v.get(index).equals(this.jCheckBoxIa32.getText())) {
- this.jCheckBoxIa32.setEnabled(false);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxIpf.getText())) {
- this.jCheckBoxIpf.setEnabled(false);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxX64.getText())) {
- this.jCheckBoxX64.setEnabled(false);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxEbc.getText())) {
- this.jCheckBoxEbc.setEnabled(false);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxArm.getText())) {
- this.jCheckBoxArm.setEnabled(false);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxPpc.getText())) {
- this.jCheckBoxPpc.setEnabled(false);
- continue;
- }
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ExitConfirm.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ExitConfirm.java deleted file mode 100644 index 836ed7b386..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ExitConfirm.java +++ /dev/null @@ -1,263 +0,0 @@ -/** @file
-
- The file is used to popup a exit confirmation window when program exists
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.common.ui;
-
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
-
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-/**
- The class is used to popup a exit confirmation window when program exists
- It extends JDialog and implements ActionListener and WindowListener
-
- **/
-public class ExitConfirm extends JDialog implements ActionListener, WindowListener {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -5875921789385911029L;
-
- private JPanel jContentPane = null;
-
- private JLabel jLabelMessage = null;
-
- private JLabel jLabelResume = null;
-
- private JLabel jLabelExit = null;
-
- private JButton jButtonResume = null;
-
- private JButton jButtonExit = null;
-
- public boolean isCancel = false;
-
- /**
- This method initializes jButtonResume
-
- @return javax.swing.JButton jButtonResume
-
- **/
- private JButton getJButtonResume() {
- if (jButtonResume == null) {
- jButtonResume = new JButton();
- jButtonResume.setText("Resume");
- jButtonResume.setSize(new java.awt.Dimension(90, 20));
- jButtonResume.setLocation(new java.awt.Point(150, 105));
- jButtonResume.setMnemonic('R');
- jButtonResume.addActionListener(this);
- }
- return jButtonResume;
- }
-
- /**
- This method initializes jButtonExit
-
- @return javax.swing.JButton jButtonExit
-
- **/
- private JButton getJButtonExit() {
- if (jButtonExit == null) {
- jButtonExit = new JButton();
- jButtonExit.setText("Exit");
- jButtonExit.setSize(new java.awt.Dimension(90, 20));
- jButtonExit.setLocation(new java.awt.Point(260, 105));
- jButtonExit.setMnemonic('x');
- jButtonExit.addActionListener(this);
- }
- return jButtonExit;
- }
-
- /**
- Main clasee, reserved for test
-
- @param args
-
- **/
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- This is the default constructor
-
- **/
- public ExitConfirm(IFrame parentFrame, boolean modal) {
- super(parentFrame, modal);
- initialize();
- }
-
- /**
- This method initializes this
-
- @return void
-
- **/
- private void initialize() {
- this.setSize(500, 170);
- this.setTitle("Exit");
- this.setResizable(false);
- this.setContentPane(getJContentPane());
- this.addWindowListener(this);
- //
- //Set DO_NOTHING_ON_CLOSE when click Close button on title bar
- //
- this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
- centerWindow();
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelExit = new JLabel();
- jLabelExit.setSize(new java.awt.Dimension(450, 20));
- jLabelExit.setLocation(new java.awt.Point(25, 70));
- jLabelResume = new JLabel();
- jLabelResume.setSize(new java.awt.Dimension(450, 20));
- jLabelResume.setLocation(new java.awt.Point(25, 40));
- jLabelMessage = new JLabel();
- jLabelMessage.setSize(new java.awt.Dimension(450, 20));
- jLabelMessage.setLocation(new java.awt.Point(25, 10));
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(jLabelMessage, null);
- jContentPane.add(jLabelResume, null);
- jContentPane.add(jLabelExit, null);
- jContentPane.add(getJButtonResume(), null);
- jContentPane.add(getJButtonExit(), null);
- }
- return jContentPane;
- }
-
- /**
- Call setWarningMessage to set messages of frame when it is used for Setup
-
- **/
- public void setSetupMessage() {
- String strTitle = "Exit Setup";
- String strMessage = "Setup is not complete. If you quit now, the program will not be installed.";
- String strResume = "You may run the setup program at a later time to complete the installation.";
- String strExit = "To continue installing, click Resume. To quit the Setup program, click Exit.";
- setWarningMessage(strTitle, strMessage, strResume, strExit);
- }
-
- /**
- Call setWarningMessage to set messages of frame when it is used for Module Main GUI
-
- **/
- public void setModuleMessage() {
- String strTitle = "Exit";
- String strMessage = "Do you really want to quit now?";
- String strResume = "All unsaved module information will be lost.";
- String strExit = "To continue editing the module, click Resume. To quit the program, click Exit.";
- setWarningMessage(strTitle, strMessage, strResume, strExit);
- }
-
- /**
- Set message information via input data
-
- @param strTitle The title value
- @param strMessage The main message value
- @param strResume The resume message value
- @param strExit The exit message value
-
- **/
- private void setWarningMessage(String strTitle, String strMessage, String strResume, String strExit) {
- this.setTitle(strTitle);
- jLabelMessage.setText(strMessage);
- jLabelResume.setText(strResume);
- jLabelExit.setText(strExit);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- *
- * Override actionPerformed to listern all actions
- *
- */
- public void actionPerformed(ActionEvent arg0) {
- //
- //Set isCancel true when click button "Exit"
- //
- Object obj = arg0.getSource();
- if (obj == jButtonResume) {
- isCancel = false;
- }
- if (obj == jButtonExit) {
- isCancel = true;
- }
- this.setVisible(false);
- }
-
- /**
- Make the window in the center of the screen
-
- **/
- private void centerWindow() {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- public void windowActivated(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowClosed(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowClosing(WindowEvent arg0) {
- isCancel = false;
- this.setVisible(false);
- }
-
- public void windowDeactivated(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowDeiconified(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowIconified(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowOpened(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IComboBox.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IComboBox.java deleted file mode 100644 index c5a51fd3e6..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IComboBox.java +++ /dev/null @@ -1,227 +0,0 @@ -/** @file
-
- The file is used to override JComboBox to provides customized interfaces
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.ui;
-
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-
-import javax.swing.JComboBox;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-
-/**
- The class is used to override JComboBox to provides customized interfaces
- It extends JComboBox implements KeyListener, MouseListener and FocusListener
-
-
-
- **/
-public class IComboBox extends JComboBox implements KeyListener, MouseListener, FocusListener {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -1940262568168458911L;
-
- public void focusGained(FocusEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.FocusListener#focusLost(java.awt.event.FocusEvent)
- *
- * Override focusLost to exit edit mode
- *
- */
- public void focusLost(FocusEvent arg0) {
- this.closeEdit();
- }
-
- /**
- Main class, used for test
-
- @param args
-
- **/
- public static void main(String[] args) {
- JFrame jf = new JFrame();
- jf.setSize(500, 200);
- JPanel jp = new JPanel();
- jp.setLayout(null);
- IComboBox icb = new IComboBox();
- jp.add(icb, null);
- jf.setContentPane(jp);
- jf.setVisible(true);
- }
-
- /**
- This is the default constructor
-
- **/
- public IComboBox() {
- super();
- init();
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(320, 20);
- this.setEditable(false);
- this.editor.addActionListener(this);
- this.addMouseListener(this);
- this.addKeyListener(this);
- this.getEditor().getEditorComponent().addKeyListener(this);
- this.getEditor().getEditorComponent().addFocusListener(this);
- this.setToolTipText("<html>Double Click to add an entry, then finish by press ENTER.<br>"
- + "Selecting DELETE will remove selected entry.</html>");
- }
-
- public void keyPressed(KeyEvent arg0) {
- // TODO Auto-generated method stub
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)
- *
- * Override keyReleased to listen key action
- *
- */
- public void keyReleased(KeyEvent arg0) {
- //
- //Add new item to list when press ENTER
- //
- if (arg0.getSource() == this.getEditor().getEditorComponent()) {
- if (arg0.getKeyCode() == KeyEvent.VK_ENTER) {
- String strCurrentText = this.getEditor().getItem().toString().trim();
- if (strCurrentText.length() == 0) {
- if (this.getItemCount() > 0) {
- this.setSelectedIndex(0);
- }
- } else {
- this.addItem(strCurrentText);
- this.setSelectedItem(strCurrentText);
- }
- this.setEditable(false);
- }
-
- if (arg0.getKeyCode() == KeyEvent.VK_ESCAPE) {
- closeEdit();
- }
- }
-
- if (arg0.getSource() == this) {
- //
- //Remove item from the list when press DEL
- //
- if (arg0.getKeyCode() == KeyEvent.VK_DELETE) {
- int intSelected = this.getSelectedIndex();
- if (intSelected > -1) {
- this.removeItemAt(this.getSelectedIndex());
- if (this.getItemCount() > 0) {
- this.setSelectedIndex(0);
- } else {
- this.removeAllItems();
- }
- }
- }
- }
- }
-
- public void keyTyped(KeyEvent arg0) {
- // TODO Auto-generated method stub
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- * Override mouseClicked to enter edit mode when double click mouse
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- this.setEditable(true);
- this.getEditor().setItem("");
- }
- }
-
- public void mouseEntered(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mousePressed(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- Exit edit mode
-
- **/
- private void closeEdit() {
- this.setEditable(false);
- this.getEditor().setItem("");
- }
-
- /**
- Set the input item as selected
-
- @param item the item which is needed to be set selected
-
- **/
- public void setSelectedItem(Object item) {
- boolean isFind = false;
- //
- // If the input value is not in the default list, add it to the list
- //
- if (item != null) {
- for (int index = 0; index < this.getItemCount(); index++) {
- if (this.getItemAt(index).equals(item)) {
- isFind = true;
- break;
- }
- }
- //
- // Add this item to IComboBox if not found
- //
- if (!isFind && !item.toString().equals("")) {
- super.addItem(item);
- }
- }
-
- //
- // Call super function to set the item selected.
- //
- super.setSelectedItem(item);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDefaultMutableTreeNode.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDefaultMutableTreeNode.java deleted file mode 100644 index 4708191ac9..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDefaultMutableTreeNode.java +++ /dev/null @@ -1,280 +0,0 @@ -/** @file
-
-
- The file is used to override DefaultMutableTreeNode to provides customized interfaces
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.common.ui;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-
-/**
- The class is used to override DefaultMutableTreeNode to provides customized interfaces
- It extends DefaultMutableTreeNode
-
-
-
- **/
-public class IDefaultMutableTreeNode extends DefaultMutableTreeNode {
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -1947340717458069548L;
-
- //
- // Static final definitions for all kinds of node
- //
- public static final int MSA_HEADER = 100;
-
- public static final int MSA_LIBRARYCLASSDEFINITIONS = 101;
-
- public static final int MSA_PACKAGEDEPENDENCIES = 102;
-
- public static final int MSA_SOURCEFILES = 103;
-
- public static final int MSA_PROTOCOLS = 104;
-
- public static final int MSA_EVENTS = 105;
-
- public static final int MSA_HOBS = 106;
-
- public static final int MSA_PPIS = 107;
-
- public static final int MSA_VARIABLES = 108;
-
- public static final int MSA_BOOTMODES = 109;
-
- public static final int MSA_SYSTEMTABLES = 110;
-
- public static final int MSA_DATAHUBS = 111;
-
- public static final int MSA_HIIPACKAGES = 112;
-
- public static final int MSA_GUIDS = 113;
-
- public static final int MSA_EXTERNS = 114;
-
- public static final int MSA_PCDS = 115;
-
- public static final int MSA_BUILDOPTIONS = 117;
-
- public static final int MSA_USEREXTENSIONS = 118;
-
- public static final int MSA_MODULEDEFINITIONS = 119;
-
- public static final int SPD_HEADER = 200;
-
- public static final int SPD_LIBRARYCLASSDECLARATIONS = 201;
-
- public static final int SPD_MSAFILES = 202;
-
- public static final int SPD_PACKAGEHEADERS = 203;
-
- public static final int SPD_GUIDDECLARATIONS = 204;
-
- public static final int SPD_PROTOCOLDECLARATIONS = 205;
-
- public static final int SPD_PPIDECLARATIONS = 206;
-
- public static final int SPD_PCDDECLARATIONS = 207;
-
- public static final int SPD_PACKAGEDEFINITIONS = 208;
-
- public static final int SPD_INDUSTRYSTDINCLUDES = 209;
-
- public static final int FPD_PLATFORMHEADER = 300;
-
- public static final int FPD_FLASH = 301;
-
- public static final int FPD_FRAMEWORKMODULES = 302;
-
- public static final int FPD_PCDDYNAMICBUILDDECLARATIONS = 303;
-
- public static final int FPD_BUILDOPTIONS = 304;
-
- public static final int FPD_PLATFORMDEFINITIONS = 305;
-
- public static final int WORKSPACE = 0;
-
- public static final int MODULE_DESCRIPTION = 1;
-
- public static final int PACKAGE_DESCRIPTION = 2;
-
- public static final int PLATFORM_DESCRIPTION = 3;
-
- public static final int MODULE = 4;
-
- public static final int PACKAGE = 5;
-
- public static final int PLATFORM = 6;
-
- public static final int MODULE_PACKAGE = 7;
-
- public static final int MODULE_PACKAGE_LIBRARY = 8;
-
- public static final int MODULE_PACKAGE_MODULE = 9;
-
- //
- //Static final definitions for operation
- //
- public static final int OPERATION_NULL = 0;
-
- public static final int OPERATION_ADD = 1;
-
- public static final int OPERATION_UPDATE = 2;
-
- public static final int OPERATION_DELETE = 4;
-
- public static final int OPERATION_ADD_UPDATE = 3;
-
- public static final int OPERATION_ADD_DELETE = 5;
-
- public static final int OPERATION_UPDATE_DELETE = 6;
-
- public static final int OPERATION_ADD_UPDATE_DELETE = 7;
-
- //
- //Define 4 node attributes
- //
- private int category = 0;
-
- private String nodeName = "";
-
- private boolean isOpening = false;
-
- private Identification id = null;
-
- private IDefaultMutableTreeNode belongNode = null;
-
- /**
- This is the default constructor
-
- **/
- public IDefaultMutableTreeNode() {
- super();
- }
-
- /**
- This is the overrided constructor
- Init clase members with input data
-
- @param strNodeName The name of node
- @param intCategory The category of node
- @param bolIsOpened to identify if the node is opening or not
- @param identification The Identification of node
-
- **/
- public IDefaultMutableTreeNode(String strNodeName, int intCategory, boolean bolIsOpening,
- Identification identification, IDefaultMutableTreeNode idmtBelongNode) {
- super(strNodeName);
- this.nodeName = strNodeName;
- this.category = intCategory;
- this.isOpening = bolIsOpening;
- this.id = identification;
- this.belongNode = idmtBelongNode;
- }
-
- /**
- Get category of node
-
- @return The category of node
-
- **/
- public int getCategory() {
- return category;
- }
-
- /**
- Set category of node
-
- @param category The input data of node category
-
- **/
- public void setCategory(int category) {
- this.category = category;
- }
-
- /**
- Get name of node
-
- @return The name of node
-
- **/
- public String getNodeName() {
- return nodeName;
- }
-
- /**
- Set name of node
-
- @param nodeName The input data of node name
-
- **/
- public void setNodeName(String nodeName) {
- this.nodeName = nodeName;
- }
-
- /**
- Get identification of node
-
- @return
-
- **/
- public Identification getId() {
- return id;
- }
-
- /**
- Set identification of node
-
- @param id
-
- **/
- public void setId(Identification id) {
- this.id = id;
- }
-
- /**
- get isOpening of node
-
- @return
-
- **/
- public boolean isOpening() {
- return isOpening;
- }
-
- /**
- Set isOpening of node
-
- @param isOpening
-
- **/
- public void setOpening(boolean isOpening) {
- this.isOpening = isOpening;
- }
-
- public String toString() {
- return this.nodeName;
- }
-
- public IDefaultMutableTreeNode getBelongNode() {
- return belongNode;
- }
-
- public void setBelongNode(IDefaultMutableTreeNode belongNode) {
- this.belongNode = belongNode;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDesktopManager.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDesktopManager.java deleted file mode 100644 index dc668e7ed3..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDesktopManager.java +++ /dev/null @@ -1,76 +0,0 @@ -/** @file
-
- The file is used to override DefaultDesktopManager to provides customized interfaces
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.common.ui;
-
-import javax.swing.DefaultDesktopManager;
-import javax.swing.JComponent;
-
-/**
- The class is used to override DefaultDesktopManager to provides customized interfaces
- It extends DefaultDesktopManager
-
-
-
- **/
-public class IDesktopManager extends DefaultDesktopManager {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -4596986878722011062L;
-
- /**
- Main class, reserved for test
-
- @param args
-
- **/
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.DesktopManager#dragFrame(javax.swing.JComponent, int, int)
- *
- * Override dragFrame to do nothing to forbid internalframe to be draged
- *
- */
- public void dragFrame(JComponent f, int newX, int newY) {
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.DesktopManager#endDraggingFrame(javax.swing.JComponent)
- *
- * Override endDraggingFrame to do nothing to forbid internalframe to be draged
- *
- */
- public void endDraggingFrame(JComponent f) {
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.DesktopManager#beginResizingFrame(javax.swing.JComponent, int)
- *
- * Override beginResizingFrame to do nothing to forbid internalframe to be draged
- *
- */
- public void beginResizingFrame(JComponent f, int direction) {
-
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDialog.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDialog.java deleted file mode 100644 index 1fc7c4c156..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDialog.java +++ /dev/null @@ -1,163 +0,0 @@ -/** @file
-
- The file is used to override Dialog to provides customized interfaces
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.common.ui;
-
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JDialog;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.Tools;
-
-/**
- The class is used to override Dialog to provides customized interfaces
- It extends JDialog implements ActionListener
-
-
-
- **/
-public class IDialog extends JDialog implements ActionListener {
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -7692623863358631984L;
- //
- //Define class members
- //
- private boolean isEdited = false;
-
- public int returnType = DataType.RETURN_TYPE_CANCEL;
-
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- Main class, used for test
-
- @param args
-
- **/
- public static void main(String[] args) {
- IDialog id = new IDialog();
- id.setVisible(true);
- }
-
- /**
- This is the default constructor
- **/
- public IDialog() {
- super();
- initialize();
- }
-
- /**
- This is the override constructor
-
- @param parentFrame The parent frame which open the dialog
- @param modal true means the dialog is modal dialog; false means the dialog is not modal dialog
- **/
- public IDialog(IFrame parentFrame, boolean modal) {
- super(parentFrame, modal);
- initialize();
- }
-
- /**
- This is the override constructor
-
- @param parentFrame The parent frame which open the dialog
- @param modal true means the dialog is modal dialog; false means the dialog is not modal dialog
- **/
- public IDialog(IDialog parentFrame, boolean modal) {
- super(parentFrame, modal);
- initialize();
- }
-
- /**
- This method initializes this
-
- **/
- private void initialize() {
- this.setResizable(false);
- }
-
- /**
- Start the dialog at the center of screen
-
- @param intWidth The width of the dialog
- @param intHeight The height of the dialog
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the dialog at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-
- /**
- Get if the dialog has been edited
-
- @retval true - The dialog has been edited
- @retval false - The dialog hasn't been edited
-
- **/
- public boolean isEdited() {
- return isEdited;
- }
-
- /**
- Set if the dialog has been edited
-
- @param isEdited The input data which identify if the dialog has been edited
-
- **/
- public void setEdited(boolean isEdited) {
- this.isEdited = isEdited;
- }
-
- /**
- Check the input data is empty or not
-
- @param strValue The input data which need be checked
-
- @retval true - The input data is empty
- @retval fals - The input data is not empty
-
- **/
- public boolean isEmpty(String strValue) {
- return Tools.isEmpty(strValue);
- }
-
- /**
- Display the dialog
-
- **/
- public int showDialog() {
- this.setVisible(true);
- return returnType;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IFrame.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IFrame.java deleted file mode 100644 index 5f3341f696..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IFrame.java +++ /dev/null @@ -1,264 +0,0 @@ -/** @file
-
- The file is used to override Frame to provides customized interfaces
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.common.ui;
-
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ComponentListener;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
-
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-
-import org.tianocore.frameworkwizard.common.Tools;
-
-/**
- The class is used to override Frame to provides customized interfaces
- It extends JFrame implements ActionListener and WindowListener
-
- **/
-public class IFrame extends JFrame implements ActionListener, WindowListener, ComponentListener {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -3324138961029300427L;
-
- //
- //Define class members
- //
- private ExitConfirm ec = null;
-
- //
- // To indicate the status while quit
- // 0 - When setup (Default)
- // 1 - Whne editing module
- //
- private int intExitType = 0;
-
- /**
- Main class, used for test
-
- @param args
-
- **/
- public static void main(String[] args) {
- IFrame i = new IFrame();
- i.setVisible(true);
- }
-
- /**
- This is the default constructor
-
- **/
- public IFrame() {
- super();
- initialize();
- }
-
- /**
- This method initializes this
-
- **/
- public void initialize() {
- this.setResizable(false);
- this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
- this.addWindowListener(this);
- this.addComponentListener(this);
- }
-
- /**
- Start the dialog at the center of screen
-
- @param intWidth The width of the dialog
- @param intHeight The height of the dialog
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window full of the screen
-
- **/
- protected void maxWindow() {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation(0, 0);
- this.setSize(d);
- }
-
- /**
- Start the dialog at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-
- /**
- Set the exit window type
-
- @param ExitType The input data of ExitType
-
- **/
- protected void setExitType(int ExitType) {
- this.intExitType = ExitType;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
- *
- * Override windowClosing to call this.onDisvisible()
- *
- */
- public void windowClosing(WindowEvent arg0) {
- //this.onDisvisible();
- }
-
- public void windowOpened(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowClosed(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowIconified(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowDeiconified(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowActivated(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void windowDeactivated(WindowEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- Define the actions when exit
-
- **/
- public void onExit() {
- ec = new ExitConfirm(this, true);
- //
- //Show different warning message via different ExitType
- //
- switch (intExitType) {
- case 0:
- ec.setSetupMessage();
- break;
- case 1:
- ec.setModuleMessage();
- break;
- }
- ec.setVisible(true);
- if (ec.isCancel) {
- this.dispose();
- System.exit(0);
- }
- }
-
- /**
- Define the actions when disvisible
-
- **/
- public void onDisvisible() {
- ec = new ExitConfirm(this, true);
- //
- //Show different warning message via different ExitType
- //
- switch (intExitType) {
- case 0:
- ec.setSetupMessage();
- break;
- case 1:
- ec.setModuleMessage();
- break;
- }
- ec.setVisible(true);
- if (ec.isCancel) {
- this.dispose();
- }
- }
-
- public int showSaveDialog() {
- return JOptionPane.showConfirmDialog(this, "Save all changed files?", "Save", JOptionPane.YES_NO_CANCEL_OPTION,
- JOptionPane.WARNING_MESSAGE);
- }
-
- /**
- Check the input data is empty or not
-
- @param strValue The input data which need be checked
-
- @retval true - The input data is empty
- @retval fals - The input data is not empty
-
- **/
- public boolean isEmpty(String strValue) {
- return Tools.isEmpty(strValue);
- }
-
- /**
- Display the dialog
-
- **/
- public void showDialog() {
- this.setVisible(true);
- }
-
- public void componentResized(ComponentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void componentMoved(ComponentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void componentShown(ComponentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void componentHidden(ComponentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IInternalFrame.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IInternalFrame.java deleted file mode 100644 index f0d018605d..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IInternalFrame.java +++ /dev/null @@ -1,216 +0,0 @@ -/** @file
-
- The file is used to override JInternalFrame to provides customized interfaces
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.common.ui;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ComponentListener;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-
-import javax.swing.JDesktopPane;
-import javax.swing.JFrame;
-import javax.swing.JInternalFrame;
-import javax.swing.JPanel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-
-import org.tianocore.frameworkwizard.common.Tools;
-
-/**
- * The class is used to override JInternalFrame to provides customized
- * interfaces It extends JInternalFrame implements ActionListener
- *
- *
- *
- */
-public class IInternalFrame extends JInternalFrame implements ActionListener, ComponentListener, ItemListener,
- FocusListener, ListSelectionListener, TableModelListener, MouseListener {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -609841772384875886L;
-
- //
- // Define class members
- //
- private boolean isEdited = false;
-
- /**
- * Main class, used for test
- *
- * @param args
- *
- */
- public static void main(String[] args) {
- JFrame jf = new JFrame();
- JPanel jp = new JPanel();
- JDesktopPane jdp = new JDesktopPane();
- IInternalFrame itf = new IInternalFrame();
- jdp.add(itf, 1);
- jf.setContentPane(jp);
- jf.setVisible(true);
- }
-
- /**
- * This is the default constructor
- *
- */
- public IInternalFrame() {
- super();
- initialize();
- }
-
- /**
- * This method initializes this
- *
- */
- private void initialize() {
- this.setBounds(new java.awt.Rectangle(0, 0, 520, 545));
- this.setMinimumSize(new java.awt.Dimension(520, 545));
- this.addComponentListener(this);
- }
-
- /**
- * Get if the InternalFrame has been edited
- *
- * @retval true - The InternalFrame has been edited
- * @retval false - The InternalFrame hasn't been edited
- *
- */
- public boolean isEdited() {
- return isEdited;
- }
-
- /**
- * Set if the InternalFrame has been edited
- *
- * @param isEdited
- * The input data which identify if the InternalFrame has been
- * edited
- *
- */
- public void setEdited(boolean isEdited) {
- this.isEdited = isEdited;
- }
-
- /**
- * Check the input data is empty or not
- *
- * @param strValue
- * The input data which need be checked
- *
- * @retval true - The input data is empty
- * @retval fals - The input data is not empty
- *
- */
- public boolean isEmpty(String strValue) {
- return Tools.isEmpty(strValue);
- }
-
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- }
-
- public void componentHidden(ComponentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void componentMoved(ComponentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void componentResized(ComponentEvent arg0) {
- // TODO Auto-generated method stub
- }
-
- public void componentShown(ComponentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void showStandard() {
-
- }
-
- public void showAdvanced() {
-
- }
-
- public void showXML() {
-
- }
-
- public void itemStateChanged(ItemEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void focusGained(FocusEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void focusLost(FocusEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void valueChanged(ListSelectionEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseClicked(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mousePressed(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ITree.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ITree.java deleted file mode 100644 index 252c34ff72..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ITree.java +++ /dev/null @@ -1,231 +0,0 @@ -/** @file
-
- The file is used to override JTree to provides customized interfaces
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.common.ui;
-
-import javax.swing.JTree;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreeNode;
-import javax.swing.tree.TreePath;
-
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-
-/**
- The class is used to override JTree to provides customized interfaces
- It extends JTree
-
- **/
-public class ITree extends JTree {
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -7907086164518295327L;
-
- //
- // Define class members
- //
- DefaultTreeModel treeModel = null;
-
- /**
- This is the default constructor
-
- **/
- public ITree() {
- super();
- }
-
- /**
- This is the overrided constructor
- Init class members with input data
-
- @param iDmtRoot The root node of the tree
-
- **/
- public ITree(IDefaultMutableTreeNode iDmtRoot) {
- super(iDmtRoot);
- treeModel = (DefaultTreeModel) this.getModel();
- }
-
- /**
- Get category of selected node
-
- @return The category of selected node
-
- **/
- public int getSelectCategory() {
- int intCategory = 0;
- TreePath path = this.getSelectionPath();
- IDefaultMutableTreeNode node = (IDefaultMutableTreeNode) path.getLastPathComponent();
- intCategory = node.getCategory();
- return intCategory;
- }
-
- /**
- Add input node as child node for current selected node
-
- @param strNewNode The name of the node which need be added
-
- **/
- public void addNode(String strNewNode) {
- DefaultMutableTreeNode parentNode = null;
- DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(strNewNode);
- newNode.setAllowsChildren(true);
- TreePath parentPath = this.getSelectionPath();
-
- /**
- * Get parent node of new node
- */
- parentNode = (DefaultMutableTreeNode) (parentPath.getLastPathComponent());
-
- /**
- * Insert new node
- */
- treeModel.insertNodeInto(newNode, parentNode, parentNode.getChildCount());
- this.scrollPathToVisible(new TreePath(newNode.getPath()));
- }
-
- /**
- Add input node as child node for current selected node
-
- @param newNode The node need be added
-
- **/
- public void addNode(IDefaultMutableTreeNode newNode) {
- IDefaultMutableTreeNode parentNode = null;
- newNode.setAllowsChildren(true);
- TreePath parentPath = this.getSelectionPath();
- parentNode = (IDefaultMutableTreeNode) (parentPath.getLastPathComponent());
- treeModel.insertNodeInto(newNode, parentNode, parentNode.getChildCount());
- this.scrollPathToVisible(new TreePath(newNode.getPath()));
- }
-
- /**
- Add input node as child node for current selected node
-
- @param newNode The node need be added
-
- **/
- public void addNode(IDefaultMutableTreeNode parentNode, IDefaultMutableTreeNode newNode) {
- treeModel.insertNodeInto(newNode, parentNode, parentNode.getChildCount());
- this.scrollPathToVisible(new TreePath(newNode.getPath()));
- }
-
- /**
- Remove the selected node
-
- @param strRemovedNode
-
- **/
- public void removeSelectedNode() {
- TreePath treePath = this.getSelectionPath();
- removeNodeByPath(treePath);
- }
-
- /**
- Remove the node by tree path
-
- @param strRemovedNode
-
- **/
- public void removeNodeByPath(TreePath treePath) {
- if (treePath != null) {
- DefaultMutableTreeNode selectionNode = (DefaultMutableTreeNode) treePath.getLastPathComponent();
- TreeNode parent = (TreeNode) selectionNode.getParent();
- if (parent != null) {
- treeModel.removeNodeFromParent(selectionNode);
- }
- }
- }
-
- /**
- Return a node by input tree path
-
- @param treePath
- @return
-
- **/
- public IDefaultMutableTreeNode getNodeByPath(TreePath treePath) {
- if (treePath != null) {
- IDefaultMutableTreeNode selectionNode = (IDefaultMutableTreeNode) treePath.getLastPathComponent();
- return selectionNode;
- }
- return null;
- }
-
- /**
- Remove all child nodes under current node
-
- **/
- public void removeNodeChildrenByPath(TreePath treePath) {
- if (treePath != null) {
- DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) treePath.getLastPathComponent();
- for (int index = currentNode.getChildCount() - 1; index > -1; index--) {
- treeModel.removeNodeFromParent((DefaultMutableTreeNode) currentNode.getChildAt(index));
- }
- }
- }
-
- /**
- Remove all nodes of the tree
-
- **/
- public void removeAllNode() {
- DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode) treeModel.getRoot();
- rootNode.removeAllChildren();
- treeModel.reload();
- }
-
- public IDefaultMutableTreeNode getSelectNode() {
- TreePath treepath = this.getSelectionPath();
- IDefaultMutableTreeNode selectionNode = null;
- if (treepath != null) {
- selectionNode = (IDefaultMutableTreeNode) treepath.getLastPathComponent();
- }
- return selectionNode;
- }
-
- public IDefaultMutableTreeNode getNodeById(IDefaultMutableTreeNode node, Identification id) {
- for (int index = 0; index < node.getChildCount(); index++) {
- IDefaultMutableTreeNode iNode = (IDefaultMutableTreeNode) node.getChildAt(index);
- if (iNode.getId().equals(id)) {
- return iNode;
- }
- }
- return null;
- }
-
- public IDefaultMutableTreeNode getNodeById(IDefaultMutableTreeNode node, Identification id, int category) {
- for (int index = 0; index < node.getChildCount(); index++) {
- IDefaultMutableTreeNode iNode = (IDefaultMutableTreeNode) node.getChildAt(index);
- if (iNode.getId().equals(id) && iNode.getCategory() == category) {
- return iNode;
- }
- IDefaultMutableTreeNode childNode = getNodeById(iNode, id, category);
- if (childNode != null) {
- return childNode;
- }
- }
- return null;
- }
-
- public TreePath getPathOfNode(IDefaultMutableTreeNode node) {
- if (node != null) {
- TreePath treePath = new TreePath(treeModel.getPathToRoot(node));
- return treePath;
- }
- return null;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/StarLabel.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/StarLabel.java deleted file mode 100644 index 3641df0373..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/StarLabel.java +++ /dev/null @@ -1,64 +0,0 @@ -/** @file
-
- The file is used to override JLabel to provides customized interfaces
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.common.ui;
-
-import javax.swing.JLabel;
-
-/**
- The class is used to override JLabel to provides customized interfaces
-
-
-
- **/
-public class StarLabel extends JLabel {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -6702981027831543919L;
-
- /**
- Main class, reserved for test
-
- @param args
-
- **/
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- This is the default constructor
-
- **/
- public StarLabel() {
- super();
- init();
- }
-
- /**
- To create a RED, BOLD and 14 size "*"
-
- **/
- private void init() {
- this.setText("*");
- this.setSize(new java.awt.Dimension(10, 20));
- this.setForeground(java.awt.Color.red);
- this.setFont(new java.awt.Font("DialogInput", java.awt.Font.BOLD, 14));
- this.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxList.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxList.java deleted file mode 100644 index 6fbdf03ddd..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxList.java +++ /dev/null @@ -1,203 +0,0 @@ -/** @file
-
- The file is used to override JList to create a List with CheckBox item
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.ui.iCheckBoxList;
-
-import java.util.Vector;
-
-import javax.swing.JList;
-
-public class ICheckBoxList extends JList {
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -2843059688070447632L;
-
- protected ICheckBoxListCellRenderer cellrenderer = new ICheckBoxListCellRenderer();
-
- protected ICheckBoxListener listener = new ICheckBoxListener(this);
-
- protected ICheckBoxListModel model = new ICheckBoxListModel();
-
- /**
- This the default Constructor
-
- **/
- public ICheckBoxList() {
- this(null);
- }
-
- /**
- This the override constructor to create checkbox item with input vector
-
- @param options
-
- **/
- public ICheckBoxList(Vector<ICheckBoxListItem> items) {
- if (items != null) {
- for (int index = 0; index < items.size(); index++) {
- model.addElement(items.elementAt(index));
- }
- }
-
- //
- // If there exists at least one item, set first item selected.
- //
- if (model.size() > 0) {
- ICheckBoxListItem listItem = (ICheckBoxListItem) model.get(0);
- listItem.setSelected(true);
- }
- this.setCellRenderer(cellrenderer);
- this.setModel(model);
- this.addMouseListener(listener);
- this.addKeyListener(listener);
- }
-
- /**
- Set all items of the CheckBoxList component.
-
- @param items
-
- **/
- public void setAllItems(Vector<String> items) {
- if (items != null) {
- model.removeAllElements();
- for (int index = 0; index < items.size(); index++) {
- model.addElement(new ICheckBoxListItem(items.elementAt(index)));
- }
- }
-
- //
- // If there exists at least one item, set first item selected.
- //
- if (model.size() > 0) {
- ICheckBoxListItem listItem = (ICheckBoxListItem) model.get(0);
- listItem.setSelected(true);
- }
- }
-
- /**
- Get All Checked Items of the CheckBoxList component.
-
- @return All Checked Items
- **/
- public Vector<ICheckBoxListItem> getAllCheckedItems() {
- Vector<ICheckBoxListItem> result = new Vector<ICheckBoxListItem>();
-
- for (int i = 0; i < this.getModel().getSize(); i++) {
- if (((ICheckBoxListItem) this.getModel().getElementAt(i)).isChecked()) {
- result.addElement((ICheckBoxListItem) this.getModel().getElementAt(i));
- }
- }
- return result;
- }
-
- /**
- Get All Checked Items index of the CheckBoxList component.
-
- @return All Checked Items index
- **/
- public Vector<Integer> getAllCheckedItemsIndex() {
- Vector<Integer> result = new Vector<Integer>();
-
- for (int i = 0; i < this.getModel().getSize(); i++) {
- if (((ICheckBoxListItem) this.getModel().getElementAt(i)).isChecked()) {
- result.addElement(i);
- }
- }
- return result;
- }
-
- /**
- Get All Checked Items String of the CheckBoxList component.
-
- @return Vector
- **/
- public Vector<String> getAllCheckedItemsString() {
- Vector<String> result = new Vector<String>();
-
- for (int i = 0; i < this.getModel().getSize(); i++) {
- if (((ICheckBoxListItem) this.getModel().getElementAt(i)).isChecked()) {
- result.addElement(((ICheckBoxListItem) this.getModel().getElementAt(i)).text);
- }
- }
- return result;
- }
-
- /**
- Get All Items String of the CheckBoxList component.
-
- @return Vector
- **/
- public Vector<String> getAllItemsString() {
- Vector<String> result = new Vector<String>();
-
- for (int i = 0; i < this.getModel().getSize(); i++) {
- result.addElement(((ICheckBoxListItem) this.getModel().getElementAt(i)).text);
- }
- return result;
- }
-
- /**
- Set Checked status for all input items.
-
- **/
- public void initCheckedItem(boolean bool, Vector<String> items) {
- if (items != null && items.size() != 0) {
- for (int indexI = 0; indexI < items.size(); indexI++) {
- for (int indexJ = 0; indexJ < model.size(); indexJ++) {
- if (items.elementAt(indexI).equals(model.getAllElements().elementAt(indexJ).getText())) {
- ICheckBoxListItem listItem = (ICheckBoxListItem) model.get(indexJ);
- listItem.setChecked(bool);
- break;
- }
- }
- }
- }
-
- //
- // If there exists at least one item, set first item selected.
- //
- if (model.size() > 0) {
- ICheckBoxListItem listItem = (ICheckBoxListItem) model.get(0);
- listItem.setSelected(true);
- }
-
- this.validate();
- }
-
- /**
- Set all items of the compontent checked
-
- **/
- public void setAllItemsChecked() {
- initCheckedItem(true, this.getAllItemsString());
- }
-
- /**
- Set all items of the compontent unchecked
-
- **/
- public void setAllItemsUnchecked() {
- initCheckedItem(false, this.getAllItemsString());
- }
-
- /**
- Remove all items of list
-
- **/
- public void removeAllItem() {
- model.removeAllElements();
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListCellRenderer.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListCellRenderer.java deleted file mode 100644 index 1b022fc908..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListCellRenderer.java +++ /dev/null @@ -1,76 +0,0 @@ -/** @file
-
- The file is used to create cell renderer for CheckBoxList Item
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.ui.iCheckBoxList;
-
-import java.awt.*;
-import javax.swing.*;
-import javax.swing.border.*;
-
-class ICheckBoxListCellRenderer extends JCheckBox implements ListCellRenderer {
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -1718072217181674870L;
-
- protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);
-
- /**
- This is the default Constructor
-
- **/
- public ICheckBoxListCellRenderer() {
- super();
- setOpaque(true);
- setBorder(noFocusBorder);
- }
-
- /* (non-Javadoc)
- * @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
- * Override to get attribute of the ICheckListCellRenderer
- *
- */
- public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
- boolean cellHasFocus) {
- ICheckBoxListItem item = (ICheckBoxListItem) value;
-
- setComponentOrientation(list.getComponentOrientation());
-
- if (item.isChecked()) {
- setBackground(list.getSelectionBackground());
- setForeground(list.getSelectionForeground());
- } else {
- if (isSelected) {
- setBackground(Color.LIGHT_GRAY);
- setForeground(list.getForeground());
- } else {
- setBackground(list.getBackground());
- setForeground(list.getForeground());
- }
- }
-
- if (value instanceof ICheckBoxListItem) {
- setText(item.getText());
- setSelected(item.isChecked());
- } else {
- setIcon(null);
- setText((value == null) ? "" : value.toString());
- }
-
- setEnabled(list.isEnabled());
- setFont(list.getFont());
-
- return this;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListItem.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListItem.java deleted file mode 100644 index a087887e2f..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListItem.java +++ /dev/null @@ -1,84 +0,0 @@ -/** @file
-
- The file is used to create list item for CheckBox list
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.ui.iCheckBoxList;
-
-public class ICheckBoxListItem {
-
- //
- // Define Class Members
- //
- protected String text;
-
- protected boolean checked;
-
- protected boolean selected;
-
- /**
- This is the default constructor to set check box item string
-
- @param text
-
- **/
- public ICheckBoxListItem(String text) {
- this.text = text;
- }
-
- /**
- This is the override constructor to set check box item string and checked status
-
- @param text
- @param checked
-
- **/
- public ICheckBoxListItem(String text, boolean checked) {
- this.text = text;
- this.checked = checked;
- }
-
- /**
- set the checked status
- if true, set false
- if false, set true
-
- **/
- public void invertChecked() {
- checked = !checked;
- }
-
- public boolean isChecked() {
- return checked;
- }
-
- public void setChecked(boolean checked) {
- this.checked = checked;
- }
-
- public String getText() {
- return text;
- }
-
- public void setText(String text) {
- this.text = text;
- }
-
- public boolean isSelected() {
- return selected;
- }
-
- public void setSelected(boolean selected) {
- this.selected = selected;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListModel.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListModel.java deleted file mode 100644 index f3bbe8a3a0..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListModel.java +++ /dev/null @@ -1,67 +0,0 @@ -/** @file
-
- The file is used to override DefaultListModel to create ICheckBoxListModel
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.ui.iCheckBoxList;
-
-import javax.swing.*;
-import java.util.Vector;
-
-public class ICheckBoxListModel extends DefaultListModel {
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -8617800969723991017L;
-
- /**
- This is the default Constructor for the CheckBoxListModel object
-
- **/
- public ICheckBoxListModel() {
- }
-
- /**
- override DefaultListModel's add method
-
- @param index
- @param item
-
- **/
- public void add(int index, ICheckBoxListItem item) {
- super.add(index, item);
- }
-
- /**
- Add one item at tail
-
- @param item
-
- **/
- public void addElement(ICheckBoxListItem item) {
- super.addElement(item);
- }
-
- /**
- Get all elements of the list
-
- **/
- public Vector<ICheckBoxListItem> getAllElements() {
- Vector<ICheckBoxListItem> items = new Vector<ICheckBoxListItem>();
- ICheckBoxListItem[] objs = new ICheckBoxListItem[this.size()];
- this.copyInto(objs);
- for (int i = 0; i < size(); i++) {
- items.addElement(objs[i]);
- }
- return items;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListener.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListener.java deleted file mode 100644 index e95d279e59..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListener.java +++ /dev/null @@ -1,104 +0,0 @@ -/** @file
-
- The file is used to create listener for Checkbox List
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common.ui.iCheckBoxList;
-
-import java.awt.event.*;
-
-class ICheckBoxListener implements MouseListener, KeyListener {
-
- protected ICheckBoxList iCheckboxlist;
-
- /**
- This is the default constructor
-
- @param parent
-
- **/
- public ICheckBoxListener(ICheckBoxList parent) {
- iCheckboxlist = parent;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)
- * Override to deal with keyReleased event
- *
- *
- */
- public void keyReleased(KeyEvent e) {
- Object[] selectedValues = iCheckboxlist.getSelectedValues();
- int[] selectedIndices = iCheckboxlist.getSelectedIndices();
-
- for (int index = 0; index < selectedValues.length; index++) {
- ICheckBoxListItem item = (ICheckBoxListItem) selectedValues[index];
-
- if (iCheckboxlist.isEnabled()) {
- if (e.getKeyCode() == KeyEvent.VK_SPACE) {
- //
- //if press space key, then reverse all selected item.
- //
- item.invertChecked();
- }
- ((ICheckBoxListModel) iCheckboxlist.getModel()).setElementAt(item, selectedIndices[index]);
- }
- }
- }
-
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- * Override to deal with mouse clicked event
- *
- */
- public void mouseClicked(MouseEvent e) {
- int index = iCheckboxlist.locationToIndex(e.getPoint());
- ICheckBoxListItem item = null;
- item = (ICheckBoxListItem) iCheckboxlist.getModel().getElementAt(index);
-
- if (item != null && iCheckboxlist.isEnabled()) {
- item.invertChecked();
- ((ICheckBoxListModel) iCheckboxlist.getModel()).setElementAt(item, index);
- }
- }
-
- public void mousePressed(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void keyPressed(KeyEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public void keyTyped(KeyEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/AggregationOperation.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/AggregationOperation.java deleted file mode 100644 index b8a6d40b0e..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/AggregationOperation.java +++ /dev/null @@ -1,86 +0,0 @@ -/** @file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.far;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class AggregationOperation {
-
- public static synchronized List<PackageIdentification> union(List<PackageIdentification> list1,
- List<PackageIdentification> list2) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- result.addAll(list1);
- Iterator<PackageIdentification> iter = list2.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- if (!belongs(item, result)) {
- result.add(item);
- }
- }
- return result;
- }
-
- public static synchronized List<PackageIdentification> intersection(List<PackageIdentification> list1,
- List<PackageIdentification> list2) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- Iterator<PackageIdentification> iter = list1.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- if (belongs(item, list2)) {
- result.add(item);
- }
- }
- return result;
- }
-
- public static synchronized List<PackageIdentification> minus(List<PackageIdentification> list1,
- List<PackageIdentification> list2) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- Iterator<PackageIdentification> iter = list1.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- if (!belongs(item, list2)) {
- result.add(item);
- }
- }
- return result;
- }
-
- public static synchronized boolean belongs(PackageIdentification o, List<PackageIdentification> list) {
- Iterator<PackageIdentification> iter = list.iterator();
- while (iter.hasNext()) {
- if (iter.next().equalsWithGuid(o)) {
- return true;
- }
- }
- return false;
- }
-
- public static synchronized List<PackageIdentification> getExistedItems(PackageIdentification o,
- List<PackageIdentification> list) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- Iterator<PackageIdentification> iter = list.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- if (item.equalsWithGuid(o)) {
- result.add(item);
- }
- }
- return result;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/DistributeRule.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/DistributeRule.java deleted file mode 100644 index 730e385c74..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/DistributeRule.java +++ /dev/null @@ -1,89 +0,0 @@ -/** @file
-
- The file is used to distribute Far
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class DistributeRule {
- static PackageQuery pkgQ = new PackageQuery();
-
- static WorkspaceTools wsTools = new WorkspaceTools();
-
- static List<PackageIdentification> farPkgList = new ArrayList<PackageIdentification>();
-
- public static List<PackageIdentification> installFarCheck(Far far) {
-
- Far myFar = far;
- List<PackageIdentification> pkgDepList = new ArrayList<PackageIdentification>();
- List<PackageIdentification> dbPkgList = new ArrayList<PackageIdentification>();
- List<PackageIdentification> depResultList = new ArrayList<PackageIdentification>();
- //
- // Get Far packages list;
- //
- try {
- farPkgList = myFar.manifest.getPackageList();
- Iterator pkgItems = farPkgList.iterator();
- while (pkgItems.hasNext()) {
- PackageIdentification id = (PackageIdentification) pkgItems.next();
- pkgDepList = myFar.getPackageDependencies(id);
- depResultList = AggregationOperation.union(depResultList, pkgDepList);
- }
- dbPkgList = vectorToList(wsTools.getAllPackages());
-
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
-
- //
- // Check does the dependence meet the requirement.
- //
- List<PackageIdentification> resultList = AggregationOperation.minus(depResultList,
- AggregationOperation.union(farPkgList,
- dbPkgList));
-
- return resultList;
-
- }
-
- // public void installPackgCheck (PackageIdentification pkgId, String pkgPath){
- // List<PackageIdentification> dbPkgList = new ArrayList<PackageIdentification>();
- // dbPkgList = vectorToList(wsTools.getAllPackages());
- // //
- // // Install far's package one by one.
- // //
- // if ((AggregationOperation.getExistItems(pkgId, dbPkgList))){
- //
- // }
- // }
-
- public void UpdatCheck(String orgFar, String destFar) {
-
- }
-
- public static List<PackageIdentification> vectorToList(Vector vec) {
- List<PackageIdentification> set = new ArrayList<PackageIdentification>();
- Iterator vecItem = vec.iterator();
- while (vecItem.hasNext()) {
- set.add((PackageIdentification) vecItem.next());
- }
- return set;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Far.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Far.java deleted file mode 100644 index ad04dc7fcd..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Far.java +++ /dev/null @@ -1,261 +0,0 @@ -/** @file
-
- The file is used to create far file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.JarOutputStream;
-
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-public class Far {
- //
- // Class member Manifest
- //
- public Manifest manifest = null;
-
- //
- // Jar file
- //
- private JarFile jf = null;
-
- private File jarFile = null;
-
- //
- // Jar outputStream.
- //
- static public JarOutputStream jos = null;
-
- public Far(File jarFile) {
- this.jarFile = jarFile;
- }
-
- //
- // For install/updat jar
- //
- public Far(JarFile farFile) throws Exception {
- jf = farFile;
- this.manifest = new Manifest(getManifestFile());
- }
-
- public void creatFar(List<PackageIdentification> pkgList, List<PlatformIdentification> plfList,
- Set<String> fileFilter, FarHeader fHeader) throws Exception {
- jos = new JarOutputStream(new FileOutputStream(jarFile));
-
- //
- // Generate Manifest and get file lists
- //
- this.manifest = new Manifest();
- this.manifest.setFarHeader(fHeader);
- this.manifest.createManifest(pkgList, plfList, fileFilter);
-
- this.manifest.hibernateToFile();
-
- //
- // Write Mainifest file to JAR.
- //
- if (this.manifest.mfFile != null) {
- writeToJar(this.manifest.mfFile, jos);
- }
-
- //
- // Write all files to JAR
- //
- Set<File> files = this.manifest.files;
- Iterator<File> iter = files.iterator();
- while (iter.hasNext()) {
- writeToJar(iter.next(), jos);
- }
- jos.close();
- }
-
- private void writeToJar(File file, JarOutputStream jos) throws Exception {
- byte[] buffer = new byte[(int) file.length()];
- FileInputStream fInput = new FileInputStream(file);
- JarEntry entry = new JarEntry(
- Tools
- .convertPathToUnixType(Tools
- .getRelativePath(file.getPath(),
- Workspace.getCurrentWorkspace())));
- jos.putNextEntry(entry);
- fInput.read(buffer);
- jos.write(buffer);
- fInput.close();
- }
-
- public void InstallFar(String dir) throws Exception {
- List<FarFileItem> allFile = manifest.getAllFileItem();
- extract(allFile, dir);
- }
-
- public void InstallFar(Map<PlatformIdentification, File> plfMap, Map<PackageIdentification, File> pkgMap)
- throws Exception {
- Set<PlatformIdentification> plfKeys = plfMap.keySet();
- Iterator<PlatformIdentification> plfIter = plfKeys.iterator();
- while (plfIter.hasNext()) {
- PlatformIdentification item = plfIter.next();
- extract(this.manifest.getPlatformContents(item), plfMap.get(item).getPath());
- }
-
- Set<PackageIdentification> pkgKeys = pkgMap.keySet();
- Iterator<PackageIdentification> pkgIter = pkgKeys.iterator();
- while (pkgIter.hasNext()) {
- PackageIdentification item = pkgIter.next();
- installPackage(item, pkgMap.get(item));
- }
- jf.close();
- }
-
- public void installPackage(PackageIdentification packageId, File installPath) throws Exception {
- List<FarFileItem> contents = this.manifest.getPackageContents(packageId);
- extract(contents, installPath.getPath());
- }
-
- public InputStream getManifestFile() throws Exception {
- JarEntry je = null;
- for (Enumeration e = jf.entries(); e.hasMoreElements();) {
- je = (JarEntry) e.nextElement();
- if (je.getName().equalsIgnoreCase(Manifest.mfFileName))
- return jf.getInputStream(je);
- }
- return null;
- }
-
- public void createFar() {
-
- }
-
- public boolean hibernateToFile() {
- return true;
- }
-
- public void extract(List<FarFileItem> allFile, String dir) throws Exception {
-
- Iterator filesItem = allFile.iterator();
- FarFileItem ffItem;
- JarEntry je;
- new File(dir).mkdirs();
- dir += File.separatorChar;
- while (filesItem.hasNext()) {
- try {
- ffItem = (FarFileItem) filesItem.next();
- je = jf.getJarEntry(Tools.convertPathToUnixType(ffItem.getDefaultPath()));
- InputStream entryStream = jf.getInputStream(je);
- File file = new File(dir + ffItem.getRelativeFilename());
- file.getParentFile().mkdirs();
- try {
- //
- // Create the output file (clobbering the file if it
- // exists).
- //
- FileOutputStream outputStream = new FileOutputStream(file);
-
- try {
- //
- // Read the entry data and write it to the output
- // file.
- //
- int fileLen = (int)je.getSize();
- byte[] buffer = new byte[fileLen];
- int len = entryStream.read(buffer);
- if (len < fileLen){
- File tempFile = new File("tempFile");
- FileOutputStream fos = new FileOutputStream(tempFile);
- fos.write(buffer, 0, len);
- while (len < fileLen){
- int tempLen = entryStream.read(buffer);
- len = len + tempLen;
- fos.write(buffer, 0, tempLen);
- }
- fos.close();
- FileInputStream fin = new FileInputStream(tempFile);
- fin.read(buffer);
- tempFile.delete();
- }
- //
- // Check Md5
- //
- if (!ffItem.getMd5Value().equalsIgnoreCase(FarMd5.md5(buffer))){
- throw new Exception (ffItem.getRelativeFilename() + " MD5 Checksum is invaild!");
- }
- outputStream.write(buffer);
- } finally {
- outputStream.close();
- }
- } finally {
- entryStream.close();
- }
-
- } finally {
- }
- }
-
- }
-
- public void addFileToFar(File file, JarOutputStream farOuputStream, String workDir) {
-
- }
-
- /**
- *
- * @param pkgId
- * @return
- */
- public List<PackageIdentification> getPackageDependencies(PackageIdentification pkgId) {
- String[] entry = new String[2];
- PackageQuery pkgQ = new PackageQuery();
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
-
- entry = this.manifest.getPackgeSpd(pkgId);
- if (entry == null) {
- return result;
- }
- if (entry[0] != null) {
- try {
- JarEntry je;
- je = jf.getJarEntry(Tools.convertPathToUnixType(entry[1] + File.separatorChar + entry[0]));
- List<String> masList = pkgQ.getPackageMsaList(jf.getInputStream(je));
- Iterator item = masList.iterator();
- while (item.hasNext()) {
- je = jf.getJarEntry(Tools.convertPathToUnixType(entry[1] + File.separatorChar + item.next()));
- List<PackageIdentification> pkgIdList = pkgQ.getModuleDependencies(jf.getInputStream(je));
- Iterator pkgItem = pkgIdList.iterator();
- while (pkgItem.hasNext()) {
- PackageIdentification id = (PackageIdentification) pkgItem.next();
- if (!AggregationOperation.belongs(id, result)) {
- result.add(id);
- }
- }
- }
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
- }
- return result;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarFileItem.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarFileItem.java deleted file mode 100644 index 0e6cc4a679..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarFileItem.java +++ /dev/null @@ -1,54 +0,0 @@ -/** @file
-
- The file is used to save information of <FarFile> item.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-public class FarFileItem {
-
- private String relativeFilename;
-
- private String md5Value;
-
- private String defaultPath;
-
- public FarFileItem(String relativeFilename, String md5Value) {
- this.relativeFilename = relativeFilename;
- this.md5Value = md5Value;
- }
-
- public String getMd5Value() {
- return md5Value;
- }
-
- public String getRelativeFilename() {
- return relativeFilename;
- }
-
- public void setMd5Value(String md5Value) {
- this.md5Value = md5Value;
- }
-
- public void setRelativeFilename(String relativeFilename) {
- this.relativeFilename = relativeFilename;
- }
-
- public String getDefaultPath() {
- return defaultPath;
- }
-
- public void setDefaultPath(String defaultPath) {
- this.defaultPath = defaultPath;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarHeader.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarHeader.java deleted file mode 100644 index dd4f22690e..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarHeader.java +++ /dev/null @@ -1,100 +0,0 @@ -/** @file
-
- The file is used to save <farPackage> information.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-public class FarHeader {
- //
- // class member
- //
- private String farName;
-
- private String guidValue;
-
- private String version;
-
- private String abstractStr;
-
- private String description;
-
- private String copyright;
-
- private String license;
-
- private String specification;
-
- public String getAbstractStr() {
- return abstractStr;
- }
-
- public void setAbstractStr(String abstractStr) {
- this.abstractStr = abstractStr;
- }
-
- public String getCopyright() {
- return copyright;
- }
-
- public void setCopyright(String copyright) {
- this.copyright = copyright;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getFarName() {
- return farName;
- }
-
- public void setFarName(String farName) {
- this.farName = farName;
- }
-
- public String getGuidValue() {
- return guidValue;
- }
-
- public void setGuidValue(String guidValue) {
- this.guidValue = guidValue;
- }
-
- public String getLicense() {
- return license;
- }
-
- public void setLicense(String license) {
- this.license = license;
- }
-
- public String getSpecification() {
- return specification;
- }
-
- public void setSpecification(String specification) {
- this.specification = specification;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarIdentification.java deleted file mode 100644 index babc9e3d92..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarIdentification.java +++ /dev/null @@ -1,58 +0,0 @@ -/** @file
-
- The file is used to save information of Far item.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-public class FarIdentification {
-
- private String guid;
-
- private String md5Value;
-
- private String path;
-
- public FarIdentification(String guid, String md5Value, String path) {
- this.guid = guid;
- this.md5Value = md5Value;
- this.path = path;
- }
-
- public String getGuid() {
- return guid;
- }
-
- public void setGuid(String guid) {
- this.guid = guid;
- }
-
- public String getMd5Value() {
- return md5Value;
- }
-
- public void setMd5Value(String md5Value) {
- this.md5Value = md5Value;
- }
-
- public String getPath() {
- return path;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- public String toString() {
- return path + " [" + guid + "]";
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarInterface.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarInterface.java deleted file mode 100644 index 04a2fb0a35..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarInterface.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.tianocore.frameworkwizard.far;
-
-import java.io.Reader;
-import java.util.Map;
-import java.util.Set;
-
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-public interface FarInterface {
-
- public Reader getManifestFile();
-
- public void hibernateToFile();
-
- public boolean extract(Map<PackageIdentification, String> packagePathes,
- Map<PlatformIdentification, String> platformPathes);
-
- public Set<PackageIdentification> getPackageDependencies(PackageIdentification packageId);
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarMd5.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarMd5.java deleted file mode 100644 index 0269fcf6cd..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarMd5.java +++ /dev/null @@ -1,40 +0,0 @@ -/** @file
-
- The file is used to caculate file MD5 value.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.security.MessageDigest;
-
-public class FarMd5 {
-
- static public String md5(File file) throws Exception {
- byte[] buffer = new byte[(int) file.length()];
- FileInputStream fInput = new FileInputStream(file);
- fInput.read(buffer);
- fInput.close();
- return md5(buffer);
-
- }
-
- static public String md5(byte[] buffer) throws Exception {
- MessageDigest md = MessageDigest.getInstance("MD5");
- byte[] md5 = md.digest(buffer);
- return new String(String.format("%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", md5[0], md5[1], md5[2], md5[3], md5[4],
- md5[5], md5[6], md5[7], md5[8], md5[9], md5[10], md5[11], md5[12], md5[13],
- md5[14], md5[15]));
-
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPackage.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPackage.java deleted file mode 100644 index aca9041c78..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPackage.java +++ /dev/null @@ -1,93 +0,0 @@ -/** @file
-
- The file is used to save <farPackage> information.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-import java.util.List;
-
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class FarPackage {
- //
- // Class member
- //
- private FarFileItem farFile;
-
- private String guidValue;
-
- private String version;
-
- private String defaultPath;
-
- private List<FarPlatformItem> farPlatformList;
-
- private List<FarFileItem> contentList;
-
- public String getDefaultPath() {
- return defaultPath;
- }
-
- public void setDefaultPath(String defaultPath) {
- this.defaultPath = defaultPath;
- }
-
- public FarFileItem getFarFile() {
- return farFile;
- }
-
- public void setFarFile(FarFileItem farFile) {
- this.farFile = farFile;
- }
-
- public List<FarPlatformItem> getFarPlatformList() {
- return farPlatformList;
- }
-
- public void setFarPlatformList(List<FarPlatformItem> farPlatformList) {
- this.farPlatformList = farPlatformList;
- }
-
- public String getGuidValue() {
- return guidValue;
- }
-
- public void setGuidValue(String guidValue) {
- this.guidValue = guidValue;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public List<FarFileItem> getContentList() {
- return this.contentList;
- }
-
- public void setContentList(List<FarFileItem> contentList) {
- this.contentList = contentList;
- }
-
- public boolean isIdentityPkg(PackageIdentification pkgId) {
- //File file = new File(farFile.getRelativeFilename());
- if (pkgId.getGuid().equalsIgnoreCase(guidValue) && pkgId.getVersion().equalsIgnoreCase(version)) {
- return true;
- }
- return false;
-
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPlatformItem.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPlatformItem.java deleted file mode 100644 index e3c2f1c733..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPlatformItem.java +++ /dev/null @@ -1,60 +0,0 @@ -/** @file
-
- The file is used to save <farPlatform> information.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-public class FarPlatformItem {
- //
- // class member
- //
- private FarFileItem farFile;
-
- private String guidValue;
-
- private String version;
-
- public FarFileItem getFarFile() {
- return farFile;
- }
-
- public void setFarFile(FarFileItem farFile) {
- this.farFile = farFile;
- }
-
- public String getGuidValue() {
- return guidValue;
- }
-
- public void setGuidValue(String guidValue) {
- this.guidValue = guidValue;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public boolean isIdentityPlf(PlatformIdentification plfId) {
- if (plfId.getGuid() == guidValue && plfId.getVersion() == version) {
- return true;
- }
- return false;
-
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarStringDefinition.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarStringDefinition.java deleted file mode 100644 index bd1b7942f3..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarStringDefinition.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.tianocore.frameworkwizard.far;
-
-public class FarStringDefinition {
-
- ///
- /// Definition for all step's title string
- ///
- public static final String CREATE_STEP_ONE_TITLE =
- "Create Framework Archive(FAR) - Step 1: Set FAR's basic information";
- public static final String CREATE_STEP_TWO_TITLE =
- "Create Framework Archive(FAR) - Step 2: Choose Packages and/or Platforms";
- public static final String CREATE_STEP_THREE_TITLE =
- "Create Framework Archive(FAR) - Step 3: Set file filter";
- public static final String CREATE_STEP_FOUR_TITLE =
- "Create Framework Archive(FAR) - Step 4: Choose target file and finish";
-
- public static final String DELETE_STEP_ONE_TITLE =
- "Delete Framework Archive(FAR) - Step 1: Choose FAR from current WORKSPACE";
- public static final String DELETE_STEP_TWO_TITLE =
- "Delete Framework Archive(FAR) - Step 2: Choose delete mode and finish";
-
- public static final String UPDATE_STEP_ONE_TITLE =
- "Update Framework Archive(FAR) - Step 1: Browse FAR file";
- public static final String UPDATE_STEP_TWO_TITLE =
- "Update Framework Archive(FAR) - Step 2: Summary";
-
- public static final String INSTALL_STEP_ONE_TITLE =
- "Install Framework Archive(FAR) - Step 1: Select FAR file";
- public static final String INSTALL_STEP_TWO_TITLE =
- "Install Framework Archive(FAR) - Step 2: Set path for packages and/or platforms";
-
- ///
- ///
- ///
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Manifest.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Manifest.java deleted file mode 100644 index 89fb5b6d42..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Manifest.java +++ /dev/null @@ -1,960 +0,0 @@ -/** @file
-
- The file is used to create Far's manifest file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class Manifest implements ManifestInterface {
- // /
- // / manifest document
- // /
- Document manifestDoc = null;
-
- // /
- // / Manfiest file element name
- // /
- final static String mfFileName = "FrameworkArchiveManifest.xml";
-
- //
- // Header
- //
- final static String farHeader = "FarHeader";
-
- final static String farHeader_FarName = "FarName";
-
- final static String farHeader_Abstract = "Abstract";
-
- final static String farHeader_Description = "Description";
-
- final static String farHeader_CopyRight = "Copyright";
-
- final static String farHeader_License = "License";
-
- final static String farHeader_Specification = "Specification";
-
- //
- // Package list
- //
- final static String farPackageList = "FarPackageList";
-
- final static String farPlatformList = "FarPlatformList";
-
- final static String contents = "Contents";
-
- final static String userExtensions = "UserExtensions";
-
- //
- // Common node name
- //
-
- final static String guidValue = "GuidValue";
-
- final static String version = "Version";
-
- //
- // FarPackage node name
- //
- final static String farPackageList_FarPackage = "FarPackage";
-
- final static String farPackage_FarfileName = "FarFilename";
-
- final static String farPackage_DefaultPath = "DefaultPath";
-
- final static String farPlatformList_FarPlatform = "FarPlatform";
-
- final static String farFileName_FarGuid = "FarGuid";
-
- final static String farFileName_Md5sum = "Md5sum";
-
- //
- // manifest header information.
- //
- FarHeader fhInfo = new FarHeader();
-
- //
- // FarPackage list
- //
- List<FarPackage> fPkgList = new ArrayList<FarPackage>();
-
- //
- // FarPlatform list
- //
- List<FarPlatformItem> fPlfList = new ArrayList<FarPlatformItem>();
-
- Set<File> files = new LinkedHashSet<File>();
-
- //
- // Manifest file
- //
- public File mfFile = null;
-
- public FarHeader getHeader() {
- return fhInfo;
- }
-
- public Manifest() throws Exception {
- DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
- DocumentBuilder dombuilder = domfac.newDocumentBuilder();
- Document document = dombuilder.newDocument();
- this.manifestDoc = document;
-
- }
-
- public Manifest(InputStream manifestInputStream) throws Exception {
- DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
- try {
- if (manifestInputStream != null) {
- DocumentBuilder dombuilder = domfac.newDocumentBuilder();
- this.manifestDoc = dombuilder.parse(manifestInputStream);
- parseManifest();
- }
-
- } catch (Exception e) {
- //
- // Will change to throw Wizader exception.
- //
- throw new Exception(e.getMessage());
- }
- }
-
- public void setFarHeader(FarHeader fHeader) {
- this.fhInfo = fHeader;
- }
-
- public void createManifest(List<PackageIdentification> pkgList, List<PlatformIdentification> plfList,
- Set<String> fileFilter) throws Exception {
-
- //
- // Add Package and it's contents to FarPackageList.
- //
- Iterator<PackageIdentification> pkgItem = pkgList.iterator();
- while (pkgItem.hasNext()) {
- PackageIdentification pkgId = pkgItem.next();
-
- //
- // Add package and it's contents to <FarPackageList>.
- //
- addPkgToPkgList(pkgId, fileFilter);
- }
-
- //
- // Add FarPlatform to this.farPlatformList.
- //
- Iterator<PlatformIdentification> plfItem = plfList.iterator();
- while (plfItem.hasNext()) {
- PlatformIdentification plfId = plfItem.next();
-
- //
- // Add platform to Mainifest.
- //
- addPlatformIdToFarPlatformItemList(plfId);
- }
- }
-
- public void setManifestFile(File manifestFile) throws Exception {
- DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
- DocumentBuilder dombuilder = domfac.newDocumentBuilder();
- InputStream is = new FileInputStream(manifestFile);
- this.manifestDoc = dombuilder.parse(is);
- }
-
- public void addPkgToPkgList(PackageIdentification packageId, Set<String> fileFilter) throws Exception {
- files.add(packageId.getSpdFile());
-
- FarPackage farPackage = new FarPackage();
- //
- // Add SPD file to FarPackage
- //
- File spdFile = new File(packageId.getPath());
-
- FarFileItem ffItem = new FarFileItem(spdFile.getName(), FarMd5.md5(spdFile));
- farPackage.setFarFile(ffItem);
-
- //
- // Add package guid value.
- //
- farPackage.setGuidValue(packageId.getGuid());
-
- //
- // Add package version
- //
- farPackage.setVersion(packageId.getVersion());
-
- //
- // Add DefaultPat: Package absoulte path - Workspace absolut
- // path.
- //
- String pkgDir = Tools.getFilePathOnly(packageId.getPath());
- File rootDir = new File(pkgDir);
- farPackage.setDefaultPath(Tools.getRelativePath(rootDir.getPath(), Workspace.getCurrentWorkspace()));
-
- //
- // Get package root dir contains.
- //
- Set<File> fileSet = new LinkedHashSet<File>();
- Set<File> fpdFileSet = new LinkedHashSet<File>();
-
- //
- // Get all files and fpd files
- //
- recursiveDirectory(fileSet, fpdFileSet, rootDir, fileFilter);
-
- //
- // Remove current package's SPD file
- //
- fileSet.remove(packageId.getSpdFile());
-
- files.addAll(fileSet);
-
- Iterator<File> iter = fileSet.iterator();
- List<FarFileItem> contents = new ArrayList<FarFileItem>();
- while (iter.hasNext()) {
- File normalFile = iter.next();
- String fileRelativePath = Tools.getRelativePath(normalFile.getPath(), pkgDir);
- ffItem = new FarFileItem(fileRelativePath, FarMd5.md5(normalFile));
- contents.add(ffItem);
- }
-
- farPackage.setContentList(contents);
-
- // List<FarPlatformItem> fpfList = new ArrayList<FarPlatformItem>();
- //
- // iter = fpdFileSet.iterator();
- //
- // while (iter.hasNext()) {
- // File fpdFile = iter.next();
- // PlatformIdentification platformId = new PlatformIdentification(wsTool
- // .getId(fpdFile.getPath(), OpenFile.openFpdFile(fpdFile
- // .getPath())));
- // addPlatformIdToFarPlatformItemList(fpfList, platformId);
- // }
- // farPackage.setFarPlatformList(fpfList);
- fPkgList.add(farPackage);
- }
-
- private void recursiveDirectory(Set<File> files, Set<File> fpds, File dir, Set<String> fileFilter) {
- if (isFilter(dir, fileFilter)) {
- return;
- }
- File[] allFilesInDir = dir.listFiles();
- for (int i = 0; i < allFilesInDir.length; i++) {
- if (allFilesInDir[i].isFile()) {
- if (isFilter(allFilesInDir[i], fileFilter)) {
- continue;
- }
- // if (allFilesInDir[i].getPath().toLowerCase().endsWith(".fpd")) {
- // fpds.add(allFilesInDir[i]);
- // } else {
- files.add(allFilesInDir[i]);
- // }
- } else {
- recursiveDirectory(files, fpds, allFilesInDir[i], fileFilter);
- }
- }
- }
-
- public void addPlatformIdToFarPlatformItemList(PlatformIdentification platformId) throws Exception {
- files.add(platformId.getFpdFile());
-
- FarPlatformItem fpfItem = new FarPlatformItem();
- FarFileItem ffItem;
- String fpfPath = platformId.getPath();
- File fpfFile = new File(fpfPath);
- //
- // Add farFileName
- //
- ffItem = new FarFileItem(Tools.getRelativePath(fpfFile.getPath(), Workspace.getCurrentWorkspace()),
- FarMd5.md5(fpfFile));
- fpfItem.setFarFile(ffItem);
-
- //
- // Add guid value
- //
- fpfItem.setGuidValue(platformId.getGuid());
-
- //
- // Add version
- //
- fpfItem.setVersion(platformId.getVersion());
-
- fPlfList.add(fpfItem);
- }
-
- /**
- *
- * @param
- * @return Set<PackageIdentification> list of PackageIdentification.
- */
- public List<PackageIdentification> getPackageList() throws Exception {
- //
- // PackageIdentification set.
- //
- List<PackageIdentification> pkgList = new ArrayList<PackageIdentification>();
- //
- //
- //
- Iterator pkgItem = this.fPkgList.iterator();
- while (pkgItem.hasNext()) {
- FarPackage fPkg = (FarPackage) pkgItem.next();
- //
- // Get package information from SPD file and create a package
- // identification.
- //
-
- PackageIdentification pkgId = new PackageIdentification(fPkg.getFarFile().getRelativeFilename(),
- fPkg.getGuidValue(), fPkg.getVersion());
- pkgId.setPath(Workspace.getCurrentWorkspace() + File.separatorChar + fPkg.getDefaultPath()
- + File.separatorChar + fPkg.getFarFile().getRelativeFilename());
- // wsTool.getId(
- // Workspace.getCurrentWorkspace() + File.separatorChar
- // + fPkg.getDefaultPath(), OpenFile
- // .openFpdFile(Workspace.getCurrentWorkspace()
- // + File.separatorChar
- // + fPkg.getDefaultPath()
- // + File.separatorChar
- // + fPkg.getFarFile().getRelativeFilename()));
- pkgList.add(pkgId);
- }
- return pkgList;
- }
-
- /**
- *
- */
- public List<PlatformIdentification> getPlatformList() throws Exception, IOException, XmlException {
- //
- // PlatformIdentification set.
- //
- List<PlatformIdentification> plfList = new ArrayList<PlatformIdentification>();
- Iterator plfItem = this.fPlfList.iterator();
- while (plfItem.hasNext()) {
- FarPlatformItem fpfItem = (FarPlatformItem) plfItem.next();
- File file = new File(Workspace.getCurrentWorkspace() + File.separatorChar
- + fpfItem.getFarFile().getRelativeFilename());
- //
- // Set platformIdentificaiton's path as absolutly path (include
- // workspace and FPD relatively path)
- //
- PlatformIdentification plfId = new PlatformIdentification(fpfItem.getFarFile().getRelativeFilename(),
- fpfItem.getGuidValue(), fpfItem.getVersion(),
- file.getPath());
-
- // (PlatformIdentification) wsTool
- // .getId(file.getParent(), OpenFile.openFpdFile(Workspace
- // .getCurrentWorkspace()
- // + File.separatorChar
- // + fpfItem.getFarFile().getRelativeFilename()));
- plfList.add(plfId);
- }
- return plfList;
- }
-
- public List<FarFileItem> getPlatformContents(PlatformIdentification platformId) {
- List<FarFileItem> result = new ArrayList<FarFileItem>();
- Iterator<FarPlatformItem> iter = this.fPlfList.iterator();
-
- while (iter.hasNext()) {
- FarPlatformItem item = iter.next();
- if (item.isIdentityPlf(platformId)) {
- FarFileItem farFileItem = item.getFarFile();
- farFileItem.setDefaultPath(farFileItem.getRelativeFilename());
- farFileItem.setRelativeFilename(Tools.getFileNameOnly(farFileItem.getRelativeFilename()));
- result.add(farFileItem);
- break;
- }
- }
- return result;
- }
-
- public List<FarFileItem> getPackageContents(PackageIdentification packageId) {
- List<FarFileItem> farFileList = new ArrayList<FarFileItem>();
- Iterator pkgItem = this.fPkgList.iterator();
- while (pkgItem.hasNext()) {
- FarPackage pkg = (FarPackage) pkgItem.next();
- if (pkg.isIdentityPkg(packageId)) {
- //
- // Add spd far file to list.
- //
- farFileList.add(pkg.getFarFile());
- //
- // Add all files in contents to list.
- //
- farFileList.addAll(pkg.getContentList());
- //
- // Add all farfiles in <FarPlatformList> to list.
- //
- // List<FarPlatformItem> plfList = pkg.getFarPlatformList();
- // Iterator plfItem = plfList.iterator();
- // while (plfItem.hasNext()) {
- // farFileList.add(((FarPlatformItem) plfItem.next())
- // .getFarFile());
- // }
-
- Iterator<FarFileItem> ffIter = farFileList.iterator();
- while (ffIter.hasNext()) {
- FarFileItem ffItem = ffIter.next();
- ffItem.setDefaultPath(pkg.getDefaultPath() + File.separatorChar + ffItem.getRelativeFilename());
- }
- break;
- }
- }
-
- return farFileList;
- }
-
- /**
- *
- * @param pkgId
- * @return String: return string represent jar file entry;
- */
- public String[] getPackgeSpd(PackageIdentification pkgId) {
- Iterator pkgItem = this.fPkgList.iterator();
- String[] entryStr = new String[2];
- while (pkgItem.hasNext()) {
- FarPackage pkg = (FarPackage) pkgItem.next();
- if (pkg.isIdentityPkg(pkgId)) {
- entryStr[0] = pkg.getFarFile().getRelativeFilename();
- entryStr[1] = pkg.getDefaultPath();
- return entryStr;
- }
- }
- return null;
- }
-
- public List<FarFileItem> getPackageContents() {
- //
- // In this farFilelist,all FarFileItem's relativeFileName should be
- // set as absolutely path.
- //
- List<FarFileItem> farFileList = new ArrayList<FarFileItem>();
- Iterator pkgItem = this.fPkgList.iterator();
- FarFileItem ffItem = null;
-
- while (pkgItem.hasNext()) {
- FarPackage pkg = (FarPackage) pkgItem.next();
-
- //
- // Add spd far file to list.
- //
- ffItem = pkg.getFarFile();
- //
- // Set farFileItem relativeFileName = absolutePath + file Name.
- //
- farFileList.add(new FarFileItem(pkg.getDefaultPath() + File.separatorChar + ffItem.getRelativeFilename(),
- ffItem.getMd5Value()));
- //
- // Add all files in contents to list.
- //
- Iterator contentsItem = pkg.getContentList().iterator();
- while (contentsItem.hasNext()) {
- ffItem = (FarFileItem) contentsItem.next();
- farFileList.add(new FarFileItem(pkg.getDefaultPath() + File.separator + ffItem.getRelativeFilename(),
- ffItem.getMd5Value()));
- }
- //
- // Add all farfiles in <FarPlatformList> to list.
- //
- List<FarPlatformItem> plfList = pkg.getFarPlatformList();
- Iterator plfItem = plfList.iterator();
- while (plfItem.hasNext()) {
- ffItem = ((FarPlatformItem) plfItem.next()).getFarFile();
- farFileList.add(new FarFileItem(pkg.getDefaultPath() + File.separator + ffItem.getRelativeFilename(),
- ffItem.getMd5Value()));
- }
- }
- return farFileList;
- }
-
- public String getPackageDefaultPath(PackageIdentification packageId) {
- Iterator pkgItr = this.fPkgList.iterator();
- while (pkgItr.hasNext()) {
- FarPackage farPackage = (FarPackage) pkgItr.next();
- if (farPackage.isIdentityPkg(packageId)) {
- return farPackage.getDefaultPath();
- }
- }
- return null;
- }
-
- // public void setPackageInstallPath(PackageIdentification packageId, String path) {
- // Iterator<FarPackage> pkgItr = this.fPkgList.iterator();
- // while (pkgItr.hasNext()) {
- // FarPackage farPackage = pkgItr.next();
- // if (farPackage.isIdentityPkg(packageId)) {
- // farPackage.setDefaultPath(path);
- // return ;
- // }
- // }
- // }
- //
- // public void setPlatformInstallPath(PlatformIdentification platformId, String path) {
- // Iterator<FarPlatformItem> plfItr = this.fPlfList.iterator();
- // while (plfItr.hasNext()) {
- // FarPlatformItem farPlatform = plfItr.next();
- // if (farPlatform.i.isIdentity(platformId)) {
- // farPackage.setDefaultPath(path);
- // return ;
- // }
- // }
- // }
-
- public List<FarFileItem> getAllFileItem() {
- //
- // The farFileName in this list are all abosulte path.
- //
- List<FarFileItem> ffiList = new ArrayList<FarFileItem>();
- //
- // Add far files in <FarPackageList> to list.
- //
- ffiList = this.getPackageContents();
-
- //
- // Add far files in <FarPlatformList> to list
- //
- NodeList elementList = this.manifestDoc.getElementsByTagName(farPlatformList);
- for (int i = 0; i < elementList.getLength(); i++) {
- //
- // Get <farPlatform> node list.
- //
- Node item = elementList.item(i);
- NodeList plfElements = item.getChildNodes();
- for (int j = 0; j < plfElements.getLength(); j++) {
- //
- // Get each <FarPlatform> content.
- //
- NodeList plfChildNode = plfElements.item(i).getChildNodes();
- Node tempNode = null;
- for (int t = 0; t < plfChildNode.getLength(); t++) {
- tempNode = plfChildNode.item(t);
- //
- // Get child node value and set to platformIdentification.
- //
- if (tempNode.getNodeName().equalsIgnoreCase(farPackage_FarfileName)) {
- NamedNodeMap farAttr = tempNode.getAttributes();
- //
- // Change relative path to absolute one
- //
- FarFileItem farFile = new FarFileItem(tempNode.getTextContent(),
- farAttr.getNamedItem(farFileName_Md5sum).getTextContent());
- ffiList.add(farFile);
- }
- }
- }
- }
- return ffiList;
- }
-
- public void hibernateToFile() throws Exception {
- //
- // create manifest root node
- //
- Element rootNode = this.manifestDoc.createElement("FrameworkArchiveManifest");
- this.manifestDoc.appendChild(rootNode);
-
- //
- // create manifest header node
- //
- Element headerNode = this.manifestDoc.createElement(farHeader);
- rootNode.appendChild(headerNode);
- //
- // Add FarHeader to headerNode.
- //
- Element farName = this.manifestDoc.createElement(farHeader_FarName);
- farName.setTextContent(this.fhInfo.getFarName());
- headerNode.appendChild(farName);
-
- Element gv = this.manifestDoc.createElement(guidValue);
- gv.setTextContent(this.fhInfo.getGuidValue());
- headerNode.appendChild(gv);
-
- Element ver = this.manifestDoc.createElement(version);
- ver.setTextContent(this.fhInfo.getVersion());
- headerNode.appendChild(ver);
-
- Element abstra = this.manifestDoc.createElement(farHeader_Abstract);
- abstra.setTextContent(this.fhInfo.getAbstractStr());
- headerNode.appendChild(abstra);
-
- Element descr = this.manifestDoc.createElement(farHeader_Description);
- descr.setTextContent(this.fhInfo.getDescription());
- headerNode.appendChild(descr);
-
- Element copyright = this.manifestDoc.createElement(farHeader_CopyRight);
- copyright.setTextContent(this.fhInfo.getCopyright());
- headerNode.appendChild(copyright);
-
- Element license = this.manifestDoc.createElement(farHeader_License);
- license.setTextContent(this.fhInfo.getLicense());
- headerNode.appendChild(license);
-
- Element spec = this.manifestDoc.createElement(farHeader_Specification);
- spec.setTextContent(this.fhInfo.getSpecification());
- System.out.println(this.fhInfo.getSpecification());
- headerNode.appendChild(spec);
-
- //
- // create manifest FarPackageList node
- //
- Element pkgListNode = this.manifestDoc.createElement(farPackageList);
- rootNode.appendChild(pkgListNode);
-
- //
- // Save each item in farPackage list to <FarPackage>.
- //
- Iterator pkgItem = this.fPkgList.iterator();
- while (pkgItem.hasNext()) {
- pkgToFarPkgNode(pkgListNode, (FarPackage) pkgItem.next());
-
- }
-
- //
- // create manifest FarPlatformList node
- //
- Element plfListNode = this.manifestDoc.createElement(farPlatformList);
- rootNode.appendChild(plfListNode);
-
- //
- // Save farPakcage list info to <FarPackageList> node
- //
- Iterator plfItem = this.fPlfList.iterator();
- while (plfItem.hasNext()) {
- FarPlatformItem plfIterator = (FarPlatformItem) plfItem.next();
- PlfToPlatformNode(plfListNode, plfIterator);
- }
-
- //
- // Write the DOM document to the file
- //
- Transformer xformer = TransformerFactory.newInstance().newTransformer();
- xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
- xformer.setOutputProperty(OutputKeys.INDENT, "yes");
-
- //
- // Prepare the DOM document for writing
- //
- Source source = new DOMSource(this.manifestDoc);
- //
- // Prepare the output file, get the Mainifest file name from <FarHeader>
- // <FarName>.
- //
- this.mfFile = new File(Workspace.getCurrentWorkspace() + File.separatorChar + mfFileName);
- //
- // generate all directory path
- //
- Result result = new StreamResult(this.mfFile);
- xformer.transform(source, result);
- //
- // Close result. Flush file by manual for Jdk1.5.0_04.
- //
- ((StreamResult) result).getOutputStream().close();
- }
-
- public void pkgToFarPkgNode(Element parentNode, FarPackage pkgItem) {
- Element pkgNode = this.manifestDoc.createElement(farPackageList_FarPackage);
- //
- // Add <FarFileName>
- //
- ffiToFfNode(pkgNode, pkgItem.getFarFile());
- //
- // Add <GuidValue>
- //
- setStrItemToNode(pkgNode, pkgItem.getGuidValue(), guidValue);
- //
- // Add <Version>
- //
- setStrItemToNode(pkgNode, pkgItem.getVersion(), version);
- //
- // Add <DefaultPath>
- //
- setStrItemToNode(pkgNode, pkgItem.getDefaultPath(), farPackage_DefaultPath);
-
- //
- // Add <Contents>
- //
- Element contentNode = this.manifestDoc.createElement(contents);
- Iterator iterator = pkgItem.getContentList().iterator();
- while (iterator.hasNext()) {
- ffiToFfNode(contentNode, (FarFileItem) iterator.next());
- }
- pkgNode.appendChild(contentNode);
- parentNode.appendChild(pkgNode);
- }
-
- public void PlfToPlatformNode(Element parentNode, FarPlatformItem fplItem) {
- Element fplNode = this.manifestDoc.createElement(farPlatformList_FarPlatform);
- //
- // Add <FarFileName>
- //
- ffiToFfNode(fplNode, fplItem.getFarFile());
- //
- // Add <GuidValue>
- //
- setStrItemToNode(fplNode, fplItem.getGuidValue(), guidValue);
- //
- // Add <Version>
- //
- setStrItemToNode(fplNode, fplItem.getVersion(), version);
- //
- // Add to <PlatformList>
- //
- parentNode.appendChild(fplNode);
-
- }
-
- public void ffiToFfNode(Element parentNode, FarFileItem ffi) {
- Element farFileName = this.manifestDoc.createElement(farPackage_FarfileName);
- farFileName.setTextContent(ffi.getRelativeFilename());
- System.out.println(farFileName.getTextContent());
- System.out.println(ffi.getRelativeFilename());
- farFileName.setAttribute(farFileName_Md5sum, ffi.getMd5Value());
- parentNode.appendChild(farFileName);
- }
-
- public void setStrItemToNode(Element parentNode, String strValue, String strName) {
- Element node = this.manifestDoc.createElement(strName);
- node.setTextContent(strValue);
- parentNode.appendChild(node);
- }
-
- private void parseManifest() {
-
- //
- // Parse header
- //
- parseMfHeader();
- //
- // parse <farPackageList>
- //
- parseHeaderFarPackageList();
-
- //
- // parse <farPlatformList>
- //
- NodeList ele = this.manifestDoc.getElementsByTagName(farPlatformList);
- Node plfNode;
- if (ele.getLength() > 0) {
- //
- // Only have one <FarPlatformList> node under manifest root node.
- //
- plfNode = ele.item(0);
- parseFarPlatformList(plfNode, this.fPlfList);
- }
- }
-
- private void parseMfHeader() {
- Node headerNode;
- NodeList ele = this.manifestDoc.getElementsByTagName(farHeader);
- if (ele.getLength() > 0) {
- //
- // For manifest file only have one <FarHeader>
- //
- headerNode = ele.item(0);
- } else {
- return;
- }
- NodeList childList = headerNode.getChildNodes();
- Node node = null;
- String nodeName = null;
- for (int i = 0; i < childList.getLength(); i++) {
- node = childList.item(i);
- nodeName = node.getNodeName();
- if (nodeName.equalsIgnoreCase(farHeader_FarName)) {
- String nodeValue = node.getTextContent();
- this.fhInfo.setFarName(nodeValue);
- } else if (nodeName.equalsIgnoreCase(guidValue)) {
- this.fhInfo.setGuidValue(node.getTextContent());
- } else if (nodeName.equalsIgnoreCase(version)) {
- this.fhInfo.setVersion(node.getTextContent());
- } else if (nodeName.equalsIgnoreCase(farHeader_Abstract)) {
- this.fhInfo.setAbstractStr(node.getTextContent());
- } else if (nodeName.equalsIgnoreCase(farHeader_Description)) {
- this.fhInfo.setDescription(node.getTextContent());
- } else if (nodeName.equalsIgnoreCase(farHeader_CopyRight)) {
- this.fhInfo.setCopyright(node.getTextContent());
- } else if (nodeName.equalsIgnoreCase(farHeader_License)) {
- this.fhInfo.setLicense(node.getTextContent());
- } else if (nodeName.equalsIgnoreCase(farHeader_Specification)) {
- this.fhInfo.setSpecification(node.getTextContent());
- }
- }
- }
-
- public void parseHeaderFarPackageList() {
- Node farPkgNode;
- NodeList ele = this.manifestDoc.getElementsByTagName(farPackageList);
- if (ele.getLength() > 0) {
- //
- // For manifest file only have one <FarHeader>
- //
- farPkgNode = ele.item(0);
- } else {
- return;
- }
- NodeList fpnList = farPkgNode.getChildNodes();
- for (int i = 0; i < fpnList.getLength(); i++) {
- if (fpnList.item(i).getNodeType() == Node.TEXT_NODE) {
- continue;
- }
- FarPackage fpItem = new FarPackage();
- parseFarPackage(fpnList.item(i), fpItem);
- this.fPkgList.add(fpItem);
- }
- }
-
- public void parseFarPackage(Node farPkgNode, FarPackage fpItem) {
- NodeList childList = farPkgNode.getChildNodes();
- Node childNode;
- String childName;
- for (int i = 0; i < childList.getLength(); i++) {
- childNode = childList.item(i);
- childName = childNode.getNodeName();
- if (childName.equalsIgnoreCase(farPackage_FarfileName)) {
- fpItem.setFarFile(parseFarFile(childNode));
- } else if (childName.equalsIgnoreCase(guidValue)) {
- fpItem.setGuidValue(childNode.getTextContent());
- } else if (childName.equalsIgnoreCase(version)) {
- fpItem.setVersion(childNode.getTextContent());
- } else if (childName.equalsIgnoreCase(farPackage_DefaultPath)) {
- fpItem.setDefaultPath(childNode.getTextContent());
- } else if (childName.equalsIgnoreCase(farPlatformList)) {
- List<FarPlatformItem> plfList = new ArrayList<FarPlatformItem>();
- parseFarPlatformList(childNode, plfList);
- fpItem.setFarPlatformList(plfList);
- } else if (childName.equalsIgnoreCase(contents)) {
- List<FarFileItem> ffList = new ArrayList<FarFileItem>();
- parseContents(childNode, ffList);
- fpItem.setContentList(ffList);
- }
- }
- }
-
- /**
- *
- * @param fpfListNode
- * @param plfList
- */
- public void parseFarPlatformList(Node fpfListNode, List<FarPlatformItem> plfList) {
- //
- // Get <FarPlatform> list.
- //
- NodeList child = fpfListNode.getChildNodes();
- Node farPlfNode;
- for (int i = 0; i < child.getLength(); i++) {
- if (child.item(i).getNodeType() == Node.TEXT_NODE) {
- continue;
- }
- farPlfNode = child.item(i);
- plfList.add(parseFarPlatform(farPlfNode));
- }
- }
-
- /**
- *
- * @param fpfNode
- * @return
- */
- public FarPlatformItem parseFarPlatform(Node fpfNode) {
- //
- // New FarPlatformItem.
- //
- FarPlatformItem fplItem = new FarPlatformItem();
- //
- // Get <FarPlatform> elements;
- //
- NodeList childList = fpfNode.getChildNodes();
- Node child;
- String nodeName;
- for (int i = 0; i < childList.getLength(); i++) {
- child = childList.item(i);
- nodeName = child.getNodeName();
- if (nodeName.equalsIgnoreCase(farPackage_FarfileName)) {
- fplItem.setFarFile(parseFarFile(child));
- } else if (nodeName.equalsIgnoreCase(guidValue)) {
- fplItem.setGuidValue(child.getTextContent());
- } else if (nodeName.equalsIgnoreCase(version)) {
- fplItem.setVersion(child.getTextContent());
- }
- }
-
- return fplItem;
- }
-
- public void parseContents(Node contentsNode, List<FarFileItem> ffList) {
- NodeList contentList = contentsNode.getChildNodes();
- Node contentNode;
- for (int i = 0; i < contentList.getLength(); i++) {
- if (contentList.item(i).getNodeType() == Node.TEXT_NODE) {
- continue;
- }
- contentNode = contentList.item(i);
- //
- // Parse each <FarFileName>.
- //
- ffList.add(parseFarFile(contentNode));
- }
- }
-
- public FarFileItem parseFarFile(Node farFileNode) {
- String ffName = farFileNode.getTextContent();
- NamedNodeMap attr = farFileNode.getAttributes();
- FarFileItem ffItem = new FarFileItem(ffName, attr.getNamedItem(farFileName_Md5sum).getTextContent());
- return ffItem;
- }
-
- public boolean isFilter(File file, Set<String> fileter) {
- Iterator<String> iter = fileter.iterator();
- while (iter.hasNext()) {
- Pattern pattern = Pattern.compile(iter.next());
- Matcher matcher = pattern.matcher(file.getName());
-
- if (matcher.find()) {
- return true;
- }
- }
- return false;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/ManifestInterface.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/ManifestInterface.java deleted file mode 100644 index 28af114a5b..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/ManifestInterface.java +++ /dev/null @@ -1,40 +0,0 @@ -/** @file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.far;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-public interface ManifestInterface {
-
- public void createManifest(List<PackageIdentification> pkgList, List<PlatformIdentification> plfList,
- Set<String> fileFilter) throws Exception;
-
- public void setManifestFile(File manifestFile) throws Exception;
-
- public List<PackageIdentification> getPackageList() throws Exception;
-
- public List<PlatformIdentification> getPlatformList() throws Exception, IOException, XmlException;
-
- public List<FarFileItem> getPackageContents(PackageIdentification packageId);
-
- public String getPackageDefaultPath(PackageIdentification packageId);
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQuery.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQuery.java deleted file mode 100644 index f76af054ba..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQuery.java +++ /dev/null @@ -1,127 +0,0 @@ -/** @file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.far;
-
-import java.io.File;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.apache.xmlbeans.XmlObject;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.PackageDependenciesDocument;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.OpenFile;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class PackageQuery implements PackageQueryInterface {
-
- public PackageIdentification getPackageIdentification(File spdFile) {
- PackageIdentification packageId = null;
- try {
- String path = spdFile.getPath();
- packageId = Tools.getId(path, OpenFile.openSpdFile(path));
- } catch (Exception e) {
- e.printStackTrace();
- }
- return packageId;
- }
-
- public List<String> getPackageMsaList(InputStream spdInput) {
- List<String> result = new ArrayList<String>();
- try {
- PackageSurfaceAreaDocument spd = (PackageSurfaceAreaDocument) XmlObject.Factory.parse(spdInput);
- result = spd.getPackageSurfaceArea().getMsaFiles().getFilenameList();
- } catch (Exception e) {
- e.printStackTrace();
- }
- return result;
- }
-
- public List<PackageIdentification> getModuleDependencies(InputStream msaInput) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- try {
- ModuleSurfaceAreaDocument msa = (ModuleSurfaceAreaDocument) XmlObject.Factory.parse(msaInput);
- ModuleSurfaceAreaDocument.ModuleSurfaceArea sa = msa.getModuleSurfaceArea();
- if (sa == null) {
- return result;
- }
- PackageDependenciesDocument.PackageDependencies pkgDep = sa.getPackageDependencies();
- if (pkgDep == null) {
- return result;
- }
- List<PackageDependenciesDocument.PackageDependencies.Package> list = pkgDep.getPackageList();
- Iterator<PackageDependenciesDocument.PackageDependencies.Package> iter = list.iterator();
- while (iter.hasNext()) {
- PackageDependenciesDocument.PackageDependencies.Package item = iter.next();
- PackageIdentification packageId = new PackageIdentification(null, item.getPackageGuid(),
- item.getPackageVersion());
- result.add(packageId);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return result;
- }
-
- public List<File> getPackageMsaList(File spdFile) {
- List<File> result = new Vector<File>();
- WorkspaceTools wt = new WorkspaceTools();
- List<String> v = wt.getAllModulesOfPackage(spdFile.getPath());
- Iterator<String> iter = v.iterator();
- while (iter.hasNext()) {
- result.add(new File(iter.next()));
- }
- return result;
- }
-
- public List<PackageIdentification> getPackageDependencies(File spdFile) {
- List<File> msaFiles = getPackageMsaList(spdFile);
- return getPackageDependencies(msaFiles);
- }
-
- public List<PackageIdentification> getPackageDependencies(List<File> msaFiles) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- Iterator<File> iter = msaFiles.iterator();
- while (iter.hasNext()) {
- result = AggregationOperation.union(result, getModuleDependencies(iter.next()));
- }
- return result;
- }
-
- public List<PackageIdentification> getModuleDependencies(File msaFile) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- try {
- ModuleSurfaceArea msa = OpenFile.openMsaFile(msaFile.getPath());
- List<PackageDependenciesDocument.PackageDependencies.Package> p = msa.getPackageDependencies()
- .getPackageList();
- Iterator<PackageDependenciesDocument.PackageDependencies.Package> iter = p.iterator();
- while (iter.hasNext()) {
- PackageDependenciesDocument.PackageDependencies.Package item = iter.next();
- PackageIdentification packageId = new PackageIdentification(null, item.getPackageGuid(),
- item.getPackageVersion());
- if (!AggregationOperation.belongs(packageId, result)) {
- result.add(packageId);
- }
- }
- } catch (Exception e) {
- }
- return result;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQueryInterface.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQueryInterface.java deleted file mode 100644 index e8644ebbf7..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQueryInterface.java +++ /dev/null @@ -1,38 +0,0 @@ -/** @file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.far;
-
-import java.io.File;
-import java.io.InputStream;
-import java.util.List;
-
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public interface PackageQueryInterface {
-
- public PackageIdentification getPackageIdentification(File spdFile);
-
- public List<File> getPackageMsaList(File spdFile);
-
- public List<String> getPackageMsaList(InputStream spdInput);
-
- public List<PackageIdentification> getPackageDependencies(File spdFile);
-
- public List<PackageIdentification> getPackageDependencies(List<File> msaFiles);
-
- public List<PackageIdentification> getModuleDependencies(InputStream msaInput);
-
- public List<PackageIdentification> getModuleDependencies(File msaFile);
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepFour.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepFour.java deleted file mode 100644 index ab2ffd07ee..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepFour.java +++ /dev/null @@ -1,334 +0,0 @@ -/** @file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.far.createui;
-
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.IFileFilter;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.far.AggregationOperation;
-import org.tianocore.frameworkwizard.far.Far;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.far.PackageQuery;
-import org.tianocore.frameworkwizard.far.PackageQueryInterface;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-public class CreateStepFour extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = -7397213364965470902L;
-
- private JPanel jContentPane = null;
-
- private JTextArea jTextAreaInstruction = null;
-
- private JLabel jLabel = null;
-
- private JLabel jLabel2 = null;
-
- private JTextField jTextFieldSaveToFile = null;
-
- private JButton jButtonBrowser = null;
-
- // private JScrollPane jScrollPane = null;
- private JButton jButtonCancel = null;
-
- private JButton jButtonFinish = null;
-
- private JButton jButtonPrevious = null;
-
- private IDefaultTableModel model = null;
-
- private CreateStepThree stepThree = null;
-
- // private JTable jTable = null;
- public CreateStepFour(IDialog iDialog, boolean modal, CreateStepThree stepThree) {
- this(iDialog, modal);
- this.stepThree = stepThree;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextAreaInstruction == null) {
- jTextAreaInstruction = new JTextArea();
- jTextAreaInstruction.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextAreaInstruction.setText("Step 4: Choose a file \n");
- jTextAreaInstruction.setEditable(false);
- }
- return jTextAreaInstruction;
- }
-
- /**
- * This method initializes jTextField1
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextField1() {
- if (jTextFieldSaveToFile == null) {
- jTextFieldSaveToFile = new JTextField();
- jTextFieldSaveToFile.setBounds(new java.awt.Rectangle(147,70,412,20));
- }
- return jTextFieldSaveToFile;
- }
-
- /**
- * This method initializes jButtonBrowser
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonBrower() {
- if (jButtonBrowser == null) {
- jButtonBrowser = new JButton();
- jButtonBrowser.setBounds(new java.awt.Rectangle(570, 70, 100, 20));
- jButtonBrowser.setText("Browser...");
- jButtonBrowser.addMouseListener(this);
- }
- return jButtonBrowser;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- // private JScrollPane getJScrollPane() {
- // if (jScrollPane == null) {
- // jScrollPane = new JScrollPane();
- // jScrollPane.setBounds(new java.awt.Rectangle(139,85,500,100));
- // jScrollPane.setViewportView(getJTable());
- // }
- // return jScrollPane;
- // }
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonFinish
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFinish() {
- if (jButtonFinish == null) {
- jButtonFinish = new JButton();
- jButtonFinish.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonFinish.setText("Finish");
- jButtonFinish.addMouseListener(this);
- }
- return jButtonFinish;
- }
-
- /**
- * This method initializes jButtonPrevious
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonPrevious() {
- if (jButtonPrevious == null) {
- jButtonPrevious = new JButton();
- jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
- jButtonPrevious.setText("Previous");
- jButtonPrevious.addMouseListener(this);
- jButtonPrevious.setVisible(true);
- }
- return jButtonPrevious;
- }
-
- /**
- * This is the default constructor
- */
- public CreateStepFour(IDialog iDialog, boolean modal) {
- super(iDialog, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.CREATE_STEP_FOUR_TITLE);
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel2 = new JLabel();
- jLabel2.setBounds(new java.awt.Rectangle(30,70,111,18));
- jLabel2.setText("File to Save: ");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(29,108,320,20));
- jLabel.setText("This FAR will depend on the following packages: ");
- jLabel.setVisible(false);
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(jLabel, null);
- // jContentPane.add(getJScrollPane(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonFinish(), null);
- jContentPane.add(getJButtonPrevious(), null);
- jContentPane.add(jLabel2, null);
- jContentPane.add(getJTextField1(), null);
- jContentPane.add(getJButtonBrower(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonFinish) {
- //
- // Add some logic process here
- // Guid Check, File Check etc.
- //
- if (this.jTextFieldSaveToFile.getText() == null) {
- Log.wrn("Create far", "Please input the Far name!");
- }
- try {
- //
- // Create an output stream for JAR
- //
-
- Far far = new Far(new File(this.jTextFieldSaveToFile.getText()));
-
- far.creatFar(this.getPreviousStep().getPreviousStep().getSelectedPackages(),
- this.getPreviousStep().getPreviousStep().getSelectedPlatforms(), this.getPreviousStep()
- .getFileFilter(),
- this.getPreviousStep().getPreviousStep().getPreviousStep().getFarHeader());
- } catch (Exception exp) {
- Log.wrn("Create far", exp.getMessage());
- Log.err("Create far", exp.getMessage());
- return;
- }
- getPreviousStep().getPreviousStep().getPreviousStep().returnType = DataType.RETURN_TYPE_OK;
- getPreviousStep().getPreviousStep().dispose();
- getPreviousStep().dispose();
- this.setVisible(false);
- this.dispose();
- } else if (e.getSource() == jButtonBrowser) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
- fc.addChoosableFileFilter(new IFileFilter(DataType.FAR_SURFACE_AREA_EXT));
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
-
- int result = fc.showSaveDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- this.jTextFieldSaveToFile.setText(Tools.addPathExt(fc.getSelectedFile().getPath(),
- DataType.RETURN_TYPE_FAR_SURFACE_AREA));
- }
- } else if (e.getSource() == jButtonPrevious) {
- this.setVisible(false);
- stepThree.setVisible(true);
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public CreateStepThree getPreviousStep() {
- return stepThree;
- }
-
- public void prepareTable() {
- model.setRowCount(0);
-
- List<PackageIdentification> packageList = new ArrayList<PackageIdentification>();
- //
- // Change here to get packages and platforms from FAR
- //
- List<PackageIdentification> selectedPackages = getPreviousStep().getPreviousStep().getSelectedPackages();
- PackageQueryInterface pq = new PackageQuery();
-
- Iterator<PackageIdentification> iter = selectedPackages.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- List<PackageIdentification> list = pq.getPackageDependencies(item.getSpdFile());
- packageList = AggregationOperation.union(list, packageList);
- }
-
- packageList = AggregationOperation.minus(packageList, selectedPackages);
-
- iter = packageList.iterator();
- while (iter.hasNext()) {
- String[] str = new String[3];
- PackageIdentification item = iter.next();
- str[2] = item.getName();
- str[1] = item.getVersion();
- str[0] = item.getGuid();
- model.addRow(str);
- }
- }
-}
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepOne.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepOne.java deleted file mode 100644 index 0126b96f38..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepOne.java +++ /dev/null @@ -1,641 +0,0 @@ -/** @file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.far.createui;
-
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.far.FarHeader;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-
-public class CreateStepOne extends IDialog implements MouseListener {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -8152099582923006900L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelBaseName = null;
-
- private JTextField jTextFieldBaseName = null;
-
- private JLabel jLabelGuid = null;
-
- private JTextField jTextFieldGuid = null;
-
- private JLabel jLabelVersion = null;
-
- private JTextField jTextFieldVersion = null;
-
- private JButton jButtonGenerateGuid = null;
-
- private JLabel jLabelLicense = null;
-
- private JTextArea jTextAreaLicense = null;
-
- private JLabel jLabelCopyright = null;
-
- private JLabel jLabelDescription = null;
-
- private JTextArea jTextAreaDescription = null;
-
- private JLabel jLabelSpecification = null;
-
- private JTextField jTextFieldSpecification = null;
-
- private JButton jButtonOk = null;
-
- private JScrollPane jScrollPaneLicense = null;
-
- private JScrollPane jScrollPaneDescription = null;
-
- private JLabel jLabelAbstract = null;
-
- private JTextField jTextFieldAbstract = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel4 = null;
-
- private StarLabel jStarLabel5 = null;
-
- private StarLabel jStarLabel6 = null;
-
- private StarLabel jStarLabel7 = null;
-
- private StarLabel jStarLabel8 = null;
-
- private StarLabel jStarLabel10 = null;
-
- private StarLabel jStarLabel12 = null;
-
- private JLabel jLabelURL = null;
-
- private JTextField jTextFieldURL = null;
-
- private JScrollPane jScrollPane = null;
-
- private CreateStepTwo stepTwo = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonNext = null;
-
- private FarHeader farHeader = new FarHeader();
-
- private JScrollPane jScrollPaneCopyright = null;
-
- private JTextArea jTextAreaCopyright = null;
-
- /**
- * This method initializes jTextFieldBaseName
- *
- * @return javax.swing.JTextField jTextFieldBaseName
- *
- */
- private JTextField getJTextFieldBaseName() {
- if (jTextFieldBaseName == null) {
- jTextFieldBaseName = new JTextField();
- jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 10, 520, 20));
- jTextFieldBaseName.setToolTipText("A brief Identifier, such as USB I/O Drivers, of the Framework Archive.");
- }
- return jTextFieldBaseName;
- }
-
- /**
- * This method initializes jTextFieldGuid
- *
- * @return javax.swing.JTextField jTextFieldGuid
- *
- */
- private JTextField getJTextFieldGuid() {
- if (jTextFieldGuid == null) {
- jTextFieldGuid = new JTextField();
- jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 35, 410, 20));
- jTextFieldGuid.setToolTipText("Guaranteed Unique Identification Number (8-4-4-4-12)");
- }
- return jTextFieldGuid;
- }
-
- /**
- * This method initializes jTextFieldVersion
- *
- * @return javax.swing.JTextField jTextFieldVersion
- *
- */
- private JTextField getJTextFieldVersion() {
- if (jTextFieldVersion == null) {
- jTextFieldVersion = new JTextField();
- jTextFieldVersion.setBounds(new java.awt.Rectangle(160, 60, 520, 20));
- jTextFieldVersion.setToolTipText("A Version Number, 1.0, 1, 1.01");
- }
- return jTextFieldVersion;
- }
-
- /**
- * This method initializes jButtonGenerateGuid
- *
- * @return javax.swing.JButton jButtonGenerateGuid
- *
- */
- private JButton getJButtonGenerateGuid() {
- if (jButtonGenerateGuid == null) {
- jButtonGenerateGuid = new JButton();
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(590, 35, 90, 20));
- jButtonGenerateGuid.setText("Generate");
- jButtonGenerateGuid.addMouseListener(this);
- }
- return jButtonGenerateGuid;
- }
-
- /**
- * This method initializes jTextAreaLicense
- *
- * @return javax.swing.JTextArea jTextAreaLicense
- *
- */
- private JTextArea getJTextAreaLicense() {
- if (jTextAreaLicense == null) {
- jTextAreaLicense = new JTextArea();
- jTextAreaLicense.setText("");
- jTextAreaLicense.setLineWrap(true);
- jTextAreaLicense.setWrapStyleWord(true);
- jTextAreaLicense.setToolTipText("The License for this FAR file.");
- }
- return jTextAreaLicense;
- }
-
- /**
- * This method initializes jTextAreaDescription
- *
- * @return javax.swing.JTextArea jTextAreaDescription
- *
- */
- private JTextArea getJTextAreaDescription() {
- if (jTextAreaDescription == null) {
- jTextAreaDescription = new JTextArea();
- jTextAreaDescription.setLineWrap(true);
- jTextAreaDescription.setWrapStyleWord(true);
- jTextAreaDescription.setToolTipText("A verbose description of the FAR contents.");
- }
- return jTextAreaDescription;
- }
-
- /**
- * This method initializes jTextFieldSpecification
- *
- * @return javax.swing.JTextField jTextFieldSpecification
- *
- */
- private JTextField getJTextFieldSpecification() {
- if (jTextFieldSpecification == null) {
- jTextFieldSpecification = new JTextField();
- jTextFieldSpecification.setText("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052");
- jTextFieldSpecification.setBounds(new java.awt.Rectangle(160, 310, 520, 20));
- jTextFieldSpecification.setEditable(false);
- }
- return jTextFieldSpecification;
- }
-
- /**
- * This method initializes jScrollPaneLicense
- *
- * @return javax.swing.JScrollPane jScrollPaneLicense
- *
- */
- private JScrollPane getJScrollPaneLicense() {
- if (jScrollPaneLicense == null) {
- jScrollPaneLicense = new JScrollPane();
- jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneLicense.setBounds(new java.awt.Rectangle(160, 220, 520, 60));
- jScrollPaneLicense.setViewportView(getJTextAreaLicense());
- }
- return jScrollPaneLicense;
- }
-
- /**
- * This method initializes jScrollPaneDescription
- *
- * @return javax.swing.JScrollPane jScrollPaneDescription
- *
- */
- private JScrollPane getJScrollPaneDescription() {
- if (jScrollPaneDescription == null) {
- jScrollPaneDescription = new JScrollPane();
- jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneDescription.setBounds(new java.awt.Rectangle(160, 110, 520, 60));
- jScrollPaneDescription.setViewportView(getJTextAreaDescription());
- }
- return jScrollPaneDescription;
- }
-
- /**
- * This method initializes jTextFieldAbstract
- *
- * @return javax.swing.JTextField jTextFieldAbstract
- *
- */
- private JTextField getJTextFieldAbstract() {
- if (jTextFieldAbstract == null) {
- jTextFieldAbstract = new JTextField();
- jTextFieldAbstract.setBounds(new java.awt.Rectangle(160, 85, 520, 20));
- jTextFieldAbstract.setToolTipText("A one sentence description of this FAR package.");
- }
- return jTextFieldAbstract;
- }
-
- /**
- * This method initializes jTextFieldURL
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldURL() {
- if (jTextFieldURL == null) {
- jTextFieldURL = new JTextField();
- jTextFieldURL.setBounds(new java.awt.Rectangle(160, 285, 520, 20));
- jTextFieldURL.setToolTipText("A URL for the latest version of the license");
- }
- return jTextFieldURL;
- }
-
- /**
- * 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 jButtonCancel1
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(590, 350, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonNext
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNext() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(480, 350, 90, 20));
- jButtonNext.setText("Next");
- jButtonNext.addMouseListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jScrollPaneCopyright
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneCopyright() {
- if (jScrollPaneCopyright == null) {
- jScrollPaneCopyright = new JScrollPane();
- jScrollPaneCopyright.setBounds(new java.awt.Rectangle(160, 175, 520, 40));
- jScrollPaneCopyright.setViewportView(getJTextAreaCopyright());
- }
- return jScrollPaneCopyright;
- }
-
- /**
- * This method initializes jTextAreaCopyright
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextAreaCopyright() {
- if (jTextAreaCopyright == null) {
- jTextAreaCopyright = new JTextArea();
- }
- return jTextAreaCopyright;
- }
-
- public static void main(String[] args) {
- CreateStepOne c = new CreateStepOne(new IFrame(), true);
- c.setVisible(true);
- }
-
- /**
- * This is the default constructor
- *
- */
- public CreateStepOne(IFrame iFrame, boolean modal) {
- super(iFrame, modal);
- initialize();
- }
-
- /**
- * 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.jTextFieldBaseName.setEnabled(!isView);
- this.jTextFieldGuid.setEnabled(!isView);
- this.jTextFieldVersion.setEnabled(!isView);
- this.jTextAreaLicense.setEnabled(!isView);
- this.jScrollPaneCopyright.setEnabled(!isView);
- this.jTextAreaCopyright.setEnabled(!isView);
- this.jTextAreaDescription.setEnabled(!isView);
- this.jTextFieldSpecification.setEnabled(!isView);
- this.jTextFieldAbstract.setEnabled(!isView);
- this.jButtonGenerateGuid.setEnabled(!isView);
- this.jButtonOk.setEnabled(!isView);
- }
- }
-
- /**
- * This method initializes this
- *
- */
- private void initialize() {
- this.setSize(700, 425);
- this.setContentPane(getJScrollPane());
- this.setTitle(FarStringDefinition.CREATE_STEP_ONE_TITLE);
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
-
- jLabelURL = new JLabel();
- jLabelURL.setText("License URL");
- jLabelURL.setBounds(new java.awt.Rectangle(35, 285, 120, 20));
- jLabelBaseName = new JLabel();
- jLabelBaseName.setText("FAR Name");
- jLabelBaseName.setBounds(new java.awt.Rectangle(35, 10, 120, 20));
- jLabelGuid = new JLabel();
- jLabelGuid.setText("Guid Value");
- jLabelGuid.setBounds(new java.awt.Rectangle(35, 35, 120, 20));
- jLabelVersion = new JLabel();
- jLabelVersion.setText("Version");
- jLabelVersion.setBounds(new java.awt.Rectangle(35, 60, 120, 20));
- jLabelAbstract = new JLabel();
- jLabelAbstract.setText("Abstract");
- jLabelAbstract.setBounds(new java.awt.Rectangle(35, 85, 120, 20));
- jLabelDescription = new JLabel();
- jLabelDescription.setText("Description");
- jLabelDescription.setBounds(new java.awt.Rectangle(35, 110, 120, 20));
- jLabelCopyright = new JLabel();
- jLabelCopyright.setText("Copyright");
- jLabelCopyright.setBounds(new java.awt.Rectangle(35, 175, 120, 20));
- jLabelLicense = new JLabel();
- jLabelLicense.setText("License");
- jLabelLicense.setBounds(new java.awt.Rectangle(35, 220, 120, 20));
- jLabelSpecification = new JLabel();
- jLabelSpecification.setText("Specification");
- jLabelSpecification.setBounds(new java.awt.Rectangle(35, 310, 120, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
-
- jContentPane.add(jLabelBaseName, null);
- jContentPane.add(getJTextFieldBaseName(), null);
- jContentPane.add(jLabelGuid, null);
- jContentPane.add(getJTextFieldGuid(), null);
- jContentPane.add(jLabelVersion, null);
- jContentPane.add(getJTextFieldVersion(), null);
- jContentPane.add(getJButtonGenerateGuid(), null);
- jContentPane.add(jLabelLicense, null);
- jContentPane.add(jLabelCopyright, null);
- jContentPane.add(jLabelDescription, null);
- jContentPane.add(jLabelSpecification, null);
- jContentPane.add(getJTextFieldSpecification(), null);
- jContentPane.add(getJScrollPaneLicense(), null);
- jContentPane.add(getJScrollPaneDescription(), null);
- jContentPane.add(jLabelAbstract, null);
- jContentPane.add(getJTextFieldAbstract(), null);
- jContentPane.add(jLabelURL, null);
- jContentPane.add(getJTextFieldURL(), null);
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(20, 10));
- jStarLabel4 = new StarLabel();
- jStarLabel4.setLocation(new java.awt.Point(20, 35));
- jStarLabel5 = new StarLabel();
- jStarLabel5.setLocation(new java.awt.Point(20, 60));
- jStarLabel6 = new StarLabel();
- jStarLabel6.setLocation(new java.awt.Point(20, 110));
- jStarLabel7 = new StarLabel();
- jStarLabel7.setLocation(new java.awt.Point(20, 175));
- jStarLabel8 = new StarLabel();
- jStarLabel8.setLocation(new java.awt.Point(20, 220));
- jStarLabel10 = new StarLabel();
- jStarLabel10.setLocation(new java.awt.Point(20, 85));
- jStarLabel12 = new StarLabel();
- jStarLabel12.setLocation(new java.awt.Point(20, 310));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(jStarLabel5, null);
- jContentPane.add(jStarLabel6, null);
- jContentPane.add(jStarLabel7, null);
- jContentPane.add(jStarLabel8, null);
- jContentPane.add(jStarLabel10, null);
- jContentPane.add(jStarLabel12, null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonNext(), null);
- jContentPane.add(getJScrollPaneCopyright(), null);
- }
- return jContentPane;
- }
-
- public boolean valid() {
- //
- // Check BaseName
- //
- if (isEmpty(this.jTextFieldBaseName.getText())) {
- Log.wrn("Create far", "FAR Name must be entered.");
- return false;
- }
- if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {
- Log.wrn("Create far", "Incorrect data type for FAR Name");
- return false;
- }
- farHeader.setFarName(this.jTextFieldBaseName.getText());
-
- //
- // Check Guid
- //
- if (isEmpty(this.jTextFieldGuid.getText())) {
- Log.wrn("Create far", "A GUID must be entered.");
- return false;
- }
- if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
- Log.wrn("Create far", "Incorrect data type for Guid");
- return false;
- }
- farHeader.setGuidValue(this.jTextFieldGuid.getText());
-
- //
- // Check Version
- //
- if (isEmpty(this.jTextFieldVersion.getText())) {
- Log.wrn("Create far", "A Version must be entered.");
- return false;
- }
- if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {
- Log.wrn("Create far", "Incorrect data type for Version");
- return false;
- }
- farHeader.setVersion(this.jTextFieldVersion.getText());
-
- //
- // Check Abstact
- //
- if (isEmpty(this.jTextFieldAbstract.getText())) {
- Log.wrn("Create far", "An Abstract must be entered.");
- return false;
- }
- if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {
- Log.wrn("Create far", "Incorrect data type for Abstract");
- return false;
- }
- farHeader.setAbstractStr(this.jTextFieldAbstract.getText());
-
- //
- // Check Description
- //
- if (isEmpty(this.jTextAreaDescription.getText())) {
- Log.wrn("Create far", "A Description must be entered.");
- return false;
- }
- farHeader.setDescription(this.jTextAreaDescription.getText());
-
- //
- // Check Copyright
- //
- if (isEmpty(this.jTextAreaCopyright.getText())) {
- Log.wrn("Create far", "The Copyright must be entered.");
- return false;
- }
- farHeader.setCopyright(this.jTextAreaCopyright.getText());
-
- //
- // Check License
- //
- if (isEmpty(this.jTextAreaLicense.getText())) {
- Log.wrn("Create far", "The License must be entered.");
- return false;
- }
- farHeader.setLicense(this.jTextAreaLicense.getText());
-
- farHeader.setSpecification(this.jTextFieldSpecification.getText());
- return true;
- }
-
- /**
- * Check the input data is empty or not
- *
- * @param strValue
- * The input data which need be checked
- *
- * @retval true - The input data is empty
- * @retval fals - The input data is not empty
- *
- */
- public boolean isEmpty(String strValue) {
- if (strValue.length() > 0) {
- return false;
- }
- return true;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonNext) {
- //
- // Add some logic process here
- //
- if (!valid()) {
- return ;
- }
- if (stepTwo == null) {
- stepTwo = new CreateStepTwo(this, true, this);
- }
- this.setVisible(false);
- stepTwo.setVisible(true);
- } else if (e.getSource() == jButtonGenerateGuid) {
- this.jTextFieldGuid.setText(Tools.generateUuidString());
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public FarHeader getFarHeader() {
- return farHeader;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepThree.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepThree.java deleted file mode 100644 index 666082d3d4..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepThree.java +++ /dev/null @@ -1,294 +0,0 @@ -/** @file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.far.createui;
-
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-
-public class CreateStepThree extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 7559888600474043337L;
-
- private JPanel jContentPane = null;
-
- private JTextArea jTextArea = null;
-
- private JButton jButtonNext = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonPrevious = null;
-
- private JLabel jLabel = null;
-
- private ICheckBoxList jComboBoxFileFilter = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabel1 = null;
-
- private JTextField jTextField = null;
-
- Vector<String> v = new Vector<String>();
-
- private CreateStepTwo stepTwo = null;
-
- private CreateStepFour stepFour = null;
-
- public CreateStepThree(IDialog iDialog, boolean modal, CreateStepTwo stepTwo) {
- this(iDialog, modal);
- this.stepTwo = stepTwo;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Add additional file filter regular expressions in the text field, separated by space characters.\n");
- jTextArea.append("Note, for additional information about regular expressions, please reference PERL language regular expressions.");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jButtonNext
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNext() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonNext.setText("Next");
- jButtonNext.addMouseListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonPrevious
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonPrevious() {
- if (jButtonPrevious == null) {
- jButtonPrevious = new JButton();
- jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
- jButtonPrevious.setText("Previous");
- jButtonPrevious.addMouseListener(this);
- }
- return jButtonPrevious;
- }
-
- /**
- * This method initializes jComboBox
- *
- * @return javax.swing.JComboBox
- */
- private ICheckBoxList getJComboBoxFileFilter() {
- if (jComboBoxFileFilter == null) {
- jComboBoxFileFilter = new ICheckBoxList();
- v.addElement(".svn");
- v.addElement("CVS");
- jComboBoxFileFilter.setAllItems(v);
- jComboBoxFileFilter.initCheckedItem(true, v);
- }
- return jComboBoxFileFilter;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(30, 85, 640, 130));
- jScrollPane.setViewportView(getJComboBoxFileFilter());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextField() {
- if (jTextField == null) {
- jTextField = new JTextField();
- jTextField.setBounds(new java.awt.Rectangle(30, 250, 640, 20));
- }
- return jTextField;
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- }
-
- /**
- * This is the default constructor
- */
- public CreateStepThree(IDialog iDialog, boolean modal) {
- super(iDialog, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.CREATE_STEP_THREE_TITLE);
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel1 = new JLabel();
- jLabel1.setBounds(new java.awt.Rectangle(30, 220, 260, 20));
- jLabel1.setText("Input File Filter Pattern (regular expressions)");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 64, 160, 20));
- jLabel.setText("File Filter Pattern: ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(getJButtonNext(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonPrevious(), null);
- jContentPane.add(jLabel, null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(jLabel1, null);
- jContentPane.add(getJTextField(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonNext) {
- //
- // Add some logic process here
- //
-
- if (stepFour == null) {
- stepFour = new CreateStepFour(this, true, this);
- }
-
- this.setVisible(false);
- stepFour.setVisible(true);
- } else if (e.getSource() == jButtonPrevious) {
- this.setVisible(false);
- stepTwo.setVisible(true);
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public Set<String> getFileFilter() {
- Set<String> result = new LinkedHashSet<String>();
- Vector<Integer> selected = jComboBoxFileFilter.getAllCheckedItemsIndex();
-
- Iterator<Integer> iter = selected.iterator();
-
- while (iter.hasNext()) {
- result.add(v.get(iter.next().intValue()));
- }
-
- String[] userdefined = jTextField.getText().split(" ");
-
- for (int i = 0; i < userdefined.length; i++) {
- if (!userdefined[i].trim().equalsIgnoreCase("")) {
- result.add(userdefined[i]);
- }
- }
-
- return result;
- }
-
- public CreateStepTwo getPreviousStep() {
- return stepTwo;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepTwo.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepTwo.java deleted file mode 100644 index a2e3500c3a..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepTwo.java +++ /dev/null @@ -1,349 +0,0 @@ -/** @file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.far.createui;
-
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class CreateStepTwo extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 3003841865197005528L;
-
- private JPanel jContentPane = null;
-
- private JTextArea jTextArea = null;
-
- private JLabel jLabel = null;
-
- private JLabel jLabel1 = null;
-
- private ICheckBoxList jComboBoxPackage = null;
-
- private ICheckBoxList jComboBoxPlatform = null;
-
- private JButton jButtonNext = null;
-
- private JButton jButtonCancel = null;
-
- private JScrollPane jScrollPanePackage = null;
-
- private JScrollPane jScrollPanePlatform = null;
-
- private CreateStepThree stepThree = null;
-
- private Vector<PlatformIdentification> platformVector = null;
-
- private Vector<PackageIdentification> packageVector = null;
-
- private CreateStepOne stepOne = null;
-
- private JButton jButtonPrevious = null;
-
- public CreateStepTwo(IDialog iDialog, boolean modal, CreateStepOne stepOne) {
- this(iDialog, modal);
- this.stepOne = stepOne;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Choose at least one package or platform. ");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jComboBox
- *
- * @return javax.swing.JComboBox
- */
- private ICheckBoxList getJComboBoxPackage() {
- if (jComboBoxPackage == null) {
- jComboBoxPackage = new ICheckBoxList();
- WorkspaceTools wt = new WorkspaceTools();
- Vector<String> v = new Vector<String>();
- packageVector = wt.getAllPackages();
- Iterator<PackageIdentification> iter = packageVector.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- String str = item.getName() + " " + item.getVersion() + " [" + item.getPath() + "]";
- v.addElement(str);
- }
- jComboBoxPackage.setAllItems(v);
- }
- return jComboBoxPackage;
- }
-
- /**
- * This method initializes jComboBox1
- *
- * @return javax.swing.JComboBox
- */
- private ICheckBoxList getJComboBoxPlatform() {
- if (jComboBoxPlatform == null) {
- jComboBoxPlatform = new ICheckBoxList();
- WorkspaceTools wt = new WorkspaceTools();
- Vector<String> v = new Vector<String>();
- platformVector = wt.getAllPlatforms();
- Iterator<PlatformIdentification> iter = platformVector.iterator();
- while (iter.hasNext()) {
- PlatformIdentification item = iter.next();
- String str = item.getName() + " " + item.getVersion() + " [" + item.getPath() + "]";
- v.addElement(str);
- }
- jComboBoxPlatform.setAllItems(v);
- }
- return jComboBoxPlatform;
- }
-
- /**
- * This method initializes jButtonNext
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNext() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonNext.setText("Next");
- jButtonNext.addMouseListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPanePackage() {
- if (jScrollPanePackage == null) {
- jScrollPanePackage = new JScrollPane();
- jScrollPanePackage.setBounds(new java.awt.Rectangle(140,65,535,130));
- jScrollPanePackage.setViewportView(getJComboBoxPackage());
- }
- return jScrollPanePackage;
- }
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPanePlatform() {
- if (jScrollPanePlatform == null) {
- jScrollPanePlatform = new JScrollPane();
- jScrollPanePlatform.setBounds(new java.awt.Rectangle(140,200,535,110));
- jScrollPanePlatform.setViewportView(getJComboBoxPlatform());
- }
- return jScrollPanePlatform;
- }
-
- /**
- * This is the default constructor
- */
- public CreateStepTwo(IDialog iDialog, boolean modal) {
- super(iDialog, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.CREATE_STEP_TWO_TITLE);
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel1 = new JLabel();
- jLabel1.setBounds(new java.awt.Rectangle(30, 200, 100, 20));
- jLabel1.setText("Platforms: ");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 64, 100, 20));
- jLabel.setText("Packages:");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(jLabel, null);
- jContentPane.add(jLabel1, null);
- jContentPane.add(getJButtonNext(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJScrollPanePackage(), null);
- jContentPane.add(getJScrollPanePlatform(), null);
- jContentPane.add(getJButtonPrevious(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonPrevious) {
- this.setVisible(false);
- stepOne.setVisible(true);
- } else if (e.getSource() == jButtonNext) {
- //
- // Add some logic process here
- //
- if (jComboBoxPlatform.getAllCheckedItemsIndex().size() == 0
- && jComboBoxPackage.getAllCheckedItemsIndex().size() == 0) {
- Log.wrn("Create far", "Choose at least one package and/or platform.");
- return;
- }
-
- //
- // If some packages a Repackage=false, give a warning message
- //
- List<PackageIdentification> selectedPackages = getSelectedPackages();
- WorkspaceTools wt = new WorkspaceTools();
- List<PackageIdentification> allRepackablePackages = wt.getAllRepackagablePackages();
-
- List<PackageIdentification> unRepackablePackages = new Vector<PackageIdentification>();
- String msg = "Following selected packages: \n";
- Iterator<PackageIdentification> iter = selectedPackages.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- if (!allRepackablePackages.contains(item)) {
- unRepackablePackages.add(item);
- msg += item.getName() + "\n";
- }
- }
- msg += "is un-Repackagable. Do you want to continue? ";
-
- if (unRepackablePackages.size() > 0) {
- if(JOptionPane.showConfirmDialog(this, msg, "Warning", JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) {
- return ;
- }
- }
-
- if (stepThree == null) {
- stepThree = new CreateStepThree(this, true, this);
- }
- this.setVisible(false);
- stepThree.setVisible(true);
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * This method initializes jButtonPrevious
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonPrevious() {
- if (jButtonPrevious == null) {
- jButtonPrevious = new JButton();
- jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
- jButtonPrevious.setText("Previous");
- jButtonPrevious.addMouseListener(this);
- }
- return jButtonPrevious;
- }
-
- public List<PackageIdentification> getSelectedPackages() {
- Vector<Integer> v = jComboBoxPackage.getAllCheckedItemsIndex();
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- for (int i = 0; i < v.size(); i++) {
- result.add(packageVector.get(v.get(i).intValue()));
- }
- return result;
- }
-
- public List<PlatformIdentification> getSelectedPlatforms() {
- Vector<Integer> v = jComboBoxPlatform.getAllCheckedItemsIndex();
- List<PlatformIdentification> result = new ArrayList<PlatformIdentification>();
- for (int i = 0; i < v.size(); i++) {
- result.add(platformVector.get(v.get(i).intValue()));
- }
- return result;
- }
-
- public CreateStepOne getPreviousStep() {
- return stepOne;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepOne.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepOne.java deleted file mode 100644 index f5b68f4eae..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepOne.java +++ /dev/null @@ -1,374 +0,0 @@ -/** @file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.far.deleteui;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.far.AggregationOperation;
-import org.tianocore.frameworkwizard.far.FarIdentification;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.far.PackageQuery;
-import org.tianocore.frameworkwizard.far.PackageQueryInterface;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class DeleteStepOne extends IDialog implements ListSelectionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 636773964435618476L;
-
- private JPanel jContentPane = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonNext = null;
-
- private JTextArea jTextAreaInstruction = null;
-
- private JLabel jLabel = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabel2 = null;
-
- private JLabel jLabel3 = null;
-
- private JScrollPane jScrollPane1 = null;
-
- private JScrollPane jScrollPane2 = null;
-
- private JList jListPlatform = null;
-
- private JList jListPackage = null;
-
- private JLabel jLabel4 = null;
-
- private JButton jButtonDetail = null;
-
- private JList jListFar = null;
-
- private JLabel jLabelImage = null;
-
- private Vector<FarIdentification> farVector = null;
-
- Vector<PackageIdentification> removePackages = null;
-
- Vector<PlatformIdentification> removePlatforms = null;
-
- private DeleteStepTwo stepTwo = null;
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonFinish
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNext() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonNext.setText("Next");
- jButtonNext.setEnabled(false);
- jButtonNext.addActionListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jTextArea1
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea1() {
- if (jTextAreaInstruction == null) {
- jTextAreaInstruction = new JTextArea();
- jTextAreaInstruction.setBounds(new java.awt.Rectangle(30, 7, 662, 50));
- jTextAreaInstruction.setText("Step 1: Select FAR to remove.\n");
- jTextAreaInstruction.setCaretColor(Color.RED);
- jTextAreaInstruction
- .append("After choosing the FAR, the packages and/or platforms that belong to the FAR will displayed.\n");
- jTextAreaInstruction.append("Icon \"OK\" or \"NO\" indicates whether the FAR can be safely removed.");
- jTextAreaInstruction.setEditable(false);
- }
- return jTextAreaInstruction;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(140, 65, 530, 100));
- jScrollPane.setViewportView(getJListFar());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane1() {
- if (jScrollPane1 == null) {
- jScrollPane1 = new JScrollPane();
- jScrollPane1.setBounds(new java.awt.Rectangle(30, 195, 300, 115));
- jScrollPane1.setViewportView(getJListPackage());
- }
- return jScrollPane1;
- }
-
- /**
- * This method initializes jScrollPane2
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane2() {
- if (jScrollPane2 == null) {
- jScrollPane2 = new JScrollPane();
- jScrollPane2.setBounds(new java.awt.Rectangle(360, 195, 310, 115));
- jScrollPane2.setViewportView(getJListPlatform());
- }
- return jScrollPane2;
- }
-
- /**
- * This method initializes jList
- *
- * @return javax.swing.JList
- */
- private JList getJListPlatform() {
- if (jListPlatform == null) {
- jListPlatform = new JList();
- jListPlatform.setEnabled(false);
- }
- return jListPlatform;
- }
-
- /**
- * This method initializes jList1
- *
- * @return javax.swing.JList
- */
- private JList getJListPackage() {
- if (jListPackage == null) {
- jListPackage = new JList();
- jListPackage.setEnabled(false);
- }
- return jListPackage;
- }
-
- /**
- * This method initializes jButtonDetail
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDetail() {
- if (jButtonDetail == null) {
- jButtonDetail = new JButton();
- jButtonDetail.setBounds(new java.awt.Rectangle(367, 325, 69, 20));
- jButtonDetail.setText("Detail");
- jButtonDetail.setVisible(false);
- }
- return jButtonDetail;
- }
-
- /**
- * This method initializes jListFar
- *
- * @return javax.swing.JList
- */
- private JList getJListFar() {
- if (jListFar == null) {
- jListFar = new JList();
- WorkspaceTools wt = new WorkspaceTools();
- farVector = wt.getAllFars();
- jListFar.setListData(farVector);
- jListFar.addListSelectionListener(this);
- }
- return jListFar;
- }
-
- /**
- * This is the default constructor
- */
- public DeleteStepOne(IFrame iFrame, boolean modal) {
- super(iFrame, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.DELETE_STEP_ONE_TITLE);
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelImage = new JLabel();
- jLabelImage.setBounds(new java.awt.Rectangle(30, 319, 36, 36));
- jLabel4 = new JLabel();
- jLabel4.setBounds(new java.awt.Rectangle(71, 325, 320, 20));
- jLabel3 = new JLabel();
- jLabel3.setBounds(new java.awt.Rectangle(360, 170, 113, 20));
- jLabel3.setText("FAR's Platforms");
- jLabel2 = new JLabel();
- jLabel2.setBounds(new java.awt.Rectangle(30, 170, 113, 20));
- jLabel2.setText("FAR's Packages");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 65, 100, 20));
- jLabel.setText("Select one FAR: ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonNext(), null);
- jContentPane.add(getJTextArea1(), null);
- jContentPane.add(jLabel, null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(jLabel2, null);
- jContentPane.add(jLabel3, null);
- jContentPane.add(getJScrollPane1(), null);
- jContentPane.add(getJScrollPane2(), null);
- jContentPane.add(jLabel4, null);
- jContentPane.add(getJButtonDetail(), null);
- jContentPane.add(jLabelImage, null);
- }
- return jContentPane;
- }
-
- public void valueChanged(ListSelectionEvent e) {
- //
- // Add logic for FAR list value changed
- //
- if (e.getSource() == jListFar) {
- boolean flag = true;
- FarIdentification far = (FarIdentification) jListFar.getSelectedValue();
- WorkspaceTools wt = new WorkspaceTools();
-
- removePackages = wt.getPackagesByFar(far);
- jListPackage.setListData(removePackages);
- removePlatforms = wt.getPlatformsByFar(far);
- jListPlatform.setListData(removePlatforms);
-
- //
- // Get Dependencies Info for current FAR
- //
- List<PackageIdentification> allPackages = wt.getAllPackages();
-
- //
- // Remain packages
- //
- allPackages.removeAll(removePackages);
-
- Iterator<PackageIdentification> iter = allPackages.iterator();
-
- PackageQueryInterface pq = new PackageQuery();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- List<PackageIdentification> list = pq.getPackageDependencies(item.getSpdFile());
- List<PackageIdentification> result = AggregationOperation.minus(list, allPackages);
- if (result.size() > 0) {
- if (AggregationOperation.intersection(result, removePackages).size() > 0) {
- flag = false;
- break;
- }
- }
- }
-
- if (flag) {
- jLabelImage.setIcon(new ImageIcon(getClass().getResource("/resources/images/Yes.JPG")));
- jLabel4.setText("None of the remaining packages depend on this FAR. ");
- jButtonDetail.setVisible(false);
- jButtonNext.setEnabled(true);
- } else {
- jLabelImage.setIcon(new ImageIcon(getClass().getResource("/resources/images/No.JPG")));
- jLabel4.setText("Some of the remaining packages still depend on this FAR. ");
- // jButtonDetail.setVisible(true);
- jButtonNext.setEnabled(false);
- }
- }
- }
-
- public void actionPerformed(ActionEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonNext) {
- //
- // Add some logic process here
- //
-
- if (stepTwo == null) {
- stepTwo = new DeleteStepTwo(this, true, this);
- }
- this.setVisible(false);
- stepTwo.setVisible(true);
- }
-
- }
-
- public FarIdentification getSelecedFar() {
- return (FarIdentification) jListFar.getSelectedValue();
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepTwo.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepTwo.java deleted file mode 100644 index 8d7e4e6fed..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepTwo.java +++ /dev/null @@ -1,351 +0,0 @@ -/** @file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.far.deleteui;
-
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.io.File;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.ButtonGroup;
-import javax.swing.JPanel;
-import javax.swing.JButton;
-import javax.swing.JTextArea;
-import javax.swing.JLabel;
-import javax.swing.JRadioButton;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.far.FarIdentification;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class DeleteStepTwo extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = -1333748185798962746L;
-
- private JPanel jContentPane = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonFinish = null;
-
- private JButton jButtonPrevious = null;
-
- private JTextArea jTextArea = null;
-
- private JLabel jLabel = null;
-
- private JRadioButton jRadioButton = null;
-
- private JRadioButton jRadioButton1 = null;
-
- private DeleteStepOne stepOne = null;
-
- public DeleteStepTwo(IDialog iDialog, boolean modal, DeleteStepOne stepOne) {
- this(iDialog, modal);
- this.stepOne = stepOne;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonFinish
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFinish() {
- if (jButtonFinish == null) {
- jButtonFinish = new JButton();
- jButtonFinish.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonFinish.setText("Finish");
- jButtonFinish.addMouseListener(this);
- }
- return jButtonFinish;
- }
-
- /**
- * This method initializes jButtonPrevious
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonPrevious() {
- if (jButtonPrevious == null) {
- jButtonPrevious = new JButton();
- jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
- jButtonPrevious.setText("Previous");
- jButtonPrevious.addMouseListener(this);
- }
- return jButtonPrevious;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Step 2: Choose Delete Mode. \n");
- jTextArea.append("Mode 1 Only remove registation information from the WORKSPACE. \n");
- jTextArea.append("Mode 2 Also delete all files and directories from file system. ");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jRadioButton
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButton() {
- if (jRadioButton == null) {
- jRadioButton = new JRadioButton();
- jRadioButton.setBounds(new java.awt.Rectangle(40,100,440,20));
- jRadioButton.setSelected(true);
- jRadioButton.setText("Mode 1: Only remove registration information from the WORKSPACE.");
- }
- return jRadioButton;
- }
-
- /**
- * This method initializes jRadioButton1
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButton1() {
- if (jRadioButton1 == null) {
- jRadioButton1 = new JRadioButton();
- jRadioButton1.setBounds(new java.awt.Rectangle(40,140,440,20));
- jRadioButton1.setText("Mode 2: Delete ALL related files and directories from the WORKSPACE.");
- }
- return jRadioButton1;
- }
-
- /**
- * This is the default constructor
- */
- public DeleteStepTwo(IDialog iDialog, boolean modal) {
- super(iDialog, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.DELETE_STEP_TWO_TITLE);
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 70, 200, 20));
- jLabel.setText("Select delete mode: ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonFinish(), null);
- jContentPane.add(getJButtonPrevious(), null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(jLabel, null);
- ButtonGroup group = new ButtonGroup();
- group.add(getJRadioButton());
- group.add(getJRadioButton1());
- jContentPane.add(getJRadioButton(), null);
- jContentPane.add(getJRadioButton1(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- this.dispose();
- } else if (e.getSource() == jButtonFinish) {
- FarIdentification far = stepOne.getSelecedFar();
- WorkspaceTools wt = new WorkspaceTools();
- //
- // If remove all source files
- //
- if (jRadioButton1.isSelected()) {
-
- Vector<PackageIdentification> removePackages = wt.getPackagesByFar(far);
- Vector<PlatformIdentification> removePlatforms = wt.getPlatformsByFar(far);
-
- Vector<PlatformIdentification> allPlatforms = wt.getAllPlatforms();
- Set<File> allPlatformFiles = new LinkedHashSet<File>();
-
- Iterator<PlatformIdentification> iter = allPlatforms.iterator();
- while (iter.hasNext()) {
- allPlatformFiles.add(iter.next().getFpdFile());
- }
-
- //
- // For all platforms, only remove its FPD file
- //
- Iterator<PlatformIdentification> platfomrIter = removePlatforms.iterator();
- while (platfomrIter.hasNext()) {
- PlatformIdentification item = platfomrIter.next();
- allPlatformFiles.remove(item.getFpdFile());
- File parentDir = item.getFpdFile().getParentFile();
- item.getFpdFile().delete();
- //
- // Remove all empty parent dir
- //
- while (parentDir.listFiles().length == 0) {
- File tempFile = parentDir;
- parentDir = parentDir.getParentFile();
- tempFile.delete();
- }
- }
-
- //
- // For all packages, remove all files.
- // Exception FPD file still in DB
- //
-
- Iterator<PackageIdentification> packageIter = removePackages.iterator();
- while (packageIter.hasNext()) {
- PackageIdentification item = packageIter.next();
- Set<File> deleteFiles = new LinkedHashSet<File>();
- recursiveDir(deleteFiles, item.getSpdFile().getParentFile(), allPlatformFiles);
- Iterator<File> iterDeleteFile = deleteFiles.iterator();
- while (iterDeleteFile.hasNext()) {
- deleteFiles(iterDeleteFile.next());
- }
- //
- // Remove all empty parent dir
- //
- File parentDir = item.getSpdFile().getParentFile();
- while (parentDir.listFiles().length == 0) {
- File tempFile = parentDir;
- parentDir = parentDir.getParentFile();
- tempFile.delete();
- }
- }
- }
-
- //
- // Update DB file
- //
- wt.removeFarFromDb(far);
-
- this.setVisible(false);
- this.stepOne.returnType = DataType.RETURN_TYPE_OK;
- this.dispose();
- } else if (e.getSource() == jButtonPrevious) {
- this.setVisible(false);
- stepOne.setVisible(true);
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- private void recursiveDir(Set<File> files, File dir, Set<File> platformFiles) {
- File[] fileList = dir.listFiles();
- for (int i = 0; i < fileList.length; i++) {
- if (fileList[i].isFile()) {
- if (!platformFiles.contains(fileList[i])) {
- files.add(fileList[i]);
- }
- } else {
- if (isContain(fileList[i], platformFiles)) {
- recursiveDir(files, fileList[i], platformFiles);
- } else {
- files.add(fileList[i]);
- }
- }
- }
- }
-
- private void deleteFiles(File file) {
- if (file.isDirectory()) {
- File[] files = file.listFiles();
- for (int i = 0; i < files.length; i++) {
- deleteFiles(files[i]);
- }
- }
- file.delete();
- }
-
- private boolean isContain(File dir, Set<File> platformFiles) {
- Iterator<File> iter = platformFiles.iterator();
- while (iter.hasNext()) {
- File file = iter.next();
- if (file.getPath().startsWith(dir.getPath())) {
- //
- // continue this FPD file
- //
- return true;
- }
- }
- return false;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepOne.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepOne.java deleted file mode 100644 index 24cd1369ea..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepOne.java +++ /dev/null @@ -1,362 +0,0 @@ -/** @file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.far.installui;
-
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.io.File;
-import java.util.List;
-import java.util.jar.JarFile;
-import java.util.Iterator;
-
-import javax.swing.JFileChooser;
-import javax.swing.JPanel;
-import javax.swing.JButton;
-import javax.swing.JTextArea;
-import javax.swing.JLabel;
-import javax.swing.JTextField;
-import javax.swing.ListSelectionModel;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IFileFilter;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.far.DistributeRule;
-import org.tianocore.frameworkwizard.far.Far;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableModel;
-
-public class InstallStepOne extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = -8821906198791949544L;
-
- private JPanel jContentPane = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonNext = null;
-
- private JTextArea jTextArea = null;
-
- private JLabel jLabel = null;
-
- private JTextField jTextFieldFarFile = null;
-
- private JButton jButtonBrowser = null;
-
- private InstallStepTwo stepTwo = null;
-
- Far far = null;
-
- private JLabel jLabelWarning = null;
-
- private JScrollPane jScrollPane = null;
-
- private JTable jTable = null;
-
- private PartialTableModel model = null;
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonNext
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNext() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonNext.setText("Next");
- jButtonNext.addMouseListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Step 1: Choose a framework archive(FAR) file. \n");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFarFile() {
- if (jTextFieldFarFile == null) {
- jTextFieldFarFile = new JTextField();
- jTextFieldFarFile.setBounds(new java.awt.Rectangle(140, 80, 423, 20));
- }
- return jTextFieldFarFile;
- }
-
- /**
- * This method initializes jButtonBrowser
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonBrowser() {
- if (jButtonBrowser == null) {
- jButtonBrowser = new JButton();
- jButtonBrowser.setBounds(new java.awt.Rectangle(570, 80, 100, 20));
- jButtonBrowser.setText("Browser...");
- jButtonBrowser.addMouseListener(this);
- }
- return jButtonBrowser;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(30, 165, 642, 140));
- jScrollPane.setViewportView(getJTable());
- }
- jScrollPane.setVisible(false);
- return jScrollPane;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new PartialTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
- jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- model.addColumn("Name");
- model.addColumn("Version");
- model.addColumn("GUID");
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- }
- jTable.setVisible(false);
- return jTable;
- }
-
- public void prepareTable(List<PackageIdentification> packageList) {
- model.setRowCount(0);
- //
- // Change here to get packages and platforms from FAR
- //
- Iterator<PackageIdentification> iter = packageList.iterator();
- while (iter.hasNext()) {
- String[] str = new String[3];
- PackageIdentification item = iter.next();
- str[0] = item.getName();
- str[1] = item.getVersion();
- str[2] = item.getGuid();
- model.addRow(str);
- }
- }
-
- /**
- * This is the default constructor
- */
- public InstallStepOne(IFrame iFrame, boolean modal) {
- super(iFrame, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.INSTALL_STEP_ONE_TITLE);
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelWarning = new JLabel();
- jLabelWarning.setBounds(new java.awt.Rectangle(30, 125, 510, 20));
- jLabelWarning.setText("Cannot install this FAR, the WORKSPACE is missing the following required packages.");
- jLabelWarning.setVisible(false);
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 80, 97, 20));
- jLabel.setText("Choose FAR file: ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonNext(), null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(jLabel, null);
- jContentPane.add(getJTextFieldFarFile(), null);
- jContentPane.add(getJButtonBrowser(), null);
- jContentPane.add(jLabelWarning, null);
- jContentPane.add(getJScrollPane(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonNext) {
- //
- // Add some logic process here
- //
- File farFile = new File(jTextFieldFarFile.getText());
- if (!farFile.exists() || !farFile.isFile()) {
- Log.wrn("Install far", "Please choose an existing FAR file.");
- return;
- }
-
- //
- // Verify Far
- //
- JarFile jarFar;
- try {
- jarFar = new JarFile(farFile);
- far = new Far(jarFar);
-
- //
- // Far dependency check
- //
- List<PackageIdentification> pkgIdList = DistributeRule.installFarCheck(far);
-
- if (pkgIdList.size() > 0) {
- prepareTable(pkgIdList);
- jLabelWarning.setVisible(true);
- jTable.setVisible(true);
- jScrollPane.setVisible(true);
- return;
- }
-
- } catch (Exception exp) {
- Log.wrn("Install far" + exp.getMessage());
- Log.err("Install far" + exp.getMessage());
- }
-
- if (stepTwo == null) {
- stepTwo = new InstallStepTwo(this, true, this);
- }
- this.setVisible(false);
-
- //
- // Refresh table
- //
- stepTwo.preparePackageTable();
- stepTwo.preparePlatformTable();
- stepTwo.setVisible(true);
- } else if (e.getSource() == jButtonBrowser) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
- fc.addChoosableFileFilter(new IFileFilter(DataType.FAR_SURFACE_AREA_EXT));
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
-
- int result = fc.showOpenDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- jLabelWarning.setVisible(false);
- jTable.setVisible(false);
- jScrollPane.setVisible(false);
- this.jTextFieldFarFile.setText(Tools.addPathExt(fc.getSelectedFile().getPath(),
- DataType.RETURN_TYPE_FAR_SURFACE_AREA));
- }
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public Far getFar() {
- return far;
- }
-
-}
-
-class PartialTableModel extends DefaultTableModel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int col) {
- switch (col) {
- default:
- return false;
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepTwo.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepTwo.java deleted file mode 100644 index 68d286cdf5..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepTwo.java +++ /dev/null @@ -1,483 +0,0 @@ -/** @file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.far.installui;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.ListSelectionModel;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.JTable;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.far.Far;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class InstallStepTwo extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 4583090421587036969L;
-
- private JPanel jContentPane = null;
-
- private JTextArea jTextArea = null;
-
- private PartialEditableTableModel packageModel = null;
-
- private PartialEditableTableModel platformModel = null;
-
- private InstallStepOne stepOne = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonFinish = null;
-
- private JButton jButtonPrevious = null;
-
- private JLabel jLabel = null;
-
- private JScrollPane jScrollPane = null;
-
- private JTable jTablePackage = null;
-
- private JLabel jLabel1 = null;
-
- private JScrollPane jScrollPane1 = null;
-
- private JTable jTablePlatform = null;
-
- List<PlatformIdentification> platformVector = null;
-
- List<PackageIdentification> packageVector = null;
-
- public InstallStepTwo(IDialog iDialog, boolean modal, InstallStepOne stepOne) {
- this(iDialog, modal);
- this.stepOne = stepOne;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Step 2: Set Install Path for Packages and/or Platforms.\n");
- jTextArea.setCaretColor(Color.RED);
- jTextArea.append("Note that the Install Path is Relative to WORKSPACE. ");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonFinish
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFinish() {
- if (jButtonFinish == null) {
- jButtonFinish = new JButton();
- jButtonFinish.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonFinish.setText("Finish");
- jButtonFinish.addMouseListener(this);
- }
- return jButtonFinish;
- }
-
- /**
- * This method initializes jButtonPrevious
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonPrevious() {
- if (jButtonPrevious == null) {
- jButtonPrevious = new JButton();
- jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
- jButtonPrevious.setText("Previous");
- jButtonPrevious.addMouseListener(this);
- }
- return jButtonPrevious;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(30, 80, 642, 110));
- jScrollPane.setViewportView(getJTablePackage());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTablePackage() {
- if (jTablePackage == null) {
- jTablePackage = new JTable();
- packageModel = new PartialEditableTableModel();
- jTablePackage = new JTable(packageModel);
- jTablePackage.setRowHeight(20);
- jTablePackage.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- packageModel.addColumn("Name");
- packageModel.addColumn("Version");
- packageModel.addColumn("Default Path");
- packageModel.addColumn("Install To");
-
- jTablePackage.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- }
- return jTablePackage;
- }
-
- public void preparePackageTable() {
- packageModel.setRowCount(0);
- //
- // Change here to get packages and platforms from FAR
- //
- try {
- Far far = stepOne.getFar();
-
- packageVector = far.manifest.getPackageList();
- Iterator<PackageIdentification> iter = packageVector.iterator();
- while (iter.hasNext()) {
- String[] str = new String[4];
- PackageIdentification item = iter.next();
- str[0] = item.getName();
- str[1] = item.getVersion();
- str[2] = Tools.getFilePathOnly(Tools.getRelativePath(item.getPath(), Workspace.getCurrentWorkspace()));
- str[3] = Tools.getFilePathOnly(Tools.getRelativePath(item.getPath(), Workspace.getCurrentWorkspace()));
- packageModel.addRow(str);
- }
- } catch (Exception e) {
- }
- }
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane1() {
- if (jScrollPane1 == null) {
- jScrollPane1 = new JScrollPane();
- jScrollPane1.setBounds(new java.awt.Rectangle(30, 215, 642, 110));
- jScrollPane1.setViewportView(getJTablePlatform());
- }
- return jScrollPane1;
- }
-
- /**
- * This method initializes jTablePlatform
- *
- * @return javax.swing.JTable
- */
- private JTable getJTablePlatform() {
- if (jTablePlatform == null) {
- jTablePlatform = new JTable();
- platformModel = new PartialEditableTableModel();
- jTablePlatform = new JTable(platformModel);
- jTablePlatform.setRowHeight(20);
- jTablePlatform.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- platformModel.addColumn("Name");
- platformModel.addColumn("Version");
- platformModel.addColumn("Default Path");
- platformModel.addColumn("Install To");
-
- jTablePlatform.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- preparePlatformTable();
- }
- return jTablePlatform;
- }
-
- public void preparePlatformTable() {
- platformModel.setRowCount(0);
- //
- // Change here to get packages and platforms from FAR
- //
- try {
- Far far = stepOne.getFar();
-
- platformVector = far.manifest.getPlatformList();
- Iterator<PlatformIdentification> iter = platformVector.iterator();
- while (iter.hasNext()) {
- String[] str = new String[4];
- PlatformIdentification item = iter.next();
- str[0] = item.getName();
- str[1] = item.getVersion();
- str[2] = Tools.getFilePathOnly(Tools.getRelativePath(item.getPath(), Workspace.getCurrentWorkspace()));
- str[3] = Tools.getFilePathOnly(Tools.getRelativePath(item.getPath(), Workspace.getCurrentWorkspace()));
- platformModel.addRow(str);
- }
- } catch (Exception e) {
- }
- }
-
- /**
- * This is the default constructor
- */
- public InstallStepTwo(IDialog iDialog, boolean modal) {
- super(iDialog, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.INSTALL_STEP_TWO_TITLE);
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel1 = new JLabel();
- jLabel1.setBounds(new java.awt.Rectangle(30, 195, 348, 18));
- jLabel1.setText("Edit \"Install To\" paths for platforms: ");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(29, 60, 366, 20));
- jLabel.setText("Edit \"Install To\" paths for packages");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonFinish(), null);
- jContentPane.add(getJButtonPrevious(), null);
- jContentPane.add(jLabel, null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(jLabel1, null);
- jContentPane.add(getJScrollPane1(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- this.dispose();
- } else if (e.getSource() == jButtonFinish) {
-
- if (jTablePackage.isEditing()) {
- jTablePackage.getCellEditor().stopCellEditing();
- }
-
- if (jTablePlatform.isEditing()) {
- jTablePlatform.getCellEditor().stopCellEditing();
- }
-
- List<String> packageList = new ArrayList<String>();
- List<String> platformList = new ArrayList<String>();
- //
- // Add some logic process here
- // Guid Check, File Check etc.
- //
- Set<File> allNewPath = new LinkedHashSet<File>();
- Map<PackageIdentification, File> packageMap = new LinkedHashMap<PackageIdentification, File>();
- for (int i = 0; i < packageModel.getRowCount(); i++) {
- File toFile = new File(Workspace.getCurrentWorkspace() + File.separatorChar
- + packageModel.getValueAt(i, 3));
- if (!isPackagePathValid(toFile)) {
- Log.wrn("Install far", packageVector.get(i) + " path already contains a package.");
- return;
- }
- if (allNewPath.contains(toFile)) {
- Log.wrn("Install far", "Path " + packageModel.getValueAt(i, 3) + " is specified twice.");
- return;
- }
- allNewPath.add(toFile);
- File spdFile = new File((String) packageModel.getValueAt(i, 3) + File.separatorChar
- + packageVector.get(i).getSpdFile().getName());
- packageList.add(spdFile.getPath());
- packageMap.put(packageVector.get(i), toFile);
- }
-
- Map<PlatformIdentification, File> platformMap = new LinkedHashMap<PlatformIdentification, File>();
- for (int i = 0; i < platformModel.getRowCount(); i++) {
- File toFile = new File(Workspace.getCurrentWorkspace() + File.separatorChar
- + platformModel.getValueAt(i, 3));
- if (!isPlatformPathValid(toFile)) {
- Log.wrn("Install far", platformVector.get(i) + " path already contains a platform.");
- return;
- }
- File fpdFile = new File((String) platformModel.getValueAt(i, 3) + File.separatorChar
- + platformVector.get(i).getFpdFile().getName());
- platformList.add(fpdFile.getPath());
- platformMap.put(platformVector.get(i), toFile);
- }
-
- //
- //
- //
- Far far = stepOne.getFar();
- try {
- far.InstallFar(platformMap, packageMap);
- //
- // Add to database
- //
- WorkspaceTools wt = new WorkspaceTools();
- wt.addFarToDb(packageList, platformList, far.manifest.getHeader());
- } catch (Exception ex) {
- Log.wrn("Install far", ex.getMessage());
- Log.err("Install far", ex.getMessage());
- return;
- }
-
- this.setVisible(false);
- this.stepOne.returnType = DataType.RETURN_TYPE_OK;
- this.dispose();
- } else if (e.getSource() == jButtonPrevious) {
- this.setVisible(false);
- stepOne.setVisible(true);
- }
- }
-
- private boolean isPackagePathValid(File spdFile) {
- WorkspaceTools wt = new WorkspaceTools();
- List<PackageIdentification> allPackages = wt.getAllPackages();
- Iterator<PackageIdentification> iter = allPackages.iterator();
-
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- if (isPathContainMutual(spdFile, item.getSpdFile())) {
- return false;
- }
- }
- return true;
- }
-
- private boolean isPlatformPathValid(File fpdFile) {
- WorkspaceTools wt = new WorkspaceTools();
- List<PlatformIdentification> allPlatforms = wt.getAllPlatforms();
- Iterator<PlatformIdentification> iter = allPlatforms.iterator();
-
- while (iter.hasNext()) {
- PlatformIdentification item = iter.next();
- if (isPathContainMutual(fpdFile, item.getFpdFile())) {
- return false;
- }
- }
- return true;
- }
-
- private boolean isPathContainMutual(File path1, File path2) {
- String s1 = Tools.addFileSeparator(path1.getPath());
- String s2 = Tools.addFileSeparator(path2.getParent());
-
- if (s1.length() > s2.length()) {
- if (s1.substring(0, s2.length()).equalsIgnoreCase(s2)) {
- return true;
- }
- } else {
- if (s2.substring(0, s1.length()).equalsIgnoreCase(s1)) {
- return true;
- }
- }
- return false;
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
-}
-
-class PartialEditableTableModel extends DefaultTableModel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int col) {
- switch (col) {
- case 3:
- return true;
- default:
- return false;
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepOne.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepOne.java deleted file mode 100644 index 5ae496672a..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepOne.java +++ /dev/null @@ -1,315 +0,0 @@ -/** @file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.far.updateui;
-
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.io.File;
-import java.util.Vector;
-import java.util.jar.JarFile;
-
-import javax.swing.JFileChooser;
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IFileFilter;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.far.Far;
-import org.tianocore.frameworkwizard.far.FarIdentification;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-import javax.swing.JScrollPane;
-import javax.swing.JList;
-
-public class UpdateStepOne extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 735554907464539931L;
-
- private JPanel jContentPane = null;
-
- private JTextArea jTextArea = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonNext = null;
-
- private JLabel jLabel = null;
-
- private JTextField jTextFieldFarFile = null;
-
- private JButton jButtonBrowser = null;
-
- private UpdateStepTwo stepTwo = null;
-
- private Far far = null;
-
- private Vector<FarIdentification> farVector = null;
-
- private JLabel jLabel1 = null;
-
- private JScrollPane jScrollPane = null;
-
- private JList jListFarFromDb = null;
-
- private File farFile = null;
-
- public File getFarFile() {
- return farFile;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Step 1: Choose framework archive (FAR) file. \n");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonNext
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNext() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonNext.setText("Next");
- jButtonNext.addMouseListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFarFile() {
- if (jTextFieldFarFile == null) {
- jTextFieldFarFile = new JTextField();
- jTextFieldFarFile.setBounds(new java.awt.Rectangle(130, 80, 436, 20));
- }
- return jTextFieldFarFile;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonBrowser() {
- if (jButtonBrowser == null) {
- jButtonBrowser = new JButton();
- jButtonBrowser.setBounds(new java.awt.Rectangle(570, 80, 100, 20));
- jButtonBrowser.setText("Browser...");
- jButtonBrowser.addMouseListener(this);
- }
- return jButtonBrowser;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(30, 135, 642, 160));
- jScrollPane.setViewportView(getJListFarFromDb());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jListFarFromDb
- *
- * @return javax.swing.JList
- */
- private JList getJListFarFromDb() {
- if (jListFarFromDb == null) {
- jListFarFromDb = new JList();
- WorkspaceTools wt = new WorkspaceTools();
- farVector = wt.getAllFars();
- jListFarFromDb.setListData(farVector);
- jListFarFromDb.setSelectionMode(0);
- }
- return jListFarFromDb;
- }
-
- /**
- * This is the default constructor
- */
- public UpdateStepOne(IFrame iFrame, boolean modal) {
- super(iFrame, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.UPDATE_STEP_ONE_TITLE);
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel1 = new JLabel();
- jLabel1.setBounds(new java.awt.Rectangle(30, 110, 355, 18));
- jLabel1.setText("Choose FAR from current WORKSPACE.");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 80, 97, 20));
- jLabel.setText("Choose FAR file: ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonNext(), null);
- jContentPane.add(jLabel, null);
- jContentPane.add(getJTextFieldFarFile(), null);
- jContentPane.add(getJButtonBrowser(), null);
- jContentPane.add(jLabel1, null);
- jContentPane.add(getJScrollPane(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonNext) {
- //
- // Judge if FAR file is existed
- //
- farFile = new File(jTextFieldFarFile.getText());
- if (!farFile.exists() || !farFile.isFile()) {
- Log.wrn("Update far", "Please choose a FAR file that already exists.");
- return;
- }
-
- //
- // Judge FAR is valid
- //
- try {
- JarFile file = new JarFile(farFile);
- this.far = new Far(file);
- } catch (Exception ex) {
- Log.wrn("Update far", ex.getMessage());
- Log.err("Update far", ex.getMessage());
- }
-
- //
- // Add more logic process here
- //
- if (jListFarFromDb.getSelectedValue() == null) {
- Log.wrn("Update far", "Please choose a FAR from current WORKSPACE.");
- return;
- }
-
- if (stepTwo == null) {
- stepTwo = new UpdateStepTwo(this, true, this);
- }
- this.setVisible(false);
- stepTwo.prepareTable();
- stepTwo.setVisible(true);
- } else if (e.getSource() == jButtonBrowser) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
- fc.addChoosableFileFilter(new IFileFilter(DataType.FAR_SURFACE_AREA_EXT));
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
-
- int result = fc.showOpenDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- this.jTextFieldFarFile.setText(Tools.addPathExt(fc.getSelectedFile().getPath(),
- DataType.RETURN_TYPE_FAR_SURFACE_AREA));
- }
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public FarIdentification getSelecedDbFar() {
- return (FarIdentification) jListFarFromDb.getSelectedValue();
- }
-
- public Far getFar() {
- return far;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepTwo.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepTwo.java deleted file mode 100644 index 6785803453..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepTwo.java +++ /dev/null @@ -1,417 +0,0 @@ -/** @file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.far.updateui;
-
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JButton;
-import javax.swing.JScrollPane;
-import javax.swing.JLabel;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.table.DefaultTableModel;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.far.AggregationOperation;
-import org.tianocore.frameworkwizard.far.DistributeRule;
-import org.tianocore.frameworkwizard.far.Far;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class UpdateStepTwo extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = -4400145363721213110L;
-
- private JPanel jContentPane = null;
-
- private JTextArea jTextArea = null;
-
- private UpdateStepOne stepOne = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonFinish = null;
-
- private JButton jButtonPrevious = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabel = null;
-
- private JTable jTablePackage = null;
-
- private PartialTableModel model = null;
-
- List<PackageIdentification> updatPkgList = new ArrayList<PackageIdentification>();
-
- public UpdateStepTwo(IDialog iDialog, boolean modal, UpdateStepOne stepOne) {
- this(iDialog, modal);
- this.stepOne = stepOne;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Step 2: Summary. \n");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonFinish
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFinish() {
- if (jButtonFinish == null) {
- jButtonFinish = new JButton();
- jButtonFinish.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonFinish.setText("Finish");
- jButtonFinish.addMouseListener(this);
- }
- return jButtonFinish;
- }
-
- /**
- * This method initializes jButtonPrevious
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonPrevious() {
- if (jButtonPrevious == null) {
- jButtonPrevious = new JButton();
- jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
- jButtonPrevious.setText("Previous");
- jButtonPrevious.addMouseListener(this);
- }
- return jButtonPrevious;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(30, 100, 642, 170));
- jScrollPane.setViewportView(getJTablePackage());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTablePackage
- *
- * @return javax.swing.JTable
- */
- private JTable getJTablePackage() {
- if (jTablePackage == null) {
- jTablePackage = new JTable();
- model = new PartialTableModel();
- jTablePackage = new JTable(model);
- jTablePackage.setRowHeight(20);
- jTablePackage.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- model.addColumn("Name");
- model.addColumn("Version");
- model.addColumn("Guid");
- model.addColumn("Path");
-
- jTablePackage.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- }
- return jTablePackage;
- }
-
- public void prepareTable() {
- model.setRowCount(0);
- try {
- Far far = stepOne.getFar();
- List<PackageIdentification> packagesInFar = far.manifest.getPackageList();
-
- WorkspaceTools wt = new WorkspaceTools();
- List<PackageIdentification> packagesInDb = wt.getAllPackages();
-
- updatPkgList = AggregationOperation.intersection(packagesInDb, packagesInFar);
- //
- // Change here to get packages and platforms from FAR
- //
- Iterator<PackageIdentification> iter = updatPkgList.iterator();//packageList.iterator();
- while (iter.hasNext()) {
- String[] str = new String[4];
- PackageIdentification item = iter.next();
- str[0] = item.getName();
- str[1] = item.getVersion();
- str[2] = item.getGuid();
- str[3] = Tools.getFilePathOnly(Tools.getRelativePath(item.getPath(), Workspace.getCurrentWorkspace()));
- model.addRow(str);
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- /**
- * This is the default constructor
- */
- public UpdateStepTwo(IDialog iDialog, boolean modal) {
- super(iDialog, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.UPDATE_STEP_TWO_TITLE);
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 70, 281, 20));
- jLabel.setText("Following packages will be updated: ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonFinish(), null);
- jContentPane.add(getJButtonPrevious(), null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(jLabel, null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonFinish) {
- //
- // Check depedency ?
- //
- WorkspaceTools wsTools = new WorkspaceTools();
-
- Iterator<PackageIdentification> iter = updatPkgList.iterator();
- List<PackageIdentification> depResultList = new ArrayList<PackageIdentification>();
- while (iter.hasNext()) {
- List<PackageIdentification> depPkgList = stepOne.getFar().getPackageDependencies(iter.next());
- depResultList = AggregationOperation.union(depResultList, depPkgList);
- }
-
- List<PackageIdentification> dbPkgList = DistributeRule.vectorToList(wsTools.getAllPackages());
- List<PackageIdentification> resultList = AggregationOperation
- .minus(
- depResultList,
- AggregationOperation
- .union(
- this.updatPkgList,
- dbPkgList));
- Iterator resultIter = resultList.iterator();
- while (resultIter.hasNext()) {
- Log.wrn("Update far", "Missing dependency package " + ((PackageIdentification) resultIter.next()).toString()
- + " in workspace!");
- return;
- }
-
- //
- // Remove all update packages
- //
- //
- // For all packages, remove all files.
- // Exception FPD file still in DB
- //
- Vector<PlatformIdentification> allPlatforms = wsTools.getAllPlatforms();
- Set<File> allPlatformFiles = new LinkedHashSet<File>();
-
- Iterator<PlatformIdentification> allPlfIter = allPlatforms.iterator();
- while (iter.hasNext()) {
- allPlatformFiles.add(allPlfIter.next().getFpdFile());
- }
-
- Iterator<PackageIdentification> packageIter = this.updatPkgList.iterator();
- while (packageIter.hasNext()) {
- PackageIdentification item = packageIter.next();
- Set<File> deleteFiles = new LinkedHashSet<File>();
- recursiveDir(deleteFiles, item.getSpdFile().getParentFile(), allPlatformFiles);
- Iterator<File> iterDeleteFile = deleteFiles.iterator();
- while (iterDeleteFile.hasNext()) {
- deleteFiles(iterDeleteFile.next());
- }
- //
- // Remove all empty parent dir
- //
- File parentDir = item.getSpdFile().getParentFile();
- while (parentDir.listFiles().length == 0) {
- File tempFile = parentDir;
- parentDir = parentDir.getParentFile();
- tempFile.delete();
- }
- }
-
- //
- // Install all update packages
- //
- Iterator<PackageIdentification> updataIter = this.updatPkgList.iterator();
- while (updataIter.hasNext()) {
- PackageIdentification pkgId = updataIter.next();
- try {
- stepOne.getFar().installPackage(pkgId, new File(pkgId.getSpdFile().getParent()));
- } catch (Exception ex) {
- Log.wrn("Install " + pkgId.toString(), ex.getMessage());
- Log.err("Install " + pkgId.toString(), ex.getMessage());
- }
-
- }
- this.stepOne.returnType = DataType.RETURN_TYPE_OK;
-
- this.setVisible(false);
- this.dispose();
- } else if (e.getSource() == jButtonPrevious) {
- this.setVisible(false);
- stepOne.setVisible(true);
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- private void recursiveDir(Set<File> files, File dir, Set<File> platformFiles) {
- File[] fileList = dir.listFiles();
- for (int i = 0; i < fileList.length; i++) {
- if (fileList[i].isFile()) {
- if (!platformFiles.contains(fileList[i])) {
- files.add(fileList[i]);
- }
- } else {
- if (isContain(fileList[i], platformFiles)) {
- recursiveDir(files, fileList[i], platformFiles);
- } else {
- files.add(fileList[i]);
- }
- }
- }
- }
-
- private void deleteFiles(File file) {
- if (file.isDirectory()) {
- File[] files = file.listFiles();
- for (int i = 0; i < files.length; i++) {
- deleteFiles(files[i]);
- }
- }
- file.delete();
- }
-
- private boolean isContain(File dir, Set<File> platformFiles) {
- Iterator<File> iter = platformFiles.iterator();
- while (iter.hasNext()) {
- File file = iter.next();
- if (file.getPath().startsWith(dir.getPath())) {
- //
- // continue this FPD file
- //
- return true;
- }
- }
- return false;
- }
-}
-
-class PartialTableModel extends DefaultTableModel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int col) {
- switch (col) {
- case 3:
- return false;
- default:
- return false;
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesIdentification.java deleted file mode 100644 index 3a81248926..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesIdentification.java +++ /dev/null @@ -1,89 +0,0 @@ -/** @file
-
- The file is used to define Boot Modes Identification
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.BootModes;
-
-import java.util.Vector;
-
-public class BootModesIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- public BootModesIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.usage = (arg1 == null ? "" : arg1);
- this.featureFlag = (arg2 == null ? "" : arg2);
- this.supArchList = arg3;
- this.help = (arg4 == null ? "" : arg4);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(BootModesIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesVector.java deleted file mode 100644 index 4c0840370f..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesVector.java +++ /dev/null @@ -1,96 +0,0 @@ -/** @file
-
- The file is used to define Boot Modes Vector
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.BootModes;
-
-import java.util.Vector;
-
-public class BootModesVector {
-
- private Vector<BootModesIdentification> vBootModes = new Vector<BootModesIdentification>();
-
- public int findBootModes(BootModesIdentification sfi) {
- for (int index = 0; index < vBootModes.size(); index++) {
- if (vBootModes.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findBootModes(String name) {
- for (int index = 0; index < vBootModes.size(); index++) {
- if (vBootModes.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public BootModesIdentification getBootModes(int index) {
- if (index > -1) {
- return vBootModes.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addBootModes(BootModesIdentification arg0) {
- vBootModes.addElement(arg0);
- }
-
- public void setBootModes(BootModesIdentification arg0, int arg1) {
- vBootModes.setElementAt(arg0, arg1);
- }
-
- public void removeBootModes(BootModesIdentification arg0) {
- int index = findBootModes(arg0);
- if (index > -1) {
- vBootModes.removeElementAt(index);
- }
- }
-
- public void removeBootModes(int index) {
- if (index > -1 && index < this.size()) {
- vBootModes.removeElementAt(index);
- }
- }
-
- public Vector<BootModesIdentification> getvBootModes() {
- return vBootModes;
- }
-
- public void setvBootModes(Vector<BootModesIdentification> BootModes) {
- vBootModes = BootModes;
- }
-
- public Vector<String> getBootModesName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vBootModes.size(); index++) {
- v.addElement(vBootModes.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vBootModes.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getBootModes(index).getName());
- v.addElement(getBootModes(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BuildOptions/BuildOptionsIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BuildOptions/BuildOptionsIdentification.java deleted file mode 100644 index 7074d3c7e0..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BuildOptions/BuildOptionsIdentification.java +++ /dev/null @@ -1,93 +0,0 @@ -/** @file
-
- The file is used to define Build Options Identification
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.BuildOptions;
-
-import java.util.Vector;
-
-public class BuildOptionsIdentification {
-
- //
- // Define class members
- //
- private String option = null;
-
- private Vector<String> buildTargets = null;
-
- private String toolChainFamily = null;
-
- private String tagName = null;
-
- private String toolCode = null;
-
- private Vector<String> supArchList = null;
-
- public BuildOptionsIdentification(String arg0, Vector<String> arg1, String arg2, String arg3, String arg4, Vector<String> arg5) {
- this.option = (arg0 == null ? "" : arg0);
- this.buildTargets = arg1;
- this.toolChainFamily = (arg2 == null ? "" : arg2);
- this.tagName = (arg3 == null ? "" : arg3);
- this.toolCode = (arg4 == null ? "" : arg4);
- this.supArchList = arg5;
- }
-
- public String getOption() {
- return option;
- }
-
- public void setOption(String option) {
- this.option = option;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public String getTagName() {
- return tagName;
- }
-
- public void setTagName(String tagName) {
- this.tagName = tagName;
- }
-
- public String getToolChainFamily() {
- return toolChainFamily;
- }
-
- public void setToolChainFamily(String toolChainFamily) {
- this.toolChainFamily = toolChainFamily;
- }
-
- public String getToolCode() {
- return toolCode;
- }
-
- public void setToolCode(String toolCode) {
- this.toolCode = toolCode;
- }
-
- public Vector<String> getBuildTargets() {
- return buildTargets;
- }
-
- public void setBuildTargets(Vector<String> buildTargets) {
- this.buildTargets = buildTargets;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BuildOptions/BuildOptionsVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BuildOptions/BuildOptionsVector.java deleted file mode 100644 index dcd1bff392..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/BuildOptions/BuildOptionsVector.java +++ /dev/null @@ -1,95 +0,0 @@ -/** @file
-
- The file is used to define Build Options Vector
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.BuildOptions;
-
-import java.util.Vector;
-
-public class BuildOptionsVector {
-
- private Vector<BuildOptionsIdentification> vBuildOptions = new Vector<BuildOptionsIdentification>();
-
- public int findBuildOptions(BuildOptionsIdentification sfi) {
- for (int index = 0; index < vBuildOptions.size(); index++) {
- if (vBuildOptions.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findBuildOptions(String name) {
- for (int index = 0; index < vBuildOptions.size(); index++) {
- if (vBuildOptions.elementAt(index).getOption().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public BuildOptionsIdentification getBuildOptions(int index) {
- if (index > -1) {
- return vBuildOptions.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addBuildOptions(BuildOptionsIdentification arg0) {
- vBuildOptions.addElement(arg0);
- }
-
- public void setBuildOptions(BuildOptionsIdentification arg0, int arg1) {
- vBuildOptions.setElementAt(arg0, arg1);
- }
-
- public void removeBuildOptions(BuildOptionsIdentification arg0) {
- int index = findBuildOptions(arg0);
- if (index > -1) {
- vBuildOptions.removeElementAt(index);
- }
- }
-
- public void removeBuildOptions(int index) {
- if (index > -1 && index < this.size()) {
- vBuildOptions.removeElementAt(index);
- }
- }
-
- public Vector<BuildOptionsIdentification> getvBuildOptions() {
- return vBuildOptions;
- }
-
- public void setvBuildOptions(Vector<BuildOptionsIdentification> BuildOptions) {
- vBuildOptions = BuildOptions;
- }
-
- public Vector<String> getBuildOptionsName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vBuildOptions.size(); index++) {
- v.addElement(vBuildOptions.get(index).getOption());
- }
- return v;
- }
-
- public int size() {
- return this.vBuildOptions.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getBuildOptions(index).getOption());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsIdentification.java deleted file mode 100644 index 2b5b362acb..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsIdentification.java +++ /dev/null @@ -1,89 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.DataHubs;
-
-import java.util.Vector;
-
-public class DataHubsIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- public DataHubsIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.usage = (arg1 == null ? "" : arg1);
- this.featureFlag = (arg2 == null ? "" : arg2);
- this.supArchList = arg3;
- this.help = (arg4 == null ? "" : arg4);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(DataHubsIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsVector.java deleted file mode 100644 index 7405342c74..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsVector.java +++ /dev/null @@ -1,96 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.DataHubs;
-
-import java.util.Vector;
-
-public class DataHubsVector {
-
- private Vector<DataHubsIdentification> vDataHubs = new Vector<DataHubsIdentification>();
-
- public int findDataHubs(DataHubsIdentification sfi) {
- for (int index = 0; index < vDataHubs.size(); index++) {
- if (vDataHubs.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findDataHubs(String name) {
- for (int index = 0; index < vDataHubs.size(); index++) {
- if (vDataHubs.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public DataHubsIdentification getDataHubs(int index) {
- if (index > -1) {
- return vDataHubs.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addDataHubs(DataHubsIdentification arg0) {
- vDataHubs.addElement(arg0);
- }
-
- public void setDataHubs(DataHubsIdentification arg0, int arg1) {
- vDataHubs.setElementAt(arg0, arg1);
- }
-
- public void removeDataHubs(DataHubsIdentification arg0) {
- int index = findDataHubs(arg0);
- if (index > -1) {
- vDataHubs.removeElementAt(index);
- }
- }
-
- public void removeDataHubs(int index) {
- if (index > -1 && index < this.size()) {
- vDataHubs.removeElementAt(index);
- }
- }
-
- public Vector<DataHubsIdentification> getvDataHubs() {
- return vDataHubs;
- }
-
- public void setvDataHubs(Vector<DataHubsIdentification> DataHubs) {
- vDataHubs = DataHubs;
- }
-
- public Vector<String> getDataHubsName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vDataHubs.size(); index++) {
- v.addElement(vDataHubs.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vDataHubs.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getDataHubs(index).getName());
- v.addElement(getDataHubs(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsIdentification.java deleted file mode 100644 index bbb22e594a..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsIdentification.java +++ /dev/null @@ -1,114 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.Events;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.common.DataType;
-
-public class EventsIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String type = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- private String group = null;
-
- public EventsIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4, String arg5, String arg6) {
- this.name = (arg0 == null ? "" : arg0);
- this.name = (this.name == DataType.EMPTY_SELECT_ITEM ? "" : this.name);
- this.type = (arg1 == null ? "" : arg1);
- this.usage = (arg2 == null ? "" : arg2);
- this.featureFlag = (arg3 == null ? "" : arg3);
- this.supArchList = arg4;
- this.help = (arg5 == null ? "" : arg5);
- this.group = (arg6 == null ? "" : arg6);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(EventsIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-
- public String getGroup() {
- return group;
- }
-
- public void setGroup(String group) {
- this.group = group;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsVector.java deleted file mode 100644 index f64e184aa3..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsVector.java +++ /dev/null @@ -1,97 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.Events;
-
-import java.util.Vector;
-
-public class EventsVector {
-
- private Vector<EventsIdentification> vEvents = new Vector<EventsIdentification>();
-
- public int findEvents(EventsIdentification sfi) {
- for (int index = 0; index < vEvents.size(); index++) {
- if (vEvents.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findEvents(String name) {
- for (int index = 0; index < vEvents.size(); index++) {
- if (vEvents.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public EventsIdentification getEvents(int index) {
- if (index > -1) {
- return vEvents.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addEvents(EventsIdentification arg0) {
- vEvents.addElement(arg0);
- }
-
- public void setEvents(EventsIdentification arg0, int arg1) {
- vEvents.setElementAt(arg0, arg1);
- }
-
- public void removeEvents(EventsIdentification arg0) {
- int index = findEvents(arg0);
- if (index > -1) {
- vEvents.removeElementAt(index);
- }
- }
-
- public void removeEvents(int index) {
- if (index > -1 && index < this.size()) {
- vEvents.removeElementAt(index);
- }
- }
-
- public Vector<EventsIdentification> getvEvents() {
- return vEvents;
- }
-
- public void setvEvents(Vector<EventsIdentification> Events) {
- vEvents = Events;
- }
-
- public Vector<String> getEventsName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vEvents.size(); index++) {
- v.addElement(vEvents.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vEvents.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getEvents(index).getName());
- v.addElement(getEvents(index).getType());
- v.addElement(getEvents(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsIdentification.java deleted file mode 100644 index 31979ceb88..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsIdentification.java +++ /dev/null @@ -1,152 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.Externs;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.common.EnumerationData;
-
-public class ExternsIdentification {
-
- //
- // Define class members
- //
- private String name0 = null;
-
- private String name1 = null;
-
- private String name2 = null;
-
- private String name3 = null;
-
- private String type = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- public ExternsIdentification(String arg0, String arg1) {
- this.name0 = (arg0 == null ? "" : arg0);
- this.type = (arg1 == null ? "" : arg1);
- }
-
- public ExternsIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4) {
- this.name0 = (arg0 == null ? "" : arg0);
- this.name1 = (arg1 == null ? "" : arg1);
- this.type = (arg2 == null ? "" : arg2);
- this.featureFlag = (arg3 == null ? "" : arg3);
- this.supArchList = arg4;
- }
-
- public ExternsIdentification(String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
- Vector<String> arg6) {
- this.name0 = (arg0 == null ? "" : arg0);
- this.name1 = (arg1 == null ? "" : arg1);
- this.name2 = (arg2 == null ? "" : arg2);
- this.name3 = (arg3 == null ? "" : arg3);
- this.type = (arg4 == null ? "" : arg4);
- this.featureFlag = (arg5 == null ? "" : arg5);
- this.supArchList = arg6;
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(ExternsIdentification pi) {
- if (this.type.equals(pi.type)) {
- if (this.type.equals(EnumerationData.EXTERNS_SPECIFICATION)) {
- if (this.name0.equals(pi.name0)) {
- return true;
- }
- }
- if (this.type.equals(EnumerationData.EXTERNS_IMAGE)) {
- if (this.name0.equals(pi.name0) && this.name1.equals(pi.name1)) {
- return true;
- }
- }
- if (this.type.equals(EnumerationData.EXTERNS_LIBRARY)) {
- if (this.name0.equals(pi.name0) && this.name1.equals(pi.name1)) {
- return true;
- }
- }
- if (this.type.equals(EnumerationData.EXTERNS_CALL_BACK)) {
- if (this.name0.equals(pi.name0) && this.name1.equals(pi.name1)) {
- return true;
- }
- }
- if (this.type.equals(EnumerationData.EXTERNS_DRIVER)) {
- if (this.name0.equals(pi.name0) && this.name1.equals(pi.name1) && this.name2.equals(pi.name2) && this.name3.equals(pi.name3)) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getName0() {
- return name0;
- }
-
- public void setName0(String name0) {
- this.name0 = name0;
- }
-
- public String getName1() {
- return name1;
- }
-
- public void setName1(String name1) {
- this.name1 = name1;
- }
-
- public String getName2() {
- return name2;
- }
-
- public void setName2(String name2) {
- this.name2 = name2;
- }
-
- public String getName3() {
- return name3;
- }
-
- public void setName3(String name3) {
- this.name3 = name3;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsVector.java deleted file mode 100644 index dbc2035fa9..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsVector.java +++ /dev/null @@ -1,174 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.Externs;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-
-public class ExternsVector {
-
- private Vector<ExternsIdentification> vExterns = new Vector<ExternsIdentification>();
-
- public int findExterns(ExternsIdentification sfi) {
- for (int index = 0; index < vExterns.size(); index++) {
- if (vExterns.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public ExternsIdentification getExterns(int index) {
- if (index > -1) {
- return vExterns.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addExterns(ExternsIdentification arg0) {
- vExterns.addElement(arg0);
- }
-
- public void setExterns(ExternsIdentification arg0, int arg1) {
- vExterns.setElementAt(arg0, arg1);
- }
-
- public void removeExterns(ExternsIdentification arg0) {
- int index = findExterns(arg0);
- if (index > -1) {
- vExterns.removeElementAt(index);
- }
- }
-
- public void removeExterns(int index) {
- if (index > -1 && index < this.size()) {
- vExterns.removeElementAt(index);
- }
- }
-
- public Vector<ExternsIdentification> getvExterns() {
- return vExterns;
- }
-
- public void setvExterns(Vector<ExternsIdentification> Externs) {
- vExterns = Externs;
- }
-
- public int size() {
- return this.vExterns.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
-
- //
- // For Specification
- //
- if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
- v.addElement(getExterns(index).getType());
- v.addElement(getExterns(index).getType() + " Name");
- v.addElement(getExterns(index).getName0());
- return v;
- }
-
- //
- // For Image
- //
- if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_IMAGE)) {
- v.addElement(getExterns(index).getType());
- String name = "";
- String value = "";
-
- name = EnumerationData.EXTERNS_MODULE_ENTRY_POINT;
- value = this.getExterns(index).getName0();
- name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_MODULE_UNLOAD_IMAGE;
- value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName1()
- + DataType.HTML_LINE_SEPARATOR;
-
- v.addElement("<html>" + name + "<html>");
- v.addElement("<html>" + value + "<html>");
- return v;
- }
-
- //
- // For Library
- //
- if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_LIBRARY)) {
- v.addElement(getExterns(index).getType());
- String name = "";
- String value = "";
-
- name = EnumerationData.EXTERNS_CONSTRUCTOR;
- value = this.getExterns(index).getName0();
- name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_DESTRUCTOR;
- value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName1()
- + DataType.HTML_LINE_SEPARATOR;
-
- v.addElement("<html>" + name + "<html>");
- v.addElement("<html>" + value + "<html>");
- return v;
- }
-
- //
- // For Driver
- //
- if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_DRIVER)) {
- v.addElement(getExterns(index).getType());
- String name = "";
- String value = "";
-
- name = EnumerationData.EXTERNS_DRIVER_BINDING;
- value = this.getExterns(index).getName0();
- name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_COMPONENT_NAME;
- value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName1();
- name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_DRIVER_CONFIG;
- value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName2();
- name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_DRIVER_DIAG;
- value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName3()
- + DataType.HTML_LINE_SEPARATOR;
-
- v.addElement("<html>" + name + "<html>");
- v.addElement("<html>" + value + "<html>");
- return v;
- }
-
- //
- // For Call Back
- //
- if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_CALL_BACK)) {
- v.addElement(getExterns(index).getType());
- String name = "";
- String value = "";
-
- name = EnumerationData.EXTERNS_VIRTUAL_ADDRESS_MAP_CALL_BACK;
- value = this.getExterns(index).getName0();
- name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_EXIT_BOOT_SERVICES_CALL_BACK;
- value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName1()
- + DataType.HTML_LINE_SEPARATOR;
-
- v.addElement("<html>" + name + "<html>");
- v.addElement("<html>" + value + "<html>");
- return v;
- }
-
- //
- // Return a empty v
- //
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsIdentification.java deleted file mode 100644 index 4affae9797..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsIdentification.java +++ /dev/null @@ -1,112 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.Guids;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class GuidsIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- private ModuleIdentification belongModule = null;
-
- private PackageIdentification declaredBy = null;
-
- public GuidsIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.usage = (arg1 == null ? "" : arg1);
- this.featureFlag = (arg2 == null ? "" : arg2);
- this.supArchList = arg3;
- this.help = (arg4 == null ? "" : arg4);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(GuidsIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-
- public ModuleIdentification getBelongModule() {
- return belongModule;
- }
-
- public void setBelongModule(ModuleIdentification belongModule) {
- this.belongModule = belongModule;
- }
-
- public PackageIdentification getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(PackageIdentification declaredBy) {
- this.declaredBy = declaredBy;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsVector.java deleted file mode 100644 index 6d415c3162..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsVector.java +++ /dev/null @@ -1,97 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.Guids;
-
-import java.util.Vector;
-
-public class GuidsVector {
-
- private Vector<GuidsIdentification> vGuids = new Vector<GuidsIdentification>();
-
- public int findGuids(GuidsIdentification sfi) {
- for (int index = 0; index < vGuids.size(); index++) {
- if (vGuids.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findGuids(String name) {
- for (int index = 0; index < vGuids.size(); index++) {
- if (vGuids.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public GuidsIdentification getGuids(int index) {
- if (index > -1) {
- return vGuids.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addGuids(GuidsIdentification arg0) {
- vGuids.addElement(arg0);
- }
-
- public void setGuids(GuidsIdentification arg0, int arg1) {
- vGuids.setElementAt(arg0, arg1);
- }
-
- public void removeGuids(GuidsIdentification arg0) {
- int index = findGuids(arg0);
- if (index > -1) {
- vGuids.removeElementAt(index);
- }
- }
-
- public void removeGuids(int index) {
- if (index > -1 && index < this.size()) {
- vGuids.removeElementAt(index);
- }
- }
-
- public Vector<GuidsIdentification> getvGuids() {
- return vGuids;
- }
-
- public void setvGuids(Vector<GuidsIdentification> Guids) {
- vGuids = Guids;
- }
-
- public Vector<String> getGuidsName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vGuids.size(); index++) {
- v.addElement(vGuids.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vGuids.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getGuids(index).getName());
- v.addElement(getGuids(index).getUsage());
- return v;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesIdentification.java deleted file mode 100644 index 4935d306b0..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesIdentification.java +++ /dev/null @@ -1,89 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.HiiPackages;
-
-import java.util.Vector;
-
-public class HiiPackagesIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- public HiiPackagesIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.usage = (arg1 == null ? "" : arg1);
- this.featureFlag = (arg2 == null ? "" : arg2);
- this.supArchList = arg3;
- this.help = (arg4 == null ? "" : arg4);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(HiiPackagesIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesVector.java deleted file mode 100644 index f946c0c7e3..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesVector.java +++ /dev/null @@ -1,96 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.HiiPackages;
-
-import java.util.Vector;
-
-public class HiiPackagesVector {
-
- private Vector<HiiPackagesIdentification> vHiiPackages = new Vector<HiiPackagesIdentification>();
-
- public int findHiiPackages(HiiPackagesIdentification sfi) {
- for (int index = 0; index < vHiiPackages.size(); index++) {
- if (vHiiPackages.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findHiiPackages(String name) {
- for (int index = 0; index < vHiiPackages.size(); index++) {
- if (vHiiPackages.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public HiiPackagesIdentification getHiiPackages(int index) {
- if (index > -1) {
- return vHiiPackages.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addHiiPackages(HiiPackagesIdentification arg0) {
- vHiiPackages.addElement(arg0);
- }
-
- public void setHiiPackages(HiiPackagesIdentification arg0, int arg1) {
- vHiiPackages.setElementAt(arg0, arg1);
- }
-
- public void removeHiiPackages(HiiPackagesIdentification arg0) {
- int index = findHiiPackages(arg0);
- if (index > -1) {
- vHiiPackages.removeElementAt(index);
- }
- }
-
- public void removeHiiPackages(int index) {
- if (index > -1 && index < this.size()) {
- vHiiPackages.removeElementAt(index);
- }
- }
-
- public Vector<HiiPackagesIdentification> getvHiiPackages() {
- return vHiiPackages;
- }
-
- public void setvHiiPackages(Vector<HiiPackagesIdentification> HiiPackages) {
- vHiiPackages = HiiPackages;
- }
-
- public Vector<String> getHiiPackagesName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vHiiPackages.size(); index++) {
- v.addElement(vHiiPackages.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vHiiPackages.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getHiiPackages(index).getName());
- v.addElement(getHiiPackages(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsIdentification.java deleted file mode 100644 index 7b9dadd15e..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsIdentification.java +++ /dev/null @@ -1,103 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.Hobs;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.common.DataType;
-
-public class HobsIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String type = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- public HobsIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4, String arg5) {
- this.name = (arg0 == null ? "" : arg0);
- this.name = (this.name == DataType.EMPTY_SELECT_ITEM ? "" : this.name);
- this.type = (arg1 == null ? "" : arg1);
- this.usage = (arg2 == null ? "" : arg2);
- this.featureFlag = (arg3 == null ? "" : arg3);
- this.supArchList = arg4;
- this.help = (arg5 == null ? "" : arg5);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(HobsIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsVector.java deleted file mode 100644 index 550cb0aca1..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsVector.java +++ /dev/null @@ -1,97 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.Hobs;
-
-import java.util.Vector;
-
-public class HobsVector {
-
- private Vector<HobsIdentification> vHobs = new Vector<HobsIdentification>();
-
- public int findHobs(HobsIdentification sfi) {
- for (int index = 0; index < vHobs.size(); index++) {
- if (vHobs.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findHobs(String name) {
- for (int index = 0; index < vHobs.size(); index++) {
- if (vHobs.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public HobsIdentification getHobs(int index) {
- if (index > -1) {
- return vHobs.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addHobs(HobsIdentification arg0) {
- vHobs.addElement(arg0);
- }
-
- public void setHobs(HobsIdentification arg0, int arg1) {
- vHobs.setElementAt(arg0, arg1);
- }
-
- public void removeHobs(HobsIdentification arg0) {
- int index = findHobs(arg0);
- if (index > -1) {
- vHobs.removeElementAt(index);
- }
- }
-
- public void removeHobs(int index) {
- if (index > -1 && index < this.size()) {
- vHobs.removeElementAt(index);
- }
- }
-
- public Vector<HobsIdentification> getvHobs() {
- return vHobs;
- }
-
- public void setvHobs(Vector<HobsIdentification> Hobs) {
- vHobs = Hobs;
- }
-
- public Vector<String> getHobsName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vHobs.size(); index++) {
- v.addElement(vHobs.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vHobs.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getHobs(index).getName());
- v.addElement(getHobs(index).getType());
- v.addElement(getHobs(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassIdentification.java deleted file mode 100644 index d47fa74208..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassIdentification.java +++ /dev/null @@ -1,147 +0,0 @@ -/** @file
-
- The file is used to define Library Class Identification
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.LibraryClass;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class LibraryClassIdentification {
- private String libraryClassName = null;
-
- private String usage = null;
-
- private String recommendedInstanceVersion = null;
-
- private String recommendedInstanceGuid = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private Vector<String> supModuleList = null;
-
- private String help = null;
-
- private ModuleIdentification belongModule = null;
-
- private PackageIdentification declaredBy = null;
-
- public LibraryClassIdentification() {
-
- }
-
- public LibraryClassIdentification(String strName, String strUsage, String strRecommendedInstanceVersion,
- String strRecommendedInstanceGuid, Vector<String> vSupArchList,
- String strFeatureFlag, Vector<String> vSupModuleList, String strHelp) {
- this.libraryClassName = (strName == null ? "" : strName);
- this.usage = (strUsage == null ? "" : strUsage);
- this.recommendedInstanceVersion = (strRecommendedInstanceVersion == null ? "" : strRecommendedInstanceVersion);
- this.recommendedInstanceGuid = (strRecommendedInstanceGuid == null ? "" : strRecommendedInstanceGuid);
- this.supArchList = vSupArchList;
- this.featureFlag = (strFeatureFlag == null ? "" : strFeatureFlag);
- this.supModuleList = vSupModuleList;
- this.help = (strHelp == null ? "" : strHelp);
- }
-
- public String getLibraryClassName() {
- return libraryClassName;
- }
-
- public void setLibraryClassName(String libraryClassName) {
- this.libraryClassName = libraryClassName;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getRecommendedInstanceGuid() {
- return recommendedInstanceGuid;
- }
-
- public void setRecommendedInstanceGuid(String recommendedInstanceGuid) {
- this.recommendedInstanceGuid = recommendedInstanceGuid;
- }
-
- public String getRecommendedInstanceVersion() {
- return recommendedInstanceVersion;
- }
-
- public void setRecommendedInstanceVersion(String recommendedInstanceVersion) {
- this.recommendedInstanceVersion = recommendedInstanceVersion;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(LibraryClassIdentification lib) {
- if (this.libraryClassName.equals(lib.libraryClassName) && this.usage.equals(lib.getUsage())) {
- return true;
- }
- return false;
- }
-
- public Vector<String> getSupModuleList() {
- return supModuleList;
- }
-
- public void setSupModuleList(Vector<String> supModuleList) {
- this.supModuleList = supModuleList;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-
- public ModuleIdentification getBelongModule() {
- return belongModule;
- }
-
- public void setBelongModule(ModuleIdentification belongModule) {
- this.belongModule = belongModule;
- }
-
- public PackageIdentification getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(PackageIdentification declaredBy) {
- this.declaredBy = declaredBy;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java deleted file mode 100644 index 3155cf6329..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java +++ /dev/null @@ -1,105 +0,0 @@ -/** @file
-
- The file is used to define Library Class Vector
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.LibraryClass;
-
-import java.util.Vector;
-
-public class LibraryClassVector {
- private Vector<LibraryClassIdentification> vLibraryClass = new Vector<LibraryClassIdentification>();
-
- public int findLibraryClass(LibraryClassIdentification lib) {
- for (int index = 0; index < vLibraryClass.size(); index++) {
- if (vLibraryClass.elementAt(index).getLibraryClassName().equals(lib.getLibraryClassName())
- && vLibraryClass.elementAt(index).getUsage().equals(lib.getUsage())) {
- if (vLibraryClass.elementAt(index).getBelongModule() != null && lib.getBelongModule() != null) {
- if (vLibraryClass.elementAt(index).getBelongModule().equals(lib.getBelongModule())) {
- return index;
- }
- }
- if (vLibraryClass.elementAt(index).getBelongModule() == null && lib.getBelongModule() == null) {
- return index;
- }
- }
- }
- return -1;
- }
-
- public int findLibraryClass(String name) {
- for (int index = 0; index < vLibraryClass.size(); index++) {
- if (vLibraryClass.elementAt(index).getLibraryClassName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public LibraryClassIdentification getLibraryClass(int index) {
- if (index > -1) {
- return vLibraryClass.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addLibraryClass(LibraryClassIdentification lib) {
- if (findLibraryClass(lib) == -1) {
- vLibraryClass.addElement(lib);
- }
- }
-
- public void setLibraryClass(LibraryClassIdentification lib, int index) {
- vLibraryClass.setElementAt(lib, index);
- }
-
- public void removeLibraryClass(LibraryClassIdentification lib) {
- int index = findLibraryClass(lib);
- if (index > -1) {
- vLibraryClass.removeElementAt(index);
- }
- }
-
- public void removeLibraryClass(int index) {
- if (index > -1 && index < this.size()) {
- vLibraryClass.removeElementAt(index);
- }
- }
-
- public Vector<LibraryClassIdentification> getVLibraryClass() {
- return vLibraryClass;
- }
-
- public void setVLibraryClass(Vector<LibraryClassIdentification> libraryClass) {
- vLibraryClass = libraryClass;
- }
-
- public Vector<String> getLibraryClassName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vLibraryClass.size(); index++) {
- v.addElement(vLibraryClass.get(index).getLibraryClassName());
- }
- return v;
- }
-
- public int size() {
- return this.vLibraryClass.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getLibraryClass(index).getLibraryClassName());
- v.addElement(getLibraryClass(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/ModuleIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/ModuleIdentification.java deleted file mode 100644 index 1302f665f7..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/ModuleIdentification.java +++ /dev/null @@ -1,170 +0,0 @@ -/** @file
-
- The file is used to save basic information of module
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications;
-
-import java.io.IOException;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.LibraryUsage;
-import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.OpenFile;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class ModuleIdentification extends Identification {
-
- private PackageIdentification packageId;
-
- private String moduleType;
-
- private boolean isLibrary;
-
- public ModuleIdentification(String name, String guid, String version, String path) {
- super(name, guid, version, path);
- setModuleType();
- }
-
- public ModuleIdentification(String name, String guid, String version, String path, boolean library) {
- super(name, guid, version, path);
- this.isLibrary = library;
- }
-
- public ModuleIdentification(Identification id) {
- super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
- }
-
- public ModuleIdentification(Identification id, boolean library) {
- super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
- this.isLibrary = library;
- }
-
- public ModuleIdentification(String name, String guid, String version, String path, PackageIdentification packageId) {
- super(name, guid, version, path);
- this.packageId = packageId;
- setModuleType();
- }
-
- public ModuleIdentification(String name, String guid, String version, String path, PackageIdentification packageId,
- String type) {
- super(name, guid, version, path);
- this.packageId = packageId;
- this.moduleType = type;
- }
-
- public ModuleIdentification(Identification id, PackageIdentification packageId) {
- super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
- this.packageId = packageId;
- setModuleType();
- }
-
- public ModuleIdentification(Identification id, PackageIdentification packageId, boolean library) {
- super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
- this.packageId = packageId;
- this.isLibrary = library;
- }
-
- public ModuleIdentification(Identification id, PackageIdentification packageId, String type) {
- super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
- this.packageId = packageId;
- this.moduleType = type;
- }
-
- public String toString() {
- return "Module " + this.getName() + "[" + this.getGuid() + "] in package " + packageId;
- }
-
- public PackageIdentification getPackageId() {
- return packageId;
- }
-
- public void setPackageId(PackageIdentification packageId) {
- this.packageId = packageId;
- }
-
- public String getModuleType() {
- return moduleType;
- }
-
- public void setModuleType(String moduleType) {
- this.moduleType = moduleType;
- }
-
- private void setModuleType() {
- ModuleSurfaceArea msa = null;
- try {
- msa = OpenFile.openMsaFile(this.getPath());
- } catch (IOException e) {
- // TODO Auto-generated catch block
-
- } catch (XmlException e) {
- // TODO Auto-generated catch block
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
-
- }
- setModuleType(DataType.MODULE_TYPE_MODULE);
- setLibrary(false);
- if (msa != null) {
- LibraryClassDefinitions lib = msa.getLibraryClassDefinitions();
- if (lib != null) {
- for (int index = 0; index < lib.getLibraryClassList().size(); index++) {
- if (lib.getLibraryClassList().get(index).getUsage().equals(LibraryUsage.ALWAYS_PRODUCED)) {
- setModuleType(DataType.MODULE_TYPE_LIBRARY);
- setLibrary(true);
- break;
- }
- }
- }
- }
- }
-
- public boolean equals(String moduleGuid, String moduleVersion, String packageGuid, String packageVersion) {
- boolean b = false;
- if (this.getGuid().equals(moduleGuid) && this.getPackageId().getGuid().equals(packageGuid)) {
- b = true;
- //
- // Check Version
- //
- if (moduleVersion != null) {
- if (!Tools.isEmpty(moduleVersion)) {
- if (!moduleVersion.equals(this.getVersion())) {
- b = false;
- }
- }
- }
- if (packageVersion != null) {
- if (!Tools.isEmpty(packageVersion)) {
- if (!packageVersion.equals(this.getPackageId().getVersion())) {
- b = false;
- }
- }
- }
- }
- return b;
- }
-
- public boolean isLibrary() {
- return isLibrary;
- }
-
- public void setLibrary(boolean isLibrary) {
- this.isLibrary = isLibrary;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesIdentification.java deleted file mode 100644 index 170c417371..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesIdentification.java +++ /dev/null @@ -1,89 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.PackageDependencies;
-
-import java.util.Vector;
-
-public class PackageDependenciesIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String version = null;
-
- private String guid = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- public PackageDependenciesIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.version = (arg1 == null ? "" : arg1);
- this.guid = (arg2 == null ? "" : arg2);
- this.featureFlag = (arg3 == null ? "" : arg3);
- this.supArchList = arg4;
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getGuid() {
- return guid;
- }
-
- public void setGuid(String guid) {
- this.guid = guid;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public boolean equals(PackageDependenciesIdentification pdi) {
- if (this.guid.equals(pdi.guid)) {
- return true;
- }
- return false;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesVector.java deleted file mode 100644 index 7661453c4f..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesVector.java +++ /dev/null @@ -1,97 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.PackageDependencies;
-
-import java.util.Vector;
-
-public class PackageDependenciesVector {
-
- private Vector<PackageDependenciesIdentification> vPackageDependencies = new Vector<PackageDependenciesIdentification>();
-
- public int findPackageDependencies(PackageDependenciesIdentification sfi) {
- for (int index = 0; index < vPackageDependencies.size(); index++) {
- if (vPackageDependencies.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findPackageDependencies(String name) {
- for (int index = 0; index < vPackageDependencies.size(); index++) {
- if (vPackageDependencies.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public PackageDependenciesIdentification getPackageDependencies(int index) {
- if (index > -1) {
- return vPackageDependencies.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addPackageDependencies(PackageDependenciesIdentification arg0) {
- vPackageDependencies.addElement(arg0);
- }
-
- public void setPackageDependencies(PackageDependenciesIdentification arg0, int arg1) {
- vPackageDependencies.setElementAt(arg0, arg1);
- }
-
- public void removePackageDependencies(PackageDependenciesIdentification arg0) {
- int index = findPackageDependencies(arg0);
- if (index > -1) {
- vPackageDependencies.removeElementAt(index);
- }
- }
-
- public void removePackageDependencies(int index) {
- if (index > -1 && index < this.size()) {
- vPackageDependencies.removeElementAt(index);
- }
- }
-
- public Vector<PackageDependenciesIdentification> getvPackageDependencies() {
- return vPackageDependencies;
- }
-
- public void setvPackageDependencies(Vector<PackageDependenciesIdentification> PackageDependencies) {
- vPackageDependencies = PackageDependencies;
- }
-
- public Vector<String> getPackageDependenciesName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vPackageDependencies.size(); index++) {
- v.addElement(vPackageDependencies.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vPackageDependencies.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getPackageDependencies(index).getName());
- v.addElement(getPackageDependencies(index).getVersion());
- return v;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedIdentification.java deleted file mode 100644 index 13ed398fa3..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedIdentification.java +++ /dev/null @@ -1,175 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.PcdCoded;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class PcdCodedIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String guid = null;
-
- private String featureFlag = null;
-
- private Vector<String> supArchList = null;
-
- private String value = null;
-
- private String help = null;
-
- private String type = null;
-
- private String usage = null;
-
- private String tokenSpaceGuidCName = null;
-
- private String token = null;
-
- private String datumType = null;
-
- private ModuleIdentification belongModule = null;
-
- private PackageIdentification declaredBy = null;
-
- public PcdCodedIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4, String arg5, String arg6, String arg7) {
- this.name = (arg0 == null ? "" : arg0);
- this.guid = (arg1 == null ? "" : arg1);
- this.featureFlag = (arg2 == null ? "" : arg2);
- this.supArchList = arg3;
- this.value = (arg4 == null ? "" : arg4);
- this.help = (arg5 == null ? "" : arg5);
- this.type = (arg6 == null ? "" : arg6);
- this.usage = (arg7 == null ? "" : arg7);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(PcdCodedIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getGuid() {
- return guid;
- }
-
- public void setGuid(String guid) {
- this.guid = guid;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public ModuleIdentification getBelongModule() {
- return belongModule;
- }
-
- public void setBelongModule(ModuleIdentification belongModule) {
- this.belongModule = belongModule;
- }
-
- public PackageIdentification getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(PackageIdentification declaredBy) {
- this.declaredBy = declaredBy;
- }
-
- public String getToken() {
- return token;
- }
-
- public void setToken(String token) {
- this.token = token;
- }
-
- public String getTokenSpaceGuidCName() {
- return tokenSpaceGuidCName;
- }
-
- public void setTokenSpaceGuidCName(String tokenSpaceGuidCName) {
- this.tokenSpaceGuidCName = tokenSpaceGuidCName;
- }
-
- public String getDatumType() {
- return datumType;
- }
-
- public void setDatumType(String datumType) {
- this.datumType = datumType;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedVector.java deleted file mode 100644 index 7b35f1a426..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedVector.java +++ /dev/null @@ -1,98 +0,0 @@ -/** @file
-
- The file is used to define PcdCoded Vector
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.PcdCoded;
-
-import java.util.Vector;
-
-public class PcdCodedVector {
-
- private Vector<PcdCodedIdentification> vPcdCoded = new Vector<PcdCodedIdentification>();
-
- public int findPcdCoded(PcdCodedIdentification sfi) {
- for (int index = 0; index < vPcdCoded.size(); index++) {
- if (vPcdCoded.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findPcdCoded(String name) {
- for (int index = 0; index < vPcdCoded.size(); index++) {
- if (vPcdCoded.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public PcdCodedIdentification getPcdCoded(int index) {
- if (index > -1) {
- return vPcdCoded.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addPcdCoded(PcdCodedIdentification arg0) {
- vPcdCoded.addElement(arg0);
- }
-
- public void setPcdCoded(PcdCodedIdentification arg0, int arg1) {
- vPcdCoded.setElementAt(arg0, arg1);
- }
-
- public void removePcdCoded(PcdCodedIdentification arg0) {
- int index = findPcdCoded(arg0);
- if (index > -1) {
- vPcdCoded.removeElementAt(index);
- }
- }
-
- public void removePcdCoded(int index) {
- if (index > -1 && index < this.size()) {
- vPcdCoded.removeElementAt(index);
- }
- }
-
- public Vector<PcdCodedIdentification> getvPcdCoded() {
- return vPcdCoded;
- }
-
- public void setvPcdCoded(Vector<PcdCodedIdentification> PcdCoded) {
- vPcdCoded = PcdCoded;
- }
-
- public Vector<String> getPcdCodedName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vPcdCoded.size(); index++) {
- v.addElement(vPcdCoded.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vPcdCoded.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getPcdCoded(index).getName());
- v.addElement(getPcdCoded(index).getType());
- v.addElement(getPcdCoded(index).getValue());
- v.addElement(getPcdCoded(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdIdentification.java deleted file mode 100644 index 85a770662a..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdIdentification.java +++ /dev/null @@ -1,74 +0,0 @@ -/** @file
-
- The file is used to define Pcd Item Identification
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.PcdCoded;
-
-import java.util.Vector;
-
-public class PcdIdentification {
- //
- // Define class members
- //
- private String name = null;
-
- private String guidCName = null;
-
- private String help = null;
-
- private Vector<String> type = null;
-
- public PcdIdentification(String arg0, String arg1, String arg2, Vector<String> arg3) {
- this.name = (arg0 == null ? "" : arg0);
- this.guidCName = (arg1 == null ? "" : arg1);
- this.help = (arg2 == null ? "" : arg2);
- this.type = arg3;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-
- public String getGuidCName() {
- return guidCName;
- }
-
- public void setGuidCName(String guidCName) {
- this.guidCName = guidCName;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getType() {
- return type;
- }
-
- public void setType(Vector<String> type) {
- this.type = type;
- }
-
- public String toString() {
- return name;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdVector.java deleted file mode 100644 index dd2832e778..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdVector.java +++ /dev/null @@ -1,97 +0,0 @@ -/** @file
-
- The file is used to define Pcd Vector
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.PcdCoded;
-
-import java.util.Vector;
-
-public class PcdVector {
-
- private Vector<PcdIdentification> vPcd = new Vector<PcdIdentification>();
-
- public int findPcd(PcdIdentification sfi) {
- for (int index = 0; index < vPcd.size(); index++) {
- if (vPcd.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findPcd(String name) {
- for (int index = 0; index < vPcd.size(); index++) {
- if (vPcd.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public PcdIdentification getPcd(int index) {
- if (index > -1) {
- return vPcd.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addPcd(PcdIdentification arg0) {
- vPcd.addElement(arg0);
- }
-
- public void setPcd(PcdIdentification arg0, int arg1) {
- vPcd.setElementAt(arg0, arg1);
- }
-
- public void removePcd(PcdIdentification arg0) {
- int index = findPcd(arg0);
- if (index > -1) {
- vPcd.removeElementAt(index);
- }
- }
-
- public void removePcd(int index) {
- if (index > -1 && index < this.size()) {
- vPcd.removeElementAt(index);
- }
- }
-
- public Vector<PcdIdentification> getvPcd() {
- return vPcd;
- }
-
- public void setvPcd(Vector<PcdIdentification> Pcd) {
- vPcd = Pcd;
- }
-
- public Vector<String> getPcdName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vPcd.size(); index++) {
- v.addElement(vPcd.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vPcd.size();
- }
-
- public void addAll(PcdVector v) {
- if (v != null) {
- for (int index = 0; index < v.size(); index++) {
- vPcd.add(v.getPcd(index));
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisIdentification.java deleted file mode 100644 index a871f628db..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisIdentification.java +++ /dev/null @@ -1,123 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.Ppis;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class PpisIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String type = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- private ModuleIdentification belongModule = null;
-
- private PackageIdentification declaredBy = null;
-
- public PpisIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4, String arg5) {
- this.name = (arg0 == null ? "" : arg0);
- this.type = (arg1 == null ? "" : arg1);
- this.usage = (arg2 == null ? "" : arg2);
- this.featureFlag = (arg3 == null ? "" : arg3);
- this.supArchList = arg4;
- this.help = (arg5 == null ? "" : arg5);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(PpisIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-
- public ModuleIdentification getBelongModule() {
- return belongModule;
- }
-
- public void setBelongModule(ModuleIdentification belongModule) {
- this.belongModule = belongModule;
- }
-
- public PackageIdentification getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(PackageIdentification declaredBy) {
- this.declaredBy = declaredBy;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisVector.java deleted file mode 100644 index 9c6f343ee7..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisVector.java +++ /dev/null @@ -1,97 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.Ppis;
-
-import java.util.Vector;
-
-public class PpisVector {
-
- private Vector<PpisIdentification> vPpis = new Vector<PpisIdentification>();
-
- public int findPpis(PpisIdentification sfi) {
- for (int index = 0; index < vPpis.size(); index++) {
- if (vPpis.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findPpis(String name) {
- for (int index = 0; index < vPpis.size(); index++) {
- if (vPpis.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public PpisIdentification getPpis(int index) {
- if (index > -1) {
- return vPpis.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addPpis(PpisIdentification arg0) {
- vPpis.addElement(arg0);
- }
-
- public void setPpis(PpisIdentification arg0, int arg1) {
- vPpis.setElementAt(arg0, arg1);
- }
-
- public void removePpis(PpisIdentification arg0) {
- int index = findPpis(arg0);
- if (index > -1) {
- vPpis.removeElementAt(index);
- }
- }
-
- public void removePpis(int index) {
- if (index > -1 && index < this.size()) {
- vPpis.removeElementAt(index);
- }
- }
-
- public Vector<PpisIdentification> getvPpis() {
- return vPpis;
- }
-
- public void setvPpis(Vector<PpisIdentification> Ppis) {
- vPpis = Ppis;
- }
-
- public Vector<String> getPpisName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vPpis.size(); index++) {
- v.addElement(vPpis.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vPpis.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getPpis(index).getName());
- v.addElement(getPpis(index).getType());
- v.addElement(getPpis(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsIdentification.java deleted file mode 100644 index 685c6d1b6e..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsIdentification.java +++ /dev/null @@ -1,123 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.Protocols;
-
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class ProtocolsIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String type = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- private ModuleIdentification belongModule = null;
-
- private PackageIdentification declaredBy = null;
-
- public ProtocolsIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4, String arg5) {
- this.name = (arg0 == null ? "" : arg0);
- this.type = (arg1 == null ? "" : arg1);
- this.usage = (arg2 == null ? "" : arg2);
- this.featureFlag = (arg3 == null ? "" : arg3);
- this.supArchList = arg4;
- this.help = (arg5 == null ? "" : arg5);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(ProtocolsIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-
- public ModuleIdentification getBelongModule() {
- return belongModule;
- }
-
- public void setBelongModule(ModuleIdentification belongModule) {
- this.belongModule = belongModule;
- }
-
- public PackageIdentification getDeclaredBy() {
- return declaredBy;
- }
-
- public void setDeclaredBy(PackageIdentification declaredBy) {
- this.declaredBy = declaredBy;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsVector.java deleted file mode 100644 index 7f09670d5a..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsVector.java +++ /dev/null @@ -1,97 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.Protocols;
-
-import java.util.Vector;
-
-public class ProtocolsVector {
-
- private Vector<ProtocolsIdentification> vProtocols = new Vector<ProtocolsIdentification>();
-
- public int findProtocols(ProtocolsIdentification sfi) {
- for (int index = 0; index < vProtocols.size(); index++) {
- if (vProtocols.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findProtocols(String name) {
- for (int index = 0; index < vProtocols.size(); index++) {
- if (vProtocols.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public ProtocolsIdentification getProtocols(int index) {
- if (index > -1) {
- return vProtocols.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addProtocols(ProtocolsIdentification arg0) {
- vProtocols.addElement(arg0);
- }
-
- public void setProtocols(ProtocolsIdentification arg0, int arg1) {
- vProtocols.setElementAt(arg0, arg1);
- }
-
- public void removeProtocols(ProtocolsIdentification arg0) {
- int index = findProtocols(arg0);
- if (index > -1) {
- vProtocols.removeElementAt(index);
- }
- }
-
- public void removeProtocols(int index) {
- if (index > -1 && index < this.size()) {
- vProtocols.removeElementAt(index);
- }
- }
-
- public Vector<ProtocolsIdentification> getvProtocols() {
- return vProtocols;
- }
-
- public void setvProtocols(Vector<ProtocolsIdentification> Protocols) {
- vProtocols = Protocols;
- }
-
- public Vector<String> getProtocolsName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vProtocols.size(); index++) {
- v.addElement(vProtocols.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vProtocols.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getProtocols(index).getName());
- v.addElement(getProtocols(index).getType());
- v.addElement(getProtocols(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesIdentification.java deleted file mode 100644 index 02a9d7faf4..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesIdentification.java +++ /dev/null @@ -1,100 +0,0 @@ -/** @file
-
- The file is used to define Source Files Identification
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.SourceFiles;
-
-import java.util.Vector;
-
-public class SourceFilesIdentification {
-
- private String filename = null;
-
- private String tagName = null;
-
- private String toolCode = null;
-
- private String toolChainFamily = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- public SourceFilesIdentification(String strFilename, String strTagName, String strToolCode,
- String strToolChainFamily, String strFeatureFlag, Vector<String> arch) {
- this.filename = (strFilename == null ? "" : strFilename);
- this.tagName = (strTagName == null ? "" : strTagName);
- this.toolCode = (strToolCode == null ? "" : strToolCode);
- this.toolChainFamily = (strToolChainFamily == null ? "" : strToolChainFamily);
- this.featureFlag = (strFeatureFlag == null ? "" : strFeatureFlag);
- this.supArchList = arch;
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getFilename() {
- return filename;
- }
-
- public void setFilename(String filename) {
- this.filename = filename;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public String getTagName() {
- return tagName;
- }
-
- public void setTagName(String tagName) {
- this.tagName = tagName;
- }
-
- public String getToolChainFamily() {
- return toolChainFamily;
- }
-
- public void setToolChainFamily(String toolChainFamily) {
- this.toolChainFamily = toolChainFamily;
- }
-
- public String getToolCode() {
- return toolCode;
- }
-
- public void setToolCode(String toolCode) {
- this.toolCode = toolCode;
- }
-
- public boolean equals(SourceFilesIdentification sfid) {
- if (this.filename.equals(sfid.filename) && this.tagName.equals(sfid.tagName)
- && this.toolCode.equals(sfid.toolCode) && this.toolChainFamily.equals(sfid.toolChainFamily)
- && this.featureFlag.equals(sfid.featureFlag)
- && this.supArchList.toString().equals(sfid.supArchList.toString())) {
- return true;
- }
- return false;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesVector.java deleted file mode 100644 index 0e5cdc97a5..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesVector.java +++ /dev/null @@ -1,100 +0,0 @@ -/** @file
-
- The file is used to define Source Files Vector
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.SourceFiles;
-
-import java.util.Vector;
-
-public class SourceFilesVector {
- private Vector<SourceFilesIdentification> vSourceFiles = new Vector<SourceFilesIdentification>();
-
- public int findSourceFiles(SourceFilesIdentification sfi) {
- for (int index = 0; index < vSourceFiles.size(); index++) {
- if (vSourceFiles.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findSourceFiles(String name) {
- for (int index = 0; index < vSourceFiles.size(); index++) {
- if (vSourceFiles.elementAt(index).getFilename().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public SourceFilesIdentification getSourceFiles(int index) {
- if (index > -1) {
- return vSourceFiles.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addSourceFiles(SourceFilesIdentification sfi) {
- if (findSourceFiles(sfi) == -1) {
- vSourceFiles.addElement(sfi);
- }
- }
-
- public void setSourceFiles(SourceFilesIdentification sfi, int index) {
- vSourceFiles.setElementAt(sfi, index);
- }
-
- public void removeSourceFiles(SourceFilesIdentification sfi) {
- int index = findSourceFiles(sfi);
- if (index > -1) {
- vSourceFiles.removeElementAt(index);
- }
- }
-
- public void removeSourceFiles(int index) {
- if (index > -1 && index < this.size()) {
- vSourceFiles.removeElementAt(index);
- }
- }
-
- public Vector<SourceFilesIdentification> getvSourceFiles() {
- return vSourceFiles;
- }
-
- public void setvSourceFiles(Vector<SourceFilesIdentification> SourceFiles) {
- vSourceFiles = SourceFiles;
- }
-
- public Vector<String> getSourceFilesName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vSourceFiles.size(); index++) {
- v.addElement(vSourceFiles.get(index).getFilename());
- }
- return v;
- }
-
- public int size() {
- return this.vSourceFiles.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getSourceFiles(index).getFilename());
- v.addElement(getSourceFiles(index).getTagName());
- v.addElement(getSourceFiles(index).getToolCode());
- v.addElement(getSourceFiles(index).getToolChainFamily());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesIdentification.java deleted file mode 100644 index d2952c0e7e..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesIdentification.java +++ /dev/null @@ -1,89 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.SystemTables;
-
-import java.util.Vector;
-
-public class SystemTablesIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- public SystemTablesIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
- this.name = (arg0 == null ? "" : arg0);
- this.usage = (arg1 == null ? "" : arg1);
- this.featureFlag = (arg2 == null ? "" : arg2);
- this.supArchList = arg3;
- this.help = (arg4 == null ? "" : arg4);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(SystemTablesIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesVector.java deleted file mode 100644 index fb875acfd5..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesVector.java +++ /dev/null @@ -1,96 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.SystemTables;
-
-import java.util.Vector;
-
-public class SystemTablesVector {
-
- private Vector<SystemTablesIdentification> vSystemTables = new Vector<SystemTablesIdentification>();
-
- public int findSystemTables(SystemTablesIdentification sfi) {
- for (int index = 0; index < vSystemTables.size(); index++) {
- if (vSystemTables.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findSystemTables(String name) {
- for (int index = 0; index < vSystemTables.size(); index++) {
- if (vSystemTables.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public SystemTablesIdentification getSystemTables(int index) {
- if (index > -1) {
- return vSystemTables.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addSystemTables(SystemTablesIdentification arg0) {
- vSystemTables.addElement(arg0);
- }
-
- public void setSystemTables(SystemTablesIdentification arg0, int arg1) {
- vSystemTables.setElementAt(arg0, arg1);
- }
-
- public void removeSystemTables(SystemTablesIdentification arg0) {
- int index = findSystemTables(arg0);
- if (index > -1) {
- vSystemTables.removeElementAt(index);
- }
- }
-
- public void removeSystemTables(int index) {
- if (index > -1 && index < this.size()) {
- vSystemTables.removeElementAt(index);
- }
- }
-
- public Vector<SystemTablesIdentification> getvSystemTables() {
- return vSystemTables;
- }
-
- public void setvSystemTables(Vector<SystemTablesIdentification> SystemTables) {
- vSystemTables = SystemTables;
- }
-
- public Vector<String> getSystemTablesName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vSystemTables.size(); index++) {
- v.addElement(vSystemTables.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vSystemTables.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getSystemTables(index).getName());
- v.addElement(getSystemTables(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesIdentification.java deleted file mode 100644 index 24d81860a4..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesIdentification.java +++ /dev/null @@ -1,100 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Identification
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.Identifications.Variables;
-
-import java.util.Vector;
-
-public class VariablesIdentification {
-
- //
- // Define class members
- //
- private String name = null;
-
- private String guid = null;
-
- private String usage = null;
-
- private Vector<String> supArchList = null;
-
- private String featureFlag = null;
-
- private String help = null;
-
- public VariablesIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4, String arg5) {
- this.name = (arg0 == null ? "" : arg0);
- this.guid = (arg1 == null ? "" : arg1);
- this.usage = (arg2 == null ? "" : arg2);
- this.featureFlag = (arg3 == null ? "" : arg3);
- this.supArchList = arg4;
- this.help = (arg5 == null ? "" : arg5);
- }
-
- public String getFeatureFlag() {
- return featureFlag;
- }
-
- public void setFeatureFlag(String featureFlag) {
- this.featureFlag = featureFlag;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Vector<String> getSupArchList() {
- return supArchList;
- }
-
- public void setSupArchList(Vector<String> supArchList) {
- this.supArchList = supArchList;
- }
-
- public boolean equals(VariablesIdentification pi) {
- if (this.name.equals(pi.name)) {
- return true;
- }
- return false;
- }
-
- public String getUsage() {
- return usage;
- }
-
- public void setUsage(String usage) {
- this.usage = usage;
- }
-
- public String getGuid() {
- return guid;
- }
-
- public void setGuid(String guid) {
- this.guid = guid;
- }
-
- public String getHelp() {
- return help;
- }
-
- public void setHelp(String help) {
- this.help = help;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesVector.java deleted file mode 100644 index 6949eff7c3..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesVector.java +++ /dev/null @@ -1,97 +0,0 @@ -/** @file
-
- The file is used to define Package Dependencies Vector
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.Identifications.Variables;
-
-import java.util.Vector;
-
-public class VariablesVector {
-
- private Vector<VariablesIdentification> vVariables = new Vector<VariablesIdentification>();
-
- public int findVariables(VariablesIdentification sfi) {
- for (int index = 0; index < vVariables.size(); index++) {
- if (vVariables.elementAt(index).equals(sfi)) {
- return index;
- }
- }
- return -1;
- }
-
- public int findVariables(String name) {
- for (int index = 0; index < vVariables.size(); index++) {
- if (vVariables.elementAt(index).getName().equals(name)) {
- return index;
- }
- }
- return -1;
- }
-
- public VariablesIdentification getVariables(int index) {
- if (index > -1) {
- return vVariables.elementAt(index);
- } else {
- return null;
- }
- }
-
- public void addVariables(VariablesIdentification arg0) {
- vVariables.addElement(arg0);
- }
-
- public void setVariables(VariablesIdentification arg0, int arg1) {
- vVariables.setElementAt(arg0, arg1);
- }
-
- public void removeVariables(VariablesIdentification arg0) {
- int index = findVariables(arg0);
- if (index > -1) {
- vVariables.removeElementAt(index);
- }
- }
-
- public void removeVariables(int index) {
- if (index > -1 && index < this.size()) {
- vVariables.removeElementAt(index);
- }
- }
-
- public Vector<VariablesIdentification> getvVariables() {
- return vVariables;
- }
-
- public void setvVariables(Vector<VariablesIdentification> Variables) {
- vVariables = Variables;
- }
-
- public Vector<String> getVariablesName() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < this.vVariables.size(); index++) {
- v.addElement(vVariables.get(index).getName());
- }
- return v;
- }
-
- public int size() {
- return this.vVariables.size();
- }
-
- public Vector<String> toStringVector(int index) {
- Vector<String> v = new Vector<String>();
- v.addElement(getVariables(index).getName());
- v.addElement(getVariables(index).getGuid());
- v.addElement(getVariables(index).getUsage());
- return v;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBootModes.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBootModes.java deleted file mode 100644 index aee620db50..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBootModes.java +++ /dev/null @@ -1,472 +0,0 @@ -/** @file
-
- The file is used to create, update BootModes of MSA/MBD file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.BootModeNames;
-import org.tianocore.BootModeUsage;
-import org.tianocore.BootModesDocument;
-import org.tianocore.BootModesDocument.BootModes;
-import org.tianocore.BootModesDocument.BootModes.BootMode;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.BootModes.BootModesIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.BootModes.BootModesVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.BootModesDlg;
-
-/**
- The class is used to create, update BootModes of MSA/MBD file
- It extends IInternalFrame
-
-
-
- **/
-public class ModuleBootModes extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -3888558623432442561L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- private IFrame parentFrame = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private BootModesDocument.BootModes bootModes = null;
-
- private BootModesIdentification id = null;
-
- private BootModesVector vid = new BootModesVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(210, 195, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(390, 195, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- 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 jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Name");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Boot Modes");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inBootModes
-
- **/
- private void init(BootModes inBootModes) {
- init();
- this.bootModes = inBootModes;
-
- if (this.bootModes != null) {
- if (this.bootModes.getBootModeList().size() > 0) {
- for (int index = 0; index < this.bootModes.getBootModeList().size(); index++) {
- String arg0 = null;
- if (bootModes.getBootModeList().get(index).getBootModeName() != null) {
- arg0 = bootModes.getBootModeList().get(index).getBootModeName().toString();
- }
- String arg1 = null;
- if (bootModes.getBootModeList().get(index).getUsage() != null) {
- arg1 = bootModes.getBootModeList().get(index).getUsage().toString();
- }
-
- String arg2 = bootModes.getBootModeList().get(index).getFeatureFlag();
- Vector<String> arg3 = Tools.convertListToVector(bootModes.getBootModeList().get(index)
- .getSupArchList());
- String arg4 = bootModes.getBootModeList().get(index).getHelpText();
-
- id = new BootModesIdentification(arg0, arg1, arg2, arg3, arg4);
- vid.addBootModes(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleBootModes() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inBootModes The input BootModesDocument.BootModes
-
- **/
- public ModuleBootModes(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getBootModes());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- BootModesDlg dlg = new BootModesDlg(vid.getBootModes(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addBootModes(dlg.getId());
- } else {
- this.vid.setBootModes(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (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() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Boot Modes", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeBootModes(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of Mbd Header
- if exists bootModes, set the value directly
- if not exists bootModes, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.bootModes = BootModes.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- BootMode p = BootMode.Factory.newInstance();
- if (!isEmpty(vid.getBootModes(index).getName())) {
- p.setBootModeName(BootModeNames.Enum.forString(vid.getBootModes(index).getName()));
- }
- if (!isEmpty(vid.getBootModes(index).getUsage())) {
- p.setUsage(BootModeUsage.Enum.forString(vid.getBootModes(index).getUsage()));
- }
- if (!isEmpty(vid.getBootModes(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getBootModes(index).getFeatureFlag());
- }
- if (vid.getBootModes(index).getSupArchList() != null
- && vid.getBootModes(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getBootModes(index).getSupArchList());
- }
- if (!isEmpty(vid.getBootModes(index).getHelp())) {
- p.setHelpText(vid.getBootModes(index).getHelp());
- }
- this.bootModes.addNewBootMode();
- this.bootModes.setBootModeArray(bootModes.getBootModeList().size() - 1, p);
- }
- }
-
- this.msa.setBootModes(bootModes);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Boot Modes", e.getMessage());
- Log.err("Update Boot Modes", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBuildOptions.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBuildOptions.java deleted file mode 100644 index 993d1b9dcb..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleBuildOptions.java +++ /dev/null @@ -1,493 +0,0 @@ -/** @file
-
- The file is used to create, update BuildOptions of MSA/MBD file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.List;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.ModuleBuildOptionsDocument;
-import org.tianocore.UserExtensionsDocument;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.OptionDocument.Option;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.BuildOptions.BuildOptionsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.BuildOptions.BuildOptionsVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.BuildOptionsDlg;
-
-/**
- The class is used to create, update BuildOptions of MSA/MBD file
- It extends IInternalFrame
-
-
-
- **/
-public class ModuleBuildOptions extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -3888558623432442561L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private ModuleBuildOptionsDocument.ModuleBuildOptions mbo = null;
-
- private List<UserExtensionsDocument.UserExtensions> ue = null;
-
- private BuildOptionsIdentification id = null;
-
- private BuildOptionsVector vid = new BuildOptionsVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(210, 195, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(390, 195, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- 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 jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Option String Value");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Boot Modes");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inBuildOptions
-
- **/
- private void init(ModuleBuildOptionsDocument.ModuleBuildOptions inModuleBuildOptions) {
- init();
- this.mbo = inModuleBuildOptions;
-
- if (this.mbo != null) {
- //
- // Save User Extensitions
- //
- if (this.mbo.getUserExtensionsList() != null) {
- this.ue = this.mbo.getUserExtensionsList();
- }
-
- if (this.mbo.getOptions() != null) {
- if (this.mbo.getOptions().getOptionList() != null) {
- for (int index = 0; index < this.mbo.getOptions().getOptionList().size(); index++) {
- Option o = this.mbo.getOptions().getOptionList().get(index);
- if (o != null) {
- String arg0 = o.getStringValue();
- Vector<String> arg1 = Tools.convertListToVector(o.getBuildTargets());
- String arg2 = o.getToolChainFamily();
- String arg3 = o.getTagName();
- String arg4 = o.getToolCode();
- Vector<String> arg5 = Tools.convertListToVector(o.getSupArchList());
-
- id = new BuildOptionsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- vid.addBuildOptions(id);
- }
- }
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleBuildOptions() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inBuildOptions The input BuildOptionsDocument.BuildOptions
-
- **/
- public ModuleBuildOptions(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getModuleBuildOptions());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- BuildOptionsDlg dlg = new BuildOptionsDlg(vid.getBuildOptions(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addBuildOptions(dlg.getId());
- } else {
- this.vid.setBuildOptions(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (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() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Boot Modes", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeBuildOptions(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of Mbd Header
- if exists BuildOptions, set the value directly
- if not exists BuildOptions, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.mbo = ModuleBuildOptionsDocument.ModuleBuildOptions.Factory.newInstance();
- this.mbo.addNewOptions();
- //
- // Restore User Extensions Data
- //
- if (this.ue != null) {
- for (int index = 0; index < this.ue.size(); index++) {
- this.mbo.addNewUserExtensions();
- this.mbo.setUserExtensionsArray(index, ue.get(index));
- }
- }
-
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- Option o = Option.Factory.newInstance();
- if (!isEmpty(vid.getBuildOptions(index).getOption())) {
- o.setStringValue(vid.getBuildOptions(index).getOption());
- }
- if (vid.getBuildOptions(index).getBuildTargets() != null
- && vid.getBuildOptions(index).getBuildTargets().size() > 0) {
- o.setBuildTargets(vid.getBuildOptions(index).getBuildTargets());
- }
- if (!isEmpty(vid.getBuildOptions(index).getToolChainFamily())) {
- o.setToolChainFamily(vid.getBuildOptions(index).getToolChainFamily());
- }
- if (!isEmpty(vid.getBuildOptions(index).getTagName())) {
- o.setTagName(vid.getBuildOptions(index).getTagName());
- }
- if (!isEmpty(vid.getBuildOptions(index).getToolCode())) {
- o.setToolCode(vid.getBuildOptions(index).getToolCode());
- }
- if (vid.getBuildOptions(index).getSupArchList() != null
- && vid.getBuildOptions(index).getSupArchList().size() > 0) {
- o.setSupArchList(vid.getBuildOptions(index).getSupArchList());
- }
-
- this.mbo.getOptions().addNewOption();
- this.mbo.getOptions().setOptionArray(this.mbo.getOptions().getOptionList().size() - 1, o);
- }
- }
-
- this.msa.setModuleBuildOptions(this.mbo);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Module Build Options", e.getMessage());
- Log.err("Update Module Build Options", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDataHubs.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDataHubs.java deleted file mode 100644 index b2217f15cd..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleDataHubs.java +++ /dev/null @@ -1,469 +0,0 @@ -/** @file
-
- The file is used to create, update DataHub of MSA/MBD file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.DataHubUsage;
-import org.tianocore.DataHubsDocument;
-import org.tianocore.DataHubsDocument.DataHubs;
-import org.tianocore.DataHubsDocument.DataHubs.DataHubRecord;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.DataHubs.DataHubsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.DataHubs.DataHubsVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.DataHubsDlg;
-
-/**
- The class is used to create, update DataHub of MSA/MBD file
- It extends IInternalFrame
-
-
-
- **/
-public class ModuleDataHubs extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -3667906991966638892L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private DataHubsDocument.DataHubs dataHubs = null;
-
- private DataHubsIdentification id = null;
-
- private DataHubsVector vid = new DataHubsVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- 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 jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Data Hub C_Name");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Data Hubs");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(DataHubs inDataHubs) {
- init();
- this.dataHubs = inDataHubs;
-
- if (this.dataHubs != null) {
- if (this.dataHubs.getDataHubRecordList().size() > 0) {
- for (int index = 0; index < this.dataHubs.getDataHubRecordList().size(); index++) {
- String arg0 = dataHubs.getDataHubRecordList().get(index).getDataHubCName();
- String arg1 = null;
- if (dataHubs.getDataHubRecordList().get(index).getUsage() != null) {
- arg1 = dataHubs.getDataHubRecordList().get(index).getUsage().toString();
- }
-
- String arg2 = dataHubs.getDataHubRecordList().get(index).getFeatureFlag();
- Vector<String> arg3 = Tools.convertListToVector(dataHubs.getDataHubRecordList().get(index)
- .getSupArchList());
- String arg4 = dataHubs.getDataHubRecordList().get(index).getHelpText();
-
- id = new DataHubsIdentification(arg0, arg1, arg2, arg3, arg4);
- vid.addDataHubs(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleDataHubs() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inDataHubs The input DataHubsDocument.DataHubs
-
- **/
- public ModuleDataHubs(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getDataHubs());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- DataHubsDlg dlg = new DataHubsDlg(vid.getDataHubs(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addDataHubs(dlg.getId());
- } else {
- this.vid.setDataHubs(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (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() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Data Hubs", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeDataHubs(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of DataHubs
- if exists dataHubs, set the value directly
- if not exists dataHubs, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.dataHubs = DataHubs.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- DataHubRecord p = DataHubRecord.Factory.newInstance();
- if (!isEmpty(vid.getDataHubs(index).getName())) {
- p.setDataHubCName(vid.getDataHubs(index).getName());
- }
- if (!isEmpty(vid.getDataHubs(index).getUsage())) {
- p.setUsage(DataHubUsage.Enum.forString(vid.getDataHubs(index).getUsage()));
- }
- if (!isEmpty(vid.getDataHubs(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getDataHubs(index).getFeatureFlag());
- }
- if (vid.getDataHubs(index).getSupArchList() != null
- && vid.getDataHubs(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getDataHubs(index).getSupArchList());
- }
- if (!isEmpty(vid.getDataHubs(index).getHelp())) {
- p.setHelpText(vid.getDataHubs(index).getHelp());
- }
- this.dataHubs.addNewDataHubRecord();
- this.dataHubs.setDataHubRecordArray(dataHubs.getDataHubRecordList().size() - 1, p);
- }
- }
-
- this.msa.setDataHubs(dataHubs);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Data Hubs", e.getMessage());
- Log.err("Update Data Hubs", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java deleted file mode 100644 index 354be3ddae..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java +++ /dev/null @@ -1,537 +0,0 @@ -/** @file
-
- The file is used to create, update Event of MSA/MBD file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.EventTypes;
-import org.tianocore.EventsDocument;
-import org.tianocore.ProtocolNotifyUsage;
-import org.tianocore.ProtocolUsage;
-import org.tianocore.EventsDocument.Events;
-import org.tianocore.EventsDocument.Events.CreateEvents;
-import org.tianocore.EventsDocument.Events.SignalEvents;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.Events.EventsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Events.EventsVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.EventsDlg;
-
-/**
- The class is used to create, update Event of MSA/MBD file
- It extends IInternalFrame
-
- @since ModuleEditor 1.0
-
- **/
-public class ModuleEvents extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -4396143706422842331L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private EventsDocument.Events events = null;
-
- private EventsIdentification id = null;
-
- private EventsVector vid = new EventsVector();
-
- private EnumerationData ed = new EnumerationData();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- 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 jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Guid C_Name");
- model.addColumn("Type");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Events");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(Events inEvents) {
- init();
- this.events = inEvents;
-
- if (this.events != null) {
- if (this.events.getCreateEvents() != null) {
- if (this.events.getCreateEvents().getEventTypesList().size() > 0) {
- for (int index = 0; index < this.events.getCreateEvents().getEventTypesList().size(); index++) {
- String arg0 = events.getCreateEvents().getEventTypesList().get(index).getEventGuidCName();
- String arg1 = ed.getVEventType().get(0);
- String arg2 = null;
- if (events.getCreateEvents().getEventTypesList().get(index).getUsage() != null) {
- arg2 = events.getCreateEvents().getEventTypesList().get(index).getUsage().toString();
- }
-
- String arg3 = events.getCreateEvents().getEventTypesList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(events.getCreateEvents().getEventTypesList()
- .get(index).getSupArchList());
- String arg5 = events.getCreateEvents().getEventTypesList().get(index).getHelpText();
- String arg6 = events.getCreateEvents().getEventTypesList().get(index).getEventType().toString();
- id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
- vid.addEvents(id);
- }
- }
- }
- if (this.events.getSignalEvents() != null) {
- if (this.events.getSignalEvents().getEventTypesList().size() > 0) {
- for (int index = 0; index < this.events.getSignalEvents().getEventTypesList().size(); index++) {
- String arg0 = events.getSignalEvents().getEventTypesList().get(index).getEventGuidCName();
- String arg1 = ed.getVEventType().get(1);
- String arg2 = null;
- if (events.getSignalEvents().getEventTypesList().get(index).getUsage() != null) {
- arg2 = events.getSignalEvents().getEventTypesList().get(index).getUsage().toString();
- }
-
- String arg3 = events.getSignalEvents().getEventTypesList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(events.getSignalEvents().getEventTypesList()
- .get(index).getSupArchList());
- String arg5 = events.getSignalEvents().getEventTypesList().get(index).getHelpText();
- String arg6 = events.getSignalEvents().getEventTypesList().get(index).getEventType().toString();
- id = new EventsIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
- vid.addEvents(id);
- }
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleEvents() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inEvents The input EventsDocument.Events
-
- **/
- public ModuleEvents(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getEvents());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- EventsDlg dlg = new EventsDlg(vid.getEvents(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addEvents(dlg.getId());
- } else {
- this.vid.setEvents(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (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() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Events", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeEvents(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of Events
- if exists events, set the value directly
- if not exists events, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.events = Events.Factory.newInstance();
- CreateEvents ce = CreateEvents.Factory.newInstance();
- SignalEvents se = SignalEvents.Factory.newInstance();
-
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- if (vid.getEvents(index).getType().equals(ed.getVEventType().get(0))) {
- CreateEvents.EventTypes e = CreateEvents.EventTypes.Factory.newInstance();
- if (!isEmpty(vid.getEvents(index).getName())) {
- e.setEventGuidCName(vid.getEvents(index).getName());
- }
- if (!isEmpty(vid.getEvents(index).getUsage())) {
- e.setUsage(ProtocolUsage.Enum.forString(vid.getEvents(index).getUsage()));
- }
- if (!isEmpty(vid.getEvents(index).getFeatureFlag())) {
- e.setFeatureFlag(vid.getEvents(index).getFeatureFlag());
- }
- if (vid.getEvents(index).getSupArchList() != null
- && vid.getEvents(index).getSupArchList().size() > 0) {
- e.setSupArchList(vid.getEvents(index).getSupArchList());
- }
- if (!isEmpty(vid.getEvents(index).getHelp())) {
- e.setHelpText(vid.getEvents(index).getHelp());
- }
- if (!isEmpty(vid.getEvents(index).getGroup())) {
- e.setEventType(EventTypes.Enum.forString(vid.getEvents(index).getGroup()));
- }
- ce.addNewEventTypes();
- ce.setEventTypesArray(ce.getEventTypesList().size() - 1, e);
- }
- if (vid.getEvents(index).getType().equals(ed.getVEventType().get(1))) {
- SignalEvents.EventTypes e = SignalEvents.EventTypes.Factory.newInstance();
- if (!isEmpty(vid.getEvents(index).getName())) {
- e.setEventGuidCName(vid.getEvents(index).getName());
- }
- if (!isEmpty(vid.getEvents(index).getUsage())) {
- e.setUsage(ProtocolNotifyUsage.Enum.forString(vid.getEvents(index).getUsage()));
- }
- if (!isEmpty(vid.getEvents(index).getFeatureFlag())) {
- e.setFeatureFlag(vid.getEvents(index).getFeatureFlag());
- }
- if (vid.getEvents(index).getSupArchList() != null
- && vid.getEvents(index).getSupArchList().size() > 0) {
- e.setSupArchList(vid.getEvents(index).getSupArchList());
- }
- if (!isEmpty(vid.getEvents(index).getHelp())) {
- e.setHelpText(vid.getEvents(index).getHelp());
- }
- if (!isEmpty(vid.getEvents(index).getGroup())) {
- e.setEventType(EventTypes.Enum.forString(vid.getEvents(index).getGroup()));
- }
- se.addNewEventTypes();
- se.setEventTypesArray(se.getEventTypesList().size() - 1, e);
- }
- }
- }
- if (ce.getEventTypesList().size() > 0) {
- events.addNewCreateEvents();
- events.setCreateEvents(ce);
- }
- if (se.getEventTypesList().size() > 0) {
- events.addNewSignalEvents();
- events.setSignalEvents(se);
- }
- this.msa.setEvents(events);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Events", e.getMessage());
- Log.err("Update Events", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleExterns.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleExterns.java deleted file mode 100644 index b1917dd033..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleExterns.java +++ /dev/null @@ -1,655 +0,0 @@ -/** @file
-
- The file is used to create, update DataHub of MSA/MBD file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ItemListener;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.ExternsDocument;
-import org.tianocore.ExternsDocument.Externs;
-import org.tianocore.ExternsDocument.Externs.Extern;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.Externs.ExternsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Externs.ExternsVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.ExternsDlg;
-
-/**
- The class is used to create, update DataHub of MSA/MBD file
- It extends IInternalFrame
-
-
-
- **/
-public class ModuleExterns extends IInternalFrame implements ItemListener {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -7382008402932047191L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private ExternsDocument.Externs externs = null;
-
- private ExternsIdentification id = null;
-
- private ExternsVector vid = new ExternsVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- 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 jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Type");
- model.addColumn("Name");
- model.addColumn("Value");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Externs");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(Externs inExterns) {
- init();
- this.externs = inExterns;
-
- if (this.externs != null) {
- //
- // Get specification
- //
- if (this.externs.getSpecificationList().size() > 0) {
- for (int index = 0; index < this.externs.getSpecificationList().size(); index++) {
- String arg0 = externs.getSpecificationList().get(index);
- String arg1 = EnumerationData.EXTERNS_SPECIFICATION;
-
- id = new ExternsIdentification(arg0, arg1);
- vid.addExterns(id);
- }
- }
-
- //
- // Get Externs list
- //
- if (this.externs.getExternList().size() > 0) {
- for (int index = 0; index < this.externs.getExternList().size(); index++) {
- //
- // Get common data
- //
- String featureFlag = externs.getExternList().get(index).getFeatureFlag();
- Vector<String> arch = Tools
- .convertListToVector(externs.getExternList().get(index).getSupArchList());
-
- //
- // Get Image data
- //
- if (this.externs.getExternList().get(index).getModuleEntryPoint() != null
- || this.externs.getExternList().get(index).getModuleUnloadImage() != null) {
- String moduleEntryPoint = this.externs.getExternList().get(index).getModuleEntryPoint();
- String moduleUnloadImage = this.externs.getExternList().get(index).getModuleUnloadImage();
- String type = EnumerationData.EXTERNS_IMAGE;
- id = new ExternsIdentification(moduleEntryPoint, moduleUnloadImage, type, featureFlag, arch);
- }
-
- //
- // Get Library Data
- //
- if (this.externs.getExternList().get(index).getConstructor() != null
- || this.externs.getExternList().get(index).getDestructor() != null) {
- String constructor = this.externs.getExternList().get(index).getConstructor();
- String destructor = this.externs.getExternList().get(index).getDestructor();
- String type = EnumerationData.EXTERNS_LIBRARY;
- id = new ExternsIdentification(constructor, destructor, type, featureFlag, arch);
- }
-
- //
- // Get Driver Data
- //
- if (this.externs.getExternList().get(index).getDriverBinding() != null) {
- String driverBinding = this.externs.getExternList().get(index).getDriverBinding();
- String componentName = this.externs.getExternList().get(index).getComponentName();
- String driverConfig = this.externs.getExternList().get(index).getDriverConfig();
- String driverDiag = this.externs.getExternList().get(index).getDriverDiag();
- String type = EnumerationData.EXTERNS_DRIVER;
- id = new ExternsIdentification(driverBinding, componentName, driverConfig, driverDiag, type,
- featureFlag, arch);
- }
-
- //
- // Get Call Back Data
- //
- if (this.externs.getExternList().get(index).getSetVirtualAddressMapCallBack() != null
- || this.externs.getExternList().get(index).getExitBootServicesCallBack() != null) {
- String virtualAddressMap = this.externs.getExternList().get(index)
- .getSetVirtualAddressMapCallBack();
- String exitBootServices = this.externs.getExternList().get(index).getExitBootServicesCallBack();
- String type = EnumerationData.EXTERNS_CALL_BACK;
- id = new ExternsIdentification(virtualAddressMap, exitBootServices, type, featureFlag, arch);
- }
-
- //
- // Add id to vector
- //
- vid.addExterns(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleExterns() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inExterns The input data of ExternsDocument.Externs
-
- **/
- public ModuleExterns(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getExterns());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- ExternsDlg dlg = new ExternsDlg(vid.getExterns(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addExterns(dlg.getId());
- } else {
- this.vid.setExterns(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- int line = 1;
-
- //
- // For Specification
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
- line = 1;
- }
-
- //
- // For Image
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_IMAGE)) {
- line = 2;
- }
-
- //
- // For Library
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_LIBRARY)) {
- line = 2;
- }
-
- //
- // For Driver
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_DRIVER)) {
- line = 4;
- }
-
- //
- // For Call Back
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_CALL_BACK)) {
- line = 2;
- }
-
- model.addRow(vid.toStringVector(index));
- jTable.setRowHeight(index, line * 18);
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (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() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Externs", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeExterns(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of Externs
- if exists externs, set the value directly
- if not exists externs, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- //
- // Save pcd and flash map information first
- //
- Externs ex = Externs.Factory.newInstance();
- if (this.externs != null) {
- if (this.externs.getPcdIsDriver() != null) {
- ex.setPcdIsDriver(this.externs.getPcdIsDriver());
- }
- if (this.externs.getTianoR8FlashMapH()) {
- ex.setTianoR8FlashMapH(this.externs.getTianoR8FlashMapH());
- }
- }
- this.externs = ex;
-
- //
- // Save externs
- //
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- //
- // Save specfication
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
- if (!isEmpty(vid.getExterns(index).getName0())) {
- this.externs.addNewSpecification();
- this.externs.setSpecificationArray(externs.getSpecificationList().size() - 1,
- vid.getExterns(index).getName0());
- continue;
- }
- }
-
- Extern e = Extern.Factory.newInstance();
- //
- // Save image
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_IMAGE)) {
- if (!isEmpty(vid.getExterns(index).getName0()) || !isEmpty(vid.getExterns(index).getName1())) {
- e = Extern.Factory.newInstance();
- if (!isEmpty(vid.getExterns(index).getName0())) {
- e.setModuleEntryPoint(vid.getExterns(index).getName0());
- }
- if (!isEmpty(vid.getExterns(index).getName1())) {
- e.setModuleUnloadImage(vid.getExterns(index).getName1());
- }
- }
- }
-
- //
- // Save library
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_LIBRARY)) {
- if (!isEmpty(vid.getExterns(index).getName0()) || !isEmpty(vid.getExterns(index).getName1())) {
- e = Extern.Factory.newInstance();
- if (!isEmpty(vid.getExterns(index).getName0())) {
- e.setConstructor(vid.getExterns(index).getName0());
- }
- if (!isEmpty(vid.getExterns(index).getName1())) {
- e.setDestructor(vid.getExterns(index).getName1());
- }
- }
- }
-
- //
- // Save call back
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_CALL_BACK)) {
- if (!isEmpty(vid.getExterns(index).getName0()) || !isEmpty(vid.getExterns(index).getName1())) {
- e = Extern.Factory.newInstance();
- if (!isEmpty(vid.getExterns(index).getName0())) {
- e.setSetVirtualAddressMapCallBack(vid.getExterns(index).getName0());
- }
- if (!isEmpty(vid.getExterns(index).getName1())) {
- e.setExitBootServicesCallBack(vid.getExterns(index).getName1());
- }
- }
- }
-
- //
- // Save driver
- //
- if (vid.getExterns(index).getType().equals(EnumerationData.EXTERNS_DRIVER)) {
- if (!isEmpty(vid.getExterns(index).getName0()) || !isEmpty(vid.getExterns(index).getName1())
- || !isEmpty(vid.getExterns(index).getName2()) || !isEmpty(vid.getExterns(index).getName3())) {
- e = Extern.Factory.newInstance();
- if (!isEmpty(vid.getExterns(index).getName0())) {
- e.setDriverBinding(vid.getExterns(index).getName0());
- }
- if (!isEmpty(vid.getExterns(index).getName1())) {
- e.setComponentName(vid.getExterns(index).getName1());
- }
- if (!isEmpty(vid.getExterns(index).getName2())) {
- e.setDriverConfig(vid.getExterns(index).getName2());
- }
- if (!isEmpty(vid.getExterns(index).getName3())) {
- e.setDriverDiag(vid.getExterns(index).getName3());
- }
- }
- }
-
- //
- // Save common data
- //
- if (!isEmpty(vid.getExterns(index).getFeatureFlag())) {
- e.setFeatureFlag(vid.getExterns(index).getFeatureFlag());
- }
- if (vid.getExterns(index).getSupArchList() != null
- && vid.getExterns(index).getSupArchList().size() > 0) {
- e.setSupArchList(vid.getExterns(index).getSupArchList());
- }
-
- this.externs.addNewExtern();
- this.externs.setExternArray(this.externs.getExternList().size() - 1, e);
- }
- }
-
- this.msa.setExterns(externs);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Externs", e.getMessage());
- Log.err("Update Externs", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java deleted file mode 100644 index 5c9d329a55..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java +++ /dev/null @@ -1,465 +0,0 @@ -/** @file
-
- The file is used to create, update Guids of MSA/MBD file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.GuidUsage;
-import org.tianocore.GuidsDocument;
-import org.tianocore.GuidsDocument.Guids;
-import org.tianocore.GuidsDocument.Guids.GuidCNames;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.GuidsDlg;
-
-/**
- The class is used to create, update Guids of MSA/MBD file
- It extends IInternalFrame
-
- **/
-public class ModuleGuids extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = 6710858997766979803L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private GuidsDocument.Guids guids = null;
-
- private GuidsIdentification id = null;
-
- private GuidsVector vid = new GuidsVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- 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 jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Guid C_Name");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Guids");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(Guids inGuids) {
- init();
- this.guids = inGuids;
-
- if (this.guids != null) {
- if (this.guids.getGuidCNamesList().size() > 0) {
- for (int index = 0; index < this.guids.getGuidCNamesList().size(); index++) {
- String arg0 = guids.getGuidCNamesList().get(index).getGuidCName();
- String arg1 = null;
- if (guids.getGuidCNamesList().get(index).getUsage() != null) {
- arg1 = guids.getGuidCNamesList().get(index).getUsage().toString();
- }
-
- String arg2 = guids.getGuidCNamesList().get(index).getFeatureFlag();
- Vector<String> arg3 = Tools.convertListToVector(guids.getGuidCNamesList().get(index)
- .getSupArchList());
- String arg4 = guids.getGuidCNamesList().get(index).getHelpText();
-
- id = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4);
- vid.addGuids(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleGuids() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inGuids The input data of GuidsDocument.Guids
-
- **/
- public ModuleGuids(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getGuids());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- GuidsDlg dlg = new GuidsDlg(vid.getGuids(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addGuids(dlg.getId());
- } else {
- this.vid.setGuids(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (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() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Guids", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeGuids(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of Guids
- if exists guids, set the value directly
- if not exists guids, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.guids = Guids.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- GuidCNames p = GuidCNames.Factory.newInstance();
- if (!isEmpty(vid.getGuids(index).getName())) {
- p.setGuidCName(vid.getGuids(index).getName());
- }
- if (!isEmpty(vid.getGuids(index).getUsage())) {
- p.setUsage(GuidUsage.Enum.forString(vid.getGuids(index).getUsage()));
- }
- if (!isEmpty(vid.getGuids(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getGuids(index).getFeatureFlag());
- }
- if (vid.getGuids(index).getSupArchList() != null && vid.getGuids(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getGuids(index).getSupArchList());
- }
- if (!isEmpty(vid.getGuids(index).getHelp())) {
- p.setHelpText(vid.getGuids(index).getHelp());
- }
- this.guids.addNewGuidCNames();
- this.guids.setGuidCNamesArray(guids.getGuidCNamesList().size() - 1, p);
- }
- }
-
- this.msa.setGuids(guids);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Guids", e.getMessage());
- Log.err("Update Guids", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHiiPackages.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHiiPackages.java deleted file mode 100644 index 5914b6a69a..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHiiPackages.java +++ /dev/null @@ -1,469 +0,0 @@ -/** @file
-
- The file is used to create, update Formset of MSA/MBD file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.HiiPackageUsage;
-import org.tianocore.HiiPackagesDocument;
-import org.tianocore.HiiPackagesDocument.HiiPackages;
-import org.tianocore.HiiPackagesDocument.HiiPackages.HiiPackage;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.HiiPackages.HiiPackagesIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.HiiPackages.HiiPackagesVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.HiiPackagesDlg;
-
-/**
- The class is used to create, update Formset of MSA/MBD file
- It extends IInternalFrame
-
- **/
-public class ModuleHiiPackages extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -6851574146786158116L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private HiiPackagesDocument.HiiPackages hiiPackages = null;
-
- private HiiPackagesIdentification id = null;
-
- private HiiPackagesVector vid = new HiiPackagesVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- 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 jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Hii Package C_Name");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Hii Packages");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(HiiPackages inHiiPackages) {
- init();
- this.hiiPackages = inHiiPackages;
-
- if (this.hiiPackages != null) {
- if (this.hiiPackages.getHiiPackageList().size() > 0) {
- for (int index = 0; index < this.hiiPackages.getHiiPackageList().size(); index++) {
- String arg0 = hiiPackages.getHiiPackageList().get(index).getHiiCName();
- String arg1 = null;
- if (hiiPackages.getHiiPackageList().get(index).getUsage() != null) {
- arg1 = hiiPackages.getHiiPackageList().get(index).getUsage().toString();
- }
-
- String arg2 = hiiPackages.getHiiPackageList().get(index).getFeatureFlag();
- Vector<String> arg3 = Tools.convertListToVector(hiiPackages.getHiiPackageList().get(index)
- .getSupArchList());
- String arg4 = hiiPackages.getHiiPackageList().get(index).getHelpText();
-
- id = new HiiPackagesIdentification(arg0, arg1, arg2, arg3, arg4);
- vid.addHiiPackages(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleHiiPackages() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- *
- */
- /**
- This is the override edit constructor
-
- @param inFormsets The input data of HiiPackagesDocument.HiiPackages
-
- **/
- public ModuleHiiPackages(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getHiiPackages());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- HiiPackagesDlg dlg = new HiiPackagesDlg(vid.getHiiPackages(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addHiiPackages(dlg.getId());
- } else {
- this.vid.setHiiPackages(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (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() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Hii Packages", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeHiiPackages(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of hiiPackages
- if exists formset, set the value directly
- if not exists formset, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.hiiPackages = HiiPackages.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- HiiPackage p = HiiPackage.Factory.newInstance();
- if (!isEmpty(vid.getHiiPackages(index).getName())) {
- p.setHiiCName(vid.getHiiPackages(index).getName());
- }
- if (!isEmpty(vid.getHiiPackages(index).getUsage())) {
- p.setUsage(HiiPackageUsage.Enum.forString(vid.getHiiPackages(index).getUsage()));
- }
- if (!isEmpty(vid.getHiiPackages(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getHiiPackages(index).getFeatureFlag());
- }
- if (vid.getHiiPackages(index).getSupArchList() != null
- && vid.getHiiPackages(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getHiiPackages(index).getSupArchList());
- }
- if (!isEmpty(vid.getHiiPackages(index).getHelp())) {
- p.setHelpText(vid.getHiiPackages(index).getHelp());
- }
- this.hiiPackages.addNewHiiPackage();
- this.hiiPackages.setHiiPackageArray(hiiPackages.getHiiPackageList().size() - 1, p);
- }
- }
-
- this.msa.setHiiPackages(hiiPackages);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update hiiPackages", e.getMessage());
- Log.err("Update hiiPackages", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHobs.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHobs.java deleted file mode 100644 index 465ebee104..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleHobs.java +++ /dev/null @@ -1,471 +0,0 @@ -/** @file
-
- The file is used to create, update Hob of MSA/MBD file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.HobTypes;
-import org.tianocore.HobUsage;
-import org.tianocore.HobsDocument;
-import org.tianocore.HobsDocument.Hobs;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.Hobs.HobsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Hobs.HobsVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.HobsDlg;
-
-/**
- The class is used to create, update Hob of MSA/MBD file
- It extends IInternalFrame
-
-
-
- **/
-public class ModuleHobs extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -553473437579358325L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private HobsDocument.Hobs hobs = null;
-
- private HobsIdentification id = null;
-
- private HobsVector vid = new HobsVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- 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 jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Guid C_Name");
- model.addColumn("Type");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Hobs");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(Hobs inHobs) {
- init();
- this.hobs = inHobs;
-
- if (this.hobs != null) {
- if (this.hobs.getHobTypesList().size() > 0) {
- for (int index = 0; index < this.hobs.getHobTypesList().size(); index++) {
- String arg0 = hobs.getHobTypesList().get(index).getHobGuidCName();
- String arg1 = null;
- if (hobs.getHobTypesList().get(index).getHobType() != null) {
- arg1 = hobs.getHobTypesList().get(index).getHobType().toString();
- }
- String arg2 = null;
- if (hobs.getHobTypesList().get(index).getUsage() != null) {
- arg2 = hobs.getHobTypesList().get(index).getUsage().toString();
- }
-
- String arg3 = hobs.getHobTypesList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(hobs.getHobTypesList().get(index).getSupArchList());
- String arg5 = hobs.getHobTypesList().get(index).getHelpText();
- id = new HobsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- vid.addHobs(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleHobs() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inHobs The input data of HobsDocument.Hobs
-
- **/
- public ModuleHobs(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getHobs());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- public JPanel getJContentPane() {
- if (jContentPane == null) {
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- HobsDlg dlg = new HobsDlg(vid.getHobs(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addHobs(dlg.getId());
- } else {
- this.vid.setHobs(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (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() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Hobs", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeHobs(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of Hobs
- if exists hobs, set the value directly
- if not exists hobs, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.hobs = Hobs.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- HobsDocument.Hobs.HobTypes p = HobsDocument.Hobs.HobTypes.Factory.newInstance();
- if (!isEmpty(vid.getHobs(index).getName())) {
- p.setHobGuidCName(vid.getHobs(index).getName());
- }
- if (!isEmpty(vid.getHobs(index).getUsage())) {
- p.setUsage(HobUsage.Enum.forString(vid.getHobs(index).getUsage()));
- }
- if (!isEmpty(vid.getHobs(index).getType())) {
- p.setHobType(HobTypes.Enum.forString(vid.getHobs(index).getType()));
- }
- if (!isEmpty(vid.getHobs(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getHobs(index).getFeatureFlag());
- }
- if (vid.getHobs(index).getSupArchList() != null && vid.getHobs(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getHobs(index).getSupArchList());
- }
- this.hobs.addNewHobTypes();
- this.hobs.setHobTypesArray(hobs.getHobTypesList().size() - 1, p);
- }
- }
-
- this.msa.setHobs(hobs);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Hobs", e.getMessage());
- Log.err("Update Hobs", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java deleted file mode 100644 index 09685719fe..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java +++ /dev/null @@ -1,485 +0,0 @@ -/** @file
-
- The file is used to create, update Library Class Definition of MSA/MBD file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.LibraryClassDefinitionsDocument;
-import org.tianocore.LibraryUsage;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;
-import org.tianocore.LibraryClassDocument.LibraryClass;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.LibraryClassDefsDlg;
-
-/**
- The class is used to create, update Library Class Definition of MSA/MBD file
- It extends IInternalFrame
-
- **/
-public class ModuleLibraryClassDefinitions extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -1743248695411382857L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not for UI
- //
- private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;
-
- private LibraryClassDefinitions lcd = null;
-
- private LibraryClassVector vLibraryClass = new LibraryClassVector();
-
- private OpeningModuleType omt = null;
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 330, 90, 20));
- jButtonAdd.setPreferredSize(new Dimension(90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 330, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.setPreferredSize(new Dimension(90, 20));
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 330, 90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.setPreferredSize(new Dimension(90, 20));
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- 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 jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Library Class Name");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleLibraryClassDefinitions() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param
-
- **/
- public ModuleLibraryClassDefinitions(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getLibraryClassDefinitions());
- this.setVisible(true);
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inLibraryClassDefinitions The input data of LibraryClassDefinitionsDocument.LibraryClassDefinitions
-
- **/
- private void init(LibraryClassDefinitionsDocument.LibraryClassDefinitions inLibraryClassDefinitions) {
- init();
- this.lcd = inLibraryClassDefinitions;
- if (this.lcd != null) {
- if (this.lcd.getLibraryClassList().size() > 0) {
- for (int index = 0; index < this.lcd.getLibraryClassList().size(); index++) {
- String name = lcd.getLibraryClassList().get(index).getKeyword();
- String usage = null;
- if (lcd.getLibraryClassList().get(index).getUsage() != null) {
- usage = lcd.getLibraryClassList().get(index).getUsage().toString();
- }
- String version = lcd.getLibraryClassList().get(index).getRecommendedInstanceVersion();
- String guid = lcd.getLibraryClassList().get(index).getRecommendedInstanceGuid();
- String featureFlag = lcd.getLibraryClassList().get(index).getFeatureFlag();
- Vector<String> arch = Tools.convertListToVector(lcd.getLibraryClassList().get(index)
- .getSupArchList());
- Vector<String> module = Tools.convertListToVector(lcd.getLibraryClassList().get(index)
- .getSupModuleList());
- String help = lcd.getLibraryClassList().get(index).getHelpText();
- LibraryClassIdentification lcid = new LibraryClassIdentification(name, usage, version, guid, arch,
- featureFlag, module, help);
- vLibraryClass.addLibraryClass(lcid);
- }
- }
- }
- //
- // Update the list
- //
- showTable();
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setContentPane(getJScrollPane());
- this.setTitle("Library Class Definitions");
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 515));
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- /**
- Save all components of Mbd Header
- if exists mbdHeader, set the value directly
- if not exists mbdHeader, new an instance first
-
- **/
- public void save() {
- try {
- int intLibraryCount = this.vLibraryClass.size();
-
- lcd = LibraryClassDefinitions.Factory.newInstance();
- if (intLibraryCount > 0) {
- for (int index = 0; index < intLibraryCount; index++) {
- LibraryClass mLibraryClass = LibraryClass.Factory.newInstance();
-
- mLibraryClass.setKeyword(vLibraryClass.getLibraryClass(index).getLibraryClassName());
- mLibraryClass
- .setUsage(LibraryUsage.Enum.forString(vLibraryClass.getLibraryClass(index).getUsage()));
- if (!isEmpty(vLibraryClass.getLibraryClass(index).getRecommendedInstanceVersion())) {
- mLibraryClass.setRecommendedInstanceVersion(vLibraryClass.getLibraryClass(index)
- .getRecommendedInstanceVersion());
- }
- if (!isEmpty(vLibraryClass.getLibraryClass(index).getRecommendedInstanceGuid())) {
- mLibraryClass.setRecommendedInstanceGuid(vLibraryClass.getLibraryClass(index)
- .getRecommendedInstanceGuid());
- }
- if (!isEmpty(vLibraryClass.getLibraryClass(index).getFeatureFlag())) {
- mLibraryClass.setFeatureFlag(vLibraryClass.getLibraryClass(index).getFeatureFlag());
- }
- if (vLibraryClass.getLibraryClass(index).getSupArchList() != null
- && vLibraryClass.getLibraryClass(index).getSupArchList().size() > 0) {
- mLibraryClass.setSupArchList(vLibraryClass.getLibraryClass(index).getSupArchList());
- }
- if (vLibraryClass.getLibraryClass(index).getSupModuleList() != null
- && vLibraryClass.getLibraryClass(index).getSupModuleList().size() > 0) {
- mLibraryClass.setSupModuleList(vLibraryClass.getLibraryClass(index).getSupModuleList());
- }
- if (!isEmpty(vLibraryClass.getLibraryClass(index).getHelp())) {
- mLibraryClass.setHelpText(vLibraryClass.getLibraryClass(index).getHelp());
- }
-
- this.lcd.addNewLibraryClass();
- this.lcd.setLibraryClassArray(index, mLibraryClass);
- }
- }
-
- if (msa.getLibraryClassDefinitions() == null) {
- this.msa.addNewLibraryClassDefinitions();
- }
- this.msa.setLibraryClassDefinitions(this.lcd);
-
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Library Class Definitions", e.getMessage());
- Log.err("Update Library Class Definitions", e.getMessage());
- }
- }
-
- private void showEdit(int index) {
- LibraryClassDefsDlg mcdd = new LibraryClassDefsDlg(vLibraryClass.getLibraryClass(index), this.parentFrame, omt.getId());
- int result = mcdd.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vLibraryClass.addLibraryClass(mcdd.getLcid());
- } else {
- this.vLibraryClass.setLibraryClass(mcdd.getLcid(), index);
- }
- this.showTable();
- this.save();
- mcdd.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- mcdd.dispose();
- }
- }
-
- /* (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() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Library Class Definitions", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vLibraryClass.removeLibraryClass(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vLibraryClass.size() > 0) {
- for (int index = 0; index < vLibraryClass.size(); index++) {
- model.addRow(vLibraryClass.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- //this.jScrollPane.setViewportView(this.jTable);
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java deleted file mode 100644 index a50475527b..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java +++ /dev/null @@ -1,485 +0,0 @@ -/** @file
-
- The file is used to create, update PCD of MSA/MBD file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.PcdCodedDocument;
-import org.tianocore.PcdItemTypes;
-import org.tianocore.PcdUsage;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.PcdCodedDocument.PcdCoded;
-import org.tianocore.PcdCodedDocument.PcdCoded.PcdEntry;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.PCDsDlg;
-
-/**
- The class is used to create, update PCD of MSA/MBD file
- It extends IInternalFrame
-
-
-
- **/
-public class ModulePCDs extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = 2227717658188438696L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private PcdCodedDocument.PcdCoded pcds = null;
-
- private PcdCodedIdentification id = null;
-
- private PcdCodedVector vid = new PcdCodedVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 245, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 245, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 245, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- 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 jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Name");
- model.addColumn("Type");
- model.addColumn("Value");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Pcd Coded");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(PcdCoded inPcdCodeds) {
- init();
- this.pcds = inPcdCodeds;
-
- if (this.pcds != null) {
- if (this.pcds.getPcdEntryList().size() > 0) {
- for (int index = 0; index < this.pcds.getPcdEntryList().size(); index++) {
- String arg0 = pcds.getPcdEntryList().get(index).getCName();
- String arg1 = pcds.getPcdEntryList().get(index).getTokenSpaceGuidCName();
-
- String arg2 = pcds.getPcdEntryList().get(index).getFeatureFlag();
- Vector<String> arg3 = Tools.convertListToVector(pcds.getPcdEntryList().get(index).getSupArchList());
-
- String arg4 = pcds.getPcdEntryList().get(index).getDefaultValue();
- String arg5 = pcds.getPcdEntryList().get(index).getHelpText();
- String arg6 = null;
- if (pcds.getPcdEntryList().get(index).getPcdItemType() != null) {
- arg6 = pcds.getPcdEntryList().get(index).getPcdItemType().toString();
- }
- String arg7 = null;
- if (pcds.getPcdEntryList().get(index).getUsage() != null) {
- arg7 = pcds.getPcdEntryList().get(index).getUsage().toString();
- }
- id = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
- vid.addPcdCoded(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModulePCDs() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inPcds The input data of PCDsDocument.PCDs
-
- **/
- public ModulePCDs(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getPcdCoded());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- PCDsDlg dlg = new PCDsDlg(vid.getPcdCoded(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addPcdCoded(dlg.getId());
- } else {
- this.vid.setPcdCoded(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (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() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update PcdCoded", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removePcdCoded(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of PCDs
- if exists pcds, set the value directly
- if not exists pcds, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.pcds = PcdCoded.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- PcdEntry p = PcdEntry.Factory.newInstance();
- if (!isEmpty(vid.getPcdCoded(index).getName())) {
- p.setCName(vid.getPcdCoded(index).getName());
- }
- if (!isEmpty(vid.getPcdCoded(index).getGuid())) {
- p.setTokenSpaceGuidCName(vid.getPcdCoded(index).getGuid());
- }
- if (!isEmpty(vid.getPcdCoded(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getPcdCoded(index).getFeatureFlag());
- }
- if (vid.getPcdCoded(index).getSupArchList() != null
- && vid.getPcdCoded(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getPcdCoded(index).getSupArchList());
- }
- if (!isEmpty(vid.getPcdCoded(index).getValue())) {
- p.setDefaultValue(vid.getPcdCoded(index).getValue());
- }
- if (!isEmpty(vid.getPcdCoded(index).getHelp())) {
- p.setHelpText(vid.getPcdCoded(index).getHelp());
- }
- if (!isEmpty(vid.getPcdCoded(index).getType())) {
- p.setPcdItemType(PcdItemTypes.Enum.forString(vid.getPcdCoded(index).getType()));
- }
- if (!isEmpty(vid.getPcdCoded(index).getUsage())) {
- p.setUsage(PcdUsage.Enum.forString(vid.getPcdCoded(index).getUsage()));
- }
- this.pcds.addNewPcdEntry();
- this.pcds.setPcdEntryArray(pcds.getPcdEntryList().size() - 1, p);
- }
- }
-
- this.msa.setPcdCoded(pcds);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update PcdCoded", e.getMessage());
- Log.err("Update PcdCoded", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePackageDependencies.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePackageDependencies.java deleted file mode 100644 index 3077f3d251..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePackageDependencies.java +++ /dev/null @@ -1,479 +0,0 @@ -/** @file
-
- The file is used to create, update Include of MSA/MBD file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.PackageDependenciesDocument.PackageDependencies;
-import org.tianocore.PackageDependenciesDocument.PackageDependencies.Package;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.PackageDependencies.PackageDependenciesIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PackageDependencies.PackageDependenciesVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.PackageDepDlg;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- The class is used to create, update Include of MSA/MBD file
- It extends IInternalFrame
-
-
-
- **/
-public class ModulePackageDependencies extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = 3465193035145152131L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private PackageDependencies pd = null;
-
- private PackageDependenciesIdentification pdid = null;
-
- private PackageDependenciesVector vid = new PackageDependenciesVector();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private Vector<PackageIdentification> vPackage = wt.getAllPackages();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 445, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 445, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 445, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- 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 jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Package Name");
- model.addColumn("Package Version");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This is the default constructor
-
- **/
- public ModulePackageDependencies() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param
-
- **/
- public ModulePackageDependencies(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getPackageDependencies());
- this.setVisible(true);
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Package Dependencies");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(PackageDependencies inPackageDependencies) {
- init();
- this.pd = inPackageDependencies;
-
- if (this.pd != null) {
- if (this.pd.getPackageList().size() > 0) {
- for (int index = 0; index < this.pd.getPackageList().size(); index++) {
- String arg0 = "";
- String arg1 = pd.getPackageList().get(index).getPackageVersion();
- String arg2 = pd.getPackageList().get(index).getPackageGuid();
- //
- // If no guid, skip current item
- //
- if (arg2 == null) {
- continue;
- }
- for (int indexJ = 0; indexJ < this.vPackage.size(); indexJ++) {
- if (vPackage.get(indexJ).getGuid().equals(arg2)) {
- arg0 = vPackage.get(indexJ).getName();
- }
- }
- String arg3 = pd.getPackageList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(pd.getPackageList().get(index).getSupArchList());
- pdid = new PackageDependenciesIdentification(arg0, arg1, arg2, arg3, arg4);
- vid.addPackageDependencies(pdid);
- }
- }
- }
- showTable();
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- PackageDepDlg pdd = new PackageDepDlg(vid.getPackageDependencies(index), this.parentFrame, omt.getId());
- int result = pdd.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addPackageDependencies(pdd.getPdid());
- } else {
- this.vid.setPackageDependencies(pdd.getPdid(), index);
- }
- this.showTable();
- this.save();
- pdd.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- pdd.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- //this.jScrollPane.setViewportView(this.jTable);
- }
-
- /* (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() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Package Dependencies", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removePackageDependencies(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of Includes
- if exists includes, set the value directly
- if not exists includes, new an instance first
-
- **/
- public void save() {
- try {
- //
- //Save as file name
- //
- int count = this.vid.size();
-
- this.pd = PackageDependencies.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- Package p = Package.Factory.newInstance();
-
- if (!isEmpty(vid.getPackageDependencies(index).getVersion())) {
- p.setPackageVersion(vid.getPackageDependencies(index).getVersion());
- }
- if (!isEmpty(vid.getPackageDependencies(index).getGuid())) {
- p.setPackageGuid(vid.getPackageDependencies(index).getGuid());
- }
- if (!isEmpty(vid.getPackageDependencies(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getPackageDependencies(index).getFeatureFlag());
- }
- if (vid.getPackageDependencies(index).getSupArchList() != null
- && vid.getPackageDependencies(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getPackageDependencies(index).getSupArchList());
- }
-
- this.pd.addNewPackage();
- this.pd.setPackageArray(index, p);
- }
- }
- this.msa.setPackageDependencies(pd);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Package Dependencies", e.getMessage());
- Log.err("Update Package Dependencies", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java deleted file mode 100644 index c7a3e424e9..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java +++ /dev/null @@ -1,514 +0,0 @@ -/** @file
-
- The file is used to create, update Ppi of MSA/MBD file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.PPIsDocument;
-import org.tianocore.PpiNotifyUsage;
-import org.tianocore.PpiUsage;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.PPIsDocument.PPIs;
-import org.tianocore.PPIsDocument.PPIs.Ppi;
-import org.tianocore.PPIsDocument.PPIs.PpiNotify;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.PpisDlg;
-
-/**
- The class is used to create, update Ppi of MSA/MBD file
- It extends IInternalFrame
-
- **/
-public class ModulePpis extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -4284901202357037724L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
-
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private PPIsDocument.PPIs ppis = null;
-
- private PpisIdentification id = null;
-
- private PpisVector vid = new PpisVector();
-
- private EnumerationData ed = new EnumerationData();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- 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 jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Guid C_Name");
- model.addColumn("Type");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Ppis");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(PPIs inPpis) {
- init();
- this.ppis = inPpis;
-
- if (this.ppis != null) {
- if (this.ppis.getPpiList().size() > 0) {
- for (int index = 0; index < this.ppis.getPpiList().size(); index++) {
- String arg0 = ppis.getPpiList().get(index).getPpiCName();
- String arg1 = ed.getVPpiType().get(0);
- String arg2 = null;
- if (ppis.getPpiList().get(index).getUsage() != null) {
- arg2 = ppis.getPpiList().get(index).getUsage().toString();
- }
-
- String arg3 = ppis.getPpiList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(ppis.getPpiList().get(index).getSupArchList());
- String arg5 = ppis.getPpiList().get(index).getHelpText();
-
- id = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- vid.addPpis(id);
- }
- }
- if (this.ppis.getPpiNotifyList().size() > 0) {
- for (int index = 0; index < this.ppis.getPpiNotifyList().size(); index++) {
- String arg0 = ppis.getPpiNotifyList().get(index).getPpiNotifyCName();
- String arg1 = ed.getVPpiType().get(1);
- String arg2 = null;
- if (ppis.getPpiNotifyList().get(index).getUsage() != null) {
- arg2 = ppis.getPpiNotifyList().get(index).getUsage().toString();
- }
-
- String arg3 = ppis.getPpiNotifyList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools
- .convertListToVector(ppis.getPpiNotifyList().get(index).getSupArchList());
- String arg5 = ppis.getPpiNotifyList().get(index).getHelpText();
-
- id = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- vid.addPpis(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModulePpis() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inPpis The input data of PPIsDocument.PPIs
-
- **/
- public ModulePpis(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getPPIs());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- PpisDlg dlg = new PpisDlg(vid.getPpis(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addPpis(dlg.getId());
- } else {
- this.vid.setPpis(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (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() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Ppis", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removePpis(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of PPIs
- if exists ppis, set the value directly
- if not exists ppis, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.ppis = PPIs.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- if (vid.getPpis(index).getType().equals(ed.getVPpiType().get(0))) {
- Ppi p = Ppi.Factory.newInstance();
- if (!isEmpty(vid.getPpis(index).getName())) {
- p.setPpiCName(vid.getPpis(index).getName());
- }
- if (!isEmpty(vid.getPpis(index).getUsage())) {
- p.setUsage(PpiUsage.Enum.forString(vid.getPpis(index).getUsage()));
- }
- if (!isEmpty(vid.getPpis(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getPpis(index).getFeatureFlag());
- }
- if (vid.getPpis(index).getSupArchList() != null
- && vid.getPpis(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getPpis(index).getSupArchList());
- }
- if (!isEmpty(vid.getPpis(index).getHelp())) {
- p.setHelpText(vid.getPpis(index).getHelp());
- }
- this.ppis.addNewPpi();
- this.ppis.setPpiArray(ppis.getPpiList().size() - 1, p);
- }
- if (vid.getPpis(index).getType().equals(ed.getVPpiType().get(1))) {
- PpiNotify p = PpiNotify.Factory.newInstance();
- if (!isEmpty(vid.getPpis(index).getName())) {
- p.setPpiNotifyCName(vid.getPpis(index).getName());
- }
- if (!isEmpty(vid.getPpis(index).getUsage())) {
- p.setUsage(PpiNotifyUsage.Enum.forString(vid.getPpis(index).getUsage()));
- }
- if (!isEmpty(vid.getPpis(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getPpis(index).getFeatureFlag());
- }
- if (vid.getPpis(index).getSupArchList() != null
- && vid.getPpis(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getPpis(index).getSupArchList());
- }
- if (!isEmpty(vid.getPpis(index).getHelp())) {
- p.setHelpText(vid.getPpis(index).getHelp());
- }
- this.ppis.addNewPpiNotify();
- this.ppis.setPpiNotifyArray(ppis.getPpiNotifyList().size() - 1, p);
- }
- }
- }
-
- this.msa.setPPIs(ppis);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Ppis", e.getMessage());
- Log.err("Update Ppis", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java deleted file mode 100644 index 61c5dd80ae..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java +++ /dev/null @@ -1,515 +0,0 @@ -/** @file
-
- The file is used to create, update Protocol of MSA/MBD file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.ProtocolNotifyUsage;
-import org.tianocore.ProtocolUsage;
-import org.tianocore.ProtocolsDocument;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.ProtocolsDocument.Protocols;
-import org.tianocore.ProtocolsDocument.Protocols.Protocol;
-import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.EnumerationData;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.ProtocolsDlg;
-
-/**
- The class is used to create, update Protocol of MSA/MBD file
- It extends IInternalFrame
-
-
-
- **/
-public class ModuleProtocols extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -9084913640747858848L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private ProtocolsDocument.Protocols protocols = null;
-
- private ProtocolsIdentification id = null;
-
- private ProtocolsVector vid = new ProtocolsVector();
-
- private EnumerationData ed = new EnumerationData();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- 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 jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Guid C_Name");
- model.addColumn("Type");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Protocols");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(Protocols inProtocols) {
- init();
- this.protocols = inProtocols;
-
- if (this.protocols != null) {
- if (this.protocols.getProtocolList().size() > 0) {
- for (int index = 0; index < this.protocols.getProtocolList().size(); index++) {
- String arg0 = protocols.getProtocolList().get(index).getProtocolCName();
- String arg1 = ed.getVProtocolType().get(0);
- String arg2 = null;
- if (protocols.getProtocolList().get(index).getUsage() != null) {
- arg2 = protocols.getProtocolList().get(index).getUsage().toString();
- }
-
- String arg3 = protocols.getProtocolList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(protocols.getProtocolList().get(index)
- .getSupArchList());
- String arg5 = protocols.getProtocolList().get(index).getHelpText();
- id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- vid.addProtocols(id);
- }
- }
- if (this.protocols.getProtocolNotifyList().size() > 0) {
- for (int index = 0; index < this.protocols.getProtocolNotifyList().size(); index++) {
- String arg0 = protocols.getProtocolNotifyList().get(index).getProtocolNotifyCName();
- String arg1 = ed.getVProtocolType().get(1);
- String arg2 = null;
- if (protocols.getProtocolNotifyList().get(index).getUsage() != null) {
- arg2 = protocols.getProtocolNotifyList().get(index).getUsage().toString();
- }
-
- String arg3 = protocols.getProtocolNotifyList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(protocols.getProtocolNotifyList().get(index)
- .getSupArchList());
- String arg5 = protocols.getProtocolNotifyList().get(index).getHelpText();
- id = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- vid.addProtocols(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleProtocols() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inProtocol The input data of ProtocolsDocument.Protocols
-
- **/
- public ModuleProtocols(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getProtocols());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- ProtocolsDlg dlg = new ProtocolsDlg(vid.getProtocols(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addProtocols(dlg.getId());
- } else {
- this.vid.setProtocols(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (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() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Protocols", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeProtocols(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of Protocols
- if exists protocols, set the value directly
- if not exists protocols, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.protocols = Protocols.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- if (vid.getProtocols(index).getType().equals(ed.getVProtocolType().get(0))) {
- Protocol p = Protocol.Factory.newInstance();
- if (!isEmpty(vid.getProtocols(index).getName())) {
- p.setProtocolCName(vid.getProtocols(index).getName());
- }
- if (!isEmpty(vid.getProtocols(index).getUsage())) {
- p.setUsage(ProtocolUsage.Enum.forString(vid.getProtocols(index).getUsage()));
- }
- if (!isEmpty(vid.getProtocols(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getProtocols(index).getFeatureFlag());
- }
- if (vid.getProtocols(index).getSupArchList() != null
- && vid.getProtocols(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getProtocols(index).getSupArchList());
- }
- if (!isEmpty(vid.getProtocols(index).getHelp())) {
- p.setHelpText(vid.getProtocols(index).getHelp());
- }
- this.protocols.addNewProtocol();
- this.protocols.setProtocolArray(protocols.getProtocolList().size() - 1, p);
- }
- if (vid.getProtocols(index).getType().equals(ed.getVProtocolType().get(1))) {
- ProtocolNotify p = ProtocolNotify.Factory.newInstance();
- if (!isEmpty(vid.getProtocols(index).getName())) {
- p.setProtocolNotifyCName(vid.getProtocols(index).getName());
- }
- if (!isEmpty(vid.getProtocols(index).getUsage())) {
- p.setUsage(ProtocolNotifyUsage.Enum.forString(vid.getProtocols(index).getUsage()));
- }
- if (!isEmpty(vid.getProtocols(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getProtocols(index).getFeatureFlag());
- }
- if (vid.getProtocols(index).getSupArchList() != null
- && vid.getProtocols(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getProtocols(index).getSupArchList());
- }
- if (!isEmpty(vid.getProtocols(index).getHelp())) {
- p.setHelpText(vid.getProtocols(index).getHelp());
- }
- this.protocols.addNewProtocolNotify();
- this.protocols.setProtocolNotifyArray(protocols.getProtocolNotifyList().size() - 1, p);
- }
- }
- }
-
- this.msa.setProtocols(protocols);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Protocols", e.getMessage());
- Log.err("Update Protocols", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java deleted file mode 100644 index 0d31e10525..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java +++ /dev/null @@ -1,491 +0,0 @@ -/** @file
-
- The file is used to create, update SourceFile of MSA/MBD file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.SourceFilesDocument;
-import org.tianocore.FilenameDocument.Filename;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.SourceFilesDocument.SourceFiles;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.SourceFiles.SourceFilesIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.SourceFiles.SourceFilesVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.SourceFilesDlg;
-
-/**
- The class is used to create, update SourceFile of MSA/MBD file
- It extends IInternalFrame
-
- **/
-public class ModuleSourceFiles extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -6765742852142775378L;
-
- //
- // Define class members
- //
- private SourceFilesDocument.SourceFiles sourceFiles = null;
-
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JCheckBox jCheckBoxArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private SourceFilesVector vSourceFiles = new SourceFilesVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- 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 jScrollPaneTable
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("File Name");
- model.addColumn("Tag Name");
- model.addColumn("Tool Code");
- model.addColumn("Tool Chain Family");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleSourceFiles() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param
-
- **/
- public ModuleSourceFiles(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getSourceFiles());
- this.setVisible(true);
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
-
- @param inSourceFiles The input data of SourceFilesDocument.SourceFiles
-
- **/
- private void init(SourceFilesDocument.SourceFiles inSourceFiles) {
- init();
- this.sourceFiles = inSourceFiles;
-
- if (this.sourceFiles != null) {
- if (this.sourceFiles.getFilenameList().size() > 0) {
- for (int index = 0; index < this.sourceFiles.getFilenameList().size(); index++) {
- String name = sourceFiles.getFilenameList().get(index).getStringValue();
- String tagName = sourceFiles.getFilenameList().get(index).getTagName();
- String toolCode = sourceFiles.getFilenameList().get(index).getToolCode();
- String tcf = sourceFiles.getFilenameList().get(index).getToolChainFamily();
- String featureFlag = sourceFiles.getFilenameList().get(index).getFeatureFlag();
- Vector<String> arch = Tools.convertListToVector(sourceFiles.getFilenameList().get(index)
- .getSupArchList());
- SourceFilesIdentification sfid = new SourceFilesIdentification(name, tagName, toolCode, tcf,
- featureFlag, arch);
- vSourceFiles.addSourceFiles(sfid);
- }
- }
- }
- showTable();
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Source Files");
- this.setViewMode(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.jButtonAdd.setEnabled(!isView);
- this.jButtonRemove.setEnabled(!isView);
- this.jButtonUpdate.setEnabled(!isView);
- this.jCheckBoxArch.setEnabled(!isView);
- }
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- /**
- Save all components of SourceFiles
- if exists sourceFiles, set the value directly
- if not exists sourceFiles, new an instance first
-
- **/
- public void save() {
- try {
- //
- //Save as file name
- //
- int count = this.vSourceFiles.size();
-
- this.sourceFiles = SourceFiles.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- Filename mFilename = Filename.Factory.newInstance();
- if (!isEmpty(vSourceFiles.getSourceFiles(index).getFilename())) {
- mFilename.setStringValue(vSourceFiles.getSourceFiles(index).getFilename());
- }
- if (!isEmpty(vSourceFiles.getSourceFiles(index).getTagName())) {
- mFilename.setTagName(vSourceFiles.getSourceFiles(index).getTagName());
- }
- if (!isEmpty(vSourceFiles.getSourceFiles(index).getToolCode())) {
- mFilename.setToolCode(vSourceFiles.getSourceFiles(index).getToolCode());
- }
- if (!isEmpty(vSourceFiles.getSourceFiles(index).getToolChainFamily())) {
- mFilename.setToolChainFamily(vSourceFiles.getSourceFiles(index).getToolChainFamily());
- }
- if (!isEmpty(vSourceFiles.getSourceFiles(index).getFeatureFlag())) {
- mFilename.setFeatureFlag(vSourceFiles.getSourceFiles(index).getFeatureFlag());
- }
- if (vSourceFiles.getSourceFiles(index).getSupArchList() != null
- && vSourceFiles.getSourceFiles(index).getSupArchList().size() > 0) {
- mFilename.setSupArchList(vSourceFiles.getSourceFiles(index).getSupArchList());
- }
-
- this.sourceFiles.addNewFilename();
- this.sourceFiles.setFilenameArray(index, mFilename);
- }
- }
- this.msa.setSourceFiles(sourceFiles);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Source Files", e.getMessage());
- Log.err("Update Source Files", e.getMessage());
- }
- }
-
- private void showEdit(int index) {
- SourceFilesDlg sfd = new SourceFilesDlg(this.vSourceFiles.getSourceFiles(index), this.parentFrame, omt.getId());
- int result = sfd.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- for (int indexI = 0; indexI < sfd.getSfid().length; indexI++) {
- this.vSourceFiles.addSourceFiles(sfd.getSfid()[indexI]);
- }
- } else {
- this.vSourceFiles.setSourceFiles(sfd.getSfid()[0], index);
- }
- this.showTable();
- this.save();
- sfd.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- sfd.dispose();
- }
- }
-
- /* (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() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Source Files", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vSourceFiles.removeSourceFiles(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vSourceFiles.size() > 0) {
- for (int index = 0; index < vSourceFiles.size(); index++) {
- model.addRow(vSourceFiles.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- //this.jScrollPane.setViewportView(this.jTable);
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSystemTables.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSystemTables.java deleted file mode 100644 index 8bcb18c1de..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleSystemTables.java +++ /dev/null @@ -1,469 +0,0 @@ -/** @file
-
- The file is used to create, update SystemTable of MSA/MBD file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.SystemTableUsage;
-import org.tianocore.SystemTablesDocument;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.SystemTablesDocument.SystemTables;
-import org.tianocore.SystemTablesDocument.SystemTables.SystemTableCNames;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.SystemTables.SystemTablesIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.SystemTables.SystemTablesVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.SystemTablesDlg;
-
-/**
- The class is used to create, update SystemTable of MSA/MBD file
- It extends IInternalFrame
-
-
-
- **/
-public class ModuleSystemTables extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = 7488769180379442276L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private SystemTablesDocument.SystemTables systemTables = null;
-
- private SystemTablesIdentification id = null;
-
- private SystemTablesVector vid = new SystemTablesVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 195, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 195, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 195, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- 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 jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Guid C_Name");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("System Tables");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inSystemTables
-
- **/
- private void init(SystemTables inSystemTables) {
- init();
- this.systemTables = inSystemTables;
-
- if (this.systemTables != null) {
- if (this.systemTables.getSystemTableCNamesList().size() > 0) {
- for (int index = 0; index < this.systemTables.getSystemTableCNamesList().size(); index++) {
- String arg0 = systemTables.getSystemTableCNamesList().get(index).getSystemTableCName();
- String arg1 = null;
- if (systemTables.getSystemTableCNamesList().get(index).getUsage() != null) {
- arg1 = systemTables.getSystemTableCNamesList().get(index).getUsage().toString();
- }
-
- String arg2 = systemTables.getSystemTableCNamesList().get(index).getFeatureFlag();
- Vector<String> arg3 = Tools.convertListToVector(systemTables.getSystemTableCNamesList().get(index)
- .getSupArchList());
- String arg4 = systemTables.getSystemTableCNamesList().get(index).getHelpText();
-
- id = new SystemTablesIdentification(arg0, arg1, arg2, arg3, arg4);
- vid.addSystemTables(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleSystemTables() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inSystemTables The input data of SystemTablesDocument.SystemTables
-
- **/
- public ModuleSystemTables(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getSystemTables());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- SystemTablesDlg dlg = new SystemTablesDlg(vid.getSystemTables(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addSystemTables(dlg.getId());
- } else {
- this.vid.setSystemTables(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (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() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update System Tables", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeSystemTables(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of SystemTables
- if exists systemTables, set the value directly
- if not exists systemTables, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.systemTables = SystemTables.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- SystemTableCNames p = SystemTableCNames.Factory.newInstance();
- if (!isEmpty(vid.getSystemTables(index).getName())) {
- p.setSystemTableCName(vid.getSystemTables(index).getName());
- }
- if (!isEmpty(vid.getSystemTables(index).getUsage())) {
- p.setUsage(SystemTableUsage.Enum.forString(vid.getSystemTables(index).getUsage()));
- }
- if (!isEmpty(vid.getSystemTables(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getSystemTables(index).getFeatureFlag());
- }
- if (vid.getSystemTables(index).getSupArchList() != null
- && vid.getSystemTables(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getSystemTables(index).getSupArchList());
- }
- if (!isEmpty(vid.getSystemTables(index).getHelp())) {
- p.setHelpText(vid.getSystemTables(index).getHelp());
- }
- this.systemTables.addNewSystemTableCNames();
- this.systemTables.setSystemTableCNamesArray(systemTables.getSystemTableCNamesList().size() - 1, p);
- }
- }
-
- this.msa.setSystemTables(systemTables);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update System Tables", e.getMessage());
- Log.err("Update System Tables", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleVariables.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleVariables.java deleted file mode 100644 index 29eb4ff852..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleVariables.java +++ /dev/null @@ -1,472 +0,0 @@ -/** @file
-
- The file is used to create, update Variable of MSA/MBD file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.MouseEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-
-import org.tianocore.VariableUsage;
-import org.tianocore.VariablesDocument;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.VariablesDocument.Variables;
-import org.tianocore.VariablesDocument.Variables.Variable;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.module.Identifications.Variables.VariablesIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Variables.VariablesVector;
-import org.tianocore.frameworkwizard.module.ui.dialog.VariablesDlg;
-
-/**
- The class is used to create, update Variable of MSA/MBD file
- It extends IInternalFrame
-
- **/
-public class ModuleVariables extends IInternalFrame {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -6998982978030439446L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonUpdate = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JTable jTable = null;
-
- //
- // Not used by UI
- //
- private OpeningModuleType omt = null;
-
- private ModuleSurfaceArea msa = null;
-
- private VariablesDocument.Variables variables = null;
-
- private VariablesIdentification id = null;
-
- private VariablesVector vid = new VariablesVector();
-
- private IDefaultTableModel model = null;
-
- private int selectedRow = -1;
-
- private IFrame parentFrame = null;
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton jButtonAdd
-
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(230, 220, 90, 20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- jButtonAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton jButtonRemove
-
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(400, 220, 90, 20));
- jButtonRemove.setText("Remove");
- jButtonRemove.addActionListener(this);
- jButtonRemove.setPreferredSize(new java.awt.Dimension(90, 20));
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonUpdate
-
- @return javax.swing.JButton jButtonUpdate
-
- **/
- private JButton getJButtonUpdate() {
- if (jButtonUpdate == null) {
- jButtonUpdate = new JButton();
- jButtonUpdate.setBounds(new java.awt.Rectangle(315, 220, 90, 20));
- jButtonUpdate.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonUpdate.setText("Edit");
- jButtonUpdate.addActionListener(this);
- }
- return jButtonUpdate;
- }
-
- /**
- 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 jScrollPaneTable
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(15, 10, 470, 420));
- jScrollPaneTable.setPreferredSize(new Dimension(470, 420));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new IDefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
-
- model.addColumn("Name");
- model.addColumn("Guid C_Name");
- model.addColumn("Usage");
-
- jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(this);
- jTable.getModel().addTableModelListener(this);
- jTable.addMouseListener(this);
- }
- return jTable;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(500, 515);
- this.setContentPane(getJScrollPane());
- this.setTitle("Variables");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inPackageDependencies
-
- **/
- private void init(Variables inVariables) {
- init();
- this.variables = inVariables;
-
- if (this.variables != null) {
- if (this.variables.getVariableList().size() > 0) {
- for (int index = 0; index < this.variables.getVariableList().size(); index++) {
- String arg0 = Tools.convertUnicodeHexStringToString(variables.getVariableList().get(index)
- .getVariableName());
- String arg1 = variables.getVariableList().get(index).getGuidCName();
- String arg2 = null;
- if (variables.getVariableList().get(index).getUsage() != null) {
- arg2 = variables.getVariableList().get(index).getUsage().toString();
- }
-
- String arg3 = variables.getVariableList().get(index).getFeatureFlag();
- Vector<String> arg4 = Tools.convertListToVector(variables.getVariableList().get(index)
- .getSupArchList());
- String arg5 = variables.getVariableList().get(index).getHelpText();
- id = new VariablesIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- vid.addVariables(id);
- }
- }
- }
- showTable();
- }
-
- /**
- This is the default constructor
-
- **/
- public ModuleVariables() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inVariables The input data of VariablesDocument.Variables
-
- **/
- public ModuleVariables(OpeningModuleType inOmt, IFrame iFrame) {
- super();
- this.omt = inOmt;
- this.msa = omt.getXmlMsa();
- this.parentFrame = iFrame;
- init(msa.getVariables());
- this.setVisible(true);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 490));
-
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonUpdate(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- }
- return jContentPane;
- }
-
- private void showEdit(int index) {
- VariablesDlg dlg = new VariablesDlg(vid.getVariables(index), this.parentFrame, omt.getId());
- int result = dlg.showDialog();
- if (result == DataType.RETURN_TYPE_OK) {
- if (index == -1) {
- this.vid.addVariables(dlg.getId());
- } else {
- this.vid.setVariables(dlg.getId(), index);
- }
- this.showTable();
- this.save();
- dlg.dispose();
- }
- if (result == DataType.RETURN_TYPE_CANCEL) {
- dlg.dispose();
- }
- }
-
- /**
- Clear all table rows
-
- **/
- private void clearAll() {
- if (model != null) {
- for (int index = model.getRowCount() - 1; index >= 0; index--) {
- model.removeRow(index);
- }
- }
- }
-
- /**
- Read content of vector and put then into table
-
- **/
- private void showTable() {
- clearAll();
-
- if (vid.size() > 0) {
- for (int index = 0; index < vid.size(); index++) {
- model.addRow(vid.toStringVector(index));
- }
- }
- this.jTable.repaint();
- this.jTable.updateUI();
- }
-
- /* (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() == jButtonAdd) {
- showEdit(-1);
- }
- if (arg0.getSource() == jButtonUpdate) {
- if (this.selectedRow < 0) {
- Log.wrn("Update Variables", "Please select one record first.");
- return;
- }
- showEdit(selectedRow);
- }
-
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
-
- int selectedRows[] = this.jTable.getSelectedRows();
-
- if (selectedRows != null) {
- for (int index = selectedRows.length - 1; index > -1; index--) {
- this.model.removeRow(selectedRows[index]);
- this.vid.removeVariables(selectedRows[index]);
- }
- selectedRow = -1;
- this.save();
- }
- }
- }
-
- /**
- Save all components of Variables
- if exists variables, set the value directly
- if not exists variables, new an instance first
-
- **/
- public void save() {
- try {
- int count = this.vid.size();
-
- this.variables = Variables.Factory.newInstance();
- if (count > 0) {
- for (int index = 0; index < count; index++) {
- Variable p = Variable.Factory.newInstance();
- if (!isEmpty(vid.getVariables(index).getName())) {
- p.setVariableName(Tools.convertStringToUnicodeHexString(vid.getVariables(index).getName()));
- }
- if (!isEmpty(vid.getVariables(index).getGuid())) {
- p.setGuidCName(vid.getVariables(index).getGuid());
- }
- if (!isEmpty(vid.getVariables(index).getUsage())) {
- p.setUsage(VariableUsage.Enum.forString(vid.getVariables(index).getUsage()));
- }
- if (!isEmpty(vid.getVariables(index).getFeatureFlag())) {
- p.setFeatureFlag(vid.getVariables(index).getFeatureFlag());
- }
- if (vid.getVariables(index).getSupArchList() != null
- && vid.getVariables(index).getSupArchList().size() > 0) {
- p.setSupArchList(vid.getVariables(index).getSupArchList());
- }
- if (!isEmpty(vid.getVariables(index).getHelp())) {
- p.setHelpText(vid.getVariables(index).getHelp());
- }
- this.variables.addNewVariable();
- this.variables.setVariableArray(variables.getVariableList().size() - 1, p);
- }
- }
-
- this.msa.setVariables(variables);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Update Variables", e.getMessage());
- Log.err("Update Variables", e.getMessage());
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
- *
- */
- public void valueChanged(ListSelectionEvent arg0) {
- if (arg0.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
- *
- */
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getClickCount() == 2) {
- if (this.selectedRow < 0) {
- return;
- } else {
- showEdit(selectedRow);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intCurrentHeight = this.getJContentPane().getHeight();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
- int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
-
- Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight);
- Tools.relocateComponent(this.jButtonAdd, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_ADD_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_ADD_BUTTON);
- Tools.relocateComponent(this.jButtonRemove, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON);
- Tools.relocateComponent(this.jButtonUpdate, intCurrentWidth, intCurrentHeight, intPreferredWidth,
- intPreferredHeight, DataType.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON,
- DataType.SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON);
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java deleted file mode 100644 index 4284af2b10..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java +++ /dev/null @@ -1,1696 +0,0 @@ -/** @file
-
- The file is used to create, update MsaHeader of MSA file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.FocusEvent;
-import java.awt.event.ItemEvent;
-import java.util.Vector;
-
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-
-import org.tianocore.ExternsDocument;
-import org.tianocore.ModuleDefinitionsDocument;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.ModuleTypeDef;
-import org.tianocore.MsaHeaderDocument;
-import org.tianocore.PcdDriverTypes;
-import org.tianocore.LicenseDocument.License;
-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.Identifications.OpeningModuleType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import javax.swing.JRadioButton;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-
-/**
- The class is used to create, update MsaHeader of MSA file
- It extends IInternalFrame
-
-
-
- **/
-public class MsaHeader extends IInternalFrame implements DocumentListener {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -8152099582923006900L;
-
- private int dialogWidth = 500;
-
- private int dialogHeight = 630;
-
- private final int labelWidth = 155;
-
- private int valueWidth = 320;
-
- private final int labelCol = 12;
-
- private final int valueCol = 168;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelBaseName = null;
-
- private JTextField jTextFieldBaseName = null;
-
- private JLabel jLabelGuid = null;
-
- private JTextField jTextFieldGuid = null;
-
- private JLabel jLabelVersion = null;
-
- private JTextField jTextFieldVersion = null;
-
- private JButton jButtonGenerateGuid = null;
-
- private JLabel jLabelLicense = null;
-
- private JTextArea jTextAreaLicense = null;
-
- private JLabel jLabelCopyright = null;
-
- private JLabel jLabelDescription = null;
-
- private JTextArea jTextAreaDescription = null;
-
- private JLabel jLabelSpecification = null;
-
- private JTextField jTextFieldSpecification = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private JScrollPane jScrollPaneLicense = null;
-
- private JScrollPane jScrollPaneDescription = null;
-
- private JLabel jLabelAbstract = null;
-
- private JTextField jTextFieldAbstract = null;
-
- private JLabel jLabelModuleType = null;
-
- private JComboBox jComboBoxModuleType = null;
-
- private JLabel jLabelArch = null;
-
- private JLabel jLabelBinaryModule = null;
-
- private JLabel jLabelOutputFileBasename = null;
-
- private JTextField jTextFieldOutputFileBasename = null;
-
- private JScrollPane jScrollPaneCopyright = null;
-
- private JTextArea jTextAreaCopyright = null;
-
- private JLabel jLabelURL = null;
-
- private JTextField jTextFieldURL = null;
-
- private JScrollPane jScrollPane = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel4 = null;
-
- private StarLabel jStarLabel5 = null;
-
- private StarLabel jStarLabel6 = null;
-
- private StarLabel jStarLabel7 = null;
-
- private StarLabel jStarLabel8 = null;
-
- private StarLabel jStarLabel10 = null;
-
- private StarLabel jStarLabel12 = null;
-
- private StarLabel jStarLabel13 = null;
-
- private StarLabel jStarLabel14 = null;
-
- private JCheckBox jCheckBoxIa32 = null;
-
- private JCheckBox jCheckBoxX64 = null;
-
- private JCheckBox jCheckBoxIpf = null;
-
- private JCheckBox jCheckBoxEbc = null;
-
- private JCheckBox jCheckBoxArm = null;
-
- private JCheckBox jCheckBoxPpc = null;
-
- private JTextField jComboBoxPcdIsDriver = null;
-
- private JCheckBox jCheckBoxPcd = null;
-
- private JCheckBox jCheckBoxFlashMap = null;
-
- //
- // Not used for UI
- //
- private MsaHeaderDocument.MsaHeader msaHeader = null;
-
- private ModuleDefinitionsDocument.ModuleDefinitions md = null;
-
- private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;
-
- private ExternsDocument.Externs ex = null;
-
- private OpeningModuleType omt = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private JRadioButton jRadioButtonBinaryModuleTrue = null;
-
- private JRadioButton jRadioButtonBinaryModuleFalse = null;
-
- /**
- * This method initializes jCheckBoxIa32
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxIa32() {
- if (jCheckBoxIa32 == null) {
- jCheckBoxIa32 = new JCheckBox();
- jCheckBoxIa32.setBounds(new java.awt.Rectangle(valueCol, 505, 55, 20));
- jCheckBoxIa32.setText("IA32");
- jCheckBoxIa32.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxIa32;
- }
-
- /**
- * This method initializes jCheckBoxX64
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxX64() {
- if (jCheckBoxX64 == null) {
- jCheckBoxX64 = new JCheckBox();
- jCheckBoxX64.setBounds(new java.awt.Rectangle(valueCol + 55, 505, 53, 20));
- jCheckBoxX64.setText("X64");
- jCheckBoxX64.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxX64;
- }
-
- /**
- * This method initializes jCheckBoxIpf
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxIpf() {
- if (jCheckBoxIpf == null) {
- jCheckBoxIpf = new JCheckBox();
- jCheckBoxIpf.setBounds(new java.awt.Rectangle(valueCol + 110, 505, 52, 20));
- jCheckBoxIpf.setText("IPF");
- jCheckBoxIpf.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxIpf;
- }
-
- /**
- * This method initializes jCheckBoxEbc
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxEbc() {
- if (jCheckBoxEbc == null) {
- jCheckBoxEbc = new JCheckBox();
- jCheckBoxEbc.setBounds(new java.awt.Rectangle(valueCol + 165, 505, 53, 20));
- jCheckBoxEbc.setText("EBC");
- jCheckBoxEbc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxEbc;
- }
-
- /**
- * This method initializes jCheckBoxArm
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxArm() {
- if (jCheckBoxArm == null) {
- jCheckBoxArm = new JCheckBox();
- jCheckBoxArm.setBounds(new java.awt.Rectangle(valueCol + 220, 505, 54, 20));
- jCheckBoxArm.setText("ARM");
- jCheckBoxArm.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxArm;
- }
-
- /**
- * This method initializes jCheckBoxPpc
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxPpc() {
- if (jCheckBoxPpc == null) {
- jCheckBoxPpc = new JCheckBox();
- jCheckBoxPpc.setBounds(new java.awt.Rectangle(valueCol + 285, 505, 53, 20));
- jCheckBoxPpc.setText("PPC");
- jCheckBoxPpc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
- }
- return jCheckBoxPpc;
- }
-
- /**
- This method initializes jTextFieldBaseName
-
- @return javax.swing.JTextField jTextFieldBaseName
-
- **/
- private JTextField getJTextFieldBaseName() {
- if (jTextFieldBaseName == null) {
- jTextFieldBaseName = new JTextField();
- jTextFieldBaseName.setBounds(new java.awt.Rectangle(valueCol, 10, valueWidth, 20));
- jTextFieldBaseName.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldBaseName.addFocusListener(this);
- jTextFieldBaseName.setToolTipText("A brief Identifier, such as USB I/O Library, of the module");
- }
- return jTextFieldBaseName;
- }
-
- /**
- This method initializes jTextFieldGuid
-
- @return javax.swing.JTextField jTextFieldGuid
-
- **/
- private JTextField getJTextFieldGuid() {
- if (jTextFieldGuid == null) {
- jTextFieldGuid = new JTextField();
- jTextFieldGuid.setPreferredSize(new java.awt.Dimension(250, 20));
- jTextFieldGuid.setLocation(new java.awt.Point(valueCol, 60));
- jTextFieldGuid.setSize(new java.awt.Dimension(250, 20));
- jTextFieldGuid.addFocusListener(this);
- jTextFieldGuid.setToolTipText("Guaranteed Unique Identification Number, Registry Format (8-4-4-4-12)");
- }
- return jTextFieldGuid;
- }
-
- /**
- This method initializes jTextFieldVersion
-
- @return javax.swing.JTextField jTextFieldVersion
-
- **/
- private JTextField getJTextFieldVersion() {
- if (jTextFieldVersion == null) {
- jTextFieldVersion = new JTextField();
- jTextFieldVersion.setPreferredSize(new java.awt.Dimension(valueWidth, 20));
- jTextFieldVersion.setLocation(new java.awt.Point(valueCol, 85));
- jTextFieldVersion.setSize(new java.awt.Dimension(valueWidth, 20));
- jTextFieldVersion.addFocusListener(this);
- jTextFieldVersion.setToolTipText("A Version Number, 1.0, 1, 1.01, 1.0.1");
- }
- return jTextFieldVersion;
- }
-
- /**
- This method initializes jButtonGenerateGuid
-
- @return javax.swing.JButton jButtonGenerateGuid
-
- **/
- private JButton getJButtonGenerateGuid() {
- if (jButtonGenerateGuid == null) {
- int genGuidCol = valueCol + 285;
- jButtonGenerateGuid = new JButton();
- jButtonGenerateGuid.setPreferredSize(new java.awt.Dimension(65, 20));
- jButtonGenerateGuid.setSize(new java.awt.Dimension(65, 20));
- jButtonGenerateGuid.setLocation(new java.awt.Point(genGuidCol, 60));
- jButtonGenerateGuid.setText("GEN");
- jButtonGenerateGuid.addActionListener(this);
- }
- return jButtonGenerateGuid;
- }
-
- /**
- This method initializes jTextAreaLicense
-
- @return javax.swing.JTextArea jTextAreaLicense
-
- **/
- private JTextArea getJTextAreaLicense() {
- if (jTextAreaLicense == null) {
- jTextAreaLicense = new JTextArea();
- jTextAreaLicense.setText("");
- jTextAreaLicense.setLineWrap(true);
- jTextAreaLicense.addFocusListener(this);
- jTextAreaLicense.setWrapStyleWord(true);
- jTextAreaLicense.setSelectionStart(0);
- jTextAreaLicense.setSelectionEnd(0);
- jTextAreaLicense.setToolTipText("The License for this Module.");
- }
- return jTextAreaLicense;
- }
-
- /**
- This method initializes jTextAreaDescription
-
- @return javax.swing.JTextArea jTextAreaDescription
-
- **/
- private JTextArea getJTextAreaDescription() {
- if (jTextAreaDescription == null) {
- jTextAreaDescription = new JTextArea();
- jTextAreaDescription.setLineWrap(true);
- jTextAreaDescription.addFocusListener(this);
- jTextAreaDescription.setToolTipText("A verbose description of the module.");
- jTextAreaDescription.setWrapStyleWord(true);
- jTextAreaDescription.setSelectionStart(0);
- jTextAreaDescription.setSelectionEnd(0);
- }
- return jTextAreaDescription;
- }
-
- /**
- This method initializes jTextFieldSpecification
-
- @return javax.swing.JTextField jTextFieldSpecification
-
- **/
- private JTextField getJTextFieldSpecification() {
- if (jTextFieldSpecification == null) {
- int specWidth = valueWidth + 50;
- jTextFieldSpecification = new JTextField();
-
- jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(specWidth, 20));
- jTextFieldSpecification.setText("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052");
- jTextFieldSpecification.setBorder(null);
-
- jTextFieldSpecification.setSize(new java.awt.Dimension(specWidth, 20));
- jTextFieldSpecification.setLocation(new java.awt.Point(labelCol, dialogHeight - 30));
- jTextFieldSpecification.setEditable(false);
- jTextFieldSpecification.addFocusListener(this);
- }
- return jTextFieldSpecification;
- }
-
- /**
- This method initializes jButtonOk
-
- @return javax.swing.JButton jButtonOk
-
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setText("OK");
- jButtonOk.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonOk.setBounds(new java.awt.Rectangle(390, 455, 90, 20));
- jButtonOk.addActionListener(this);
- jButtonOk.setVisible(false);
- }
- return jButtonOk;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton jButtonCancel
-
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setText("Cancel");
- jButtonCancel.setBounds(new java.awt.Rectangle(390, 445, 90, 20));
- jButtonCancel.addActionListener(this);
- jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonCancel.setVisible(false);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes jScrollPaneLicense
-
- @return javax.swing.JScrollPane jScrollPaneLicense
-
- **/
- private JScrollPane getJScrollPaneLicense() {
- if (jScrollPaneLicense == null) {
- jScrollPaneLicense = new JScrollPane();
- jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneLicense.setSize(new java.awt.Dimension(valueWidth, 120));
- jScrollPaneLicense.setLocation(new java.awt.Point(valueCol, 305));
- jScrollPaneLicense.setViewportView(getJTextAreaLicense());
- jScrollPaneLicense.setPreferredSize(new java.awt.Dimension(valueWidth, 120));
- }
- return jScrollPaneLicense;
- }
-
- /**
- This method initializes jScrollPaneDescription
-
- @return javax.swing.JScrollPane jScrollPaneDescription
-
- **/
- private JScrollPane getJScrollPaneDescription() {
- if (jScrollPaneDescription == null) {
- jScrollPaneDescription = new JScrollPane();
- jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneDescription.setSize(new java.awt.Dimension(valueWidth, 120));
- jScrollPaneDescription.setLocation(new java.awt.Point(valueCol, 135));
- jScrollPaneDescription.setViewportView(getJTextAreaDescription());
- jScrollPaneDescription.setPreferredSize(new java.awt.Dimension(valueWidth, 120));
- }
- return jScrollPaneDescription;
- }
-
- /**
- This method initializes jTextFieldAbstract
-
- @return javax.swing.JTextField jTextFieldAbstract
-
- **/
- private JTextField getJTextFieldAbstract() {
- if (jTextFieldAbstract == null) {
- jTextFieldAbstract = new JTextField();
- jTextFieldAbstract.setPreferredSize(new java.awt.Dimension(valueWidth, 20));
- jTextFieldAbstract.setLocation(new java.awt.Point(valueCol, 110));
- jTextFieldAbstract.setSize(new java.awt.Dimension(valueWidth, 20));
- jTextFieldAbstract.addFocusListener(this);
- jTextFieldAbstract.setToolTipText("A one sentence description of this module.");
- }
- return jTextFieldAbstract;
- }
-
- /**
- This method initializes jComboBoxModuleType
-
- @return javax.swing.JComboBox jComboBoxModuleType
-
- **/
- private JComboBox getJComboBoxModuleType() {
- if (jComboBoxModuleType == null) {
- jComboBoxModuleType = new JComboBox();
- jComboBoxModuleType.setBounds(new java.awt.Rectangle(valueCol, 35, valueWidth, 20));
- jComboBoxModuleType.setPreferredSize(new java.awt.Dimension(valueWidth, 20));
- }
- return jComboBoxModuleType;
- }
-
- /**
- This method initializes jTextFieldURL
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldURL() {
- if (jTextFieldURL == null) {
- jTextFieldURL = new JTextField();
- jTextFieldURL.setPreferredSize(new java.awt.Dimension(valueWidth, 20));
- jTextFieldURL.setLocation(new java.awt.Point(valueCol, 430));
- jTextFieldURL.setSize(new java.awt.Dimension(valueWidth, 20));
- jTextFieldURL.addFocusListener(this);
- jTextFieldURL.setToolTipText("A URL for the latest version of the license.");
- }
- return jTextFieldURL;
- }
-
- /**
- 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 jScrollPaneCopyright
-
- @return javax.swing.JScrollPane
-
- **/
- private JScrollPane getJScrollPaneCopyright() {
- if (jScrollPaneCopyright == null) {
- jScrollPaneCopyright = new JScrollPane();
- jScrollPaneCopyright.setBounds(new java.awt.Rectangle(valueCol, 260, valueWidth, 40));
- jScrollPaneCopyright.setPreferredSize(new java.awt.Dimension(valueWidth, 40));
- jScrollPaneCopyright.setViewportView(getJTextAreaCopyright());
- jScrollPaneCopyright.setSize(new java.awt.Dimension(valueWidth, 40));
- }
- return jScrollPaneCopyright;
- }
-
- /**
- This method initializes jTextAreaCopyright
-
- @return javax.swing.JTextArea
-
- **/
- private JTextArea getJTextAreaCopyright() {
- if (jTextAreaCopyright == null) {
- jTextAreaCopyright = new JTextArea();
- jTextAreaCopyright.setLineWrap(true);
- jTextAreaCopyright.addFocusListener(this);
- jTextAreaCopyright.setWrapStyleWord(true);
- jTextAreaCopyright.setSelectionStart(0);
- jTextAreaCopyright.setSelectionEnd(0);
- jTextAreaCopyright.setBounds(new java.awt.Rectangle(0, 0, valueWidth, 40));
- jTextAreaCopyright.setToolTipText("One or more copyright lines.");
- }
- return jTextAreaCopyright;
- }
-
- /**
- * This method initializes jTextFieldOutputFileBasename
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldOutputFileBasename() {
- if (jTextFieldOutputFileBasename == null) {
- jTextFieldOutputFileBasename = new JTextField();
- jTextFieldOutputFileBasename.setBounds(new java.awt.Rectangle(valueCol, 455, valueWidth, 20));
- jTextFieldOutputFileBasename.setPreferredSize(new java.awt.Dimension(valueWidth, 20));
- jTextFieldOutputFileBasename.addFocusListener(this);
- jTextFieldOutputFileBasename.setToolTipText("Enter a single word for generated output file names.");
- }
- return jTextFieldOutputFileBasename;
- }
-
- /**
- * This method initializes jComboBoxPcdIsDriver
- *
- * @return javax.swing.JComboBox
- */
- private JTextField getJComboBoxPcdIsDriver() {
- if (jComboBoxPcdIsDriver == null) {
- jComboBoxPcdIsDriver = new JTextField();
- jComboBoxPcdIsDriver.setPreferredSize(new java.awt.Dimension(valueWidth, 20));
- jComboBoxPcdIsDriver.setBounds(new java.awt.Rectangle(valueCol, 530, valueWidth, 20));
- jComboBoxPcdIsDriver.setEnabled(false);
- jComboBoxPcdIsDriver.setVisible(false);
- }
- return jComboBoxPcdIsDriver;
- }
-
- /**
- This is the default constructor
-
- **/
- public MsaHeader() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader
-
- **/
- public MsaHeader(OpeningModuleType inMsa) {
- super();
- this.omt = inMsa;
- this.msa = omt.getXmlMsa();
-
- //
- // Set module definitions default value
- //
- if (msa.getModuleDefinitions() == null) {
- ModuleDefinitionsDocument.ModuleDefinitions md = ModuleDefinitionsDocument.ModuleDefinitions.Factory
- .newInstance();
- md.setOutputFileBasename(msa.getMsaHeader().getModuleName());
- md.setBinaryModule(false);
- md.setSupportedArchitectures(ed.getVSupportedArchitectures());
- msa.setModuleDefinitions(md);
- }
-
- //
- // Init items of Header, Definitions and Externs
- //
- init(msa.getMsaHeader());
- init(msa.getModuleDefinitions());
- init(msa.getExterns());
- this.addListeners();
-
- this.setVisible(true);
- this.setViewMode(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.jTextFieldBaseName.setEnabled(!isView);
- this.jTextFieldGuid.setEnabled(!isView);
- this.jTextFieldVersion.setEnabled(!isView);
- this.jTextAreaLicense.setEnabled(!isView);
- this.jTextAreaCopyright.setEnabled(!isView);
- this.jTextAreaDescription.setEnabled(!isView);
- this.jTextFieldSpecification.setEnabled(!isView);
- this.jTextFieldAbstract.setEnabled(!isView);
- this.jComboBoxModuleType.setEnabled(!isView);
- this.jButtonCancel.setEnabled(!isView);
- this.jButtonGenerateGuid.setEnabled(!isView);
- this.jButtonOk.setEnabled(!isView);
- }
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(dialogWidth, dialogHeight);
- this.setPreferredSize(new java.awt.Dimension(dialogWidth, dialogHeight));
- this.setContentPane(getJScrollPane());
- this.setTitle("Module Surface Area Header");
- initFrame();
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader
-
- **/
- private void init(MsaHeaderDocument.MsaHeader inMsaHeader) {
- init();
- if (inMsaHeader != null) {
- setMsaHeader(inMsaHeader);
- if (this.msaHeader.getModuleName() != null) {
- this.jTextFieldBaseName.setText(this.msaHeader.getModuleName());
- }
- if (this.msaHeader.getModuleType() != null) {
- this.jComboBoxModuleType.setSelectedItem(this.msaHeader.getModuleType().toString());
- }
- if (this.msaHeader.getGuidValue() != null) {
- this.jTextFieldGuid.setText(this.msaHeader.getGuidValue());
- }
- if (this.msaHeader.getVersion() != null) {
- this.jTextFieldVersion.setText(this.msaHeader.getVersion());
- }
- if (this.msaHeader.getAbstract() != null) {
- this.jTextFieldAbstract.setText(this.msaHeader.getAbstract());
- }
- if (this.msaHeader.getDescription() != null) {
- this.jTextAreaDescription.setText(this.msaHeader.getDescription());
- jTextAreaDescription.setSelectionStart(0);
- jTextAreaDescription.setSelectionEnd(0);
- }
- if (this.msaHeader.getCopyright() != null) {
- this.jTextAreaCopyright.setText(this.msaHeader.getCopyright());
- }
- if (this.msaHeader.getLicense() != null) {
- this.jTextAreaLicense.setText(this.msaHeader.getLicense().getStringValue());
- jTextAreaLicense.setSelectionStart(0);
- jTextAreaLicense.setSelectionEnd(0);
- }
- if (this.msaHeader.getLicense() != null && this.msaHeader.getLicense().getURL() != null) {
- this.jTextFieldURL.setText(this.msaHeader.getLicense().getURL());
- }
- if (this.msaHeader.getSpecification() != null) {
- this.jTextFieldSpecification.setText(this.msaHeader.getSpecification());
- }
- }
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader
-
- **/
- private void init(ModuleDefinitionsDocument.ModuleDefinitions inMd) {
- if (inMd != null) {
- this.md = inMd;
- if (md.getSupportedArchitectures() != null) {
- this.setSelectedItems(Tools.convertListToVector(md.getSupportedArchitectures()));
- }
- if (md.getBinaryModule()) {
- this.jRadioButtonBinaryModuleTrue.setSelected(true);
- } else {
- this.jRadioButtonBinaryModuleFalse.setSelected(true);
- }
- if (md.getOutputFileBasename() != null) {
- this.jTextFieldOutputFileBasename.setText(md.getOutputFileBasename());
- }
- }
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inEx The input data of ExternsDocument.Externs
-
- **/
- private void init(ExternsDocument.Externs inEx) {
- if (inEx != null) {
- this.ex = inEx;
- if (ex.getPcdIsDriver() != null) {
- this.jCheckBoxPcd.setSelected(true);
- this.jCheckBoxPcd.setEnabled(true);
- }
- this.jCheckBoxFlashMap.setSelected(ex.getTianoR8FlashMapH());
- }
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
-
- jLabelURL = new JLabel();
- jLabelURL.setText("License URL");
- jLabelURL.setLocation(new java.awt.Point(labelCol, 430));
- jLabelURL.setSize(new java.awt.Dimension(labelWidth, 20));
- jLabelBaseName = new JLabel();
- jLabelBaseName.setText("Module Name");
- jLabelBaseName.setBounds(new java.awt.Rectangle(labelCol, 10, labelWidth, 20));
- jLabelModuleType = new JLabel();
- jLabelModuleType.setBounds(new java.awt.Rectangle(labelCol, 35, labelWidth, 20));
- jLabelModuleType.setText("Module Type");
- jLabelGuid = new JLabel();
- jLabelGuid.setText("Guid Value");
- jLabelGuid.setLocation(new java.awt.Point(labelCol, 60));
- jLabelGuid.setSize(new java.awt.Dimension(labelWidth, 20));
- jLabelVersion = new JLabel();
- jLabelVersion.setText("Version");
- jLabelVersion.setLocation(new java.awt.Point(labelCol, 85));
- jLabelVersion.setSize(new java.awt.Dimension(labelWidth, 20));
- jLabelAbstract = new JLabel();
- jLabelAbstract.setText("Abstract");
- jLabelAbstract.setLocation(new java.awt.Point(labelCol, 110));
- jLabelAbstract.setSize(new java.awt.Dimension(labelWidth, 20));
- jLabelDescription = new JLabel();
- jLabelDescription.setText("Description");
- jLabelDescription.setLocation(new java.awt.Point(labelCol, 135));
- jLabelDescription.setSize(new java.awt.Dimension(labelWidth, 20));
- jLabelCopyright = new JLabel();
- jLabelCopyright.setText("Copyright");
- jLabelCopyright.setLocation(new java.awt.Point(labelCol, 260));
- jLabelCopyright.setSize(new java.awt.Dimension(labelWidth, 20));
- jLabelLicense = new JLabel();
- jLabelLicense.setText("License");
- jLabelLicense.setLocation(new java.awt.Point(labelCol, 305));
- jLabelLicense.setSize(new java.awt.Dimension(labelWidth, 20));
- jLabelOutputFileBasename = new JLabel();
- jLabelOutputFileBasename.setBounds(new java.awt.Rectangle(labelCol, 455, labelWidth, 20));
- jLabelOutputFileBasename.setText("Output File Basename");
- jLabelBinaryModule = new JLabel();
- jLabelBinaryModule.setBounds(new java.awt.Rectangle(labelCol, 480, labelWidth, 20));
- jLabelBinaryModule.setText("Binary Module");
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(labelCol, 505, labelWidth, 20));
- jLabelArch.setText("Supported Architectures");
- jLabelSpecification = new JLabel();
- jLabelSpecification.setText("Specification");
- jLabelSpecification.setLocation(new java.awt.Point(labelCol, 530));
- jLabelSpecification.setSize(new java.awt.Dimension(labelWidth, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(dialogWidth - 10, dialogHeight - 10));
-
- jContentPane.addFocusListener(this);
-
- jContentPane.add(jLabelBaseName, null);
- jContentPane.add(getJTextFieldBaseName(), null);
- jContentPane.add(jLabelGuid, null);
- jContentPane.add(getJTextFieldGuid(), null);
- jContentPane.add(jLabelVersion, null);
- jContentPane.add(getJTextFieldVersion(), null);
- jContentPane.add(getJButtonGenerateGuid(), null);
- jContentPane.add(jLabelLicense, null);
- jContentPane.add(jLabelCopyright, null);
- jContentPane.add(jLabelDescription, null);
- jContentPane.add(getJTextFieldSpecification(), null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJScrollPaneLicense(), null);
- jContentPane.add(getJScrollPaneDescription(), null);
- jContentPane.add(jLabelAbstract, null);
- jContentPane.add(getJTextFieldAbstract(), null);
- jContentPane.add(jLabelModuleType, null);
- jContentPane.add(getJComboBoxModuleType(), null);
- jContentPane.add(jLabelURL, null);
- jContentPane.add(getJTextFieldURL(), null);
- jContentPane.add(jLabelOutputFileBasename, null);
- jContentPane.add(getJTextFieldOutputFileBasename(), null);
- jContentPane.add(jLabelBinaryModule, null);
- jContentPane.add(jLabelArch, null);
-
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, 10));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(0, 35));
- jStarLabel4 = new StarLabel();
- jStarLabel4.setLocation(new java.awt.Point(0, 60));
- jStarLabel5 = new StarLabel();
- jStarLabel5.setLocation(new java.awt.Point(0, 85));
- jStarLabel6 = new StarLabel();
- jStarLabel6.setLocation(new java.awt.Point(0, 135));
- jStarLabel7 = new StarLabel();
- jStarLabel7.setLocation(new java.awt.Point(0, 260));
- jStarLabel8 = new StarLabel();
- jStarLabel8.setLocation(new java.awt.Point(0, 305));
- jStarLabel10 = new StarLabel();
- jStarLabel10.setLocation(new java.awt.Point(0, 110));
- jStarLabel12 = new StarLabel();
- jStarLabel12.setLocation(new java.awt.Point(0, 455));
- jStarLabel13 = new StarLabel();
- jStarLabel13.setLocation(new java.awt.Point(0, 480));
- jStarLabel14 = new StarLabel();
- jStarLabel14.setLocation(new java.awt.Point(0, 505));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(jStarLabel5, null);
- jContentPane.add(jStarLabel6, null);
- jContentPane.add(jStarLabel7, null);
- jContentPane.add(jStarLabel8, null);
- jContentPane.add(jStarLabel10, null);
- jContentPane.add(jStarLabel12, null);
- jContentPane.add(jStarLabel13, null);
- jContentPane.add(jStarLabel14, null);
- jContentPane.add(getJScrollPaneCopyright(), null);
-
- jContentPane.add(getJCheckBoxIa32(), null);
- jContentPane.add(getJCheckBoxX64(), null);
- jContentPane.add(getJCheckBoxIpf(), null);
- jContentPane.add(getJCheckBoxEbc(), null);
- jContentPane.add(getJCheckBoxArm(), null);
- jContentPane.add(getJCheckBoxPpc(), null);
-
- jContentPane.add(getJCheckBoxPcd(), null);
- jContentPane.add(getJComboBoxPcdIsDriver(), null);
- jContentPane.add(getJCheckBoxFlashMap(), null);
-
- ButtonGroup bg = new ButtonGroup();
- jContentPane.add(getJRadioButtonBinaryModuleTrue(), null);
- jContentPane.add(getJRadioButtonBinaryModuleFalse(), null);
- bg.add(getJRadioButtonBinaryModuleTrue());
- bg.add(getJRadioButtonBinaryModuleFalse());
- }
- 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() == jButtonGenerateGuid) {
- jTextFieldGuid.setText(Tools.generateUuidString());
- jTextFieldGuid.requestFocus();
- jButtonGenerateGuid.requestFocus();
- }
- }
-
- /**
- Data validation for all fields
-
- @retval true - All datas are valid
- @retval false - At least one data is invalid
-
- **/
- public boolean check() {
- //
- // Check if all required fields are not empty
- // and check if all data fields values are valid
- //
-
- //
- // Check Base Name
- //
- if (isEmpty(this.jTextFieldBaseName.getText())) {
- Log.wrn("Update Msa Header", "Name must be entered!");
- //this.jTextFieldBaseName.requestFocus();
- return false;
- }
- if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {
- Log.wrn("Update Msa Header", "Incorrect data type for Name, it must start with an alpha character!");
- //this.jTextFieldBaseName.requestFocus();
- return false;
- }
-
- //
- // Check Guid
- //
- if (isEmpty(this.jTextFieldGuid.getText())) {
- Log.wrn("Update Msa Header", "The Guid Value must be entered!");
- //this.jTextFieldGuid.requestFocus();
- return false;
- }
- if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
- Log.wrn("Update Msa Header", "Incorrect data type for Guid, it must be registry format, 8-4-4-4-12");
- //this.jTextFieldGuid.requestFocus();
- return false;
- }
-
- //
- // Check Version
- //
- if (isEmpty(this.jTextFieldVersion.getText())) {
- Log.wrn("Update Msa Header", "Version must be entered!");
- //this.jTextFieldVersion.requestFocus();
- return false;
- }
- if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {
- Log.wrn("Update Msa Header", "Incorrect data type for Version, it must start with a digit.");
- //this.jTextFieldVersion.requestFocus();
- return false;
- }
-
- //
- // Check Abstact
- //
- if (isEmpty(this.jTextFieldAbstract.getText())) {
- Log.wrn("Update Msa Header", "Abstract must be entered!");
- //this.jTextFieldAbstract.requestFocus();
- return false;
- }
- if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {
- Log.wrn("Update Msa Header",
- "Incorrect data type for Abstract, is should be a sentence describing the module.");
- //this.jTextFieldAbstract.requestFocus();
- return false;
- }
-
- //
- // Check Description
- //
- if (isEmpty(this.jTextAreaDescription.getText())) {
- Log.wrn("Update Msa Header", "Description must be entered!");
- //this.jTextAreaDescription.requestFocus();
- return false;
- }
-
- //
- // Check Copyright
- //
- if (isEmpty(this.jTextAreaCopyright.getText())) {
- Log.wrn("Update Msa Header", "Copyright must be entered!");
- //this.jTextFieldCopyright.requestFocus();
- return false;
- }
-
- //
- // Check License
- //
- if (isEmpty(this.jTextAreaLicense.getText())) {
- Log.wrn("Update Msa Header", "License must be entered!");
- //this.jTextAreaLicense.requestFocus();
- return false;
- }
-
- //
- // Check Specification
- //
- if (isEmpty(this.jTextFieldSpecification.getText())) {
- Log.wrn("Update Msa Header", "Specification must exist.");
- //this.jTextFieldSpecification.requestFocus();
- return false;
- }
- if (!DataValidation.isSpecification(this.jTextFieldSpecification.getText())) {
- // TODO Add code to check the specification number.
- // Future releases of Schema may require that we process these files
- // differently.
- Log.wrn("Update Msa Header", "Incorrect data type for Specification");
- //this.jTextFieldSpecification.requestFocus();
- return false;
- }
-
- return true;
- }
-
- /**
- Save all components of Msa Header
- if exists msaHeader, set the value directly
- if not exists msaHeader, new an instance first
-
- **/
- public void save() {
- try {
- msaHeader.setSpecification(this.jTextFieldSpecification.getText());
- msa.setMsaHeader(msaHeader);
- msa.setModuleDefinitions(md);
- this.omt.setSaved(false);
- } catch (Exception e) {
- Log.wrn("Save Module", e.getMessage());
- Log.err("Save Module", e.getMessage());
- }
- }
-
- /**
- This method initializes Module type and Compontent type
-
- **/
- private void initFrame() {
- EnumerationData ed = new EnumerationData();
- Tools.generateComboBoxByVector(jComboBoxModuleType, ed.getVModuleType());
- this.setSelectedItems(ed.getVSupportedArchitectures());
- }
-
- /**
- Get MsaHeaderDocument.MsaHeader
-
- @return MsaHeaderDocument.MsaHeader
-
- **/
- public MsaHeaderDocument.MsaHeader getMsaHeader() {
- return msaHeader;
- }
-
- /**
- Set MsaHeaderDocument.MsaHeader
-
- @param msaHeader The input data of MsaHeaderDocument.MsaHeader
-
- **/
- public void setMsaHeader(MsaHeaderDocument.MsaHeader msaHeader) {
- this.msaHeader = msaHeader;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intCurrentWidth = this.getJContentPane().getWidth();
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
-
- Tools.resizeComponentWidth(this.jTextFieldBaseName, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldGuid, intCurrentWidth, intPreferredWidth + 7);
- Tools.resizeComponentWidth(this.jTextFieldVersion, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPaneLicense, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldURL, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPaneCopyright, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPaneDescription, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldSpecification, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldAbstract, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jComboBoxModuleType, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldOutputFileBasename, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jComboBoxPcdIsDriver, intCurrentWidth, intPreferredWidth);
-
- Tools.relocateComponentX(this.jButtonGenerateGuid, intCurrentWidth, intPreferredWidth,
- DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
- }
-
- public void focusLost(FocusEvent arg0) {
- if (this.msaHeader == null) {
- msaHeader = MsaHeaderDocument.MsaHeader.Factory.newInstance();
- }
-
- //
- // Check BaseName
- //
- if (arg0.getSource() == this.jTextFieldBaseName) {
- if (isEmpty(this.jTextFieldBaseName.getText())) {
- Log.wrn("Update Msa Header", "The Name must be entered!");
- //this.jTextFieldBaseName.requestFocus();
- return;
- }
- if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {
- Log.wrn("Update Msa Header", "Incorrect data type for Name, it must begin with an alpha character.");
- //this.jTextFieldBaseName.requestFocus();
- return;
- }
- if (!this.jTextFieldBaseName.getText().equals(msaHeader.getModuleName())) {
- this.msaHeader.setModuleName(this.jTextFieldBaseName.getText());
- } else {
- return;
- }
- }
-
- //
- // Check Guid
- //
- if (arg0.getSource() == this.jTextFieldGuid) {
- if (isEmpty(this.jTextFieldGuid.getText())) {
- Log.wrn("Update Msa Header", "Guid must be entered!");
- //this.jTextFieldGuid.requestFocus();
- return;
- }
- if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
- Log.wrn("Update Msa Header", "Incorrect data type for Guid, it must be registry format. (8-4-4-4-12)");
- //this.jTextFieldGuid.requestFocus();
- return;
- }
- if (!this.jTextFieldGuid.getText().equals(msaHeader.getGuidValue())) {
- this.msaHeader.setGuidValue(this.jTextFieldGuid.getText());
- } else {
- return;
- }
- }
-
- //
- // Check Version
- //
- if (arg0.getSource() == this.jTextFieldVersion) {
- if (isEmpty(this.jTextFieldVersion.getText())) {
- Log.wrn("Update Msa Header", "Version must be entered!");
- //this.jTextFieldVersion.requestFocus();
- return;
- }
- if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {
- Log.wrn("Update Msa Header", "Incorrect data type for Version, it must start with a digit.");
- //this.jTextFieldVersion.requestFocus();
- return;
- }
- if (!this.jTextFieldVersion.getText().equals(msaHeader.getVersion())) {
- this.msaHeader.setVersion(this.jTextFieldVersion.getText());
- } else {
- return;
- }
- }
-
- //
- // Check Abstact
- //
- if (arg0.getSource() == this.jTextFieldAbstract) {
- if (isEmpty(this.jTextFieldAbstract.getText())) {
- Log.wrn("Update Msa Header", "Abstract must be entered!");
- //this.jTextFieldAbstract.requestFocus();
- return;
- }
- if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {
- Log.wrn("Update Msa Header", "Incorrect data type for Abstract, it must be sentence.");
- //this.jTextFieldAbstract.requestFocus();
- return;
- }
- if (!this.jTextFieldAbstract.getText().equals(msaHeader.getAbstract())) {
- this.msaHeader.setAbstract(this.jTextFieldAbstract.getText());
- } else {
- return;
- }
- }
-
- //
- // Check Description
- //
- if (arg0.getSource() == this.jTextAreaDescription) {
- if (isEmpty(this.jTextAreaDescription.getText())) {
- Log.wrn("Update Msa Header", "Description must be entered!");
- //this.jTextAreaDescription.requestFocus();
- return;
- }
- if (!this.jTextAreaDescription.getText().equals(msaHeader.getDescription())) {
- this.msaHeader.setDescription(this.jTextAreaDescription.getText());
- } else {
- return;
- }
- }
-
- //
- // Check Copyright
- //
- if (arg0.getSource() == this.jTextAreaCopyright) {
- if (isEmpty(this.jTextAreaCopyright.getText())) {
- Log.wrn("Update Msa Header", "Copyright must be entered!");
- //this.jTextFieldCopyright.requestFocus();
- return;
- }
- if (!this.jTextAreaCopyright.getText().equals(msaHeader.getCopyright())) {
- this.msaHeader.setCopyright(this.jTextAreaCopyright.getText());
- } else {
- return;
- }
- }
-
- //
- // Check License
- //
- if (arg0.getSource() == this.jTextAreaLicense) {
- if (isEmpty(this.jTextAreaLicense.getText())) {
- Log.wrn("Update Msa Header", "License must be entered!");
- //this.jTextAreaLicense.requestFocus();
- return;
- }
- if (this.msaHeader.getLicense() != null) {
- if (!this.jTextAreaLicense.getText().equals(msaHeader.getLicense().getStringValue())) {
- this.msaHeader.getLicense().setStringValue(this.jTextAreaLicense.getText());
- } else {
- return;
- }
- } else {
- License mLicense = License.Factory.newInstance();
- mLicense.setStringValue(this.jTextAreaLicense.getText());
- this.msaHeader.setLicense(mLicense);
- }
- }
-
- //
- // Check License URL
- //
- if (arg0.getSource() == this.jTextFieldURL) {
- if (!isEmpty(this.jTextFieldURL.getText())) {
- if (this.msaHeader.getLicense() == null) {
- License mLicense = License.Factory.newInstance();
- mLicense.setURL(this.jTextFieldURL.getText());
- this.msaHeader.setLicense(mLicense);
- } else {
- if (!this.jTextFieldURL.getText().equals(msaHeader.getLicense().getURL())) {
- this.msaHeader.getLicense().setURL(this.jTextFieldURL.getText());
- } else {
- return;
- }
- }
- }
- }
-
- //
- // Check Output File Basename
- //
- if (arg0.getSource() == this.jTextFieldOutputFileBasename) {
- if (isEmpty(this.jTextFieldOutputFileBasename.getText())) {
- Log.wrn("Update Msa Header", "Output File Basename must be entered!");
- // jTextFieldOutputFileBasename.removeFocusListener(this);
- // jTextFieldOutputFileBasename.requestFocus();
- // jTextFieldOutputFileBasename.addFocusListener(this);
- return;
- }
-
- if (!DataValidation.isOutputFileBasename(this.jTextFieldOutputFileBasename.getText())) {
- Log.wrn("Update Msa Header",
- "Incorrect data type for Output File Basename, it must be a valid file name");
- return;
- }
-
- if (!this.jTextFieldOutputFileBasename.getText().equals(md.getOutputFileBasename())) {
- this.md.setOutputFileBasename(this.jTextFieldOutputFileBasename.getText());
- } else {
- return;
- }
- }
-
- //
- // Check Binary Module Type
- //
- if (arg0.getSource() == this.jRadioButtonBinaryModuleTrue) {
- if (jRadioButtonBinaryModuleTrue.isSelected()) {
- if (md.getBinaryModule()) {
- return;
- } else {
- md.setBinaryModule(true);
- }
- }
- }
-
- //
- // Check Binary Module Type
- //
- if (arg0.getSource() == this.jRadioButtonBinaryModuleFalse) {
- if (jRadioButtonBinaryModuleFalse.isSelected()) {
- if (md.getBinaryModule()) {
- md.setBinaryModule(false);
- } else {
- return;
- }
- }
- }
-
- this.save();
- }
-
- private Vector<String> getSelectedItemsVector() {
- Vector<String> v = new Vector<String>();
- if (this.jCheckBoxIa32.isSelected()) {
- v.addElement(jCheckBoxIa32.getText());
- }
- if (this.jCheckBoxX64.isSelected()) {
- v.addElement(jCheckBoxX64.getText());
- }
- if (this.jCheckBoxIpf.isSelected()) {
- v.addElement(jCheckBoxIpf.getText());
- }
- if (this.jCheckBoxEbc.isSelected()) {
- v.addElement(jCheckBoxEbc.getText());
- }
- if (this.jCheckBoxArm.isSelected()) {
- v.addElement(jCheckBoxArm.getText());
- }
- if (this.jCheckBoxPpc.isSelected()) {
- v.addElement(jCheckBoxPpc.getText());
- }
- return v;
- }
-
- private String getSelectedItemsString() {
- String s = "";
- if (this.jCheckBoxIa32.isSelected()) {
- s = s + jCheckBoxIa32.getText() + " ";
- }
- if (this.jCheckBoxX64.isSelected()) {
- s = s + jCheckBoxX64.getText() + " ";
- }
- if (this.jCheckBoxIpf.isSelected()) {
- s = s + jCheckBoxIpf.getText() + " ";
- }
- if (this.jCheckBoxEbc.isSelected()) {
- s = s + jCheckBoxEbc.getText() + " ";
- }
- if (this.jCheckBoxArm.isSelected()) {
- s = s + jCheckBoxArm.getText() + " ";
- }
- if (this.jCheckBoxPpc.isSelected()) {
- s = s + jCheckBoxPpc.getText() + " ";
- }
- return s.trim();
- }
-
- private void setAllItemsSelected(boolean isSelected) {
- this.jCheckBoxIa32.setSelected(true);
- this.jCheckBoxX64.setSelected(isSelected);
- this.jCheckBoxIpf.setSelected(isSelected);
- this.jCheckBoxEbc.setSelected(isSelected);
- this.jCheckBoxArm.setSelected(isSelected);
- this.jCheckBoxPpc.setSelected(isSelected);
- }
-
- private void setSelectedItems(Vector<String> v) {
- setAllItemsSelected(false);
- boolean isIA32Selected = false;
- if (v != null) {
- for (int index = 0; index < v.size(); index++) {
- if (v.get(index).equals(this.jCheckBoxIa32.getText())) {
- this.jCheckBoxIa32.setSelected(true);
- isIA32Selected = true;
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxIpf.getText())) {
- this.jCheckBoxIpf.setSelected(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxX64.getText())) {
- this.jCheckBoxX64.setSelected(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxEbc.getText())) {
- this.jCheckBoxEbc.setSelected(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxArm.getText())) {
- this.jCheckBoxArm.setSelected(true);
- continue;
- }
- if (v.get(index).equals(this.jCheckBoxPpc.getText())) {
- this.jCheckBoxPpc.setSelected(true);
- continue;
- }
- }
- if (!isIA32Selected) {
- this.jCheckBoxIa32.setSelected(false);
- }
- }
- }
-
- /**
- * This method initializes jCheckBoxPcd
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxPcd() {
- if (jCheckBoxPcd == null) {
- jCheckBoxPcd = new JCheckBox();
- jCheckBoxPcd.setBounds(new java.awt.Rectangle(labelCol, 530, labelWidth, 20));
- jCheckBoxPcd.setText("Is this a PCD Driver?");
- jCheckBoxPcd.addFocusListener(this);
- jCheckBoxPcd.addActionListener(this);
- jCheckBoxPcd.setEnabled(false);
- }
- return jCheckBoxPcd;
- }
-
- /**
- * This method initializes jCheckBoxFlashMap
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxFlashMap() {
- if (jCheckBoxFlashMap == null) {
- jCheckBoxFlashMap = new JCheckBox();
- jCheckBoxFlashMap.setBounds(new java.awt.Rectangle(labelCol, 555, 480, 20));
- jCheckBoxFlashMap.setText("Does this module require a legacy FlashMap header file?");
- }
- return jCheckBoxFlashMap;
- }
-
- /**
- * This method initializes jRadioButtonBinaryModuleTrue
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonBinaryModuleTrue() {
- if (jRadioButtonBinaryModuleTrue == null) {
- jRadioButtonBinaryModuleTrue = new JRadioButton();
- jRadioButtonBinaryModuleTrue.setBounds(new java.awt.Rectangle(valueCol, 480, 140, 20));
- jRadioButtonBinaryModuleTrue.setText("True");
- jRadioButtonBinaryModuleTrue.setSelected(true);
- jRadioButtonBinaryModuleTrue.addFocusListener(this);
- jRadioButtonBinaryModuleTrue
- .setToolTipText("<html>Modules are either source modules which can be compiled or binary <br>"
- + "modules which are linked. A module cannot contain both. <br>"
- + "The GUID numbers should be identical for a binary and source MSA, <br>"
- + "however the BINARY MSA should have a higher version number.</html>");
- }
- return jRadioButtonBinaryModuleTrue;
- }
-
- /**
- * This method initializes jRadioButtonBinaryModuleFalse
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonBinaryModuleFalse() {
- if (jRadioButtonBinaryModuleFalse == null) {
- jRadioButtonBinaryModuleFalse = new JRadioButton();
- jRadioButtonBinaryModuleFalse.setBounds(new java.awt.Rectangle(valueCol + 140, 480, 140, 20));
- jRadioButtonBinaryModuleFalse.setText("False");
- jRadioButtonBinaryModuleFalse.addFocusListener(this);
- jRadioButtonBinaryModuleFalse
- .setToolTipText("<html>Modules are either source modules which can be compiled or binary <br>"
- + "modules which are linked. A module cannot contain both. <br>"
- + "The GUID numbers should be identical for a binary and source MSA, <br>"
- + "however the BINARY MSA should have a higher version number.</html>");
- }
- return jRadioButtonBinaryModuleFalse;
- }
-
- public void itemStateChanged(ItemEvent arg0) {
- //
- // Check Supported Arch
- //
- if (arg0.getSource() == this.jCheckBoxIa32 || arg0.getSource() == this.jCheckBoxIpf
- || arg0.getSource() == this.jCheckBoxX64 || arg0.getSource() == this.jCheckBoxEbc
- || arg0.getSource() == this.jCheckBoxArm || arg0.getSource() == this.jCheckBoxPpc) {
- if (!this.jCheckBoxIa32.isSelected() && !this.jCheckBoxX64.isSelected() && !this.jCheckBoxIpf.isSelected()
- && !this.jCheckBoxEbc.isSelected() && !this.jCheckBoxPpc.isSelected()
- && !this.jCheckBoxArm.isSelected()) {
- Log
- .wrn("At lease one Supportted Architecture should be selected! IA32 is selected as default value!");
- this.jCheckBoxIa32.setSelected(true);
- }
-
- if (!this.getSelectedItemsString().equals(md.getSupportedArchitectures().toString())) {
- md.setSupportedArchitectures(this.getSelectedItemsVector());
- this.save();
- }
- }
-
- if (arg0.getSource() == this.jComboBoxModuleType) {
- if (this.jComboBoxModuleType.getSelectedItem().equals("PEIM")
- || this.jComboBoxModuleType.getSelectedItem().equals("DXE_DRIVER")) {
- this.jCheckBoxPcd.setEnabled(true);
- if (this.jCheckBoxPcd.isSelected()) {
- this.jCheckBoxPcd.setSelected(false);
- this.jCheckBoxPcd.setSelected(true);
- }
- } else {
- this.jCheckBoxPcd.setEnabled(false);
- this.jCheckBoxPcd.setSelected(false);
- }
- if (!jComboBoxModuleType.getSelectedItem().toString().equals(msaHeader.getModuleType().toString())) {
- msaHeader.setModuleType(ModuleTypeDef.Enum.forString(jComboBoxModuleType.getSelectedItem().toString()));
- this.save();
- }
- }
-
- //
- // Check Pcd is Driver
- //
- if (arg0.getSource() == this.jCheckBoxPcd) {
- if (this.jCheckBoxPcd.isSelected()) {
- if (this.jComboBoxModuleType.getSelectedItem().toString().equals("DXE_DRIVER")) {
- this.jComboBoxPcdIsDriver.setText("DXE_PCD_DRIVER");
- this.jComboBoxPcdIsDriver.setEnabled(true);
- } else if (this.jComboBoxModuleType.getSelectedItem().toString().equals("PEIM")) {
- this.jComboBoxPcdIsDriver.setText("PEI_PCD_DRIVER");
- this.jComboBoxPcdIsDriver.setEnabled(true);
- }
- }
-
- if ((this.ex == null) && this.jCheckBoxPcd.isSelected()) {
- this.ex = ExternsDocument.Externs.Factory.newInstance();
- this.ex.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getText()));
- this.msa.setExterns(this.ex);
- } else if ((this.ex != null) && (this.ex.getPcdIsDriver() == null) && this.jCheckBoxPcd.isSelected()) {
- this.ex.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getText()));
- this.msa.setExterns(this.ex);
- } else if ((this.ex != null) && (this.ex.getPcdIsDriver() != null)) {
- if (this.jCheckBoxPcd.isSelected()
- && !this.jComboBoxPcdIsDriver.getText().toString().equals(this.ex.getPcdIsDriver().toString())) {
- this.ex.setPcdIsDriver(PcdDriverTypes.Enum.forString(this.jComboBoxPcdIsDriver.getText()));
- this.msa.setExterns(this.ex);
- }
- if (!this.jCheckBoxPcd.isSelected()) {
- ExternsDocument.Externs newEx = ExternsDocument.Externs.Factory.newInstance();
- if (this.ex.getExternList() != null) {
- for (int index = 0; index < this.ex.getExternList().size(); index++) {
- newEx.addNewExtern();
- newEx.setExternArray(index, this.ex.getExternArray(index));
- }
- }
- if (this.ex.getSpecificationList() != null) {
- for (int index = 0; index < this.ex.getSpecificationList().size(); index++) {
- newEx.addNewSpecification();
- newEx.setSpecificationArray(index, this.ex.getSpecificationArray(index));
- }
- }
- if (this.ex.getTianoR8FlashMapH()) {
- newEx.setTianoR8FlashMapH(this.ex.getTianoR8FlashMapH());
- }
- this.ex = newEx;
- this.msa.setExterns(this.ex);
- }
- }
- this.save();
- }
- //
- // Check Flash Map
- //
- if (arg0.getSource() == this.jCheckBoxFlashMap) {
- if ((this.ex == null) && this.jCheckBoxFlashMap.isSelected()) {
- this.ex = ExternsDocument.Externs.Factory.newInstance();
- this.ex.setTianoR8FlashMapH(this.jCheckBoxFlashMap.isSelected());
- this.msa.setExterns(this.ex);
- } else if ((this.ex != null) && this.jCheckBoxFlashMap.isSelected()) {
- this.ex.setTianoR8FlashMapH(this.jCheckBoxFlashMap.isSelected());
- this.msa.setExterns(this.ex);
- } else if ((this.ex != null) && !this.jCheckBoxFlashMap.isSelected()) {
- ExternsDocument.Externs newEx = ExternsDocument.Externs.Factory.newInstance();
- if (this.ex.getExternList() != null) {
- for (int index = 0; index < this.ex.getExternList().size(); index++) {
- newEx.addNewExtern();
- newEx.setExternArray(index, this.ex.getExternArray(index));
- }
- }
- if (this.ex.getSpecificationList() != null) {
- for (int index = 0; index < this.ex.getSpecificationList().size(); index++) {
- newEx.addNewSpecification();
- newEx.setSpecificationArray(index, this.ex.getSpecificationArray(index));
- }
- }
- if (this.ex.getPcdIsDriver() != null) {
- newEx.setPcdIsDriver(this.ex.getPcdIsDriver());
- }
- this.ex = newEx;
- this.msa.setExterns(this.ex);
- }
- this.save();
- }
- }
-
- private void addListeners() {
- this.jTextFieldBaseName.getDocument().addDocumentListener(this);
- this.jTextFieldGuid.getDocument().addDocumentListener(this);
- this.jTextFieldAbstract.getDocument().addDocumentListener(this);
- this.jTextAreaCopyright.getDocument().addDocumentListener(this);
- this.jTextAreaDescription.getDocument().addDocumentListener(this);
- this.jTextAreaLicense.getDocument().addDocumentListener(this);
- this.jTextFieldOutputFileBasename.getDocument().addDocumentListener(this);
- this.jTextFieldSpecification.getDocument().addDocumentListener(this);
- this.jTextFieldURL.getDocument().addDocumentListener(this);
- this.jTextFieldVersion.getDocument().addDocumentListener(this);
-
- this.jComboBoxModuleType.addItemListener(this);
-
- this.jCheckBoxIa32.addItemListener(this);
- this.jCheckBoxX64.addItemListener(this);
- this.jCheckBoxIpf.addItemListener(this);
- this.jCheckBoxEbc.addItemListener(this);
- this.jCheckBoxArm.addItemListener(this);
- this.jCheckBoxPpc.addItemListener(this);
-
- this.jCheckBoxPcd.addItemListener(this);
-
- this.jCheckBoxFlashMap.addItemListener(this);
- }
-
- public void insertUpdate(DocumentEvent e) {
- this.omt.setSaved(false);
- }
-
- public void removeUpdate(DocumentEvent e) {
- this.omt.setSaved(false);
- }
-
- public void changedUpdate(DocumentEvent e) {
- // Do nothing
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BootModesDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BootModesDlg.java deleted file mode 100644 index 5b5f49dc59..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BootModesDlg.java +++ /dev/null @@ -1,445 +0,0 @@ -/** @file
- <<The file is used to create, update BootModes of MSA file>>
-
- <<The BootModesDlg is called to add or edit a Module's Boot Modes definitions.>>
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Package Name: Tools
- Module Name: FrameworkWizard
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-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.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.BootModes.BootModesIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update BootModes of MSA/MBD file
- *
- * It extends IDialog
- *
- */
-public class BootModesDlg extends IDialog {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -3888558623432442561L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelBootModeName = null;
-
- private JComboBox jComboBoxBootModeName = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not used by UI
- //
- private BootModesIdentification id = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- /**
- * This method initializes jComboBoxBootModeName
- *
- * @return javax.swing.JComboBox jComboBoxBootModeName
- *
- */
- private JComboBox getJComboBoxBootModeName() {
- if (jComboBoxBootModeName == null) {
- jComboBoxBootModeName = new JComboBox();
- jComboBoxBootModeName.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- jComboBoxBootModeName.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxBootModeName
- .setToolTipText("<html><table>"
- + "<tr><td>FULL</td><td>Boot with full configuration</td></tr>"
- + "<tr><td>MINIMAL</td><td>Boot with minimal configuration</td></tr>"
- + "<tr><td>NO_CHANGE</td><td>Boot assuming no configuration changes</td></tr>"
- + "<tr><td>DIAGNOSTICS</td><td>Boot with full configuration plus diagnostics</td></tr>"
- + "<tr><td>DEFAULT</td><td>Boot with default settings</td></tr>"
- + "<tr><td>BOOT_ON_S#_RESUME</td><td>where # is 2, 3, 4 or 5</td></tr>"
- + "<tr><td>FLASH_UPDATE</td><td>Boot on flash update</td></tr>"
- + "<tr><td>RECOVERY</td><td>Boot in recovery mode</td></tr>"
- + "</table></html>");
- }
- 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(168, 37, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table>"
- + "<tr><td>ALWAYS_CONSUMED</td><td>Indicates Supports the specified boot mode</td></tr>"
- + "<tr><td>SOMETIMES_CONSUMED</td><td>Indicates Supports the specified boot mode on some execution paths</td></tr>"
- + "<tr><td>ALWAYS_PRODUCED</td><td>Always changes the boot mode</td></tr>"
- + "<tr><td>SOMETIMES_PRODUCED</td><td>Change the boot mode sometimes</td></tr>"
- + "</table></html>");
- }
- 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(168, 132, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * 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 jTextAreaHelpText
- *
- * @return javax.swing.JTextArea
- *
- */
- private JTextArea getJTextAreaHelpText() {
- if (jTextAreaHelpText == null) {
- jTextAreaHelpText = new JTextArea();
- jTextAreaHelpText.setLineWrap(true);
- jTextAreaHelpText.setWrapStyleWord(true);
- }
- 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(168, 62));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- 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, 162, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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, 162, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 235);
- 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, ModuleIdentification mid) {
- init();
- this.id = inBootModesId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- 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, ModuleIdentification mid) {
- super(iFrame, true);
- init(inBootModesIdentification, mid);
- }
-
- /**
- * 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 method initializes jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 12));
- jLabelBootModeName = new JLabel();
- jLabelBootModeName.setText("Boot Mode Name");
- jLabelBootModeName.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
- jLabelHelpText.setText("Help Text");
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 132, 155, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 107, 155, 20));
- jLabelArch.setText("Supported Archectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 107, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(480, 180));
-
- 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;
- }
-
- /**
- * This method initializes BootModeName groups and Usage type
- *
- */
- private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxBootModeName, ed.getVBootModeNames());
- Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVBootModeUsage());
- }
-
- /*
- * (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<String> 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;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BuildOptionsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BuildOptionsDlg.java deleted file mode 100644 index a4bad7e40a..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/BuildOptionsDlg.java +++ /dev/null @@ -1,495 +0,0 @@ -/** @file
-
- The file is used to create, update SourceFiles section of the MSA file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-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;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.BuildOptions.BuildOptionsIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update SourceFiles section of the MSA file
- *
- * It extends IDialog
- *
- **/
-public class BuildOptionsDlg extends IDialog {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -6765742852142775378L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelFileName = null;
-
- private JTextField jTextFieldFileOption = null;
-
- private JLabel jLabelToolChainFamily = null;
-
- private StarLabel jStarLabel1 = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelTagName = null;
-
- private JTextField jTextFieldTagName = null;
-
- private JLabel jLabelToolCode = null;
-
- private JTextField jTextFieldToolCode = null;
-
- private IComboBox iComboBoxToolCode = null;
-
- private JTextField jTextFieldToolChainFamily = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private JScrollPane jScrollPaneBuildTargets = null;
-
- private ICheckBoxList iCheckBoxListBuildTargets = null;
-
- //
- // Not used by UI
- //
- private BuildOptionsIdentification id = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private JLabel jLabelBuildTargets = null;
-
- /**
- This method initializes jTextFieldFileOption
-
- @return javax.swing.JTextField jTextFieldFileOption
-
- **/
- private JTextField getJTextFieldSourceFilesDirectory() {
- if (jTextFieldFileOption == null) {
- jTextFieldFileOption = new JTextField();
- jTextFieldFileOption.setBounds(new java.awt.Rectangle(168, 12, 340, 20));
- jTextFieldFileOption.setPreferredSize(new java.awt.Dimension(340, 20));
- jTextFieldFileOption.setToolTipText("Path is relative to the MSA file and must include the file name");
- }
- return jTextFieldFileOption;
- }
-
- /**
- 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 jTextFieldTagName
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldTagName() {
- if (jTextFieldTagName == null) {
- jTextFieldTagName = new JTextField();
- jTextFieldTagName.setBounds(new java.awt.Rectangle(168, 37, 340, 20));
- jTextFieldTagName.setPreferredSize(new java.awt.Dimension(340, 20));
- jTextFieldTagName.setToolTipText("You may specify a specific tool chain tag name, such as BILL1");
- }
- return jTextFieldTagName;
- }
-
- private IComboBox getIComboBoxToolCode() {
- if (iComboBoxToolCode == null) {
- iComboBoxToolCode = new IComboBox();
- iComboBoxToolCode.setBounds(new java.awt.Rectangle(168, 62, 340, 20));
- iComboBoxToolCode.setPreferredSize(new java.awt.Dimension(340, 20));
- iComboBoxToolCode.setToolTipText("<html>You may select a specific tool command from drop down list,<br>"
- + "or you can DOUBLE-CLICK this field to enter your customized<br>"
- + "tool command.<br>"
- + "Press ENTER to save your input or press ESCAPE to quit</html>");
- }
- return iComboBoxToolCode;
- }
-
- /**
- * This method initializes jTextFieldToolCode
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldToolCode() {
- if (jTextFieldToolCode == null) {
- jTextFieldToolCode = new JTextField();
- jTextFieldToolCode.setBounds(new java.awt.Rectangle(168, 62, 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;
- }
-
- /**
- * This method initializes jTextFieldToolChainFamily
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldToolChainFamily() {
- if (jTextFieldToolChainFamily == null) {
- jTextFieldToolChainFamily = new JTextField();
- jTextFieldToolChainFamily.setBounds(new java.awt.Rectangle(168, 87, 340, 20));
- jTextFieldToolChainFamily.setPreferredSize(new java.awt.Dimension(340, 20));
- jTextFieldToolChainFamily.setToolTipText("You may specify a specific tool chain family, such as GCC");
- }
- return jTextFieldToolChainFamily;
- }
-
- /**
- This method initializes jButtonOk
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(317, 202, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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(412, 202, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes iCheckBoxListArch
-
- @return ICheckBoxList
- **/
- private ICheckBoxList getICheckBoxListSupModuleList() {
- if (iCheckBoxListBuildTargets == null) {
- iCheckBoxListBuildTargets = new ICheckBoxList();
- }
- return iCheckBoxListBuildTargets;
- }
-
- /**
- This method initializes jScrollPaneBuildTargets
-
- @return javax.swing.JScrollPane
-
- **/
- private JScrollPane getJScrollPaneBuildTargets() {
- if (jScrollPaneBuildTargets == null) {
- jScrollPaneBuildTargets = new JScrollPane();
- jScrollPaneBuildTargets.setBounds(new java.awt.Rectangle(168, 137, 340, 40));
- jScrollPaneBuildTargets.setPreferredSize(new java.awt.Dimension(340, 40));
- jScrollPaneBuildTargets.setViewportView(getICheckBoxListSupModuleList());
- }
- return jScrollPaneBuildTargets;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This is the default constructor
-
- **/
- public BuildOptionsDlg(BuildOptionsIdentification inBuildOptionsIdentification, IFrame iFrame,
- ModuleIdentification mid) {
- super(iFrame, true);
- init(inBuildOptionsIdentification, mid);
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(525, 270);
- this.setContentPane(getJScrollPane());
- this.setTitle("Source Files");
- this.setViewMode(false);
- this.centerWindow();
- Tools.generateComboBoxByVector(iComboBoxToolCode, ed.getVToolCode());
- this.iCheckBoxListBuildTargets.setAllItems(ed.getVBuildTargets());
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
-
- @param inSourceFiles The input data of SourceFilesDocument.SourceFiles
-
- **/
- private void init(BuildOptionsIdentification inBuildOptionsIdentification, ModuleIdentification mid) {
- init();
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- if (inBuildOptionsIdentification != null) {
- this.jTextFieldFileOption.setText(inBuildOptionsIdentification.getOption());
- this.jTextFieldTagName.setText(inBuildOptionsIdentification.getTagName());
-
- //
- // Generate Tool Code selection list
- //
- Vector<String> v = ed.getVToolCode();
- boolean isFind = false;
- String strToolCode = inBuildOptionsIdentification.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(inBuildOptionsIdentification.getToolChainFamily());
-
- this.jArchCheckBox.setSelectedItems(inBuildOptionsIdentification.getSupArchList());
-
- this.iCheckBoxListBuildTargets.setAllItemsUnchecked();
- this.iCheckBoxListBuildTargets.initCheckedItem(true, inBuildOptionsIdentification.getBuildTargets());
- }
- }
-
- /**
- 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.jTextFieldFileOption.setEnabled(!isView);
- }
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelBuildTargets = new JLabel();
- jLabelBuildTargets.setBounds(new java.awt.Rectangle(12, 137, 155, 20));
- jLabelBuildTargets.setText("Build Targets");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 112, 340, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(340, 20));
- jLabelToolCode = new JLabel();
- jLabelToolCode.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
- jLabelToolCode.setText("Tool Code");
- jLabelTagName = new JLabel();
- jLabelTagName.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
- jLabelTagName.setText("Tag Name");
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 112, 155, 20));
- jLabelArch.setText("Supported Architectures");
- jLabelToolChainFamily = new JLabel();
- jLabelToolChainFamily.setBounds(new java.awt.Rectangle(12, 87, 155, 20));
- jLabelToolChainFamily.setText("Tool Chain Family");
- jLabelFileName = new JLabel();
- jLabelFileName.setText("Option String");
- jLabelFileName.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(505, 222));
-
- jContentPane.add(jLabelFileName, null);
- jContentPane.add(getJTextFieldSourceFilesDirectory(), null);
- jContentPane.add(jLabelToolChainFamily, null);
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, 10));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jLabelArch, null);
- jContentPane.add(jLabelTagName, null);
- jContentPane.add(getJTextFieldTagName(), null);
- jContentPane.add(jLabelToolCode, null);
- jContentPane.add(getJTextFieldToolCode(), null);
- jContentPane.add(getIComboBoxToolCode(), null);
- jContentPane.add(getJTextFieldToolChainFamily(), null);
- jContentPane.add(jArchCheckBox, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(jLabelBuildTargets, null);
- jContentPane.add(getJScrollPaneBuildTargets(), null);
- }
- 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()) {
- getCurrentId();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- private BuildOptionsIdentification getCurrentId() {
- String arg0 = this.jTextFieldFileOption.getText();
- Vector<String> arg1 = this.iCheckBoxListBuildTargets.getAllCheckedItemsString();
- String arg2 = this.jTextFieldToolChainFamily.getText();
- String arg3 = this.jTextFieldTagName.getText();
- String arg4 = this.iComboBoxToolCode.getSelectedItem().toString();
- if (arg4.equals(DataType.EMPTY_SELECT_ITEM)) {
- arg4 = "";
- }
- Vector<String> arg5 = this.jArchCheckBox.getSelectedItemsVector();
-
- id = new BuildOptionsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
- return id;
- }
-
- /**
- Data validation for all fields
-
- @retval true - All datas are valid
- @retval false - At least one data is invalid
-
- **/
- public boolean checkAdd() {
- //
- // Check Option
- //
- if (isEmpty(this.jTextFieldFileOption.getText())) {
- Log.wrn("Update Build Options", "Option String must be entered!");
- return false;
- }
-
- //
- // Check TagName
- //
- if (!isEmpty(this.jTextFieldTagName.getText())) {
- if (!DataValidation.isTagName(this.jTextFieldTagName.getText())) {
- Log.wrn("Update Build Options", "Incorrect data type for Tag Name");
- return false;
- }
- }
-
- //
- // Check ToolCode
- //
- if (!isEmpty(this.jTextFieldToolCode.getText())) {
- if (!DataValidation.isToolCode(this.jTextFieldToolCode.getText())) {
- Log.wrn("Update Build Options", "Incorrect data type for Tool Code");
- return false;
- }
- }
-
- //
- // Check ToolChainFamily
- //
- if (!isEmpty(this.jTextFieldToolChainFamily.getText())) {
- if (!DataValidation.isToolChainFamily(this.jTextFieldToolChainFamily.getText())) {
- Log.wrn("Update Build Options", "Incorrect data type for Tool Chain Family");
- return false;
- }
- }
-
- return true;
- }
-
- public BuildOptionsIdentification getId() {
- return id;
- }
-
- public void setId(BuildOptionsIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/DataHubsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/DataHubsDlg.java deleted file mode 100644 index a3c6c63838..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/DataHubsDlg.java +++ /dev/null @@ -1,452 +0,0 @@ -/** @file
- <<The file is used to create, update Data Hub Record entries in a MSA file.>>
-
- <<The DataHbsDlg is a dialog called to add or edit a Data Hub Record within a MSA file.>>
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Package Name: Tools
- Module Name: FrameworkWizard
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-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.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.DataHubs.DataHubsIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update DataHub of the MSA file
- *
- * It extends IDialog
- *
- */
-public class DataHubsDlg extends IDialog {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -3667906991966638892L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private JLabel jLabelDataHubRecord = null;
-
- private JTextField jTextFieldDataHubRecord = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not used by UI
- //
- private DataHubsIdentification id = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- /**
- * This method initializes jTextFieldDataHubRecord
- *
- * @return javax.swing.JTextField jTextFieldDataHubRecord
- *
- */
- private JTextField getJTextFieldDataHubRecord() {
- if (jTextFieldDataHubRecord == null) {
- jTextFieldDataHubRecord = new JTextField();
- jTextFieldDataHubRecord.setBounds(new java.awt.Rectangle(168, 12, 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 jComboBoxUsage
- *
- * @return javax.swing.JComboBox jComboBoxUsage
- *
- */
- private JComboBox getJComboBoxUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table>"
- + "<tr><td>ALWAYS_CONSUMED</td><td>Module always consumes a Data Hub Entry<br>via registering a filter driver.</td></tr>"
- + "<tr><td>SOMETIMES_CONSUMED</td><td>Module will use a Data Hub Entry if it exists<br>via registering a filter driver</td></tr>"
- + "<tr><td>ALWAYS_PRODUCED</td><td>Always logs data into the Data Hub</td></tr>"
- + "<tr><td>SOMETIMES_PRODUCED</td><td>Log data into the Data Hub under<br>certain circumstances</td></tr>"
- + "</table></html>");
- }
- 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(168, 132, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * 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 jTextAreaHelpText
- *
- * @return javax.swing.JTextArea
- *
- */
- private JTextArea getJTextAreaHelpText() {
- if (jTextAreaHelpText == null) {
- jTextAreaHelpText = new JTextArea();
- jTextAreaHelpText.setLineWrap(true);
- jTextAreaHelpText.setWrapStyleWord(true);
- }
- 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(168, 62));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- 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, 162, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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, 162, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 235);
- 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, ModuleIdentification mid) {
- init();
- this.id = inDataHubsId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- 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 is the override edit constructor
- *
- * @param inDataHubsIdentification
- * @param iFrame
- *
- */
- public DataHubsDlg(DataHubsIdentification inDataHubsIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inDataHubsIdentification, mid);
- }
-
- /**
- * 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 jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 12));
- jLabelDataHubRecord = new JLabel();
- jLabelDataHubRecord.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
- jLabelDataHubRecord.setText("Data Hub Record");
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
- jLabelHelpText.setText("Help Text");
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 132, 155, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 107, 155, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 107, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(480, 180));
-
- 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;
- }
-
- /**
- * 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);
- }
- }
-
- 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 DataHubRecord
- //
- if (isEmpty(this.jTextFieldDataHubRecord.getText())) {
- Log.wrn("Update Hubs", "Data Hub Record must be entered!");
- 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;
- }
-
- private DataHubsIdentification getCurrentDataHubs() {
- String arg0 = this.jTextFieldDataHubRecord.getText();
- String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg2 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();
- String arg4 = this.jTextAreaHelpText.getText();
-
- id = new DataHubsIdentification(arg0, arg1, arg2, arg3, arg4);
- return id;
- }
-
- public DataHubsIdentification getId() {
- return id;
- }
-
- public void setId(DataHubsIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/EventsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/EventsDlg.java deleted file mode 100644 index 10e3a174ca..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/EventsDlg.java +++ /dev/null @@ -1,546 +0,0 @@ -/** @file
-
- The file is used to create, update Events section of the MSA file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-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;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Events.EventsIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Events section of the MSA file
- * It extends IDialog
- *
- * @since ModuleEditor 1.0
- *
- */
-public class EventsDlg extends IDialog {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -4396143706422842331L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelEventType = null;
-
- private JLabel jLabelC_Name = null;
-
- private IComboBox iComboBoxGuidC_Name = null;
-
- private JLabel jLabelUsage = null;
-
- private JLabel jLabelGroup = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private JComboBox jComboBoxEventGroup = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private StarLabel jStarLabel4 = null;
-
- private JComboBox jComboBoxEventsType = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelArch = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = 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(168, 12, 320, 20));
- jComboBoxEventsType.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxEventsType
- .setToolTipText("<html>Select CreateEvents if the Module has an event that is waiting to be signaled.<br>"
- + "Select SignalEvents if the Module will signal all events in an event group.<br>"
- + "NOTE: Signal events are named by GUID.</html>");
- }
- return jComboBoxEventsType;
- }
-
- /**
- * This method initializes jTextFieldC_Name
- *
- * @return javax.swing.JTextField jTextFieldC_Name
- *
- */
- private IComboBox getIComboBoxGuidC_Name() {
- if (iComboBoxGuidC_Name == null) {
- iComboBoxGuidC_Name = new IComboBox();
- iComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- iComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));
- iComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Event");
- }
- return iComboBoxGuidC_Name;
- }
-
- /**
- * This method initializes jComboBoxEventsType
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxEventGroup() {
- if (jComboBoxEventGroup == null) {
- jComboBoxEventGroup = new JComboBox();
- jComboBoxEventGroup.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
- jComboBoxEventGroup.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxEventGroup.setToolTipText("Select Type of Event: Guid or Timer.");
-
- }
- 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(168, 87, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table>"
- + "<tr><td colspan=2 align=center><b>Create Events</b></td></tr>"
- + "<tr><td>ALWAYS_CONSUMED</td><td>Module registers a notification function and REQUIRES that it be<br>"
- + "executed for the module to fully function.</td></tr>"
- + "<tr><td>SOMETIMES_CONSUMED</td><td>Module registers a notification function and calls the function<br>"
- + "when it is signaled</td></tr><tr><td colspan=2 align=center><b>Signal Events</b></td></tr>"
- + "<tr><td>ALWAYS_PRODUCED</td><td>Module will Always signal the event</td></tr>"
- + "<tr><td>SOMETIMES_PRODUCED</td><td>Module will sometimes signal the event</td></tr>"
- + "</table></html>");
- }
- return jComboBoxUsage;
- }
-
- /**
- * 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
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 182, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * 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;
- }
-
- /**
- * 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(168, 112));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- 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, 212, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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, 212, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 280);
- 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, ModuleIdentification mid) {
- init();
- this.id = inEventsId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- //
- // Get defined guids from dependent packages
- //
- Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
- if (vpid.size() <= 0) {
- Log
- .wrn("Init Guid",
- "This module hasn't defined any package dependency, so there is no guid value can be added for event");
- }
- //
- // Init guids drop down list
- //
- Tools
- .generateComboBoxByVector(iComboBoxGuidC_Name,
- wt.getAllGuidDeclarationsFromPackages(vpid, EnumerationData.GUID_TYPE_EFI_EVENT));
-
- this.iComboBoxGuidC_Name.insertItemAt(DataType.EMPTY_SELECT_ITEM, 0);
- this.iComboBoxGuidC_Name.setSelectedIndex(0);
-
- if (this.id != null) {
- String tmpName = id.getName();
- if (isEmpty(tmpName)) {
- tmpName = DataType.EMPTY_SELECT_ITEM;
- }
-
- this.iComboBoxGuidC_Name.setSelectedItem(tmpName);
- 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, ModuleIdentification mid) {
- super(iFrame, true);
- init(inEventsIdentification, mid);
- }
-
- /**
- * 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.iComboBoxGuidC_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, 12));
- jLabelEventType = new JLabel();
- jLabelEventType.setText("Select Event Type");
- jLabelEventType.setBounds(new java.awt.Rectangle(12, 12, 168, 20));
-
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelC_Name = new JLabel();
- jLabelC_Name.setText("Guid C Name");
- jLabelC_Name.setBounds(new java.awt.Rectangle(12, 37, 168, 20));
-
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(2, 62));
- jLabelGroup = new JLabel();
- jLabelGroup.setText("Event Group Type");
- jLabelGroup.setBounds(new java.awt.Rectangle(12, 62, 168, 20));
-
- jStarLabel4 = new StarLabel();
- jStarLabel4.setLocation(new java.awt.Point(2, 87));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 87, 168, 20));
-
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 112, 168, 20));
- jLabelHelpText.setText("Help Text");
-
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 182, 168, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
-
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 157, 168, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 157, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(485, 235));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jLabelEventType, null);
- jContentPane.add(getJComboBoxEventsType(), null);
- //jContentPane.add(jStarLabel2, null);
- jContentPane.add(jLabelC_Name, null);
- jContentPane.add(getIComboBoxGuidC_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;
- }
-
- /**
- * 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());
- }
-
- /*
- * (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
- //
- String tmpName = this.iComboBoxGuidC_Name.getSelectedItem().toString();
- if (!tmpName.equals(DataType.EMPTY_SELECT_ITEM) && isEmpty(tmpName)) {
- if (!DataValidation.isC_NameType(this.iComboBoxGuidC_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;
- }
-
- private EventsIdentification getCurrentEvents() {
- String arg0 = this.iComboBoxGuidC_Name.getSelectedItem().toString();
- String arg1 = this.jComboBoxEventsType.getSelectedItem().toString();
- String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg3 = this.jTextFieldFeatureFlag.getText();
- Vector<String> 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;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ExternsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ExternsDlg.java deleted file mode 100644 index 3aa9b4a297..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ExternsDlg.java +++ /dev/null @@ -1,948 +0,0 @@ -/** @file
-
- The file is used to create, update Externs section of the MSA file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-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.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Externs.ExternsIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Externs section of the MSA file
- *
- * It extends IDialog
- *
- */
-public class ExternsDlg extends IDialog implements ItemListener {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -7382008402932047191L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelName = null;
-
- private JComboBox jComboBoxType = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelSpecification = null;
-
- private JTextField jTextFieldSpecification = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JLabel jLabelArch = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private StarLabel jStarLabel1 = null;
-
- private JPanel jPanelSpecification = null;
-
- private JPanel jPanelImage = null;
-
- private JPanel jPanelDriver = null;
-
- private JPanel jPanelLibrary = null;
-
- private JPanel jPanelCallBack = null;
-
- private JLabel jLabelModuleEntryPoint = null;
-
- private JTextField jTextFieldModuleEntryPoint = null;
-
- private JLabel jLabelModuleUnloadImage = null;
-
- private JTextField jTextFieldModuleUnloadImage = null;
-
- private JLabel jLabelDriverBinding = null;
-
- private JTextField jTextFieldDriverBinding = null;
-
- private JLabel jLabelComponentName = null;
-
- private JTextField jTextFieldComponentName = null;
-
- private JLabel jLabelDriverConfig = null;
-
- private JTextField jTextFieldDriverConfig = null;
-
- private JLabel jLabelDriverDiagnostic = null;
-
- private JTextField jTextFieldDriverDiagnostic = null;
-
- private JLabel jLabelConstructor = null;
-
- private JTextField jTextFieldConstructor = null;
-
- private JLabel jLabelDestructor = null;
-
- private JTextField jTextFieldDestructor = null;
-
- private JLabel jLabelVirtualAddressMap = null;
-
- private JTextField jTextFieldVirtualAddressMap = null;
-
- private JLabel jLabelExitBootServices = null;
-
- private JTextField jTextFieldExitBootServices = null;
-
- //
- // Not used by UI
- //
- private ExternsIdentification id = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private Vector<String> vArchList = new Vector<String>();
-
- /**
- This method initializes jComboBoxType
-
- @return javax.swing.JComboBox jComboBoxType
-
- **/
- private JComboBox getJComboBoxType() {
- if (jComboBoxType == null) {
- jComboBoxType = new JComboBox();
- jComboBoxType.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- jComboBoxType.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxType.addItemListener(this);
- }
- return jComboBoxType;
- }
-
- /**
- 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 jTextFieldC_Name
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldSpecification() {
- if (jTextFieldSpecification == null) {
- jTextFieldSpecification = new JTextField();
- jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldSpecification.setBounds(new java.awt.Rectangle(168, 0, 320, 20));
- }
- return jTextFieldSpecification;
- }
-
- /**
- This method initializes jTextFieldFeatureFlag
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 87, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setEnabled(false);
- }
- 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(300, 187, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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(400, 187, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jPanelSpecification
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelSpecification() {
- if (jPanelSpecification == null) {
- jPanelSpecification = new JPanel();
- jPanelSpecification.setBounds(new java.awt.Rectangle(0, 37, 505, 20));
- jPanelSpecification.setLayout(null);
-
- jLabelSpecification = new JLabel();
- jLabelSpecification.setBounds(new java.awt.Rectangle(12, 0, 140, 20));
- jLabelSpecification.setText("Specification Name");
-
- jPanelSpecification.add(jLabelSpecification, null);
- jPanelSpecification.add(getJTextFieldSpecification(), null);
- }
- return jPanelSpecification;
- }
-
- /**
- * This method initializes jPanelImage
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelImage() {
- if (jPanelImage == null) {
- jLabelModuleUnloadImage = new JLabel();
- jLabelModuleUnloadImage.setBounds(new java.awt.Rectangle(12, 25, 140, 20));
- jLabelModuleUnloadImage.setText("Module Unload Image");
- jLabelModuleEntryPoint = new JLabel();
- jLabelModuleEntryPoint.setBounds(new java.awt.Rectangle(12, 0, 140, 20));
- jLabelModuleEntryPoint.setText("Module Entry Point");
- jPanelImage = new JPanel();
- jPanelImage.setBounds(new java.awt.Rectangle(0, 37, 505, 45));
- jPanelImage.setLayout(null);
- jPanelImage.add(jLabelModuleEntryPoint, null);
- jPanelImage.add(getJTextFieldModuleEntryPoint(), null);
- jPanelImage.add(jLabelModuleUnloadImage, null);
- jPanelImage.add(getJTextFieldModuleUnloadImage(), null);
- }
- return jPanelImage;
- }
-
- /**
- * This method initializes jPanelDriver
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelDriver() {
- if (jPanelDriver == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, 0));
- jLabelDriverDiagnostic = new JLabel();
- jLabelDriverDiagnostic.setBounds(new java.awt.Rectangle(12, 75, 140, 20));
- jLabelDriverDiagnostic.setText("Driver Diagnostic");
- jLabelDriverConfig = new JLabel();
- jLabelDriverConfig.setBounds(new java.awt.Rectangle(12, 50, 140, 20));
- jLabelDriverConfig.setText("Driver Config");
- jLabelComponentName = new JLabel();
- jLabelComponentName.setBounds(new java.awt.Rectangle(12, 25, 140, 20));
- jLabelComponentName.setText("Component Name");
- jLabelDriverBinding = new JLabel();
- jLabelDriverBinding.setBounds(new java.awt.Rectangle(12, 0, 140, 20));
- jLabelDriverBinding.setText("Driver Binding");
- jPanelDriver = new JPanel();
- jPanelDriver.setBounds(new java.awt.Rectangle(0, 37, 505, 95));
- jPanelDriver.setLayout(null);
- jPanelDriver.add(jStarLabel1, null);
- jPanelDriver.add(jLabelDriverBinding, null);
- jPanelDriver.add(getJTextFieldDriverBinding(), null);
- jPanelDriver.add(jLabelComponentName, null);
- jPanelDriver.add(getJTextFieldComponentName(), null);
- jPanelDriver.add(jLabelDriverConfig, null);
- jPanelDriver.add(getJTextFieldDriverConfig(), null);
- jPanelDriver.add(jLabelDriverDiagnostic, null);
- jPanelDriver.add(getJTextFieldDriverDiagnostic(), null);
- }
- return jPanelDriver;
- }
-
- /**
- * This method initializes jPanelLibrary
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelLibrary() {
- if (jPanelLibrary == null) {
- jLabelDestructor = new JLabel();
- jLabelDestructor.setBounds(new java.awt.Rectangle(12, 25, 140, 20));
- jLabelDestructor.setText("Destructor");
- jLabelConstructor = new JLabel();
- jLabelConstructor.setBounds(new java.awt.Rectangle(12, 0, 140, 20));
- jLabelConstructor.setText("Constructor");
- jPanelLibrary = new JPanel();
- jPanelLibrary.setBounds(new java.awt.Rectangle(0, 37, 505, 45));
- jPanelLibrary.setLayout(null);
- jPanelLibrary.add(jLabelConstructor, null);
- jPanelLibrary.add(getJTextFieldConstructor(), null);
- jPanelLibrary.add(jLabelDestructor, null);
- jPanelLibrary.add(getJTextFieldDestructor(), null);
- }
- return jPanelLibrary;
- }
-
- /**
- * This method initializes jPanelCallBack
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelCallBack() {
- if (jPanelCallBack == null) {
- jLabelExitBootServices = new JLabel();
- jLabelExitBootServices.setBounds(new java.awt.Rectangle(12, 25, 140, 20));
- jLabelExitBootServices.setText("Exit Boot Services");
- jLabelVirtualAddressMap = new JLabel();
- jLabelVirtualAddressMap.setBounds(new java.awt.Rectangle(12, 0, 140, 20));
- jLabelVirtualAddressMap.setText("Virtual Address Map");
- jPanelCallBack = new JPanel();
- jPanelCallBack.setBounds(new java.awt.Rectangle(0, 37, 505, 45));
- jPanelCallBack.setLayout(null);
- jPanelCallBack.add(jLabelVirtualAddressMap, null);
- jPanelCallBack.add(getJTextFieldVirtualAddressMap(), null);
- jPanelCallBack.add(jLabelExitBootServices, null);
- jPanelCallBack.add(getJTextFieldExitBootServices(), null);
- }
- return jPanelCallBack;
- }
-
- /**
- * This method initializes jTextFieldModuleEntryPoint
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldModuleEntryPoint() {
- if (jTextFieldModuleEntryPoint == null) {
- jTextFieldModuleEntryPoint = new JTextField();
- jTextFieldModuleEntryPoint.setBounds(new java.awt.Rectangle(168, 0, 320, 20));
- }
- return jTextFieldModuleEntryPoint;
- }
-
- /**
- * This method initializes jTextFieldModuleUnloadImage
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldModuleUnloadImage() {
- if (jTextFieldModuleUnloadImage == null) {
- jTextFieldModuleUnloadImage = new JTextField();
- jTextFieldModuleUnloadImage.setBounds(new java.awt.Rectangle(168, 25, 320, 20));
- }
- return jTextFieldModuleUnloadImage;
- }
-
- /**
- * This method initializes jTextFieldDriverBinding
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldDriverBinding() {
- if (jTextFieldDriverBinding == null) {
- jTextFieldDriverBinding = new JTextField();
- jTextFieldDriverBinding.setBounds(new java.awt.Rectangle(168, 0, 320, 20));
- }
- return jTextFieldDriverBinding;
- }
-
- /**
- * This method initializes jTextFieldComponentName
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldComponentName() {
- if (jTextFieldComponentName == null) {
- jTextFieldComponentName = new JTextField();
- jTextFieldComponentName.setBounds(new java.awt.Rectangle(168, 25, 320, 20));
- }
- return jTextFieldComponentName;
- }
-
- /**
- * This method initializes jTextFieldDriverConfig
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldDriverConfig() {
- if (jTextFieldDriverConfig == null) {
- jTextFieldDriverConfig = new JTextField();
- jTextFieldDriverConfig.setBounds(new java.awt.Rectangle(168, 50, 320, 20));
- }
- return jTextFieldDriverConfig;
- }
-
- /**
- * This method initializes jTextFieldDriverDiagnostic
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldDriverDiagnostic() {
- if (jTextFieldDriverDiagnostic == null) {
- jTextFieldDriverDiagnostic = new JTextField();
- jTextFieldDriverDiagnostic.setBounds(new java.awt.Rectangle(168, 75, 320, 20));
- }
- return jTextFieldDriverDiagnostic;
- }
-
- /**
- * This method initializes jTextFieldConstructor
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldConstructor() {
- if (jTextFieldConstructor == null) {
- jTextFieldConstructor = new JTextField();
- jTextFieldConstructor.setBounds(new java.awt.Rectangle(168, 0, 320, 20));
- }
- return jTextFieldConstructor;
- }
-
- /**
- * This method initializes jTextFieldDestructor
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldDestructor() {
- if (jTextFieldDestructor == null) {
- jTextFieldDestructor = new JTextField();
- jTextFieldDestructor.setBounds(new java.awt.Rectangle(168, 25, 320, 20));
- }
- return jTextFieldDestructor;
- }
-
- /**
- * This method initializes jTextFieldVirtualAddressMap
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldVirtualAddressMap() {
- if (jTextFieldVirtualAddressMap == null) {
- jTextFieldVirtualAddressMap = new JTextField();
- jTextFieldVirtualAddressMap.setBounds(new java.awt.Rectangle(168, 0, 320, 20));
- }
- return jTextFieldVirtualAddressMap;
- }
-
- /**
- * This method initializes jTextFieldExitBootServices
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldExitBootServices() {
- if (jTextFieldExitBootServices == null) {
- jTextFieldExitBootServices = new JTextField();
- jTextFieldExitBootServices.setBounds(new java.awt.Rectangle(168, 25, 320, 20));
- }
- return jTextFieldExitBootServices;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(515, 250);
- this.setContentPane(getJScrollPane());
- this.setTitle("Externs");
- initFrame();
- this.centerWindow();
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inExternsId
-
- **/
- private void init(ExternsIdentification inExternsId, ModuleIdentification mid) {
- init();
- this.id = inExternsId;
-
- //
- // Init arch with module's arch
- //
- this.vArchList = wt.getModuleArch(mid);
-
- if (this.id != null) {
- String type = id.getType();
- //
- // Filter the type to lock down the type
- //
- this.jComboBoxType.removeAllItems();
- this.jComboBoxType.addItem(type);
-
- this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(id.getSupArchList());
-
- //
- // Init specification
- //
- if (type.equals(EnumerationData.EXTERNS_SPECIFICATION)) {
- this.jTextFieldSpecification.setText(id.getName0());
- }
-
- //
- // Init image
- //
- if (type.equals(EnumerationData.EXTERNS_IMAGE)) {
- this.jTextFieldModuleEntryPoint.setText(id.getName0());
- this.jTextFieldModuleUnloadImage.setText(id.getName1());
- }
-
- //
- // Init library
- //
- if (type.equals(EnumerationData.EXTERNS_LIBRARY)) {
- this.jTextFieldConstructor.setText(id.getName0());
- this.jTextFieldDestructor.setText(id.getName1());
- }
-
- //
- // Init driver
- //
- if (type.equals(EnumerationData.EXTERNS_DRIVER)) {
- this.jTextFieldDriverBinding.setText(id.getName0());
- this.jTextFieldComponentName.setText(id.getName1());
- this.jTextFieldDriverConfig.setText(id.getName2());
- this.jTextFieldDriverDiagnostic.setText(id.getName3());
- }
-
- //
- // Init library
- //
- if (type.equals(EnumerationData.EXTERNS_CALL_BACK)) {
- this.jTextFieldVirtualAddressMap.setText(id.getName0());
- this.jTextFieldExitBootServices.setText(id.getName1());
- }
- }
- }
-
- /**
- This is the override edit constructor
-
- @param inBootModesIdentification
- @param iFrame
-
- **/
- public ExternsDlg(ExternsIdentification inExternsIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inExternsIdentification, mid);
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jLabelName = new JLabel();
- jLabelName.setText("Choose Extern Type");
- jLabelName.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
- jLabelArch.setText("Supported Architectures");
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 87, 155, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(505, 200));
-
- jContentPane.add(jLabelName, null);
- jContentPane.add(getJComboBoxType(), null);
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(jLabelArch, null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
-
- jContentPane.add(jArchCheckBox, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
-
- jContentPane.add(getJPanelSpecification(), null);
- jContentPane.add(getJPanelImage(), null);
- jContentPane.add(getJPanelDriver(), null);
- jContentPane.add(getJPanelLibrary(), null);
- jContentPane.add(getJPanelCallBack(), null);
- }
- return jContentPane;
- }
-
- /**
- This method initializes Usage type and Externs type
-
- **/
- private void initFrame() {
- Tools.generateComboBoxByVector(this.jComboBoxType, ed.getVExternTypes());
- this.jPanelSpecification.setVisible(true);
- this.jPanelImage.setVisible(false);
- this.jPanelLibrary.setVisible(false);
- this.jPanelDriver.setVisible(false);
- this.jPanelCallBack.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()) {
- this.getCurrentExterns();
- 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 specification
- //
- if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
- if (isEmpty(this.jTextFieldSpecification.getText())) {
- Log.wrn("Update Externs", "Please type specification's name");
- return false;
- }
- if (!DataValidation.isSentence(this.jTextFieldSpecification.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for Specification");
- return false;
- }
-
- //
- // No need to check feature flag, return true directly here.
- //
- return true;
- }
-
- //
- // Check image
- //
- if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_IMAGE)) {
- if (isEmpty(this.jTextFieldModuleEntryPoint.getText())
- && isEmpty(this.jTextFieldModuleUnloadImage.getText())) {
- Log.wrn("Update Externs", "At least one of ModuleEntryPoint or ModuleUnloadImage should have a value");
- return false;
- }
- if (!isEmpty(this.jTextFieldModuleEntryPoint.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldModuleEntryPoint.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for Module Entry Point");
- return false;
- }
- }
- if (!isEmpty(this.jTextFieldModuleUnloadImage.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldModuleUnloadImage.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for Module Unload Image");
- return false;
- }
- }
- }
-
- //
- // Check library
- //
- if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_LIBRARY)) {
- if (isEmpty(this.jTextFieldConstructor.getText()) && isEmpty(this.jTextFieldDestructor.getText())) {
- Log.wrn("Update Externs", "At least one of Constructor or Destructor should have a value");
- return false;
- }
- if (isEmpty(this.jTextFieldConstructor.getText()) && !isEmpty(this.jTextFieldDestructor.getText())) {
- Log.wrn("Update Externs", "You must define a Constructor at the same time when you declare a Destructor");
- return false;
- }
- if (!isEmpty(this.jTextFieldConstructor.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldConstructor.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for Constructor");
- return false;
- }
- }
- if (!isEmpty(this.jTextFieldDestructor.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldDestructor.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for Destructor");
- return false;
- }
- }
- }
-
- //
- // Check driver
- //
- if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_DRIVER)) {
- if (isEmpty(this.jTextFieldDriverBinding.getText())) {
- Log.wrn("Update Externs", "DriverBinding must have a value");
- return false;
- }
- if (!isEmpty(this.jTextFieldDriverBinding.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldDriverBinding.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for DriverBinding");
- return false;
- }
- }
- if (!isEmpty(this.jTextFieldComponentName.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldComponentName.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for ComponentName");
- return false;
- }
- }
- if (!isEmpty(this.jTextFieldDriverConfig.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldDriverConfig.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for DriverConfig");
- return false;
- }
- }
- if (!isEmpty(this.jTextFieldDriverDiagnostic.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldDriverDiagnostic.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for DriverDiagnostic");
- return false;
- }
- }
- }
-
- //
- // Check call back
- //
- if (this.jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_CALL_BACK)) {
- if (isEmpty(this.jTextFieldVirtualAddressMap.getText())
- && isEmpty(this.jTextFieldExitBootServices.getText())) {
- Log.wrn("Update Externs", "At least one of VirtualAddressMap or ExitBootServices should have a value");
- return false;
- }
- if (!isEmpty(this.jTextFieldVirtualAddressMap.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldVirtualAddressMap.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for Virtual Address Map");
- return false;
- }
- }
- if (!isEmpty(this.jTextFieldExitBootServices.getText())) {
- if (!DataValidation.isC_NameType(this.jTextFieldExitBootServices.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for Exit Boot Services");
- return false;
- }
- }
- }
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update Externs", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- return true;
- }
-
- private ExternsIdentification getCurrentExterns() {
- String arg0 = "";
- String arg1 = "";
- String arg2 = "";
- String arg3 = "";
-
- String type = this.jComboBoxType.getSelectedItem().toString();
- String featureFlag = this.jTextFieldFeatureFlag.getText();
- Vector<String> arch = this.jArchCheckBox.getSelectedItemsVector();
-
- if (type.equals(EnumerationData.EXTERNS_SPECIFICATION)) {
- arg0 = this.jTextFieldSpecification.getText();
- id = new ExternsIdentification(arg0, type);
- }
-
- if (type.equals(EnumerationData.EXTERNS_IMAGE)) {
- arg0 = this.jTextFieldModuleEntryPoint.getText();
- arg1 = this.jTextFieldModuleUnloadImage.getText();
- id = new ExternsIdentification(arg0, arg1, type, featureFlag, arch);
- }
-
- if (type.equals(EnumerationData.EXTERNS_LIBRARY)) {
- arg0 = this.jTextFieldConstructor.getText();
- arg1 = this.jTextFieldDestructor.getText();
- id = new ExternsIdentification(arg0, arg1, type, featureFlag, arch);
- }
-
- if (type.equals(EnumerationData.EXTERNS_DRIVER)) {
- arg0 = this.jTextFieldDriverBinding.getText();
- arg1 = this.jTextFieldComponentName.getText();
- arg2 = this.jTextFieldDriverConfig.getText();
- arg3 = this.jTextFieldDriverDiagnostic.getText();
- id = new ExternsIdentification(arg0, arg1, arg2, arg3, type, featureFlag, arch);
- }
-
- if (type.equals(EnumerationData.EXTERNS_CALL_BACK)) {
- arg0 = this.jTextFieldVirtualAddressMap.getText();
- arg1 = this.jTextFieldExitBootServices.getText();
- id = new ExternsIdentification(arg0, arg1, type, featureFlag, arch);
- }
-
- 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() == jComboBoxType && arg0.getStateChange() == ItemEvent.SELECTED) {
- if (jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
- this.jPanelSpecification.setVisible(true);
- this.jPanelImage.setVisible(false);
- this.jPanelLibrary.setVisible(false);
- this.jPanelDriver.setVisible(false);
- this.jPanelCallBack.setVisible(false);
- this.jLabelArch.setEnabled(false);
- this.jArchCheckBox.setAllItemsEnabled(false);
- this.jLabelArch.setLocation(12, 62);
- this.jArchCheckBox.setLocation(168, 62);
- this.jLabelFeatureFlag.setLocation(12, 87);
- this.jTextFieldFeatureFlag.setLocation(168, 87);
- } else if (jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_IMAGE)) {
- this.jPanelSpecification.setVisible(false);
- this.jPanelImage.setVisible(true);
- this.jPanelLibrary.setVisible(false);
- this.jPanelDriver.setVisible(false);
- this.jPanelCallBack.setVisible(false);
- this.jLabelArch.setEnabled(true);
- this.jArchCheckBox.setEnabledItems(this.vArchList);
- this.jLabelArch.setLocation(12, 87);
- this.jArchCheckBox.setLocation(168, 87);
- this.jLabelFeatureFlag.setLocation(12, 112);
- this.jTextFieldFeatureFlag.setLocation(168, 112);
- } else if (jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_LIBRARY)) {
- this.jPanelSpecification.setVisible(false);
- this.jPanelImage.setVisible(false);
- this.jPanelLibrary.setVisible(true);
- this.jPanelDriver.setVisible(false);
- this.jPanelCallBack.setVisible(false);
- this.jLabelArch.setEnabled(true);
- this.jArchCheckBox.setEnabledItems(this.vArchList);
- this.jLabelArch.setLocation(12, 87);
- this.jArchCheckBox.setLocation(168, 87);
- this.jLabelFeatureFlag.setLocation(12, 112);
- this.jTextFieldFeatureFlag.setLocation(168, 112);
- } else if (jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_DRIVER)) {
- this.jPanelSpecification.setVisible(false);
- this.jPanelImage.setVisible(false);
- this.jPanelLibrary.setVisible(false);
- this.jPanelDriver.setVisible(true);
- this.jPanelCallBack.setVisible(false);
- this.jLabelArch.setEnabled(true);
- this.jArchCheckBox.setEnabledItems(this.vArchList);
- this.jLabelArch.setLocation(12, 137);
- this.jArchCheckBox.setLocation(168, 137);
- this.jLabelFeatureFlag.setLocation(12, 162);
- this.jTextFieldFeatureFlag.setLocation(168, 162);
- } else if (jComboBoxType.getSelectedItem().toString().equals(EnumerationData.EXTERNS_CALL_BACK)) {
- this.jPanelSpecification.setVisible(false);
- this.jPanelImage.setVisible(false);
- this.jPanelLibrary.setVisible(false);
- this.jPanelDriver.setVisible(false);
- this.jPanelCallBack.setVisible(true);
- this.jLabelArch.setEnabled(true);
- this.jArchCheckBox.setEnabledItems(this.vArchList);
- this.jLabelArch.setLocation(12, 87);
- this.jArchCheckBox.setLocation(168, 87);
- this.jLabelFeatureFlag.setLocation(12, 112);
- this.jTextFieldFeatureFlag.setLocation(168, 112);
- }
- }
- }
-
- public ExternsIdentification getId() {
- return id;
- }
-
- public void setId(ExternsIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java deleted file mode 100644 index cf22e2c102..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java +++ /dev/null @@ -1,465 +0,0 @@ -/** @file
- <<The file is used to create, update Guids of the MSA file>>
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-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;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Guids of the MSA file
- *
- * It extends IDialog
- *
- */
-public class GuidsDlg extends IDialog {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = 6710858997766979803L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelC_Name = null;
-
- private IComboBox iComboBoxCName = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // 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 IComboBox getIComboBoxCName() {
- if (iComboBoxCName == null) {
- iComboBoxCName = new IComboBox();
- iComboBoxCName.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- iComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
- iComboBoxCName.setToolTipText("Select the C Name of the GUID");
- }
- return iComboBoxCName;
- }
-
- /**
- * This method initializes jComboBoxUsage
- *
- * @return javax.swing.JComboBox jComboBoxUsage
- *
- */
- private JComboBox getJComboBoxUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table>"
- + "<tr><td>ALWAYS_CONSUMED</td><td>Module always consumes the GUID</td></tr>"
- + "<tr><td>SOMETIMES_CONSUMED</td><td>Module will use the GUID only if it is present</td></tr>"
- + "<tr><td>ALWAYS_PRODUCED</td><td>Module always produces the GUID</td></tr>"
- + "<tr><td>SOMETIMES_PRODUCED</td><td>Module will sometimes produce the GUID</td></tr>"
- + "<tr><td>DEFAULT</td><td>Default is the the GUID that specified the<br>instance of the package</td></tr>"
- + "</table></html>");
- }
- 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(168, 132, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * 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 jTextAreaHelpText
- *
- * @return javax.swing.JTextArea
- *
- */
- private JTextArea getJTextAreaHelpText() {
- if (jTextAreaHelpText == null) {
- jTextAreaHelpText = new JTextArea();
- jTextAreaHelpText.setLineWrap(true);
- jTextAreaHelpText.setWrapStyleWord(true);
- }
- 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(168, 62));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- 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, 162, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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, 162, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- *
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 235);
- 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, ModuleIdentification mid) {
- init();
- this.id = inGuidsId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- //
- // Get defined guids from dependent packages
- //
- Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
- if (vpid.size() <= 0) {
- Log.wrn("Init Guid", "This module hasn't defined any package dependency, so there is no guid can be added");
- }
-
- Tools.generateComboBoxByVector(this.iComboBoxCName,
- wt.getAllGuidDeclarationsFromPackages(wt.getPackageDependenciesOfModule(mid),
- EnumerationData.GUID_TYPE_GUID));
-
-
- if (this.id != null) {
- this.iComboBoxCName.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 inGuidsIdentification
- * @param iFrame
- *
- */
- public GuidsDlg(GuidsIdentification inGuidsIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inGuidsIdentification, mid);
- }
-
- /**
- * 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 jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 12));
- jLabelC_Name = new JLabel();
- jLabelC_Name.setText("Select GUID's C Name");
- jLabelC_Name.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
-
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
-
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
- jLabelHelpText.setText("Help Text");
-
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 132, 155, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
-
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 107, 155, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 107, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(480, 180));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jLabelC_Name, null);
- jContentPane.add(getIComboBoxCName(), 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;
- }
-
- /**
- * This method initializes Usage type
- *
- */
- private void initFrame() {
- 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);
- }
- }
-
- 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 (this.iComboBoxCName.getSelectedItem() == null) {
- Log.wrn("Update Guids", "Please select one Guid Name");
- return false;
- }
-
- if (!isEmpty(this.iComboBoxCName.getSelectedItem().toString())) {
- if (!DataValidation.isC_NameType(this.iComboBoxCName.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() {
- String arg0 = this.iComboBoxCName.getSelectedItem().toString();
- String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg2 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();
- String arg4 = this.jTextAreaHelpText.getText();
-
- id = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4);
- return id;
- }
-
- public GuidsIdentification getId() {
- return id;
- }
-
- public void setId(GuidsIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HiiPackagesDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HiiPackagesDlg.java deleted file mode 100644 index 906be0b9ff..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HiiPackagesDlg.java +++ /dev/null @@ -1,461 +0,0 @@ -/** @file
-
- The file is used to create, update Hii Packages section of the MSA file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-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.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.HiiPackages.HiiPackagesIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Hii Packages of the MSA file
- *
- * It extends IDialog
- *
- */
-public class HiiPackagesDlg extends IDialog {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -6851574146786158116L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelName = null;
-
- private JTextField jTextFieldName = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not used by UI
- //
- private HiiPackagesIdentification id = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- /**
- *
- * This method initializes jTextFieldName
- *
- * @return javax.swing.JTextField jTextFieldName
- *
- */
- private JTextField getJTextFieldName() {
- if (jTextFieldName == null) {
- jTextFieldName = new JTextField();
- jTextFieldName.setBounds(new java.awt.Rectangle(168, 12, 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 jComboBoxUsage
- *
- * @return javax.swing.JComboBox jComboBoxUsage
- *
- */
- private JComboBox getJComboBoxUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table>"
- + "<tr><td>ALWAYS_PRODUCED</td><td>Hii is always registered</td></tr>"
- + "<tr><td>SOMETIMES_PRODUCED</td><td>Some executions paths will require the Hii to be registered</td></tr>"
- + "</table></html>");
- }
- 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(168, 132, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- *
- * 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 jTextAreaHelpText
- *
- * @return javax.swing.JTextArea jTextAreaHelpText
- *
- */
- private JTextArea getJTextAreaHelpText() {
- if (jTextAreaHelpText == null) {
- jTextAreaHelpText = new JTextArea();
- jTextAreaHelpText.setLineWrap(true);
- jTextAreaHelpText.setWrapStyleWord(true);
- }
- 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(168, 62));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- 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, 162, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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, 162, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- *
- * This method initializes this
- *
- **/
- private void init() {
- this.setSize(505, 235);
- 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, ModuleIdentification mid) {
- init();
- this.id = inHiiPackagesId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- 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 is the override edit constructor
- *
- * @param inHiiPackagesIdentification
- * @param iFrame
- *
- **/
- public HiiPackagesDlg(HiiPackagesIdentification inHiiPackagesIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inHiiPackagesIdentification, mid);
- }
-
- /**
- *
- * 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 jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 12));
- jLabelName = new JLabel();
- jLabelName.setText("Hii Package C Name");
- jLabelName.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
- jLabelHelpText.setText("Help Text");
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 132, 155, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 107, 155, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 107, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(480, 180));
-
- 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;
- }
-
- /**
- *
- * 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);
- }
- }
-
- 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 Hii Package Name
- //
- if (isEmpty(this.jTextFieldName.getText())) {
- Log.wrn("Update Hii Packages", "Hii Package Name Record must be entered!");
- 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;
- }
-
- private HiiPackagesIdentification getCurrentHiiPackages() {
- String arg0 = this.jTextFieldName.getText();
- String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg2 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();
- String arg4 = this.jTextAreaHelpText.getText();
-
- id = new HiiPackagesIdentification(arg0, arg1, arg2, arg3, arg4);
- return id;
- }
-
- public HiiPackagesIdentification getId() {
- return id;
- }
-
- public void setId(HiiPackagesIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HobsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HobsDlg.java deleted file mode 100644 index caf1649984..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HobsDlg.java +++ /dev/null @@ -1,511 +0,0 @@ -/** @file
-
- The file is used to create, update Hob section of the MSA file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-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;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Hobs.HobsIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Hob of the MSA file
- *
- * It extends IDialog
- *
- */
-public class HobsDlg extends IDialog {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -553473437579358325L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelC_Name = null;
-
- private IComboBox iComboBoxGuidC_Name = null;
-
- private JLabel jLabelUsage = null;
-
- private JLabel jLabelHobType = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private JComboBox jComboBoxHobType = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = 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 IComboBox getIComboBoxGuidC_Name() {
- if (iComboBoxGuidC_Name == null) {
- iComboBoxGuidC_Name = new IComboBox();
- iComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- iComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));
- iComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Hob");
- }
- return iComboBoxGuidC_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(168, 37, 320, 20));
- jComboBoxHobType.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxHobType
- .setToolTipText("<html><table>"
- + "<tr><td>PHIT</td><td>EFI_HOB_TYPE_HANDOFF</td></tr>"
- + "<tr><td>MEMORY_ALLOCATION</td><td>EFI_HOB_TYPE_MEMORY_ALLOCATION and $BaseName</td></tr>"
- + "<tr><td>RESOURCE_DESCRIPTOR</td><td>EFI_HOB_TYPE_RESOURCE_DESCRIPTOR</td></tr>"
- + "<tr><td>GUID_EXTENTION</td><td>EFI_HOB_TYPE_GUID_EXTENSION and BaseName of GUID</td></tr>"
- + "<tr><td>FIRMWARE_VOLUME</td><td>EFI_HOB_TYPE_FV</td></tr>"
- + "<tr><td>CPU</td><td>EFI_HOB_TYPE_CPU</td></tr>"
- + "<tr><td>POOL</td><td>EFI_HOB_TYPE_PEI_MEMORY_POOL</td></tr>"
- + "<tr><td>CAPSULE_VOLUME</td><td>EFI_HOB_TYPE_CV</td></tr>"
- + "</table></html>");
- }
- 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(168, 62, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table>"
- + "<tr><td>ALWAYS_CONSUMED</td><td>HOB must be present in the system</td></tr>"
- + "<tr><td>SOMETIMES_CONSUMED</td><td>HOB will be used if it's present</td></tr>"
- + "<tr><td>ALWAYS_PRODUCED</td><td>HOB is always produced</td></tr>"
- + "<tr><td>SOMETIMES_PRODUCED</td><td>HOB will sometimes be produced by the module</td></tr>"
- + "</table></html>");
- }
- return jComboBoxUsage;
- }
-
- /**
- * 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
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 157, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * 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;
- }
-
- /**
- * 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(168, 87));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- 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, 187, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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, 187, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 260);
- 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, ModuleIdentification mid) {
- init();
- this.id = inHobsId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- //
- // Get defined guids from dependent packages
- //
- Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
- if (vpid.size() <= 0) {
- Log
- .wrn("Init Guid",
- "This module hasn't defined any package dependency, so there is no guid value can be added for hob");
- }
- //
- // Init guids drop down list
- //
- Tools
- .generateComboBoxByVector(iComboBoxGuidC_Name,
- wt.getAllGuidDeclarationsFromPackages(vpid, EnumerationData.GUID_TYPE_HOB));
- this.iComboBoxGuidC_Name.insertItemAt(DataType.EMPTY_SELECT_ITEM, 0);
- this.iComboBoxGuidC_Name.setSelectedIndex(0);
-
-
- if (this.id != null) {
- String tmpName = id.getName();
- if (isEmpty(tmpName)) {
- tmpName = DataType.EMPTY_SELECT_ITEM;
- }
- this.iComboBoxGuidC_Name.setSelectedItem(tmpName);
- 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, ModuleIdentification mid) {
- super(iFrame, true);
- init(inHobsIdentification, mid);
- }
-
- /**
- * 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.iComboBoxGuidC_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, 12));
- jLabelC_Name = new JLabel();
- jLabelC_Name.setText("Hob's Guid C Name");
- jLabelC_Name.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
-
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelHobType = new JLabel();
- jLabelHobType.setText("Hob Type");
- jLabelHobType.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
-
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(2, 62));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
-
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 87, 155, 20));
- jLabelHelpText.setText("Help Text");
-
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 157, 155, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
-
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 132, 155, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 132, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(485, 215));
-
- jContentPane.add(jLabelC_Name, null);
- jContentPane.add(getIComboBoxGuidC_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;
- }
-
- /**
- * This method initializes Usage type and Hob type
- *
- */
- private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVHobUsage());
- Tools.generateComboBoxByVector(jComboBoxHobType, ed.getVHobType());
- }
-
- /*
- * (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
- //
- String tmpName = this.iComboBoxGuidC_Name.getSelectedItem().toString();
- if (!tmpName.equals(DataType.EMPTY_SELECT_ITEM) && isEmpty(tmpName)) {
- if (!DataValidation.isC_NameType(this.iComboBoxGuidC_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;
- }
-
- private HobsIdentification getCurrentHobs() {
- String arg0 = this.iComboBoxGuidC_Name.getSelectedItem().toString();
- String arg1 = this.jComboBoxHobType.getSelectedItem().toString();
- String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg3 = this.jTextFieldFeatureFlag.getText();
- Vector<String> 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;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java deleted file mode 100644 index 5c48303a26..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java +++ /dev/null @@ -1,589 +0,0 @@ -/** @file
-
- The file is used to create, update Library Class Definition section of the MSA file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-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.find.Find;
-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;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Library Class Definition section of the MSA file
- *
- * It extends IDialog
- *
- */
-public class LibraryClassDefsDlg extends IDialog {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -1743248695411382857L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null;
-
- private IComboBox iComboBoxLibraryClassName = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private JLabel jLabelLibraryClassName = null;
-
- private JScrollPane jScrollPane = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private JLabel jLabelRecommendedInstanceVersion = null;
-
- private JTextField jTextFieldRecommendedInstanceVersion = null;
-
- private JLabel jLabelRecommendedInstanceGuid = null;
-
- private JTextField jTextFieldRecommendedInstanceGuid = null;
-
- private JButton jButtonGenerateGuid = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelArch = null;
-
- private JLabel jLabelModuleList = null;
-
- private JScrollPane jScrollPaneModuleList = null;
-
- private ICheckBoxList iCheckBoxListModule = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextField jTextFieldHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not for UI
- //
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private LibraryClassIdentification lcid = null;
-
- /**
- This method initializes jComboBoxSelect
-
- @return javax.swing.JComboBox jComboBoxSelect
-
- **/
- private IComboBox getIComboBoxLibraryClassName() {
- if (iComboBoxLibraryClassName == null) {
- iComboBoxLibraryClassName = new IComboBox();
- iComboBoxLibraryClassName.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- iComboBoxLibraryClassName.setPreferredSize(new Dimension(320, 20));
- iComboBoxLibraryClassName.setEnabled(true);
- }
- return iComboBoxLibraryClassName;
- }
-
- /**
- This method initializes jComboBoxUsage
-
- @return javax.swing.JComboBox jComboBoxUsage
-
- **/
- private JComboBox getJComboBoxUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- jComboBoxUsage.setPreferredSize(new Dimension(320, 20));
- }
- return jComboBoxUsage;
- }
-
- /**
- 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 jTextFieldRecommendedInstanceVersion
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldRecommendedInstanceVersion() {
- if (jTextFieldRecommendedInstanceVersion == null) {
- jTextFieldRecommendedInstanceVersion = new JTextField();
- jTextFieldRecommendedInstanceVersion.setPreferredSize(new java.awt.Dimension(260, 20));
- jTextFieldRecommendedInstanceVersion.setSize(new java.awt.Dimension(260, 20));
- jTextFieldRecommendedInstanceVersion.setLocation(new java.awt.Point(220, 85));
- jTextFieldRecommendedInstanceVersion.setVisible(false);
- }
- return jTextFieldRecommendedInstanceVersion;
- }
-
- /**
- * This method initializes jTextFieldRecommendedInstanceGuid
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldRecommendedInstanceGuid() {
- if (jTextFieldRecommendedInstanceGuid == null) {
- jTextFieldRecommendedInstanceGuid = new JTextField();
- jTextFieldRecommendedInstanceGuid.setBounds(new java.awt.Rectangle(220, 110, 190, 20));
- jTextFieldRecommendedInstanceGuid.setPreferredSize(new java.awt.Dimension(190, 20));
- jTextFieldRecommendedInstanceGuid.setVisible(false);
- }
- return jTextFieldRecommendedInstanceGuid;
- }
-
- /**
- * This method initializes jButtonGenerateGuid
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonGenerateGuid() {
- if (jButtonGenerateGuid == null) {
- jButtonGenerateGuid = new JButton();
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(415, 112, 65, 20));
- jButtonGenerateGuid.setPreferredSize(new java.awt.Dimension(65, 20));
- jButtonGenerateGuid.setText("GEN");
- jButtonGenerateGuid.setVisible(false);
- jButtonGenerateGuid.addActionListener(this);
- }
- return jButtonGenerateGuid;
- }
-
- /**
- * This method initializes jTextFieldFeatureFlag
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 197, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- This method initializes iCheckBoxListArch
-
- @return ICheckBoxList
- **/
- private ICheckBoxList getICheckBoxListSupModuleList() {
- if (iCheckBoxListModule == null) {
- iCheckBoxListModule = new ICheckBoxList();
- }
- return iCheckBoxListModule;
- }
-
- /**
- This method initializes jScrollPaneModuleList
-
- @return javax.swing.JScrollPane
-
- **/
- private JScrollPane getJScrollPaneModuleList() {
- if (jScrollPaneModuleList == null) {
- jScrollPaneModuleList = new JScrollPane();
- jScrollPaneModuleList.setBounds(new java.awt.Rectangle(168, 112, 320, 80));
- jScrollPaneModuleList.setPreferredSize(new java.awt.Dimension(320, 80));
- jScrollPaneModuleList.setViewportView(getICheckBoxListSupModuleList());
- }
- return jScrollPaneModuleList;
- }
-
- /**
- This method initializes jTextFieldHelpText
-
- @return javax.swing.JTextField
-
- **/
- private JTextField getJTextFieldHelpText() {
- if (jTextFieldHelpText == null) {
- jTextFieldHelpText = new JTextField();
- jTextFieldHelpText.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
- jTextFieldHelpText.setPreferredSize(new java.awt.Dimension(320, 20));
- }
- return jTextFieldHelpText;
- }
-
- /**
- This method initializes jButtonOk
-
- @return javax.swing.JButton
-
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(300, 232, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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(400, 232, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This is the default constructor
-
- **/
- public LibraryClassDefsDlg(LibraryClassIdentification inLibraryClassIdentification, IFrame iFrame,
- ModuleIdentification mid) {
- super(iFrame, true);
- init(inLibraryClassIdentification, mid);
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setContentPane(getJScrollPane());
- this.setTitle("Library Class Definitions");
- this.setBounds(new java.awt.Rectangle(0, 0, 505, 305));
- initFrame();
- this.setViewMode(false);
- this.centerWindow();
- }
-
- /**
- This method initializes this
-
- **/
- private void init(LibraryClassIdentification inLibraryClassIdentification, ModuleIdentification mid) {
- init();
- this.lcid = inLibraryClassIdentification;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- //
- // Get defined library classes from dependent packages
- //
- Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
- if (vpid.size() <= 0) {
- Log.wrn("Init Library Class",
- "This module hasn't defined any package dependency, so there is no library class can be added");
- }
-
- Tools
- .generateComboBoxByVector(
- this.iComboBoxLibraryClassName,
- wt
- .getAllLibraryClassDefinitionsFromPackages(wt
- .getPackageDependenciesOfModule(mid)));
-
- if (lcid != null) {
- this.iComboBoxLibraryClassName.setSelectedItem(lcid.getLibraryClassName());
- this.jComboBoxUsage.setSelectedItem(lcid.getUsage());
- this.jTextFieldRecommendedInstanceVersion.setText(lcid.getRecommendedInstanceVersion());
- this.jTextFieldRecommendedInstanceGuid.setText(lcid.getRecommendedInstanceGuid());
- this.jTextFieldFeatureFlag.setText(lcid.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(lcid.getSupArchList());
- this.iCheckBoxListModule.setAllItemsUnchecked();
- this.iCheckBoxListModule.initCheckedItem(true, lcid.getSupModuleList());
- this.jTextFieldHelpText.setText(lcid.getHelp());
- }
- }
-
- /**
- 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.iComboBoxLibraryClassName.setEnabled(!isView);
- this.jComboBoxUsage.setEnabled(!isView);
- }
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 87, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 62, 168, 20));
- jLabelHelpText.setText("Help Text");
- jLabelModuleList = new JLabel();
- jLabelModuleList.setBounds(new java.awt.Rectangle(12, 112, 168, 20));
- jLabelModuleList.setText("Supported Module Types");
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 87, 168, 20));
- jLabelArch.setText("Supported Architectures");
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 197, 168, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
- jLabelRecommendedInstanceGuid = new JLabel();
- jLabelRecommendedInstanceGuid.setBounds(new java.awt.Rectangle(12, 87, 200, 20));
- jLabelRecommendedInstanceGuid.setText("Recommended Instance Guid");
- jLabelRecommendedInstanceGuid.setVisible(false);
- jLabelRecommendedInstanceVersion = new JLabel();
- jLabelRecommendedInstanceVersion.setBounds(new java.awt.Rectangle(12, 87, 200, 20));
- jLabelRecommendedInstanceVersion.setText("Recommended Instance Version");
- jLabelRecommendedInstanceVersion.setVisible(false);
- jLabelLibraryClassName = new JLabel();
- jLabelLibraryClassName.setBounds(new java.awt.Rectangle(12, 12, 168, 20));
- jLabelLibraryClassName.setText("Library Class Name");
- jLabelUsage = new JLabel();
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 37, 168, 20));
- jLabelUsage.setText("Usage");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(495, 255));
-
- jContentPane.add(getIComboBoxLibraryClassName(), null);
- jContentPane.add(jLabelUsage, null);
- jContentPane.add(getJComboBoxUsage(), null);
- jContentPane.add(jLabelLibraryClassName, null);
- jContentPane.add(jLabelRecommendedInstanceVersion, null);
- jContentPane.add(getJTextFieldRecommendedInstanceVersion(), null);
- jContentPane.add(jLabelRecommendedInstanceGuid, null);
- jContentPane.add(getJTextFieldRecommendedInstanceGuid(), null);
- jContentPane.add(getJButtonGenerateGuid(), null);
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
- jContentPane.add(jLabelArch, null);
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 10));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 35));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jLabelModuleList, null);
- jContentPane.add(getJScrollPaneModuleList(), null);
- jContentPane.add(jLabelHelpText, null);
- jContentPane.add(getJTextFieldHelpText(), null);
- jContentPane.add(jArchCheckBox, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- }
- return jContentPane;
- }
-
- /**
- This method initializes all existing libraries and usage types
-
- **/
- private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVLibraryUsage());
- this.iCheckBoxListModule.setAllItems(ed.getVFrameworkModuleTypes());
- }
-
- /* (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() == jButtonGenerateGuid) {
- this.jTextFieldRecommendedInstanceGuid.setText(Tools.generateUuidString());
- }
-
- if (arg0.getSource() == jButtonOk) {
- if (checkAdd()) {
- getCurrentLibraryClass();
- 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 LibraryClass
- //
- if (this.iComboBoxLibraryClassName.getSelectedItem() == null) {
- Log.wrn("Update Library Class Definitions", "Please select one Library Class");
- return false;
- }
- if (!DataValidation.isLibraryClass(this.iComboBoxLibraryClassName.getSelectedItem().toString())) {
- Log.wrn("Update Library Class Definitions", "Incorrect data type for Library Class");
- return false;
- }
-
- //
- // Check RecommendedInstanceVersion
- //
- // if (!isEmpty(this.jTextFieldRecommendedInstanceVersion.getText())) {
- // if (!DataValidation.isRecommendedInstanceVersion(this.jTextFieldRecommendedInstanceVersion.getText())) {
- // Log.err("Incorrect data type for Recommended Instance Version");
- // return false;
- // }
- // }
-
- //
- // Check RecommendedInstanceGuid
- //
- // if (!isEmpty(this.jTextFieldRecommendedInstanceGuid.getText())) {
- // if (!DataValidation.isGuid(this.jTextFieldRecommendedInstanceGuid.getText())) {
- // Log.err("Incorrect data type for Recommended Instance Guid");
- // return false;
- // }
- // }
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update Library Class Definitions", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- //
- // Check if the library is produced
- //
- String strUsage = this.jComboBoxUsage.getSelectedItem().toString();
- //
- // Check only when the library class is consumed
- //
- if (strUsage.equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED) || strUsage.equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
- LibraryClassVector v = Find.getAllLibraryClassVector();
- boolean isFind = false;
- for (int index = 0; index < v.size(); index++) {
- LibraryClassIdentification lid = v.getLibraryClass(index);
- if (lid.getLibraryClassName().equals(this.iComboBoxLibraryClassName.getSelectedItem().toString())) {
- if (lid.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
- || lid.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
- isFind = true;
- break;
- }
- }
- }
- if (!isFind) {
- Log.wrn("Update Library Class Definitions", "This Library Class has no instance yet. It may have some errors in build time.");
- //return false;
- }
- }
-
- return true;
- }
-
- private LibraryClassIdentification getCurrentLibraryClass() {
- String name = this.iComboBoxLibraryClassName.getSelectedItem().toString();
- String usage = this.jComboBoxUsage.getSelectedItem().toString();
- String version = this.jTextFieldRecommendedInstanceVersion.getText();
- String guid = this.jTextFieldRecommendedInstanceGuid.getText();
- String featureFlag = this.jTextFieldFeatureFlag.getText();
- Vector<String> arch = this.jArchCheckBox.getSelectedItemsVector();
- Vector<String> module = this.iCheckBoxListModule.getAllCheckedItemsString();
- String help = this.jTextFieldHelpText.getText();
- lcid = new LibraryClassIdentification(name, usage, version, guid, arch, featureFlag, module, help);
- return lcid;
- }
-
- public LibraryClassIdentification getLcid() {
- return lcid;
- }
-
- public void setLcid(LibraryClassIdentification lcid) {
- this.lcid = lcid;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java deleted file mode 100644 index fa3d4a4f33..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java +++ /dev/null @@ -1,611 +0,0 @@ -/** @file
-
- The file is used to create, update PcdCode section of the MSA file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-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.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdVector;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update PcdCoded section of the MSA file
- *
- * It extends IDialog
- *
- */
-public class PCDsDlg extends IDialog implements ItemListener {
-
- // /
- // / 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;
-
- private JComboBox jComboBoxItemType = null;
-
- private JComboBox jComboBoxCName = null;
-
- private JLabel jLabelDefaultValue = null;
-
- private JTextField jTextFieldDefaultValue = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelTokenSpaceGuid = null;
-
- private JTextField jTextFieldTokenSpaceGuid = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelArch = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- //
- // Not used by UI
- //
- private PcdCodedIdentification id = null;
-
- private EnumerationData ed = new EnumerationData();
-
- 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(168, 37, 320, 20));
- jComboBoxItemType.setPreferredSize(new java.awt.Dimension(320, 20));
- }
- 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(168, 12, 320, 20));
- jComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxCName.addItemListener(this);
- }
- 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(168, 62, 320, 20));
- jTextFieldDefaultValue.setPreferredSize(new java.awt.Dimension(320, 20));
- }
- 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);
- }
- 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(168, 112));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- return jScrollPaneHelpText;
- }
-
- /**
- * 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 jTextFieldTokenSpaceGuid
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldTokenSpaceGuid() {
- if (jTextFieldTokenSpaceGuid == null) {
- jTextFieldTokenSpaceGuid = new JTextField();
- jTextFieldTokenSpaceGuid.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
- jTextFieldTokenSpaceGuid.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldTokenSpaceGuid.setVisible(false);
- }
- 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(168, 182, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(290, 212, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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, 212, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jComboBoxUsage
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 87, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- }
- return jComboBoxUsage;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 280);
- 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, ModuleIdentification mid) {
- init();
- this.id = inPcdCodedId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- //
- // Get defined pcds from dependent packages
- //
- Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
- if (vpid.size() <= 0) {
- Log.wrn("Init Pcd", "This module hasn't defined any package dependency, so there is no pcd can be added");
- }
-
- pcd = wt.getAllPcdDeclarationsFromPackages(wt.getPackageDependenciesOfModule(mid));
- for (int index = 0; index < pcd.size(); index++) {
- jComboBoxCName.addItem(pcd.getPcd(index));
- }
-
- if (this.id != null) {
- for (int index = 0; index < this.jComboBoxCName.getItemCount(); index++) {
- if (this.jComboBoxCName.getItemAt(index).toString().equals(id.getName())) {
- this.jComboBoxCName.setSelectedIndex(index);
- break;
- }
- }
- this.jTextFieldTokenSpaceGuid.setText(id.getGuid());
- this.jTextFieldDefaultValue.setText(id.getValue());
- this.jComboBoxUsage.setSelectedItem(id.getUsage());
- this.jTextAreaHelpText.setText(id.getHelp());
- this.jComboBoxItemType.setSelectedItem(id.getType());
- this.jTextFieldFeatureFlag.setText(id.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(id.getSupArchList());
- }
- }
-
- /**
- * This is the override edit constructor
- *
- * @param inPcdCodedId
- * @param iFrame
- *
- */
- public PCDsDlg(PcdCodedIdentification inPcdCodedId, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inPcdCodedId, mid);
- }
-
- /**
- * 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 jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelUsage = new JLabel();
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 87, 168, 20));
- jLabelUsage.setText("Usge");
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 12));
- jLabelC_Name = new JLabel();
- jLabelC_Name.setText("PCD C Name");
- jLabelC_Name.setBounds(new java.awt.Rectangle(12, 12, 168, 20));
-
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelItemType = new JLabel();
- jLabelItemType.setText("PCD Item Type");
- jLabelItemType.setBounds(new java.awt.Rectangle(12, 37, 168, 20));
-
- jLabelDefaultValue = new JLabel();
- jLabelDefaultValue.setText("Default Value");
- jLabelDefaultValue.setBounds(new java.awt.Rectangle(12, 62, 168, 20));
-
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(2, 112));
- jLabelHelpText = new JLabel();
- jLabelHelpText.setText("Help Text");
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 112, 168, 20));
-
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 182, 168, 20));
- jLabelFeatureFlag.setEnabled(false);
-
- 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(12, 157, 168, 20));
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 157, 320, 20));
-
- // Hidden field
- jLabelTokenSpaceGuid.setBounds(new java.awt.Rectangle(12, 62, 140, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(485, 235));
-
- 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);
- jContentPane.add(jLabelUsage, null);
- jContentPane.add(getJComboBoxUsage(), null);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes Usage type, Item type and Datum type
- *
- */
- private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVPcdUsage());
- }
-
- /*
- * (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);
- }
- }
-
- /**
- * 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 (this.jComboBoxCName.getSelectedItem() == null) {
- Log.wrn("Update Pcd", "Please select one Pcd Name");
- return false;
- }
-
- 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 the datatype specified in the 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;
- }
-
- private PcdCodedIdentification getCurrentPcdCoded() {
- String arg0 = this.jComboBoxCName.getSelectedItem().toString();
- String arg1 = this.jTextFieldTokenSpaceGuid.getText();
-
- String arg2 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();
-
- String arg4 = this.jTextFieldDefaultValue.getText();
- String arg5 = this.jTextAreaHelpText.getText();
- String arg6 = this.jComboBoxItemType.getSelectedItem().toString();
- String arg7 = this.jComboBoxUsage.getSelectedItem().toString();
- if (arg7.equals(DataType.EMPTY_SELECT_ITEM)) {
- arg7 = "";
- }
-
- id = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
- 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 value is defined incorrectly.\r\nPlease check it in the 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/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PackageDepDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PackageDepDlg.java deleted file mode 100644 index 00161b5ecb..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PackageDepDlg.java +++ /dev/null @@ -1,441 +0,0 @@ -/** @file
-
- The file is used to create, update Package Dependencies section of the MSA file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PackageDependencies.PackageDependenciesIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Package Dependencies section of the MSA file
- *
- * It extends IDialog
- *
- */
-public class PackageDepDlg extends IDialog implements ItemListener {
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = 3465193035145152131L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelPackageName = null;
-
- private StarLabel jStarLabel1 = null;
-
- private JComboBox jComboBoxPackageName = null;
-
- private JLabel jLabelPackageGuid = null;
-
- private JTextField jTextFieldPackageGuid = null;
-
- private JLabel jLabelPackageVersion = null;
-
- private JTextField jTextFieldPackageVersion = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelArch = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not used by UI
- //
- private PackageDependenciesIdentification pdid = null;
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private Vector<PackageIdentification> vPackage = wt.getAllPackages();
-
- /**
- * This method initializes jComboBoxPackageName
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxPackageName() {
- if (jComboBoxPackageName == null) {
- jComboBoxPackageName = new JComboBox();
- jComboBoxPackageName.setBounds(new java.awt.Rectangle(168, 12, 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;
- }
-
- /**
- * This method initializes jTextFieldPackageGuid
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldPackageGuid() {
- if (jTextFieldPackageGuid == null) {
- jTextFieldPackageGuid = new JTextField();
- jTextFieldPackageGuid.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- jTextFieldPackageGuid.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldPackageGuid.setEditable(false);
- jTextFieldPackageGuid.setVisible(false);
- }
- return jTextFieldPackageGuid;
- }
-
- /**
- * This method initializes jTextFieldPackageVersion
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldPackageVersion() {
- if (jTextFieldPackageVersion == null) {
- jTextFieldPackageVersion = new JTextField();
- jTextFieldPackageVersion.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- jTextFieldPackageVersion.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldPackageVersion
- .setToolTipText("<html>If this module depends on a specific version of a package, <br>"
- + "enter the package version here. <br>"
- + "If the module can use the latest version <br>"
- + "that does not break backward compatibility, <br>"
- + "leave this field blank</html>");
- }
- return jTextFieldPackageVersion;
- }
-
- /**
- * This method initializes jTextFieldFeatureFlag
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 87, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * 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 jButtonOk
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(290, 122, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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, 122, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 216);
- this.setContentPane(getJScrollPane());
- this.setTitle("Package Dependencies");
- initFrame();
- this.setViewMode(false);
- this.centerWindow();
- }
-
- /**
- * This method initializes this
- *
- */
- private void init(PackageDependenciesIdentification inPackageDependenciesIdentification, ModuleIdentification mid) {
- init();
- this.pdid = inPackageDependenciesIdentification;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- if (pdid != null) {
- this.jComboBoxPackageName.setSelectedItem(pdid.getName());
- this.jTextFieldPackageVersion.setText(pdid.getVersion());
- this.jTextFieldPackageGuid.setText(pdid.getGuid());
- jTextFieldFeatureFlag.setText(pdid.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(pdid.getSupArchList());
- }
- }
-
- /**
- * This is the default constructor
- *
- */
- public PackageDepDlg(PackageDependenciesIdentification inPackageDependenciesIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inPackageDependenciesIdentification, mid);
- }
-
- /**
- * 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.jComboBoxPackageName.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, 12));
- jLabelPackageName = new JLabel();
- jLabelPackageName.setBounds(new java.awt.Rectangle(12, 12, 168, 20));
- jLabelPackageName.setText("Package Name");
-
- jLabelPackageVersion = new JLabel();
- jLabelPackageVersion.setBounds(new java.awt.Rectangle(12, 37, 168, 20));
- jLabelPackageVersion.setText("Package Version");
-
- jLabelPackageGuid = new JLabel();
- jLabelPackageGuid.setBounds(new java.awt.Rectangle(12, 37, 168, 20));
- jLabelPackageGuid.setText("Package Guid");
- jLabelPackageGuid.setVisible(false);
-
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 87, 168, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
-
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 62, 168, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(485, 170));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jLabelPackageName, null);
- jContentPane.add(getJComboBoxPackageName(), null);
- jContentPane.add(jLabelPackageGuid, null);
- jContentPane.add(getJTextFieldPackageGuid(), null);
- jContentPane.add(jLabelPackageVersion, null);
- jContentPane.add(getJTextFieldPackageVersion(), null);
- // LAH Not Used here
- // jContentPane.add(getJButtonGenerateGuid(), 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;
- }
-
- /*
- * (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()) {
- getCurrentPackageDependencies();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- /**
- * This method initializes Usage type, Package type and Arch type
- *
- */
- private void initFrame() {
- for (int index = 0; index < vPackage.size(); index++) {
- jComboBoxPackageName.addItem(vPackage.elementAt(index).getName());
- }
- }
-
- /**
- * Data validation for all fields before add current item to Vector
- *
- * @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 PackageGuid
- //
- // if (!isEmpty(this.jTextFieldPackageGuid.getText())) {
- // if (!DataValidation.isGuid(this.jTextFieldPackageGuid.getText())) {
- // Log.err("Incorrect data type for Package Guid");
- // return false;
- // }
- // }
-
- //
- // Check PackageVersion
- //
- if (!isEmpty(this.jTextFieldPackageVersion.getText())) {
- if (!DataValidation.isVersion(this.jTextFieldPackageVersion.getText())) {
- Log.wrn("Update Package Dependencies", "Incorrect data type for Package Version");
- return false;
- }
- }
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update Package Dependencies", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- return true;
- }
-
- private PackageDependenciesIdentification getCurrentPackageDependencies() {
- String arg0 = this.jComboBoxPackageName.getSelectedItem().toString();
- String arg1 = this.jTextFieldPackageVersion.getText();
- String arg2 = this.jTextFieldPackageGuid.getText();
-
- String arg3 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector();
- pdid = new PackageDependenciesIdentification(arg0, arg1, arg2, arg3, arg4);
- return pdid;
- }
-
- /*
- * (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.jComboBoxPackageName && arg0.getStateChange() == ItemEvent.SELECTED) {
- for (int index = 0; index < vPackage.size(); index++) {
- if (this.jComboBoxPackageName.getSelectedItem().toString().equals(vPackage.get(index).getName())) {
- this.jTextFieldPackageGuid.setText(vPackage.get(index).getGuid());
- }
- }
- }
- }
-
- public PackageDependenciesIdentification getPdid() {
- return pdid;
- }
-
- public void setPdid(PackageDependenciesIdentification pdid) {
- this.pdid = pdid;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java deleted file mode 100644 index c649d13508..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java +++ /dev/null @@ -1,493 +0,0 @@ -/** @file
-
- The file is used to create, update Ppi section of the MSA file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-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;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Ppi section of the MSA file
- *
- * It extends IDialog
- *
- */
-public class PpisDlg extends IDialog implements ItemListener {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -4284901202357037724L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelC_Name = null;
-
- private IComboBox iComboBoxCName = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private JLabel jLabelPpiType = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private JComboBox jComboBoxPpiType = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // 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(168, 12, 320, 20));
- jComboBoxPpiType.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxPpiType.addItemListener(this);
- jComboBoxPpiType
- .setToolTipText("<html>PPIs are named by GUID.<br>PPI Notify is consumed via a register PPI Notify mechanism</html>");
- }
- return jComboBoxPpiType;
- }
-
- /**
- * This method initializes jTextFieldC_Name
- *
- * @return javax.swing.JTextField jTextFieldC_Name
- *
- */
- private IComboBox getIComboBoxCName() {
- if (iComboBoxCName == null) {
- iComboBoxCName = new IComboBox();
- iComboBoxCName.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- iComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
- iComboBoxCName.setToolTipText("Select Guid C Name of PPI");
- }
- return iComboBoxCName;
- }
-
- /**
- * This method initializes jComboBoxUsage
- *
- * @return javax.swing.JComboBox jComboBoxUsage
- *
- */
- private JComboBox getJComboBoxUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table><tr><td colspan=2 align=center><b>PPI</b></td></tr><tr><td>ALWAYS_CONSUMED</td><td>Module always consumes the PPI</td></tr><tr><td>SOMETIMES_CONSUMED</td><td>Module sometimes consumes the PPI</td></tr><tr><td>ALWAYS_PRODUCED</td><td>Module always produces the PPI</td></tr><tr><td>SOMETIMES_PRODUCED</td><td>Module sometimes produces the PPI</td></tr><tr><td colspan=2 align=center><b>PPI Notify</b></td></tr><tr><td>SOMETIMES_CONSUMED</td><td>Module will consume the PPI if it is produced. Consumption<br>is defined by executing the PPI notify function</td></tr></table></html>");
- }
- 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(168, 157, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * 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 jTextAreaHelpText
- *
- * @return javax.swing.JTextArea
- *
- */
- private JTextArea getJTextAreaHelpText() {
- if (jTextAreaHelpText == null) {
- jTextAreaHelpText = new JTextArea();
- jTextAreaHelpText.setLineWrap(true);
- jTextAreaHelpText.setWrapStyleWord(true);
- }
- 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(168, 87));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- 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, 187, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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, 187, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 260);
- 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 inPpisId
- @param mid
-
- **/
- private void init(PpisIdentification inPpisId, ModuleIdentification mid) {
- init();
- this.id = inPpisId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- //
- // Get defined ppis from dependent packages
- //
- Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
- if (vpid.size() <= 0) {
- Log.wrn("Init Ppi", "This module hasn't defined any package dependency, so there is no ppi can be added");
- }
-
- Tools.generateComboBoxByVector(this.iComboBoxCName,
- wt.getAllPpiDeclarationsFromPackages(wt.getPackageDependenciesOfModule(mid)));
-
- if (this.id != null) {
- this.iComboBoxCName.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 is the override edit constructor
- *
- * @param inProtocolsIdentification
- * @param iFrame
- *
- */
- public PpisDlg(PpisIdentification inPpisIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inPpisIdentification, mid);
- }
-
- /**
- * 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, 12));
- jLabelPpiType = new JLabel();
- jLabelPpiType.setBounds(new java.awt.Rectangle(12, 12, 168, 20));
- jLabelPpiType.setText("Select Ppi Type");
-
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelC_Name = new JLabel();
- jLabelC_Name.setText("PPI GUID C Name");
- jLabelC_Name.setBounds(new java.awt.Rectangle(12, 37, 168, 20));
-
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(2, 62));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 62, 168, 20));
-
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(14, 87, 168, 20));
- jLabelHelpText.setText("Help Text");
-
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 157, 168, 20));
- jLabelFeatureFlag.setEnabled(false);
-
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 132, 168, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 132, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(485, 215));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jLabelPpiType, null);
- jContentPane.add(getJComboBoxPpiType(), null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jLabelC_Name, null);
- jContentPane.add(getIComboBoxCName(), 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;
- }
-
- /**
- * This method initializes Usage type
- *
- */
- private void initFrame() {
- 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);
- }
- }
-
- 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 (this.iComboBoxCName.getSelectedItem() == null) {
- Log.wrn("Update Ppis", "Please select one Ppi/PpiNotify Name");
- return false;
- }
-
- if (!isEmpty(this.iComboBoxCName.getSelectedItem().toString())) {
- if (!DataValidation.isC_NameType(this.iComboBoxCName.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() {
- String arg0 = this.iComboBoxCName.getSelectedItem().toString();
- String arg1 = this.jComboBoxPpiType.getSelectedItem().toString();
- String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg3 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg4 = this.jArchCheckBox.getSelectedItemsVector();
- String arg5 = this.jTextAreaHelpText.getText();
-
- 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());
- }
- }
- }
-
- public PpisIdentification getId() {
- return id;
- }
-
- public void setId(PpisIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java deleted file mode 100644 index aa7c453290..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java +++ /dev/null @@ -1,523 +0,0 @@ -/** @file
-
- The file is used to create, update Protocol of section of the MSA file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-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;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Protocol of MSA file
- *
- * It extends IDialog
- *
- */
-public class ProtocolsDlg extends IDialog implements ItemListener {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -9084913640747858848L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelC_Name = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private JLabel jLabelProtocolType = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JComboBox jComboBoxProtocolType = null;
-
- private IComboBox iComboBoxCName = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = 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(168, 157, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * This method initializes jComboBoxUsage
- *
- * @return javax.swing.JComboBox jComboBoxUsage
- *
- */
- private JComboBox getJComboBoxProtocolUsage() {
- if (jComboBoxUsage == null) {
- jComboBoxUsage = new JComboBox();
- jComboBoxUsage.setBounds(new java.awt.Rectangle(168, 62, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table><tr><td colspan=2 align=center><b>Protocol</b></td></tr>"
- + "<tr><td>ALWAYS_CONSUMED</td><td>Module always consumes the protocol</td></tr>"
- + "<tr><td>SOMETIMES_CONSUMES</td><td>Module sometimes consumes the protocol</td></tr>"
- + "<tr><td>ALWAYS_PRODUCED</td><td>Module always produces the protocol</td></tr>"
- + "<tr><td>SOMETIMES_PRODUCED</td><td>Module sometimes produces the protocol</td></tr>"
- + "<tr><td>TO_START</td><td>The protocol is consumed by a Driver Binding protocol <b>Start</b><br>function. The protocol is used in EFI 1.10 driver model</td></tr>"
- + "<tr><td>BY_START</td><td>Protocol is produced by a Driver Binding protocol <b>Start</b><br>function. The protocol is used in EFI 1.10 driver model</td></tr>"
- + "<tr><td colspan=2 align=center><b>Protocol Notify</b></td></tr>"
- + "<tr><td>SOMETIMES_CONSUMED</td><td>Module will consume the protocol if it is produced.<br>Consumption is defined by executing the protocol notify<br>function.</td></tr></table></html>");
- }
- return jComboBoxUsage;
- }
-
- /**
- * 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 jComboBoxProtocolType
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxProtocolType() {
- if (jComboBoxProtocolType == null) {
- jComboBoxProtocolType = new JComboBox();
- jComboBoxProtocolType.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- jComboBoxProtocolType.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxProtocolType.addItemListener(this);
- jComboBoxProtocolType
- .setToolTipText("<html>Select Protocol Type<br>Protocol Notify is a register protocol notify mechanism.");
- }
- return jComboBoxProtocolType;
- }
-
- /**
- * This method initializes iComboBoxCName
- *
- * @return javax.swing.JComboBox
- */
- private IComboBox getIComboBoxCName() {
- if (iComboBoxCName == null) {
- iComboBoxCName = new IComboBox();
- iComboBoxCName.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- iComboBoxCName.setPreferredSize(new java.awt.Dimension(320, 20));
- iComboBoxCName.setToolTipText("Select Guid C Name of the Protocol");
-
- }
- return iComboBoxCName;
- }
-
- /**
- * 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;
- }
-
- /**
- * 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(168, 87));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- 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, 187, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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, 187, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- // Width must be 20 larger than Content Pane PreferredSize width for MSFT
- // Height must be 45 larger than ContentPane PreferredSize height for MSFT
- this.setSize(505, 260);
- 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, ModuleIdentification mid) {
- init();
- this.id = inProtocolsId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- //
- // Get defined protocols from dependent packages
- //
- Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
- if (vpid.size() <= 0) {
- Log.wrn("Init Protocol", "This module hasn't defined any package dependency, so there is no protocol can be added");
- }
-
- Tools.generateComboBoxByVector(this.iComboBoxCName,
- wt.getAllProtocolDeclarationsFromPackages(wt.getPackageDependenciesOfModule(mid)));
-
- if (this.id != null) {
- this.iComboBoxCName.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, ModuleIdentification mid) {
- super(iFrame, true);
- init(inProtocolsIdentification, mid);
- }
-
- /**
- * 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, 12));
- jLabelProtocolType = new JLabel();
- jLabelProtocolType.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
- jLabelProtocolType.setText("Select Protocol Type");
-
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelC_Name = new JLabel();
- jLabelC_Name.setText("Protocol Guid C Name");
- jLabelC_Name.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
-
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(2, 62));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
-
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 87, 155, 20));
- jLabelHelpText.setText("Help Text");
-
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 157, 155, 20));
- jLabelFeatureFlag.setEnabled(false);
-
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 132, 155, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 132, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(485, 215));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jLabelProtocolType, null);
- jContentPane.add(getJComboBoxProtocolType(), null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jLabelC_Name, null);
- jContentPane.add(getIComboBoxCName(), 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;
- }
-
- /**
- * This method initializes Usage type
- *
- */
- private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxProtocolType, ed.getVProtocolType());
- 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);
- }
- }
-
- 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 (this.iComboBoxCName.getSelectedItem() == null) {
- Log.wrn("Update protocols", "Please select one Protocol/ProtocolNotify Name");
- return false;
- }
-
- if (!isEmpty(this.iComboBoxCName.getSelectedItem().toString())) {
- if (!DataValidation.isC_NameType(this.iComboBoxCName.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;
- }
-
- private ProtocolsIdentification getCurrentProtocols() {
- String arg0 = this.iComboBoxCName.getSelectedItem().toString();
- String arg1 = this.jComboBoxProtocolType.getSelectedItem().toString();
- String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg3 = this.jTextFieldFeatureFlag.getText();
- Vector<String> 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());
- }
- }
- }
-
- public ProtocolsIdentification getId() {
- return id;
- }
-
- public void setId(ProtocolsIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java deleted file mode 100644 index 238c000cde..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java +++ /dev/null @@ -1,547 +0,0 @@ -/** @file
-
- The file is used to create, update SourceFiles section of the MSA file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-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;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.SourceFiles.SourceFilesIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update SourceFiles section of the MSA file
- *
- * It extends IDialog
- *
- **/
-public class SourceFilesDlg extends IDialog {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -6765742852142775378L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelFileName = null;
-
- private JTextField jTextFieldFileName = null;
-
- private JButton jButtonOpenFile = null;
-
- private JLabel jLabelToolChainFamily = null;
-
- private StarLabel jStarLabel1 = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelTagName = null;
-
- private JTextField jTextFieldTagName = null;
-
- private JLabel jLabelToolCode = null;
-
- private JTextField jTextFieldToolCode = null;
-
- private IComboBox iComboBoxToolCode = null;
-
- private JTextField jTextFieldToolChainFamily = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not used by UI
- //
- private SourceFilesIdentification sfid[] = null;
-
- private String msaFileName = "";
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- /**
- This method initializes jTextFieldFileName
-
- @return javax.swing.JTextField jTextFieldFileName
-
- **/
- private JTextField getJTextFieldSourceFilesDirectory() {
- if (jTextFieldFileName == null) {
- jTextFieldFileName = new JTextField();
- jTextFieldFileName.setBounds(new java.awt.Rectangle(168, 12, 250, 20));
- jTextFieldFileName.setPreferredSize(new java.awt.Dimension(250, 20));
- jTextFieldFileName.setToolTipText("Path is relative to the MSA file and must include the file name");
- }
- return jTextFieldFileName;
- }
-
- /**
- This method initializes jButtonOpenFile
-
- @return javax.swing.JButton jButtonOpenFile
-
- **/
- private JButton getJButtonOpenFile() {
- if (jButtonOpenFile == null) {
- jButtonOpenFile = new JButton();
- jButtonOpenFile.setText("Browse");
- jButtonOpenFile.setBounds(new java.awt.Rectangle(422, 12, 85, 20));
- jButtonOpenFile.setPreferredSize(new java.awt.Dimension(85, 20));
- jButtonOpenFile.addActionListener(this);
- }
- return jButtonOpenFile;
- }
-
- /**
- 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 jTextFieldTagName
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldTagName() {
- if (jTextFieldTagName == null) {
- jTextFieldTagName = new JTextField();
- jTextFieldTagName.setBounds(new java.awt.Rectangle(168, 37, 340, 20));
- jTextFieldTagName.setPreferredSize(new java.awt.Dimension(340, 20));
- jTextFieldTagName.setToolTipText("You may specify a specific tool chain tag name, such as BILL1");
- }
- return jTextFieldTagName;
- }
-
- private IComboBox getIComboBoxToolCode() {
- if (iComboBoxToolCode == null) {
- iComboBoxToolCode = new IComboBox();
- iComboBoxToolCode.setBounds(new java.awt.Rectangle(168, 62, 340, 20));
- iComboBoxToolCode.setPreferredSize(new java.awt.Dimension(340, 20));
- iComboBoxToolCode.setToolTipText("<html>You may select a specific tool command from drop down list,<br>"
- + "or you can DOUBLE-CLICK this field to enter your customized<br>"
- + "tool command.<br>"
- + "Press ENTER to save your input or press ESCAPE to quit</html>");
- }
- return iComboBoxToolCode;
- }
-
- /**
- * This method initializes jTextFieldToolCode
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldToolCode() {
- if (jTextFieldToolCode == null) {
- jTextFieldToolCode = new JTextField();
- jTextFieldToolCode.setBounds(new java.awt.Rectangle(168, 62, 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;
- }
-
- /**
- * This method initializes jTextFieldToolChainFamily
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldToolChainFamily() {
- if (jTextFieldToolChainFamily == null) {
- jTextFieldToolChainFamily = new JTextField();
- jTextFieldToolChainFamily.setBounds(new java.awt.Rectangle(168, 87, 340, 20));
- jTextFieldToolChainFamily.setPreferredSize(new java.awt.Dimension(340, 20));
- jTextFieldToolChainFamily.setToolTipText("You may specify a specific tool chain family, such as GCC");
- }
- return jTextFieldToolChainFamily;
- }
-
- /**
- * This method initializes jTextFieldFeatureFlag
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFeatureFlag() {
- if (jTextFieldFeatureFlag == null) {
- jTextFieldFeatureFlag = new JTextField();
- jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 137, 340, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(340, 20));
- jTextFieldFeatureFlag.setToolTipText("RESERVED FOR FUTURE USE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- 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(317, 172, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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(412, 172, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- This is the default constructor
-
- **/
- public SourceFilesDlg(SourceFilesIdentification inSourceFilesIdentification, IFrame iFrame, ModuleIdentification mid) {
- super(iFrame, true);
- init(inSourceFilesIdentification, mid);
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setSize(525, 240);
- this.setContentPane(getJScrollPane());
- this.setTitle("Source Files");
- this.setViewMode(false);
- this.centerWindow();
- Tools.generateComboBoxByVector(iComboBoxToolCode, ed.getVToolCode());
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
-
- @param inSourceFiles The input data of SourceFilesDocument.SourceFiles
-
- **/
- private void init(SourceFilesIdentification inSourceFilesIdentifications, ModuleIdentification mid) {
- init();
- this.msaFileName = mid.getPath();
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- if (inSourceFilesIdentifications != null) {
- this.jTextFieldFileName.setText(inSourceFilesIdentifications.getFilename());
- this.jTextFieldTagName.setText(inSourceFilesIdentifications.getTagName());
-
-// //
-// // Generate Tool Code selection list
-// //
-// Vector<String> 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, ed.getVToolCode());
- this.iComboBoxToolCode.setSelectedItem(inSourceFilesIdentifications.getToolCode());
-
- this.jTextFieldToolChainFamily.setText(inSourceFilesIdentifications.getToolChainFamily());
- jTextFieldFeatureFlag.setText(inSourceFilesIdentifications.getFeatureFlag());
- this.jArchCheckBox.setSelectedItems(inSourceFilesIdentifications.getSupArchList());
- }
- }
-
- /**
- 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.jTextFieldFileName.setEnabled(!isView);
- this.jButtonOpenFile.setEnabled(!isView);
- }
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 112, 340, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(340, 20));
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 137, 155, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
- jLabelToolCode = new JLabel();
- jLabelToolCode.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
- jLabelToolCode.setText("Tool Code");
- jLabelTagName = new JLabel();
- jLabelTagName.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
- jLabelTagName.setText("Tag Name");
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 112, 155, 20));
- jLabelArch.setText("Supported Architectures");
- jLabelToolChainFamily = new JLabel();
- jLabelToolChainFamily.setBounds(new java.awt.Rectangle(12, 87, 155, 20));
- jLabelToolChainFamily.setText("Tool Chain Family");
- jLabelFileName = new JLabel();
- jLabelFileName.setText("File Name");
- jLabelFileName.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(505, 192));
-
- jContentPane.add(jLabelFileName, null);
- jContentPane.add(getJTextFieldSourceFilesDirectory(), null);
- jContentPane.add(getJButtonOpenFile(), null);
- jContentPane.add(jLabelToolChainFamily, null);
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, 10));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jLabelArch, null);
- jContentPane.add(jLabelTagName, null);
- 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);
- jContentPane.add(jArchCheckBox, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- }
- 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() == jButtonOpenFile) {
- selectFile();
- }
-
- if (arg0.getSource() == jButtonOk) {
- if (checkAdd()) {
- getCurrentSourceFiles();
- this.returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.returnType = DataType.RETURN_TYPE_CANCEL;
- this.setVisible(false);
- }
- }
-
- private SourceFilesIdentification[] getCurrentSourceFiles() {
- String name = this.jTextFieldFileName.getText();
- String s[] = name.split(";");
- String tagName = this.jTextFieldTagName.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<String> 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);
- }
- return sfid;
- }
-
- /**
- Data validation for all fields
-
- @retval true - All datas are valid
- @retval false - At least one data is invalid
-
- **/
- public boolean checkAdd() {
- //
- // Check Filename
- //
- if (isEmpty(this.jTextFieldFileName.getText())) {
- Log.wrn("Update Source Files", "File Name must be entered!");
- return false;
- }
- if (!DataValidation.isFilename(this.jTextFieldFileName.getText())) {
- Log.wrn("Update Source Files", "Incorrect data type for File Name");
- return false;
- }
-
- //
- // Check TagName
- //
- if (!isEmpty(this.jTextFieldTagName.getText())) {
- if (!DataValidation.isTagName(this.jTextFieldTagName.getText())) {
- Log.wrn("Update Source Files", "Incorrect data type for Tag Name");
- return false;
- }
- }
-
- //
- // Check ToolCode
- //
- if (!isEmpty(this.jTextFieldToolCode.getText())) {
- if (!DataValidation.isToolCode(this.jTextFieldToolCode.getText())) {
- Log.wrn("Update Source Files", "Incorrect data type for Tool Code");
- return false;
- }
- }
-
- //
- // Check ToolChainFamily
- //
- if (!isEmpty(this.jTextFieldToolChainFamily.getText())) {
- if (!DataValidation.isToolChainFamily(this.jTextFieldToolChainFamily.getText())) {
- Log.wrn("Update Source Files", "Incorrect data type for Tool Chain Family");
- return false;
- }
- }
-
- //
- // Check FeatureFlag
- //
- if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {
- if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {
- Log.wrn("Update Source Files", "Incorrect data type for Feature Flag");
- return false;
- }
- }
-
- return true;
- }
-
- /**
- Display a file open browser to let user select file
-
- **/
- private void selectFile() {
- JFileChooser fc = new JFileChooser();
- fc.setCurrentDirectory(new File(Tools.getFilePathOnly(msaFileName)));
- fc.setMultiSelectionEnabled(true);
- int result = fc.showOpenDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- File f[] = fc.getSelectedFiles();
- String s = "";
- for (int index = 0; index < f.length; index++) {
- String relativePath = "";
- relativePath = Tools.getRelativePath(Tools.getFilePathOnly(f[index].getPath()), Tools.getFilePathOnly(msaFileName));
- if (!Tools.isEmpty(relativePath)) {
- relativePath = relativePath + DataType.UNIX_FILE_SEPARATOR;
- }
- s = s + relativePath + f[index].getName() + ";";
- }
- this.jTextFieldFileName.setText(s);
- }
- }
-
- public SourceFilesIdentification[] getSfid() {
- return sfid;
- }
-
- public void setSfid(SourceFilesIdentification[] sfid) {
- this.sfid = sfid;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SystemTablesDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SystemTablesDlg.java deleted file mode 100644 index 83d29cec2c..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SystemTablesDlg.java +++ /dev/null @@ -1,458 +0,0 @@ -/** @file
- <<The file is used to create, update SystemTable in the MSA file>>
-
- <<This dialog is used to add or edit a System Table entry in the MSA file.>>
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-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;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.SystemTables.SystemTablesIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update SystemTables section of the MSA file
- *
- * It extends IDialog
- *
- */
-public class SystemTablesDlg extends IDialog {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = 7488769180379442276L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelEntry = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private IComboBox iComboBoxGuidC_Name = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelArch = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // Not used by UI
- //
- private SystemTablesIdentification id = null;
-
- private EnumerationData ed = new EnumerationData();
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- /**
- * This method initializes iComboBoxGuidC_Name
- *
- * @return javax.swing.JComboBox iComboBoxGuidC_Name
- *
- */
- private IComboBox getIComboBoxGuidC_Name() {
- if (iComboBoxGuidC_Name == null) {
- iComboBoxGuidC_Name = new IComboBox();
- iComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(168, 12, 320, 20));
- iComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));
- iComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the System Table");
- }
- return iComboBoxGuidC_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(168, 37, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table>"
- + "<tr><td>ALWAYS_CONSUMED</td><td>Module requires a GUIDed entry in the system table</td></tr>"
- + "<tr><td>SOMETIMES_CONSUMED</td><td>Module consumes a GUIDed entry in the system<br>table if it is present</td>"
- + "</tr><tr><td>ALWAYS_PRODUCED</td><td>Module always produces a GUIDed entry in the system table</td></tr>"
- + "<tr><td>SOMETIMES_PRODUCED</td><td>Module produces a GUIDed entry in the system table<br>for some of its execution flows.</td></tr>"
- + "</table></html>");
- }
- 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(168, 132, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * 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 jTextAreaHelpText
- *
- * @return javax.swing.JTextArea
- *
- */
- private JTextArea getJTextAreaHelpText() {
- if (jTextAreaHelpText == null) {
- jTextAreaHelpText = new JTextArea();
- jTextAreaHelpText.setLineWrap(true);
- jTextAreaHelpText.setWrapStyleWord(true);
- }
- 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(168, 62));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- 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, 162, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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, 162, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 235);
- 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, ModuleIdentification mid) {
- init();
- this.id = inSystemTablesId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- //
- // Get defined guids from dependent packages
- //
- Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
- if (vpid.size() <= 0) {
- Log
- .wrn("Init Guid",
- "This module hasn't defined any package dependency, so there is no guid value can be added for system table");
- }
- //
- // Init guids drop down list
- //
- Tools
- .generateComboBoxByVector(iComboBoxGuidC_Name,
- wt.getAllGuidDeclarationsFromPackages(vpid, EnumerationData.GUID_TYPE_EFI_SYSTEM_CONFIGURATION_TABLE));
-
-
- if (this.id != null) {
- this.iComboBoxGuidC_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,
- ModuleIdentification mid) {
- super(iFrame, true);
- init(inSystemTablesIdentification, mid);
- }
-
- /**
- * 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 jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(2, 12));
- jLabelEntry = new JLabel();
- jLabelEntry.setText("Table's GUID C Name");
- jLabelEntry.setBounds(new java.awt.Rectangle(12, 12, 155, 20));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 37, 155, 20));
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 62, 155, 20));
- jLabelHelpText.setText("Help Text");
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 132, 155, 20));
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setEnabled(false);
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 107, 155, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 107, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(480, 180));
-
- jContentPane.add(jLabelEntry, null);
- jContentPane.add(jLabelFeatureFlag, null);
- jContentPane.add(getJTextFieldFeatureFlag(), null);
- jContentPane.add(getIComboBoxGuidC_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;
- }
-
- /**
- * This method initializes Usage type
- *
- */
- private void initFrame() {
- Tools.generateComboBoxByVector(jComboBoxUsage, ed.getVSystemTableUsage());
- }
-
- /*
- * (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);
- }
- }
-
- /**
- * 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 (this.iComboBoxGuidC_Name.getSelectedItem() == null) {
- Log.wrn("Update Guids", "Please select one System Table Name");
- return false;
- }
-
- //
- // 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.iComboBoxGuidC_Name.getSelectedItem().toString();
- String arg1 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg2 = this.jTextFieldFeatureFlag.getText();
- Vector<String> arg3 = this.jArchCheckBox.getSelectedItemsVector();
- String arg4 = this.jTextAreaHelpText.getText();
-
- id = new SystemTablesIdentification(arg0, arg1, arg2, arg3, arg4);
- return id;
- }
-
- public SystemTablesIdentification getId() {
- return id;
- }
-
- public void setId(SystemTablesIdentification id) {
- this.id = id;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/VariablesDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/VariablesDlg.java deleted file mode 100644 index b906e9adff..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/VariablesDlg.java +++ /dev/null @@ -1,498 +0,0 @@ -/** @file
-
- The file is used to create, update Variables section of the MSA file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.module.ui.dialog;
-
-import java.awt.event.ActionEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-
-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;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.Variables.VariablesIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-/**
- * The class is used to create, update Variables section of the MSA file
- *
- * It extends IDialog
- *
- */
-public class VariablesDlg extends IDialog {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -6998982978030439446L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabelVariableName = null;
-
- private JTextField jTextFieldVariableName = null;
-
- private JLabel jLabelUsage = null;
-
- private JComboBox jComboBoxUsage = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabelGuidCName = null;
-
- private IComboBox iComboBoxGuidC_Name = null;
-
- private JTextField jTextFieldFeatureFlag = null;
-
- private JLabel jLabelFeatureFlag = null;
-
- private JLabel jLabelArch = null;
-
- private JLabel jLabelHelpText = null;
-
- private JTextArea jTextAreaHelpText = null;
-
- private JScrollPane jScrollPaneHelpText = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- //
- // 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(168, 12));
- jTextFieldVariableName.setToolTipText("Enter a string; the tool will convert to Unicode hex");
- }
- 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(168, 62, 320, 20));
- jComboBoxUsage.setPreferredSize(new java.awt.Dimension(320, 20));
- jComboBoxUsage
- .setToolTipText("<html><table>"
- + "<tr><td>ALWAYS_CONSUMED</td><td>The module requires the variable entry to be set</td></tr>"
- + "<tr><td>SOMETIMES_CONSUMED</td><td>The module will use the variable entry if it is set.</td></tr>"
- + "<tr><td>ALWAYS_PRODUCED</td><td>The module will always write the variable.</td></tr>"
- + "<tr><td>SOMETIMES_PRODUCED</td><td>The module will sometimes write the variable.</td></tr>"
- + "</table></html>");
- }
- return jComboBoxUsage;
- }
-
- /**
- * 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(168, 157, 320, 20));
- jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
- jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
- jTextFieldFeatureFlag.setEnabled(false);
- }
- return jTextFieldFeatureFlag;
- }
-
- /**
- * 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;
- }
-
- 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(168, 87));
- jScrollPaneHelpText.setViewportView(getJTextAreaHelpText());
- }
- return jScrollPaneHelpText;
- }
-
- /**
- * This method initializes iComboBoxGuidC_Name
- *
- * @return javax.swing.JComboBox iComboBoxGuidC_Name
- *
- */
- private IComboBox getIComboBoxGuidC_Name() {
- if (iComboBoxGuidC_Name == null) {
- iComboBoxGuidC_Name = new IComboBox();
- iComboBoxGuidC_Name.setBounds(new java.awt.Rectangle(168, 37, 320, 20));
- iComboBoxGuidC_Name.setPreferredSize(new java.awt.Dimension(320, 20));
- iComboBoxGuidC_Name.setToolTipText("Select the GUID C Name of the Variable.");
- }
- return iComboBoxGuidC_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, 187, 90, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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, 187, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
-
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- this.setSize(505, 260);
- 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, ModuleIdentification mid) {
- init();
- this.id = inVariablesId;
-
- //
- // Init arch with module's arch
- //
- this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
-
- //
- // Get defined guids from dependent packages
- //
- Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
- if (vpid.size() <= 0) {
- Log
- .wrn("Init Guid",
- "This module hasn't defined any package dependency, so there is no guid value can be added for variable");
- }
- //
- // Init guids drop down list
- //
- Tools
- .generateComboBoxByVector(iComboBoxGuidC_Name,
- wt.getAllGuidDeclarationsFromPackages(vpid, EnumerationData.GUID_TYPE_EFI_VARIABLE));
-
- if (this.id != null) {
- this.jTextFieldVariableName.setText(id.getName());
- this.iComboBoxGuidC_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, ModuleIdentification mid) {
- super(iFrame, true);
- init(inVariablesIdentification, mid);
- }
-
- /**
- * 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, 12));
- jLabelVariableName = new JLabel();
- jLabelVariableName.setText("Variable Name");
- jLabelVariableName.setBounds(new java.awt.Rectangle(12, 12, 168, 20));
-
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, 37));
- jLabelGuidCName = new JLabel();
- jLabelGuidCName.setBounds(new java.awt.Rectangle(12, 37, 168, 20));
- jLabelGuidCName.setText("Variable Guid C Name");
-
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(2, 62));
- jLabelUsage = new JLabel();
- jLabelUsage.setText("Usage");
- jLabelUsage.setBounds(new java.awt.Rectangle(12, 62, 168, 20));
-
- jLabelHelpText = new JLabel();
- jLabelHelpText.setBounds(new java.awt.Rectangle(12, 87, 168, 20));
- jLabelHelpText.setText("Help Text");
-
- jLabelFeatureFlag = new JLabel();
- jLabelFeatureFlag.setText("Feature Flag Expression");
- jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 157, 168, 20));
- jLabelFeatureFlag.setEnabled(false);
-
- jLabelArch = new JLabel();
- jLabelArch.setBounds(new java.awt.Rectangle(12, 132, 168, 20));
- jLabelArch.setText("Supported Architectures");
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(168, 132, 320, 20));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(320, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(485, 215));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jLabelVariableName, null);
- jContentPane.add(getJTextFieldString(), null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jLabelGuidCName, null);
- jContentPane.add(getIComboBoxGuidC_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;
- }
-
- /*
- * (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);
- }
- }
-
- /**
- * This method initializes Usage type
- *
- */
- private void initFrame() {
- 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 VariableName
- //
- if (isEmpty(this.jTextFieldVariableName.getText())) {
- Log.wrn("Update Variables", "Variable Name must be entered!");
- return false;
- }
-
- //
- // Check Guid Value
- //
- if (this.iComboBoxGuidC_Name.getSelectedItem() == null) {
- Log.wrn("Update Guids", "Please select one Varibale Guid value");
- 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;
- }
-
- private VariablesIdentification getCurrentVariables() {
- String arg0 = this.jTextFieldVariableName.getText();
- String arg1 = this.iComboBoxGuidC_Name.getSelectedItem().toString();
- String arg2 = this.jComboBoxUsage.getSelectedItem().toString();
-
- String arg3 = this.jTextFieldFeatureFlag.getText();
- Vector<String> 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;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/PackageIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/PackageIdentification.java deleted file mode 100644 index e986f55baf..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/PackageIdentification.java +++ /dev/null @@ -1,64 +0,0 @@ -/** @file
-
- The file is used to save basic information of package
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.packaging;
-
-import java.io.File;
-
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-public class PackageIdentification extends Identification{
-
- public PackageIdentification(String name, String guid, String version){
- super(name, guid, version);
- }
-
- public PackageIdentification(String name, String guid, String version, String path){
- super(name, guid, version, path);
- }
-
- public PackageIdentification(Identification id){
- super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
- }
-
- public File getSpdFile(){
- File spdFile = new File(this.getPath());
- return spdFile;
- }
-
- public String toString() {
- return getName() + " " + getVersion() + " [" + Tools.getRelativePath(getSpdFile().getPath(), Workspace.getCurrentWorkspace()) + "]";
- }
-
- public boolean equals(String packageGuid, String packageVersion) {
- boolean b = false;
- if (this.getGuid().equals(packageGuid)) {
- b = true;
- //
- // Check Version
- //
- if (packageVersion != null) {
- if (!Tools.isEmpty(packageVersion)) {
- if (!packageVersion.equals(this.getVersion())) {
- b = false;
- }
- }
- }
- }
- return b;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GenGuidDialog.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GenGuidDialog.java deleted file mode 100644 index b219c9ed70..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GenGuidDialog.java +++ /dev/null @@ -1,445 +0,0 @@ -/** @file
- Java class GenGuidDialog.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-
-import javax.swing.JPanel;
-import javax.swing.JDialog;
-import java.awt.GridLayout;
-
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JTextField;
-import javax.swing.JLabel;
-import javax.swing.JRadioButton;
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.KeyStroke;
-
-import org.tianocore.frameworkwizard.common.Tools;
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-/**
- Dialog for GUID generation.
- @since PackageEditor 1.0
-**/
-public class GenGuidDialog extends JDialog implements ActionListener{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public static final String guidArrayPat = "0x[a-fA-F0-9]{1,8},( )*0x[a-fA-F0-9]{1,4},( )*0x[a-fA-F0-9]{1,4}(,( )*\\{)?(,?( )*0x[a-fA-F0-9]{1,2}){8}( )*(\\})?";
-
- public static final String guidRegistryPat = "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}";
-
- static private JFrame frame;
- private JPanel jContentPane = null;
- private JPanel jPanelEast = null;
- private JPanel jPanelCenter = null;
- private JTextField jTextField = null;
- private JLabel jLabel = null;
- private JRadioButton jRadioButton = null;
- private JRadioButton jRadioButtonReg = null;
- private JButton jButtonCancel = null;
- private JButton jButtonNew = null;
- private JButton jButtonOk = null;
- private ActionListener outerListener = null;
-
-// private String guid = null;
-
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- if (arg0.getSource() == jButtonNew){
- String uuid = Tools.generateUuidString();
- if (jRadioButtonReg.isSelected()) {
- jTextField.setText(uuid);
- }
- else {
- //ToDo: transform to comma-sep guid
- String s = GenGuidDialog.formatGuidString(uuid);
- if (s.equals("0")) {
- JOptionPane.showMessageDialog(frame, "Check GUID Value, it don't conform to the schema.");
- return;
- }
- jTextField.setText(s);
- }
- }
-
- if (arg0.getSource() == jRadioButtonReg){
-
- //ToDo: check text field value against RegExp and transform if needed
- if (jTextField.getText().matches(GenGuidDialog.guidRegistryPat)){
- return;
- }
- if (jTextField.getText().matches(GenGuidDialog.guidArrayPat)) {
- jTextField.setText(GenGuidDialog.formatGuidString(jTextField.getText()));
- return;
- }
- if (jTextField.getText().length()>0)
- JOptionPane.showMessageDialog(frame, "Check GUID Value, it don't conform to the schema.");
-
- }
-
- if (arg0.getSource() == jRadioButton){
-
- //ToDo: check text field value against RegExp and transform if needed
- if (jTextField.getText().matches(GenGuidDialog.guidArrayPat)){
- return;
- }
- if (jTextField.getText().matches(GenGuidDialog.guidRegistryPat)) {
- jTextField.setText(GenGuidDialog.formatGuidString(jTextField.getText()));
- return;
- }
- if (jTextField.getText().length()>0)
- JOptionPane.showMessageDialog(frame, "Check GUID Value, it don't conform to the schema.");
-
- }
-
- if (arg0.getSource() == jButtonOk){
-// if (jTextField.getText().matches(Tools.guidArrayPat)
-// || jTextField.getText().matches(Tools.guidRegistryPat)){
-// this.setVisible(false);
-// }
-// else {
-// JOptionPane.showMessageDialog(frame, "Incorrect GUID Value Format.");
-// }
-// this.dispose();
- }
-
- if (arg0.getSource() == jButtonCancel){
- this.dispose();
- }
- }
-
- /**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelEast() {
- if (jPanelEast == null) {
- FlowLayout flowLayout = new FlowLayout();
- flowLayout.setVgap(10);
- jPanelEast = new JPanel();
- jPanelEast.setLayout(flowLayout);
- jPanelEast.setPreferredSize(new java.awt.Dimension(100,30));
- jPanelEast.add(getJButtonNew(), null);
- jPanelEast.add(getJButtonOk(), null);
- jPanelEast.add(getJButtonCancel(), null);
- }
- return jPanelEast;
- }
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelCenter() {
- if (jPanelCenter == null) {
- jLabel = new JLabel();
- jLabel.setText("GUID Value");
- GridLayout gridLayout = new GridLayout();
- gridLayout.setRows(4);
- jPanelCenter = new JPanel();
- jPanelCenter.setLayout(gridLayout);
- jPanelCenter.add(getJRadioButtonReg(), null);
- jPanelCenter.add(getJRadioButton(), null);
- jPanelCenter.add(jLabel, null);
- jPanelCenter.add(getJTextField(), null);
- ButtonGroup bg = new ButtonGroup();
- bg.add(jRadioButtonReg);
- bg.add(jRadioButton);
- }
- return jPanelCenter;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextField() {
- if (jTextField == null) {
- jTextField = new JTextField();
- jTextField.setHorizontalAlignment(JTextField.LEADING);
- jTextField.setPreferredSize(new java.awt.Dimension(100,20));
- }
- return jTextField;
- }
-
- /**
- * This method initializes jRadioButton
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButton() {
- if (jRadioButton == null) {
- jRadioButton = new JRadioButton();
- jRadioButton.setText("Comma-Seperated Format");
- jRadioButton.setEnabled(false);
- jRadioButton.addActionListener(this);
- }
- return jRadioButton;
- }
-
- /**
- * This method initializes jRadioButton1
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonReg() {
- if (jRadioButtonReg == null) {
- jRadioButtonReg = new JRadioButton();
- jRadioButtonReg.setText("Registry Format");
- jRadioButtonReg.setSelected(true);
- jRadioButtonReg.addActionListener(this);
- }
- return jRadioButtonReg;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- jButtonCancel.registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButton1
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNew() {
- if (jButtonNew == null) {
- jButtonNew = new JButton();
- jButtonNew.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonNew.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
- jButtonNew.setText("New");
- jButtonNew.addActionListener(this);
- jButtonNew.registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
- }
- return jButtonNew;
- }
-
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonOk.setText("Ok");
- jButtonOk.setActionCommand("GenGuidValue");
-// jButtonOk.addActionListener(this);
- jButtonOk.registerKeyboardAction(outerListener, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
-
- }
- return jButtonOk;
- }
-
- public String getGuid(){
- return jTextField.getText();
- }
-
- public void setGuid(String s){
- jTextField.setText(s);
- }
- /**
- * This is the default constructor
- */
- public GenGuidDialog() {
- super();
- initialize();
- }
-
- public GenGuidDialog(ActionListener i, JFrame frame){
- super(frame);
- outerListener = i;
- initialize();
- jButtonOk.addActionListener(i);
- this.addWindowListener(new WindowAdapter(){
-
- @Override
- public void windowActivated(WindowEvent arg0) {
- // TODO Auto-generated method stub
- super.windowActivated(arg0);
- if ((jRadioButtonReg.isSelected() && jTextField.getText().matches(GenGuidDialog.guidArrayPat))
- || (jRadioButton.isSelected() && jTextField.getText().matches(GenGuidDialog.guidRegistryPat))) {
- jTextField.setText(GenGuidDialog.formatGuidString(jTextField.getText()));
- }
-
-// if (!jTextField.getText().matches(Tools.guidArrayPat) || !jTextField.getText().matches(Tools.guidRegistryPat)) {
-// JOptionPane.showMessageDialog(frame, "InitVal: Incorrect GUID Value Format.");
-// return;
-// }
- }
-
- });
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(466, 157);
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- this.setModal(true);
- this.setTitle("Editing GUID Value");
- this.setContentPane(getJContentPane());
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJPanelEast(), java.awt.BorderLayout.EAST);
- jContentPane.add(getJPanelCenter(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-
- public static String formatGuidString (String guidNameConv) {
- String[] strList;
- String guid = "";
- int index = 0;
- if (guidNameConv
- .matches(GenGuidDialog.guidRegistryPat)) {
- strList = guidNameConv.split("-");
- guid = "0x" + strList[0] + ", ";
- guid = guid + "0x" + strList[1] + ", ";
- guid = guid + "0x" + strList[2] + ", ";
-
- guid = guid + "0x" + strList[3].substring(0, 2) + ", ";
- guid = guid + "0x" + strList[3].substring(2, 4);
-
- while (index < strList[4].length()) {
- guid = guid + ", ";
- guid = guid + "0x" + strList[4].substring(index, index + 2);
- index = index + 2;
- }
-
- return guid;
- }
- else if (guidNameConv
- .matches(GenGuidDialog.guidArrayPat)) {
- strList = guidNameConv.split(",");
-
- //
- // chang ANSI c form to registry form
- //
- for (int i = 0; i < strList.length; i++){
- strList[i] = strList[i].substring(strList[i].lastIndexOf("x") + 1);
- }
- if (strList[strList.length - 1].endsWith("}")) {
- strList[strList.length -1] = strList[strList.length-1].substring(0, strList[strList.length-1].length()-1);
- }
- //
- //inserting necessary leading zeros
- //
-
- int segLen = strList[0].length();
- if (segLen < 8){
- for (int i = 0; i < 8 - segLen; ++i){
- strList[0] = "0" + strList[0];
- }
- }
-
- segLen = strList[1].length();
- if (segLen < 4){
- for (int i = 0; i < 4 - segLen; ++i){
- strList[1] = "0" + strList[1];
- }
- }
- segLen = strList[2].length();
- if (segLen < 4){
- for (int i = 0; i < 4 - segLen; ++i){
- strList[2] = "0" + strList[2];
- }
- }
- for (int i = 3; i < 11; ++i) {
- segLen = strList[i].length();
- if (segLen < 2){
- strList[i] = "0" + strList[i];
- }
- }
-
- for (int i = 0; i < 3; i++){
- guid += strList[i] + "-";
- }
-
- guid += strList[3];
- guid += strList[4] + "-";
-
- for (int i = 5; i < strList.length; ++i){
- guid += strList[i];
- }
-
-
- return guid;
- } else {
-
- return "0";
-
- }
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GuidEditor.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GuidEditor.java deleted file mode 100644 index 0d00f4a014..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GuidEditor.java +++ /dev/null @@ -1,98 +0,0 @@ -/** @file
- Java class GuidEditor.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-//import java.awt.event.KeyEvent;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-//import javax.swing.JComponent;
-import javax.swing.JTable;
-//import javax.swing.KeyStroke;
-import javax.swing.table.TableCellEditor;
-
-
-/**
- Editor for table cell with GUID value.
- @since PackageEditor 1.0
- **/
-public class GuidEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- String currentGuid;
- JButton button;
- GenGuidDialog dialog;
- protected static final String EDIT = "edit";
-
- public GuidEditor(JFrame frame) {
-
- button = new JButton();
- button.setActionCommand(EDIT);
- button.addActionListener(this);
-// button.registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0, false), JComponent.WHEN_FOCUSED);
- button.setBorderPainted(false);
-
-
- dialog = new GenGuidDialog(this, frame);
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int)
- */
- public Component getTableCellEditorComponent(JTable arg0, Object arg1, boolean arg2, int arg3, int arg4) {
- // TODO Auto-generated method stub
- currentGuid = (String)arg1;
- return button;
- }
-
- /* (non-Javadoc)
- * @see javax.swing.CellEditor#getCellEditorValue()
- */
- public Object getCellEditorValue() {
- // TODO Auto-generated method stub
- return currentGuid;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- if (EDIT.equals(arg0.getActionCommand())) {
- //The user has clicked the cell, so
- //bring up the dialog.
- button.setText(currentGuid);
- dialog.setGuid(currentGuid);
- dialog.setVisible(true);
-
- //Make the renderer reappear.
- fireEditingStopped();
- }
- else { //User pressed dialog's "OK" button.
- currentGuid = dialog.getGuid();
-// button.setText(currentGuid);
- dialog.dispose();
- }
-
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java deleted file mode 100644 index 922d1355e8..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java +++ /dev/null @@ -1,1885 +0,0 @@ -/** @file
- Java class SpdFileContents is used to parse spd xml file.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-
-
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
-import org.apache.xmlbeans.XmlCursor;
-
-import org.tianocore.GuidDeclarationsDocument;
-
-import org.tianocore.LibraryClassDeclarationsDocument;
-
-import org.tianocore.ModuleTypeDef;
-import org.tianocore.MsaFilesDocument;
-import org.tianocore.PackageDefinitionsDocument;
-import org.tianocore.PackageHeadersDocument;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.PcdDataTypes;
-import org.tianocore.PcdDeclarationsDocument;
-import org.tianocore.PpiDeclarationsDocument;
-import org.tianocore.ProtocolDeclarationsDocument;
-import org.tianocore.SpdHeaderDocument;
-import org.tianocore.GuidDeclarationsDocument.GuidDeclarations;
-
-/**
- This class processes spd file contents such as add remove xml elements.
-
- @since PackageEditor 1.0
-**/
-
-public class SpdFileContents {
-
- private File file = null;
-
- private PackageSurfaceAreaDocument psad = null;
-
- private PackageSurfaceAreaDocument.PackageSurfaceArea psaRoot = null;
-
- private SpdHeaderDocument.SpdHeader spdHdr = null;
-
- private PackageDefinitionsDocument.PackageDefinitions spdPkgDefs = null;
-
- private LibraryClassDeclarationsDocument.LibraryClassDeclarations spdLibClassDeclarations = null;
-
- private MsaFilesDocument.MsaFiles spdMsaFiles = null;
-
- private PackageHeadersDocument.PackageHeaders spdModHdrs = null;
-
- private GuidDeclarationsDocument.GuidDeclarations spdGuidDeclarations = null;
-
- private ProtocolDeclarationsDocument.ProtocolDeclarations spdProtocolDeclarations = null;
-
- private PpiDeclarationsDocument.PpiDeclarations spdPpiDeclarations = null;
-
- private PcdDeclarationsDocument.PcdDeclarations spdPcdDefinitions = null;
-
- /**
- Constructor to create a new spd file
- **/
- public SpdFileContents() {
-
- psad = PackageSurfaceAreaDocument.Factory.newInstance();
- psaRoot = psad.addNewPackageSurfaceArea();
-
- }
-
- /**
- Constructor for existing document object
- @param psa
- **/
- public SpdFileContents(PackageSurfaceAreaDocument.PackageSurfaceArea psa) {
- psaRoot = psa;
- spdHdr = psaRoot.getSpdHeader();
- spdPkgDefs = psaRoot.getPackageDefinitions();
- }
- /**
- Constructor based on an existing spd file
-
- @param f Existing spd file
- **/
- public SpdFileContents(File f) {
- try {
- psad = PackageSurfaceAreaDocument.Factory.parse(f);
- psaRoot = psad.getPackageSurfaceArea();
- file = f;
- } catch (Exception e) {
- System.out.println(e.toString());
- }
- }
-
- /**
- Remove existing pcd definitions elements using XmlCursor
- **/
- public void removeSpdPcdDefinition() {
- XmlObject o = psaRoot.getPcdDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdPcdDefinitions = null;
- cursor.dispose();
- }
-
- public void removeSpdPcdDefinition(int i){
- XmlObject o = psaRoot.getPcdDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdPcdDefinitionCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- /**
- Remove existing ppi declarations using XmlCursor
- **/
- public void removeSpdPpiDeclaration() {
- XmlObject o = psaRoot.getPpiDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdPpiDeclarations = null;
- cursor.dispose();
- }
-
- public void removeSpdPpiDeclaration(int i){
- XmlObject o = psaRoot.getPpiDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdPpiDeclarationCount() == 0){
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
- /**
- Remove existing protocols declarations using XmlCursor
- **/
- public void removeSpdProtocolDeclaration() {
- XmlObject o = psaRoot.getProtocolDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdProtocolDeclarations = null;
- cursor.dispose();
- }
-
- public void removeSpdProtocolDeclaration(int i) {
- XmlObject o = psaRoot.getProtocolDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdProtocolDeclarationCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
- /**
- Remove existing GUID declarations using XmlCursor
- **/
- public void removeSpdGuidDeclaration() {
- XmlObject o = psaRoot.getGuidDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdGuidDeclarations = null;
- cursor.dispose();
- }
-
- public void removeSpdGuidDeclaration(int i) {
- XmlObject o = psaRoot.getGuidDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdGuidDeclarationCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- /**
- Remove existing spd package include files using XmlCursor
- **/
- public void removeSpdPkgHeader() {
- XmlObject o = psaRoot.getPackageHeaders();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdModHdrs = null;
- cursor.dispose();
- }
-
- public void removeSpdPkgHeader(int i){
- XmlObject o = psaRoot.getPackageHeaders();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdPackageHeaderCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- /**
- Remove existing msa files using XmlCursor
- **/
- public void removeSpdMsaFile() {
- XmlObject o = psaRoot.getMsaFiles();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdMsaFiles = null;
- cursor.dispose();
- }
-
- public void removeSpdMsaFile(int i){
- XmlObject o = psaRoot.getMsaFiles();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdMsaFileCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- /**
- Remove existing library class declarations using XmlCursor
- **/
- public void removeSpdLibClass() {
- XmlObject o = psaRoot.getLibraryClassDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- spdLibClassDeclarations = null;
- cursor.dispose();
- }
-
- public void removeSpdLibClass(int i) {
- XmlObject o = psaRoot.getLibraryClassDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getSpdLibClassDeclarationCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- public void updateSpdLibClass(int i, String lib, String hdr, String hlp, String clsUsage, String instanceVer, String hdrAttribArch, String hdrAttribModType) {
- XmlObject o = psaRoot.getLibraryClassDeclarations();
- if (o == null)
- return;
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass lc = (LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass)cursor.getObject();
- lc.setName(lib);
- lc.setIncludeHeader(hdr);
- lc.setHelpText(hlp);
- if (clsUsage != null) {
- lc.setRecommendedInstanceGuid(clsUsage);
- if (instanceVer != null){
- lc.setRecommendedInstanceVersion(instanceVer);
- } else {
- if (lc.isSetRecommendedInstanceVersion()) {
- lc.unsetRecommendedInstanceVersion();
- }
- }
- } else {
- if (lc.isSetRecommendedInstanceGuid()) {
- lc.unsetRecommendedInstanceGuid();
- }
- if (lc.isSetRecommendedInstanceVersion()) {
- lc.unsetRecommendedInstanceVersion();
- }
- }
-
- if (stringToList(hdrAttribArch) != null){
- lc.setSupArchList(stringToList(hdrAttribArch));
- } else {
- if (lc.isSetSupArchList()) {
- lc.unsetSupArchList();
- }
- }
- if (stringToList(hdrAttribModType) != null){
- lc.setSupModuleList(stringToList(hdrAttribModType));
- } else {
- if (lc.isSetSupModuleList()) {
- lc.unsetSupModuleList();
- }
- }
- }
-
- cursor.dispose();
- }
-
- public void updateSpdMsaFile(int i, String msaFile, String mName, String v, String g){
- XmlObject o = psaRoot.getMsaFiles();
- if (o == null)
- return;
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.setTextValue(msaFile);
-
- }
-
- cursor.dispose();
- }
-
- public void updateSpdGuidDecl(int i, String name, String cName, String guid, String hlp, String archList,
- String modTypeList, String guidTypeList){
- XmlObject o = psaRoot.getGuidDeclarations();
- if (o == null){
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- GuidDeclarationsDocument.GuidDeclarations.Entry e = (GuidDeclarationsDocument.GuidDeclarations.Entry)cursor.getObject();
- e.setName(name);
- e.setCName(cName);
- e.setGuidValue(guid);
- e.setHelpText(hlp);
- if (stringToList(guidTypeList) != null) {
- e.setGuidTypeList(stringToList(guidTypeList));
- }
- else{
- if (e.isSetGuidTypeList()) {
- e.unsetGuidTypeList();
- }
- }
- if (stringToList(archList) != null){
- e.setSupArchList(stringToList(archList));
- }
- else{
- if (e.isSetSupArchList()) {
- e.unsetSupArchList();
- }
- }
- if (stringToList(modTypeList) != null) {
- e.setSupModuleList(stringToList(modTypeList));
- }
- else{
- if (e.isSetSupModuleList()) {
- e.unsetSupModuleList();
- }
- }
-
- }
- cursor.dispose();
- }
-
- public void updateSpdPpiDecl(int i, String name, String cName, String guid, String hlp, String archList,
- String modTypeList, String guidTypeList){
- XmlObject o = psaRoot.getPpiDeclarations();
- if (o == null){
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- PpiDeclarationsDocument.PpiDeclarations.Entry e = (PpiDeclarationsDocument.PpiDeclarations.Entry)cursor.getObject();
- e.setName(name);
- e.setCName(cName);
- e.setGuidValue(guid);
- e.setHelpText(hlp);
- if (stringToList(guidTypeList) != null) {
- e.setGuidTypeList(stringToList(guidTypeList));
- }
- else{
- if (e.isSetGuidTypeList()) {
- e.unsetGuidTypeList();
- }
- }
- if (stringToList(archList) != null){
- e.setSupArchList(stringToList(archList));
- }
- else{
- if (e.isSetSupArchList()) {
- e.unsetSupArchList();
- }
- }
- if (stringToList(modTypeList) != null) {
- e.setSupModuleList(stringToList(modTypeList));
- }
- else{
- if (e.isSetSupModuleList()) {
- e.unsetSupModuleList();
- }
- }
- }
- cursor.dispose();
- }
-
- public void updateSpdProtocolDecl(int i, String name, String cName, String guid, String hlp, String archList,
- String modTypeList, String guidTypeList){
- XmlObject o = psaRoot.getProtocolDeclarations();
- if (o == null){
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- ProtocolDeclarationsDocument.ProtocolDeclarations.Entry e = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry)cursor.getObject();
- e.setName(name);
- e.setCName(cName);
- e.setGuidValue(guid);
- e.setHelpText(hlp);
- if (stringToList(guidTypeList) != null) {
- e.setGuidTypeList(stringToList(guidTypeList));
- }
- else{
- if (e.isSetGuidTypeList()) {
- e.unsetGuidTypeList();
- }
- }
- if (stringToList(archList) != null){
- e.setSupArchList(stringToList(archList));
- }
- else{
- if (e.isSetSupArchList()) {
- e.unsetSupArchList();
- }
- }
- if (stringToList(modTypeList) != null) {
- e.setSupModuleList(stringToList(modTypeList));
- }
- else{
- if (e.isSetSupModuleList()) {
- e.unsetSupModuleList();
- }
- }
- }
- cursor.dispose();
- }
-
- public void updateSpdPkgHdr(int i, String pkgName, String hdrName){
- XmlObject o = psaRoot.getPackageHeaders();
- if (o == null){
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
-
- PackageHeadersDocument.PackageHeaders.IncludePkgHeader iph = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader)cursor.getObject();
- iph.setModuleType(ModuleTypeDef.Enum.forString(pkgName));
- iph.setStringValue(hdrName);
- }
- cursor.dispose();
- }
-
- public void updateSpdPcdDefinition(int i, String cName, String token, String dataType, String pcdItemTypes,
- String spaceGuid, String defaultString, String help, String archList, String modTypeList){
- XmlObject o = psaRoot.getPcdDeclarations();
- if (o == null)
- return;
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry e = (PcdDeclarationsDocument.PcdDeclarations.PcdEntry)cursor.getObject();
- e.setCName(cName);
- e.setToken(token);
- e.setDatumType(PcdDataTypes.Enum.forString(dataType));
- if (pcdItemTypes != null && pcdItemTypes.length() > 0) {
- String usage[] = pcdItemTypes.split("( )+");
- List<String> l = new ArrayList<String>();
- for (int k = 0; k < usage.length; ++k) {
- l.add(usage[k]);
- }
- e.setValidUsage(l);
- }
-
- e.setTokenSpaceGuidCName(spaceGuid);
- e.setDefaultValue(defaultString);
- e.setHelpText(help);
- if (stringToList(archList) != null){
- e.setSupArchList(stringToList(archList));
- }
- else{
- if (e.isSetSupArchList()) {
- e.unsetSupArchList();
- }
- }
- if (stringToList(modTypeList) != null) {
- e.setSupModuleList(stringToList(modTypeList));
- }
- else{
- if (e.isSetSupModuleList()) {
- e.unsetSupModuleList();
- }
- }
-
- }
- cursor.dispose();
- }
- /**
- Get spd file header contents into String array
-
- @param s Caller allocated String array
- **/
- public void getSpdHdrDetails(String[] s) {
- if (getSpdHdr() == null) {
- spdHdr = psaRoot.addNewSpdHeader();
- }
- s[0] = getSpdHdrPkgName();
- s[1] = getSpdHdr().getGuidValue();
- s[2] = getSpdHdrVer();
-// s[3] = getSpdHdr().getAbstract();
- s[4] = getSpdHdr().getDescription();
- s[5] = getSpdHdr().getCopyright();
- s[6] = getSpdHdrLicense();
-
- }
-
- /**
- Get the number of library class declarations from the size of List
-
- @return int
- **/
- public int getSpdLibClassDeclarationCount() {
- if (psaRoot.getLibraryClassDeclarations() == null
- || psaRoot.getLibraryClassDeclarations().getLibraryClassList() == null) {
- return 0;
- }
- return psaRoot.getLibraryClassDeclarations().getLibraryClassList().size();
- }
-
- /**
- Get available library class declaration into String array
- @param libClass Caller allocated two-dimentional String array
- **/
- public void getSpdLibClassDeclarations(String[][] libClass) {
- if (psaRoot.getLibraryClassDeclarations() == null){
- return;
- }
-
- List<LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass> l = psaRoot.getLibraryClassDeclarations().getLibraryClassList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass lc = (LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass) li.next();
- if (lc != null) {
- libClass[i][0] = lc.getName();
- libClass[i][1] = lc.getIncludeHeader();
- libClass[i][2] = lc.getHelpText();
-// LAH added logic so you cannot set the version unless the GUID is defined.
-
-// if (lc.getRecommendedInstanceGuid() != null) {
- libClass[i][3] = lc.getRecommendedInstanceGuid();
-// if (lc.getRecommendedInstanceVersion() != null) {
- libClass[i][4] = lc.getRecommendedInstanceVersion();
-// }
-// }
-
- if (lc.getSupArchList() != null) {
- libClass[i][5] = listToString(lc.getSupArchList());
- }
- if (lc.getSupModuleList() != null) {
- libClass[i][6] = listToString(lc.getSupModuleList());
- }
-
- }
-
- i++;
- }
-
- }
-
- /**
- Get the number of Msa files from the size of List
-
- @return int
- **/
- public int getSpdMsaFileCount() {
- if (psaRoot.getMsaFiles() == null || psaRoot.getMsaFiles().getFilenameList() == null) {
- return 0;
- }
- return psaRoot.getMsaFiles().getFilenameList().size();
- }
-
- /**
- Get available Msa file into String array
-
- @param msaFile Caller allocated two-dimentional String array
- **/
- public void getSpdMsaFiles(String[][] msaFile) {
- if (psaRoot.getMsaFiles() == null) {
- return;
- }
- List<String> l = psaRoot.getMsaFiles().getFilenameList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- msaFile[i][0] = (String)li.next();
-
- i++;
- }
- }
-
- /**
- Get the number of include header files in PackageHeaders from the size of List
-
- @return int
- **/
- public int getSpdPackageHeaderCount() {
- if (psaRoot.getPackageHeaders() == null || psaRoot.getPackageHeaders().getIncludePkgHeaderList() == null) {
- return 0;
- }
- return psaRoot.getPackageHeaders().getIncludePkgHeaderList().size();
- }
-
- /**
- Get available package header contents into String array
-
- @param pkgHeader Caller allocated two-dimentional String array
- **/
- public void getSpdPackageHeaders(String[][] pkgHeader) {
- if (psaRoot.getPackageHeaders() == null) {
- return;
- }
-
- List<PackageHeadersDocument.PackageHeaders.IncludePkgHeader> l = psaRoot.getPackageHeaders().getIncludePkgHeaderList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- PackageHeadersDocument.PackageHeaders.IncludePkgHeader ih = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader) li.next();
- if (ih.getModuleType() != null) {
- pkgHeader[i][0] = ih.getModuleType().toString();
- }
-
- pkgHeader[i][1] = ih.getStringValue();
- i++;
- }
- }
-
- public void getSpdGuidDeclWithType (Vector<String> vGuidCName, String type) {
- if (psaRoot.getGuidDeclarations() == null) {
- return;
- }
- List<GuidDeclarationsDocument.GuidDeclarations.Entry> l = psaRoot.getGuidDeclarations().getEntryList();
- for (int i = 0; i < l.size(); ++i) {
- if (l.get(i).getGuidTypeList() == null || l.get(i).getGuidTypeList().contains(type)) {
- vGuidCName.add(l.get(i).getCName());
- }
- }
- }
- /**
- Get the number of GUID declarations from the size of List
-
- @return int
- **/
- public int getSpdGuidDeclarationCount() {
- if (psaRoot.getGuidDeclarations() == null || psaRoot.getGuidDeclarations().getEntryList() == null) {
- return 0;
- }
- return psaRoot.getGuidDeclarations().getEntryList().size();
- }
-
- /**
- Get available Guid declaration contents into String array
-
- @param guid Caller allocated two-dimentional String array
- **/
- public void getSpdGuidDeclarations(String[][] guid) {
- if (psaRoot.getGuidDeclarations() == null) {
- return;
- }
-
- List<GuidDeclarationsDocument.GuidDeclarations.Entry> l = psaRoot.getGuidDeclarations().getEntryList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- GuidDeclarationsDocument.GuidDeclarations.Entry e = (GuidDeclarationsDocument.GuidDeclarations.Entry) li
- .next();
- guid[i][0] = e.getName();
- guid[i][1] = e.getCName();
- if (e.getGuidValue() != null) {
- guid[i][2] = e.getGuidValue();
- }
- guid[i][3] = e.getHelpText();
- guid[i][4] = listToString(e.getSupArchList());
- guid[i][5] = listToString(e.getSupModuleList());
- guid[i][6] = listToString(e.getGuidTypeList());
- i++;
- }
- }
-
- /**
- Get the number of protocol declarations from the size of List
-
- @return int
- **/
- public int getSpdProtocolDeclarationCount() {
- if (psaRoot.getProtocolDeclarations() == null || psaRoot.getProtocolDeclarations().getEntryList() == null) {
- return 0;
- }
- return psaRoot.getProtocolDeclarations().getEntryList().size();
- }
-
- /**
- Get available protocol declaration contents into String array
-
- @param protocol Caller allocated two-dimentional String array
- **/
- public void getSpdProtocolDeclarations(String[][] protocol) {
- if (psaRoot.getProtocolDeclarations() == null) {
- return;
- }
-
- List<ProtocolDeclarationsDocument.ProtocolDeclarations.Entry> l = psaRoot.getProtocolDeclarations()
- .getEntryList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- ProtocolDeclarationsDocument.ProtocolDeclarations.Entry e = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry) li
- .next();
- protocol[i][0] = e.getName();
- protocol[i][1] = e.getCName();
- if (e.getGuidValue() != null) {
- protocol[i][2] = e.getGuidValue();
- }
- protocol[i][3] = e.getHelpText();
- protocol[i][4] = listToString(e.getSupArchList());
- protocol[i][5] = listToString(e.getSupModuleList());
- protocol[i][6] = listToString(e.getGuidTypeList());
- i++;
- }
- }
-
- /**
- Get the number of Ppi declarations from the size of List
-
- @return int
- **/
- public int getSpdPpiDeclarationCount() {
- if (psaRoot.getPpiDeclarations() == null || psaRoot.getPpiDeclarations().getEntryList() == null) {
- return 0;
- }
- return psaRoot.getPpiDeclarations().getEntryList().size();
- }
-
- /**
- Get available Ppi declaration contents into String array
-
- @param ppi Caller allocated two-dimentional String array
- **/
- public void getSpdPpiDeclarations(String[][] ppi) {
- if (psaRoot.getPpiDeclarations() == null) {
- return;
- }
-
- List<PpiDeclarationsDocument.PpiDeclarations.Entry> l = psaRoot.getPpiDeclarations().getEntryList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- PpiDeclarationsDocument.PpiDeclarations.Entry e = (PpiDeclarationsDocument.PpiDeclarations.Entry) li.next();
- ppi[i][0] = e.getName();
- ppi[i][1] = e.getCName();
- if (e.getGuidValue() != null) {
- ppi[i][2] = e.getGuidValue();
- }
- ppi[i][3] = e.getHelpText();
- ppi[i][4] = listToString(e.getSupArchList());
- ppi[i][5] = listToString(e.getSupModuleList());
- ppi[i][6] = listToString(e.getGuidTypeList());
- i++;
- }
- }
-
- /**
- Get the number of Pcd definitions from the size of List
-
- @return int
- **/
- public int getSpdPcdDefinitionCount() {
- if (psaRoot.getPcdDeclarations() == null || psaRoot.getPcdDeclarations().getPcdEntryList() == null) {
- return 0;
- }
- return psaRoot.getPcdDeclarations().getPcdEntryList().size();
- }
-
- /**
- Get available Pcd definition contents into String array
-
- @param pcd Caller allocated two-dimentional String array
- **/
- public void getSpdPcdDefinitions(String[][] pcd, String pcdUsage[][]) {
- if (psaRoot.getPcdDeclarations() == null) {
- return;
- }
-
- List<PcdDeclarationsDocument.PcdDeclarations.PcdEntry> l = psaRoot.getPcdDeclarations().getPcdEntryList();
- int i = 0;
- while (i < l.size()) {
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry e = (PcdDeclarationsDocument.PcdDeclarations.PcdEntry)l.get(i);
- pcd[i][0] = e.getCName();
- pcd[i][1] = e.getToken() + "";
- pcd[i][2] = e.getTokenSpaceGuidCName();
- if (e.getDatumType() != null) {
- pcd[i][3] = e.getDatumType().toString();
- }
- pcd[i][4] = e.getDefaultValue()+"";
- pcd[i][5] = e.getHelpText();
- String archList = listToString(e.getSupArchList());
- if (archList != null) {
- pcd[i][6] = archList;
- }
- String modTypeList = listToString(e.getSupModuleList());
- if (modTypeList != null) {
- pcd[i][7] = modTypeList;
- }
-
- int j = 0;
- while (j < e.getValidUsage().size() && j < 5) {
- pcdUsage[i][j] = (String)e.getValidUsage().get(j);
- ++j;
- }
- i++;
- }
- }
-
- /**
- Save the processed xml contents to file
-
- @param spdFile The file to save xml contents
- @throws IOException Exceptions during file operation
- **/
- public void saveAs(File spdFile) throws IOException {
-
- XmlOptions options = new XmlOptions();
-
- options.setCharacterEncoding("UTF-8");
- options.setSavePrettyPrint();
- options.setSavePrettyPrintIndent(2);
- try {
- psad.save(spdFile, options);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
-
- /**
- Generate SpdHeader contents using parameters passed in.
-
- @param pkgName PackageName
- @param pkgGuid Guid
- @param pkgVer Version
- @param pkgAbs Abstract
- @param pkgDes Description
- @param pkgCpRight Copyright
- @param pkgLicense License
- @param pkgCreateDate Created
- @param pkgUpdateDate Updated
- @param pkgURL URL
- @param pkgType PackageType
- @param pkgRdOnly ReadOnly
- @param pkgRePkg RePackage
- @param pkgSpec Reserved
- @param pkgOutDir Reserved
- **/
- public void genSpdHeader(String pkgName, String pkgGuid, String pkgVer, String pkgAbs, String pkgDes,
- String pkgCpRight, String pkgLicense, String pkgCreateDate, String pkgUpdateDate,
- String pkgURL, String pkgType, String pkgRdOnly, String pkgRePkg, String pkgSpec,
- String pkgOutDir) {
- if (getSpdHdr() == null) {
- spdHdr = psaRoot.addNewSpdHeader();
- }
-
- setSpdHdrPkgName(pkgName);
- setSpdHdrGuidValue(pkgGuid);
- setSpdHdrVer(pkgVer);
- setSpdHdrAbs(pkgAbs);
- setSpdHdrDescription(pkgDes);
- setSpdHdrCopyright(pkgCpRight);
- setSpdHdrLicense(pkgLicense);
-
-
- setSpdHdrSpec(pkgSpec);
- }
-
- /**
- Generate library class declaration element using parameters passed in
-
- @param libClassBaseName LibraryClass element value
- @param libClassUsage Reserved
- @param incHdrFileName IncludeHeader element value
- @param incHdrAttribGuid Reserved
- @param incHdrAttribArch Reserved
- @param incHdrAttribPath Reserved
- @param incHdrAttribClass Reserved
- @param incHdrAttribVer Reserved
- @param incHdrAttribOverrideID Reserved
- @param incHdrAttribModuleType Reserved
- **/
- public void genSpdLibClassDeclarations(String libClassBaseName, String instanceUsage, String incHdrFileName,
- String help, String incHdrAttribArch, String incHdrAttribPath,
- String incHdrAttribClass, String incHdrAttribVer,
- String incHdrAttribOverrideID, String incHdrAttribModuleType) {
- if (getSpdLibClassDeclarations() == null) {
- spdLibClassDeclarations = psaRoot.addNewLibraryClassDeclarations();
- }
- //
- // add contents under LibraryClassDeclarations tag
- //
- setSpdLibClassDeclaration(libClassBaseName, instanceUsage, incHdrFileName, help, incHdrAttribArch,
- incHdrAttribPath, incHdrAttribClass, incHdrAttribVer, incHdrAttribOverrideID,
- incHdrAttribModuleType, spdLibClassDeclarations);
- }
-
- public void getSpdLibClassDeclaration(String[] sa, int i) {
- if (getSpdLibClassDeclarations() == null) {
- return;
- }
- XmlCursor cursor = getSpdLibClassDeclarations().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass lc = (LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass)cursor.getObject();
- sa[0] = lc.getName();
- sa[1] = lc.getIncludeHeader();
- sa[2] = lc.getHelpText();
- sa[3] = lc.getRecommendedInstanceGuid();
- sa[4] = lc.getRecommendedInstanceVersion();
- sa[5] = listToString(lc.getSupArchList());
- sa[6] = listToString(lc.getSupModuleList());
- }
- cursor.dispose();
- }
-
- /**
- Set library class declaration contents under parent tag
-
- @param clsName LibraryClass element value
- @param clsUsage Reserved
- @param hdrFile IncludeHeader element value
- @param hdrAttribGuid Reserved
- @param hdrAttribArch Reserved
- @param hdrAttribPath Reserved
- @param hdrAttribClass Reserved
- @param hdrAttribVer Reserved
- @param hdrAttribOverID Reserved
- @param hdrAttribModType Reserved
- @param parent The tag under which library class declaration goes to
- **/
- public void setSpdLibClassDeclaration(String clsName, String clsUsage, String hdrFile, String help,
- String hdrAttribArch, String hdrAttribPath, String hdrAttribClass,
- String instanceVer, String hdrAttribOverID, String hdrAttribModType,
- XmlObject parent) {
-
- setSpdLibraryClass(clsName, hdrFile, help, clsUsage, instanceVer, hdrAttribArch, hdrAttribModType, parent);
-
- }
-
- /**
- Set the contents of LibraryClass under parent element
-
- @param clsName LibraryClass element value
- @param clsUsage Reserved
- @param parent The tag under which library class declaration goes to
- **/
- public void setSpdLibraryClass(String clsName, String clsIncludeFile, String help, String clsUsage, String instanceVer, String hdrAttribArch, String hdrAttribModType, XmlObject parent) {
- LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass lc = ((LibraryClassDeclarationsDocument.LibraryClassDeclarations) parent).addNewLibraryClass();
- lc.setName(clsName);
- lc.setIncludeHeader(clsIncludeFile);
- lc.setHelpText(help);
-// LAH added logic so you cannot set the version unless the GUID is defined.
-
- if (clsUsage != null) {
- lc.setRecommendedInstanceGuid(clsUsage);
- if (instanceVer != null) {
- lc.setRecommendedInstanceVersion(instanceVer);
- }
- }
- else {
- if (lc.isSetRecommendedInstanceGuid()) {
- lc.unsetRecommendedInstanceGuid();
- }
- if (lc.isSetRecommendedInstanceVersion()) {
- lc.unsetRecommendedInstanceVersion();
- }
- }
-
- if (hdrAttribArch != null) {
- lc.setSupArchList(stringToList(hdrAttribArch));
- } else {
- if (lc.isSetSupArchList()) {
- lc.unsetSupArchList();
- }
- }
-
- if (hdrAttribModType != null) {
- lc.setSupModuleList(stringToList(hdrAttribModType));
- } else {
- if (lc.isSetSupModuleList()) {
- lc.unsetSupModuleList();
- }
- }
-
- }
-
- /**
- Set contents of IncludeHeader under parent element
-
- @param modType Reserved
- @param hdrFile IncludeHeader element value
- @param hdrAttribGuid Reserved
- @param hdrAttribArch Reserved
- @param hdrAttribPath Reserved
- @param hdrAttribClass Reserved
- @param hdrAttribVer Reserved
- @param hdrAttribOverID Reserved
- @param parent The tag under which library class declaration goes to
- **/
- public void setSpdIncludeHeader(String modType, String hdrFile, String hdrAttribGuid, String hdrAttribArch,
- String hdrAttribPath, String hdrAttribClass, String hdrAttribVer,
- String hdrAttribOverID, XmlObject parent) {
-
- if (parent instanceof LibraryClassDeclarationsDocument.LibraryClassDeclarations) {
- } else if (parent instanceof PackageHeadersDocument.PackageHeaders) {
- PackageHeadersDocument.PackageHeaders.IncludePkgHeader ih = null;
- ih = ((PackageHeadersDocument.PackageHeaders) parent).addNewIncludePkgHeader();
- ih.setStringValue(hdrFile);
- ih.setModuleType(ModuleTypeDef.Enum.forString(modType));
- } else {
- return;
- }
-
- if (hdrAttribGuid != null) {
- }
- if (hdrAttribPath != null) {
- }
- if (hdrAttribClass != null) {
- }
- if (hdrAttribVer != null) {
- }
- if (hdrAttribOverID != null) {
- }
-
- }
-
- /**
- Generate MsaFile element.
-
- @param msaFileName MsaFile element value
- @param archType Reserved
- **/
- public void genSpdMsaFiles(String msaFileName, String moduleName, String ver, String guid) {
- if (getSpdMsaFiles() == null) {
- spdMsaFiles = psaRoot.addNewMsaFiles();
- }
- setSpdMsaFile(msaFileName, moduleName, ver, guid, spdMsaFiles);
-
- }
-
- public void getSpdMsaFile (String[] sa, int i) {
- if (getSpdMsaFiles() == null) {
- return;
- }
- XmlCursor cursor = getSpdMsaFiles().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- sa[0] = cursor.getTextValue();
- }
- cursor.dispose();
- }
-
- /**
- Set MsaFile contents under parent element.
-
- @param msaFileName MsaFile element value
- @param parent Element under which MsaFile goes to
- **/
- public void setSpdMsaFile(String msaFileName, String moduleName, String ver, String guid, XmlObject parent) {
- MsaFilesDocument.MsaFiles f = (MsaFilesDocument.MsaFiles)parent;
- f.addNewFilename().setStringValue(msaFileName);
-// f.setFilename(msaFileName);
-// f.setModuleName(moduleName);
-// f.setModuleVersion(ver);
-// f.setModuleGuid(guid);
- }
-
- /**
- Generate PackageHeader element using parameters passed in.
-
- @param ModHdrModType ModuleType attribute of IncludeHeader element
- @param hdrFile IncludeHeader element value
- @param hdrAttribGuid Reserved
- @param hdrAttribArch Reserved
- @param hdrAttribPath Reserved
- @param hdrAttribClass Reserved
- @param hdrAttribVer Reserved
- @param hdrAttribOverID Reserved
- **/
- public void genSpdModuleHeaders(String ModHdrModType, String hdrFile, String hdrAttribGuid, String hdrAttribArch,
- String hdrAttribPath, String hdrAttribClass, String hdrAttribVer,
- String hdrAttribOverID) {
- if (getSpdModHdrs() == null) {
- spdModHdrs = psaRoot.addNewPackageHeaders();
- }
-
- //
- // add IncludeHeader under PackageHeaders element
- //
- setSpdIncludeHeader(ModHdrModType, hdrFile, hdrAttribGuid, hdrAttribArch, hdrAttribPath, hdrAttribClass,
- hdrAttribVer, hdrAttribOverID, spdModHdrs);
- }
-
- public void getSpdModuleHeader(String[] sa, int i) {
- if (getSpdModHdrs() == null) {
- return;
- }
- XmlCursor cursor = getSpdModHdrs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- PackageHeadersDocument.PackageHeaders.IncludePkgHeader ih = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader)cursor.getObject();
- sa[0] = ih.getModuleType()+"";
- sa[1] = ih.getStringValue();
- }
- cursor.dispose();
- }
-
- /**
- Generate GUID declaration element using parameters passed in.
-
- @param guidDeclEntryName Name attribute of Entry element
- @param guidDeclCName CName element value
- @param guidDeclGuid Guid element value
- @param guidDeclFeatureFlag Reserved
- **/
- public void genSpdGuidDeclarations(String guidDeclEntryName, String guidDeclCName, String guidDeclGuid,
- String guidDeclHelp, Vector<String> archList, Vector<String> modTypeList,
- Vector<String> guidTypeList) {
- if (getSpdGuidDeclarations() == null) {
- spdGuidDeclarations = psaRoot.addNewGuidDeclarations();
- }
-
- setSpdEntry(guidDeclEntryName, guidDeclCName, guidDeclGuid, guidDeclHelp, archList, modTypeList, guidTypeList, spdGuidDeclarations);
- }
-
- /**
- Generate protocol declaration element using parameters passed in.
-
- @param protocolDeclEntryName Name attribute of Entry element
- @param protocolDeclCName CName element value
- @param protocolDeclGuid Guid element value
- @param protocolDeclFeatureFlag Reserved
- **/
- public void genSpdProtocolDeclarations(String protocolDeclEntryName, String protocolDeclCName,
- String protocolDeclGuid, String protocolDeclFeatureFlag,
- Vector<String> archList, Vector<String> modTypeList, Vector<String> guidTypeList) {
- if (getSpdProtocolDeclarations() == null) {
- spdProtocolDeclarations = psaRoot.addNewProtocolDeclarations();
- }
-
- setSpdEntry(protocolDeclEntryName, protocolDeclCName, protocolDeclGuid, protocolDeclFeatureFlag,
- archList, modTypeList, guidTypeList, spdProtocolDeclarations);
- }
-
- /**
- Generate PPI declaration element using parameters passed in.
-
- @param ppiDeclEntryName Name attribute of Entry element
- @param ppiDeclCName CName element value
- @param ppiDeclGuid Guid element value
- @param ppiDeclFeatureFlag Reserved
- **/
- public void genSpdPpiDeclarations(String ppiDeclEntryName, String ppiDeclCName, String ppiDeclGuid,
- String ppiDeclFeatureFlag, Vector<String> archList, Vector<String> modTypeList, Vector<String> guidTypeList) {
- if (getSpdPpiDeclarations() == null) {
- spdPpiDeclarations = psaRoot.addNewPpiDeclarations();
- }
-
- setSpdEntry(ppiDeclEntryName, ppiDeclCName, ppiDeclGuid, ppiDeclFeatureFlag, archList, modTypeList, guidTypeList, spdPpiDeclarations);
- }
-
- public void getSpdGuidDeclaration(String[] sa, int i) {
- if (getSpdGuidDeclarations() == null) {
- return;
- }
- getSpdEntry(sa, i, getSpdGuidDeclarations());
- }
-
- public void getSpdProtocolDeclaration(String[] sa, int i) {
- if (getSpdProtocolDeclarations() == null) {
- return;
- }
- getSpdEntry(sa, i, getSpdProtocolDeclarations());
- }
-
- public void getSpdPpiDeclaration(String[] sa, int i) {
- if (getSpdPpiDeclarations() == null) {
- return;
- }
- getSpdEntry(sa, i, getSpdPpiDeclarations());
- }
-
- public void getSpdEntry(String[] sa, int i, XmlObject parent) {
- XmlCursor cursor = parent.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- if (parent instanceof GuidDeclarationsDocument.GuidDeclarations) {
- GuidDeclarationsDocument.GuidDeclarations.Entry e = (GuidDeclarationsDocument.GuidDeclarations.Entry)cursor.getObject();
- sa[0] = e.getName();
- sa[1] = e.getCName();
- sa[2] = e.getGuidValue();
- sa[3] = e.getHelpText();
- sa[4] = listToString(e.getSupArchList());
- sa[5] = listToString(e.getSupModuleList());
- sa[6] = listToString(e.getGuidTypeList());
- }
-
- if (parent instanceof ProtocolDeclarationsDocument.ProtocolDeclarations) {
- ProtocolDeclarationsDocument.ProtocolDeclarations.Entry e = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry)cursor.getObject();
- sa[0] = e.getName();
- sa[1] = e.getCName();
- sa[2] = e.getGuidValue();
- sa[3] = e.getHelpText();
- sa[4] = listToString(e.getSupArchList());
- sa[5] = listToString(e.getSupModuleList());
- sa[6] = listToString(e.getGuidTypeList());
- }
-
- if (parent instanceof PpiDeclarationsDocument.PpiDeclarations) {
- PpiDeclarationsDocument.PpiDeclarations.Entry e = (PpiDeclarationsDocument.PpiDeclarations.Entry)cursor.getObject();
- sa[0] = e.getName();
- sa[1] = e.getCName();
- sa[2] = e.getGuidValue();
- sa[3] = e.getHelpText();
- sa[4] = listToString(e.getSupArchList());
- sa[5] = listToString(e.getSupModuleList());
- sa[6] = listToString(e.getGuidTypeList());
- }
-
- }
- cursor.dispose();
- }
- /**
- Set Entry contents using parameters passed in
-
- @param entryName Name attribute of Entry element
- @param cName CName element value
- @param guid Guid element value
- @param featureFlag Reserved
- @param parent The tag under which Entry element goes to
- **/
- public void setSpdEntry(String entryName, String cName, String guid, String help,
- Vector<String> archList, Vector<String> modTypeList,
- Vector<String> guidTypeList, XmlObject parent) {
-
- if (parent instanceof GuidDeclarationsDocument.GuidDeclarations) {
- GuidDeclarationsDocument.GuidDeclarations.Entry e = ((GuidDeclarations) parent).addNewEntry();
- e.setName(entryName);
- e.setCName(cName);
- e.setGuidValue(guid);
- e.setHelpText(help);
- if (guidTypeList != null) {
- e.setGuidTypeList(guidTypeList);
- }
- else{
- if (e.isSetGuidTypeList()) {
- e.unsetGuidTypeList();
- }
- }
- if (archList != null) {
- e.setSupArchList(archList);
- }
- else {
- if (e.isSetSupArchList()) {
- e.unsetSupArchList();
- }
- }
- if (modTypeList != null){
- e.setSupModuleList(modTypeList);
- }
- else {
- if (e.isSetSupModuleList()) {
- e.unsetSupModuleList();
- }
- }
-
- return;
- }
- if (parent instanceof ProtocolDeclarationsDocument.ProtocolDeclarations) {
- ProtocolDeclarationsDocument.ProtocolDeclarations.Entry pe = ((ProtocolDeclarationsDocument.ProtocolDeclarations) parent)
- .addNewEntry();
- pe.setName(entryName);
- pe.setCName(cName);
- pe.setGuidValue(guid);
- pe.setHelpText(help);
- if (guidTypeList != null) {
- pe.setGuidTypeList(guidTypeList);
- }
- else{
- if (pe.isSetGuidTypeList()) {
- pe.unsetGuidTypeList();
- }
- }
- if (archList != null) {
- pe.setSupArchList(archList);
- }
- else {
- if (pe.isSetSupArchList()) {
- pe.unsetSupArchList();
- }
- }
- if (modTypeList != null){
- pe.setSupModuleList(modTypeList);
- }
- else {
- if (pe.isSetSupModuleList()) {
- pe.unsetSupModuleList();
- }
- }
-
- return;
- }
- if (parent instanceof PpiDeclarationsDocument.PpiDeclarations) {
- PpiDeclarationsDocument.PpiDeclarations.Entry ppe = ((PpiDeclarationsDocument.PpiDeclarations) parent)
- .addNewEntry();
- ppe.setName(entryName);
- ppe.setCName(cName);
- ppe.setGuidValue(guid);
- ppe.setHelpText(help);
- if (guidTypeList != null) {
- ppe.setGuidTypeList(guidTypeList);
- }
- else{
- if (ppe.isSetGuidTypeList()) {
- ppe.unsetGuidTypeList();
- }
- }
- if (archList != null) {
- ppe.setSupArchList(archList);
- }
- else {
- if (ppe.isSetSupArchList()) {
- ppe.unsetSupArchList();
- }
- }
- if (modTypeList != null){
- ppe.setSupModuleList(modTypeList);
- }
- else {
- if (ppe.isSetSupModuleList()) {
- ppe.unsetSupModuleList();
- }
- }
-
- return;
- }
-
- return;
-
- }
-
- /**
- Generate Pcd definition using parameters passed in
-
- @param pcdItemTypes ItemType attribute of PcdEntry element
- @param cName C_Name element value
- @param token Token element value
- @param dataType DatumType element value
- @param skuEnable Reserved
- @param sku Reserved
- @param maxSku Reserved
- @param hiiEnable Reserved
- @param varGuid Reserved
- @param varName Reserved
- @param defaultString DefaultString element value
- **/
- public void genSpdPcdDefinitions(String cName, String token, String dataType, String pcdItemTypes,
- String spaceGuid, String defaultString, String help, String archList,
- String modTypeList) {
- if (getSpdPcdDefinitions() == null) {
- spdPcdDefinitions = psaRoot.addNewPcdDeclarations();
- }
-
- setSpdPcdEntry(pcdItemTypes, cName, token, dataType, spaceGuid, help,
- defaultString, archList, modTypeList, spdPcdDefinitions);
- }
-
- public void getSpdPcdDeclaration(String[] sa, int i) {
- if (getSpdPcdDefinitions() == null) {
- return;
- }
-
- XmlCursor cursor = getSpdPcdDefinitions().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry pe = (PcdDeclarationsDocument.PcdDeclarations.PcdEntry)cursor.getObject();
- sa[0] = pe.getCName();
- sa[1] = pe.getToken()+"";
- sa[2] = pe.getTokenSpaceGuidCName();
- sa[3] = pe.getDatumType()+"";
- sa[4] = pe.getDefaultValue();
- sa[5] = pe.getHelpText();
- sa[6] = listToString(pe.getValidUsage());
- sa[7] = listToString(pe.getSupArchList());
- sa[8] = listToString(pe.getSupModuleList());
- }
- cursor.dispose();
- }
-
- /**
- Set Pcd entry contents under parent tag
-
- @param pcdItemTypes ItemType attribute of PcdEntry element
- @param cName C_Name element value
- @param token Token element value
- @param dataType DatumType element value
- @param spaceGuid Reserved
- @param help Reserved
- @param defaultString DefaultString element value
- @param parent Tag under which PcdEntry goes to
- **/
- public void setSpdPcdEntry(String pcdItemTypes, String cName, String token, String dataType, String spaceGuid, String help,
- String defaultString, String archList, String modTypeList, XmlObject parent) {
-
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry pe = ((PcdDeclarationsDocument.PcdDeclarations) parent).addNewPcdEntry();
-
- //ToDo: maybe multiple types in, need parse pcdItemTypes.
- String usage[] = pcdItemTypes.split("( )+");
- List<String> l = new ArrayList<String>();
- for (int i = 0; i < usage.length; ++i) {
- l.add(usage[i]);
- }
- pe.setValidUsage(l);
- pe.setCName(cName);
- pe.setToken(token);
- pe.setDatumType(PcdDataTypes.Enum.forString(dataType));
- pe.setDefaultValue(defaultString);
- pe.setTokenSpaceGuidCName(spaceGuid);
- pe.setHelpText(help);
- if (archList != null){
- pe.setSupArchList(stringToList(archList));
- } else {
- if (pe.isSetSupArchList()) {
- pe.unsetSupArchList();
- }
- }
- if (modTypeList != null){
- pe.setSupModuleList(stringToList(modTypeList));
- } else {
- if (pe.isSetSupModuleList()) {
- pe.unsetSupModuleList();
- }
- }
- }
-
- /**
- Get PpiDeclarations element
-
- @return PpiDeclarationsDocument.PpiDeclarations
- **/
- public PpiDeclarationsDocument.PpiDeclarations getSpdPpiDeclarations() {
- if (spdPpiDeclarations == null) {
- spdPpiDeclarations = psaRoot.getPpiDeclarations();
- }
- return spdPpiDeclarations;
- }
-
- /**
- Get ProtocolDeclarations element
-
- @return ProtocolDeclarationsDocument.ProtocolDeclarations
- **/
- public ProtocolDeclarationsDocument.ProtocolDeclarations getSpdProtocolDeclarations() {
- if (spdProtocolDeclarations == null) {
- spdProtocolDeclarations = psaRoot.getProtocolDeclarations();
- }
- return spdProtocolDeclarations;
- }
-
- /**
- Get GuidDeclarations element
-
- @return GuidDeclarationsDocument.GuidDeclarations
- **/
- public GuidDeclarationsDocument.GuidDeclarations getSpdGuidDeclarations() {
- if (spdGuidDeclarations == null) {
- spdGuidDeclarations = psaRoot.getGuidDeclarations();
- }
- return spdGuidDeclarations;
- }
-
- /**
- Get PcdDefinitions element
-
- @return PcdDefinitionsDocument.PcdDefinitions
- **/
- public PcdDeclarationsDocument.PcdDeclarations getSpdPcdDefinitions() {
- if (spdPcdDefinitions == null) {
- spdPcdDefinitions = psaRoot.getPcdDeclarations();
- }
- return spdPcdDefinitions;
- }
-
- /**
- Get PackageHeaders element
-
- @return PackageHeadersDocument.PackageHeaders
- **/
- public PackageHeadersDocument.PackageHeaders getSpdModHdrs() {
- if (spdModHdrs == null) {
- spdModHdrs = psaRoot.getPackageHeaders();
- }
- return spdModHdrs;
- }
-
- /**
- Get MsaFiles element
-
- @return MsaFilesDocument.MsaFiles
- **/
- public MsaFilesDocument.MsaFiles getSpdMsaFiles() {
- if (spdMsaFiles == null) {
- spdMsaFiles = psaRoot.getMsaFiles();
- }
- return spdMsaFiles;
- }
-
- /**
- Get LibraryClassDeclarations element
-
- @return LibraryClassDeclarationsDocument.LibraryClassDeclarations
- **/
- public LibraryClassDeclarationsDocument.LibraryClassDeclarations getSpdLibClassDeclarations() {
- if (spdLibClassDeclarations == null) {
- spdLibClassDeclarations = psaRoot.getLibraryClassDeclarations();
- }
- return spdLibClassDeclarations;
- }
-
- public PackageDefinitionsDocument.PackageDefinitions getSpdPkgDefs() {
- if (spdPkgDefs == null) {
- spdPkgDefs = psaRoot.addNewPackageDefinitions();
- }
- return spdPkgDefs;
- }
- /**
- Get SpdHeader element
-
- @return SpdHeaderDocument.SpdHeader
- **/
- public SpdHeaderDocument.SpdHeader getSpdHdr() {
- if (spdHdr == null) {
- spdHdr = psaRoot.addNewSpdHeader();
- }
- return spdHdr;
- }
-
- /**
- Set value to Guid element
-
- @param guid The value set to Guid element
- **/
- public void setSpdHdrGuidValue(String guid) {
- getSpdHdr().setGuidValue(guid);
- }
-
- /**
- Get Version element under SpdHdr
-
- @return String
- **/
- public String getSpdHdrVer() {
- return getSpdHdr().getVersion();
- }
-
- /**
- Set value to Version element
-
- @param ver The value set to Version element
- **/
- public void setSpdHdrVer(String ver) {
- getSpdHdr().setVersion(ver);
- }
-
- public String getSpdHdrAbs(){
- return getSpdHdr().getAbstract();
-
- }
-
- /**
- Set value to Abstract element
-
- @param abs The value set to Abstract element
- **/
- public void setSpdHdrAbs(String abs) {
-
- getSpdHdr().setAbstract(abs);
- }
-
- public String getSpdHdrDescription(){
- return getSpdHdr().getDescription();
- }
- /**
- Set value to Description element
-
- @param des The value set to Description element
- **/
- public void setSpdHdrDescription(String des) {
- getSpdHdr().setDescription(des);
- }
-
- public String getSpdHdrCopyright(){
- return getSpdHdr().getCopyright();
- }
- /**
- Set value to Copyright element
-
- @param cpRit The value set to Copyright element
- **/
- public void setSpdHdrCopyright(String cpRit) {
-
- getSpdHdr().setCopyright(cpRit);
-
- }
- /**
- Get License element under SpdHdr
-
- @return String
- **/
- public String getSpdHdrLicense() {
- if (getSpdHdr().getLicense() != null) {
- return getSpdHdr().getLicense().getStringValue();
- }
- return null;
- }
-
- /**
- Set value to License element
-
- @param license The value set to License element
- **/
- public void setSpdHdrLicense(String license) {
- if (getSpdHdr().getLicense() == null){
- getSpdHdr().addNewLicense().setStringValue(license);
- }
- else {
- getSpdHdr().getLicense().setStringValue(license);
- }
- }
-
- public String getSpdHdrUrl(){
- if (getSpdHdr().getLicense() != null) {
- return getSpdHdr().getLicense().getURL();
- }
- return null;
- }
-
- public void setSpdHdrUrl(String url){
- getSpdHdr().getLicense().setURL(url);
- }
-
- /**
- Get PackageName element under SpdHdr
-
- @return String
- **/
- public String getSpdHdrPkgName() {
-
- return getSpdHdr().getPackageName();
- }
-
- /**
- Set value to PackageName element
-
- @param pkgName The value set to PackageName element
- **/
- public void setSpdHdrPkgName(String pkgName) {
- getSpdHdr().setPackageName(pkgName);
- }
-
- public String getSpdHdrGuidValue(){
- return getSpdHdr().getGuidValue();
- }
-
- /**
- Reserved method
-
- @return SpecificationDocument.Specification
- **/
- public String getSpdHdrSpec() {
- return "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
-// return getSpdHdr().getSpecification();
- }
-
- /**
- Reserved method
-
- @param spec
- **/
- public void setSpdHdrSpec(String spec) {
- spec = "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
- getSpdHdr().setSpecification(spec);
-
- }
-
- public String getSpdPkgDefsRdOnly(){
- return getSpdPkgDefs().getReadOnly() + "";
- }
- /**
- Set value to ReadOnly element
-
- @param rdOnly The value set to ReadOnly element
- **/
- public void setSpdPkgDefsRdOnly(String rdOnly) {
-
- getSpdPkgDefs().setReadOnly(new Boolean(rdOnly));
- }
-
- public String getSpdPkgDefsRePkg(){
- return getSpdPkgDefs().getRePackage() + "";
- }
- /**
- Set value to RePackage element
-
- @param rePkg The value set to RePackage element
- **/
- public void setSpdPkgDefsRePkg(String rePkg) {
-
- getSpdPkgDefs().setRePackage(new Boolean(rePkg));
- }
-
- /**
- Set value to URL element
-
- @param url The value set to URL element
- **/
-// public void setSpdHdrURL(String url) {
-// getSpdHdr().setURL(url);
-// }
-
- /**
- Get xml file
-
- @return File
- **/
- public File getFile() {
- return file;
- }
-
- /**
- Set file
-
- @param file File with xml format
- **/
- public void setFile(File file) {
- this.file = file;
- }
-
- private List<String> stringToList(String s){
- if (s == null || s.length() == 0) {
- return null;
- }
- Vector<String> al = new Vector<String>();
- String[] sArray = s.split(" ");
- for(int i = 0; i < sArray.length; ++i){
- al.add(sArray[i]);
- }
- return al;
- }
-
- private String listToString(List l) {
- if (l == null) {
- return null;
- }
- String s = " ";
- ListIterator li = l.listIterator();
- while(li.hasNext()) {
- s += li.next();
- s += " ";
- }
- return s.trim();
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java deleted file mode 100644 index 8f39783a8f..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java +++ /dev/null @@ -1,941 +0,0 @@ -/** @file
- Java class SpdGuidDecls is GUI for create library definition elements of spd file.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import java.awt.Dimension;
-import java.awt.FontMetrics;
-import java.awt.Point;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.util.Vector;
-
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JButton;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.platform.ui.ListEditor;
-import org.tianocore.frameworkwizard.platform.ui.LongTextEditor;
-
-/**
- GUI for create library definition elements of spd file.
-
- @since PackageEditor 1.0
-**/
-public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JFrame topFrame = null;
-
- private SpdFileContents sfc = null;
-
- private OpeningPackageType docConsole = null;
-
- private JTable jTable = null;
-
- private DefaultTableModel model = null;
-
- private JPanel jContentPane = null;
-
- private JTextField jTextFieldGuid = null;
-
- private JScrollPane jScrollPane = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonClearAll = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonGen = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private StarLabel jStarLabel4 = null;
-
- protected int selectedRow = -1;
-
- private JLabel jLabelName = null;
-
- private JScrollPane jScrollPaneModule = null;
-
- private JTextField jTextFieldName = null;
-
- private JScrollPane jScrollPaneArch = null;
-
- private JScrollPane jScrollPaneGuid = null;
-
- private JLabel jLabelGuid = null;
-
- private JScrollPane topScrollPane = null; // @jve:decl-index=0:visual-constraint="10,213"
-
- private JLabel jLabelCName = null;
-
- private GenGuidDialog guidDialog = null;
-
- private JTextField jTextFieldCName = null;
-
- private JLabel jLabelHelp = null;
-
- private JTextField jTextFieldHelp = null;
-
- private JLabel jLabelSupMod = null;
-
- private JLabel jLabelSupArch = null;
-
- private ICheckBoxList iCheckBoxListArch = null;
-
- private ICheckBoxList iCheckBoxListGuid = null;
-
- private ICheckBoxList iCheckBoxListMod = null;
-
- private JLabel jLabelGuidType = null;
-
- protected String[][] saa = null;
-
- protected StarLabel starLabel = null;
-
- private final int guidNameMinWidth = 200;
- private final int guidCNameMinWidth = 200;
- private final int guidValueMinWidth = 300;
- private final int helpTextMinWidth = 300;
- private final int supArchMinWidth = 200;
- private final int supModMinWidth = 200;
- private final int guidTypeMinWidth = 200;
-
-
- /**
- This method initializes this
-
- **/
- protected void initialize() {
-
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
- }
-
- /**
- This method initializes jTextFieldGuid
-
- @return javax.swing.JTextField
- **/
- protected JTextField getJTextFieldGuid() {
- if (jTextFieldGuid == null) {
- jTextFieldGuid = new JTextField();
- jTextFieldGuid.setBounds(new java.awt.Rectangle(137,60,336,20));
- jTextFieldGuid.setPreferredSize(new java.awt.Dimension(200,20));
-
- }
- return jTextFieldGuid;
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- **/
- protected JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(5,256,472,292));
- jScrollPane.setViewportView(getJTable());
- }
- return jScrollPane;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- protected JTable getJTable() {
- if (jTable == null) {
- model = new DefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
- jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
- model.addColumn("Name");
- model.addColumn("The C Name");
- model.addColumn("GUID Value");
- model.addColumn("Help Text");
- model.addColumn("Supported Architectures");
- model.addColumn("Supported Module Types");
- model.addColumn("GuidTypes");
-
- TableColumn column = jTable.getColumnModel().getColumn(0);
- column.setMinWidth(this.guidNameMinWidth);
- column = jTable.getColumnModel().getColumn(1);
- column.setMinWidth(this.guidCNameMinWidth);
- column = jTable.getColumnModel().getColumn(2);
- column.setMinWidth(this.guidValueMinWidth);
- column = jTable.getColumnModel().getColumn(3);
- column.setMinWidth(this.helpTextMinWidth);
- column = jTable.getColumnModel().getColumn(4);
- column.setMinWidth(this.supArchMinWidth);
- column = jTable.getColumnModel().getColumn(5);
- column.setMinWidth(this.supModMinWidth);
- column = jTable.getColumnModel().getColumn(6);
- column.setMinWidth(this.guidTypeMinWidth);
-
- jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor(topFrame));
- jTable.getColumnModel().getColumn(3).setCellEditor(new LongTextEditor(topFrame));
-
- Vector<String> vArch = new Vector<String>();
- vArch.add("IA32");
- vArch.add("X64");
- vArch.add("IPF");
- vArch.add("EBC");
- vArch.add("ARM");
- vArch.add("PPC");
- jTable.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch, topFrame));
-
- Vector<String> vModule = new Vector<String>();
- vModule.add("BASE");
- vModule.add("SEC");
- vModule.add("PEI_CORE");
- vModule.add("PEIM");
- vModule.add("DXE_CORE");
- vModule.add("DXE_DRIVER");
- vModule.add("DXE_RUNTIME_DRIVER");
- vModule.add("DXE_SAL_DRIVER");
- vModule.add("DXE_SMM_DRIVER");
- vModule.add("UEFI_DRIVER");
- vModule.add("UEFI_APPLICATION");
- vModule.add("USER_DEFINED");
- jTable.getColumnModel().getColumn(5).setCellEditor(new ListEditor(vModule, topFrame));
-
- Vector<String> vGuid = new Vector<String>();
- vGuid.add("DATA_HUB_RECORD");
- vGuid.add("EFI_EVENT");
- vGuid.add("EFI_SYSTEM_CONFIGURATION_TABLE");
- vGuid.add("EFI_VARIABLE");
- vGuid.add("GUID");
- vGuid.add("HII_PACKAGE_LIST");
- vGuid.add("HOB");
- vGuid.add("TOKEN_SPACE_GUID");
- ListEditor le = new ListEditor(vGuid, topFrame);
- le.setCanNotBeEmpty(true);
- jTable.getColumnModel().getColumn(6).setCellEditor(le);
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- selectedRow = lsm.getMinSelectionIndex();
-
- }
- }
- });
-
- jTable.getModel().addTableModelListener(this);
- }
- return jTable;
- }
-
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int column = arg0.getColumn();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
-
- updateRow(row, column, m);
- }
- }
-
- protected void updateRow(int row, int column, TableModel m){
- String[] sa = new String[7];
- sfc.getSpdGuidDeclaration(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[column])) {
- return;
- }
-
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
-
- String name = m.getValueAt(row, 0) + "";
- String cName = m.getValueAt(row, 1) + "";
- String guid = m.getValueAt(row, 2) + "";
- String help = m.getValueAt(row, 3) + "";
- String archList = null;
- if (m.getValueAt(row, 4) != null){
- archList = m.getValueAt(row, 4).toString();
- }
- String modTypeList = null;
- if (m.getValueAt(row, 5) != null) {
- modTypeList = m.getValueAt(row, 5).toString();
- }
- String guidTypeList = null;
- if (m.getValueAt(row, 6) != null){
- guidTypeList = m.getValueAt(row, 6).toString();
- }
- String[] rowData = {name, cName, guid, help};
- if (!dataValidation(rowData)){
- return;
- }
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- sfc.updateSpdGuidDecl(row, name, cName, guid, help, archList, modTypeList, guidTypeList);
- }
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton
- **/
- protected JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(167,227,90,20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton
- **/
- protected JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(270,227,90,20));
- jButtonRemove.setText("Delete");
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonRemoveAll
-
- @return javax.swing.JButton
- **/
- protected JButton getJButtonClearAll() {
- if (jButtonClearAll == null) {
- jButtonClearAll = new JButton();
- jButtonClearAll.setBounds(new java.awt.Rectangle(380,227,90,20));
- jButtonClearAll.setText("Clear All");
- jButtonClearAll.addActionListener(this);
- }
- return jButtonClearAll;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton
- **/
- protected JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonCancel.setLocation(new java.awt.Point(390, 305));
- jButtonCancel.setText("Cancel");
- jButtonCancel.setSize(new java.awt.Dimension(90, 20));
- jButtonCancel.setVisible(false);
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes jButton
-
- @return javax.swing.JButton
- **/
- protected JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setSize(new java.awt.Dimension(90, 20));
- jButtonOk.setText("OK");
- jButtonOk.setLocation(new java.awt.Point(290, 305));
- jButtonOk.setVisible(false);
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This is the default constructor
- **/
- public SpdGuidDecls(JFrame frame) {
- super();
- topFrame = frame;
- initialize();
- init();
-
- }
-
- public SpdGuidDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame){
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdGuidDecls(OpeningPackageType opt, JFrame frame) {
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(this, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
- }
- /**
- This method initializes this
-
- @return void
- **/
- protected void init() {
- this.setContentPane(getJContentPane());
- this.addInternalFrameListener(new InternalFrameAdapter(){
- public void internalFrameDeactivated(InternalFrameEvent e){
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
- }
- });
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
- this.setVisible(true);
- }
-
- protected void init(SpdFileContents sfc){
- if (sfc.getSpdGuidDeclarationCount() == 0) {
- return ;
- }
- //
- // initialize table using SpdFileContents object
- //
- saa = new String[sfc.getSpdGuidDeclarationCount()][7];
- sfc.getSpdGuidDeclarations(saa);
- int i = 0;
- while (i < saa.length) {
- model.addRow(saa[i]);
- i++;
- }
-
- }
-
- protected JScrollPane getJContentPane(){
- if (topScrollPane == null){
- topScrollPane = new JScrollPane();
- topScrollPane.setSize(new java.awt.Dimension(617,500));
- topScrollPane.setPreferredSize(new java.awt.Dimension(498,500));
- topScrollPane.setViewportView(getJContentPane1());
- }
- return topScrollPane;
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel
- **/
- protected JPanel getJContentPane1() {
- if (jContentPane == null) {
-
- jLabelGuidType = new JLabel();
- jLabelGuidType.setBounds(new java.awt.Rectangle(420,122,103,16));
- jLabelGuidType.setText("GUID Type List");
- jLabelGuidType.setEnabled(true);
- starLabel = new StarLabel();
- starLabel.setLocation(new Point(jLabelGuidType.getX() - 10, jLabelGuidType.getY()));
- starLabel.setVisible(true);
- jLabelSupArch = new JLabel();
- jLabelSupArch.setBounds(new java.awt.Rectangle(197,122,108,16));
- jLabelSupArch.setText("Supported Architectures");
- jLabelSupArch.setEnabled(true);
- FontMetrics fm = jLabelSupArch.getFontMetrics(jLabelSupArch.getFont());
- jLabelSupArch.setSize(fm.stringWidth(jLabelSupArch.getText()) + 10, 20);
- jLabelSupMod = new JLabel();
- jLabelSupMod.setBounds(new java.awt.Rectangle(14,120,110,16));
- jLabelSupMod.setText("Supported Module Types");
- jLabelSupMod.setEnabled(true);
- fm = jLabelSupMod.getFontMetrics(jLabelSupMod.getFont());
- jLabelSupMod.setSize(fm.stringWidth(jLabelSupMod.getText()) + 10, 20);
- jLabelHelp = new JLabel();
- jLabelHelp.setText("HelpText");
- jLabelHelp.setSize(new java.awt.Dimension(109,20));
- jLabelHelp.setLocation(new java.awt.Point(14,85));
- jLabelCName = new JLabel();
- jLabelCName.setBounds(new java.awt.Rectangle(14,35,111,20));
- jLabelCName.setText("C Name");
- jLabelGuid = new JLabel();
- jLabelGuid.setBounds(new java.awt.Rectangle(15,60,112,20));
- jLabelGuid.setText("Guid Value");
- jLabelName = new JLabel();
- jLabelName.setBounds(new java.awt.Rectangle(15,10,113,20));
- jLabelName.setText("Name");
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, 10));
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(0, 35));
- jStarLabel4 = new StarLabel();
- jStarLabel4.setLocation(new java.awt.Point(0, 60));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(0, 85));
- jStarLabel2.setVisible(true);
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new Dimension(480, 375));
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(jLabelCName, null);
- jContentPane.add(getJTextFieldCName(), null);
- jContentPane.add(getJTextFieldGuid(), null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonClearAll(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonOk(), null);
-
- jContentPane.add(getJButtonGen(), null);
- jContentPane.add(jLabelName, null);
- jContentPane.add(getJTextFieldName(), null);
- jContentPane.add(jLabelGuid, null);
- jContentPane.add(jLabelHelp, null);
- jContentPane.add(getJTextFieldHelp(), null);
- jContentPane.add(jLabelSupMod, null);
- jContentPane.add(jLabelSupArch, null);
- jContentPane.add(getJScrollPaneArch(), null);
- jContentPane.add(getJScrollPaneGuid(), null);
- jContentPane.add(getJScrollPaneModule(), null);
- jContentPane.add(jLabelGuidType, null);
- jContentPane.add(starLabel, null);
- }
- return jContentPane;
- }
-
- /**
- fill ComboBoxes with pre-defined contents
- **/
- protected void initFrame() {
-
- this.setTitle("GUID Declarations");
-
- boolean editable = true;
- if (getSfc().getSpdPkgDefsRdOnly().equals("true")) {
- editable = false;
- }
-
- jButtonAdd.setEnabled(editable);
- jButtonRemove.setEnabled(editable);
- jButtonClearAll.setEnabled(editable);
- jTable.setEnabled(editable);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonOk) {
- this.save();
- this.dispose();
-
- }
- if (arg0.getSource() == jButtonCancel) {
- this.dispose();
- }
-
- if (arg0.getSource() == jButtonAdd) {
-
- //ToDo: check before add
- String[] row = {"", "", "", "", "", "", ""};
- row[3] = jTextFieldHelp.getText();
- row[2] = jTextFieldGuid.getText();
- row[1] = jTextFieldCName.getText();
- row[0] = jTextFieldName.getText();
- row[4] = vectorToString(iCheckBoxListArch.getAllCheckedItemsString());
- if (row[4].length() == 0) {
- row[4] = null;
- }
- row[5] = vectorToString(iCheckBoxListMod.getAllCheckedItemsString());
- if (row[5].length() == 0) {
- row[5] = null;
- }
- row[6] = vectorToString(iCheckBoxListGuid.getAllCheckedItemsString());
- if (row[6].length() == 0) {
- row[6] = null;
- }
-
- if (!dataValidation(row)) {
- return;
- }
-
- if (addRow(row) == -1) {
- return;
- }
- model.addRow(row);
- jTable.changeSelection(model.getRowCount()-1, 0, false, false);
-
- }
- //
- // remove selected line
- //
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()){
- jTable.getCellEditor().stopCellEditing();
- }
- int rowSelected = selectedRow;
- if (rowSelected >= 0) {
- model.removeRow(rowSelected);
- removeRow(rowSelected);
- }
- }
-
- if (arg0.getSource() == jButtonClearAll) {
- if (model.getRowCount() == 0) {
- return;
- }
- model.setRowCount(0);
- clearAllRow();
- }
-
- if (arg0.getSource() == jButtonGen) {
- jTextFieldGuid.setText(Tools.generateUuidString());
- }
-
- if (arg0.getActionCommand().equals("GenGuidValue")) {
- jTextFieldGuid.setText(guidDialog.getGuid());
- }
-
- }
-
- protected boolean dataValidation(String[] row){
- if (!DataValidation.isUiNameType(row[0])) {
- JOptionPane.showMessageDialog(this, "Name must start with an alpha character.");
- return false;
- }
- if (!DataValidation.isGuid(row[2])) {
- JOptionPane.showMessageDialog(this, "Guid Value must be in registry format, 8-4-4-4-12.");
- return false;
- }
- if (!DataValidation.isC_NameType(row[1])) {
- JOptionPane.showMessageDialog(this, "C Name does not match C Name datatype.");
- return false;
- }
- if (row[3].length() == 0) {
- JOptionPane.showMessageDialog(this, "Help Text must be entered!");
- return false;
- }
- return true;
- }
-
- protected int addRow(String[] row) {
- Vector<String> vArch = iCheckBoxListArch.getAllCheckedItemsString();
- if (vArch.size() == 0) {
- vArch = null;
- }
- Vector<String> vModType = iCheckBoxListMod.getAllCheckedItemsString();
- if (vModType.size() == 0) {
- vModType = null;
- }
- Vector<String> vguidType = iCheckBoxListGuid.getAllCheckedItemsString();
- if (vguidType.size() == 0) {
- vguidType = null;
- }
- if (vguidType == null) {
- JOptionPane.showMessageDialog(this, "You must select at least one GUID type.");
- return -1;
- }
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- sfc.genSpdGuidDeclarations(row[0], row[1], row[2], row[3], vArch, vModType, vguidType);
- return 0;
- }
-
- protected void removeRow(int i){
- sfc.removeSpdGuidDeclaration(i);
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-
- protected void clearAllRow(){
- sfc.removeSpdGuidDeclaration();
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-
- /**
- Add contents in list to sfc
- **/
- protected void save() {
-
- }
-
- /**
- This method initializes jButtonBrowse
-
- @return javax.swing.JButton
- **/
- protected JButton getJButtonGen() {
- if (jButtonGen == null) {
- jButtonGen = new JButton();
- jButtonGen.setBounds(new java.awt.Rectangle(485,58,92,21));
- jButtonGen.setText("Gen");
- jButtonGen.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonGen.addActionListener(this);
- }
- return jButtonGen;
- }
-
- /**
- * This method initializes jTextFieldName
- *
- * @return javax.swing.JTextField
- */
- protected JTextField getJTextFieldName() {
- if (jTextFieldName == null) {
- jTextFieldName = new JTextField();
- jTextFieldName.setBounds(new java.awt.Rectangle(138,10,337,20));
- jTextFieldName.setPreferredSize(new java.awt.Dimension(335,20));
- }
- return jTextFieldName;
- }
-
- /**
- * This method initializes jTextFieldCName
- *
- * @return javax.swing.JTextField
- */
- protected JTextField getJTextFieldCName() {
- if (jTextFieldCName == null) {
- jTextFieldCName = new JTextField();
- jTextFieldCName.setBounds(new java.awt.Rectangle(137,35,337,20));
- jTextFieldCName.setPreferredSize(new java.awt.Dimension(335,20));
- }
- return jTextFieldCName;
- }
-
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = 500;
-
- Tools.resizeComponentWidth(this.jTextFieldName, this.getWidth(), intPreferredWidth);
-
- Tools.resizeComponentWidth(this.jTextFieldCName, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldHelp, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPane, this.getWidth(), intPreferredWidth);
- Tools.relocateComponentX(this.jButtonGen, this.getWidth(), this.getPreferredSize().width, 40);
-
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldHelp() {
- if (jTextFieldHelp == null) {
- jTextFieldHelp = new JTextField();
- jTextFieldHelp.setBounds(new java.awt.Rectangle(136,85,337,20));
- jTextFieldHelp.setPreferredSize(new Dimension(335, 20));
- }
- return jTextFieldHelp;
- }
-
- private JScrollPane getJScrollPaneArch() {
- if (jScrollPaneArch == null) {
- jScrollPaneArch = new JScrollPane();
- jScrollPaneArch.setBounds(new java.awt.Rectangle(197,142,188,74));
- jScrollPaneArch.setPreferredSize(new java.awt.Dimension(188, 74));
- jScrollPaneArch.setViewportView(getICheckBoxListArch());
- }
- return jScrollPaneArch;
- }
- /**
- * This method initializes iCheckBoxList
- *
- * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
- */
- private ICheckBoxList getICheckBoxListArch() {
- if (iCheckBoxListArch == null) {
- iCheckBoxListArch = new ICheckBoxList();
- iCheckBoxListArch.setBounds(new java.awt.Rectangle(197,142,188,74));
- Vector<String> v = new Vector<String>();
- v.add("IA32");
- v.add("X64");
- v.add("IPF");
- v.add("EBC");
- v.add("ARM");
- v.add("PPC");
- iCheckBoxListArch.setAllItems(v);
- }
- return iCheckBoxListArch;
- }
-
- protected JScrollPane getJScrollPaneGuid() {
- if (jScrollPaneGuid== null) {
- jScrollPaneGuid = new JScrollPane();
- jScrollPaneGuid.setPreferredSize(new java.awt.Dimension(190,74));
- jScrollPaneGuid.setLocation(new java.awt.Point(400,142));
- jScrollPaneGuid.setSize(new java.awt.Dimension(260,74));
- jScrollPaneGuid.setViewportView(getICheckBoxListGuid());
- }
- return jScrollPaneGuid;
- }
- /**
- * This method initializes iCheckBoxList1
- *
- * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
- */
- private ICheckBoxList getICheckBoxListGuid() {
- if (iCheckBoxListGuid == null) {
- iCheckBoxListGuid = new ICheckBoxList();
- iCheckBoxListGuid.setBounds(new java.awt.Rectangle(400,142,177,74));
- Vector<String> v = new Vector<String>();
- v.add("DATA_HUB_RECORD");
- v.add("EFI_EVENT");
- v.add("EFI_SYSTEM_CONFIGURATION_TABLE");
- v.add("EFI_VARIABLE");
- v.add("GUID");
- v.add("HII_PACKAGE_LIST");
- v.add("HOB");
- v.add("TOKEN_SPACE_GUID");
-
- iCheckBoxListGuid.setAllItems(v);
- }
- return iCheckBoxListGuid;
- }
-
- private JScrollPane getJScrollPaneModule() {
- if (jScrollPaneModule == null) {
- jScrollPaneModule = new JScrollPane();
- jScrollPaneModule.setBounds(new java.awt.Rectangle(14,142,170,74));
- jScrollPaneModule.setPreferredSize(new java.awt.Dimension(170, 74));
- jScrollPaneModule.setViewportView(getICheckBoxListMod());
- }
- return jScrollPaneModule;
- }
- /**
- * This method initializes iCheckBoxList2
- *
- * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
- */
- private ICheckBoxList getICheckBoxListMod() {
- if (iCheckBoxListMod == null) {
- iCheckBoxListMod = new ICheckBoxList();
- iCheckBoxListMod.setBounds(new java.awt.Rectangle(14,142,170,74));
- Vector<String> v = new Vector<String>();
- v.add("BASE");
- v.add("SEC");
- v.add("PEI_CORE");
- v.add("PEIM");
- v.add("DXE_CORE");
- v.add("DXE_DRIVER");
- v.add("DXE_RUNTIME_DRIVER");
- v.add("DXE_SAL_DRIVER");
- v.add("DXE_SMM_DRIVER");
- v.add("UEFI_DRIVER");
- v.add("UEFI_APPLICATION");
- v.add("USER_DEFINED");
- iCheckBoxListMod.setAllItems(v);
- }
- return iCheckBoxListMod;
- }
-
- protected DefaultTableModel getModel() {
- return model;
- }
-
- protected void setModel(DefaultTableModel model) {
- this.model = model;
- }
-
- protected String vectorToString(Vector<String> v) {
- String s = " ";
- for (int i = 0; i < v.size(); ++i) {
- s += v.get(i);
- s += " ";
- }
- return s.trim();
- }
-
- protected Vector<String> stringToVector(String s){
- if (s == null) {
- return null;
- }
- String[] sArray = s.split(" ");
- Vector<String> v = new Vector<String>();
- for (int i = 0; i < sArray.length; ++i) {
- v.add(sArray[i]);
- }
- return v;
- }
-
- protected JLabel getJLabelGuidType() {
- return jLabelGuidType;
- }
-
- /**
- * @return Returns the sfc.
- */
- protected SpdFileContents getSfc() {
- return sfc;
- }
-}
-
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java deleted file mode 100644 index a8def0a86b..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java +++ /dev/null @@ -1,816 +0,0 @@ -/** @file
-
- The file is used to create, update spdHeader of Spd file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import javax.swing.JCheckBox;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-
-/**
- The class is used to create, update spdHeader of Spd file
- It extends IInternalFrame
-
- @since PackageEditor 1.0
-
- **/
-public class SpdHeader extends IInternalFrame implements DocumentListener{
-
- private int dialogWidth = 560;
-
- private int labelColumn = 12;
-
- private int labelWidth = 155;
-
- private int buttonWidth = 60;
-
- private final int valueColumn = 168;
-
- private final int valueWidth = 320;
-
- private final int specWidth = 420;
-
- private int shortValueWidth = valueWidth - (buttonWidth + 5);
-
- private final int oneRowHeight = 20;
-
- private final int threeRowHeight = 60;
-
- private final int fourRowHeight = 80;
-
- private final int rowSep = 5;
-
- private final int rowOne = 12;
-
- private final int rowTwo = rowOne + oneRowHeight + rowSep;
-
- private final int rowThree = rowTwo + oneRowHeight + rowSep;
-
- private final int rowFour = rowThree + oneRowHeight + rowSep;
-
- private final int rowFive = rowFour + threeRowHeight + rowSep;
-
- private final int rowSix = rowFive + fourRowHeight + rowSep;
-
- private final int rowSeven = rowSix + oneRowHeight + rowSep;
-
- private final int rowEight = rowSeven + oneRowHeight + rowSep;
-
- private final int rowNine = rowEight + fourRowHeight + rowSep;
-
- private final int rowTen = rowNine + oneRowHeight + rowSep;
-
- private int dialogHeight = rowTen + threeRowHeight;
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -8152099582923006900L;
-
- //
- //Define class members
- //
- private IInternalFrame topFrame;
-
- private JPanel jContentPane = null;
-
- private JLabel jPackageNameLabel = null;
-
- private JTextField jPackageNameTextField = null;
-
- private JLabel jGuidLabel = null;
-
- private JTextField jGuidTextField = null;
-
- private JLabel jVersionLabel = null;
-
- private JTextField jVersionTextField = null;
-
- private JButton jGenerateGuidButton = null;
-
- private JLabel jLicenseLabel = null;
-
- private JTextArea jLicenseTextArea = null;
-
- private JLabel jLabelCopyright = null;
-
- private JLabel jDescriptionLabel = null;
-
- private JTextArea jDescriptionTextArea = null;
-
- private JTextField jSpecificationTextField = null;
-
- private JScrollPane jLicenseScrollPane = null;
-
- private JScrollPane jDescriptionScrollPane = null;
-
- private JScrollPane jCopyrightScrollPane = null;
-
- private JLabel jAbstractLabel = null;
-
- private JTextField jAbstractTextField = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private StarLabel jStarLabel4 = null;
-
- private StarLabel jStarLabel5 = null;
-
- private StarLabel jStarLabel6 = null;
-
- private StarLabel jStarLabel7 = null;
-
- private StarLabel jStarLabel8 = null;
-
- private StarLabel jStarLabel9 = null;
-
- private SpdFileContents sfc = null;
-
- private OpeningPackageType docConsole = null;
-
- private JTextArea jCopyrightTextArea = null;
-
- private JScrollPane topScrollPane = null;
-
- private JLabel jUrlLabel = null;
-
- private JTextField jUrlTextField = null;
-
- private JCheckBox jCheckBoxRdOnly = null;
-
- private JCheckBox jCheckBoxRePkg = null;
-
- /**
- This method initializes jPackageNameTextField
-
- @return javax.swing.JTextField jPackageNameTextField
-
- **/
- private JTextField getJPackageNameTextField() {
- if (jPackageNameTextField == null) {
- jPackageNameTextField = new JTextField();
- jPackageNameTextField.setBounds(new java.awt.Rectangle(valueColumn, rowOne, valueWidth, oneRowHeight));
- jPackageNameTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jPackageNameTextField.getDocument().addDocumentListener(this);
- jPackageNameTextField.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isUiNameType(jPackageNameTextField.getText())) {
- JOptionPane.showMessageDialog(topFrame, "Package Name must start with a letter.");
- return;
- }
- if (jPackageNameTextField.getText().equals(sfc.getSpdHdrPkgName())) {
- return;
- }
- sfc.setSpdHdrPkgName(jPackageNameTextField.getText());
- }
- });
- }
- return jPackageNameTextField;
- }
-
- /**
- This method initializes jGuidTextField
-
- @return javax.swing.JTextField jGuidTextField
-
- **/
- private JTextField getJGuidTextField() {
- if (jGuidTextField == null) {
- jGuidTextField = new JTextField();
- jGuidTextField.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, shortValueWidth, oneRowHeight));
- jGuidTextField.setPreferredSize(new java.awt.Dimension(shortValueWidth, oneRowHeight));
- jGuidTextField.getDocument().addDocumentListener(this);
- jGuidTextField.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isGuid(jGuidTextField.getText())) {
- JOptionPane.showMessageDialog(topFrame, "Guid must be in registry (8-4-4-4-12) format.");
- return;
- }
- if (jGuidTextField.getText().equals(sfc.getSpdHdrGuidValue())) {
- return;
- }
- sfc.setSpdHdrGuidValue(jGuidTextField.getText());
- }
- });
- }
- return jGuidTextField;
- }
-
- /**
- This method initializes jVersionTextField
-
- @return javax.swing.JTextField jVersionTextField
-
- **/
- private JTextField getJVersionTextField() {
- if (jVersionTextField == null) {
- jVersionTextField = new JTextField();
- jVersionTextField.setBounds(new java.awt.Rectangle(valueColumn, rowThree, valueWidth, oneRowHeight));
- jVersionTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jVersionTextField.getDocument().addDocumentListener(this);
- jVersionTextField.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isVersion(jVersionTextField.getText())) {
- JOptionPane.showMessageDialog(topFrame, "Version must start with a number.");
- return;
- }
- if (jVersionTextField.getText().equals(sfc.getSpdHdrVer())) {
- return;
- }
- sfc.setSpdHdrVer(jVersionTextField.getText());
- }
- });
- }
- return jVersionTextField;
- }
-
- /**
- This method initializes jGenerateGuidButton
-
- @return javax.swing.JButton jGenerateGuidButton
-
- **/
- private JButton getJGenerateGuidButton() {
- if (jGenerateGuidButton == null) {
- jGenerateGuidButton = new JButton();
- jGenerateGuidButton.setBounds(new java.awt.Rectangle(valueColumn + shortValueWidth + 5, rowTwo, buttonWidth, oneRowHeight));
- jGenerateGuidButton.setText("GEN");
- jGenerateGuidButton.addActionListener(this);
- }
- return jGenerateGuidButton;
- }
-
- /**
- This method initializes jLicenseTextArea
-
- @return javax.swing.JTextArea jLicenseTextArea
-
- **/
- private JTextArea getJLicenseTextArea() {
- if (jLicenseTextArea == null) {
- jLicenseTextArea = new JTextArea();
- jLicenseTextArea.setLineWrap(true);
- jLicenseTextArea.getDocument().addDocumentListener(this);
- jLicenseTextArea.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (jLicenseTextArea.getText().length() == 0) {
- JOptionPane.showMessageDialog(topFrame, "License is a required field.");
- return;
- }
- if (jLicenseTextArea.getText().equals(sfc.getSpdHdrLicense())) {
- return;
- }
- sfc.setSpdHdrLicense(jLicenseTextArea.getText());
- }
- });
- }
- return jLicenseTextArea;
- }
-
- /**
- This method initializes jDescriptionTextArea
-
- @return javax.swing.JTextArea jDescriptionTextArea
-
- **/
- private JTextArea getJDescriptionTextArea() {
- if (jDescriptionTextArea == null) {
- jDescriptionTextArea = new JTextArea();
- jDescriptionTextArea.setLineWrap(true);
- jDescriptionTextArea.getDocument().addDocumentListener(this);
- jDescriptionTextArea.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (jDescriptionTextArea.getText().length() == 0) {
- JOptionPane
- .showMessageDialog(topFrame,
- "Description is a required field, and should reflect the contents of the package.");
- return;
- }
- if (jDescriptionTextArea.getText().equals(sfc.getSpdHdrDescription())) {
- return;
- }
- sfc.setSpdHdrDescription(jDescriptionTextArea.getText());
- }
- });
- }
- return jDescriptionTextArea;
- }
-
- /**
- This method initializes jSpecificationTextField
-
- @return javax.swing.JTextField jSpecificationTextField
-
- **/
- private JTextField getJSpecificationTextField() {
- if (jSpecificationTextField == null) {
- jSpecificationTextField = new JTextField();
- jSpecificationTextField.setBounds(new java.awt.Rectangle(labelColumn, dialogHeight - 40, specWidth, oneRowHeight));
- jSpecificationTextField.setEditable(false);
- jSpecificationTextField.setPreferredSize(new java.awt.Dimension(specWidth, oneRowHeight));
- jSpecificationTextField.setLocation(new java.awt.Point(2, dialogHeight - oneRowHeight));
- jSpecificationTextField.setBorder(null);
-
- // jSpecificationTextField.addFocusListener(new FocusAdapter(){
- // public void focusLost(FocusEvent e){
- // sfc.setSpdHdrSpec(jSpecificationTextField.getText());
- // }
- // });
- }
- return jSpecificationTextField;
- }
-
- /**
- This method initializes jLicenseScrollPane
-
- @return javax.swing.JScrollPane jLicenseScrollPane
-
- **/
- private JScrollPane getJLicenseScrollPane() {
- if (jLicenseScrollPane == null) {
- jLicenseScrollPane = new JScrollPane();
- jLicenseScrollPane.setBounds(new java.awt.Rectangle(valueColumn, rowFive, valueWidth, fourRowHeight));
- jLicenseScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jLicenseScrollPane.setPreferredSize(new java.awt.Dimension(valueWidth, fourRowHeight));
- jLicenseScrollPane.setViewportView(getJLicenseTextArea());
- }
- return jLicenseScrollPane;
- }
-
- /**
- This method initializes jDescriptionScrollPane
-
- @return javax.swing.JScrollPane jDescriptionScrollPane
-
- **/
- private JScrollPane getJDescriptionScrollPane() {
- if (jDescriptionScrollPane == null) {
- jDescriptionScrollPane = new JScrollPane();
- jDescriptionScrollPane.setBounds(new java.awt.Rectangle(valueColumn, rowEight, valueWidth, fourRowHeight));
- jDescriptionScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jDescriptionScrollPane.setPreferredSize(new java.awt.Dimension(valueWidth, fourRowHeight));
- jDescriptionScrollPane.setViewportView(getJDescriptionTextArea());
- }
- return jDescriptionScrollPane;
- }
-
- /**
- This method initializes jAbstractTextField
-
- @return javax.swing.JTextField jAbstractTextField
-
- **/
- private JTextField getJAbstractTextField() {
- if (jAbstractTextField == null) {
- jAbstractTextField = new JTextField();
- jAbstractTextField.setBounds(new java.awt.Rectangle(valueColumn, rowSeven, valueWidth, oneRowHeight));
- jAbstractTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jAbstractTextField.getDocument().addDocumentListener(this);
- jAbstractTextField.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isAbstract(jAbstractTextField.getText())) {
- JOptionPane.showMessageDialog(topFrame, "Abstract could NOT be empty.");
- return;
- }
- if (jAbstractTextField.getText().equals(sfc.getSpdHdrAbs())) {
- return;
- }
- sfc.setSpdHdrAbs(jAbstractTextField.getText());
- }
- });
- }
- return jAbstractTextField;
- }
-
- private JScrollPane getCopyrightScrollPane() {
- if (jCopyrightScrollPane == null) {
- jCopyrightScrollPane = new JScrollPane();
- jCopyrightScrollPane.setBounds(new java.awt.Rectangle(valueColumn, rowFour, valueWidth, threeRowHeight));
- jCopyrightScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jCopyrightScrollPane.setPreferredSize(new java.awt.Dimension(valueWidth, threeRowHeight));
- jCopyrightScrollPane.setViewportView(getJCopyrightTextArea());
- }
- return jCopyrightScrollPane;
- }
- /**
- This method initializes jTextFieldCopyright
-
- @return javax.swing.JTextField jTextFieldCopyright
-
- **/
- private JTextArea getJCopyrightTextArea() {
- if (jCopyrightTextArea == null) {
- jCopyrightTextArea = new JTextArea();
- jCopyrightTextArea.setWrapStyleWord(true);
- jCopyrightTextArea.setLineWrap(true);
- jCopyrightTextArea.getDocument().addDocumentListener(this);
- jCopyrightTextArea.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isCopyright(jCopyrightTextArea.getText())) {
- JOptionPane.showMessageDialog(topFrame, "Copyright must be entered.");
- return;
- }
- if (jCopyrightTextArea.getText().equals(sfc.getSpdHdrCopyright())) {
- return;
- }
- sfc.setSpdHdrCopyright(jCopyrightTextArea.getText());
- }
- });
- }
- return jCopyrightTextArea;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJUrlTextField() {
- if (jUrlTextField == null) {
- jUrlTextField = new JTextField();
- jUrlTextField.setBounds(new java.awt.Rectangle(valueColumn, rowSix, valueWidth, oneRowHeight));
- jUrlTextField.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jUrlTextField.getDocument().addDocumentListener(this);
- jUrlTextField.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (jUrlTextField.getText().length() == 0 && sfc.getSpdHdrUrl() == null) {
- return;
- }
- if (jUrlTextField.getText().equals(sfc.getSpdHdrUrl())) {
- return;
- }
- sfc.setSpdHdrLicense(jLicenseTextArea.getText());
- sfc.setSpdHdrUrl(jUrlTextField.getText());
- }
- });
- }
- return jUrlTextField;
- }
-
- /**
- * This method initializes jCheckBoxRdOnly
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxRdOnly() {
- if (jCheckBoxRdOnly == null) {
- jCheckBoxRdOnly = new JCheckBox();
- jCheckBoxRdOnly.setText("Read Only");
- jCheckBoxRdOnly.setLocation(new java.awt.Point(labelColumn, rowNine));
- jCheckBoxRdOnly.setSize(new java.awt.Dimension(labelWidth, oneRowHeight));
- jCheckBoxRdOnly.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- sfc.setSpdPkgDefsRdOnly(jCheckBoxRdOnly.isSelected()+"");
- initFrame();
- }
- });
- }
- return jCheckBoxRdOnly;
- }
-
- /**
- * This method initializes jCheckBoxRePkg
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxRePkg() {
- if (jCheckBoxRePkg == null) {
- jCheckBoxRePkg = new JCheckBox();
- jCheckBoxRePkg.setLocation(new java.awt.Point(labelColumn, rowTen));
- jCheckBoxRePkg.setText("RePackagable");
- jCheckBoxRePkg.setSize(new java.awt.Dimension(labelWidth, oneRowHeight));
- jCheckBoxRePkg.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- sfc.setSpdPkgDefsRePkg(jCheckBoxRePkg.isSelected()+"");
- }
- });
- }
- return jCheckBoxRePkg;
- }
-
- public static void main(String[] args) {
- new SpdHeader().setVisible(true);
- }
-
- /**
- This is the default constructor
-
- **/
- public SpdHeader() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inspdHeader The input data of spdHeaderDocument.spdHeader
-
- **/
- public SpdHeader(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa) {
- this();
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdHeader(OpeningPackageType opt) {
- this(opt.getXmlSpd());
- docConsole = opt;
- initFrame();
- topFrame = this;
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- this.setContentPane(getTopScrollPane());
- this.setTitle("Package Surface Area Header");
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inspdHeader The input data of spdHeaderDocument.spdHeader
-
- **/
- private void init(SpdFileContents sfc) {
- if (sfc.getSpdHdrPkgName() != null) {
- jPackageNameTextField.setText(sfc.getSpdHdrPkgName());
- }
- if (sfc.getSpdHdrGuidValue() != null) {
- jGuidTextField.setText(sfc.getSpdHdrGuidValue());
- }
- if (sfc.getSpdHdrVer() != null) {
- jVersionTextField.setText(sfc.getSpdHdrVer());
- }
- if (sfc.getSpdHdrLicense() != null) {
- jLicenseTextArea.setText(sfc.getSpdHdrLicense());
- }
- if (sfc.getSpdHdrUrl() != null) {
- jUrlTextField.setText(sfc.getSpdHdrUrl());
- }
- if (sfc.getSpdHdrCopyright() != null) {
- jCopyrightTextArea.setText(sfc.getSpdHdrCopyright());
- }
- if (sfc.getSpdHdrAbs() != null) {
- jAbstractTextField.setText(sfc.getSpdHdrAbs());
- }
- if (sfc.getSpdHdrDescription() != null) {
- jDescriptionTextArea.setText(sfc.getSpdHdrDescription());
- }
- if (sfc.getSpdHdrSpec() != null) {
- jSpecificationTextField.setText(sfc.getSpdHdrSpec());
- }
- sfc.setSpdHdrSpec(jSpecificationTextField.getText());
-
- if (!sfc.getSpdPkgDefsRdOnly().equals("true")) {
- sfc.setSpdPkgDefsRdOnly("false");
- jCheckBoxRdOnly.setSelected(false);
- } else {
- jCheckBoxRdOnly.setSelected(true);
- }
- if (!sfc.getSpdPkgDefsRePkg().equals("true")) {
- sfc.setSpdPkgDefsRePkg("false");
- jCheckBoxRePkg.setSelected(false);
- } else {
- jCheckBoxRePkg.setSelected(true);
- }
-
- }
-
- /**
- 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, rowOne));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2, rowTwo));
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(2, rowThree));
- jStarLabel4 = new StarLabel();
- jStarLabel4.setLocation(new java.awt.Point(2, rowFour));
- jStarLabel5 = new StarLabel();
- jStarLabel5.setLocation(new java.awt.Point(2, rowFive));
- jStarLabel6 = new StarLabel();
- jStarLabel6.setLocation(new java.awt.Point(2, rowSeven));
- jStarLabel7 = new StarLabel();
- jStarLabel7.setLocation(new java.awt.Point(2, rowEight));
- jStarLabel8 = new StarLabel();
- jStarLabel8.setLocation(new java.awt.Point(2, rowNine));
- jStarLabel8.setVisible(false);
- jStarLabel9 = new StarLabel();
- jStarLabel9.setLocation(new java.awt.Point(2, rowTen));
-
- jStarLabel9.setVisible(false);
- jPackageNameLabel = new JLabel();
- jPackageNameLabel.setText("Package Name");
- jPackageNameLabel.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
- jGuidLabel = new JLabel();
- jGuidLabel.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));
- jGuidLabel.setText("Guid");
- jVersionLabel = new JLabel();
- jVersionLabel.setText("Version");
- jVersionLabel.setBounds(new java.awt.Rectangle(labelColumn, rowThree, labelWidth, oneRowHeight));
- jLabelCopyright = new JLabel();
- jLabelCopyright.setText("Copyright");
- jLabelCopyright.setBounds(new java.awt.Rectangle(labelColumn, rowFour, labelWidth, oneRowHeight));
- jLicenseLabel = new JLabel();
- jLicenseLabel.setText("License");
- jLicenseLabel.setBounds(new java.awt.Rectangle(labelColumn, rowFive, labelWidth, oneRowHeight));
- jUrlLabel = new JLabel();
- jUrlLabel.setBounds(new java.awt.Rectangle(labelColumn, rowSix, labelWidth, oneRowHeight));
- jUrlLabel.setText("URL");
- jAbstractLabel = new JLabel();
- jAbstractLabel.setBounds(new java.awt.Rectangle(labelColumn, rowSeven, labelWidth, oneRowHeight));
- jAbstractLabel.setText("Abstract");
- jDescriptionLabel = new JLabel();
- jDescriptionLabel.setText("Description");
- jDescriptionLabel.setBounds(new java.awt.Rectangle(labelColumn, rowEight, labelWidth, oneRowHeight));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setLocation(new java.awt.Point(0, 0));
- jContentPane.setPreferredSize(new java.awt.Dimension(dialogWidth - 20, dialogHeight - 20));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(jStarLabel5, null);
- jContentPane.add(jStarLabel6, null);
- jContentPane.add(jStarLabel7, null);
- jContentPane.add(jStarLabel8, null);
- jContentPane.add(jStarLabel9, null);
-
- jContentPane.add(jPackageNameLabel, null);
- jContentPane.add(getJPackageNameTextField(), null);
- jContentPane.add(jGuidLabel, null);
- jContentPane.add(getJGuidTextField(), null);
- jContentPane.add(jVersionLabel, null);
- jContentPane.add(getJVersionTextField(), null);
- jContentPane.add(getJGenerateGuidButton(), null);
- jContentPane.add(jLabelCopyright, null);
- jContentPane.add(getCopyrightScrollPane(), null);
- jContentPane.add(jLicenseLabel, null);
- jContentPane.add(getJLicenseScrollPane(), null);
- jContentPane.add(jUrlLabel, null);
- jContentPane.add(getJUrlTextField(), null);
- jContentPane.add(jAbstractLabel, null);
- jContentPane.add(getJAbstractTextField(), null);
- jContentPane.add(jDescriptionLabel, null);
- jContentPane.add(getJDescriptionScrollPane(), null);
-
-// jContentPane.add(getJButtonOk(), null);
-// jContentPane.add(getJButtonCancel(), null);
-
- jContentPane.add(getJCheckBoxRdOnly(), null);
- jContentPane.add(getJCheckBoxRePkg(), null);
- jContentPane.add(getJSpecificationTextField(), null);
-
- }
- 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() == jGenerateGuidButton) {
- //ToDo: invoke GuidValueEditor
- jGuidTextField.setText(Tools.generateUuidString());
- sfc.setSpdHdrGuidValue(jGuidTextField.getText());
- }
- }
-
- /**
- This method initializes Package type and Compontent type
-
- **/
- private void initFrame() {
- boolean editable = true;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- editable = false;
- }
- jPackageNameTextField.setEditable(editable);
- jGuidTextField.setEditable(editable);
- jGenerateGuidButton.setEnabled(editable);
- jVersionTextField.setEditable(editable);
- jCopyrightTextArea.setEditable(editable);
- jLicenseTextArea.setEditable(editable);
- jUrlTextField.setEditable(editable);
- jAbstractTextField.setEditable(editable);
- jDescriptionTextArea.setEditable(editable);
- jCheckBoxRePkg.setEnabled(editable);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = dialogWidth;
- int intCurrentWidth = this.getJContentPane().getWidth();
-
-// Tools.resizeComponentWidth(this.jPackageNameTextField, intCurrentWidth, intPreferredWidth);
-// Tools.resizeComponentWidth(this.jGuidTextField, intCurrentWidth, intPreferredWidth);
-// Tools.resizeComponentWidth(this.jVersionTextField, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jUrlTextField, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jLicenseScrollPane, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jCopyrightTextArea, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jDescriptionScrollPane, intCurrentWidth, intPreferredWidth);
- // Tools.resizeComponentWidth(this.jSpecificationTextField, intCurrentWidth,intPreferredWidth);
- Tools.resizeComponentWidth(this.jAbstractTextField, intCurrentWidth, intPreferredWidth);
-// Tools.relocateComponentX(this.jGenerateGuidButton, intCurrentWidth, jGenerateGuidButton.getWidth(), 30);
- }
-
- private JScrollPane getTopScrollPane() {
- if (topScrollPane == null) {
- topScrollPane = new JScrollPane();
- topScrollPane.setViewportView(getJContentPane());
- }
- return topScrollPane;
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.DocumentListener#changedUpdate(javax.swing.event.DocumentEvent)
- */
- public void changedUpdate(DocumentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.DocumentListener#insertUpdate(javax.swing.event.DocumentEvent)
- */
- public void insertUpdate(DocumentEvent arg0) {
- // TODO Auto-generated method stub
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent)
- */
- public void removeUpdate(DocumentEvent arg0) {
- // TODO Auto-generated method stub
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java deleted file mode 100644 index 9aac2464c9..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java +++ /dev/null @@ -1,931 +0,0 @@ -/** @file
- Java class SpdLibClassDecls is GUI for create library definition elements of spd file.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import java.awt.Dimension;
-import java.awt.FontMetrics;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.io.File;
-import java.util.HashMap;
-//import java.util.Iterator;
-//import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.AbstractAction;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.JTextArea;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableModel;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.DataValidation;
-//import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.platform.ui.ListEditor;
-import org.tianocore.frameworkwizard.platform.ui.LongTextEditor;
-//import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;
-//import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-
-
-/**
- GUI for create library definition elements of spd file.
-
- @since PackageEditor 1.0
-**/
-public class SpdLibClassDecls extends IInternalFrame implements TableModelListener{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JFrame topFrame;
-
- private JTable jTable = null;
-
- private DefaultTableModel model = null;
-
- private JPanel jContentPane = null;
-
- private JTextField jTextFieldAddClass = null;
-
- private JComboBox jComboBoxSelect = null;
-
- private JScrollPane jScrollPaneTable = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonRemoveAll = null;
-
- private JLabel jLabelHdr = null;
-
- private JTextField jTextFieldHdr = null;
-
- private JButton jButtonBrowse = null;
-
- private StarLabel starLabel1 = null;
-
- private StarLabel starLabel3 = null;
-
- private SpdFileContents sfc = null;
-
- private OpeningPackageType docConsole = null;
-
- private JLabel jLabel1ClassName = null;
-
- private JScrollPane topScrollPane = null; // @jve:decl-index=0:visual-constraint="10,53"
-
- private int selectedRow = -1;
-
- private StarLabel starLabel2 = null;
-
- private JLabel jLabel2HelpText = null;
-
- private JTextArea jTextAreaHelp = null;
-
- private JScrollPane jHelpTextScrollPane = null;
-
- private JLabel jLabel5SupArchList = null;
-
- private JLabel jLabel6SupModList = null;
-
- private JScrollPane jScrollPaneModules = null;
-
- private JScrollPane jScrollPane1Arch = null;
-
- private ICheckBoxList iCheckBoxListModules = null;
-
- private ICheckBoxList iCheckBoxListArch = null;
-
- private int cnClassName = 0;
- private int cnHdrFile = 1;
- private int cnHelpText = 2;
-// private int cnRecInstName = 3;
-// private int cnRecInstVer = 4;
- private int cnSupArch = 5;
- private int cnSupMod = 6;
-
- private final int classNameMinWidth = 200;
- private final int hdrFileMinWidth = 300;
- private final int helpTextMinWidth = 300;
- private final int supArchMinWidth = 200;
- private final int supModMinWidth = 200;
-
- private final int shortLabel = 90;
- private final int longLabel = 220;
- private final int labelCol = 12;
- private final int shortValueCol = labelCol + shortLabel + 6;
- private final int longValueCol = labelCol + longLabel + 6;
- private final int longValueWidth = 347;
- private final int shortWidth = 140;
- private final int medWidth = 240;
-
- private final int buttonWidth = 99;
-
- private final int addButtonCol = shortValueCol + 10;
- private final int removeButtonCol = addButtonCol + buttonWidth + 10;
- private final int removeAllButtonCol = removeButtonCol + buttonWidth + 10;
-
- private final int rowOne = 12;
- private final int rowTwo = rowOne + 25;
- private final int rowThree = rowTwo + 60 + 25;
- private final int rowFour = rowThree + 25;
- private final int rowFive = rowFour + 40 + 25;
- private final int rowSix = rowFive + 40 + 25;
- private final int rowSeven = rowSix;
- private final int rowEight = rowSeven + 30;
-
- HashMap<String, String> libNameGuidMap = new HashMap<String, String>();
-
-
- /**
- This method initializes this
-
- **/
- private void initialize() {
-
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
- }
-
- /**
- This method initializes jTextFieldAddClass
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextFieldAddClass() {
- if (jTextFieldAddClass == null) {
- jTextFieldAddClass = new JTextField();
- jTextFieldAddClass.setBounds(new java.awt.Rectangle(shortValueCol,rowOne,longValueWidth,20));
- jTextFieldAddClass.setPreferredSize(new java.awt.Dimension(longValueWidth,20));
- jTextFieldAddClass.setEnabled(true);
- }
- return jTextFieldAddClass;
- }
-
- /**
- This method initializes jComboBoxSelect
-
- @return javax.swing.JComboBox
- **/
- private JComboBox getJComboBoxSelect() {
- if (jComboBoxSelect == null) {
- jComboBoxSelect = new JComboBox();
- jComboBoxSelect.setBounds(new java.awt.Rectangle(220, 10, 260, 20));
- jComboBoxSelect.setPreferredSize(new java.awt.Dimension(260,22));
- jComboBoxSelect.setEnabled(true);
- jComboBoxSelect.setVisible(false);
- }
- return jComboBoxSelect;
- }
-
- /**
- This method initializes jScrollPaneTable
-
- @return javax.swing.JScrollPane
-
- Used for the Table of Library Classes that are provided by this package
-
- **/
- private JScrollPane getJScrollPaneTable() {
- if (jScrollPaneTable == null) {
- jScrollPaneTable = new JScrollPane();
- jScrollPaneTable.setBounds(new java.awt.Rectangle(labelCol,rowEight,400,253));
- jScrollPaneTable.setViewportView(getJTable());
- }
- return jScrollPaneTable;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- model = new DefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
- jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
- jTable.setColumnSelectionAllowed(false);
- model.addColumn("Class Name");
- model.addColumn("Header");
- model.addColumn("Help Text");
- model.addColumn("Recommended Instance");
- model.addColumn("Version");
- model.addColumn("Supported Architectures");
- model.addColumn("Supported Module Types");
-
- jTable.getColumnModel().getColumn(cnHelpText).setCellEditor(new LongTextEditor(topFrame));
-
- jTable.removeColumn(jTable.getColumnModel().getColumn(3));
- jTable.removeColumn(jTable.getColumnModel().getColumn(3));
-
- Vector<String> vArch = new Vector<String>();
- vArch.add("IA32");
- vArch.add("X64");
- vArch.add("IPF");
- vArch.add("EBC");
- vArch.add("ARM");
- vArch.add("PPC");
- jTable.getColumnModel().getColumn(cnSupArch - 2).setCellEditor(new ListEditor(vArch, topFrame));
-
- Vector<String> vModule = new Vector<String>();
- vModule.add("BASE");
- vModule.add("SEC");
- vModule.add("PEI_CORE");
- vModule.add("PEIM");
- vModule.add("DXE_CORE");
- vModule.add("DXE_DRIVER");
- vModule.add("DXE_RUNTIME_DRIVER");
- vModule.add("DXE_SAL_DRIVER");
- vModule.add("DXE_SMM_DRIVER");
- vModule.add("UEFI_DRIVER");
- vModule.add("UEFI_APPLICATION");
- vModule.add("USER_DEFINED");
-
- jTable.getColumnModel().getColumn(cnSupMod - 2).setCellEditor(new ListEditor(vModule, topFrame));
-
- TableColumn column = jTable.getColumnModel().getColumn(this.cnClassName);
- column.setMinWidth(this.classNameMinWidth);
- column = jTable.getColumnModel().getColumn(this.cnHdrFile);
- column.setMinWidth(this.hdrFileMinWidth);
- column = jTable.getColumnModel().getColumn(this.cnHelpText);
- column.setMinWidth(this.helpTextMinWidth);
- column = jTable.getColumnModel().getColumn(this.cnSupArch - 2);
- column.setMinWidth(this.supArchMinWidth);
- column = jTable.getColumnModel().getColumn(this.cnSupMod - 2);
- column.setMinWidth(this.supModMinWidth);
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
- });
-
- jTable.getModel().addTableModelListener(this);
-
- }
- return jTable;
- }
-
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int column = arg0.getColumn();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
-
- String lib = m.getValueAt(row, cnClassName) + "";
- String hdr = m.getValueAt(row, cnHdrFile) + "";
- String hlp = m.getValueAt(row, cnHelpText) + "";
- String name = null;
-// if (m.getValueAt(row, cnRecInstName) != null) {
-// name = m.getValueAt(row, cnRecInstName).toString();
-// }
-// String ver = null;
-// if (m.getValueAt(row, cnRecInstVer) != null){
-// ver = m.getValueAt(row, cnRecInstVer).toString();
-// }
- String arch = null;
- if (m.getValueAt(row, cnSupArch) != null) {
- arch = m.getValueAt(row, cnSupArch).toString();
- }
- String module = null;
- if (m.getValueAt(row, cnSupMod) != null) {
- module = m.getValueAt(row, cnSupMod).toString();
- }
- String[] rowData = {lib, hdr, hlp, name};
- if (!dataValidation(rowData)) {
- return;
- }
-
- String guid = null;
-// if (name != null && name.length() > 0) {
-// getLibInstances(lib);
-// guid = nameToGuid(name);
-// if (guid == null){
-// JOptionPane.showMessageDialog(frame, "Recommended Instance does not exist.");
-// return;
-// }
-// }
-
- String[] sa = new String[7];
- sfc.getSpdLibClassDeclaration(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (cellData == null) {
- cellData = "";
- }
-// if (column == cnRecInstName) {
-// if (guid == null) {
-// if (sa[cnRecInstName] == null) {
-// return;
-// }
-// }
-// else {
-// if (guid.equals(sa[cnRecInstName])) {
-// return;
-// }
-// }
-// }
- if (cellData.equals(sa[column])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
- docConsole.setSaved(false);
- sfc.updateSpdLibClass(row, lib, hdr, hlp, guid, null, arch, module);
- }
- }
-
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setText("Add");
- jButtonAdd.setSize(new java.awt.Dimension(buttonWidth,20));
- jButtonAdd.setBounds(new java.awt.Rectangle(addButtonCol,rowSeven,buttonWidth,20));
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setText("Delete");
- jButtonRemove.setSize(new java.awt.Dimension(buttonWidth,20));
- jButtonRemove.setBounds(new java.awt.Rectangle(removeButtonCol,rowSeven,buttonWidth,20));
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonRemoveAll
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonRemoveAll() {
- if (jButtonRemoveAll == null) {
- jButtonRemoveAll = new JButton();
- jButtonRemoveAll.setText("Clear All");
- jButtonRemoveAll.setLocation(removeAllButtonCol,rowSeven);
- FontMetrics fm = jButtonRemoveAll.getFontMetrics(jButtonRemoveAll.getFont());
- jButtonRemoveAll.setSize(fm.stringWidth(jButtonRemoveAll.getText()) + 50, 20);
- jButtonRemoveAll.addActionListener(this);
- }
- return jButtonRemoveAll;
- }
-
- /**
- This is the default constructor
- **/
- public SpdLibClassDecls(JFrame frame) {
- super();
- topFrame = frame;
- initialize();
- init();
-
- }
-
- public SpdLibClassDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame){
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdLibClassDecls(OpeningPackageType opt, JFrame frame) {
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- }
- /**
- This method initializes this
-
- @return void
- **/
- private void init() {
-
- this.setContentPane(getJContentPane());
- this.setTitle("Library Class Declarations");
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
- this.setVisible(true);
- this.addInternalFrameListener(new InternalFrameAdapter(){
- public void internalFrameDeactivated(InternalFrameEvent e){
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
- }
- });
- }
-
- private void init(SpdFileContents sfc) {
-
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(topFrame, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
-
- if (sfc.getSpdLibClassDeclarationCount() == 0) {
- return ;
- }
- //
- // initialize table using SpdFileContents object
- //
- String[][] saa = new String[sfc.getSpdLibClassDeclarationCount()][7];
- sfc.getSpdLibClassDeclarations(saa);
- int i = 0;
- while (i < saa.length) {
-// if (saa[i][3] != null && saa[i][3].length() > 0) {
-// getLibInstances(saa[i][0]);
-// saa[i][3] = guidToName(saa[i][3]);
-// }
-
- model.addRow(saa[i]);
- i++;
- }
-
- }
-
- private void initFrame() {
- boolean editable = true;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- editable = false;
- }
-
- jButtonAdd.setEnabled(editable);
- jButtonRemove.setEnabled(editable);
- jButtonRemoveAll.setEnabled(editable);
- jTable.setEnabled(editable);
- }
-
- private JScrollPane getJContentPane(){
- if (topScrollPane == null){
- topScrollPane = new JScrollPane();
- topScrollPane.setViewportView(getJContentPane1());
- }
- return topScrollPane;
- }
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel
- **/
- private JPanel getJContentPane1() {
- if (jContentPane == null) {
- // Library Class
- starLabel1 = new StarLabel();
- starLabel1.setLocation(new java.awt.Point(1,rowOne));
- jLabel1ClassName = new JLabel();
- jLabel1ClassName.setBounds(new java.awt.Rectangle(labelCol,rowOne,shortLabel,20));
- jLabel1ClassName.setText("Library Class");
-
- // Help Text
- starLabel2 = new StarLabel();
- starLabel2.setBounds(new java.awt.Rectangle(1,rowTwo,10,20));
- jLabel2HelpText = new JLabel();
- jLabel2HelpText.setBounds(new java.awt.Rectangle(labelCol,rowTwo,shortLabel,20));
- jLabel2HelpText.setText("Help Text");
-
- // Header File
- starLabel3 = new StarLabel();
- starLabel3.setLocation(new java.awt.Point(1,rowThree));
- jLabelHdr = new JLabel();
- jLabelHdr.setBounds(new java.awt.Rectangle(labelCol,rowThree,longLabel,20));
- jLabelHdr.setText("Include Header for Specified Class");
-
- jLabel6SupModList = new JLabel();
- jLabel6SupModList.setBounds(new java.awt.Rectangle(labelCol,rowFive,longLabel,20));
- jLabel6SupModList.setText("Supported Module Types");
- jLabel6SupModList.setEnabled(true);
-
- jLabel5SupArchList = new JLabel();
- jLabel5SupArchList.setBounds(new java.awt.Rectangle(labelCol,rowFour,longLabel,20));
- jLabel5SupArchList.setText("Supported Architectures");
- jLabel5SupArchList.setEnabled(true);
-
- jContentPane = new JPanel();
- jContentPane.setPreferredSize(new Dimension(680, 600));
- jContentPane.setLayout(null);
- jContentPane.add(jLabelHdr, null);
- jContentPane.add(starLabel1, null);
- jContentPane.add(starLabel3, null);
- jContentPane.add(getJTextFieldAddClass(), null);
- jContentPane.add(getJComboBoxSelect(), null);
- jContentPane.add(getJScrollPaneTable(), null);
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonRemoveAll(), null);
-
- jContentPane.add(getJTextFieldHdr(), null);
- jContentPane.add(getJButtonBrowse(), null);
- jContentPane.add(jLabel1ClassName, null);
- jContentPane.add(starLabel2, null);
- jContentPane.add(jLabel2HelpText, null);
- jContentPane.add(getJHelpTextScrollPane(), null);
-
- jContentPane.add(jLabel5SupArchList, null);
- jContentPane.add(jLabel6SupModList, null);
-
- jContentPane.add(getJScrollPaneModules(), null);
- jContentPane.add(getJScrollPane1Arch(), null);
-
- }
-
- return jContentPane;
- }
-
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonAdd) {
-
- //ToDo: check before add
- // LAH WAS String[] row = {null, null, null, jComboBox.getSelectedItem()+"", jTextField2RecInstVer.getText(), null, null};
- String[] row = {null, null, null, null, null, null, null};
- row[cnClassName] = jTextFieldAddClass.getText();
- row[cnHdrFile] = jTextFieldHdr.getText().replace('\\', '/');
- row[cnHelpText] = jTextAreaHelp.getText();
-// row[cnRecInstName] = jComboBox.getSelectedItem()+"";
-// row[cnRecInstVer] = jTextField2RecInstVer.getText();
- row[cnSupArch] = vectorToString(iCheckBoxListArch.getAllCheckedItemsString());
- if (row[cnSupArch].length() == 0) {
- row[cnSupArch] = null;
- }
- row[cnSupMod] = vectorToString(iCheckBoxListModules.getAllCheckedItemsString());
- if (row[cnSupMod].length() == 0){
- row[cnSupMod] = null;
- }
- if (!dataValidation(row)) {
- return;
- }
- //
- //convert to GUID before storing recommended lib instance.
- //
-// getLibInstances(row[cnClassName]);
-// String recommendGuid = nameToGuid(row[cnRecInstName]);
-// if (row[cnRecInstName].equals("null")) {
-// row[cnRecInstName] = null;
-// }
-// else{
-// if (recommendGuid == null) {
-// JOptionPane.showMessageDialog(frame, "Recommended Instance does not exist.");
-// return;
-// }
-// }
-
- sfc.genSpdLibClassDeclarations(row[cnClassName], null, row[cnHdrFile], row[cnHelpText], row[cnSupArch], null, null, null, null, row[cnSupMod]);
- model.addRow(row);
- jTable.changeSelection(model.getRowCount()-1, 0, false, false);
- docConsole.setSaved(false);
- }
- //
- // remove selected line
- //
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()){
- jTable.getCellEditor().stopCellEditing();
- }
- int rowSelected = selectedRow;
- if (rowSelected >= 0) {
- model.removeRow(rowSelected);
- docConsole.setSaved(false);
- sfc.removeSpdLibClass(rowSelected);
- }
- }
-
- if (arg0.getSource() == jButtonRemoveAll) {
- if (model.getRowCount() == 0) {
- return;
- }
- docConsole.setSaved(false);
- model.setRowCount(0);
- sfc.removeSpdLibClass();
- }
- }
-
- private boolean dataValidation(String[] row) {
- if (!DataValidation.isKeywordType(row[cnClassName])) {
- JOptionPane.showMessageDialog(this, "Library Class name entered does not match KeyWord datatype.");
- return false;
- }
- if (!DataValidation.isPathAndFilename(row[cnHdrFile])) {
- JOptionPane.showMessageDialog(this, "Include Header does not match the PathAndFilename datatype.");
- return false;
- }
- if (row[cnHelpText].length() == 0) {
- JOptionPane.showMessageDialog(this, "Help Text must be entered!");
- return false;
- }
-// if (row[cnRecInstVer] != null && row[cnRecInstVer].length() > 0) {
-// if (row[cnRecInstName] == null || row[cnRecInstName].length() == 0) {
-// JOptionPane.showMessageDialog(frame, "Recommended Instance Version must associate with the Instance Name.");
-// return false;
-// }
-//
-// if (!DataValidation.isVersionDataType(row[cnRecInstVer])) {
-// JOptionPane.showMessageDialog(frame, "Recommended Instance Version does not match Version datatype.");
-// return false;
-// }
-// }
- return true;
- }
- /**
- Add contents in list to sfc
- **/
- protected void save() {
-
- }
-
- /**
- This method initializes jTextField
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextFieldHdr() {
- if (jTextFieldHdr == null) {
- jTextFieldHdr = new JTextField();
- jTextFieldHdr.setPreferredSize(new java.awt.Dimension(shortWidth,20));
- jTextFieldHdr.setLocation(new java.awt.Point(longValueCol,rowThree));
- jTextFieldHdr.setSize(new java.awt.Dimension(shortWidth,20));
- }
- return jTextFieldHdr;
- }
-
- /**
- This method initializes jButtonBrowse
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonBrowse() {
- if (jButtonBrowse == null) {
- jButtonBrowse = new JButton();
- jButtonBrowse.setBounds(new java.awt.Rectangle(longValueCol + shortWidth + 7,rowThree,90,20));
- jButtonBrowse.setText("Browse");
- jButtonBrowse.setPreferredSize(new java.awt.Dimension(99,20));
- jButtonBrowse.addActionListener(new AbstractAction() {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent arg0) {
- //
- // Select files from current pkg
- //
- String dirPrefix = Tools.dirForNewSpd.substring(0, Tools.dirForNewSpd.lastIndexOf(File.separator));
- JFileChooser chooser = new JFileChooser(dirPrefix);
- File theFile = null;
- String headerDest = null;
-
- chooser.setMultiSelectionEnabled(false);
- chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
- int retval = chooser.showOpenDialog(topFrame);
- if (retval == JFileChooser.APPROVE_OPTION) {
-
- theFile = chooser.getSelectedFile();
- String file = theFile.getPath();
- if (!file.startsWith(dirPrefix)) {
- JOptionPane.showMessageDialog(topFrame, "You can only select files in current package directory structure!");
- return;
- }
-
-
- }
- else {
- return;
- }
-
- headerDest = theFile.getPath();
- int fileIndex = headerDest.indexOf(System.getProperty("file.separator"), dirPrefix.length());
- jTextFieldHdr.setText(headerDest.substring(fileIndex + 1).replace('\\', '/'));
-
- }
-
- });
- }
- return jButtonBrowse;
- }
-
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = 500;
-
- Tools.resizeComponentWidth(this.jTextFieldAddClass, this.getWidth(), intPreferredWidth-28);
- Tools.resizeComponentWidth(this.jHelpTextScrollPane, this.getWidth(), intPreferredWidth-28);
- Tools.resizeComponentWidth(this.jScrollPaneTable, this.getWidth(), intPreferredWidth-10);
- Tools.resizeComponentWidth(this.jTextFieldHdr, this.getWidth(), intPreferredWidth - 7);
- Tools.relocateComponentX(this.jButtonBrowse, this.getWidth(), intPreferredWidth,
- DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
- }
-
- /**
- * This method initializes jHelpTextScrollPane
- *
- * @return javax.swing.JScrollPane jHelpTextScrollPane
- */
- private JScrollPane getJHelpTextScrollPane() {
- if (jHelpTextScrollPane == null) {
- jHelpTextScrollPane = new JScrollPane();
- jHelpTextScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jHelpTextScrollPane.setPreferredSize(new java.awt.Dimension(longValueWidth, 80));
- jHelpTextScrollPane.setSize(new java.awt.Dimension(longValueWidth, 80));
- jHelpTextScrollPane.setLocation(new java.awt.Point(shortValueCol,rowTwo));
- jHelpTextScrollPane.setViewportView(getJTextAreaHelp());
- }
- return jHelpTextScrollPane;
- }
-
- /**
- * This method initializes jTextAreaHelp
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextAreaHelp() {
- if (jTextAreaHelp == null) {
- jTextAreaHelp = new JTextArea();
- jTextAreaHelp.setLineWrap(true);
- jTextAreaHelp.setWrapStyleWord(true);
- }
- return jTextAreaHelp;
- }
-
- private JScrollPane getJScrollPaneModules() {
- if (jScrollPaneModules == null) {
- jScrollPaneModules = new JScrollPane();
- jScrollPaneModules.setBounds(new java.awt.Rectangle(longValueCol,rowFive,medWidth,60));
- jScrollPaneModules.setPreferredSize(new java.awt.Dimension(medWidth, 60));
- jScrollPaneModules.setViewportView(getICheckBoxListSupportedModules());
- }
- return jScrollPaneModules;
- }
-
- private ICheckBoxList getICheckBoxListSupportedModules() {
- if (iCheckBoxListModules == null) {
- iCheckBoxListModules = new ICheckBoxList();
- iCheckBoxListModules.setBounds(new java.awt.Rectangle(longValueCol,rowFour,medWidth,60));
- Vector<String> v = new Vector<String>();
- v.add("BASE");
- v.add("SEC");
- v.add("PEI_CORE");
- v.add("PEIM");
- v.add("DXE_CORE");
- v.add("DXE_DRIVER");
- v.add("DXE_RUNTIME_DRIVER");
- v.add("DXE_SAL_DRIVER");
- v.add("DXE_SMM_DRIVER");
- v.add("UEFI_DRIVER");
- v.add("UEFI_APPLICATION");
- v.add("USER_DEFINED");
- iCheckBoxListModules.setAllItems(v);
- }
- return iCheckBoxListModules;
- }
-
- private String vectorToString(Vector<String> v) {
- String s = " ";
- for (int i = 0; i < v.size(); ++i) {
- s += v.get(i);
- s += " ";
- }
- return s.trim();
- }
-
- private JScrollPane getJScrollPane1Arch() {
- if (jScrollPane1Arch == null) {
- jScrollPane1Arch = new JScrollPane();
- jScrollPane1Arch.setBounds(new java.awt.Rectangle(longValueCol,rowFour,medWidth,60));
- jScrollPane1Arch.setPreferredSize(new java.awt.Dimension(medWidth, 60));
- jScrollPane1Arch.setViewportView(getICheckBoxListArch());
- }
- return jScrollPane1Arch;
- }
- /**
- * This method initializes iCheckBoxList
- *
- * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
- */
- private ICheckBoxList getICheckBoxListArch() {
- if (iCheckBoxListArch == null) {
- iCheckBoxListArch = new ICheckBoxList();
- iCheckBoxListArch.setBounds(new java.awt.Rectangle(longValueCol,rowFour,medWidth,60));
- Vector<String> v = new Vector<String>();
- v.add("IA32");
- v.add("X64");
- v.add("IPF");
- v.add("EBC");
- v.add("ARM");
- v.add("PPC");
- iCheckBoxListArch.setAllItems(v);
- }
- return iCheckBoxListArch;
- }
-
-// private void getLibInstances(String libClass){
-// libNameGuidMap.clear();
-// try {
-// Iterator ismi = GlobalData.vModuleList.iterator();
-// while (ismi.hasNext()) {
-// ModuleIdentification mi = (ModuleIdentification) ismi.next();
-//
-// Vector<String> classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
-// for (int i = 0; i < classProduced.size(); ++i) {
-// if (classProduced.get(i).equals(libClass)) {
-// libNameGuidMap.put(mi.getName(), mi.getGuid());
-// }
-// }
-// }
-//
-// }
-// catch(Exception e){
-// JOptionPane.showMessageDialog(frame, "Search Instances Failed.");
-// }
-//
-// }
-
-// private String nameToGuid(String name) {
-// String s = null;
-// if (!libNameGuidMap.containsKey(name)) {
-// return s;
-// }
-//
-// s = libNameGuidMap.get(name);
-// return s;
-// }
-
-// private String guidToName(String guid){
-// String s = "";
-// if (!libNameGuidMap.containsValue(guid)) {
-// return s;
-// }
-// Set<String> key = libNameGuidMap.keySet();
-// Iterator<String> is = key.iterator();
-// while(is.hasNext()) {
-// s = is.next();
-// if (libNameGuidMap.get(s).equals(guid)) {
-// break;
-// }
-// }
-// return s;
-// }
-
-}
-
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java deleted file mode 100644 index fb23e05659..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java +++ /dev/null @@ -1,517 +0,0 @@ -/** @file
- Java class SpdMsaFiles is GUI for create library definition elements of spd file.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.io.File;
-
-import javax.swing.AbstractAction;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-
-/**
- GUI for create library definition elements of spd file.
-
- @since PackageEditor 1.0
-**/
-public class SpdMsaFiles extends IInternalFrame implements TableModelListener{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JFrame topFrame;
-
- private JScrollPane jScrollPane = null; // @jve:decl-index=0:visual-constraint="10,95"
-
- private JTable jTable = null;
-
- private DefaultTableModel model = null;
-
- private JPanel jContentPane = null;
-
- private JScrollPane jScrollPaneMsa = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonClearAll = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonOk = null;
-
- private JLabel jLabel = null;
-
- private JTextField jTextField = null;
-
- private JButton jButtonBrowse = null;
-
- private StarLabel jStarLabel2 = null;
-
- private SpdFileContents sfc = null;
-
- private OpeningPackageType docConsole = null;
-
- private int selectedRow = -1;
-
- /**
- This method initializes this
-
- **/
- private void initialize() {
-
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
- }
-
- /**
- This method initializes jScrollPane
-
- @return javax.swing.JScrollPane
- **/
- private JScrollPane getJScrollPaneMsa() {
- if (jScrollPaneMsa == null) {
- jScrollPaneMsa = new JScrollPane();
- jScrollPaneMsa.setBounds(new java.awt.Rectangle(13,177,461,421));
- jScrollPaneMsa.setViewportView(getJTable());
- }
- return jScrollPaneMsa;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- **/
- private JTable getJTable() {
- if (jTable == null) {
- model = new DefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
- model.addColumn("MsaFile");
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
- });
-
- jTable.getModel().addTableModelListener(this);
- }
- return jTable;
- }
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(163,148,90,20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(266,148,90,20));
- jButtonRemove.setText("Delete");
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonRemoveAll
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonClearAll() {
- if (jButtonClearAll == null) {
- jButtonClearAll = new JButton();
- jButtonClearAll.setBounds(new java.awt.Rectangle(374,148,90,20));
- jButtonClearAll.setText("Clear All");
- jButtonClearAll.addActionListener(this);
- }
- return jButtonClearAll;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonCancel.setLocation(new java.awt.Point(390, 305));
- jButtonCancel.setText("Cancel");
- jButtonCancel.setSize(new java.awt.Dimension(90, 20));
- jButtonCancel.setVisible(false);
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes jButton
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setSize(new java.awt.Dimension(90, 20));
- jButtonOk.setText("OK");
- jButtonOk.setLocation(new java.awt.Point(290, 305));
- jButtonOk.setVisible(false);
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This is the default constructor
- **/
- public SpdMsaFiles(JFrame frame) {
- super();
- initialize();
- init();
- topFrame = frame;
- }
-
- public SpdMsaFiles(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame){
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdMsaFiles(OpeningPackageType opt, JFrame frame){
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- }
- /**
- This method initializes this
-
- @return void
- **/
- private void init() {
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
- this.setPreferredSize(new Dimension(490, 400));
- this.setContentPane(getJScrollPane());
- this.setTitle("Msa Files");
- this.addInternalFrameListener(new InternalFrameAdapter(){
- public void internalFrameDeactivated(InternalFrameEvent e){
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
- }
- });
- this.setVisible(true);
- }
-
- private void init(SpdFileContents sfc){
-
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(topFrame, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
-
- if (sfc.getSpdMsaFileCount() == 0) {
- return ;
- }
- //
- // initialize table using SpdFileContents object
- //
- String[][] saa = new String[sfc.getSpdMsaFileCount()][4];
- sfc.getSpdMsaFiles(saa);
- int i = 0;
- while (i < saa.length) {
- model.addRow(saa[i]);
- i++;
- }
-
- }
-
- private JScrollPane getJScrollPane(){
- if (jScrollPane == null){
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(2,24));
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(17,24,111,22));
- jLabel.setText("Msa File ");
-
- jContentPane = new JPanel();
- jContentPane.setPreferredSize(new Dimension(480, 325));
- jContentPane.setLayout(null);
- jContentPane.add(jLabel, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(getJScrollPaneMsa(), null);
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonClearAll(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonOk(), null);
-
- jContentPane.add(getJTextField(), null);
- jContentPane.add(getJButtonBrowse(), null);
- }
- return jContentPane;
- }
-
- /**
- fill ComboBoxes with pre-defined contents
- **/
- private void initFrame() {
- boolean editable = true;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- editable = false;
- }
-
- jButtonAdd.setEnabled(editable);
- jButtonRemove.setEnabled(editable);
- jButtonClearAll.setEnabled(editable);
- jTable.setEnabled(editable);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonOk) {
- this.save();
- this.dispose();
-
- }
- if (arg0.getSource() == jButtonCancel) {
- this.dispose();
- }
-
- if (arg0.getSource() == jButtonAdd) {
- //ToDo: check before add
- String[] row = {jTextField.getText().replace('\\', '/')};
- if (jTextField.getText().length() == 0) {
- JOptionPane.showMessageDialog(this, "Msa File is NOT PathAndFilename type.");
- return;
- }
-
- String dirPrefix = Tools.dirForNewSpd.substring(0, Tools.dirForNewSpd.lastIndexOf(File.separator));
- if (!new File(dirPrefix + File.separator + jTextField.getText()).exists()) {
- JOptionPane.showMessageDialog(this, "File NOT Exists in Current Package.");
- return;
- }
- model.addRow(row);
- jTable.changeSelection(model.getRowCount()-1, 0, false, false);
- sfc.genSpdMsaFiles(row[0], null, null, null);
- docConsole.setSaved(false);
- }
- //
- // remove selected line
- //
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()){
- jTable.getCellEditor().stopCellEditing();
- }
- int rowSelected = selectedRow;
- if (rowSelected >= 0) {
- model.removeRow(rowSelected);
- sfc.removeSpdMsaFile(rowSelected);
- docConsole.setSaved(false);
- }
- }
-
- if (arg0.getSource() == jButtonClearAll) {
- if (model.getRowCount() == 0) {
- return;
- }
- model.setRowCount(0);
- sfc.removeSpdMsaFile();
- docConsole.setSaved(false);
- }
-
- }
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int column = arg0.getColumn();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
- String[] sa = new String[1];
- sfc.getSpdMsaFile(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[column])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
- String file = m.getValueAt(row, 0) + "";
- if (file.length() == 0) {
- JOptionPane.showMessageDialog(this, "Msa File is NOT PathAndFilename type.");
- return;
- }
- docConsole.setSaved(false);
- sfc.updateSpdMsaFile(row, file, null, null, null);
- }
- }
-
- /**
- Add contents in list to sfc
- **/
- protected void save() {
-
- }
-
- /**
- This method initializes jTextField
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextField() {
- if (jTextField == null) {
- jTextField = new JTextField();
- jTextField.setBounds(new java.awt.Rectangle(14,51,346,21));
- jTextField.setPreferredSize(new java.awt.Dimension(345,20));
- }
- return jTextField;
- }
-
- /**
- This method initializes jButtonBrowse
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonBrowse() {
- if (jButtonBrowse == null) {
- jButtonBrowse = new JButton();
- jButtonBrowse.setBounds(new java.awt.Rectangle(376,50,92,21));
- jButtonBrowse.setText("Browse");
- jButtonBrowse.setPreferredSize(new java.awt.Dimension(90,20));
- jButtonBrowse.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- //
- // Select files from current workspace
- //
- String dirPrefix = Tools.dirForNewSpd.substring(0, Tools.dirForNewSpd.lastIndexOf(File.separator));
- JFileChooser chooser = new JFileChooser(dirPrefix);
- File theFile = null;
- String headerDest = null;
-
- chooser.setMultiSelectionEnabled(false);
- chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
- int retval = chooser.showOpenDialog(SpdMsaFiles.this);
- if (retval == JFileChooser.APPROVE_OPTION) {
-
- theFile = chooser.getSelectedFile();
- String file = theFile.getPath();
- if (!file.startsWith(dirPrefix)) {
- JOptionPane.showMessageDialog(SpdMsaFiles.this, "You can only select files in current package!");
- return;
- }
-
-
- }
- else {
- return;
- }
-
- headerDest = theFile.getPath();
- int fileIndex = headerDest.indexOf(System.getProperty("file.separator"), dirPrefix.length());
-
- jTextField.setText(headerDest.substring(fileIndex + 1).replace('\\', '/'));
-
- }
- });
- }
- return jButtonBrowse;
- }
-
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = 500;
-
- Tools.resizeComponentWidth(this.jScrollPaneMsa, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextField, this.getWidth(), intPreferredWidth);
- Tools.relocateComponentX(this.jButtonBrowse, this.getWidth(), this.getPreferredSize().width, 25);
- }
-
-}
-
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java deleted file mode 100644 index 1c1d13a245..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java +++ /dev/null @@ -1,579 +0,0 @@ -/** @file
- Java class SpdPackageHeaders is GUI for create library definition elements of spd file.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.io.File;
-
-import javax.swing.DefaultCellEditor;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTable;
-import javax.swing.JTextField;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-
-/**
- GUI for create library definition elements of spd file.
-
- @since PackageEditor 1.0
-**/
-public class SpdPackageHeaders extends IInternalFrame implements TableModelListener{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JFrame topFrame;
-
- private SpdFileContents sfc = null;
-
- private OpeningPackageType docConsole = null;
-
- private DefaultTableModel model = null;
-
- private JPanel jContentPane = null;
-
- private JLabel jLabelSelect = null;
-
- private JComboBox jComboBoxSelect = null;
-
- private JButton jButtonAdd = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonClearAll = null;
-
- private JLabel jLabel = null;
-
- private JTextField jTextField = null;
-
- private JButton jButtonBrowse = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private JScrollPane jScrollPane = null;
-
- private JScrollPane jScrollPanePkgHdr = null;
-
- private int selectedRow = -1;
-
- private JTable jTable = null;
-
- private final int buttonWidth = 100;
- private final int buttonSep = 6;
- private final int addButtonCol = 148;
- private final int removeButtonCol = addButtonCol + buttonWidth + buttonSep;
- private final int removeAllButtonCol = removeButtonCol + buttonWidth + buttonSep;
- private final int labelCol = 12;
- private final int valueCol = 168;
- private final int rowOne = 12;
- private final int rowTwo = rowOne + 25;
- private final int rowThree = rowTwo + 25;
- private final int rowFour = rowThree + 30;
- private final int rowFive = rowFour + 30;
-
-
- /**
- This method initializes this
-
- **/
- private void initialize() {
-
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
- }
-
- /**
- This method initializes jLabelSelect
-
- @return javax.swing.JLabel jLabelSelect
- **/
- private JLabel getJLabelSelect() {
- if (jLabelSelect == null) {
- jLabelSelect = new JLabel();
- jLabelSelect.setBounds(new java.awt.Rectangle(labelCol,rowOne,155,20));
- jLabelSelect.setText("Select ModuleType");
-
- }
- return jLabelSelect;
- }
-
- /**
- This method initializes jComboBoxSelect
-
- @return javax.swing.JComboBox
- **/
- private JComboBox getJComboBoxSelect() {
- if (jComboBoxSelect == null) {
- jComboBoxSelect = new JComboBox();
- jComboBoxSelect.setBounds(new java.awt.Rectangle(valueCol, rowOne, 260, 20));
- jComboBoxSelect.setPreferredSize(new java.awt.Dimension(260,20));
-
- jComboBoxSelect.setEnabled(true);
- }
- return jComboBoxSelect;
- }
-
- /**
- This method initializes jTable
-
- @return javax.swing.JTable
- *
- private JTable getJTable() {
- if (jTable == null) {
- model = new PackageHeaderTableModel();
- model.addColumn("ModuleType");
- model.addColumn("IncludeHeader");
-
-
- }
- return jTable;
- }*/
- /**
- This method initializes jButtonAdd
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(addButtonCol,rowFour,buttonWidth,20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
- }
-
- /**
- This method initializes jButtonRemove
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(removeButtonCol,rowFour,buttonWidth,20));
- jButtonRemove.setText("Delete");
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- This method initializes jButtonRemoveAll
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonClearAll() {
- if (jButtonClearAll == null) {
- jButtonClearAll = new JButton();
- jButtonClearAll.setBounds(new java.awt.Rectangle(removeAllButtonCol,rowFour,buttonWidth,20));
- jButtonClearAll.setText("Clear All");
- jButtonClearAll.addActionListener(this);
- }
- return jButtonClearAll;
- }
-
- /**
- This is the default constructor
- **/
- public SpdPackageHeaders(JFrame frame) {
- super();
- initialize();
- init();
- topFrame = frame;
- }
-
- public SpdPackageHeaders(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame){
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdPackageHeaders(OpeningPackageType opt, JFrame frame) {
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- }
- /**
- This method initializes this
-
- @return void
- **/
- private void init() {
-
- this.setContentPane(getJScrollPane());
- this.setTitle("Package Headers");
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
- this.setVisible(true);
- this.addInternalFrameListener(new InternalFrameAdapter(){
- public void internalFrameDeactivated(InternalFrameEvent e){
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
- }
- });
- }
-
- private void init(SpdFileContents sfc){
-
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(topFrame, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
-
- if (sfc.getSpdPackageHeaderCount() == 0) {
- return ;
- }
- String[][] saa = new String[sfc.getSpdPackageHeaderCount()][2];
- sfc.getSpdPackageHeaders(saa);
- int i = 0;
- while (i < saa.length) {
- model.addRow(saa[i]);
- i++;
- }
-
- }
-
- private JScrollPane getJScrollPane(){
- if (jScrollPane == null){
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, rowOne));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(0,rowTwo));
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(labelCol,rowTwo,320,22));
- jLabel.setText("Include Header for Module Type");
-
- jContentPane = new JPanel();
- jContentPane.setPreferredSize(new Dimension(480, 325));
- jContentPane.setLayout(null);
- jContentPane.add(jLabel, null);
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(getJLabelSelect(), null);
- jContentPane.add(getJComboBoxSelect(), null);
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonClearAll(), null);
-
- jContentPane.add(getJTextField(), null);
- jContentPane.add(getJButtonBrowse(), null);
- jContentPane.add(getJScrollPanePkgHdr(), null);
- }
- return jContentPane;
- }
-
- /**
- fill ComboBoxes with pre-defined contents
- **/
- private void initFrame() {
- jComboBoxSelect.addItem("BASE");
- jComboBoxSelect.addItem("SEC");
- jComboBoxSelect.addItem("PEI_CORE");
- jComboBoxSelect.addItem("PEIM");
- jComboBoxSelect.addItem("DXE_CORE");
- jComboBoxSelect.addItem("DXE_DRIVER");
- jComboBoxSelect.addItem("DXE_RUNTIME_DRIVER");
- jComboBoxSelect.addItem("DXE_SAL_DRIVER");
- jComboBoxSelect.addItem("DXE_SMM_DRIVER");
- jComboBoxSelect.addItem("TOOL");
- jComboBoxSelect.addItem("UEFI_DRIVER");
- jComboBoxSelect.addItem("UEFI_APPLICATION");
- jComboBoxSelect.addItem("USER_DEFINED");
- jComboBoxSelect.setSelectedIndex(0);
-
- boolean editable = true;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- editable = false;
- }
-
- jButtonAdd.setEnabled(editable);
- jButtonRemove.setEnabled(editable);
- jButtonClearAll.setEnabled(editable);
- jTable.setEnabled(editable);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
-
- docConsole.setSaved(false);
-
- if (arg0.getSource() == jButtonAdd) {
- String strLibClass = "";
-
- strLibClass = jComboBoxSelect.getSelectedItem().toString();
- //ToDo: check before add
- String[] row = {"", ""};
- row[0] = strLibClass;
- row[1] = jTextField.getText().replace('\\', '/');
- if (!dataValidation(row)) {
- return;
- }
- model.addRow(row);
- jTable.changeSelection(model.getRowCount()-1, 0, false, false);
- sfc.genSpdModuleHeaders(row[0], row[1], null, null, null, null, null, null);
- }
- //
- // remove selected line
- //
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()){
- jTable.getCellEditor().stopCellEditing();
- }
- int rowSelected = selectedRow;
- if (rowSelected >= 0) {
- model.removeRow(rowSelected);
- sfc.removeSpdPkgHeader(rowSelected);
- }
- }
-
- if (arg0.getSource() == jButtonClearAll) {
- if (model.getRowCount() == 0) {
- return;
- }
- model.setRowCount(0);
- sfc.removeSpdPkgHeader();
- }
-
- }
-
- private boolean dataValidation(String[] row) {
- if (!DataValidation.isPathAndFilename(row[1])) {
- JOptionPane.showMessageDialog(this, "Include header path is NOT PathAndFilename type.");
- return false;
- }
-
- return true;
- }
-
- /**
- Add contents in list to sfc
- **/
- protected void save() {
-
- }
-
- /**
- This method initializes jTextField
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextField() {
- if (jTextField == null) {
- jTextField = new JTextField();
- jTextField.setBounds(new java.awt.Rectangle(labelCol,rowThree,346,20));
- jTextField.setPreferredSize(new java.awt.Dimension(345,20));
- }
- return jTextField;
- }
-
- /**
- This method initializes jButtonBrowse
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonBrowse() {
- if (jButtonBrowse == null) {
- jButtonBrowse = new JButton();
- jButtonBrowse.setBounds(new java.awt.Rectangle(374,rowThree,buttonWidth,20));
- jButtonBrowse.setText("Browse");
- jButtonBrowse.setPreferredSize(new java.awt.Dimension(buttonWidth,20));
- jButtonBrowse.addActionListener(new javax.swing.AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- //
- // Select files from current workspace
- //
- String dirPrefix = Tools.dirForNewSpd.substring(0, Tools.dirForNewSpd.lastIndexOf(File.separator));
- JFileChooser chooser = new JFileChooser(dirPrefix);
- File theFile = null;
- String headerDest = null;
-
- chooser.setMultiSelectionEnabled(false);
- chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
- int retval = chooser.showOpenDialog(SpdPackageHeaders.this);
- if (retval == JFileChooser.APPROVE_OPTION) {
-
- theFile = chooser.getSelectedFile();
- String file = theFile.getPath();
- if (!file.startsWith(dirPrefix)) {
- JOptionPane.showMessageDialog(SpdPackageHeaders.this, "You can only select files in current package!");
- return;
- }
-
-
- }
- else {
- return;
- }
-
- headerDest = theFile.getPath();
- int fileIndex = headerDest.indexOf(System.getProperty("file.separator"), dirPrefix.length());
-
- jTextField.setText(headerDest.substring(fileIndex + 1).replace('\\', '/'));
-
- }
- });
- }
- return jButtonBrowse;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPanePkgHdr() {
- if (jScrollPanePkgHdr == null) {
- jScrollPanePkgHdr = new JScrollPane();
- jScrollPanePkgHdr.setBounds(new java.awt.Rectangle(labelCol,rowFive,453,258));
- jScrollPanePkgHdr.setViewportView(getJTable());
- }
- return jScrollPanePkgHdr;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTable() {
- if (jTable == null) {
- model = new DefaultTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
- model.addColumn("ModuleType");
- model.addColumn("IncludeHeader");
- TableColumn typeColumn = jTable.getColumnModel().getColumn(0);
- JComboBox jComboBoxSelect = new JComboBox();
- jComboBoxSelect.addItem("BASE");
- jComboBoxSelect.addItem("SEC");
- jComboBoxSelect.addItem("PEI_CORE");
- jComboBoxSelect.addItem("PEIM");
- jComboBoxSelect.addItem("DXE_CORE");
- jComboBoxSelect.addItem("DXE_DRIVER");
- jComboBoxSelect.addItem("DXE_RUNTIME_DRIVER");
- jComboBoxSelect.addItem("DXE_SAL_DRIVER");
- jComboBoxSelect.addItem("DXE_SMM_DRIVER");
- jComboBoxSelect.addItem("TOOL");
- jComboBoxSelect.addItem("UEFI_DRIVER");
- jComboBoxSelect.addItem("UEFI_APPLICATION");
- jComboBoxSelect.addItem("USER_DEFINED");
- typeColumn.setCellEditor(new DefaultCellEditor(jComboBoxSelect));
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
- });
-
- jTable.getModel().addTableModelListener(this);
- }
- return jTable;
- }
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int column = arg0.getColumn();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
- String[] sa = new String[2];
- sfc.getSpdModuleHeader(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[column])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
- String pkg = m.getValueAt(row, 0) + "";
- String hdr = m.getValueAt(row, 1) + "";
- String[] rowData = {pkg, hdr};
- if (!dataValidation(rowData)) {
- return;
- }
- docConsole.setSaved(false);
- sfc.updateSpdPkgHdr(row, pkg, hdr);
- }
- }
-
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = 500;
-
- // Tools.resizeComponentWidth(this.jComboBoxSelect, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextField, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPanePkgHdr, this.getWidth(), intPreferredWidth);
- Tools.relocateComponentX(this.jButtonBrowse, this.getWidth(), this.getPreferredSize().width, 30);
- }
-
-}
-
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java deleted file mode 100644 index 3886843072..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java +++ /dev/null @@ -1,1242 +0,0 @@ -/** @file
- Java class SpdPcdDefs is GUI for create PCD definition elements of spd file.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import java.awt.Dimension;
-import java.awt.FontMetrics;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-
-import javax.swing.DefaultCellEditor;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JLabel;
-import javax.swing.JTextField;
-import javax.swing.JComboBox;
-import javax.swing.JButton;
-import javax.swing.ListSelectionModel;
-
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JCheckBox;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.platform.ui.ListEditor;
-import org.tianocore.frameworkwizard.platform.ui.LongTextEditor;
-
-import java.awt.Rectangle;
-import java.util.Vector;
-
-/**
- GUI for create PCD definition elements of spd file
-
- @since PackageEditor 1.0
-**/
-public class SpdPcdDefs extends IInternalFrame implements TableModelListener{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JFrame topFrame;
-
- private JPanel jContentPane = null;
-
- private JLabel jLabelItemType = null;
-
- private JLabel jLabelC_Name = null;
-
- private JTextField jTextFieldC_Name = null;
-
- private JLabel jLabelToken = null;
-
- private JTextField jTextFieldToken = null;
-
- private JLabel jLabelDataType = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private JComboBox jComboBoxDataType = null;
-
- private SpdFileContents sfc = null;
-
- private OpeningPackageType docConsole = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private StarLabel jStarLabel4 = null;
-
- private StarLabel jStarLabel = null;
-
- private StarLabel jStarLabel1 = null;
-
- private JLabel jLabelTokenSpace = null;
-
- private JComboBox jComboBoxTsGuid = null;
-
- private JLabel jLabelVarVal = null;
-
- private JTextField jTextFieldHelp = null;
-
- private JLabel jLabelDefVal = null;
-
- private JTextField jTextFieldDefaultValue = null;
-
- private JButton jButtonAdd = null;
-
- private CheckboxTableModel model = null;
-
- private JButton jButtonRemove = null;
-
- private JButton jButtonClearAll = null;
-
- private JScrollPane jScrollPane = null;
-
- private JTable jTable = null;
-
- private JScrollPane topScrollPane = null; // @jve:decl-index=0:visual-constraint="390,10"
-
- private int selectedRow = -1;
-
- private StarLabel starLabel = null;
-
- private JCheckBox jCheckBoxFeatureFlag = null;
-
- private JCheckBox jCheckBoxFixedAtBuild = null;
-
- private JCheckBox jCheckBoxPatchInMod = null;
-
- private JCheckBox jCheckBoxDyn = null;
-
- private JCheckBox jCheckBoxDynEx = null;
-
- private JScrollPane jScrollPaneArch = null;
-
- private ICheckBoxList iCheckBoxListArch = null;
-
- private JScrollPane jScrollPaneMod = null;
-
- private ICheckBoxList iCheckBoxListMod = null;
-
- private JLabel jLabelSupMod = null;
-
- private JLabel jLabelSupArch = null;
-
- private final int pcdCNameMinWidth = 200;
- private final int pcdTokenMinWidth = 100;
- private final int pcdTokenSpaceMinWidth = 200;
- private final int datumTypeMinWidth = 80;
- private final int defaultValueMinWidth = 100;
- private final int helpTextMinWidth = 200;
- private final int usageMinWidth = 60;
- private final int supArchMinWidth = 200;
- private final int supModMinWidth = 200;
-
-// private Object boolModifyLock = new Object();
-// private boolean exclusiveUsage = false;
-
- /**
- This method initializes this
-
- **/
- private void initialize() {
- this.setTitle("PCD Declarations");
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
- int xPos = jCheckBoxPatchInMod.getX() + jCheckBoxPatchInMod.getWidth();
- jCheckBoxFixedAtBuild.setLocation(xPos,133);
-
- xPos = jCheckBoxFeatureFlag.getX() + jCheckBoxFeatureFlag.getWidth();
- jCheckBoxDyn.setLocation(xPos,161);
-
- xPos = jCheckBoxDyn.getX() + jCheckBoxDyn.getWidth();
- jCheckBoxDynEx.setLocation(xPos,161);
-
- }
-
- /**
- This method initializes jTextFieldC_Name
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextFieldC_Name() {
- if (jTextFieldC_Name == null) {
- jTextFieldC_Name = new JTextField();
- jTextFieldC_Name.setBounds(new java.awt.Rectangle(156,9,317,20));
- jTextFieldC_Name.setPreferredSize(new java.awt.Dimension(315,20));
- }
- return jTextFieldC_Name;
- }
-
- /**
- This method initializes jTextFieldToken
-
- @return javax.swing.JTextField
- **/
- private JTextField getJTextFieldToken() {
- if (jTextFieldToken == null) {
- jTextFieldToken = new JTextField();
- jTextFieldToken.setBounds(new java.awt.Rectangle(156,33,317,20));
- jTextFieldToken.setPreferredSize(new java.awt.Dimension(315,20));
- }
- return jTextFieldToken;
- }
-
- /**
- This method initializes jButtonOk
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setText("OK");
- jButtonOk.setBounds(new java.awt.Rectangle(279,276,90,20));
- jButtonOk.setVisible(false);
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setText("Cancel");
- jButtonCancel.setBounds(new java.awt.Rectangle(389,276,82,20));
- jButtonCancel.setVisible(false);
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes jComboBoxDataType
-
- @return javax.swing.JComboBox
- **/
- private JComboBox getJComboBoxDataType() {
- if (jComboBoxDataType == null) {
- jComboBoxDataType = new JComboBox();
- jComboBoxDataType.setBounds(new java.awt.Rectangle(156,84,110,20));
- }
- return jComboBoxDataType;
- }
-
- /**
- This is the default constructor
- **/
- public SpdPcdDefs(JFrame frame) {
- super();
- init();
- initialize();
- topFrame = frame;
- }
-
- public SpdPcdDefs(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame) {
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdPcdDefs(OpeningPackageType opt, JFrame frame) {
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- }
- /**
- This method initializes this
-
- @return void
- **/
- private void init() {
- this.setSize(500, 650);
- this.setContentPane(getJContentPane());
- this.addInternalFrameListener(new InternalFrameAdapter(){
- public void internalFrameDeactivated(InternalFrameEvent e){
- if (jTable.isEditing()) {
- jTable.getCellEditor().stopCellEditing();
- }
- }
- });
-
- this.setVisible(true);
- }
-
- private void init(SpdFileContents sfc){
-
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(topFrame, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
-
- if (sfc.getSpdPcdDefinitionCount() == 0) {
- return ;
- }
- String[][] saa = new String[sfc.getSpdPcdDefinitionCount()][8];
- String[][] usage = new String[sfc.getSpdPcdDefinitionCount()][5];
- Object[] rowData = new Object[13];
- sfc.getSpdPcdDefinitions(saa, usage);
- int i = 0;
- while (i < saa.length) {
-
- for (int k = 0; k < 6; ++k) {
- rowData[k] = saa[i][k];
- }
- for (int m = 6; m < 11; ++m) {
- rowData[m] = new Boolean("false");
- }
- int j = 0;
- while (j < 5) {
- if (usage[i][j] == null || usage[i][j].length()==0){
- ++j;
- continue;
- }
- if (usage[i][j].equals("FEATURE_FLAG")){
- rowData[6] = new Boolean("true");
- }
- if (usage[i][j].equals("FIXED_AT_BUILD")){
- rowData[7] = new Boolean("true");
- }
- if (usage[i][j].equals("PATCHABLE_IN_MODULE")){
- rowData[8] = new Boolean("true");
- }
- if (usage[i][j].equals("DYNAMIC")){
- rowData[9] = new Boolean("true");
- }
- if (usage[i][j].equals("DYNAMIC_EX")){
- rowData[10] = new Boolean("true");
- }
-
- ++j;
- }
-
- rowData[11] = saa[i][6];
- rowData[12] = saa[i][7];
-
- model.addRow(rowData);
-
- i++;
- }
-
- }
-
- private JScrollPane getJContentPane(){
- if (topScrollPane == null){
- topScrollPane = new JScrollPane();
- topScrollPane.setSize(new java.awt.Dimension(482,451));
- topScrollPane.setViewportView(getJContentPane1());
- }
- return topScrollPane;
- }
- private JPanel getJContentPane1() {
- if (jContentPane == null) {
-
- jLabelSupArch = new JLabel();
- jLabelSupArch.setBounds(new java.awt.Rectangle(241,192,89,16));
- jLabelSupArch.setText("Supported Architectures");
- jLabelSupArch.setEnabled(true);
- FontMetrics fm = jLabelSupArch.getFontMetrics(jLabelSupArch.getFont());
- jLabelSupArch.setSize(fm.stringWidth(jLabelSupArch.getText()) + 10, 20);
- jLabelSupMod = new JLabel();
- jLabelSupMod.setBounds(new java.awt.Rectangle(15,193,103,16));
- jLabelSupMod.setText("Supported Module types");
- jLabelSupMod.setEnabled(true);
- fm = jLabelSupMod.getFontMetrics(jLabelSupMod.getFont());
- jLabelSupMod.setSize(fm.stringWidth(jLabelSupMod.getText()) + 10, 20);
- starLabel = new StarLabel();
- starLabel.setBounds(new java.awt.Rectangle(2,134,10,20));
- jLabelDefVal = new JLabel();
- jLabelDefVal.setBounds(new java.awt.Rectangle(277,84,80,20));
- jLabelDefVal.setText("Default Value");
- fm = jLabelDefVal.getFontMetrics(jLabelDefVal.getFont());
- jLabelDefVal.setSize(fm.stringWidth(jLabelDefVal.getText()) + 10, 20);
- jLabelVarVal = new JLabel();
- jLabelVarVal.setBounds(new java.awt.Rectangle(11,133,100,20));
- jLabelVarVal.setText("Valid Usage");
- jLabelC_Name = new JLabel();
- jLabelC_Name.setText("C Name");
- jLabelC_Name.setBounds(new java.awt.Rectangle(11,9,140,20));
- jLabelTokenSpace = new JLabel();
- jLabelTokenSpace.setBounds(new java.awt.Rectangle(11,58,140,20));
- jLabelTokenSpace.setText("Token Space");
- jLabelDataType = new JLabel();
- jLabelDataType.setText("Data Type");
- jLabelDataType.setBounds(new java.awt.Rectangle(11,83,140,20));
- jLabelToken = new JLabel();
- jLabelToken.setText("Token Number");
- jLabelToken.setBounds(new java.awt.Rectangle(11,33,140,20));
- jLabelItemType = new JLabel();
- jLabelItemType.setText("Help Text");
- jLabelItemType.setBounds(new java.awt.Rectangle(11,108,140,20));
-
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(479,375));
-
- jContentPane.add(jLabelItemType, null);
- jContentPane.add(jLabelC_Name, null);
- jContentPane.add(jLabelTokenSpace, null);
- jContentPane.add(getJComboBoxTsGuid(), null);
- jContentPane.add(jLabelVarVal, null);
- jContentPane.add(getJTextFieldC_Name(), null);
- jContentPane.add(jLabelToken, null);
- jContentPane.add(getJTextFieldToken(), null);
- jContentPane.add(jLabelDataType, null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJComboBoxDataType(), null);
-
- jStarLabel = new StarLabel();
- jStarLabel1 = new StarLabel();
- jStarLabel1.setBounds(new java.awt.Rectangle(2,8,10,20));
- jStarLabel2 = new StarLabel();
- jStarLabel3 = new StarLabel();
- jStarLabel4 = new StarLabel();
- jStarLabel.setLocation(new java.awt.Point(2,84));
- jStarLabel4.setLocation(new java.awt.Point(2, 109));
- jStarLabel2.setLocation(new java.awt.Point(2,33));
- jStarLabel3.setLocation(new java.awt.Point(2, 58));
- jStarLabel3.setSize(new java.awt.Dimension(8,20));
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jStarLabel, null);
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(getJTextFieldHelp(), null);
- jContentPane.add(jLabelDefVal, null);
- jContentPane.add(getJTextFieldDefaultValue(), null);
- jContentPane.add(getJButtonAdd(), null);
- jContentPane.add(getJButtonRemove(), null);
- jContentPane.add(getJButtonClearAll(), null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(starLabel, null);
- jContentPane.add(getJCheckBoxFeatureFlag(), null);
- jContentPane.add(getJCheckBoxFixedAtBuild(), null);
- jContentPane.add(getJCheckBoxPatchInMod(), null);
- jContentPane.add(getJCheckBoxDyn(), null);
- jContentPane.add(getJCheckBoxDynEx(), null);
- jContentPane.add(getJScrollPaneArch(), null);
- jContentPane.add(getJScrollPaneMod(), null);
- jContentPane.add(jLabelSupMod, null);
- jContentPane.add(jLabelSupArch, null);
- }
- return jContentPane;
- }
-
- /**
- This method initializes comboboxes
- jContentPane.add(jLabelTokenSpace, null);
-
- **/
- private void initFrame() {
-
- jComboBoxDataType.addItem("UINT8");
- jComboBoxDataType.addItem("UINT16");
- jComboBoxDataType.addItem("UINT32");
- jComboBoxDataType.addItem("UINT64");
- jComboBoxDataType.addItem("VOID*");
- jComboBoxDataType.addItem("BOOLEAN");
- jComboBoxDataType.setSelectedIndex(0);
-
- Vector<String> vGuidCName = new Vector<String>();
- sfc.getSpdGuidDeclWithType(vGuidCName, "TOKEN_SPACE_GUID");
- for (int i = 0; i < vGuidCName.size(); ++i) {
- jComboBoxTsGuid.addItem(vGuidCName.get(i));
- }
-
- boolean editable = true;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- editable = false;
- }
-
- jButtonAdd.setEnabled(editable);
- jButtonRemove.setEnabled(editable);
- jButtonClearAll.setEnabled(editable);
- jTable.setEnabled(editable);
- }
-
- public void actionPerformed(ActionEvent arg0) {
-
-
- if (arg0.getSource() == jButtonOk) {
- this.save();
- this.dispose();
- }
- if (arg0.getSource() == jButtonCancel) {
- this.dispose();
- }
-
- if (arg0.getSource() == jButtonAdd) {
- //ToDo: check before add
-
- boolean[] b = {jCheckBoxFeatureFlag.isSelected(), jCheckBoxFixedAtBuild.isSelected(), jCheckBoxPatchInMod.isSelected(), jCheckBoxDyn.isSelected(), jCheckBoxDynEx.isSelected()};
- if (!checkValidUsage(b)) {
- return;
- }
- String archList = vectorToString(iCheckBoxListArch.getAllCheckedItemsString());
- if (archList.length() == 0) {
- archList = null;
- }
- String modTypeList = vectorToString(iCheckBoxListMod.getAllCheckedItemsString());
- if (modTypeList.length() == 0) {
- modTypeList = null;
- }
- Object[] row = {jTextFieldC_Name.getText(), jTextFieldToken.getText(),
- jComboBoxTsGuid.getSelectedItem(), jComboBoxDataType.getSelectedItem(),
- jTextFieldDefaultValue.getText(), jTextFieldHelp.getText(),
- jCheckBoxFeatureFlag.isSelected(), jCheckBoxFixedAtBuild.isSelected(),
- jCheckBoxPatchInMod.isSelected(), jCheckBoxDyn.isSelected(), jCheckBoxDynEx.isSelected(),
- archList, modTypeList};
- try {
- if (!dataValidation(row)) {
- return;
- }
-
- if (tokenCNameExisted(jTextFieldToken.getText(), jTextFieldC_Name.getText())) {
- return;
- }
- } catch (Exception e) {
- JOptionPane.showMessageDialog(this, "Illegal Token:"+ e.getCause());
- return;
- }
-
- model.addRow(row);
- jTable.changeSelection(model.getRowCount()-1, 0, false, false);
- String usage = getValidUsage(jCheckBoxFeatureFlag.isSelected(), jCheckBoxFixedAtBuild.isSelected(), jCheckBoxPatchInMod.isSelected(), jCheckBoxDyn.isSelected(), jCheckBoxDynEx.isSelected());
- if (usage.length() == 0) {
- usage = null;
- }
- sfc.genSpdPcdDefinitions(row[0]+"", row[1]+"", row[3]+"", usage, row[2]+"", row[4]+"", row[5]+"", archList, modTypeList);
- docConsole.setSaved(false);
- }
- //
- // remove selected line
- //
- if (arg0.getSource() == jButtonRemove) {
- if (jTable.isEditing()){
- jTable.getCellEditor().stopCellEditing();
- }
- int rowSelected = selectedRow;
- if (rowSelected >= 0) {
- model.removeRow(rowSelected);
- sfc.removeSpdPcdDefinition(rowSelected);
- docConsole.setSaved(false);
- }
- }
-
- if (arg0.getSource() == jButtonClearAll) {
- if (model.getRowCount() == 0) {
- return;
- }
- model.setRowCount(0);
- sfc.removeSpdPcdDefinition();
- docConsole.setSaved(false);
- }
-
- }
-
- protected void save() {
-
- }
-
- /**
- * This method initializes jComboBoxTsGuid
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxTsGuid() {
- if (jComboBoxTsGuid == null) {
- jComboBoxTsGuid = new JComboBox();
- jComboBoxTsGuid.setBounds(new java.awt.Rectangle(156,58,315,20));
-
- }
- return jComboBoxTsGuid;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldHelp() {
- if (jTextFieldHelp == null) {
- jTextFieldHelp = new JTextField();
- jTextFieldHelp.setBounds(new java.awt.Rectangle(156,108,317,20));
- jTextFieldHelp.setPreferredSize(new java.awt.Dimension(315,20));
- }
- return jTextFieldHelp;
- }
-
- /**
- * This method initializes jTextFieldDefaultValue
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldDefaultValue() {
- if (jTextFieldDefaultValue == null) {
- jTextFieldDefaultValue = new JTextField();
- int xPos = jLabelDefVal.getX() + jLabelDefVal.getWidth();
- jTextFieldDefaultValue.setBounds(new java.awt.Rectangle(xPos,84,105,20));
- jTextFieldDefaultValue.setPreferredSize(new java.awt.Dimension(104,20));
- }
- return jTextFieldDefaultValue;
- }
-
- /**
- * This method initializes jButtonAdd
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setBounds(new java.awt.Rectangle(195,277,71,20));
- jButtonAdd.setPreferredSize(new java.awt.Dimension(70,20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(this);
- }
- return jButtonAdd;
-
- }
-
- /**
- * This method initializes jButtonRemove
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setBounds(new java.awt.Rectangle(278,277,81,20));
- jButtonRemove.setPreferredSize(new java.awt.Dimension(70,20));
- jButtonRemove.setText("Delete");
- jButtonRemove.addActionListener(this);
- }
- return jButtonRemove;
- }
-
- /**
- * This method initializes jButtonClearAll
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonClearAll() {
- if (jButtonClearAll == null) {
- jButtonClearAll = new JButton();
- jButtonClearAll.setBounds(new java.awt.Rectangle(382,277,90,20));
- jButtonClearAll.setPreferredSize(new java.awt.Dimension(81,20));
- jButtonClearAll.setText("Clear All");
- jButtonClearAll.addActionListener(this);
- }
- return jButtonClearAll;
- }
-
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = 500;
-
- Tools.resizeComponentWidth(this.jTextFieldC_Name, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldToken, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jComboBoxTsGuid, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldDefaultValue, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldHelp, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPane, this.getWidth(), intPreferredWidth);
-
- Tools.resizeComponentWidth(this.jTextFieldDefaultValue, this.getWidth(), intPreferredWidth);
-// relocateComponentX(this.jButtonClearAll, this.getWidth(), DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
-// relocateComponentX(this.jButtonRemove, this.getWidth(), DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
-// relocateComponentX(this.jButtonAdd, this.getWidth(), DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(5,301,1473,259));
- jScrollPane.setViewportView(getJTable());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTable() {
- if (jTable == null) {
- model = new CheckboxTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
- jTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
- jTable.setSize(new Dimension(1000, 300));
-
- model.addColumn("C_Name");
- model.addColumn("Token");
- model.addColumn("TokenSpace");
- model.addColumn("DatumType");
- model.addColumn("DefaultValue");
- model.addColumn("HelpText");
-
- model.addColumn("FeatureFlag");
- model.addColumn("FixedAtBuild");
- model.addColumn("PatchableInModule");
- model.addColumn("Dynamic");
- model.addColumn("DynamicEx");
- model.addColumn("SupportedArch");
- model.addColumn("SupportedModule");
-
- TableColumn column = jTable.getColumnModel().getColumn(0);
- column.setMinWidth(this.pcdCNameMinWidth);
- column = jTable.getColumnModel().getColumn(1);
- column.setMinWidth(this.pcdTokenMinWidth);
- column = jTable.getColumnModel().getColumn(2);
- column.setMinWidth(this.pcdTokenSpaceMinWidth);
- column = jTable.getColumnModel().getColumn(3);
- column.setMinWidth(this.datumTypeMinWidth);
- column = jTable.getColumnModel().getColumn(4);
- column.setMinWidth(this.defaultValueMinWidth);
- column = jTable.getColumnModel().getColumn(5);
- column.setMinWidth(this.helpTextMinWidth);
- column = jTable.getColumnModel().getColumn(6);
- column.setMinWidth(this.usageMinWidth);
- column = jTable.getColumnModel().getColumn(7);
- column.setMinWidth(this.usageMinWidth);
- column = jTable.getColumnModel().getColumn(8);
- column.setMinWidth(this.usageMinWidth);
- column = jTable.getColumnModel().getColumn(9);
- column.setMinWidth(this.usageMinWidth);
- column = jTable.getColumnModel().getColumn(10);
- column.setMinWidth(this.usageMinWidth);
- column = jTable.getColumnModel().getColumn(11);
- column.setMinWidth(this.supArchMinWidth);
- column = jTable.getColumnModel().getColumn(12);
- column.setMinWidth(this.supModMinWidth);
-
- //ToDo: add a valid usage editor
-
- JComboBox jComboBoxDataType = new JComboBox();
- jComboBoxDataType.addItem("UINT8");
- jComboBoxDataType.addItem("UINT16");
- jComboBoxDataType.addItem("UINT32");
- jComboBoxDataType.addItem("UINT64");
- jComboBoxDataType.addItem("VOID*");
- jComboBoxDataType.addItem("BOOLEAN");
- TableColumn dataTypeColumn = jTable.getColumnModel().getColumn(3);
- dataTypeColumn.setCellEditor(new DefaultCellEditor(jComboBoxDataType));
-
- jTable.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor(topFrame));
-
- Vector<String> vArch = new Vector<String>();
- vArch.add("IA32");
- vArch.add("X64");
- vArch.add("IPF");
- vArch.add("EBC");
- vArch.add("ARM");
- vArch.add("PPC");
- jTable.getColumnModel().getColumn(11).setCellEditor(new ListEditor(vArch, topFrame));
-
- Vector<String> vModule = new Vector<String>();
- vModule.add("BASE");
- vModule.add("SEC");
- vModule.add("PEI_CORE");
- vModule.add("PEIM");
- vModule.add("DXE_CORE");
- vModule.add("DXE_DRIVER");
- vModule.add("DXE_RUNTIME_DRIVER");
- vModule.add("DXE_SAL_DRIVER");
- vModule.add("DXE_SMM_DRIVER");
- vModule.add("UEFI_DRIVER");
- vModule.add("UEFI_APPLICATION");
- vModule.add("USER_DEFINED");
- jTable.getColumnModel().getColumn(12).setCellEditor(new ListEditor(vModule, topFrame));
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
- });
-
- jTable.getModel().addTableModelListener(this);
- }
- return jTable;
- }
-
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int column = arg0.getColumn();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
- String[] sa = new String[9];
- sfc.getSpdPcdDeclaration(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (column < 6) {
-
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[column])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
- }
-
- String usage = getValidUsage(new Boolean(m.getValueAt(row, 6)+""), new Boolean(m.getValueAt(row, 7)+""), new Boolean(m.getValueAt(row, 8)+""), new Boolean(m.getValueAt(row, 9)+""), new Boolean(m.getValueAt(row, 10)+""));
- if (usage.length() == 0) {
- JOptionPane.showMessageDialog(this, "You must choose at least one usage for PCD entry.");
- return;
- }
-
- if (column <= 10 && column >= 6) {
- Vector<String> v = stringToVector(usage);
- if (compareTwoVectors(v, stringToVector(sa[6]))) {
- return;
- }
- if (v.contains("FEATURE_FLAG")/* && v.size() > 1 && !exclusiveUsage*/) {
- if (v.size() > 1) {
- JOptionPane.showMessageDialog(this, "Usage Feature Flag can NOT co-exist with others.");
- return;
- }
-// synchronized (boolModifyLock){
-// exclusiveUsage = true;
-// }
-// m.setValueAt(false, row, 7);
-// m.setValueAt(false, row, 8);
-// m.setValueAt(false, row, 9);
-// m.setValueAt(false, row, 10);
- else {
- m.setValueAt("BOOLEAN", row, 3);
- }
-
- }
- }
-
- if (column == 11) {
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[7])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[7] == null) {
- return;
- }
- }
-
- if (column == 12) {
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[8])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[8] == null) {
- return;
- }
- }
- String cName = m.getValueAt(row, 0) + "";
- String token = m.getValueAt(row, 1) + "";
- String ts = m.getValueAt(row, 2) + "";
- String dataType = m.getValueAt(row, 3) + "";
- String defaultVal = m.getValueAt(row, 4) + "";
- String help = m.getValueAt(row, 5) + "";
-
-
- String archList = null;
- if (m.getValueAt(row, 11) != null){
- archList = m.getValueAt(row, 11).toString();
- }
- String modTypeList = null;
- if (m.getValueAt(row, 12) != null) {
- modTypeList = m.getValueAt(row, 12).toString();
- }
-
- Object[] o = {cName, token, ts, dataType, defaultVal, help};
- try {
- if (!dataValidation(o)){
- return;
- }
- }
- catch (Exception e) {
- JOptionPane.showMessageDialog(this, "Illegal Token:" + e.getCause());
- return;
- }
- docConsole.setSaved(false);
- sfc.updateSpdPcdDefinition(row, cName, token, dataType, usage, ts, defaultVal, help, archList, modTypeList);
- }
- }
-
- /**
- * This method initializes jCheckBox
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxFeatureFlag() {
- if (jCheckBoxFeatureFlag == null) {
- jCheckBoxFeatureFlag = new JCheckBox();
- jCheckBoxFeatureFlag.setBounds(new java.awt.Rectangle(156,161,100,21));
- jCheckBoxFeatureFlag.setText("Feature Flag");
- FontMetrics fm = jCheckBoxFeatureFlag.getFontMetrics(jCheckBoxFeatureFlag.getFont());
- jCheckBoxFeatureFlag.setSize(fm.stringWidth(jCheckBoxFeatureFlag.getText()) + 30, 20);
- jCheckBoxFeatureFlag.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (jCheckBoxFeatureFlag.isSelected()) {
- jCheckBoxPatchInMod.setSelected(false);
- jCheckBoxFixedAtBuild.setSelected(false);
- jCheckBoxDyn.setSelected(false);
- jCheckBoxDynEx.setSelected(false);
- jComboBoxDataType.setSelectedItem("BOOLEAN");
- }
- }
- });
- }
- return jCheckBoxFeatureFlag;
- }
-
- /**
- * This method initializes jCheckBox1
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxFixedAtBuild() {
- if (jCheckBoxFixedAtBuild == null) {
- jCheckBoxFixedAtBuild = new JCheckBox();
-
- jCheckBoxFixedAtBuild.setText("Fixed at Build");
- FontMetrics fm = jCheckBoxFixedAtBuild.getFontMetrics(jCheckBoxFixedAtBuild.getFont());
- jCheckBoxFixedAtBuild.setSize(fm.stringWidth(jCheckBoxFixedAtBuild.getText()) + 30, 20);
- jCheckBoxFixedAtBuild.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (jCheckBoxFixedAtBuild.isSelected()) {
- jCheckBoxFeatureFlag.setSelected(false);
- }
- }
- });
- }
- return jCheckBoxFixedAtBuild;
- }
-
- /**
- * This method initializes jCheckBox2
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxPatchInMod() {
- if (jCheckBoxPatchInMod == null) {
- jCheckBoxPatchInMod = new JCheckBox();
-
- jCheckBoxPatchInMod.setBounds(new java.awt.Rectangle(156,133,154,20));
- jCheckBoxPatchInMod.setText("Patchable in Module");
- FontMetrics fm = jCheckBoxPatchInMod.getFontMetrics(jCheckBoxPatchInMod.getFont());
- jCheckBoxPatchInMod.setSize(fm.stringWidth(jCheckBoxPatchInMod.getText()) + 30, 20);
- jCheckBoxPatchInMod.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (jCheckBoxPatchInMod.isSelected()) {
- jCheckBoxFeatureFlag.setSelected(false);
- }
- }
- });
- }
- return jCheckBoxPatchInMod;
- }
-
- /**
- * This method initializes jCheckBox3
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxDyn() {
- if (jCheckBoxDyn == null) {
- jCheckBoxDyn = new JCheckBox();
-
- jCheckBoxDyn.setText("Dynamic");
- FontMetrics fm = jCheckBoxDyn.getFontMetrics(jCheckBoxDyn.getFont());
- jCheckBoxDyn.setSize(fm.stringWidth(jCheckBoxDyn.getText()) + 30, 20);
- jCheckBoxDyn.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (jCheckBoxDyn.isSelected()) {
- jCheckBoxFeatureFlag.setSelected(false);
- }
- }
- });
- }
- return jCheckBoxDyn;
- }
-
- /**
- * This method initializes jCheckBox4
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxDynEx() {
- if (jCheckBoxDynEx == null) {
- jCheckBoxDynEx = new JCheckBox();
-
- jCheckBoxDynEx.setText("DynamicEx");
- FontMetrics fm = jCheckBoxDynEx.getFontMetrics(jCheckBoxDynEx.getFont());
- jCheckBoxDynEx.setSize(fm.stringWidth(jCheckBoxDynEx.getText()) + 30, 20);
- jCheckBoxDynEx.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (jCheckBoxDynEx.isSelected()) {
- jCheckBoxFeatureFlag.setSelected(false);
- }
- }
- });
- }
- return jCheckBoxDynEx;
- }
-
- private String getValidUsage(boolean ff, boolean fab, boolean pim, boolean d, boolean de) {
- String usage = "";
- if (ff){
- usage += "FEATURE_FLAG ";
- }
- if (fab){
- usage += "FIXED_AT_BUILD ";
- }
- if (pim){
- usage += "PATCHABLE_IN_MODULE ";
- }
- if (d){
- usage += "DYNAMIC ";
- }
- if (de){
- usage += "DYNAMIC_EX ";
- }
-
- return usage.trim();
- }
-
- private boolean tokenCNameExisted(String token, String cName) throws Exception{
- Long inputToken = Long.decode(token);
-
- for (int i = 0; i < model.getRowCount(); ++i) {
- if (model.getValueAt(i, 0).equals(cName)) {
- JOptionPane.showMessageDialog(this, "C_Name already existed in table.");
- return true;
- }
- if (model.getValueAt(i, 1).equals(token)) {
- JOptionPane.showMessageDialog(this, "Token already existed in table.");
- return true;
- }
- Long tokenValue = Long.decode(model.getValueAt(i, 1)+"");
- if (tokenValue.equals(inputToken)) {
- JOptionPane.showMessageDialog(this, "Same token value already existed in table.");
- return true;
- }
-
- }
- return false;
- }
-
- private boolean checkValidUsage(boolean[] b) {
- if (!(b[0] || b[1] || b[2] || b[3] || b[4])){
- JOptionPane.showMessageDialog(this, "You must specify at least one usage.");
- return false;
- }
- return true;
- }
- private boolean dataValidation(Object[] row) throws Exception{
-
- if (!DataValidation.isC_NameType(row[0].toString())) {
- JOptionPane.showMessageDialog(this, "C_Name is NOT C_NameType.");
- return false;
- }
- if (!DataValidation.isHexDoubleWordDataType(row[1].toString()) &&
- !DataValidation.isLongInt(row[1].toString(), 1, Long.MAX_VALUE)) {
- JOptionPane.showMessageDialog(this, "Token is NOT correct.");
- return false;
- }
- if (!DataValidation.isC_NameType(row[2].toString())) {
- JOptionPane.showMessageDialog(this, "Token Space is NOT C_NameType");
- return false;
- }
- if (row[5].toString().length() == 0) {
- JOptionPane.showMessageDialog(this, "HelpText could NOT be empty.");
- return false;
- }
- return true;
- }
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneArch() {
- if (jScrollPaneArch == null) {
- jScrollPaneArch = new JScrollPane();
- jScrollPaneArch.setBounds(new java.awt.Rectangle(242,213,188,54));
- jScrollPaneArch.setViewportView(getICheckBoxListArch());
- jScrollPaneArch.setPreferredSize(new Dimension(188, 74));
- }
- return jScrollPaneArch;
- }
-
- /**
- * This method initializes iCheckBoxList
- *
- * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
- */
- private ICheckBoxList getICheckBoxListArch() {
- if (iCheckBoxListArch == null) {
- iCheckBoxListArch = new ICheckBoxList();
- iCheckBoxListArch.setBounds(new Rectangle(197, 142, 188, 74));
- Vector<String> v = new Vector<String>();
- v.add("IA32");
- v.add("X64");
- v.add("IPF");
- v.add("EBC");
- v.add("ARM");
- v.add("PPC");
- iCheckBoxListArch.setAllItems(v);
- }
- return iCheckBoxListArch;
- }
-
- /**
- * This method initializes jScrollPane2
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneMod() {
- if (jScrollPaneMod == null) {
- jScrollPaneMod = new JScrollPane();
- jScrollPaneMod.setBounds(new java.awt.Rectangle(15,213,199,55));
- jScrollPaneMod.setViewportView(getICheckBoxListMod());
- jScrollPaneMod.setPreferredSize(new Dimension(170, 74));
- }
- return jScrollPaneMod;
- }
-
- /**
- * This method initializes iCheckBoxList1
- *
- * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList
- */
- private ICheckBoxList getICheckBoxListMod() {
- if (iCheckBoxListMod == null) {
- iCheckBoxListMod = new ICheckBoxList();
- iCheckBoxListMod.setBounds(new Rectangle(14, 142, 170, 74));
- Vector<String> v = new Vector<String>();
- v.add("BASE");
- v.add("SEC");
- v.add("PEI_CORE");
- v.add("PEIM");
- v.add("DXE_CORE");
- v.add("DXE_DRIVER");
- v.add("DXE_RUNTIME_DRIVER");
- v.add("DXE_SAL_DRIVER");
- v.add("DXE_SMM_DRIVER");
- v.add("UEFI_DRIVER");
- v.add("UEFI_APPLICATION");
- v.add("USER_DEFINED");
- iCheckBoxListMod.setAllItems(v);
- }
- return iCheckBoxListMod;
- }
-
- protected String vectorToString(Vector<String> v) {
- if (v == null) {
- return null;
- }
- String s = " ";
- for (int i = 0; i < v.size(); ++i) {
- s += v.get(i);
- s += " ";
- }
- return s.trim();
- }
-
- protected Vector<String> stringToVector(String s){
- Vector<String> v = new Vector<String>();
- if (s == null) {
- return v;
- }
- String[] sArray = s.split(" ");
-
- for (int i = 0; i < sArray.length; ++i) {
- v.add(sArray[i]);
- }
- return v;
- }
-
- private boolean compareTwoVectors(Vector v1, Vector v2) {
- if (v1.size() != v2.size()) {
- return false;
- }
- for (int i = 0; i < v1.size(); ++i) {
- if (!v2.contains(v1.get(i))) {
- return false;
- }
- }
- return true;
- }
-} // @jve:decl-index=0:visual-constraint="22,11"
-
-class CheckboxTableModel extends DefaultTableModel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public Class<?> getColumnClass (int c) {
- if (getValueAt(0, c) != null){
- return getValueAt(0, c).getClass();
- }
- return String.class;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java deleted file mode 100644 index e0b96319a7..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java +++ /dev/null @@ -1,148 +0,0 @@ -/** @file
- Java class SpdProtocolDecls is GUI for create library definition elements of spd file.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.platform.ui.ListEditor;
-
-/**
-GUI for create library definition elements of spd file.
-
-@since PackageEditor 1.0
-**/
-public class SpdPpiDecls extends SpdGuidDecls {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private SpdFileContents sfc = null;
- private OpeningPackageType docConsole = null;
-// private JFrame topFrame = null;
-
- public SpdPpiDecls(JFrame frame) {
- super(frame);
- // TODO Auto-generated constructor stub
- }
-
- public SpdPpiDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame) {
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdPpiDecls(OpeningPackageType opt, JFrame frame) {
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(this, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
- }
-
- protected void initFrame() {
- super.initFrame();
- this.setTitle("PPI Declarations");
- starLabel.setVisible(false);
- ((ListEditor)getJTable().getColumnModel().getColumn(6).getCellEditor()).setCanNotBeEmpty(false);
- }
-
- protected void init(SpdFileContents sfc){
- //
- // initialize table using SpdFileContents object
- //
- DefaultTableModel model = getModel();
- if (sfc.getSpdPpiDeclarationCount() == 0) {
- return ;
- }
- saa = new String[sfc.getSpdPpiDeclarationCount()][7];
- sfc.getSpdPpiDeclarations(saa);
- int i = 0;
- while (i < saa.length) {
- model.addRow(saa[i]);
- i++;
- }
-
- }
-
- protected void updateRow(int row, int column, TableModel m){
- String[] sa = new String[7];
- sfc.getSpdPpiDeclaration(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[column])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
-
- String name = m.getValueAt(row, 0) + "";
- String cName = m.getValueAt(row, 1) + "";
- String guid = m.getValueAt(row, 2) + "";
- String help = m.getValueAt(row, 3) + "";
- String archList = null;
- if (m.getValueAt(row, 4) != null) {
- archList = m.getValueAt(row, 4).toString();
- }
- String modTypeList = null;
- if (m.getValueAt(row, 5) != null) {
- modTypeList = m.getValueAt(row, 5).toString();
- }
- String guidTypeList = null;
- if (m.getValueAt(row, 6) != null) {
- guidTypeList = m.getValueAt(row, 6).toString();
- }
- String[] rowData = {name, cName, guid, help};
- if (!dataValidation(rowData)){
- return;
- }
- docConsole.setSaved(false);
- sfc.updateSpdPpiDecl(row, name, cName, guid, help, archList, modTypeList, guidTypeList);
- }
-
- protected int addRow(String[] row) {
-
- if (!dataValidation(row)){
- return -1;
- }
- docConsole.setSaved(false);
- sfc.genSpdPpiDeclarations(row[0], row[1], row[2], row[3], stringToVector(row[4]), stringToVector(row[5]), stringToVector(row[6]));
- return 0;
- }
-
- protected void removeRow(int i){
- sfc.removeSpdPpiDeclaration(i);
- docConsole.setSaved(false);
- }
-
- protected void clearAllRow(){
- sfc.removeSpdPpiDeclaration();
- docConsole.setSaved(false);
- }
-
- /**
- * @return Returns the sfc.
- */
- protected SpdFileContents getSfc() {
- return sfc;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java deleted file mode 100644 index 1c4c0cf269..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java +++ /dev/null @@ -1,146 +0,0 @@ -/** @file
- Java class SpdProtocolDecls is GUI for create library definition elements of spd file.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.packaging.ui;
-
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.platform.ui.ListEditor;
-
-/**
-GUI for create library definition elements of spd file.
-
-@since PackageEditor 1.0
-**/
-public class SpdProtocolDecls extends SpdGuidDecls {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private SpdFileContents sfc = null;
- private OpeningPackageType docConsole = null;
-
- public SpdProtocolDecls(JFrame frame) {
- super(frame);
- // TODO Auto-generated constructor stub
- }
-
- public SpdProtocolDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame) {
- this(frame);
- sfc = new SpdFileContents(inPsa);
- init(sfc);
- }
-
- public SpdProtocolDecls(OpeningPackageType opt, JFrame frame) {
- this(opt.getXmlSpd(), frame);
- docConsole = opt;
- if (sfc.getSpdPkgDefsRdOnly().equals("true")) {
- JOptionPane.showMessageDialog(this, "This is a read-only package. You will not be able to edit contents in table.");
- }
- initFrame();
- }
-
- protected void initFrame() {
- super.initFrame();
- this.setTitle("Protocol Declarations");
- starLabel.setVisible(false);
- ((ListEditor)getJTable().getColumnModel().getColumn(6).getCellEditor()).setCanNotBeEmpty(false);
- }
-
- protected void init(SpdFileContents sfc){
- //
- // initialize table using SpdFileContents object
- //
- DefaultTableModel model = getModel();
- if (sfc.getSpdProtocolDeclarationCount() == 0) {
- return ;
- }
- saa = new String[sfc.getSpdProtocolDeclarationCount()][7];
- sfc.getSpdProtocolDeclarations(saa);
- int i = 0;
- while (i < saa.length) {
- model.addRow(saa[i]);
- i++;
- }
-
- }
-
- protected void updateRow(int row, int column, TableModel m){
- String[] sa = new String[7];
- sfc.getSpdProtocolDeclaration(sa, row);
- Object cellData = m.getValueAt(row, column);
- if (cellData == null) {
- cellData = "";
- }
- if (cellData.equals(sa[column])) {
- return;
- }
- if (cellData.toString().length() == 0 && sa[column] == null) {
- return;
- }
-
- String name = m.getValueAt(row, 0) + "";
- String cName = m.getValueAt(row, 1) + "";
- String guid = m.getValueAt(row, 2) + "";
- String help = m.getValueAt(row, 3) + "";
- String archList = null;
- if (m.getValueAt(row, 4) != null) {
- archList = m.getValueAt(row, 4).toString();
- }
- String modTypeList = null;
- if (m.getValueAt(row, 5) != null) {
- modTypeList = m.getValueAt(row, 5).toString();
- }
- String guidTypeList = null;
- if (m.getValueAt(row, 6) != null) {
- guidTypeList = m.getValueAt(row, 6).toString();
- }
- String[] rowData = {name, cName, guid, help};
- if (!dataValidation(rowData)){
- return;
- }
- docConsole.setSaved(false);
- sfc.updateSpdProtocolDecl(row, name, cName, guid, help, archList, modTypeList, guidTypeList);
- }
-
- protected int addRow(String[] row) {
- if (!dataValidation(row)){
- return -1;
- }
- docConsole.setSaved(false);
- sfc.genSpdProtocolDeclarations(row[0], row[1], row[2], row[3], stringToVector(row[4]), stringToVector(row[5]), stringToVector(row[6]));
- return 0;
- }
-
- protected void removeRow(int i){
- sfc.removeSpdProtocolDeclaration(i);
- docConsole.setSaved(false);
- }
-
- protected void clearAllRow(){
- sfc.removeSpdProtocolDeclaration();
- docConsole.setSaved(false);
- }
-
- /**
- * @return Returns the sfc.
- */
- protected SpdFileContents getSfc() {
- return sfc;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/PlatformIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/PlatformIdentification.java deleted file mode 100644 index bc0b3d2bed..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/PlatformIdentification.java +++ /dev/null @@ -1,61 +0,0 @@ -/** @file
-
- The file is used to save basic information of platform
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.platform;
-
-
-import java.io.File;
-
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-public class PlatformIdentification extends Identification{
-
- public PlatformIdentification(String name, String guid, String version, String path){
- super(name, guid, version, path);
- }
-
- public PlatformIdentification(Identification id){
- super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
- }
-
- public File getFpdFile(){
- File fpdFile = new File(this.getPath());
- return fpdFile;
- }
-
- public String toString() {
- return getName() + " " + getVersion() + " [" + Tools.getRelativePath(getFpdFile().getPath(), Workspace.getCurrentWorkspace()) + "]";
- }
-
- public boolean equals(String platformGuid, String platformVersion) {
- boolean b = false;
- if (this.getGuid().equals(platformGuid)) {
- b = true;
- //
- // Check Version
- //
- if (platformVersion != null) {
- if (!Tools.isEmpty(platformVersion)) {
- if (!platformVersion.equals(this.getVersion())) {
- b = false;
- }
- }
- }
- }
- return b;
- }
-}
\ No newline at end of file diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/DynamicTree.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/DynamicTree.java deleted file mode 100644 index d47352bb3e..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/DynamicTree.java +++ /dev/null @@ -1,42 +0,0 @@ -/** @file - - The file is used to create tree view sections - - Copyright (c) 2006, Intel Corporation - All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - **/ -package org.tianocore.frameworkwizard.platform.ui; -import java.awt.GridLayout; - -import javax.swing.JPanel; -import javax.swing.JTree; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeModel; - - -public class DynamicTree extends JPanel { - /** - * - */ - private static final long serialVersionUID = 1L; - protected DefaultMutableTreeNode rootNode; - protected DefaultTreeModel treeModel; - protected JTree tree; - - public DynamicTree() { - super(new GridLayout(1,0)); - - - } - - -} - - diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java deleted file mode 100644 index feddaeeb71..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java +++ /dev/null @@ -1,2242 +0,0 @@ -/** @file
-
- The file is used to create, update BuildOptions of Fpd file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-
-import javax.swing.JPanel;
-import javax.swing.JTabbedPane;
-import javax.swing.JCheckBox;
-import javax.swing.JLabel;
-import java.awt.FlowLayout;
-import javax.swing.AbstractAction;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ComponentEvent;
-
-import javax.swing.DefaultCellEditor;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JTextField;
-import javax.swing.JButton;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JComboBox;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Set;
-import java.util.Vector;
-import java.awt.Dimension;
-import javax.swing.JSplitPane;
-import java.awt.GridLayout;
-
-public class FpdBuildOptions extends IInternalFrame {
-
- private final int oneRowHeight = 20;
-
- private final int twoRowHeight = 40;
-
- private final int sepHeight = 6;
-
- private final int sepWidth = 10;
-
- private final int buttonWidth = 90;
-
- private final int rowOne = 12;
-
- private final int dialogWidth = 600;
-
- private final int rowTwo = rowOne + oneRowHeight + sepHeight;
-
- private final int rowThree = rowTwo + oneRowHeight + sepHeight;
-
- private final int rowFour = rowThree + oneRowHeight + sepHeight;
-
- private final int rowFive = rowFour + oneRowHeight + sepHeight;
-
- private final int rowSix = rowFive + oneRowHeight + sepHeight;
-
- private final int rowSeven = rowSix + oneRowHeight + sepHeight;
-
- private final int buttonRow = rowSeven + oneRowHeight + sepHeight + sepHeight;
-
- private final int dialogHeight = buttonRow + twoRowHeight + twoRowHeight;
-
- private final int lastButtonXLoc = dialogWidth - buttonWidth - sepWidth;
-
- private final int next2LastButtonLoc = lastButtonXLoc - buttonWidth - sepWidth;
-
- private final int firstButtonLoc = next2LastButtonLoc - buttonWidth - sepWidth;
-
- private final int labelColumn = 12;
-
- private final int fieldColumn = 168;
-
- private final int labelWidth = 155;
-
- private final int fieldWidth = 320;
-
- private static final long serialVersionUID = 1L;
-
- private JPanel jContentPane = null;
-
- // private JPanel jPanelContentSouth = null;
-
- // private JPanel jPanelContentNorth = null;
-
- // private JPanel jPanelContentWest = null;
-
- // private JPanel jPanelContentEast = null;
-
- private JTabbedPane jTabbedPane = null;
-
- private JPanel jPanelUserDef = null;
-
- private JPanel jPanelUserDefNorth = null;
-
- private JPanel jPanelUserDefCenter = null;
-
- private JTextField jTextFieldAntTaskFile = null;
-
- private JLabel jLabelAntTaskId = null;
-
- private JTextField jTextFieldAntTaskId = null;
-
- private JButton jButtonAntTaskAdd = null;
-
- private JButton jButtonAntTaskDel = null;
-
- private JTextField jTextFieldAntCmdOpts = null;
-
- private JScrollPane jScrollPaneAntTasks = null;
-
- private JTable jTableAntTasks = null;
-
- private DefaultTableModel ffsTableModel = null;
-
- private DefaultTableModel sectionsTableModel = null;
-
- private DefaultTableModel sectionTableModel = null;
-
- private DefaultTableModel subsectionsTableModel = null;
-
- private DefaultTableModel antTaskTableModel = null;
-
- private DefaultTableModel ffsAttributesTableModel = null;
-
- private DefaultTableModel optionsTableModel = null;
-
- private JPanel jPanelFfsTab = null;
-
- private JPanel jPanelFfsTabCenter = null;
-
- private JPanel jPanelFfsTabCenterN = null;
-
- private JPanel jPanelFfsTabCenterS = null;
-
- private JButton jButtonFfsAdd = null;
-
- private JButton jButtonFfsDel = null;
-
- private JScrollPane jScrollPaneFfsAttribs = null;
-
- private JTable jTableFfsAttribs = null;
-
- private JPanel jPanelOptionsTab = null;
-
- private JLabel jLabelOptionContents = null;
-
- private JTextField jTextFieldOptionContents = null;
-
- private JLabel jLabelToolChainFamily = null;
-
- private JLabel jLabelSupArch = null;
-
- private JLabel jLabelToolCmd = null;
-
- private JTextField jTextFieldToolCmd = null;
-
- private JScrollPane jScrollPaneOptions = null;
-
- private JTable jTableOptions = null;
-
- private JButton jButtonOptionsAdd = null;
-
- private JButton jButtonOptionsDel = null;
-
- private JButton jButtonFfsAttribNew = null;
-
- private JButton jButtonFfsAttribRemove = null;
-
- private FpdFileContents ffc = null;
-
- private OpeningPlatformType docConsole = null;
-
- private JPanel jArchitectureSelections = null;
-
- private JCheckBox jCheckBoxIA32 = null;
-
- private JCheckBox jCheckBoxIpf = null;
-
- private JCheckBox jCheckBoxX64 = null;
-
- private JCheckBox jCheckBoxEBC = null;
-
- private JCheckBox jCheckBoxARM = null;
-
- private JCheckBox jCheckBoxPPC = null;
-
- private JLabel jLabelBuildTargets = null;
-
- private JTextField jTextFieldBuildTargets = null;
-
- private JTextField jTextFieldTagName = null;
-
- private JLabel jLabelTagName = null;
-
- private int selectedRow = -1;
-
- private JLabel jLabelAntTaskFile = null;
-
- private JLabel jLabelAntCmdOpts = null;
-
- private JScrollPane jScrollPaneFfs = null;
-
- private JTable jTableFfs = null;
-
- private JLabel jLabelFfsSection = null;
-
- private JScrollPane jScrollPaneFfsSection = null;
-
- private JTable jTableFfsSection = null;
-
- private JLabel jLabelFfsSubSections = null;
-
- private JScrollPane jScrollPaneFfsSubSection = null;
-
- private JTable jTableFfsSubSection = null;
-
- private JLabel jLabelEncapType = null;
-
- private JTextField jTextFieldEncapType = null;
-
- private JPanel jPanelFfsAttribButtonGroup = null;
-
- private JLabel jLabelFfsAttribs = null;
-
- private JButton jButtonFfsSectionNew = null;
-
- private JButton jButtonFfsSectionRemove = null;
-
- private JButton jButtonFfsSubSectionNew = null;
-
- private JButton jButtonFfsSubSectionRemove = null;
-
- private JLabel jLabelFfsSections = null;
-
- private JButton jButtonFfsSectionsNew = null;
-
- private JButton jButtonFfsSectionsRemove = null;
-
- private JScrollPane jScrollPaneFfsSections = null;
-
- private JTable jTableFfsSections = null;
-
- private JButton jButtonAntTaskFileBrowse = null;
-
- private JTextField jTextFieldToolChainFamily = null;
-
- private JSplitPane jSplitPaneFfsC = null;
-
- private JPanel jPanelFfsCTop = null;
-
- private JSplitPane jSplitPaneFfsCBottom = null;
-
- private JPanel jPanelFfsCBottomTop = null;
-
- private JPanel jPanelFfsCBottomBottom = null;
-
- private JPanel jPanelSectionN = null;
-
- private JPanel jPanelSectionsN = null;
-
- private JPanel jPanelSubSectionN = null;
-
- private JPanel jPanelOptionsContainer = null;
-
- private JPanel jPanelUserDefCenterN = null;
-
- private JPanel jPanelTableOptionsContainer = null;
-
- private JLabel jLabelTableOptionsTitle = null;
-
- private final int buildTargetWidth = 150;
- private final int toolChainFamilyWidth = 150;
- private final int supportArchWidth = 150;
- private final int toolCmdCodeWidth = 200;
- private final int tagNameWidth = 150;
- private final int argWidth = 400;
-
- private boolean ffsSelection = false;
- private int selectedFfsTableRow = -1;
-
- /**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
- private JPanel getJPanelContentSouth() {
- if (jPanelContentSouth == null) {
- jPanelContentSouth = new JPanel();
- }
- return jPanelContentSouth;
- }
- */
-
- /**
- * This method initializes jPanel1
- *
- * @return javax.swing.JPanel
- private JPanel getJPanelContentNorth() {
- if (jPanelContentNorth == null) {
- jPanelContentNorth = new JPanel();
- }
- return jPanelContentNorth;
- }
- */
-
- /**
- * This method initializes jPanel2
- *
- * @return javax.swing.JPanel
- private JPanel getJPanelContentWest() {
- if (jPanelContentWest == null) {
- jPanelContentWest = new JPanel();
- }
- return jPanelContentWest;
- }
- */
-
- /**
- * This method initializes jPanel3
- *
- * @return javax.swing.JPanel
- private JPanel getJPanelContentEast() {
- if (jPanelContentEast == null) {
- jPanelContentEast = new JPanel();
- }
- return jPanelContentEast;
- }
- */
-
- /**
- * This method initializes jTabbedPane
- *
- * @return javax.swing.JTabbedPane
- */
- private JTabbedPane getJTabbedPane() {
- if (jTabbedPane == null) {
- jTabbedPane = new JTabbedPane();
- jTabbedPane.addTab("Flash Filesystem Options", null, getJPanelFfsTab(), null);
- jTabbedPane.addTab("Customize Tool Chain Configurations", null, getJPanelOptionsTab(), null);
- jTabbedPane.addTab("User Defined ANT Tasks", null, getJPanelUserDef(), null);
- }
- return jTabbedPane;
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(722, 577);
- this.setTitle("Platform Build Options");
- this.setContentPane(getJContentPane());
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- // jContentPane.add(getJPanelContentSouth(), java.awt.BorderLayout.SOUTH);
- // jContentPane.add(getJPanelContentNorth(), java.awt.BorderLayout.NORTH);
- // jContentPane.add(getJPanelContentWest(), java.awt.BorderLayout.WEST);
- // jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.EAST);
- jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes jPanelTableOptionsContainer
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelTableOptionsContainer() {
- if (jPanelTableOptionsContainer == null) {
- jLabelTableOptionsTitle = new JLabel();
- jLabelTableOptionsTitle.setText(" Current Argument Lines");
- jPanelTableOptionsContainer = new JPanel();
- jPanelTableOptionsContainer.setLayout(new BorderLayout());
- jPanelTableOptionsContainer.add(jLabelTableOptionsTitle, java.awt.BorderLayout.NORTH);
- jPanelTableOptionsContainer.add(getJScrollPaneOptions(), java.awt.BorderLayout.CENTER);
- }
- return jPanelTableOptionsContainer;
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- new FpdBuildOptions().setVisible(true);
- }
-
- /**
- * This is the default constructor
- */
- public FpdBuildOptions() {
- super();
- initialize();
- this.setVisible(true);
- }
-
- public FpdBuildOptions(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
- this();
- ffc = new FpdFileContents(fpd);
- init(ffc);
- }
-
- public FpdBuildOptions(OpeningPlatformType opt) {
- this(opt.getXmlFpd());
- docConsole = opt;
- }
-
- private void init(FpdFileContents ffc) {
- initOptionTable();
- initAntTaskTable();
- initFfsTable();
- this.addInternalFrameListener(new InternalFrameAdapter() {
- public void internalFrameDeactivated(InternalFrameEvent e) {
- if (jTableAntTasks.isEditing()) {
- jTableAntTasks.getCellEditor().stopCellEditing();
- }
- if (jTableOptions.isEditing()) {
- jTableOptions.getCellEditor().stopCellEditing();
- }
- stopEditingInTables ();
- }
- });
- }
-
- private void stopEditingInTables () {
- if (jTableFfs.isEditing()) {
- jTableFfs.getCellEditor().stopCellEditing();
- }
- if (jTableFfsSection.isEditing()) {
- jTableFfsSection.getCellEditor().stopCellEditing();
- }
- if (jTableFfsSections.isEditing()) {
- jTableFfsSections.getCellEditor().stopCellEditing();
- }
- if (jTableFfsSubSection.isEditing()) {
- jTableFfsSubSection.getCellEditor().stopCellEditing();
- }
- if (jTableFfsAttribs.isEditing()) {
- jTableFfsAttribs.getCellEditor().stopCellEditing();
- }
- }
-
- /**
- * This method initializes jPanel13
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsTab() {
- if (jPanelFfsTab == null) {
- jPanelFfsTab = new JPanel();
- jPanelFfsTab.setLayout(new BorderLayout());
- jPanelFfsTab.add(getJPanelFfsTabCenter(), java.awt.BorderLayout.CENTER);
- jPanelFfsTab.add(getJScrollPaneFfs(), java.awt.BorderLayout.WEST);
- }
- return jPanelFfsTab;
- }
-
- /**
- * This method initializes jPanel18
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsTabCenter() {
- if (jPanelFfsTabCenter == null) {
- jPanelFfsTabCenter = new JPanel();
- jPanelFfsTabCenter.setLayout(new BorderLayout());
- jPanelFfsTabCenter.add(getJPanelFfsTabCenterN(), java.awt.BorderLayout.NORTH);
- jPanelFfsTabCenter.add(getJPanelFfsTabCenterS(), java.awt.BorderLayout.SOUTH);
- jPanelFfsTabCenter.add(getJSplitPaneFfsC(), java.awt.BorderLayout.CENTER);
- }
- return jPanelFfsTabCenter;
- }
-
- /**
- * This method initializes jPanel15
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsTabCenterN() {
- if (jPanelFfsTabCenterN == null) {
- jLabelEncapType = new JLabel();
- jLabelEncapType.setText("Encapsulation Type");
- FlowLayout flowLayout5 = new FlowLayout();
- flowLayout5.setAlignment(java.awt.FlowLayout.RIGHT);
-
- jPanelFfsTabCenterN = new JPanel();
- jPanelFfsTabCenterN.setLayout(flowLayout5);
-
-
- jPanelFfsTabCenterN.add(jLabelEncapType, null);
- jPanelFfsTabCenterN.add(getJTextFieldEncapType(), null);
- jPanelFfsTabCenterN.add(getJButtonFfsAdd(), null);
- jPanelFfsTabCenterN.add(getJButtonFfsDel(), null);
- }
- return jPanelFfsTabCenterN;
- }
-
- /**
- * This method initializes jPanel16
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsTabCenterS() {
- if (jPanelFfsTabCenterS == null) {
- jLabelFfsAttribs = new JLabel();
- jLabelFfsAttribs.setText("Attributes");
- jPanelFfsTabCenterS = new JPanel();
- jPanelFfsTabCenterS.setPreferredSize(new java.awt.Dimension(491, 130));
- jPanelFfsTabCenterS.setLayout(new BorderLayout());
- jPanelFfsTabCenterS.add(jLabelFfsAttribs, java.awt.BorderLayout.WEST);
- jPanelFfsTabCenterS.add(getJScrollPaneFfsAttribs(), java.awt.BorderLayout.CENTER);
- jPanelFfsTabCenterS.add(getJPanelFfsAttribButtonGroup(), java.awt.BorderLayout.EAST);
- }
- return jPanelFfsTabCenterS;
- }
-
- /**
- * This method initializes jTextField6
- *
- * @return javax.swing.JTextField
- */
-
-
- /**
- * This method initializes jButton8
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsAdd() {
- if (jButtonFfsAdd == null) {
- jButtonFfsAdd = new JButton();
- jButtonFfsAdd.setPreferredSize(new java.awt.Dimension(70, 20));
- jButtonFfsAdd.setText("New");
- jButtonFfsAdd.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = -2923720717273384221L;
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
-
- String[] row = { "" };
- ffsTableModel.addRow(row);
- docConsole.setSaved(false);
- ffc.genBuildOptionsFfs("", "");
- jTableFfs.changeSelection(ffsTableModel.getRowCount()-1, 0, false, false);
-
- }
- });
- }
- return jButtonFfsAdd;
- }
-
- /**
- * This method initializes jButton9
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsDel() {
- if (jButtonFfsDel == null) {
- jButtonFfsDel = new JButton();
- jButtonFfsDel.setPreferredSize(new java.awt.Dimension(70, 20));
- jButtonFfsDel.setText("Delete");
- jButtonFfsDel.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = -4002678939178194476L;
-
- public void actionPerformed(ActionEvent arg0) {
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- stopEditingInTables();
- docConsole.setSaved(false);
- ffc.removeBuildOptionsFfs(jTableFfs.getSelectedRow());
- ffsTableModel.removeRow(jTableFfs.getSelectedRow());
- sectionTableModel.setRowCount(0);
- sectionsTableModel.setRowCount(0);
- subsectionsTableModel.setRowCount(0);
- ffsAttributesTableModel.setRowCount(0);
- }
- });
- }
- return jButtonFfsDel;
- }
-
- /**
- * This method initializes jScrollPane5
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFfsAttribs() {
- if (jScrollPaneFfsAttribs == null) {
- jScrollPaneFfsAttribs = new JScrollPane();
-// jScrollPaneFfsAttribs.setPreferredSize(new java.awt.Dimension(350, 100));
- jScrollPaneFfsAttribs.setViewportView(getJTableFfsAttribs());
-
- }
- return jScrollPaneFfsAttribs;
- }
-
- /**
- * This method initializes jTable4
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFfsAttribs() {
- if (jTableFfsAttribs == null) {
- ffsAttributesTableModel = new DefaultTableModel();
- jTableFfsAttribs = new JTable(ffsAttributesTableModel);
-// jTableFfsAttribs.setPreferredSize(new java.awt.Dimension(400, 80));
- jTableFfsAttribs.setRowHeight(20);
- ffsAttributesTableModel.addColumn("Name");
- ffsAttributesTableModel.addColumn("Value");
-
- jTableFfsAttribs.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFfsAttribs.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String name = m.getValueAt(row, 0) + "";
- String value = m.getValueAt(row, 1) + "";
-
- if (name.length() == 0) {
- return;
- }
- if (value.length() == 0) {
- return;
- }
- docConsole.setSaved(false);
- ffc.updateBuildOptionsFfsAttribute(jTableFfs.getSelectedRow(), row, name, value);
- }
- }
- });
- }
- return jTableFfsAttribs;
- }
-
- private void initFfsTable() {
- int ffsCount = ffc.getBuildOptionsFfsCount();
- if (ffsCount < 0) {
- return;
- }
- String[][] saa = new String[ffsCount][1];
- ffc.getBuildOptionsFfsKey(saa);
- for (int i = 0; i < saa.length; ++i) {
- ffsTableModel.addRow(saa[i]);
- }
- jTableFfs.changeSelection(0, 0, false, false);
- }
-
- /**
- * This method initializes jButton17
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsAttribNew() {
- if (jButtonFfsAttribNew == null) {
- jButtonFfsAttribNew = new JButton();
- jButtonFfsAttribNew.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsAttribNew.setText("New");
- jButtonFfsAttribNew.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent arg0) {
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- Object[] o = { "", "" };
- ffsAttributesTableModel.addRow(o);
- docConsole.setSaved(false);
- ffc.genBuildOptionsFfsAttribute(jTableFfs.getSelectedRow(), "", "");
- }
- });
- }
- return jButtonFfsAttribNew;
- }
-
- /**
- * This method initializes jButton18
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsAttribRemove() {
- if (jButtonFfsAttribRemove == null) {
- jButtonFfsAttribRemove = new JButton();
- jButtonFfsAttribRemove.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsAttribRemove.setText("Remove");
- jButtonFfsAttribRemove.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent arg0) {
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- stopEditingInTables();
- if (jTableFfsAttribs.getSelectedRow() >= 0) {
- docConsole.setSaved(false);
- ffsAttributesTableModel.removeRow(jTableFfsAttribs.getSelectedRow());
- ffc.removeBuildOptionsFfsAttribute(jTableFfs.getSelectedRow(),
- jTableFfsAttribs.getSelectedRow());
- }
- }
- });
- }
- return jButtonFfsAttribRemove;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFfs() {
- if (jScrollPaneFfs == null) {
- jScrollPaneFfs = new JScrollPane();
- jScrollPaneFfs.setPreferredSize(new java.awt.Dimension(200,419));
- jScrollPaneFfs.setViewportView(getJTableFfs());
- }
- return jScrollPaneFfs;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFfs() {
- if (jTableFfs == null) {
- ffsTableModel = new DefaultTableModel();
- ffsTableModel.addColumn("FFS Type");
- jTableFfs = new JTable(ffsTableModel);
- jTableFfs.setShowGrid(false);
- jTableFfs.setRowHeight(20);
-
- jTableFfs.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFfs.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
-
- if (e.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- int row = lsm.getMinSelectionIndex();
- sectionTableModel.setRowCount(0);
- sectionsTableModel.setRowCount(0);
- subsectionsTableModel.setRowCount(0);
- ffsAttributesTableModel.setRowCount(0);
- String[] sArray = { "", "" };
- LinkedHashMap<String, String> lhm = new LinkedHashMap<String, String>();
- ArrayList<String> alSections = new ArrayList<String>();
- ArrayList<String> alSection = new ArrayList<String>();
- ffc.getBuildOptionsFfs(row, sArray, lhm, alSections, alSection);
- ffsSelection = true;
- jTextFieldEncapType.setText(sArray[1]);
- ffsSelection = false;
- for (int i = 0; i < alSection.size(); ++i) {
- String[] sectionRow = { alSection.get(i) };
- sectionTableModel.addRow(sectionRow);
- }
- for (int j = 0; j < alSections.size(); ++j) {
- String[] sectionsRow = { alSections.get(j) };
- sectionsTableModel.addRow(sectionsRow);
- }
- if (lhm.size() <= 0) {
- return;
- }
- Set<String> keySet = lhm.keySet();
- Iterator<String> is = keySet.iterator();
- while (is.hasNext()) {
- String key = is.next();
- String[] attribRow = { key, lhm.get(key) };
- ffsAttributesTableModel.addRow(attribRow);
- }
- selectedFfsTableRow = row;
- }
- }
- });
-
- jTableFfs.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String id = m.getValueAt(row, 0) + "";
-
- if (id.length() == 0) {
- return;
- }
- docConsole.setSaved(false);
- ffc.updateBuildOptionsFfsKey(row, id);
- }
- }
- });
- }
- return jTableFfs;
- }
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFfsSection() {
- if (jScrollPaneFfsSection == null) {
- jScrollPaneFfsSection = new JScrollPane();
-// jScrollPaneFfsSection.setPreferredSize(new java.awt.Dimension(500, 80));
- jScrollPaneFfsSection.setViewportView(getJTableFfsSection());
- }
- return jScrollPaneFfsSection;
- }
-
- /**
- * This method initializes jTable1
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFfsSection() {
- if (jTableFfsSection == null) {
- sectionTableModel = new DefaultTableModel();
- sectionTableModel.addColumn("SectionType");
-
- jTableFfsSection = new JTable(sectionTableModel);
- jTableFfsSection.setRowHeight(20);
- JComboBox cb = new JComboBox();
- cb.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID");
- cb.addItem("EFI_SECTION_VERSION");
- cb.addItem("EFI_SECTION_USER_INTERFACE");
- cb.addItem("EFI_SECTION_DXE_DEPEX");
- cb.addItem("EFI_SECTION_PEI_DEPEX");
- cb.addItem("EFI_SECTION_PE32");
- cb.addItem("EFI_SECTION_PIC");
- cb.addItem("EFI_SECTION_TE");
- cb.addItem("EFI_SECTION_RAW");
- cb.addItem("EFI_SECTION_COMPRESSION");
- cb.addItem("EFI_SECTION_GUID_DEFINED");
- cb.addItem("EFI_SECTION_COMPATIBILITY16");
- cb.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE");
- jTableFfsSection.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb));
-
- jTableFfsSection.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- jTableFfsSection.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String type = m.getValueAt(row, 0) + "";
- docConsole.setSaved(false);
- ffc.updateBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(), row, type);
- }
- }
- });
- }
- return jTableFfsSection;
- }
-
- /**
- * This method initializes jScrollPane3
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFfsSubSection() {
- if (jScrollPaneFfsSubSection == null) {
- jScrollPaneFfsSubSection = new JScrollPane();
-// jScrollPaneFfsSubSection.setPreferredSize(new java.awt.Dimension(500, 90));
- jScrollPaneFfsSubSection.setViewportView(getJTableFfsSubSection());
- }
- return jScrollPaneFfsSubSection;
- }
-
- /**
- * This method initializes jTable3
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFfsSubSection() {
- if (jTableFfsSubSection == null) {
- subsectionsTableModel = new DefaultTableModel();
- subsectionsTableModel.addColumn("SectionType");
- jTableFfsSubSection = new JTable(subsectionsTableModel);
- jTableFfsSubSection.setRowHeight(20);
- JComboBox cb = new JComboBox();
- cb.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID");
- cb.addItem("EFI_SECTION_VERSION");
- cb.addItem("EFI_SECTION_USER_INTERFACE");
- cb.addItem("EFI_SECTION_DXE_DEPEX");
- cb.addItem("EFI_SECTION_PEI_DEPEX");
- cb.addItem("EFI_SECTION_PE32");
- cb.addItem("EFI_SECTION_PIC");
- cb.addItem("EFI_SECTION_TE");
- cb.addItem("EFI_SECTION_RAW");
- cb.addItem("EFI_SECTION_COMPRESSION");
- cb.addItem("EFI_SECTION_GUID_DEFINED");
- cb.addItem("EFI_SECTION_COMPATIBILITY16");
- cb.addItem("EFI_SECTION_FIRMWARE_VOLUME_IMAGE");
- jTableFfsSubSection.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(cb));
- jTableFfsSubSection.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- jTableFfsSubSection.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) {
- return;
- }
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String type = m.getValueAt(row, 0) + "";
- docConsole.setSaved(false);
- ffc.updateBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(),
- jTableFfsSections.getSelectedRow(), row, type);
- }
- }
- });
- }
- return jTableFfsSubSection;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldEncapType() {
- if (jTextFieldEncapType == null) {
- jTextFieldEncapType = new JTextField();
- jTextFieldEncapType.setPreferredSize(new java.awt.Dimension(200,20));
- jTextFieldEncapType.getDocument().addDocumentListener(new DocumentListener() {
-
- public void insertUpdate(DocumentEvent arg0) {
- if (ffsSelection) {
-// ffsSelection = false;
- return;
- }
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-
- public void removeUpdate(DocumentEvent arg0) {
- if (ffsSelection) {
-// ffsSelection = false;
- return;
- }
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-
- public void changedUpdate(DocumentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- });
- jTextFieldEncapType.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusLost(java.awt.event.FocusEvent e) {
- if (selectedFfsTableRow < 0) {
- return;
- }
- ffc.updateBuildOptionsFfsSectionsType(selectedFfsTableRow, jTextFieldEncapType.getText());
-
- }
- });
- }
- return jTextFieldEncapType;
- }
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsAttribButtonGroup() {
- if (jPanelFfsAttribButtonGroup == null) {
- jPanelFfsAttribButtonGroup = new JPanel();
- jPanelFfsAttribButtonGroup.setPreferredSize(new java.awt.Dimension(100, 100));
- jPanelFfsAttribButtonGroup.add(getJButtonFfsAttribNew(), null);
- jPanelFfsAttribButtonGroup.add(getJButtonFfsAttribRemove(), null);
- }
- return jPanelFfsAttribButtonGroup;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsSectionNew() {
- if (jButtonFfsSectionNew == null) {
- jButtonFfsSectionNew = new JButton();
- jButtonFfsSectionNew.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsSectionNew.setText("New");
- jButtonFfsSectionNew.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- docConsole.setSaved(false);
- String[] row = { "EFI_SECTION_RAW" };
- sectionTableModel.addRow(row);
- ffc.genBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(), row[0]);
- }
- });
- }
- return jButtonFfsSectionNew;
- }
-
- /**
- * This method initializes jButton1
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsSectionRemove() {
- if (jButtonFfsSectionRemove == null) {
- jButtonFfsSectionRemove = new JButton();
- jButtonFfsSectionRemove.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsSectionRemove.setText("Remove");
-
- jButtonFfsSectionRemove.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFfs.getSelectedRow() < 0 || jTableFfsSection.getSelectedRow() < 0) {
- return;
- }
- stopEditingInTables();
- docConsole.setSaved(false);
- sectionTableModel.removeRow(jTableFfsSection.getSelectedRow());
- ffc.removeBuildOptionsFfsSectionsSection(jTableFfs.getSelectedRow(),
- jTableFfsSection.getSelectedRow());
- }
- });
- }
- return jButtonFfsSectionRemove;
- }
-
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsSubSectionNew() {
- if (jButtonFfsSubSectionNew == null) {
- jButtonFfsSubSectionNew = new JButton();
- jButtonFfsSubSectionNew.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsSubSectionNew.setText("New");
- jButtonFfsSubSectionNew.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) {
- return;
- }
- docConsole.setSaved(false);
- String[] row = { "EFI_SECTION_RAW" };
- subsectionsTableModel.addRow(row);
- ffc.genBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(),
- jTableFfsSections.getSelectedRow(), row[0]);
-
- }
- });
- }
- return jButtonFfsSubSectionNew;
- }
-
- /**
- * This method initializes jButton3
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsSubSectionRemove() {
- if (jButtonFfsSubSectionRemove == null) {
- jButtonFfsSubSectionRemove = new JButton();
- jButtonFfsSubSectionRemove.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsSubSectionRemove.setText("Remove");
- jButtonFfsSubSectionRemove.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedFfsRow = jTableFfs.getSelectedRow();
- int selectedSectionsRow = jTableFfsSections.getSelectedRow();
- int selectedSubSectionRow = jTableFfsSubSection.getSelectedRow();
- if (selectedFfsRow < 0 || selectedSectionsRow < 0
- || selectedSubSectionRow < 0) {
- return;
- }
- stopEditingInTables();
- docConsole.setSaved(false);
- subsectionsTableModel.removeRow(selectedSubSectionRow);
- ffc.removeBuildOptionsFfsSectionsSectionsSection(selectedFfsRow,
- selectedSectionsRow,
- selectedSubSectionRow);
- if (subsectionsTableModel.getRowCount() == 0) {
- sectionsTableModel.removeRow(selectedSectionsRow);
- }
- }
- });
- }
- return jButtonFfsSubSectionRemove;
- }
-
- /**
- * This method initializes jButton6
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsSectionsNew() {
- if (jButtonFfsSectionsNew == null) {
- jButtonFfsSectionsNew = new JButton();
- jButtonFfsSectionsNew.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsSectionsNew.setText("New");
- jButtonFfsSectionsNew.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- docConsole.setSaved(false);
- String[] row = { "Compress" };
- sectionsTableModel.addRow(row);
- ffc.genBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(), "");
- JOptionPane.showMessageDialog(FpdBuildOptions.this, "Add Default Section Type EFI_SECTION_PE32 into the New Sections Entry.");
- jTableFfsSections.changeSelection(sectionsTableModel.getRowCount()-1, 0, false, false);
- }
- });
- }
- return jButtonFfsSectionsNew;
- }
-
- /**
- * This method initializes jButton7
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFfsSectionsRemove() {
- if (jButtonFfsSectionsRemove == null) {
- jButtonFfsSectionsRemove = new JButton();
- jButtonFfsSectionsRemove.setPreferredSize(new java.awt.Dimension(80, 20));
- jButtonFfsSectionsRemove.setText("Remove");
- jButtonFfsSectionsRemove.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFfs.getSelectedRow() < 0 || jTableFfsSections.getSelectedRow() < 0) {
- return;
- }
- stopEditingInTables();
- docConsole.setSaved(false);
- sectionsTableModel.removeRow(jTableFfsSections.getSelectedRow());
- ffc.removeBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(),
- jTableFfsSections.getSelectedRow());
- subsectionsTableModel.setRowCount(0);
- }
- });
- }
- return jButtonFfsSectionsRemove;
- }
-
- private JScrollPane getJScrollPaneFfsSections() {
- if (jScrollPaneFfsSections == null) {
- jScrollPaneFfsSections = new JScrollPane();
-// jScrollPaneFfsSections.setPreferredSize(new java.awt.Dimension(500, 80));
- jScrollPaneFfsSections.setViewportView(getJTableFfsSections());
- }
- return jScrollPaneFfsSections;
- }
-
- /**
- * This method initializes jTable6
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFfsSections() {
- if (jTableFfsSections == null) {
- sectionsTableModel = new DefaultTableModel();
- sectionsTableModel.addColumn("EncapsulationType");
- jTableFfsSections = new JTable(sectionsTableModel);
- jTableFfsSections.setRowHeight(20);
- jTableFfsSections.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFfsSections.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- int sectionsRow = lsm.getMinSelectionIndex();
- if (jTableFfs.getSelectedRow() < 0) {
- return;
- }
- subsectionsTableModel.setRowCount(0);
- ArrayList<String> al = new ArrayList<String>();
- ffc.getBuildOptionsFfsSectionsSectionsSection(jTableFfs.getSelectedRow(), sectionsRow, al);
- for (int i = 0; i < al.size(); ++i) {
- String[] subsectionRow = { al.get(i) };
- subsectionsTableModel.addRow(subsectionRow);
- }
- }
- }
- });
-
- jTableFfsSections.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String encapType = m.getValueAt(row, 0) + "";
- docConsole.setSaved(false);
- ffc.updateBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(), row, encapType);
- }
- }
- });
- }
- return jTableFfsSections;
- }
-
- /**
- * This method initializes jSplitPaneFfsC
- *
- * @return javax.swing.JSplitPane
- */
- private JSplitPane getJSplitPaneFfsC() {
- if (jSplitPaneFfsC == null) {
- jSplitPaneFfsC = new JSplitPane();
- jSplitPaneFfsC.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
- jSplitPaneFfsC.setDividerLocation(130);
- jSplitPaneFfsC.setTopComponent(getJPanelFfsCTop());
- jSplitPaneFfsC.setBottomComponent(getJSplitPaneFfsCBottom());
- jSplitPaneFfsC.setDividerSize(5);
- }
- return jSplitPaneFfsC;
- }
-
- /**
- * This method initializes jPanelFfsCTop
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsCTop() {
- if (jPanelFfsCTop == null) {
- jPanelFfsCTop = new JPanel();
- jPanelFfsCTop.setLayout(new BorderLayout());
- jPanelFfsCTop.add(getJPanelSectionN(), java.awt.BorderLayout.NORTH);
- jPanelFfsCTop.add(getJScrollPaneFfsSection(), java.awt.BorderLayout.CENTER);
- }
- return jPanelFfsCTop;
- }
-
- /**
- * This method initializes jSplitPaneFfsCBottom
- *
- * @return javax.swing.JSplitPane
- */
- private JSplitPane getJSplitPaneFfsCBottom() {
- if (jSplitPaneFfsCBottom == null) {
- jSplitPaneFfsCBottom = new JSplitPane();
- jSplitPaneFfsCBottom.setDividerSize(5);
- jSplitPaneFfsCBottom.setDividerLocation(130);
- jSplitPaneFfsCBottom.setTopComponent(getJPanelFfsCBottomTop());
- jSplitPaneFfsCBottom.setBottomComponent(getJPanelFfsCBottomBottom());
- jSplitPaneFfsCBottom.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
- }
- return jSplitPaneFfsCBottom;
- }
-
- /**
- * This method initializes jPanelFfsCBottomTop
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsCBottomTop() {
- if (jPanelFfsCBottomTop == null) {
- jPanelFfsCBottomTop = new JPanel();
- jPanelFfsCBottomTop.setLayout(new BorderLayout());
- jPanelFfsCBottomTop.add(getJPanelSectionsN(), java.awt.BorderLayout.NORTH);
- jPanelFfsCBottomTop.add(getJScrollPaneFfsSections(), java.awt.BorderLayout.CENTER);
- }
- return jPanelFfsCBottomTop;
- }
-
- /**
- * This method initializes jPanelFfsCBottomBottom
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFfsCBottomBottom() {
- if (jPanelFfsCBottomBottom == null) {
- jPanelFfsCBottomBottom = new JPanel();
- jPanelFfsCBottomBottom.setLayout(new BorderLayout());
- jPanelFfsCBottomBottom.add(getJPanelSubSectionN(), java.awt.BorderLayout.NORTH);
- jPanelFfsCBottomBottom.add(getJScrollPaneFfsSubSection(), java.awt.BorderLayout.CENTER);
- }
- return jPanelFfsCBottomBottom;
- }
-
- /**
- * This method initializes jPanelSectionN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelSectionN() {
- if (jPanelSectionN == null) {
- jPanelSectionN = new JPanel();
- jLabelFfsSection = new JLabel();
- jLabelFfsSection.setText("Section");
- jPanelSectionN.add(jLabelFfsSection, null);
- jPanelSectionN.add(getJButtonFfsSectionNew(), null);
- jPanelSectionN.add(getJButtonFfsSectionRemove(), null);
- }
- return jPanelSectionN;
- }
-
- /**
- * This method initializes jPanelSectionsN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelSectionsN() {
- if (jPanelSectionsN == null) {
- jPanelSectionsN = new JPanel();
- jLabelFfsSections = new JLabel();
- jLabelFfsSections.setText("Sections");
- jPanelSectionsN.add(jLabelFfsSections, null);
- jPanelSectionsN.add(getJButtonFfsSectionsNew(), null);
- jPanelSectionsN.add(getJButtonFfsSectionsRemove(), null);
- }
- return jPanelSectionsN;
- }
-
- /**
- * This method initializes jPanelSubSectionN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelSubSectionN() {
- if (jPanelSubSectionN == null) {
- jPanelSubSectionN = new JPanel();
- jLabelFfsSubSections = new JLabel();
- jLabelFfsSubSections.setText("Sub-Sections");
- jPanelSubSectionN.add(jLabelFfsSubSections, null);
- jPanelSubSectionN.add(getJButtonFfsSubSectionNew(), null);
- jPanelSubSectionN.add(getJButtonFfsSubSectionRemove(), null);
- }
- return jPanelSubSectionN;
- }
-
- /**
- * The following section contains all Build Options content
- */
-
- /**
- * This method initializes jPanelOptionsTab
- *
- * This is the main Options screen
- *
- * @return javax.swing.JPanel jPanelOptionsTab
- */
- private JPanel getJPanelOptionsTab() {
- if (jPanelOptionsTab == null) {
- // This container holds the Options Tab content
-
- // FlowLayout flowLayout9 = new FlowLayout();
- // flowLayout9.setAlignment(java.awt.FlowLayout.LEFT);
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.setRows(2);
- jPanelOptionsTab = new JPanel();
- jPanelOptionsTab.setLayout(gridLayout);
- jPanelOptionsTab.setBounds(new java.awt.Rectangle(0, 0, dialogWidth * 2, dialogHeight * 3));
- jPanelOptionsTab.setPreferredSize(new java.awt.Dimension(dialogWidth + 10, (dialogHeight * 3) + 10));
- jPanelOptionsTab.setAutoscrolls(true);
- jPanelOptionsTab.setLocation(0, 0);
- jPanelOptionsTab.add(getJPanelOptionsContainer(), null);
-// jPanelOptionsTab.add(getJScrollPaneOptions(), null);
- jPanelOptionsTab.add(getJPanelTableOptionsContainer(), null);
- }
- return jPanelOptionsTab;
- }
-
- /**
- * This method initializes jPanelOptionsContainer
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelOptionsContainer() {
- if (jPanelOptionsContainer == null) {
- jLabelTagName = new JLabel();
- jLabelTagName.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
- jLabelTagName.setLocation(new java.awt.Point(labelColumn, rowOne));
- jLabelTagName.setText("Tag Name");
- jLabelBuildTargets = new JLabel();
- jLabelBuildTargets.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));
- jLabelBuildTargets.setLocation(new java.awt.Point(labelColumn, rowTwo));
- jLabelBuildTargets.setText("Build Targets");
- jLabelToolCmd = new JLabel();
- jLabelToolCmd.setBounds(new java.awt.Rectangle(labelColumn, rowThree, labelWidth, oneRowHeight));
- jLabelToolCmd.setLocation(new java.awt.Point(labelColumn, rowThree));
- jLabelToolCmd.setText("Tool Command");
- jLabelSupArch = new JLabel();
- jLabelSupArch.setBounds(new java.awt.Rectangle(labelColumn, rowFour, labelWidth, oneRowHeight));
- jLabelSupArch.setLocation(new java.awt.Point(labelColumn, rowFour));
- jLabelSupArch.setText("Supported Architectures");
- jLabelToolChainFamily = new JLabel();
- jLabelToolChainFamily.setBounds(new java.awt.Rectangle(labelColumn, rowFive, labelWidth, oneRowHeight));
- jLabelToolChainFamily.setLocation(new java.awt.Point(labelColumn, rowFive));
- jLabelToolChainFamily.setText("Tool Chain Family");
-
- jLabelOptionContents = new JLabel();
- jLabelOptionContents.setBounds(new java.awt.Rectangle(labelColumn, rowSix, labelWidth, oneRowHeight));
- jLabelOptionContents.setLocation(new java.awt.Point(labelColumn, rowSix));
- jLabelOptionContents.setText("Argument Strings");
-
- jPanelOptionsContainer = new JPanel();
-
- jPanelOptionsContainer.setLayout(null);
-
- jPanelOptionsContainer.setPreferredSize(new java.awt.Dimension(dialogWidth, dialogHeight));
- /*
- jPanelOptionsContainer
- .setBorder(javax.swing.BorderFactory
- .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
-*/
- jPanelOptionsContainer.add(jLabelTagName, null);
- jPanelOptionsContainer.add(getJTextFieldTagName(), null);
-
- jPanelOptionsContainer.add(jLabelBuildTargets, null);
- jPanelOptionsContainer.add(getJTextFieldBuildTargets(), null);
-
- jPanelOptionsContainer.add(jLabelToolChainFamily, null);
- jPanelOptionsContainer.add(getJTextFieldToolChainFamily(), null);
-
- jPanelOptionsContainer.add(jLabelToolCmd, null);
- jPanelOptionsContainer.add(getJTextFieldToolCmd(), null);
-
- jPanelOptionsContainer.add(jLabelSupArch, null);
- jPanelOptionsContainer.add(getArchitectureSelections(), null);
-
- jPanelOptionsContainer.add(jLabelOptionContents, null);
- jPanelOptionsContainer.add(getJTextFieldOptionContents(), null);
-
- jPanelOptionsContainer.add(getJButtonOptionsAdd(), null);
- jPanelOptionsContainer.add(getJButtonOptionsDel(), null);
- }
- return jPanelOptionsContainer;
- }
-
- /**
- * This method initializes jTextFieldOptionTagName Row 1
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldTagName() {
- if (jTextFieldTagName == null) {
- jTextFieldTagName = new JTextField();
- jTextFieldTagName.setBounds(new java.awt.Rectangle(fieldColumn, rowOne, fieldWidth, oneRowHeight));
- jTextFieldTagName.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
- jTextFieldTagName.setLocation(new java.awt.Point(fieldColumn, rowOne));
- }
- return jTextFieldTagName;
- }
-
- /**
- * This method initializes jTextFieldBuildTargets Row 2
- *
- * @return javax.swing.JTextField jTextFieldBuildTargets
- */
- private JTextField getJTextFieldBuildTargets() {
- if (jTextFieldBuildTargets == null) {
- jTextFieldBuildTargets = new JTextField();
- jTextFieldBuildTargets.setBounds(new java.awt.Rectangle(fieldColumn, rowTwo, fieldWidth, oneRowHeight));
- jTextFieldBuildTargets.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
- jTextFieldBuildTargets.setLocation(new java.awt.Point(fieldColumn, rowTwo));
- }
- return jTextFieldBuildTargets;
- }
-
- /**
- * This method initializes jTextFieldToolCmd Row 3
- *
- * This should be a dropdown box of command codes from tools_def.txt
- *
- * @return javax.swing.JTextField jTextFieldToolCmd
- */
- private JTextField getJTextFieldToolCmd() {
- if (jTextFieldToolCmd == null) {
- jTextFieldToolCmd = new JTextField();
- jTextFieldToolCmd.setBounds(new java.awt.Rectangle(fieldColumn, rowThree, fieldWidth, oneRowHeight));
- jTextFieldToolCmd.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
- jTextFieldToolCmd.setLocation(new java.awt.Point(fieldColumn, rowThree));
- }
- return jTextFieldToolCmd;
- }
-
- /**
- * This method initializes jArchitectureSelections Row 4
- *
- * @return jArchitectureSelections
- */
- private JPanel getArchitectureSelections() {
- if (jArchitectureSelections == null) {
- jArchitectureSelections = new JPanel();
- jArchitectureSelections.setLayout(null);
- jArchitectureSelections.add(getJCheckBoxIA32(), null);
- jArchitectureSelections.add(getJCheckBoxX64(), null);
- jArchitectureSelections.add(getJCheckBoxIpf(), null);
- jArchitectureSelections.add(getJCheckBoxEBC(), null);
- jArchitectureSelections.add(getJCheckBoxARM(), null);
- jArchitectureSelections.add(getJCheckBoxPPC(), null);
- jArchitectureSelections.setBounds(new java.awt.Rectangle(fieldColumn, rowFour, fieldWidth, oneRowHeight));
- jArchitectureSelections.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
- jArchitectureSelections.setLocation(new java.awt.Point(fieldColumn, rowFour));
- }
- return jArchitectureSelections;
- }
-
- /**
- * This method initializes jCheckBoxIA32
- *
- * @return javax.swing.JCheckBox jCheckBoxIA32
- */
- private JCheckBox getJCheckBoxIA32() {
- if (jCheckBoxIA32 == null) {
- jCheckBoxIA32 = new JCheckBox();
- jCheckBoxIA32.setBounds(new java.awt.Rectangle(0, 0, 55, 20));
- jCheckBoxIA32.setText("IA32");
- }
- return jCheckBoxIA32;
- }
-
- /**
- * This method initializes jCheckBoxX64
- *
- * @return javax.swing.JCheckBox jCheckBoxX64
- */
- private JCheckBox getJCheckBoxX64() {
- if (jCheckBoxX64 == null) {
- jCheckBoxX64 = new JCheckBox();
- jCheckBoxX64.setText("X64");
- jCheckBoxX64.setBounds(new java.awt.Rectangle(55, 0, 53, 20));
- }
- return jCheckBoxX64;
- }
-
- /**
- * This method initializes jCheckBoxIpf
- *
- * @return javax.swing.JCheckBox jCheckBoxIpf
- */
- private JCheckBox getJCheckBoxIpf() {
- if (jCheckBoxIpf == null) {
- jCheckBoxIpf = new JCheckBox();
- jCheckBoxIpf.setBounds(new java.awt.Rectangle(108, 0, 52, 20));
- jCheckBoxIpf.setText("IPF");
- }
- return jCheckBoxIpf;
- }
-
-
- /**
- * This method initializes jCheckBoxEBC
- *
- * @return javax.swing.JCheckBox jCheckBoxEBC
- */
- private JCheckBox getJCheckBoxEBC() {
- if (jCheckBoxEBC == null) {
- jCheckBoxEBC = new JCheckBox();
- jCheckBoxEBC.setBounds(new java.awt.Rectangle(160, 0, 53, 20));
- jCheckBoxEBC.setText("EBC");
- }
- return jCheckBoxEBC;
- }
-
- /**
- * This method initializes jCheckBoxARM
- *
- * @return javax.swing.JCheckBox jCheckBoxARM
- */
- private JCheckBox getJCheckBoxARM() {
- if (jCheckBoxARM == null) {
- jCheckBoxARM = new JCheckBox();
- jCheckBoxARM.setBounds(new java.awt.Rectangle(213, 0, 54, 20));
- jCheckBoxARM.setText("ARM");
- }
- return jCheckBoxARM;
- }
-
- /**
- * This method initializes jCheckBoxPPC
- *
- * @return javax.swing.JCheckBox jCheckBoxPPC
- */
- private JCheckBox getJCheckBoxPPC() {
- if (jCheckBoxPPC == null) {
- jCheckBoxPPC = new JCheckBox();
- jCheckBoxPPC.setBounds(new java.awt.Rectangle(267, 0, 53, 20));
- jCheckBoxPPC.setText("PPC");
- }
- return jCheckBoxPPC;
- }
-
- /**
- * This method initializes jTextFieldToolChainFamily Row 5
- *
- * This should be a drop down for MSFT, INTEL, GCC or USER_DEFINED
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldToolChainFamily() {
- if (jTextFieldToolChainFamily == null) {
- jTextFieldToolChainFamily = new JTextField();
- jTextFieldToolChainFamily.setBounds(new java.awt.Rectangle(fieldColumn, rowFive, fieldWidth, oneRowHeight));
- jTextFieldToolChainFamily.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
- jTextFieldToolChainFamily.setLocation(new java.awt.Point(fieldColumn, rowFive));
- }
- return jTextFieldToolChainFamily;
- }
-
- /**
- * This method initializes jTextFieldOptionContents Row 6
- *
- * This is where we should put the checkbox & entry data for the command arguments
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldOptionContents() {
- if (jTextFieldOptionContents == null) {
- jTextFieldOptionContents = new JTextField();
- jTextFieldOptionContents.setPreferredSize(new java.awt.Dimension(fieldWidth, oneRowHeight));
- jTextFieldOptionContents.setBounds(fieldColumn, rowSix, fieldWidth, oneRowHeight);
- jTextFieldOptionContents.setLocation(new java.awt.Point(fieldColumn, rowSix));
- }
- return jTextFieldOptionContents;
- }
-
- /**
- * This method initializes jButtonOptionsAdd
- *
- * Add entry from the top screen to the table
- *
- * @return javax.swing.JButton jButtonOptionsAdd
- */
- private JButton getJButtonOptionsAdd() {
- if (jButtonOptionsAdd == null) {
- jButtonOptionsAdd = new JButton();
- jButtonOptionsAdd.setText("Add");
-
- jButtonOptionsAdd.setPreferredSize(new java.awt.Dimension(buttonWidth, oneRowHeight));
- jButtonOptionsAdd.setBounds(new java.awt.Rectangle(firstButtonLoc, buttonRow, buttonWidth, oneRowHeight));
- jButtonOptionsAdd.setLocation(new java.awt.Point(firstButtonLoc, buttonRow));
- jButtonOptionsAdd.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
- boolean[] boolArray = { jCheckBoxIA32.isSelected(), jCheckBoxIpf.isSelected(),
- jCheckBoxX64.isSelected(), jCheckBoxEBC.isSelected(),
- jCheckBoxARM.isSelected(), jCheckBoxPPC.isSelected() };
- String s = boolToList(boolArray);
- Object[] o = { jTextFieldBuildTargets.getText(), jTextFieldToolChainFamily.getText(), s,
- jTextFieldToolCmd.getText(), jTextFieldTagName.getText(),
- jTextFieldOptionContents.getText() };
- optionsTableModel.addRow(o);
- docConsole.setSaved(false);
- ffc.genBuildOptionsOpt(stringToVector(jTextFieldBuildTargets.getText().trim()),
- jTextFieldToolChainFamily.getText(), jTextFieldTagName.getText(),
- jTextFieldToolCmd.getText(), stringToVector(s.trim()),
- jTextFieldOptionContents.getText());
- }
- });
- }
- return jButtonOptionsAdd;
- }
-
- /**
- * This method initializes jButtonOptionsDel
- *
- * Remove a line from the table below
- *
- * @return javax.swing.JButton jButtonOptionsDel
- */
- private JButton getJButtonOptionsDel() {
- if (jButtonOptionsDel == null) {
- jButtonOptionsDel = new JButton();
- jButtonOptionsDel.setText("Delete");
- jButtonOptionsDel.setPreferredSize(new java.awt.Dimension(buttonWidth, oneRowHeight));
- jButtonOptionsDel.setBounds(new java.awt.Rectangle(next2LastButtonLoc, buttonRow, buttonWidth, oneRowHeight));
- jButtonOptionsDel.setLocation(new java.awt.Point(next2LastButtonLoc, buttonRow));
- jButtonOptionsDel.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (selectedRow >= 0) {
- optionsTableModel.removeRow(selectedRow);
- docConsole.setSaved(false);
- ffc.removeBuildOptionsOpt(selectedRow);
- }
- }
- });
- }
- return jButtonOptionsDel;
- }
-
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = 500;
-
- Tools.resizeComponentWidth(this.jScrollPaneOptions, this.getWidth(), intPreferredWidth);
-
- }
- /**
- * This method initializes jScrollPaneOptions
- * Contains the Table and is located below the data entry section
- * @return javax.swing.JScrollPane jScrollPaneOptoins
- */
- private JScrollPane getJScrollPaneOptions() {
- if (jScrollPaneOptions == null) {
- jScrollPaneOptions = new JScrollPane();
- jScrollPaneOptions.setViewportView(getJTableOptions());
- }
- return jScrollPaneOptions;
- }
-
- /**
- * This method initializes jTableOptions
- *
- * @return javax.swing.JTable jTableOptions
- */
- private JTable getJTableOptions() {
- if (jTableOptions == null) {
-
- optionsTableModel = new DefaultTableModel();
- jTableOptions = new JTable(optionsTableModel);
- jTableOptions.setRowHeight(20);
- optionsTableModel.addColumn("Build Targets");
- optionsTableModel.addColumn("Tool Chain Family");
- optionsTableModel.addColumn("Supported Architectures");
- optionsTableModel.addColumn("Tool Command Code");
- optionsTableModel.addColumn("TagName");
- optionsTableModel.addColumn("Arguments");
-
- jTableOptions.getColumnModel().getColumn(0).setMinWidth(buildTargetWidth);
- jTableOptions.getColumnModel().getColumn(1).setMinWidth(toolChainFamilyWidth);
- jTableOptions.getColumnModel().getColumn(2).setMinWidth(supportArchWidth);
- jTableOptions.getColumnModel().getColumn(3).setMinWidth(toolCmdCodeWidth);
- jTableOptions.getColumnModel().getColumn(4).setMinWidth(tagNameWidth);
- jTableOptions.getColumnModel().getColumn(5).setMinWidth(argWidth);
-
-// javax.swing.table.TableColumn toolFamilyCol = jTableOptions.getColumnModel().getColumn(1);
-// JComboBox cb = new JComboBox();
-// cb.addItem("MSFT");
-// cb.addItem("GCC");
-// cb.addItem("CYGWIN");
-// cb.addItem("INTEL");
-// cb.addItem("USER_DEFINED");
-// toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));
- Vector<String> vArch = new Vector<String>();
- vArch.add("IA32");
- vArch.add("X64");
- vArch.add("IPF");
- vArch.add("EBC");
- vArch.add("ARM");
- vArch.add("PPC");
- jTableOptions.getColumnModel().getColumn(2).setCellEditor(new ListEditor(vArch, FrameworkWizardUI.getInstance()));
-
- jTableOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor(FrameworkWizardUI.getInstance()));
-
- jTableOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
- jTableOptions.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- selectedRow = -1;
- if (e.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
- });
-
- jTableOptions.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String targets = m.getValueAt(row, 0) + "";
- Vector<Object> targetName = new Vector<Object>();
- String[] sArray = targets.split("( )+");
- for (int i = 0; i < sArray.length; ++i) {
- targetName.add(sArray[i]);
- }
- String toolChain = m.getValueAt(row, 1) + "";
- String archs = m.getValueAt(row, 2) + "";
- Vector<Object> supArch = null;
- if (archs.length() > 0) {
- supArch = new Vector<Object>();
- String[] sArray1 = archs.split("( )+");
- for (int i = 0; i < sArray1.length; ++i) {
- supArch.add(sArray1[i]);
- }
- }
-
- String toolCmd = m.getValueAt(row, 3) + "";
- String tagName = m.getValueAt(row, 4) + "";
- String contents = m.getValueAt(row, 5) + "";
- docConsole.setSaved(false);
- ffc.updateBuildOptionsOpt(row, targetName, toolChain, tagName, toolCmd, supArch, contents);
- }
- }
- });
- }
- return jTableOptions;
- }
-
- private Vector<Object> stringToVector(String s) {
- String[] sArray = s.split(" ");
- Vector<Object> v = null;
- if (s.length() > 0 && !s.trim().equalsIgnoreCase("")) {
- v = new Vector<Object>();
- for (int i = 0; i < sArray.length; ++i) {
- v.add(sArray[i]);
- }
- }
- return v;
- }
-
- private String boolToList(boolean[] bool) {
- String s = " ";
- if (bool[0]) {
- s += "IA32 ";
- }
- if (bool[1]) {
- s += "IPF ";
- }
- if (bool[2]) {
- s += "X64 ";
- }
- if (bool[3]) {
- s += "EBC ";
- }
- if (bool[4]) {
- s += "ARM ";
- }
- if (bool[5]) {
- s += "PPC ";
- }
-
- return s.trim();
- }
-
- private void initOptionTable() {
- if (ffc.getBuildOptionsOptCount() == 0) {
- //ToDo get default options from *.txt file
- return;
- }
- String[][] saa = new String[ffc.getBuildOptionsOptCount()][6];
- ffc.getBuildOptionsOpts(saa);
- for (int i = 0; i < saa.length; ++i) {
- optionsTableModel.addRow(saa[i]);
- }
- }
-
-
- /**
- * Everything below should pertain to the ANT Task Tab
- */
-
- /**
- * This method initializes jButton12
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAntTaskFileBrowse() {
- if (jButtonAntTaskFileBrowse == null) {
- jButtonAntTaskFileBrowse = new JButton();
- jButtonAntTaskFileBrowse.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
- jButtonAntTaskFileBrowse.setText("Browse");
- jButtonAntTaskFileBrowse.addActionListener(new AbstractAction() {
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent arg0) {
- //
- // Select files from current workspace
- //
- String dirPrefix = Workspace.getCurrentWorkspace();
- JFileChooser chooser = new JFileChooser(dirPrefix);
- File theFile = null;
- String headerDest = null;
-
- chooser.setMultiSelectionEnabled(false);
- chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
- int retval = chooser.showOpenDialog(FpdBuildOptions.this);
- if (retval == JFileChooser.APPROVE_OPTION) {
-
- theFile = chooser.getSelectedFile();
- String file = theFile.getPath();
- if (!file.startsWith(dirPrefix)) {
- JOptionPane.showMessageDialog(FpdBuildOptions.this, "You can only select files in current package!");
- return;
- }
- } else {
- return;
- }
-
- headerDest = theFile.getPath();
- jTextFieldAntTaskFile.setText(headerDest.substring(dirPrefix.length()).replace('\\', '/'));
-
- }
-
- });
- }
- return jButtonAntTaskFileBrowse;
- }
-
- /**
- * This method initializes jPanelUserDefCenterN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelUserDefCenterN() {
- if (jPanelUserDefCenterN == null) {
- jPanelUserDefCenterN = new JPanel();
- jPanelUserDefCenterN.add(jLabelAntCmdOpts, null);
- jPanelUserDefCenterN.add(getJTextFieldAntCmdOpts(), null);
- jPanelUserDefCenterN.add(getJButtonAntTaskAdd(), null);
- jPanelUserDefCenterN.add(getJButtonAntTaskDel(), null);
- }
- return jPanelUserDefCenterN;
- }
-
- /**
- * This method initializes jPanel8
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelUserDef() {
- if (jPanelUserDef == null) {
- jPanelUserDef = new JPanel();
- jPanelUserDef.setLayout(new BorderLayout());
- jPanelUserDef.add(getJPanelUserDefNorth(), java.awt.BorderLayout.NORTH);
- jPanelUserDef.add(getJPanelUserDefCenter(), java.awt.BorderLayout.CENTER);
-
- }
- return jPanelUserDef;
- }
-
- /**
- * This method initializes jPanel9
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelUserDefNorth() {
- if (jPanelUserDefNorth == null) {
- jLabelAntTaskFile = new JLabel();
- jLabelAntTaskFile.setText("ANT Task File");
- jLabelAntTaskFile.setPreferredSize(new java.awt.Dimension(80, 20));
- FlowLayout flowLayout8 = new FlowLayout();
- flowLayout8.setAlignment(java.awt.FlowLayout.CENTER);
- jLabelAntTaskId = new JLabel();
- jLabelAntTaskId.setText("ID");
- jPanelUserDefNorth = new JPanel();
- jPanelUserDefNorth.setLayout(flowLayout8);
- jPanelUserDefNorth.add(jLabelAntTaskFile, null);
- jPanelUserDefNorth.add(getJTextFieldAntTaskFile(), null);
- jPanelUserDefNorth.add(getJButtonAntTaskFileBrowse(), null);
- jPanelUserDefNorth.add(jLabelAntTaskId, null);
- jPanelUserDefNorth.add(getJTextFieldAntTaskId(), null);
- }
- return jPanelUserDefNorth;
- }
-
- /**
- * This method initializes jPanel11
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelUserDefCenter() {
- if (jPanelUserDefCenter == null) {
- jLabelAntCmdOpts = new JLabel();
- jLabelAntCmdOpts.setText("ANT Command Options");
- jLabelAntCmdOpts.setPreferredSize(new java.awt.Dimension(131, 20));
- jPanelUserDefCenter = new JPanel();
- jPanelUserDefCenter.setLayout(new BorderLayout());
-
- jPanelUserDefCenter.add(getJPanelUserDefCenterN(), java.awt.BorderLayout.NORTH);
- jPanelUserDefCenter.add(getJScrollPaneAntTasks(), java.awt.BorderLayout.CENTER);
- }
- return jPanelUserDefCenter;
- }
-
- /**
- * This method initializes jTextField2
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldAntTaskFile() {
- if (jTextFieldAntTaskFile == null) {
- jTextFieldAntTaskFile = new JTextField();
- jTextFieldAntTaskFile.setPreferredSize(new java.awt.Dimension(200, 20));
- }
- return jTextFieldAntTaskFile;
- }
-
- /**
- * This method initializes jTextField3
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldAntTaskId() {
- if (jTextFieldAntTaskId == null) {
- jTextFieldAntTaskId = new JTextField();
- jTextFieldAntTaskId.setPreferredSize(new java.awt.Dimension(100, 20));
- }
- return jTextFieldAntTaskId;
- }
-
- /**
- * This method initializes jButton4
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAntTaskAdd() {
- if (jButtonAntTaskAdd == null) {
- jButtonAntTaskAdd = new JButton();
- jButtonAntTaskAdd.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonAntTaskAdd.setText("Add");
- jButtonAntTaskAdd.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if (!DataValidation.isInt(jTextFieldAntTaskId.getText())
- || jTextFieldAntTaskId.getText().length() != 8) {
- JOptionPane.showMessageDialog(FpdBuildOptions.this, "ID must be an 8-digit integer.");
- return;
- }
- Object[] o = { jTextFieldAntTaskId.getText(), null, null };
- o[1] = jTextFieldAntTaskFile.getText();
- o[2] = jTextFieldAntCmdOpts.getText();
- ffc.genBuildOptionsUserDefAntTask(o[0] + "", o[1] + "", o[2] + "");
- antTaskTableModel.addRow(o);
- docConsole.setSaved(false);
- }
- });
- }
- return jButtonAntTaskAdd;
- }
-
- /**
- * This method initializes jButton5
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAntTaskDel() {
- if (jButtonAntTaskDel == null) {
- jButtonAntTaskDel = new JButton();
- jButtonAntTaskDel.setPreferredSize(new java.awt.Dimension(90, 20));
- jButtonAntTaskDel.setText("Delete");
- jButtonAntTaskDel.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if (selectedRow >= 0) {
- docConsole.setSaved(false);
- antTaskTableModel.removeRow(selectedRow);
- ffc.removeBuildOptionsUserDefAntTask(selectedRow);
- }
- }
- });
- }
- return jButtonAntTaskDel;
- }
-
- /**
- * This method initializes jTextField4
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldAntCmdOpts() {
- if (jTextFieldAntCmdOpts == null) {
- jTextFieldAntCmdOpts = new JTextField();
- jTextFieldAntCmdOpts.setPreferredSize(new java.awt.Dimension(270, 20));
- jTextFieldAntCmdOpts.setEnabled(true);
- }
- return jTextFieldAntCmdOpts;
- }
-
- /**
- * This method initializes jScrollPane2
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneAntTasks() {
- if (jScrollPaneAntTasks == null) {
- jScrollPaneAntTasks = new JScrollPane();
- jScrollPaneAntTasks.setPreferredSize(new java.awt.Dimension(600, 400));
- jScrollPaneAntTasks.setViewportView(getJTableAntTasks());
- }
- return jScrollPaneAntTasks;
- }
-
- /**
- * This method initializes jTable2
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableAntTasks() {
- if (jTableAntTasks == null) {
- antTaskTableModel = new DefaultTableModel();
- jTableAntTasks = new JTable(antTaskTableModel);
- jTableAntTasks.setRowHeight(20);
- antTaskTableModel.addColumn("ID");
- antTaskTableModel.addColumn("Filename");
- antTaskTableModel.addColumn("ANT Command Options");
-
- jTableAntTasks.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableAntTasks.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- selectedRow = -1;
- if (e.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- }
- }
- });
-
- jTableAntTasks.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String id = m.getValueAt(row, 0) + "";
- String file = m.getValueAt(row, 1) + "";
- String execOrder = m.getValueAt(row, 2) + "";
- if (id.length() == 0) {
- return;
- }
- if (file.length() == 0 && execOrder.length() == 0) {
- return;
- }
- if (file.length() == 0) {
- file = null;
- }
- if (execOrder.length() == 0) {
- execOrder = null;
- }
- ffc.updateBuildOptionsUserDefAntTask(row, id, file, execOrder);
-
- }
- }
- });
- }
- return jTableAntTasks;
- }
-
- private void initAntTaskTable() {
- if (ffc.getBuildOptionsUserDefAntTaskCount() == 0) {
- return;
- }
- String[][] saa = new String[ffc.getBuildOptionsUserDefAntTaskCount()][3];
- ffc.getBuildOptionsUserDefAntTasks(saa);
- for (int i = 0; i < saa.length; ++i) {
- antTaskTableModel.addRow(saa[i]);
- }
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java deleted file mode 100644 index c7a455ed91..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java +++ /dev/null @@ -1,774 +0,0 @@ -package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.FontMetrics;
-
-import javax.swing.ButtonGroup;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableColumn;
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import javax.swing.JCheckBox;
-import javax.swing.JRadioButton;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JTextField;
-import java.awt.GridLayout;
-import java.util.ArrayList;
-
-public class FpdDynamicPcdBuildDefinitions extends IInternalFrame {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private JPanel jContentPane = null;
- private JScrollPane jScrollPaneDynPcd = null;
- private JTable jTableDynPcd = null;
- private DynPcdTableModel modelPcd = null;
- private DynPcdTableModel modelSku = null;
- private FpdFileContents ffc = null;
- private OpeningPlatformType docConsole = null;
- private JPanel jPanelSkuInfo = null;
- private JCheckBox jCheckBoxSkuEnable = null;
- private JPanel jPanelDynPcdValue = null;
- private JRadioButton jRadioButtonHii = null;
- private JRadioButton jRadioButtonVpd = null;
- private JScrollPane jScrollPaneSkuInfo = null;
- private JTable jTableSkuInfo = null;
- private JButton jButtonSkuInfoUpdate = null;
- private JLabel jLabelVarName = null;
- private JTextField jTextFieldVarName = null;
- private JLabel jLabelVarGuid = null;
- private JTextField jTextFieldVarGuid = null;
- private JLabel jLabelPad = null;
- private JLabel jLabelVarOffset = null;
- private JTextField jTextFieldVarOffset = null;
- private JLabel jLabelHiiDefaultValue = null;
- private JTextField jTextFieldHiiDefaultValue = null;
- private JTextField jTextFieldVpdOffset = null;
- private JLabel jLabelVpdOffset = null;
- private JTextField jTextFieldDefaultValue = null;
- private JRadioButton jRadioButtonDefaultValue = null;
- private ButtonGroup bg = new ButtonGroup();
- private JLabel jLabelPadd = null;
- private JLabel jLabelPad1 = null;
- private JScrollPane jScrollPane = null;
- /**
- * This is the default constructor
- */
- public FpdDynamicPcdBuildDefinitions() {
- super();
- initialize();
- }
-
- public FpdDynamicPcdBuildDefinitions(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd){
- this();
- init(fpd);
- }
-
- public FpdDynamicPcdBuildDefinitions(OpeningPlatformType opt) {
- this(opt.getXmlFpd());
- docConsole = opt;
- }
-
- public void init(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
- if (ffc == null) {
- ffc = new FpdFileContents(fpd);
- ffc.initDynPcdMap();
- }
- String[][] saa = new String[ffc.getDynamicPcdBuildDataCount()][5];
- ffc.getDynamicPcdBuildData(saa);
- for (int i = 0; i < saa.length; ++i) {
- modelPcd.addRow(saa[i]);
- }
-
- saa = new String[ffc.getPlatformDefsSkuInfoCount()][2];
- ffc.getPlatformDefsSkuInfos(saa);
- for (int i = 0; i < saa.length; ++i) {
- modelSku.addRow(saa[i]);
- }
-
- }
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(661, 558);
- this.setTitle("Dynamic PCD Build Definitions");
- this.setContentPane(getJContentPane());
- this.setVisible(true);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJScrollPaneDynPcd(), java.awt.BorderLayout.NORTH);
- jContentPane.add(getJPanelSkuInfo(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneDynPcd() {
- if (jScrollPaneDynPcd == null) {
- jScrollPaneDynPcd = new JScrollPane();
- jScrollPaneDynPcd.setPreferredSize(new java.awt.Dimension(100,250));
- jScrollPaneDynPcd.setViewportView(getJTableDynPcd());
- }
- return jScrollPaneDynPcd;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableDynPcd() {
- if (jTableDynPcd == null) {
- modelPcd = new DynPcdTableModel();
- modelPcd.addColumn("CName");
- modelPcd.addColumn("Token");
- modelPcd.addColumn("TokenSpaceGuid");
- modelPcd.addColumn("MaxDatumSize");
- modelPcd.addColumn("DatumType");
- jTableDynPcd = new JTable(modelPcd);
- jTableDynPcd.setRowHeight(20);
- TableColumn tokenColumn = jTableDynPcd.getColumnModel().getColumn(1);
- jTableDynPcd.removeColumn(tokenColumn);
- jTableDynPcd.getColumnModel().getColumn(0).setMinWidth(250);
-
- jTableDynPcd.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableDynPcd.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- int selectedRow = lsm.getMinSelectionIndex();
- jTextFieldDefaultValue.setText("");
- jTextFieldVpdOffset.setText("");
- jTextFieldVarName.setText("");
- jTextFieldVarGuid.setText("");
- jTextFieldVarOffset.setText("");
- jTextFieldHiiDefaultValue.setText("");
- displayDetails(selectedRow);
- }
- }
- });
- }
- return jTableDynPcd;
- }
- //
- // should display default sku info here, as no selection event of table1 will be triggered when change selection of rows in table.
- //
- private void displayDetails(int i) {
- int defaultSkuRow = getDefaultSkuInfoRow();
- jTableSkuInfo.changeSelection(defaultSkuRow, 0, false, false);
-
- int skuCount = ffc.getDynamicPcdSkuInfoCount(i);
- String defaultVal = ffc.getDynamicPcdBuildDataValue(i);
- if (defaultVal != null) {
- jRadioButtonDefaultValue.setSelected(true);
- jTextFieldDefaultValue.setText(defaultVal);
- if ( skuCount == 1) {
- jCheckBoxSkuEnable.setSelected(false);
- }
- else{
- jCheckBoxSkuEnable.setSelected(true);
- }
- }
-
- else if (ffc.getDynamicPcdBuildDataVpdOffset(i) != null) {
- jRadioButtonVpd.setSelected(true);
- jTextFieldVpdOffset.setText(ffc.getDynamicPcdBuildDataVpdOffset(i));
- if (skuCount ==1) {
- jCheckBoxSkuEnable.setSelected(false);
-
- }
- else{
- jCheckBoxSkuEnable.setSelected(true);
- }
- }
- else {
- jRadioButtonHii.setSelected(true);
- String[][] saa = new String[ffc.getDynamicPcdSkuInfoCount(i)][7];
- ffc.getDynamicPcdSkuInfos(i, saa);
-
- String varDisplayName = Tools.convertUnicodeHexStringToString(saa[0][1]);
- jTextFieldVarName.setText(varDisplayName);
-
- jTextFieldVarGuid.setText(saa[0][2]);
- jTextFieldVarOffset.setText(saa[0][3]);
- jTextFieldHiiDefaultValue.setText(saa[0][4]);
- if (skuCount ==1) {
- jCheckBoxSkuEnable.setSelected(false);
- }
- else{
- jCheckBoxSkuEnable.setSelected(true);
- }
- }
-
- }
-
- private void displaySkuInfoDetails(String id) {
- int pcdSelected = jTableDynPcd.getSelectedRow();
- if (pcdSelected < 0) {
- return;
- }
-
- int skuInfoCount = ffc.getDynamicPcdSkuInfoCount(pcdSelected);
- String[][] saa = new String[skuInfoCount][7];
- ffc.getDynamicPcdSkuInfos(pcdSelected, saa);
- int i = 0;
- while (i < skuInfoCount) {
- if (id.equals(saa[i][0])) {
- if (saa[i][5] != null){
- jRadioButtonVpd.setSelected(true);
- jTextFieldVpdOffset.setText(saa[i][5]);
- }
-
- else if (saa[i][1] != null) {
- jRadioButtonHii.setSelected(true);
- String varDisplayName = Tools.convertUnicodeHexStringToString(saa[i][1]);
- jTextFieldVarName.setText(varDisplayName);
- jTextFieldVarGuid.setText(saa[i][2]);
- jTextFieldVarOffset.setText(saa[i][3]);
- jTextFieldHiiDefaultValue.setText(saa[i][4]);
- }
-
- else{
- jRadioButtonDefaultValue.setSelected(true);
- jTextFieldDefaultValue.setText(saa[i][6]);
- }
- return;
- }
- ++i;
- }
- }
-
- private int getDefaultSkuInfoRow () {
- for (int i = 0; i < modelSku.getRowCount(); ++i) {
- if (modelSku.getValueAt(i, 0).equals("0")) {
- return i;
- }
- }
- return 0;
- }
-
- /**
- * This method initializes jPanel3
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelSkuInfo() {
- if (jPanelSkuInfo == null) {
- jPanelSkuInfo = new JPanel();
- jPanelSkuInfo.setLayout(new BorderLayout());
- jPanelSkuInfo.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
- jPanelSkuInfo.setPreferredSize(new java.awt.Dimension(600,120));
-
-// jPanelSkuInfo.add(getJPanelSkuInfoN(), java.awt.BorderLayout.NORTH);
- jPanelSkuInfo.add(getJScrollPane(), java.awt.BorderLayout.NORTH);
- jPanelSkuInfo.add(getJScrollPaneSkuInfo(), java.awt.BorderLayout.CENTER);
-
-
-// jPanelSkuInfo.add(getJPanelDynPcdValue(), java.awt.BorderLayout.SOUTH);
- }
- return jPanelSkuInfo;
- }
-
- /**
- * This method initializes jCheckBox
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxSkuEnable() {
- if (jCheckBoxSkuEnable == null) {
- jCheckBoxSkuEnable = new JCheckBox();
- jCheckBoxSkuEnable.setText("SKU Enable");
- jCheckBoxSkuEnable.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (!jCheckBoxSkuEnable.isSelected()) {
- int defaultSkuRow = getDefaultSkuInfoRow();
- jTableSkuInfo.changeSelection(defaultSkuRow, 0, false, false);
- }
- jTableSkuInfo.setEnabled(jCheckBoxSkuEnable.isSelected());
- }
- });
- }
- return jCheckBoxSkuEnable;
- }
-
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelDynPcdValue() {
- if (jPanelDynPcdValue == null) {
- jLabelPad1 = new JLabel();
- jLabelPad1.setText(" ");
- GridLayout gridLayout = new GridLayout();
- gridLayout.setColumns(5);
- gridLayout.setRows(4);
- gridLayout.setHgap(20);
- gridLayout.setVgap(20);
-
- jLabelVpdOffset = new JLabel();
- jLabelVpdOffset.setPreferredSize(new java.awt.Dimension(80,20));
- jLabelVpdOffset.setText("VPD Offset");
- jLabelHiiDefaultValue = new JLabel();
- jLabelHiiDefaultValue.setPreferredSize(new java.awt.Dimension(100,20));
- jLabelHiiDefaultValue.setText("HII Default Value");
- jLabelVarOffset = new JLabel();
- jLabelVarOffset.setText("Variable Offset");
- jLabelVarOffset.setPreferredSize(new java.awt.Dimension(90,20));
- jLabelPad = new JLabel();
- jLabelPad.setText(" ");
- jLabelVarGuid = new JLabel();
- jLabelVarGuid.setText("Variable GUID");
- jLabelVarGuid.setPreferredSize(new java.awt.Dimension(100,20));
- jLabelVarName = new JLabel();
- jLabelVarName.setText("Variable Name");
- jLabelVarName.setToolTipText("");
- jLabelVarName.setPreferredSize(new java.awt.Dimension(90,20));
- jPanelDynPcdValue = new JPanel();
- jPanelDynPcdValue.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED));
- jPanelDynPcdValue.setPreferredSize(new java.awt.Dimension(1000,150));
- jPanelDynPcdValue.setLayout(gridLayout);
- jPanelDynPcdValue.add(getJRadioButtonHii(), null);
- jPanelDynPcdValue.add(jLabelVarName, null);
- jPanelDynPcdValue.add(getJTextFieldVarName(), null);
- jPanelDynPcdValue.add(jLabelVarGuid, null);
- jPanelDynPcdValue.add(getJTextFieldVarGuid(), null);
- jPanelDynPcdValue.add(jLabelPad, null);
- jPanelDynPcdValue.add(jLabelVarOffset, null);
- jPanelDynPcdValue.add(getJTextFieldVarOffset(), null);
- jPanelDynPcdValue.add(jLabelHiiDefaultValue, null);
- jPanelDynPcdValue.add(getJTextFieldHiiDefaultValue(), null);
- jPanelDynPcdValue.add(getJRadioButtonVpd(), null);
- jPanelDynPcdValue.add(jLabelVpdOffset, null);
- jLabelPadd = new JLabel();
- jLabelPadd.setText(" ");
- jPanelDynPcdValue.add(getJTextFieldVpdOffset(), null);
- jLabelVarName.setEnabled(false);
- jLabelVarGuid.setEnabled(false);
- jLabelHiiDefaultValue.setEnabled(false);
- jLabelVarOffset.setEnabled(false);
- jLabelVpdOffset.setEnabled(false);
- jPanelDynPcdValue.add(jLabelPadd, null);
- jPanelDynPcdValue.add(jLabelPad1, null);
- jPanelDynPcdValue.add(getJRadioButtonDefaultValue(), null);
- jPanelDynPcdValue.add(getJTextFieldDefaultValue(), null);
- jPanelDynPcdValue.add(getJCheckBoxSkuEnable(), null);
- jPanelDynPcdValue.add(getJButtonSkuInfoUpdate(), null);
- bg.add(jRadioButtonHii);
- bg.add(jRadioButtonVpd);
- }
-
- return jPanelDynPcdValue;
- }
-
- /**
- * This method initializes jRadioButton
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonHii() {
- if (jRadioButtonHii == null) {
- jRadioButtonHii = new JRadioButton();
- jRadioButtonHii.setText("HII Enable");
- jRadioButtonHii.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- boolean selected = jRadioButtonHii.isSelected();
- jLabelVarName.setEnabled(selected);
- jLabelVarGuid.setEnabled(selected);
- jLabelPad.setEnabled(selected);
- jLabelVarOffset.setEnabled(selected);
- jLabelHiiDefaultValue.setEnabled(selected);
- jTextFieldVarName.setEnabled(selected);
- jTextFieldVarGuid.setEnabled(selected);
- jTextFieldVarOffset.setEnabled(selected);
- jTextFieldHiiDefaultValue.setEnabled(selected);
- }
- });
- }
- return jRadioButtonHii;
- }
-
- /**
- * This method initializes jRadioButton1
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonVpd() {
- if (jRadioButtonVpd == null) {
- jRadioButtonVpd = new JRadioButton();
- jRadioButtonVpd.setText("VPD Enable");
- jRadioButtonVpd.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- boolean selected = jRadioButtonVpd.isSelected();
- jTextFieldVpdOffset.setEnabled(selected);
- jLabelVpdOffset.setEnabled(selected);
- }
- });
- }
- return jRadioButtonVpd;
- }
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneSkuInfo() {
- if (jScrollPaneSkuInfo == null) {
- jScrollPaneSkuInfo = new JScrollPane();
- jScrollPaneSkuInfo.setPreferredSize(new java.awt.Dimension(300,50));
- jScrollPaneSkuInfo.setViewportView(getJTableSkuInfo());
- }
- return jScrollPaneSkuInfo;
- }
-
- /**
- * This method initializes jTable1
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableSkuInfo() {
- if (jTableSkuInfo == null) {
- modelSku = new DynPcdTableModel();
- jTableSkuInfo = new JTable(modelSku);
- modelSku.addColumn("SKU ID");
- modelSku.addColumn("SKU Name");
- jTableSkuInfo.setEnabled(false);
- jTableSkuInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableSkuInfo.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (jTableDynPcd.getSelectedRow() < 0) {
- return;
- }
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- jTextFieldDefaultValue.setText("");
- jTextFieldVpdOffset.setText("");
- jTextFieldVarName.setText("");
- jTextFieldVarGuid.setText("");
- jTextFieldVarOffset.setText("");
- jTextFieldHiiDefaultValue.setText("");
- int selected = lsm.getMinSelectionIndex();
- String skuId = modelSku.getValueAt(selected, 0)+"";
- displaySkuInfoDetails(skuId);
- }
- }
- });
- }
- return jTableSkuInfo;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonSkuInfoUpdate() {
- if (jButtonSkuInfoUpdate == null) {
- jButtonSkuInfoUpdate = new JButton();
- jButtonSkuInfoUpdate.setPreferredSize(new java.awt.Dimension(180,20));
- jButtonSkuInfoUpdate.setText("Update SKU Value");
- FontMetrics fm = jButtonSkuInfoUpdate.getFontMetrics(jButtonSkuInfoUpdate.getFont());
- jButtonSkuInfoUpdate.setPreferredSize(new Dimension (fm.stringWidth(jButtonSkuInfoUpdate.getText()) + 40, 20));
- jButtonSkuInfoUpdate.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int pcdSelected = jTableDynPcd.getSelectedRow();
- if (pcdSelected < 0) {
- return;
- }
- docConsole.setSaved(false);
- updateSkuInfo(pcdSelected);
-
- }
- });
- }
- return jButtonSkuInfoUpdate;
- }
-
- private void updateSkuInfo (int pcdSelected) {
- int skuCount = ffc.getDynamicPcdSkuInfoCount(pcdSelected);
- String cName = modelPcd.getValueAt(pcdSelected, 0)+"";
- String tsGuid = modelPcd.getValueAt(pcdSelected, 2)+"";
-
- String varName = null;
- String varGuid = null;
- String varOffset = null;
- String hiiDefault = null;
- String value = null;
- String vpdOffset = null;
- if (jRadioButtonHii.isSelected()) {
- varName = Tools.convertStringToUnicodeHexString(jTextFieldVarName.getText());
- if (varName.length() == 0) {
- JOptionPane.showMessageDialog(this, "Variable Name is Empty.");
- return;
- }
- varGuid = jTextFieldVarGuid.getText();
- if (varGuid.length() == 0) {
- JOptionPane.showMessageDialog(this, "Variable GUID is Empty.");
- return;
- }
- varOffset = jTextFieldVarOffset.getText();
- if (!DataValidation.isHex64BitDataType(varOffset)) {
- JOptionPane.showMessageDialog(this, "Variable Offset is NOT Hex64BitDataType.");
- return;
- }
- hiiDefault = jTextFieldHiiDefaultValue.getText();
- if (!DataValidation.isDefaultValueType(hiiDefault)) {
- JOptionPane.showMessageDialog(this, "Default Value is NOT DefaultValueType.");
- return;
- }
- }
- if (jRadioButtonVpd.isSelected()) {
- vpdOffset = jTextFieldVpdOffset.getText();
- if (!DataValidation.isHex64BitDataType(vpdOffset)) {
- JOptionPane.showMessageDialog(this, "VPD Offset is NOT Hex64BitDataType.");
- return;
- }
- }
- if (jRadioButtonDefaultValue.isSelected()) {
- value = jTextFieldDefaultValue.getText();
- if (!DataValidation.isDefaultValueType(value)) {
- JOptionPane.showMessageDialog(this, "Value is NOT DefaultValueType.");
- return;
- }
- }
- //
- // SKU disabled. only modify data for default SKU.
- //
- if (!jCheckBoxSkuEnable.isSelected()) {
- if (true) {
- ffc.removeDynamicPcdBuildDataSkuInfo(pcdSelected);
- if (jRadioButtonHii.isSelected()) {
- ffc.genDynamicPcdBuildDataSkuInfo("0", varName, varGuid, varOffset, hiiDefault, null, null, pcdSelected);
- ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- if (al == null) {
- return;
- }
- for (int i = 0; i < al.size(); ++i) {
- String mKey = moduleInfo (al.get(i));
- ffc.updatePcdData(mKey, cName, tsGuid, null, null, hiiDefault);
- }
- }
- else if (jRadioButtonVpd.isSelected()){
- ffc.genDynamicPcdBuildDataSkuInfo("0", null, null, null, null, vpdOffset, null, pcdSelected);
- ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- if (al == null) {
- return;
- }
- for (int i = 0; i < al.size(); ++i) {
- String mKey = moduleInfo (al.get(i));
- ffc.updatePcdData(mKey, cName, tsGuid, null, null, vpdOffset);
- }
- }
- else{
- ffc.genDynamicPcdBuildDataSkuInfo("0", null, null, null, null, null, value, pcdSelected);
- ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- if (al == null) {
- return;
- }
- for (int i = 0; i < al.size(); ++i) {
- String mKey = moduleInfo (al.get(i));
- ffc.updatePcdData(mKey, cName, tsGuid, null, null, value);
- }
- }
- }
- }
- //
- // SKU Enabled, need add data to all SKUs.
- //
- if (jCheckBoxSkuEnable.isSelected()) {
- if (skuCount == 1) {
-
- for (int i = 1; i < jTableSkuInfo.getRowCount(); ++i) {
- ffc.genDynamicPcdBuildDataSkuInfo(modelSku.getValueAt(i, 0)+"", varName, varGuid, varOffset, hiiDefault, vpdOffset, value, pcdSelected);
- }
- }
- else {
- int row = jTableSkuInfo.getSelectedRow();
- if (row < 0) {
- return;
- }
- ffc.updateDynamicPcdBuildDataSkuInfo(modelSku.getValueAt(row, 0)+"", varName, varGuid, varOffset, hiiDefault, vpdOffset, value, pcdSelected);
- }
- }
- }
-
- private String moduleInfo (String pcdInfo) {
-
- return pcdInfo.substring(0, pcdInfo.lastIndexOf(" "));
- }
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldVarName() {
- if (jTextFieldVarName == null) {
- jTextFieldVarName = new JTextField();
- jTextFieldVarName.setPreferredSize(new java.awt.Dimension(150,20));
- jTextFieldVarName.setEnabled(false);
- }
- return jTextFieldVarName;
- }
-
- /**
- * This method initializes jTextField1
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldVarGuid() {
- if (jTextFieldVarGuid == null) {
- jTextFieldVarGuid = new JTextField();
- jTextFieldVarGuid.setPreferredSize(new java.awt.Dimension(150,20));
- jTextFieldVarGuid.setEnabled(false);
- }
- return jTextFieldVarGuid;
- }
-
- /**
- * This method initializes jTextField2
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldVarOffset() {
- if (jTextFieldVarOffset == null) {
- jTextFieldVarOffset = new JTextField();
- jTextFieldVarOffset.setPreferredSize(new java.awt.Dimension(150,20));
- jTextFieldVarOffset.setEnabled(false);
- }
- return jTextFieldVarOffset;
- }
-
- /**
- * This method initializes jTextField3
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldHiiDefaultValue() {
- if (jTextFieldHiiDefaultValue == null) {
- jTextFieldHiiDefaultValue = new JTextField();
- jTextFieldHiiDefaultValue.setPreferredSize(new java.awt.Dimension(150,20));
- jTextFieldHiiDefaultValue.setEnabled(false);
- }
- return jTextFieldHiiDefaultValue;
- }
-
- /**
- * This method initializes jTextField4
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldVpdOffset() {
- if (jTextFieldVpdOffset == null) {
- jTextFieldVpdOffset = new JTextField();
- jTextFieldVpdOffset.setPreferredSize(new java.awt.Dimension(150,20));
- jTextFieldVpdOffset.setEnabled(false);
- }
- return jTextFieldVpdOffset;
- }
-
- /**
- * This method initializes jTextField5
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldDefaultValue() {
- if (jTextFieldDefaultValue == null) {
- jTextFieldDefaultValue = new JTextField();
- jTextFieldDefaultValue.setPreferredSize(new java.awt.Dimension(150,20));
- }
- return jTextFieldDefaultValue;
- }
-
- /**
- * This method initializes jRadioButton2
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButtonDefaultValue() {
- if (jRadioButtonDefaultValue == null) {
- jRadioButtonDefaultValue = new JRadioButton();
- jRadioButtonDefaultValue.setText("Default PCD Value");
- jRadioButtonDefaultValue.setSelected(true);
- jRadioButtonDefaultValue.setPreferredSize(new java.awt.Dimension(175,20));
- jRadioButtonDefaultValue.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- jTextFieldDefaultValue.setEnabled(jRadioButtonDefaultValue.isSelected());
- }
- });
- bg.add(jRadioButtonDefaultValue);
- }
- return jRadioButtonDefaultValue;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setPreferredSize(new java.awt.Dimension(1003,180));
- jScrollPane.setViewportView(getJPanelDynPcdValue());
- }
- return jScrollPane;
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
-
-class DynPcdTableModel extends DefaultTableModel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int col) {
-
- return false;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java deleted file mode 100644 index c5f854a7e8..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java +++ /dev/null @@ -1,3818 +0,0 @@ -/** @file
- Java class FpdFileContents is used to parse fpd xml file.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.io.File;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
-import org.tianocore.AntTaskDocument;
-import org.tianocore.BuildOptionsDocument;
-import org.tianocore.DynamicPcdBuildDefinitionsDocument;
-import org.tianocore.EfiSectionType;
-import org.tianocore.FlashDefinitionFileDocument;
-import org.tianocore.FlashDocument;
-import org.tianocore.FrameworkModulesDocument;
-import org.tianocore.IntermediateOutputType;
-import org.tianocore.LibrariesDocument;
-import org.tianocore.ModuleSADocument;
-import org.tianocore.ModuleSaBuildOptionsDocument;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.OptionDocument;
-import org.tianocore.OptionsDocument;
-import org.tianocore.PcdBuildDefinitionDocument;
-import org.tianocore.PcdCodedDocument;
-import org.tianocore.PcdDataTypes;
-import org.tianocore.PcdDeclarationsDocument;
-import org.tianocore.PcdItemTypes;
-import org.tianocore.PlatformDefinitionsDocument;
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.FvImageTypes;
-import org.tianocore.FvImagesDocument;
-import org.tianocore.LicenseDocument;
-import org.tianocore.PlatformHeaderDocument;
-import org.tianocore.SkuInfoDocument;
-import org.tianocore.UserDefinedAntTasksDocument;
-import org.tianocore.UserExtensionsDocument;
-import org.tianocore.LibrariesDocument.Libraries.Instance;
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
-import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-/**
- This class processes fpd file contents such as add remove xml elements.
- @since PackageEditor 1.0
-**/
-public class FpdFileContents {
-
- static final String xmlNs = "http://www.TianoCore.org/2006/Edk2.0";
- static final String regExpNewLineAndSpaces = "((\n)|(\r\n)|(\r)|(\u0085)|(\u2028)|(\u2029))(\\s)*";
-
- private PlatformSurfaceAreaDocument fpdd = null;
-
- private PlatformSurfaceAreaDocument.PlatformSurfaceArea fpdRoot = null;
-
- private PlatformHeaderDocument.PlatformHeader fpdHdr = null;
-
- private PlatformDefinitionsDocument.PlatformDefinitions fpdPlatformDefs = null;
-
- private FlashDocument.Flash fpdFlash = null;
-
- private BuildOptionsDocument.BuildOptions fpdBuildOpts = null;
-
- private FrameworkModulesDocument.FrameworkModules fpdFrameworkModules = null;
-
- private DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions fpdDynPcdBuildDefs = null;
-
- private HashMap<String, ArrayList<String>> dynPcdMap = null;
-
- private HashMap<String, String> defaultPcdValue = new HashMap<String, String>();
-
- private String itemType (String pcdInfo) {
-
- return pcdInfo.substring(pcdInfo.lastIndexOf(" ") + 1);
- }
-
- /**
- * look through all pcd data in all ModuleSA, create pcd -> ModuleSA mappings.
- */
- public void initDynPcdMap() {
- if (dynPcdMap == null) {
- dynPcdMap = new HashMap<String, ArrayList<String>>();
- List<ModuleSADocument.ModuleSA> l = getfpdFrameworkModules().getModuleSAList();
- if (l == null) {
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return;
- }
- ListIterator<ModuleSADocument.ModuleSA> li = l.listIterator();
- while (li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = li.next();
- if (moduleSa.getPcdBuildDefinition() == null || moduleSa.getPcdBuildDefinition().getPcdDataList() == null) {
- continue;
- }
- String ModuleInfo = moduleSa.getModuleGuid().toLowerCase() + " " + moduleSa.getModuleVersion() +
- " " + moduleSa.getPackageGuid().toLowerCase() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList());
- List<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData> lp = moduleSa.getPcdBuildDefinition().getPcdDataList();
- ListIterator<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData> lpi = lp.listIterator();
- while (lpi.hasNext()) {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = lpi.next();
- String pcdKey = pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName();
- if (dynPcdMap.get(pcdKey) == null) {
- ArrayList<String> al = new ArrayList<String>();
- al.add(ModuleInfo + " " + pcdData.getItemType().toString());
- dynPcdMap.put(pcdKey, al);
- }
- else{
- dynPcdMap.get(pcdKey).add(ModuleInfo + " " + pcdData.getItemType().toString());
- }
- }
- }
- }
- }
-
- public ArrayList<String> getDynPcdMapValue(String key) {
- return dynPcdMap.get(key);
- }
- /**
- Constructor to create a new spd file
- **/
- public FpdFileContents() {
-
- fpdd = PlatformSurfaceAreaDocument.Factory.newInstance();
- fpdRoot = fpdd.addNewPlatformSurfaceArea();
-
- }
-
- /**
- Constructor for existing document object
- @param psa
- **/
- public FpdFileContents(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
- fpdRoot = fpd;
- fpdHdr = fpdRoot.getPlatformHeader();
- fpdPlatformDefs = fpdRoot.getPlatformDefinitions();
- fpdBuildOpts = fpdRoot.getBuildOptions();
- fpdFrameworkModules = fpdRoot.getFrameworkModules();
- fpdDynPcdBuildDefs = fpdRoot.getDynamicPcdBuildDefinitions();
- fpdFlash = fpdRoot.getFlash();
- }
-
- /**
- Constructor based on an existing spd file
-
- @param f Existing spd file
- **/
- public FpdFileContents(File f) {
- try {
- fpdd = PlatformSurfaceAreaDocument.Factory.parse(f);
- fpdRoot = fpdd.getPlatformSurfaceArea();
- } catch (Exception e) {
- System.out.println(e.toString());
- }
- }
-
- public DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions getfpdDynPcdBuildDefs() {
- if (fpdDynPcdBuildDefs == null){
- fpdDynPcdBuildDefs = fpdRoot.addNewDynamicPcdBuildDefinitions();
- }
- return fpdDynPcdBuildDefs;
- }
-
- public FrameworkModulesDocument.FrameworkModules getfpdFrameworkModules() {
- if (fpdFrameworkModules == null){
- fpdFrameworkModules = fpdRoot.addNewFrameworkModules();
- }
- return fpdFrameworkModules;
- }
-
- public void getFrameworkModuleSAByFvBinding (String fvName, Vector<String[]> vGuid) {
- if (getFrameworkModulesCount() == 0){
- return;
- }
-
- ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator();
- while(li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)li.next();
- if (moduleSa.getModuleSaBuildOptions() == null) {
- continue;
- }
- String fvBinding = moduleSa.getModuleSaBuildOptions().getFvBinding();
- if (fvBinding == null) {
- continue;
- }
-
- String[] fvNames = fvBinding.split(" ");
- for (int i = 0; i < fvNames.length; ++i) {
- //
- // BugBug : underscore "_" should not be replaced!!!
- // But Fv name FVMAIN from fdf file not consist with FV_MAIN in fpd file.
- //
- if (fvNames[i].equals(fvName) || fvNames[i].replaceAll("_", "").equals(fvName)) {
- String[] sa = new String[] {moduleSa.getModuleGuid(), moduleSa.getModuleVersion(),
- moduleSa.getPackageGuid(), moduleSa.getPackageVersion(),
- listToString(moduleSa.getSupArchList())};
- vGuid.add(sa);
- break;
- }
- }
- }
- }
-
- public int getFrameworkModulesCount() {
- if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return 0;
- }
- return getfpdFrameworkModules().getModuleSAList().size();
- }
-
- public void getFrameworkModulesInfo(String[][] saa) {
- if (getFrameworkModulesCount() == 0){
- return;
- }
-
- ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator();
- int i = 0;
- while(li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)li.next();
- saa[i][0] = moduleSa.getModuleGuid();
- saa[i][1] = moduleSa.getModuleVersion();
-
- saa[i][2] = moduleSa.getPackageGuid();
- saa[i][3] = moduleSa.getPackageVersion();
- saa[i][4] = listToString(moduleSa.getSupArchList());
- ++i;
- }
- }
-
- public void getFrameworkModuleInfo(int i, String[] sa) {
- ModuleSADocument.ModuleSA msa = getModuleSA(i);
- if (msa == null) {
- return;
- }
- sa[0] = msa.getModuleGuid();
- sa[1] = msa.getModuleVersion();
- sa[2] = msa.getPackageGuid();
- sa[3] = msa.getPackageVersion();
- sa[4] = listToString(msa.getSupArchList());
- }
-
- public ModuleSADocument.ModuleSA getModuleSA(String key) {
-
- if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0) {
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return null;
- }
- String[] s = key.split(" ");
- String archsInKey = "";
- if (s.length > 4) {
- for (int i = 4; i < s.length; ++i) {
- archsInKey += s[i];
- archsInKey += " ";
- }
- archsInKey = archsInKey.trim();
- }
-
- ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator();
- while(li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)li.next();
- if (moduleSa.getModuleGuid().equalsIgnoreCase(s[0]) && moduleSa.getPackageGuid().equalsIgnoreCase(s[2])) {
- if (moduleSa.getModuleVersion() != null) {
- if (!moduleSa.getModuleVersion().equals(s[1])) {
- continue;
- }
- }
- if (moduleSa.getPackageVersion() != null) {
- if (!moduleSa.getPackageVersion().equals(s[3])) {
- continue;
- }
- }
- //ToDo add arch check .
- if (moduleSa.getSupArchList() != null) {
- if (listToString(moduleSa.getSupArchList()).equals(archsInKey)) {
- return moduleSa;
- }
- }
- else {
- if (archsInKey.length() == 0) {
- return moduleSa;
- }
- }
- }
- }
- return null;
- }
-
- private ModuleSADocument.ModuleSA getModuleSA(int i) {
- ModuleSADocument.ModuleSA moduleSa = null;
- if (fpdRoot.getFrameworkModules() == null) {
- return null;
- }
- XmlCursor cursor = fpdRoot.getFrameworkModules().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- moduleSa = (ModuleSADocument.ModuleSA)cursor.getObject();
- }
- cursor.dispose();
- return moduleSa;
- }
-
- public void removeModuleSA(int i) {
- XmlObject o = fpdRoot.getFrameworkModules();
- if (o == null) {
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- //
- // remove pcd from dynPcdMap, if DynamicPcdBuildData exists, remove them too.
- //
- ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)cursor.getObject();
- String moduleInfo = moduleSa.getModuleGuid() + " " + moduleSa.getModuleVersion() + " " +
- moduleSa.getPackageGuid()+ " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList());
- PcdBuildDefinitionDocument.PcdBuildDefinition pcdBuildDef = moduleSa.getPcdBuildDefinition();
- if (pcdBuildDef != null && pcdBuildDef.getPcdDataList() != null) {
- ListIterator<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData> li = pcdBuildDef.getPcdDataList().listIterator();
- while(li.hasNext()) {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = li.next();
- maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(), moduleInfo);
- }
- }
-
- cursor.push();
- while (cursor.hasPrevToken()) {
- cursor.toPrevToken();
- if (!cursor.isText()) {
- break;
- }
- if (cursor.getObject() == null) {
- break;
- }
- String s = cursor.getTextValue();
- if (s.matches(regExpNewLineAndSpaces)) {
- continue;
- }
- }
-
- if (cursor.isComment()) {
- cursor.removeXml();
- }
-
- cursor.pop();
- cursor.removeXml();
- if (getFrameworkModulesCount() == 0) {
- cursor.dispose();
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return;
- }
- }
- cursor.dispose();
- }
-
- public boolean adjustPcd (String seqModuleSa, Vector<String> vExceptions) throws Exception {
- boolean dataModified = false;
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(seqModuleSa);
- int pcdCount = getPcdDataCount(seqModuleSa);
- String[][] saaModuleSaPcd = new String[pcdCount][7];
- getPcdData(seqModuleSa, saaModuleSaPcd);
- String mg = moduleSa.getModuleGuid().toLowerCase();
- String mv = moduleSa.getModuleVersion();
- String pg = moduleSa.getPackageGuid().toLowerCase();
- String pv = moduleSa.getPackageVersion();
- String arch = listToString(moduleSa.getSupArchList());
- //
- // delete pcd in ModuleSA but not in MSA files any longer.
- //
- String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch;
- int libCount = getLibraryInstancesCount(moduleKey);
- String[][] saaLib = new String[libCount][5];
- getLibraryInstances(moduleKey, saaLib);
- ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
- if (mi == null) {
- vExceptions.add("Module " + mg + " does NOT exist in workspace.");
- throw new Exception ("Module does NOT exist in workspace.");
- }
- Vector<ModuleIdentification> vMi = new Vector<ModuleIdentification>();
- //
- // create vector for module & library instance MIs.
- //
- vMi.add(mi);
- for (int j = 0; j < saaLib.length; ++j) {
- String libKey = saaLib[j][1] + " " + saaLib[j][2] + " " + saaLib[j][3] + " " + saaLib[j][4];
- ModuleIdentification libMi = WorkspaceProfile.getModuleId(libKey);
- if (libMi != null) {
- vMi.add(libMi);
- }
- }
-
- nextPcd:for (int i = 0; i < saaModuleSaPcd.length; ++i) {
-
- for (int j = 0; j < vMi.size(); ++j) {
- ModuleIdentification nextMi = vMi.get(j);
- if (nextMi == null) {
- continue;
- }
- if (WorkspaceProfile.pcdInMsa(saaModuleSaPcd[i][0], saaModuleSaPcd[i][1], arch, nextMi)) {
- continue nextPcd;
- }
- }
- removePcdData(seqModuleSa, saaModuleSaPcd[i][0], saaModuleSaPcd[i][1]);
- dataModified = true;
- }
- //
- // add new Pcd from MSA file to ModuleSA.
- //
- for (int i = 0; i < vMi.size(); ++i) {
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) WorkspaceProfile
- .getModuleXmlObject(vMi
- .get(i));
- if (msa.getPcdCoded() == null || msa.getPcdCoded().getPcdEntryList() == null) {
- continue;
- }
- ListIterator li = msa.getPcdCoded().getPcdEntryList().listIterator();
- msaPcdIter:while (li.hasNext()) {
- PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry) li.next();
- ArrayList<String> al = getDynPcdMapValue(msaPcd.getCName() + " " + msaPcd.getTokenSpaceGuidCName());
- if (al != null) {
- for (int j = 0; j < al.size(); ++j) {
- if (al.get(j).startsWith(moduleKey)) {
- continue msaPcdIter;
- }
- }
- }
- // Check sup arch conformance for the new PCD
- if (msaPcd.getSupArchList() != null) {
- String newPcdArch = msaPcd.getSupArchList().toString();
- if (!newPcdArch.toLowerCase().contains(arch.toLowerCase())) {
- continue;
- }
- }
-
- PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, vMi.get(i));
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs);
- if (spdPcd == null) {
- //
- // ToDo Error
- //
- String errorMessage = "No Declaration for PCD Entry " + msaPcd.getCName() + " in Module "
- + mi.getName();
- if (i != 0) {
- errorMessage += " Library Instance " + vMi.get(i).getName();
- }
- vExceptions.add(errorMessage);
- throw new PcdDeclNotFound(errorMessage);
- }
- //
- // AddItem to ModuleSA PcdBuildDefinitions
- //
- String defaultVal = msaPcd.getDefaultValue() == null ? spdPcd.getDefaultValue()
- : msaPcd.getDefaultValue();
-
- genPcdData(msaPcd.getCName(), spdPcd.getToken(), msaPcd.getTokenSpaceGuidCName(),
- msaPcd.getPcdItemType().toString(), spdPcd.getDatumType() + "", defaultVal, moduleSa, spdPcd);
- dataModified = true;
- }
-
- }
-
- return dataModified;
- }
-
- private synchronized void maintainDynPcdMap(String pcdKey, String moduleInfo) {
-
- ArrayList<String> al = dynPcdMap.get(pcdKey);
- if (al == null) {
- return;
- }
- String[] s = moduleInfo.split(" ");
- for(int i = 0; i < al.size(); ++i){
- String consumer = al.get(i);
- if (consumer.contains(s[0].toLowerCase()) && consumer.contains(s[2].toLowerCase())){
- String[] consumerPart = consumer.split(" ");
- if (!consumerPart[4].equals(s[4])) {
- continue;
- }
- al.remove(consumer);
- break;
- }
- }
-
- if (al.size() == 0) {
- defaultPcdValue.remove(pcdKey);
- dynPcdMap.remove(pcdKey);
- String[] s1 = pcdKey.split(" ");
- removeDynamicPcdBuildData(s1[0], s1[1]);
- }
-
- }
- //
- // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer Arch"
- //
- public int getPcdDataCount (String key){
- ModuleSADocument.ModuleSA msa = getModuleSA(key);
-
- if (msa == null || msa.getPcdBuildDefinition() == null || msa.getPcdBuildDefinition().getPcdDataList() == null){
- return 0;
- }
- return msa.getPcdBuildDefinition().getPcdDataList().size();
-
- }
-
- public void getPcdData (String key, String[][] saa) {
- ModuleSADocument.ModuleSA msa = getModuleSA(key);
-
- if (msa == null || msa.getPcdBuildDefinition() == null || msa.getPcdBuildDefinition().getPcdDataList() == null){
- return;
- }
- ListIterator<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData>li = msa.getPcdBuildDefinition().getPcdDataList().listIterator();
- for (int k = 0; k < saa.length; ++k) {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = li.next();
- saa[k][0] = pcdData.getCName();
- saa[k][1] = pcdData.getTokenSpaceGuidCName();
- saa[k][2] = pcdData.getItemType()+"";
- saa[k][3] = pcdData.getToken().toString();
- saa[k][4] = pcdData.getMaxDatumSize()+"";
- saa[k][5] = pcdData.getDatumType()+"";
- saa[k][6] = pcdData.getValue();
-
- }
- }
-
- public void removePcdData (String key, String cName, String tsGuid) {
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(key);
- if (moduleSa == null || moduleSa.getPcdBuildDefinition() == null){
- return;
- }
-
- String mg = moduleSa.getModuleGuid();
- String mv = moduleSa.getModuleVersion();
- String pg = moduleSa.getPackageGuid();
- String pv = moduleSa.getPackageVersion();
- String arch = listToString(moduleSa.getSupArchList());
- String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch;
-
- XmlCursor cursor = moduleSa.getPcdBuildDefinition().newCursor();
- if (cursor.toFirstChild()){
-
- do {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)cursor.getObject();
- if (pcdData.getCName().equals(cName) && pcdData.getTokenSpaceGuidCName().equals(tsGuid)) {
- maintainDynPcdMap(cName + " " + tsGuid, moduleKey);
- if (getPcdDataCount(key) == 1) {
- cursor.toParent();
- }
- cursor.removeXml();
- break;
- }
- }
- while(cursor.toNextSibling());
-
- }
- cursor.dispose();
- }
-
- public void updatePcdData (String key, String cName, String tsGuid, String itemType, String maxSize, String value){
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(key);
- if (moduleSa == null || moduleSa.getPcdBuildDefinition() == null){
- return;
- }
-
- XmlCursor cursor = moduleSa.getPcdBuildDefinition().newCursor();
- if (cursor.toFirstChild()){
- do {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)cursor.getObject();
- if (pcdData.getCName().equals(cName) && pcdData.getTokenSpaceGuidCName().equals(tsGuid)) {
- //
- // change item type while not updating dynPcdData????
- //
- if (itemType != null) {
- pcdData.setItemType(PcdItemTypes.Enum.forString(itemType));
- }
-
- if(pcdData.getDatumType().equals("VOID*") && maxSize != null) {
- pcdData.setMaxDatumSize(new Integer(maxSize));
- }
- //
- // if value input is null, keep old value untouched.
- //
- if (value != null) {
- pcdData.setValue(value);
- defaultPcdValue.put(cName + " " + tsGuid, value);
- }
-
- break;
- }
- }
- while(cursor.toNextSibling());
- }
- cursor.dispose();
- }
-
- /**Get original Pcd info from MSA & SPD files.
- * @param mi ModuleIdentification from which MSA & SPD come
- * @param cName PCD cName
- * @param sa Results: HelpText, Original item type.
- * @return
- */
- public boolean getPcdBuildDataInfo(ModuleIdentification mi, String cName, String tsGuid, String[] sa, Vector<String> validPcdTypes) throws Exception{
-
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) WorkspaceProfile
- .getModuleXmlObject(mi);
- if (msa.getPcdCoded() == null) {
- return false;
- }
-
- PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, mi);
- //
- // First look through MSA pcd entries.
- //
- List<PcdCodedDocument.PcdCoded.PcdEntry> l = msa.getPcdCoded().getPcdEntryList();
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry) li.next();
- if (!msaPcd.getCName().equals(cName)) {
- continue;
- }
- if (!msaPcd.getTokenSpaceGuidCName().equals(tsGuid)) {
- continue;
- }
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs);
- if (spdPcd == null || spdPcd.getValidUsage() == null) {
- //
- // ToDo Error
- //
- throw new PcdDeclNotFound(mi.getName() + " " + msaPcd.getCName());
- }
- //
- // Get Pcd help text and original item type.
- //
- sa[0] = spdPcd.getHelpText() + msaPcd.getHelpText();
- sa[1] = msaPcd.getPcdItemType() + "";
- sa[2] = msa.getModuleDefinitions().getBinaryModule() + "";
- ListIterator iter = spdPcd.getValidUsage().listIterator();
- while (iter.hasNext()) {
- String usage = iter.next().toString();
- validPcdTypes.add(usage);
- }
- return true;
- }
-
- return false;
- }
-
- private boolean multiSourcePcd (String cName, String tsGuidCName, String moduleKey) {
- int libCount = getLibraryInstancesCount(moduleKey);
- String[][] saaLib = new String[libCount][5];
- getLibraryInstances(moduleKey, saaLib);
- ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
- Vector<ModuleIdentification> vMi = new Vector<ModuleIdentification>();
- //
- // create vector for module & library instance MIs.
- //
- vMi.add(mi);
- for (int j = 0; j < saaLib.length; ++j) {
- String libKey = saaLib[j][1] + " " + saaLib[j][2] + " " + saaLib[j][3] + " " + saaLib[j][4];
- ModuleIdentification libMi = WorkspaceProfile.getModuleId(libKey);
- vMi.add(libMi);
- }
-
- int pcdSourceCount = 0;
- for (int i = 0; i < vMi.size(); ++i) {
- if (WorkspaceProfile.pcdInMsa(cName, tsGuidCName, null, vMi.get(i))) {
- pcdSourceCount++;
- }
- }
-
- if (pcdSourceCount < 2) {
- return false;
- }
- else {
- return true;
- }
-
- }
-
- /**Remove PCDBuildDefinition entries from ModuleSA
- * @param moduleKey identifier of ModuleSA.
- * @param consumer where these entries come from.
- */
- public void removePcdData(String moduleKey, ModuleIdentification consumer) {
-
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)WorkspaceProfile.getModuleXmlObject(consumer);
- if (msa.getPcdCoded() == null) {
- return;
- }
-
- List<PcdCodedDocument.PcdCoded.PcdEntry> l = msa.getPcdCoded().getPcdEntryList();
- ListIterator li = l.listIterator();
-
- while(li.hasNext()) {
- PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry)li.next();
- ModuleSADocument.ModuleSA moduleSA = getModuleSA(moduleKey);
- if (moduleSA.getPcdBuildDefinition() != null) {
- XmlCursor cursor = moduleSA.getPcdBuildDefinition().newCursor();
- cursor.push();
- if (cursor.toFirstChild()) {
- do {
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData) cursor
- .getObject();
- String cName = msaPcd.getCName();
- String tsGuidCName = msaPcd.getTokenSpaceGuidCName();
- if (cName.equals(pcdData.getCName())
- && tsGuidCName.equals(pcdData.getTokenSpaceGuidCName()) && !multiSourcePcd(cName, tsGuidCName, moduleKey)) {
-
- maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(),
- moduleKey);
- cursor.removeXml();
- break;
- }
- } while (cursor.toNextSibling());
- }
-
- cursor.pop();
- if (moduleSA.getPcdBuildDefinition().getPcdDataList().size() == 0) {
- cursor.removeXml();
- }
- cursor.dispose();
- }
- }
-
- }
- //
- // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer Arch"
- //
- public int getLibraryInstancesCount(String key) {
- ModuleSADocument.ModuleSA msa = getModuleSA(key);
- if (msa == null || msa.getLibraries() == null || msa.getLibraries().getInstanceList() == null){
- return 0;
- }
- return msa.getLibraries().getInstanceList().size();
- }
-
- public void getLibraryInstances(String key, String[][] saa){
- ModuleSADocument.ModuleSA msa = getModuleSA(key);
- if (msa == null || msa.getLibraries() == null || msa.getLibraries().getInstanceList() == null){
- return ;
- }
-
- ListIterator<LibrariesDocument.Libraries.Instance> li = msa.getLibraries().getInstanceList().listIterator();
- for (int i = 0; i < saa.length; ++i) {
- LibrariesDocument.Libraries.Instance instance = li.next();
- saa[i][1] = instance.getModuleGuid();
- saa[i][2] = instance.getModuleVersion();
- saa[i][3] = instance.getPackageGuid();
- saa[i][4] = instance.getPackageVersion();
- }
- }
-
- public boolean instanceExistsInModuleSA (String key, String mg, String mv, String pg, String pv) {
- int count = 0;
- if ((count = getLibraryInstancesCount(key)) > 0) {
- String[][] saa = new String[count][5];
- getLibraryInstances (key, saa);
- for (int i = 0; i < count; ++i) {
- if (mg.equalsIgnoreCase(saa[i][1]) && pg.equalsIgnoreCase(saa[i][3])) {
- boolean modVerMatch = false;
- boolean pkgVerMatch = false;
- if ((mv.equals("null") || saa[i][2] == null)) {
- modVerMatch = true;
- }
- if (pv.equals("null") || saa[i][4] == null) {
- pkgVerMatch = true;
- }
- if (modVerMatch && pkgVerMatch) {
- return true;
- }
- else {
- if (mv.equals(saa[i][2]) && pv.equals(saa[i][4])) {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- public void removeLibraryInstance(String key, String instanceKey) {
- ModuleSADocument.ModuleSA msa = getModuleSA(key);
- if (msa == null || msa.getLibraries() == null){
- return ;
- }
-
- String[] instanceInfo = instanceKey.split(" ");
- XmlCursor cursor = msa.getLibraries().newCursor();
- if (cursor.toFirstChild()) {
- do {
- Instance libIns = (Instance)cursor.getObject();
- if (libIns.getModuleGuid().equalsIgnoreCase(instanceInfo[0]) && libIns.getPackageGuid().equalsIgnoreCase(instanceInfo[2])) {
- break;
- }
- }while (cursor.toNextSibling());
- cursor.push();
- while (cursor.hasPrevToken()) {
- cursor.toPrevToken();
- if (!cursor.isText()) {
- break;
- }
- String s = cursor.getTextValue();
- if (s.matches(regExpNewLineAndSpaces)) {
- continue;
- }
- }
-
- if (cursor.isComment()) {
- cursor.removeXml();
- }
- cursor.pop();
- cursor.removeXml();
- if (getLibraryInstancesCount(key) == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
-
- cursor.dispose();
- }
-
- public void genLibraryInstance(ModuleIdentification libMi, String key) {
- ModuleSADocument.ModuleSA msa = getModuleSA(key);
- if (msa == null){
- msa = getfpdFrameworkModules().addNewModuleSA();
- }
- LibrariesDocument.Libraries libs = msa.getLibraries();
- if(libs == null){
- libs = msa.addNewLibraries();
- }
-
- String mn = libMi.getName();
- String mg = libMi.getGuid();
- String mv = libMi.getVersion();
- String pn = libMi.getPackageId().getName();
- String pg = libMi.getPackageId().getGuid();
- String pv = libMi.getPackageId().getVersion();
- LibrariesDocument.Libraries.Instance instance = libs.addNewInstance();
- XmlCursor cursor = instance.newCursor();
- try{
- String comment = "Pkg: " + pn + " Mod: " + mn
- + " Path: " + libMi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1);
- cursor.insertComment(comment);
- }
- catch (Exception e){
- e.printStackTrace();
- }
- finally {
- cursor.dispose();
- }
-
- instance.setModuleGuid(mg);
- instance.setModuleVersion(mv);
- instance.setPackageGuid(pg);
- instance.setPackageVersion(pv);
-
- }
-
- public String getFvBinding(String moduleKey){
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(moduleKey);
- return getFvBinding (moduleSa);
- }
-
- public String getFvBinding (ModuleSADocument.ModuleSA moduleSa) {
- if (moduleSa == null || moduleSa.getModuleSaBuildOptions() == null) {
- return null;
- }
- return moduleSa.getModuleSaBuildOptions().getFvBinding();
- }
-
- public void setFvBinding(ModuleSADocument.ModuleSA moduleSa, String fvBinding) {
- if (moduleSa == null ) {
- return;
- }
- if (fvBinding == null || fvBinding.length() == 0) {
- if(moduleSa.getModuleSaBuildOptions() != null){
- moduleSa.getModuleSaBuildOptions().unsetFvBinding();
- }
- }
- else {
- if(moduleSa.getModuleSaBuildOptions() == null){
- moduleSa.addNewModuleSaBuildOptions().setFvBinding(fvBinding);
- return;
- }
- moduleSa.getModuleSaBuildOptions().setFvBinding(fvBinding);
- }
- }
-
- public void setFvBinding(String moduleKey, String fvBinding){
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(moduleKey);
- setFvBinding (moduleSa, fvBinding);
- }
-
- private int fvBindingForModuleSA (ModuleSADocument.ModuleSA moduleSa, String fvName) {
- if (moduleSa == null || moduleSa.getModuleSaBuildOptions() == null || moduleSa.getModuleSaBuildOptions().getFvBinding() == null) {
- return -1;
- }
-
- String fvNameList = moduleSa.getModuleSaBuildOptions().getFvBinding();
- String[] fvNamesArray = fvNameList.split(" ");
- int occursAt = -1;
- for (int i = 0; i < fvNamesArray.length; ++i) {
- if (fvNamesArray[i].equals(fvName)) {
- occursAt = i;
- break;
- }
- }
- return occursAt;
- }
-
- public void removeFvBinding (ModuleSADocument.ModuleSA moduleSa, String fvName) {
- if (moduleSa == null || moduleSa.getModuleSaBuildOptions() == null || moduleSa.getModuleSaBuildOptions().getFvBinding() == null) {
- return;
- }
-
- String fvNameList = moduleSa.getModuleSaBuildOptions().getFvBinding();
- String[] fvNamesArray = fvNameList.split(" ");
- int occursAt = -1;
- for (int i = 0; i < fvNamesArray.length; ++i) {
- if (fvNamesArray[i].equals(fvName)) {
- occursAt = i;
- break;
- }
- }
- // jump over where the input fvName occurs in the original Fv list.
- if (occursAt != -1) {
- String newFvNameList = " ";
- for (int i = 0; i < fvNamesArray.length; ++i) {
- if (i == occursAt) {
- continue;
- }
- newFvNameList += fvNamesArray[i];
- }
- setFvBinding (moduleSa, newFvNameList.trim());
- }
-
- }
-
- /**
- * @param fvName The FV name that to be removed from FvBinding List.
- */
- public void removeFvBindingAll (String fvName) {
- if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return;
- }
-
- Iterator<ModuleSADocument.ModuleSA> li = getfpdFrameworkModules().getModuleSAList().iterator();
- while (li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = li.next();
- removeFvBinding (moduleSa, fvName);
- }
- }
-
- public void appendFvBindingAll (String fvName) {
- if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return;
- }
-
- Iterator<ModuleSADocument.ModuleSA> li = getfpdFrameworkModules().getModuleSAList().iterator();
- while (li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = li.next();
- appendFvBinding (moduleSa, fvName);
- }
- }
-
- public void appendFvBindingFor (String oldFvName, String newFvName) {
- if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){
- removeElement(getfpdFrameworkModules());
- fpdFrameworkModules = null;
- return;
- }
-
- Iterator<ModuleSADocument.ModuleSA> li = getfpdFrameworkModules().getModuleSAList().iterator();
- while (li.hasNext()) {
- ModuleSADocument.ModuleSA moduleSa = li.next();
- String fvBinding = getFvBinding (moduleSa);
- if (fvBinding != null && fvBindingForModuleSA (moduleSa, oldFvName) >= 0) {
- appendFvBinding (moduleSa, newFvName);
- }
- }
- }
-
- public void appendFvBinding (String moduleKey, String fvName) {
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(moduleKey);
- appendFvBinding (moduleSa, fvName);
- }
-
- public void appendFvBinding (ModuleSADocument.ModuleSA moduleSa, String fvName) {
- if (moduleSa == null) {
- return;
- }
-
- if (moduleSa.getModuleSaBuildOptions() == null || moduleSa.getModuleSaBuildOptions().getFvBinding() == null) {
- setFvBinding(moduleSa, fvName);
- return;
- }
-
- String fvNameList = moduleSa.getModuleSaBuildOptions().getFvBinding();
- String newFvNameList = fvNameList + " " + fvName;
- setFvBinding (moduleSa, newFvNameList.trim());
- }
-
- public void updateFvBindingInModuleSA (String moduleKey, String fvName) {
-
- appendFvBinding (moduleKey, fvName);
- }
-
- public String getFfsFileNameGuid(String moduleKey){
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(moduleKey);
- if (moduleSa == null || moduleSa.getModuleSaBuildOptions() == null) {
- return null;
- }
- return moduleSa.getModuleSaBuildOptions().getFfsFileNameGuid();
- }
-
- public void setFfsFileNameGuid(String moduleKey, String fileGuid){
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa == null ) {
- return;
- }
- if(msa.getModuleSaBuildOptions() == null){
- msa.addNewModuleSaBuildOptions();
-
- }
- ModuleSaBuildOptionsDocument.ModuleSaBuildOptions msaBuildOpts= msa.getModuleSaBuildOptions();
- if (fileGuid != null) {
- msaBuildOpts.setFfsFileNameGuid(fileGuid);
- }
- else{
- XmlCursor cursor = msaBuildOpts.newCursor();
- if (cursor.toChild(xmlNs, "FfsFileNameGuid")) {
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- }
-
- public String getFfsFormatKey(String moduleKey){
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa == null || msa.getModuleSaBuildOptions() == null) {
- return null;
- }
- return msa.getModuleSaBuildOptions().getFfsFormatKey();
- }
-
- public void setFfsFormatKey(String moduleKey, String ffsKey){
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa == null ) {
- return;
- }
- if(msa.getModuleSaBuildOptions() == null){
- msa.addNewModuleSaBuildOptions().setFfsFormatKey(ffsKey);
- return;
- }
- msa.getModuleSaBuildOptions().setFfsFormatKey(ffsKey);
- }
-
- public void setModuleSAForceDebug(int i, boolean dbgEnable) {
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(i);
- moduleSa.setForceDebug(dbgEnable);
- }
-
- public boolean getModuleSAForceDebug (int i) {
- ModuleSADocument.ModuleSA moduleSa = getModuleSA(i);
- if (moduleSa.getForceDebug() == true) {
- return true;
- }
- return false;
- }
-
- public void getModuleSAOptions(String moduleKey, String[][] saa) {
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa == null || msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null
- || msa.getModuleSaBuildOptions().getOptions().getOptionList() == null) {
- return ;
- }
-
- List<OptionDocument.Option> lOpt = msa.getModuleSaBuildOptions().getOptions().getOptionList();
- ListIterator li = lOpt.listIterator();
- int i = 0;
- while(li.hasNext()) {
- OptionDocument.Option opt = (OptionDocument.Option)li.next();
- if (opt.getBuildTargets() != null) {
- saa[i][0] = listToString(opt.getBuildTargets());
- }
- saa[i][1] = opt.getToolChainFamily();
- saa[i][2] = opt.getTagName();
- saa[i][3] = opt.getToolCode();
-
- if (opt.getSupArchList() != null){
- saa[i][4] = listToString(opt.getSupArchList());
- }
- else {
- saa[i][4] = "";
- }
-
- saa[i][5] = opt.getStringValue();
-
- ++i;
- }
- }
-
- public int getModuleSAOptionsCount(String moduleKey){
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa == null || msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null
- || msa.getModuleSaBuildOptions().getOptions().getOptionList() == null) {
- return 0;
- }
- return msa.getModuleSaBuildOptions().getOptions().getOptionList().size();
- }
-
- public void genModuleSAOptionsOpt(String moduleKey, Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents) {
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa.getModuleSaBuildOptions() == null) {
- msa.addNewModuleSaBuildOptions();
- }
- if (msa.getModuleSaBuildOptions().getOptions() == null){
- msa.getModuleSaBuildOptions().addNewOptions();
- }
- OptionDocument.Option opt = msa.getModuleSaBuildOptions().getOptions().addNewOption();
- setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt);
- }
-
- public void removeModuleSAOptionsOpt(String moduleKey, int i) {
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null) {
- return ;
- }
- OptionsDocument.Options opts = msa.getModuleSaBuildOptions().getOptions();
- XmlCursor cursor = opts.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j){
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getModuleSAOptionsCount(moduleKey) == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- public void updateModuleSAOptionsOpt(String moduleKey, int i, Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents) {
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
- if (msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null) {
- return ;
- }
- OptionsDocument.Options opts = msa.getModuleSaBuildOptions().getOptions();
- XmlCursor cursor = opts.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j){
- cursor.toNextSibling();
- }
- OptionDocument.Option opt = (OptionDocument.Option)cursor.getObject();
- setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt);
- }
- cursor.dispose();
- }
-
- /**add pcd information of module mi to a ModuleSA.
- * @param mi
- * @param moduleSa if null, generate a new ModuleSA.
- */
- public void addFrameworkModulesPcdBuildDefs(ModuleIdentification mi, String arch, ModuleSADocument.ModuleSA moduleSa) throws Exception {
- //ToDo add Arch filter
-
- if (moduleSa == null) {
- moduleSa = genModuleSA(mi, arch);
- }
-
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) WorkspaceProfile
- .getModuleXmlObject(mi);
- if (msa.getPcdCoded() == null) {
- return;
- }
-
- PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, mi);
- //
- // Implementing InitializePlatformPcdBuildDefinitions
- //
- List<PcdCodedDocument.PcdCoded.PcdEntry> l = msa.getPcdCoded().getPcdEntryList();
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry) li.next();
- if (msaPcd.getSupArchList() != null) {
- if (!msaPcd.getSupArchList().toString().toLowerCase().contains(arch.toLowerCase())) {
- continue;
- }
- }
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs);
- if (spdPcd == null) {
- //
- // ToDo Error
- //
- throw new PcdDeclNotFound("No Declaration for PCD Entry " + msaPcd.getCName() + "\n used by Module "
- + mi.getName() + " or its Library Instances.");
- }
- //
- // AddItem to ModuleSA PcdBuildDefinitions
- //
- String defaultVal = msaPcd.getDefaultValue() == null ? spdPcd.getDefaultValue() : msaPcd.getDefaultValue();
-
- genPcdData(msaPcd.getCName(), spdPcd.getToken(), msaPcd.getTokenSpaceGuidCName(), msaPcd.getPcdItemType()
- .toString(),
- spdPcd.getDatumType() + "", defaultVal, moduleSa, spdPcd);
- }
-
- }
-
- private PcdDeclarationsDocument.PcdDeclarations.PcdEntry LookupPcdDeclaration (PcdCodedDocument.PcdCoded.PcdEntry msaPcd, PackageIdentification[] depPkgs) {
-
- PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = null;
- for (int i = 0; i < depPkgs.length; ++i) {
-
- XmlObject[] xo = SurfaceAreaQuery.getSpdPcdDeclarations(depPkgs[i]);
- if (xo == null) {
- continue;
- }
- for (int j = 0; j < xo.length; ++j) {
- spdPcd = (PcdDeclarationsDocument.PcdDeclarations.PcdEntry)xo[j];
- if (msaPcd.getTokenSpaceGuidCName() == null) {
- if (spdPcd.getCName().equals(msaPcd.getCName())) {
- return spdPcd;
- }
- }
- else{
- if (spdPcd.getCName().equals(msaPcd.getCName()) && spdPcd.getTokenSpaceGuidCName().equals(msaPcd.getTokenSpaceGuidCName())) {
- return spdPcd;
- }
- }
-
- }
-
- }
- return null;
- }
-
- private ModuleSADocument.ModuleSA genModuleSA (ModuleIdentification mi, String arch) {
- PackageIdentification pi = WorkspaceProfile.getPackageForModule(mi);
- ModuleSADocument.ModuleSA msa = getfpdFrameworkModules().addNewModuleSA();
- XmlCursor cursor = msa.newCursor();
- try{
- String comment = "Mod: " + mi.getName() + " Type: " + SurfaceAreaQuery.getModuleType(mi) + " Path: "
- + mi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1);
- cursor.insertComment(comment);
- }
- catch(Exception e){
- e.printStackTrace();
- }
- finally {
- cursor.dispose();
- }
- msa.setModuleGuid(mi.getGuid());
- msa.setModuleVersion(mi.getVersion());
- msa.setPackageGuid(pi.getGuid());
- msa.setPackageVersion(pi.getVersion());
- if (arch != null) {
- Vector<String> v = new Vector<String>();
- v.add(arch);
- msa.setSupArchList(v);
- }
-
- return msa;
- }
-
- private String chooseDefaultPcdType (List validPcdTypes) {
- String choosedType = "";
- if (validPcdTypes.contains("FIXED_AT_BUILD")) {
- choosedType = "FIXED_AT_BUILD";
- }
- else if (validPcdTypes.contains("DYNAMIC")) {
- choosedType = "DYNAMIC";
- }
- else if (validPcdTypes.contains("PATCHABLE_IN_MODULE")) {
- choosedType = "PATCHABLE_IN_MODULE";
- }
- else if (validPcdTypes.contains("DYNAMIC_EX")) {
- choosedType = "DYNAMIC_EX";
- }
- return choosedType;
- }
-
- private synchronized void genPcdData (String cName, Object token, String tsGuid, String itemType, String dataType, String defaultVal,
- ModuleSADocument.ModuleSA moduleSa, PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd)
- throws PcdItemTypeConflictException, PcdValueMalFormed{
- if (moduleSa.getPcdBuildDefinition() == null){
- moduleSa.addNewPcdBuildDefinition();
- }
- //
- // constructe pcd to modulesa mapping first.
- // Attention : for any error condition, remove from map this pcd.
- //
- ArrayList<String> pcdConsumer = LookupPlatformPcdData(cName + " " + tsGuid);
- if (pcdConsumer == null) {
- pcdConsumer = new ArrayList<String>();
- }
- //
- // Check whether this PCD has already added to ModuleSA, if so, just return.
- //
- String moduleInfo = moduleSa.getModuleGuid().toLowerCase() + " " + moduleSa.getModuleVersion()
- + " " + moduleSa.getPackageGuid().toLowerCase() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList());
- for (int i = 0; i < pcdConsumer.size(); ++i) {
- String pcdInfo = pcdConsumer.get(i);
- if (moduleInfo.equals(pcdInfo.substring(0, pcdInfo.lastIndexOf(" ")))){
- return;
- }
- }
- // if pcd type from MSA file is Dynamic
- // we must choose one default type from SPD file for it.
- //
- List validPcdTypes = spdPcd.getValidUsage();
- //
- // Using existing Pcd type, if this pcd already exists in other ModuleSA
- //
- if (pcdConsumer.size() > 0) {
- //
- // platform should only contain one type for each pcd.
- //
- String existingItemType = itemType (pcdConsumer.get(0));
- for (int i = 1; i < pcdConsumer.size(); ++i) {
- if (!existingItemType.equals(itemType(pcdConsumer.get(i)))) {
- throw new PcdItemTypeConflictException (cName, pcdConsumer.get(0), pcdConsumer.get(i));
- }
- }
-
- if (itemType.equals("DYNAMIC")) {
- if (!validPcdTypes.contains(existingItemType)) {
- throw new PcdItemTypeConflictException(cName, pcdConsumer.get(0));
- }
- itemType = existingItemType;
- }
- else {
- if (!itemType.equals(existingItemType)) {
- throw new PcdItemTypeConflictException(cName, pcdConsumer.get(0));
- }
- }
- }
- //
- // if this is the first occurence of this pcd.
- //
- else {
- if (itemType.equals("DYNAMIC")) {
- itemType = chooseDefaultPcdType (validPcdTypes);
- }
- }
- String listValue = moduleInfo + " " + itemType;
- pcdConsumer.add(listValue);
- dynPcdMap.put(cName + " " + tsGuid, pcdConsumer);
-
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData fpdPcd = moduleSa.getPcdBuildDefinition().addNewPcdData();
- fpdPcd.setCName(cName);
- fpdPcd.setToken(token);
- fpdPcd.setTokenSpaceGuidCName(tsGuid);
- fpdPcd.setDatumType(PcdDataTypes.Enum.forString(dataType));
- fpdPcd.setItemType(PcdItemTypes.Enum.forString(itemType));
-
- if (defaultVal != null && defaultVal.length() > 0){
- fpdPcd.setValue(defaultVal);
- }
- else {
- if (dataType.equals("UINT8") || dataType.equals("UINT16") || dataType.equals("UINT32") || dataType.equals("UINT64")) {
- fpdPcd.setValue("0");
- }
- if (dataType.equals("BOOLEAN")){
- fpdPcd.setValue("FALSE");
- }
- if (dataType.equals("VOID*")) {
- fpdPcd.setValue("L\"\"");
- }
- }
- //
- // Using existing pcd value, if this pcd already exists in other moduleSa.
- //
- if (defaultPcdValue.get(cName + " " + tsGuid) == null) {
- defaultPcdValue.put(cName + " " + tsGuid, fpdPcd.getValue());
- }
- else {
- fpdPcd.setValue(defaultPcdValue.get(cName + " " + tsGuid));
- }
-
- if (dataType.equals("UINT8")){
- fpdPcd.setMaxDatumSize(1);
- }
- if (dataType.equals("UINT16")) {
- fpdPcd.setMaxDatumSize(2);
- }
- if (dataType.equals("UINT32")) {
- fpdPcd.setMaxDatumSize(4);
- }
- if (dataType.equals("UINT64")){
- fpdPcd.setMaxDatumSize(8);
- }
- if (dataType.equals("BOOLEAN")){
- fpdPcd.setMaxDatumSize(1);
- }
- if (dataType.equals("VOID*")) {
- int maxSize = setMaxSizeForPointer(fpdPcd.getValue());
- fpdPcd.setMaxDatumSize(maxSize);
- }
-
-
- if (itemType.equals("DYNAMIC") || itemType.equals("DYNAMIC_EX")) {
- ArrayList<String> al = LookupDynamicPcdBuildDefinition(cName + " " + tsGuid);
- //
- // if only one module mapped to this pcd, then the one is myself. so no other module mapped.
- // so need to add one dyn pcd.
- //
- if (al.size() == 1) {
- addDynamicPcdBuildData(cName, token, tsGuid, itemType, dataType, defaultVal);
- }
- }
-
- }
-
- public int setMaxSizeForPointer(String datum) throws PcdValueMalFormed{
- if (datum == null) {
- return 0;
- }
- char ch = datum.charAt(0);
- int start, end;
- String strValue;
- //
- // For void* type PCD, only three datum is support:
- // 1) Unicode: string with start char is "L"
- // 2) Ansci: String is ""
- // 3) byte array: String start char "{"
- //
- if (ch == 'L') {
- start = datum.indexOf('\"');
- end = datum.lastIndexOf('\"');
- if ((start > end) ||
- (end > datum.length())||
- ((start == end) && (datum.length() > 0))) {
- //ToDo Error handling here
- throw new PcdValueMalFormed (datum);
- }
-
- strValue = datum.substring(start + 1, end);
- return strValue.length() * 2;
- } else if (ch == '\"'){
- start = datum.indexOf('\"');
- end = datum.lastIndexOf('\"');
- if ((start > end) ||
- (end > datum.length())||
- ((start == end) && (datum.length() > 0))) {
- throw new PcdValueMalFormed (datum);
- }
- strValue = datum.substring(start + 1, end);
- return strValue.length();
- } else if (ch =='{') {
- String[] strValueArray;
-
- start = datum.indexOf('{');
- end = datum.lastIndexOf('}');
- strValue = datum.substring(start + 1, end);
- strValue = strValue.trim();
- if (strValue.length() == 0) {
- return 0;
- }
- strValueArray = strValue.split(",");
- for (int index = 0; index < strValueArray.length; index ++) {
- Integer value = Integer.decode(strValueArray[index].trim());
-
- if (value > 0xFF) {
-// "[FPD file error] The datum type of PCD %s in %s is VOID*, "+
-// "it must be a byte array. But the element of %s exceed the byte range",
- throw new PcdValueMalFormed (datum);
- }
- }
- return strValueArray.length;
-
-
- } else {
-// "[FPD file error] The datum type of PCD %s in %s is VOID*. For VOID* type, you have three format choise:\n "+
-// "1) UNICODE string: like L\"xxxx\";\r\n"+
-// "2) ANSIC string: like \"xxx\";\r\n"+
-// "3) Byte array: like {0x2, 0x45, 0x23}\r\n"+
-// "but the datum in seems does not following above format!",
- throw new PcdValueMalFormed (datum);
-
- }
- }
-
- private ArrayList<String> LookupDynamicPcdBuildDefinition(String dynPcdKey) {
- ArrayList<String> al = dynPcdMap.get(dynPcdKey);
-
- return al;
- }
-
- private ArrayList<String> LookupPlatformPcdData(String pcdKey) {
-
- return dynPcdMap.get(pcdKey);
- }
-
- public int getDynamicPcdBuildDataCount() {
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return 0;
- }
- return getfpdDynPcdBuildDefs().getPcdBuildDataList().size();
- }
-
- public void getDynamicPcdBuildData(String[][] saa) {
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return ;
- }
- List<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData> l = getfpdDynPcdBuildDefs().getPcdBuildDataList();
- ListIterator<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData> li = l.listIterator();
- int i = 0;
- while(li.hasNext()) {
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData dynPcd = li.next();
- saa[i][0] = dynPcd.getCName();
- saa[i][1] = dynPcd.getToken().toString();
- saa[i][2] = dynPcd.getTokenSpaceGuidCName();
- saa[i][3] = dynPcd.getMaxDatumSize()+"";
- saa[i][4] = dynPcd.getDatumType()+"";
-
- ++i;
- }
- }
-
- public void addDynamicPcdBuildData(String cName, Object token, String tsGuid, String itemType, String dataType, String defaultVal)
- throws PcdValueMalFormed{
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData dynPcdData = getfpdDynPcdBuildDefs().addNewPcdBuildData();
- dynPcdData.setItemType(PcdItemTypes.Enum.forString(itemType));
- dynPcdData.setCName(cName);
- dynPcdData.setToken(token);
- dynPcdData.setTokenSpaceGuidCName(tsGuid);
- dynPcdData.setDatumType(PcdDataTypes.Enum.forString(dataType));
-
- BigInteger bigInt = new BigInteger("0");
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo skuInfo = dynPcdData.addNewSkuInfo();
- skuInfo.setSkuId(bigInt);
- if (defaultVal != null){
- skuInfo.setValue(defaultVal);
- }
- else {
- if (dataType.equals("UINT8")){
- skuInfo.setValue("0");
- }
- if (dataType.equals("UINT16")) {
- skuInfo.setValue("0");
- }
- if (dataType.equals("UINT32")) {
- skuInfo.setValue("0");
- }
- if (dataType.equals("UINT64")){
- skuInfo.setValue("0");
- }
- if (dataType.equals("BOOLEAN")){
- skuInfo.setValue("false");
- }
- if (dataType.equals("VOID*")) {
- skuInfo.setValue("");
- }
- }
- if (dataType.equals("UINT8")){
- dynPcdData.setMaxDatumSize(1);
- }
- if (dataType.equals("UINT16")) {
- dynPcdData.setMaxDatumSize(2);
- }
- if (dataType.equals("UINT32")) {
- dynPcdData.setMaxDatumSize(4);
- }
- if (dataType.equals("UINT64")){
- dynPcdData.setMaxDatumSize(8);
- }
- if (dataType.equals("BOOLEAN")){
- dynPcdData.setMaxDatumSize(1);
- }
- if (dataType.equals("VOID*")) {
- int maxSize = setMaxSizeForPointer(defaultVal);
- dynPcdData.setMaxDatumSize(maxSize);
- }
- }
-
- public void removeDynamicPcdBuildData(String cName, String tsGuid) {
- XmlObject o = fpdRoot.getDynamicPcdBuildDefinitions();
- if (o == null) {
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- do {
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdBuildData =
- (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- if (pcdBuildData.getCName().equals(cName) && pcdBuildData.getTokenSpaceGuidCName().equals(tsGuid)) {
-
- if (getDynamicPcdBuildDataCount() == 1) {
- cursor.dispose();
- removeElement(o);
- fpdDynPcdBuildDefs = null;
- return;
- }
- cursor.removeXml();
- cursor.dispose();
- return;
- }
- }
- while (cursor.toNextSibling());
- }
- cursor.dispose();
- }
- //
- // Get the Sku Info count of ith dyn pcd element.
- //
- public int getDynamicPcdSkuInfoCount(int i){
- if (fpdRoot.getDynamicPcdBuildDefinitions() == null || fpdRoot.getDynamicPcdBuildDefinitions().getPcdBuildDataList() == null
- || fpdRoot.getDynamicPcdBuildDefinitions().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return 0;
- }
-
- int skuInfoCount = 0;
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- if (pcdData.getSkuInfoList() == null) {
- skuInfoCount = 0;
- }
- else {
- skuInfoCount = pcdData.getSkuInfoList().size();
- }
- }
- cursor.dispose();
- return skuInfoCount;
- }
-
- public void getDynamicPcdSkuInfos(int i, String[][] saa){
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return;
- }
-
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- if (pcdData.getSkuInfoList() == null) {
- cursor.dispose();
- return;
- }
- else {
- ListIterator<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo> li = pcdData.getSkuInfoList().listIterator();
- int k = 0;
- while (li.hasNext()) {
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo skuInfo = li.next();
- saa[k][0] = skuInfo.getSkuId()+"";
- saa[k][1] = skuInfo.getVariableName();
- saa[k][2] = skuInfo.getVariableGuid();
- saa[k][3] = skuInfo.getVariableOffset();
- saa[k][4] = skuInfo.getHiiDefaultValue();
- saa[k][5] = skuInfo.getVpdOffset();
- saa[k][6] = skuInfo.getValue();
- ++k;
- }
-
- }
- }
- cursor.dispose();
-
- }
-
- public String getDynamicPcdBuildDataValue(int i){
- String value = null;
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return value;
- }
-
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- if (pcdData.getSkuInfoList() == null) {
- value = null;
- }
- else {
- value = pcdData.getSkuInfoArray(0).getValue();
- }
- }
- cursor.dispose();
- return value;
- }
-
- public String getDynamicPcdBuildDataVpdOffset(int i){
- String vpdOffset = null;
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return vpdOffset;
- }
-
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- if (pcdData.getSkuInfoList() == null) {
- vpdOffset = null;
- }
- else {
- vpdOffset = pcdData.getSkuInfoArray(0).getVpdOffset();
- }
- }
- cursor.dispose();
- return vpdOffset;
- }
-
- public void removeDynamicPcdBuildDataSkuInfo(int i) {
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return;
- }
-
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- if (pcdData.getSkuInfoList() == null) {
- cursor.dispose();
- return;
- }
- else {
- pcdData.getSkuInfoList().clear();
-// QName qSkuInfo = new QName(xmlNs, "SkuInfo");
-// cursor.toChild(qSkuInfo);
-// cursor.removeXml();
- }
- }
- cursor.dispose();
- }
- //
- // generate sku info for ith dyn pcd build data.
- //
- public void genDynamicPcdBuildDataSkuInfo(String id, String varName, String varGuid, String varOffset,
- String hiiDefault, String vpdOffset, String value, int i) {
-// if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
-// return;
-// }
-
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo skuInfo = pcdData.addNewSkuInfo();
- skuInfo.setSkuId(new BigInteger(id));
- if (varName != null){
- skuInfo.setVariableName(varName);
- skuInfo.setVariableGuid(varGuid);
- skuInfo.setVariableOffset(varOffset);
- skuInfo.setHiiDefaultValue(hiiDefault);
- }
- else if (vpdOffset != null){
- skuInfo.setVpdOffset(vpdOffset);
- }
- else{
- skuInfo.setValue(value);
- }
- }
- }
-
- public void updateDynamicPcdBuildDataSkuInfo(String id, String varName, String varGuid, String varOffset,
- String hiiDefault, String vpdOffset, String value, int i){
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- return;
- }
-
- XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();
- ListIterator<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo> li = pcdData.getSkuInfoList().listIterator();
- while (li.hasNext()) {
- DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo skuInfo = li.next();
- if (skuInfo.getSkuId().toString().equals(id)){
- if (varName != null){
- skuInfo.setVariableName(varName);
- skuInfo.setVariableGuid(varGuid);
- skuInfo.setVariableOffset(varOffset);
- skuInfo.setHiiDefaultValue(hiiDefault);
- }
- else if (vpdOffset != null){
- skuInfo.setVpdOffset(vpdOffset);
- }
- else{
- skuInfo.setValue(value);
- }
- break;
- }
- }
- }
- }
-
- public BuildOptionsDocument.BuildOptions getfpdBuildOpts() {
- if (fpdBuildOpts == null) {
- fpdBuildOpts = fpdRoot.addNewBuildOptions();
- }
- return fpdBuildOpts;
- }
-
- public void genBuildOptionsUserExtensions(String fvName, String userId, String id, String outputFileName, Vector<String[]> includeModules) {
- QName elementFvName = new QName (xmlNs, "FvName");
- QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
- QName elementInfFileName = new QName(xmlNs, "InfFileName");
- QName elementModule = new QName(xmlNs, "Module");
-
- UserExtensionsDocument.UserExtensions userExts = getfpdBuildOpts().addNewUserExtensions();
- userExts.setUserID(userId);
- userExts.setIdentifier(id);
- XmlCursor cursor = userExts.newCursor();
- cursor.toEndToken();
-
- cursor.beginElement(elementFvName);
- cursor.insertChars(fvName);
- cursor.toNextToken();
-
- cursor.beginElement(elementInfFileName);
- cursor.insertChars(outputFileName);
- cursor.toNextToken();
-
- cursor.beginElement(elementIncludeModules);
- for (int i = 0; i < includeModules.size(); ++i) {
- cursor.beginElement(elementModule);
- cursor.insertAttributeWithValue("ModuleGuid", includeModules.get(i)[0]);
- if (!includeModules.get(i)[1].equals("null") && includeModules.get(i)[1].length() != 0) {
- cursor.insertAttributeWithValue("ModuleVersion", includeModules.get(i)[1]);
- }
- cursor.insertAttributeWithValue("PackageGuid", includeModules.get(i)[2]);
- if (!includeModules.get(i)[3].equals("null") && includeModules.get(i)[3].length() != 0) {
- cursor.insertAttributeWithValue("PackageVersion", includeModules.get(i)[3]);
- }
-
- cursor.insertAttributeWithValue("Arch", includeModules.get(i)[4]);
- cursor.toEndToken();
- cursor.toNextToken();
- }
- cursor.dispose();
- }
-
- public int getUserExtsIncModCount (String fvName, String userId, String id) {
- if (getfpdBuildOpts().getUserExtensionsList() == null) {
- return -1;
- }
-
- ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();
- QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
- while (li.hasNext()) {
- UserExtensionsDocument.UserExtensions ues = li.next();
- if (!ues.getUserID().equals(userId)) {
- continue;
- }
- if (ues.getIdentifier() == null || !ues.getIdentifier().equals(id)) {
- continue;
- }
- XmlCursor cursor = ues.newCursor();
- cursor.toFirstChild();
- String elementName = cursor.getTextValue();
- if (elementName.equals(fvName)) {
- cursor.toNextSibling(elementIncludeModules);
- if (cursor.toFirstChild()) {
- int i = 1;
- for (i = 1; cursor.toNextSibling(); ++i);
- cursor.dispose();
- return i;
- }
- cursor.dispose();
- return 0;
- }
- cursor.dispose();
- }
- return -1;
- }
-
- public void getUserExtsIncMods(String fvName, String userId, String id, String[][] saa) {
- if (getfpdBuildOpts().getUserExtensionsList() == null) {
- return;
- }
-
- XmlCursor cursor = getfpdBuildOpts().newCursor();
- QName elementUserExts = new QName (xmlNs, "UserExtensions");
- QName attribUserId = new QName ("UserID");
- QName attribId = new QName ("Identifier");
- QName elementFvName = new QName (xmlNs, "FvName");
- QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
- QName attribModuleGuid = new QName("ModuleGuid");
- QName attribModuleVersion = new QName("ModuleVersion");
- QName attribPackageGuid = new QName("PackageGuid");
- QName attribPackageVersion = new QName("PackageVersion");
- QName attribArch = new QName("Arch");
-
- if (cursor.toChild(elementUserExts)) {
- do {
- cursor.push();
- if (cursor.getAttributeText(attribUserId).equals(userId) && cursor.getAttributeText(attribId).equals(id)) {
- cursor.toChild(elementFvName);
- String elementName = cursor.getTextValue();
- if (elementName.equals(fvName)) {
- cursor.toNextSibling(elementIncludeModules);
- if (cursor.toFirstChild()) {
- int i = 0;
- do {
- saa[i][0] = cursor.getAttributeText(attribModuleGuid);
- saa[i][1] = cursor.getAttributeText(attribModuleVersion);
- saa[i][2] = cursor.getAttributeText(attribPackageGuid);
- saa[i][3] = cursor.getAttributeText(attribPackageVersion);
- saa[i][4] = cursor.getAttributeText(attribArch);
- ++i;
- }while (cursor.toNextSibling());
- }
- break;
- }
- }
- cursor.pop();
- }while (cursor.toNextSibling(elementUserExts));
- }
- cursor.dispose();
-
- }
-
- public void updateBuildOptionsUserExtensions (String oldFvName, String newFvName) {
- if (getfpdBuildOpts().getUserExtensionsList() == null) {
- return;
- }
- ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();
- while (li.hasNext()) {
- UserExtensionsDocument.UserExtensions ues = li.next();
- if (!ues.getUserID().equals("IMAGES")) {
- continue;
- }
- XmlCursor cursor = ues.newCursor();
- cursor.toFirstChild();
- String elementName = cursor.getTextValue();
- if (elementName.equals(oldFvName)) {
- cursor.setTextValue(newFvName);
- }
- cursor.dispose();
- }
-
- }
-
- public void removeBuildOptionsUserExtensions (String fvName, String userId, String id) {
- if (getfpdBuildOpts().getUserExtensionsList() == null) {
- return;
- }
-
- ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();
- while (li.hasNext()) {
- UserExtensionsDocument.UserExtensions ues = li.next();
- if (!ues.getUserID().equals(userId)) {
- continue;
- }
- if (ues.getIdentifier()== null || !ues.getIdentifier().equals(id)) {
- continue;
- }
- XmlCursor cursor = ues.newCursor();
- cursor.toFirstChild();
- String elementName = cursor.getTextValue();
- if (elementName.equals(fvName)) {
- cursor.toParent();
- cursor.removeXml();
- cursor.dispose();
- return;
- }
- cursor.dispose();
- }
-
- }
-
- private boolean versionEqual (String v1, String v2) {
-
- if ((v1 == null || v1.length() == 0 || v1.equalsIgnoreCase("null"))
- && (v2 == null || v2.length() == 0 || v2.equalsIgnoreCase("null"))) {
- return true;
- }
-
- if (v1 != null && v1.equals(v2)) {
- return true;
- }
-
- return false;
- }
-
- public boolean moduleInBuildOptionsUserExtensions (String fvName, String userId, String id, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {
- boolean inList = false;
- if (getUserExtsIncModCount(fvName, userId, id) > 0) {
- XmlCursor cursor = getfpdBuildOpts().newCursor();
- QName elementUserExts = new QName (xmlNs, "UserExtensions");
- QName attribUserId = new QName ("UserID");
- QName attribId = new QName ("Identifier");
- QName elementFvName = new QName (xmlNs, "FvName");
- QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
- QName attribModuleGuid = new QName("ModuleGuid");
- QName attribModuleVersion = new QName("ModuleVersion");
- QName attribPackageGuid = new QName("PackageGuid");
- QName attribPackageVersion = new QName("PackageVersion");
- QName attribArch = new QName("Arch");
-
- if (cursor.toChild(elementUserExts)) {
- do {
- cursor.push();
- if (cursor.getAttributeText(attribUserId).equals(userId) && cursor.getAttributeText(attribId).equals(id)) {
- cursor.toChild(elementFvName);
- String elementName = cursor.getTextValue();
- if (elementName.equals(fvName)) {
- cursor.toNextSibling(elementIncludeModules);
- if (cursor.toFirstChild()) {
-
- do {
- String mg = cursor.getAttributeText(attribModuleGuid);
- String mv = cursor.getAttributeText(attribModuleVersion);
- String pg = cursor.getAttributeText(attribPackageGuid);
- String pv = cursor.getAttributeText(attribPackageVersion);
- String ar = cursor.getAttributeText(attribArch);
- if (!moduleGuid.equalsIgnoreCase(mg)) {
- continue;
- }
- if (!packageGuid.equalsIgnoreCase(pg)) {
- continue;
- }
- if (!arch.equalsIgnoreCase(ar)) {
- continue;
- }
- if (!versionEqual(moduleVersion, mv)) {
- continue;
- }
- if (!versionEqual(packageVersion, pv)) {
- continue;
- }
- inList = true;
- break;
- }while (cursor.toNextSibling());
- }
- break;
- }
- }
- cursor.pop();
- }while (cursor.toNextSibling(elementUserExts));
- }
- cursor.dispose();
- }
- return inList;
- }
-
- public void removeModuleInBuildOptionsUserExtensions (String fvName, String userId, String id, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {
- //
- // if there is only one module before remove operation, the whole user extension should be removed.
- //
- int moduleAmount = getUserExtsIncModCount(fvName, userId, id);
- if (moduleAmount == 1) {
- removeBuildOptionsUserExtensions(fvName, userId, id);
- return;
- }
-
- if (moduleAmount > 1) {
- XmlCursor cursor = getfpdBuildOpts().newCursor();
- QName elementUserExts = new QName (xmlNs, "UserExtensions");
- QName attribUserId = new QName ("UserID");
- QName attribId = new QName ("Identifier");
- QName elementFvName = new QName (xmlNs, "FvName");
- QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
- QName attribModuleGuid = new QName("ModuleGuid");
- QName attribModuleVersion = new QName("ModuleVersion");
- QName attribPackageGuid = new QName("PackageGuid");
- QName attribPackageVersion = new QName("PackageVersion");
- QName attribArch = new QName("Arch");
-
- if (cursor.toChild(elementUserExts)) {
- do {
- cursor.push();
- if (cursor.getAttributeText(attribUserId).equals(userId) && cursor.getAttributeText(attribId).equals(id)) {
- cursor.toChild(elementFvName);
- String elementName = cursor.getTextValue();
- if (elementName.equals(fvName)) {
- cursor.toNextSibling(elementIncludeModules);
- if (cursor.toFirstChild()) {
-
- do {
- String mg = cursor.getAttributeText(attribModuleGuid);
- String mv = cursor.getAttributeText(attribModuleVersion);
- String pg = cursor.getAttributeText(attribPackageGuid);
- String pv = cursor.getAttributeText(attribPackageVersion);
- String ar = cursor.getAttributeText(attribArch);
- if (!moduleGuid.equalsIgnoreCase(mg)) {
- continue;
- }
- if (!packageGuid.equalsIgnoreCase(pg)) {
- continue;
- }
- if (!arch.equalsIgnoreCase(ar)) {
- continue;
- }
- if (!versionEqual(moduleVersion, mv)) {
- continue;
- }
- if (!versionEqual(packageVersion, pv)) {
- continue;
- }
- cursor.removeXml();
- }while (cursor.toNextSibling());
- }
- break;
- }
- }
- cursor.pop();
- }while (cursor.toNextSibling(elementUserExts));
- }
- cursor.dispose();
- }
- }
-
- public void addModuleIntoBuildOptionsUserExtensions (String fvName, String userId, String id, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {
- if (moduleInBuildOptionsUserExtensions (fvName, userId, id, moduleGuid, moduleVersion, packageGuid, packageVersion, arch)) {
- return;
- }
-
- ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();
- QName elementIncludeModules = new QName(xmlNs, "IncludeModules");
- QName elementModule = new QName(xmlNs, "Module");
- while (li.hasNext()) {
- UserExtensionsDocument.UserExtensions ues = li.next();
- if (!ues.getUserID().equals(userId)) {
- continue;
- }
- if (ues.getIdentifier() == null || !ues.getIdentifier().equals(id)) {
- continue;
- }
- XmlCursor cursor = ues.newCursor();
- cursor.toFirstChild();
- String elementName = cursor.getTextValue();
- if (elementName.equals(fvName)) {
- cursor.toNextSibling(elementIncludeModules);
- cursor.toLastChild();
- cursor.toEndToken();
- cursor.toNextToken();
- cursor.beginElement(elementModule);
- cursor.insertAttributeWithValue("ModuleGuid", moduleGuid);
- if (!moduleVersion.equals("null") && moduleVersion.length() != 0) {
- cursor.insertAttributeWithValue("ModuleVersion", moduleVersion);
- }
- cursor.insertAttributeWithValue("PackageGuid", packageGuid);
- if (!packageVersion.equals("null") && packageVersion.length() != 0) {
- cursor.insertAttributeWithValue("PackageVersion", packageVersion);
- }
-
- cursor.insertAttributeWithValue("Arch", arch);
- cursor.dispose();
- return;
- }
- cursor.dispose();
- }
-
- }
-
- public void genBuildOptionsUserDefAntTask (String id, String fileName, String execOrder) {
- UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks();
- if (udats == null) {
- udats = getfpdBuildOpts().addNewUserDefinedAntTasks();
- }
-
- AntTaskDocument.AntTask at = udats.addNewAntTask();
- setBuildOptionsUserDefAntTask(id, fileName, execOrder, at);
- }
-
- private void setBuildOptionsUserDefAntTask(String id, String fileName, String execOrder, AntTaskDocument.AntTask at) {
- at.setId(new Integer(id));
- XmlCursor cursor = at.newCursor();
- if (fileName != null){
- at.setFilename(fileName);
- }
- else if (cursor.toChild(xmlNs, "Filename")) {
- cursor.removeXml();
- }
- if (execOrder != null) {
- at.setAntCmdOptions(execOrder);
- }
- else if (cursor.toChild(xmlNs, "AntCmdOptions")) {
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- public void removeBuildOptionsUserDefAntTask(int i) {
- XmlObject o = getfpdBuildOpts().getUserDefinedAntTasks();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getBuildOptionsUserDefAntTaskCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- public void updateBuildOptionsUserDefAntTask(int i, String id, String fileName, String execOrder){
- XmlObject o = getfpdBuildOpts().getUserDefinedAntTasks();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- AntTaskDocument.AntTask at = (AntTaskDocument.AntTask)cursor.getObject();
- setBuildOptionsUserDefAntTask(id, fileName, execOrder, at);
- }
- cursor.dispose();
- }
-
- public int getBuildOptionsUserDefAntTaskCount() {
- UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks();
- if (udats == null || udats.getAntTaskList() == null) {
- return 0;
- }
-
- return udats.getAntTaskList().size();
- }
-
- public void getBuildOptionsUserDefAntTasks(String[][] saa) {
- UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks();
- if (udats == null || udats.getAntTaskList() == null) {
- return ;
- }
-
- List<AntTaskDocument.AntTask> l = udats.getAntTaskList();
- ListIterator li = l.listIterator();
- int i = 0;
- while (li.hasNext()) {
- AntTaskDocument.AntTask at = (AntTaskDocument.AntTask)li.next();
- saa[i][0] = at.getId() + "";
- saa[i][1] = saa[i][2] = "";
- if (at.getFilename() != null){
- saa[i][1] = at.getFilename();
- }
- if (at.getAntCmdOptions() != null) {
- saa[i][2] = at.getAntCmdOptions();
- }
- ++i;
- }
- }
- public void genBuildOptionsOpt(Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents) {
- OptionsDocument.Options opts = getfpdBuildOpts().getOptions();
- if (opts == null) {
- opts = getfpdBuildOpts().addNewOptions();
- }
- OptionDocument.Option opt = opts.addNewOption();
- setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt);
- }
-
- private void setBuildOptionsOpt(Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents, OptionDocument.Option opt){
- opt.setStringValue(contents);
- if (buildTargets != null) {
- opt.setBuildTargets(buildTargets);
- }
- else {
- if (opt.isSetBuildTargets()) {
- opt.unsetBuildTargets();
- }
- }
-
- if (toolChain != null && toolChain.length() > 0) {
- opt.setToolChainFamily(toolChain);
- }
- else {
- if (opt.isSetToolChainFamily()) {
- opt.unsetToolChainFamily();
- }
- }
-
- if (tagName != null && tagName.length() > 0) {
- opt.setTagName(tagName);
- }
- else {
- if (opt.isSetTagName()) {
- opt.unsetTagName();
- }
- }
-
- if (toolCmd != null && toolCmd.length() > 0) {
- opt.setToolCode(toolCmd);
- }
- else {
- if (opt.isSetToolCode()) {
- opt.unsetToolCode();
- }
- }
-
-
- if (archList != null) {
- opt.setSupArchList(archList);
- }
- else {
- if (opt.isSetSupArchList()) {
- opt.unsetSupArchList();
- }
- }
- }
-
- public void removeBuildOptionsOpt(int i){
-
- XmlObject o = getfpdBuildOpts().getOptions();
- if (o == null) {
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (getBuildOptionsOptCount() == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- cursor.dispose();
- }
-
- public void updateBuildOptionsOpt(int i, Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents) {
- XmlObject o = getfpdBuildOpts().getOptions();
- if (o == null) {
- return;
- }
-
- XmlCursor cursor = o.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- OptionDocument.Option opt = (OptionDocument.Option)cursor.getObject();
- setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt);
- }
- cursor.dispose();
- }
-
- public int getBuildOptionsOptCount(){
- if (getfpdBuildOpts().getOptions() == null || getfpdBuildOpts().getOptions().getOptionList() == null) {
- return 0;
- }
- return getfpdBuildOpts().getOptions().getOptionList().size();
- }
-
- public void getBuildOptionsOpts(String[][] saa) {
- if (getfpdBuildOpts().getOptions() == null || getfpdBuildOpts().getOptions().getOptionList() == null) {
- return ;
- }
-
- List<OptionDocument.Option> lOpt = getfpdBuildOpts().getOptions().getOptionList();
- ListIterator li = lOpt.listIterator();
- int i = 0;
- while(li.hasNext()) {
- OptionDocument.Option opt = (OptionDocument.Option)li.next();
- if (opt.getBuildTargets() != null) {
- saa[i][0] = listToString(opt.getBuildTargets());
- }
- saa[i][1] = opt.getToolChainFamily();
- if (opt.getSupArchList() != null){
- saa[i][2] = listToString(opt.getSupArchList());
-
- }
- saa[i][3] = opt.getToolCode();
- saa[i][4] = opt.getTagName();
- saa[i][5] = opt.getStringValue();
-
- ++i;
- }
- }
-
- public void genBuildOptionsFfs(String ffsKey, String type) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getfpdBuildOpts().addNewFfs();
- ffs.setFfsKey(ffsKey);
- if (type != null) {
- ffs.addNewSections().setEncapsulationType(type);
- }
- }
-
- public void updateBuildOptionsFfsSectionsType(int i, String type) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- ffs.getSections().setEncapsulationType(type);
- }
-
- public void genBuildOptionsFfsAttribute(int i, String name, String value) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Attribute attrib = ffs.addNewAttribute();
- attrib.setName(name);
- attrib.setValue(value);
- }
-
- /**update jth attribute of ith ffs.
- * @param i
- * @param j
- */
- public void updateBuildOptionsFfsAttribute(int i, int j, String name, String value){
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- XmlCursor cursor = ffs.newCursor();
- QName qAttrib = new QName(xmlNs, "Attribute");
- if (cursor.toChild(qAttrib)) {
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qAttrib);
- }
- BuildOptionsDocument.BuildOptions.Ffs.Attribute attrib = (BuildOptionsDocument.BuildOptions.Ffs.Attribute)cursor.getObject();
- attrib.setName(name);
- attrib.setValue(value);
- }
- cursor.dispose();
- }
-
- public void removeBuildOptionsFfsAttribute(int i, int j){
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- XmlCursor cursor = ffs.newCursor();
- QName qAttrib = new QName(xmlNs, "Attribute");
- if (cursor.toChild(qAttrib)) {
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qAttrib);
- }
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- public void genBuildOptionsFfsSectionsSection(int i, String sectionType) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- if (ffs == null) {
- return;
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
-
- if (sections == null){
- sections = ffs.addNewSections();
- }
- sections.addNewSection().setSectionType(EfiSectionType.Enum.forString(sectionType));
- }
-
- public void removeBuildOptionsFfsSectionsSection(int i, int j) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- if (sections == null) {
- return;
- }
- XmlCursor cursor = sections.newCursor();
- QName qSection = new QName(xmlNs, "Section");
- if (cursor.toChild(qSection)) {
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qSection);
- }
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- public void updateBuildOptionsFfsSectionsSection(int i, int j, String type){
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- if (sections == null) {
- return;
- }
- XmlCursor cursor = sections.newCursor();
- QName qSection = new QName(xmlNs, "Section");
- if (cursor.toChild(qSection)) {
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qSection);
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Section section = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Section)cursor.getObject();
- section.setSectionType(EfiSectionType.Enum.forString(type));
- }
- cursor.dispose();
- }
-
- public void genBuildOptionsFfsSectionsSections(int i, String encapType) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- if (ffs == null) {
- return;
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
-
- if (sections == null){
- sections = ffs.addNewSections();
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2 sections2 = sections.addNewSections();
- sections2.setEncapsulationType(encapType);
- sections2.addNewSection().setSectionType(EfiSectionType.Enum.forString("EFI_SECTION_PE32"));
- }
-
- public void removeBuildOptionsFfsSectionsSections(int i, int j) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- if (sections == null) {
- return;
- }
- XmlCursor cursor = sections.newCursor();
- QName qSections = new QName(xmlNs, "Sections");
- if (cursor.toChild(qSections)) {
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qSections);
- }
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- public void updateBuildOptionsFfsSectionsSections(int i, int j, String type) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- if (sections == null) {
- return;
- }
- XmlCursor cursor = sections.newCursor();
- QName qSections = new QName(xmlNs, "Sections");
- if (cursor.toChild(qSections)) {
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qSections);
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2 sections2 = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2)cursor.getObject();
- sections2.setEncapsulationType(type);
- }
- cursor.dispose();
- }
-
- public void genBuildOptionsFfsSectionsSectionsSection(int i, int j, String type) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- if (ffs == null) {
- return;
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- XmlCursor cursor = sections.newCursor();
- QName qSections = new QName(xmlNs, "Sections");
- if (cursor.toChild(qSections)){
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qSections);
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2 sections2 = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2)cursor.getObject();
- sections2.addNewSection().setSectionType(EfiSectionType.Enum.forString(type));
- }
- cursor.dispose();
- }
-
- public void removeBuildOptionsFfsSectionsSectionsSection(int i, int j, int k) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- if (sections == null) {
- return;
- }
- XmlCursor cursor = sections.newCursor();
- QName qSections = new QName(xmlNs, "Sections");
- if (cursor.toChild(qSections)) {
- for (int l = 0; l < j; ++l) {
- cursor.toNextSibling(qSections);
- }
- if (cursor.toFirstChild()) {
- int m = 0;
- for (; m < k; ++m) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- if (m == 0) {
- cursor.toParent();
- cursor.removeXml();
- }
- }
- }
- cursor.dispose();
- }
-
- public void updateBuildOptionsFfsSectionsSectionsSection(int i, int j, int k, String type) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- if (sections == null) {
- return;
- }
- XmlCursor cursor = sections.newCursor();
- QName qSections = new QName(xmlNs, "Sections");
- if (cursor.toChild(qSections)) {
- for (int l = 0; l < j; ++l) {
- cursor.toNextSibling(qSections);
- }
- if (cursor.toFirstChild()) {
- for (int m = 0; m < k; ++m) {
- cursor.toNextSibling();
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section section = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section)cursor.getObject();
- section.setSectionType(EfiSectionType.Enum.forString(type));
- }
- }
- cursor.dispose();
- }
-
- public void getBuildOptionsFfsSectionsSectionsSection(int i, int j, ArrayList<String> al) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- if (ffs == null) {
- return;
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections sections = ffs.getSections();
- XmlCursor cursor = sections.newCursor();
- QName qSections = new QName(xmlNs, "Sections");
- if (cursor.toChild(qSections)){
- for (int k = 0; k < j; ++k) {
- cursor.toNextSibling(qSections);
- }
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2 sections2 = (BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2)cursor.getObject();
- if (sections2.getSectionList() == null){
- cursor.dispose();
- return;
- }
- ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section> li = sections2.getSectionList().listIterator();
- while(li.hasNext()) {
- BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section section = li.next();
-// if (section.isSetSectionType()) {
- al.add(section.getSectionType()+"");
-// }
-
- }
- }
- cursor.dispose();
-
- }
-
- public int getBuildOptionsFfsCount(){
- if (getfpdBuildOpts().getFfsList() == null) {
- return 0;
- }
- return getfpdBuildOpts().getFfsList().size();
- }
-
- public void getBuildOptionsFfsKey(String[][] saa) {
- if (getfpdBuildOpts().getFfsList() == null) {
- return;
- }
- ListIterator<BuildOptionsDocument.BuildOptions.Ffs> li = getfpdBuildOpts().getFfsList().listIterator();
- int i = 0;
- while(li.hasNext()){
- BuildOptionsDocument.BuildOptions.Ffs ffs = li.next();
- saa[i][0] = ffs.getFfsKey();
- ++i;
- }
- }
-
- public void updateBuildOptionsFfsKey(int i, String key) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- ffs.setFfsKey(key);
- }
-
- /**Get ith FFS key and contents.
- * @param saa
- */
- public void getBuildOptionsFfs(int i, String[] sa, LinkedHashMap<String, String> ffsAttribMap, ArrayList<String> firstLevelSections, ArrayList<String> firstLevelSection) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
-
- if (ffs != null) {
-
- sa[0] = ffs.getFfsKey();
- if (ffs.getSections() != null) {
- if(ffs.getSections().getEncapsulationType() != null){
- sa[1] = ffs.getSections().getEncapsulationType();
- }
- if (ffs.getSections().getSectionList() != null){
- ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Sections.Section> li = ffs.getSections().getSectionList().listIterator();
- while (li.hasNext()) {
- firstLevelSection.add(li.next().getSectionType()+"");
- }
- }
- if (ffs.getSections().getSectionsList() != null) {
- ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2> li = ffs.getSections().getSectionsList().listIterator();
- while(li.hasNext()) {
- firstLevelSections.add(li.next().getEncapsulationType());
- }
- }
- }
- if (ffs.getAttributeList() != null) {
- ListIterator<BuildOptionsDocument.BuildOptions.Ffs.Attribute> li = ffs.getAttributeList().listIterator();
- while(li.hasNext()) {
- BuildOptionsDocument.BuildOptions.Ffs.Attribute attrib = li.next();
- ffsAttribMap.put(attrib.getName(), attrib.getValue());
- }
-
- }
- }
-
-
- }
-
- private BuildOptionsDocument.BuildOptions.Ffs getFfs(int i) {
- XmlObject o = getfpdBuildOpts();
- BuildOptionsDocument.BuildOptions.Ffs ffs = null;
-
- XmlCursor cursor = o.newCursor();
- QName qFfs = new QName(xmlNs, "Ffs");
- if (cursor.toChild(qFfs)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFfs);
- }
- ffs = (BuildOptionsDocument.BuildOptions.Ffs)cursor.getObject();
- }
- cursor.dispose();
- return ffs;
- }
-
- public void removeBuildOptionsFfs(int i) {
- BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i);
- if (ffs == null){
- return;
- }
-
- XmlCursor cursor = ffs.newCursor();
- cursor.removeXml();
- cursor.dispose();
- }
-
-
-
- public PlatformDefinitionsDocument.PlatformDefinitions getfpdPlatformDefs(){
- if (fpdPlatformDefs == null){
- fpdPlatformDefs = fpdRoot.addNewPlatformDefinitions();
- }
- return fpdPlatformDefs;
- }
-
- public void getPlatformDefsSupportedArchs(Vector<Object> archs){
- if (getfpdPlatformDefs().getSupportedArchitectures() == null) {
- return;
- }
- ListIterator li = getfpdPlatformDefs().getSupportedArchitectures().listIterator();
- while(li.hasNext()) {
- archs.add(li.next());
- }
- }
-
- public void setPlatformDefsSupportedArchs(Vector<Object> archs) {
- if (archs != null) {
- getfpdPlatformDefs().setSupportedArchitectures(archs);
- }
-// else {
-// XmlCursor cursor = getfpdPlatformDefs().newCursor();
-// if (cursor.toChild(xmlNs, "SupportedArchitectures")) {
-// cursor.removeXml();
-// }
-// cursor.dispose();
-// }
- }
-
- public void getPlatformDefsBuildTargets(Vector<Object> targets) {
- if (getfpdPlatformDefs().getBuildTargets() == null) {
- return;
- }
- ListIterator li = getfpdPlatformDefs().getBuildTargets().listIterator();
- while(li.hasNext()) {
- targets.add(li.next());
- }
- }
-
- public void setPlatformDefsBuildTargets(Vector<Object> targets) {
- getfpdPlatformDefs().setBuildTargets(targets);
- }
-
- public void genPlatformDefsSkuInfo(String id, String name) {
- SkuInfoDocument.SkuInfo skuInfo = null;
- if (getfpdPlatformDefs().getSkuInfo() == null) {
- skuInfo = getfpdPlatformDefs().addNewSkuInfo();
- }
- skuInfo = getfpdPlatformDefs().getSkuInfo();
- if (skuInfo.getUiSkuNameList() == null || skuInfo.getUiSkuNameList().size() == 0) {
- SkuInfoDocument.SkuInfo.UiSkuName skuName = skuInfo.addNewUiSkuName();
- skuName.setSkuID(new BigInteger("0"));
- skuName.setStringValue("DEFAULT");
- }
- if (id.equals("0")) {
- return;
- }
- SkuInfoDocument.SkuInfo.UiSkuName skuName = skuInfo.addNewUiSkuName();
- skuName.setSkuID(new BigInteger(id));
- skuName.setStringValue(name);
- }
-
- public int getPlatformDefsSkuInfoCount(){
- if (getfpdPlatformDefs().getSkuInfo() == null || getfpdPlatformDefs().getSkuInfo().getUiSkuNameList() == null) {
- return 0;
- }
- return getfpdPlatformDefs().getSkuInfo().getUiSkuNameList().size();
- }
-
- public void getPlatformDefsSkuInfos(String[][] saa){
- if (getfpdPlatformDefs().getSkuInfo() == null || getfpdPlatformDefs().getSkuInfo().getUiSkuNameList() == null) {
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null) {
- removeElement(getfpdDynPcdBuildDefs());
- fpdDynPcdBuildDefs = null;
- }
- return ;
- }
-
- List<SkuInfoDocument.SkuInfo.UiSkuName> l = getfpdPlatformDefs().getSkuInfo().getUiSkuNameList();
- ListIterator<SkuInfoDocument.SkuInfo.UiSkuName> li = l.listIterator();
- int i = 0;
- while(li.hasNext()) {
- SkuInfoDocument.SkuInfo.UiSkuName sku = li.next();
- saa[i][0] = sku.getSkuID()+"";
- saa[i][1] = sku.getStringValue();
- ++i;
- }
- }
-
- public void removePlatformDefsSkuInfo(int i) {
- SkuInfoDocument.SkuInfo skuInfo = getfpdPlatformDefs().getSkuInfo();
- if (skuInfo == null || i == 0) {
- return ;
- }
-
- XmlCursor cursor = skuInfo.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- public void updatePlatformDefsSkuInfo(int i, String id, String name) {
- SkuInfoDocument.SkuInfo skuInfo = getfpdPlatformDefs().getSkuInfo();
- if (skuInfo == null || i == 0) {
- return ;
- }
-
- XmlCursor cursor = skuInfo.newCursor();
- if (cursor.toFirstChild()) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling();
- }
- SkuInfoDocument.SkuInfo.UiSkuName sku = (SkuInfoDocument.SkuInfo.UiSkuName)cursor.getObject();
- sku.setSkuID(new BigInteger(id));
- sku.setStringValue(name);
- }
- cursor.dispose();
- }
-
- public String getPlatformDefsInterDir(){
- if (getfpdPlatformDefs().getIntermediateDirectories() == null) {
- return null;
- }
- return getfpdPlatformDefs().getIntermediateDirectories().toString();
- }
-
- public void setPlatformDefsInterDir(String interDir){
- getfpdPlatformDefs().setIntermediateDirectories(IntermediateOutputType.Enum.forString(interDir));
- }
-
- public String getPlatformDefsOutputDir() {
- return getfpdPlatformDefs().getOutputDirectory();
- }
-
- public void setPlatformDefsOutputDir(String outputDir) {
- if (outputDir != null && outputDir.length() > 0) {
- getfpdPlatformDefs().setOutputDirectory(outputDir);
- }
- else{
- XmlCursor cursor = getfpdPlatformDefs().newCursor();
- if (cursor.toChild(new QName(xmlNs, "OutputDirectory"))) {
- cursor.removeXml();
- }
- cursor.dispose();
- }
- }
-
- public FlashDocument.Flash getfpdFlash() {
- if (fpdFlash == null) {
- fpdFlash = fpdRoot.addNewFlash();
- }
- return fpdFlash;
- }
-
- public void genFlashDefinitionFile(String file) {
- FlashDefinitionFileDocument.FlashDefinitionFile fdf = getfpdFlash().getFlashDefinitionFile();
- if (fdf == null) {
- fdf = getfpdFlash().addNewFlashDefinitionFile();
- }
-
- fdf.setStringValue(file);
- }
-
- public String getFlashDefinitionFile() {
- FlashDefinitionFileDocument.FlashDefinitionFile fdf = getfpdFlash().getFlashDefinitionFile();
- if (fdf == null) {
- return "";
- }
-
- return fdf.getStringValue();
- }
-
- public void genFvImagesNameValue(String name, String value) {
-
- FvImagesDocument.FvImages fi = getfpdFlash().getFvImages();
- if (fi == null) {
- fi = getfpdFlash().addNewFvImages();
- }
-
- FvImagesDocument.FvImages.NameValue nv = fi.addNewNameValue();
- nv.setName(name);
- nv.setValue(value);
- }
-
- public void removeFvImagesNameValue(int i){
-
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
-
- QName qNameValue = new QName(xmlNs, "NameValue");
- XmlCursor cursor = o.newCursor();
- if (cursor.toChild(qNameValue)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qNameValue);
- }
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- public void updateFvImagesNameValue(int i, String name, String value){
-
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
-
- QName qNameValue = new QName(xmlNs, "NameValue");
- XmlCursor cursor = o.newCursor();
- if (cursor.toChild(qNameValue)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qNameValue);
- }
- FvImagesDocument.FvImages.NameValue nv = (FvImagesDocument.FvImages.NameValue)cursor.getObject();
- nv.setName(name);
- nv.setValue(value);
- }
- cursor.dispose();
- }
-
- public int getFvImagesNameValueCount() {
-
- FvImagesDocument.FvImages fi = null;
- if ((fi = getfpdFlash().getFvImages()) == null || fi.getNameValueList() == null) {
- return 0;
- }
- return fi.getNameValueList().size();
- }
-
- public void getFvImagesNameValues(String[][] nv) {
-
- FvImagesDocument.FvImages fi = getfpdFlash().getFvImages();
- if (fi == null){
- return;
- }
- List<FvImagesDocument.FvImages.NameValue> l = fi.getNameValueList();
- int i = 0;
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.NameValue e = (FvImagesDocument.FvImages.NameValue) li
- .next();
- nv[i][0] = e.getName();
- nv[i][1] = e.getValue();
-
- i++;
- }
- }
-
- public void getFvImagesFvImageFvImageNames (Vector<String> vImageNames) {
- FvImagesDocument.FvImages fis = getfpdFlash().getFvImages();
- if (fis == null || fis.getFvImageList() == null) {
- return;
- }
-
- ListIterator<FvImagesDocument.FvImages.FvImage> li = fis.getFvImageList().listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = li.next();
- if (fi.getType().toString().equals("ImageName")) {
- vImageNames.addAll(fi.getFvImageNamesList());
- return;
- }
- }
- }
-
- public void addFvImageFvImageNames (String[] fvNames) {
- FvImagesDocument.FvImages fis = getfpdFlash().getFvImages();
- if (fis == null || fis.getFvImageList() == null) {
- genFvImagesFvImage (fvNames, "ImageName", null);
- return;
- }
-
- ListIterator<FvImagesDocument.FvImages.FvImage> li = fis.getFvImageList().listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = li.next();
- if (fi.getType().toString().equals("ImageName")) {
- addFvImageNamesInFvImage (fi, fvNames);
- return;
- }
- }
- genFvImagesFvImage (fvNames, "ImageName", null);
- }
-
- public void addFvImageNamesInFvImage (FvImagesDocument.FvImages.FvImage fi, String[] fvNames) {
-
- for (int i = 0; i < fvNames.length; ++i) {
- fi.addFvImageNames(fvNames[i]);
- }
- }
-
- public void addFvImageNamesInFvImage (int i, String[] fvNames) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- addFvImageNamesInFvImage(fi, fvNames);
- }
- cursor.dispose();
- }
-
- public void genFvImagesFvImage(String[] names, String types, Map<String, String> options) {
-
- FvImagesDocument.FvImages fis = null;
- if ((fis = getfpdFlash().getFvImages()) == null) {
- fis = getfpdFlash().addNewFvImages();
- }
-
- //
- //gen FvImage with FvImageNames array
- //
- FvImagesDocument.FvImages.FvImage fi = fis.addNewFvImage();
- for (int i = 0; i < names.length; ++i) {
- fi.addFvImageNames(names[i]);
- }
- fi.setType(FvImageTypes.Enum.forString(types));
- if (options != null){
- setFvImagesFvImageFvImageOptions(options, fi);
- }
- }
-
- private void setFvImagesFvImageFvImageOptions(Map<String, String> options, FvImagesDocument.FvImages.FvImage fi){
- FvImagesDocument.FvImages.FvImage.FvImageOptions fio = fi.getFvImageOptions();
- if (fio == null){
- fio = fi.addNewFvImageOptions();
- }
-
- Set<String> key = options.keySet();
- Iterator<String> i = key.iterator();
- while (i.hasNext()) {
-
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = fio.addNewNameValue();
- String k = (String)i.next();
-
- nv.setName(k);
- nv.setValue((String)options.get(k));
-
- }
-
- }
-
-
- public void removeFvImagesFvImage(int i) {
-
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
-
- QName qFvImage = new QName(xmlNs, "FvImage");
- XmlCursor cursor = o.newCursor();
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- cursor.removeXml();
- }
- cursor.dispose();
- }
-
- /**
- * @param oldFvName
- * @param newFvName The New FV Name. If null, remove the old FvImageNames entry.
- */
- public void updateFvImageNameAll (String oldFvName, String newFvName) {
- if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {
- return;
- }
- ListIterator<FvImagesDocument.FvImages.FvImage> li = getfpdFlash().getFvImages().getFvImageList().listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = li.next();
- updateFvImageNamesInFvImage (fi, oldFvName, newFvName);
- if (fi.getFvImageNamesList().size() == 0) {
- li.remove();
- }
- }
- }
-
- public void updateFvImageNamesInFvImage (int i, String oldFvName, String newFvName) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- updateFvImageNamesInFvImage (fi, oldFvName, newFvName);
- }
- cursor.dispose();
- }
- /**
- * @param fi
- * @param oldFvName The FV Name to be replaced.
- * @param newFvName The New FV Name. If null, remove the old FvImageNames entry.
- */
- public void updateFvImageNamesInFvImage (FvImagesDocument.FvImages.FvImage fi, String oldFvName, String newFvName) {
- QName qFvImageNames = new QName(xmlNs, "FvImageNames");
- XmlCursor cursor = fi.newCursor();
-
- if (cursor.toChild(qFvImageNames)) {
- do {
- String xmlValue = cursor.getTextValue();
- if (xmlValue.equals(oldFvName)){
- if (newFvName != null) {
- cursor.setTextValue(newFvName);
- }
- else {
- cursor.removeXml();
- }
- }
- }while (cursor.toNextSibling(qFvImageNames));
- }
-
- cursor.dispose();
- }
-
- /**update the Type attribute of ith FvImage with new type.
- * @param i
- * @param type
- */
- public void updateFvImagesFvImageType (int i, String type) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- fi.setType(FvImageTypes.Enum.forString(type));
- }
- cursor.dispose();
- }
-
- public void updateFvImagesFvImage(int i, String[] names, String types, Map<String, String> options){
-
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- fi.setType(FvImageTypes.Enum.forString(types));
-
- //
- // remove old FvImageNames before adding new ones
- //
- QName qFvImageNames = new QName(xmlNs, "FvImageNames");
- cursor.toChild(qFvImageNames);
- cursor.removeXml();
- while (cursor.toNextSibling(qFvImageNames)) {
- cursor.removeXml();
- }
-
- for (int k = 0; k < names.length; ++k) {
- fi.addFvImageNames(names[k]);
- }
- //
- // remove old FvImageOptions before adding new options
- //
- QName qFvImageOptions = new QName(xmlNs, "FvImageOptions");
- cursor.toNextSibling(qFvImageOptions);
- cursor.removeXml();
-
- setFvImagesFvImageFvImageOptions(options, fi);
- }
- cursor.dispose();
- }
-
- public int getFvImagesFvImageCount(String type) {
-
- if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {
- return 0;
- }
- List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
- ListIterator li = l.listIterator();
- int i = 0;
- while(li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
- if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
- continue;
- }
-
- ++i;
- }
-
- return i;
- }
-
- public Vector<FvImagesDocument.FvImages.FvImage> getFvImagesFvImageWithName (String fvName, String type) {
- Vector<FvImagesDocument.FvImages.FvImage> vFvImage = new Vector<FvImagesDocument.FvImages.FvImage>();
- if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {
- return vFvImage;
- }
- List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
- ListIterator li = l.listIterator();
- while(li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
- if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
- continue;
- }
- if (fi.getFvImageNamesList().contains(fvName)) {
- vFvImage.add(fi);
- }
- }
-
- return vFvImage;
- }
- /**
- * @param saa
- * @param type "ALL" means all FvImage types: ImageName, Options, Attributes, Components.
- */
- public void getFvImagesFvImages(String[][] saa, String type) {
-
- if (getfpdFlash().getFvImages() == null) {
- return;
- }
- List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
- if (l == null) {
- return;
- }
- ListIterator li = l.listIterator();
- int i = 0;
- while(li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
- if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
- continue;
- }
- //
- // get FvImageNames array, space separated
- //
- List<String> lfn = fi.getFvImageNamesList();
- ListIterator lfni = lfn.listIterator();
- saa[i][0] = " ";
- while (lfni.hasNext()) {
- saa[i][0] += (String)lfni.next();
- saa[i][0] += " ";
- }
- saa[i][0] = saa[i][0].trim();
-
- saa[i][1] = fi.getType()+"";
-
- ++i;
- }
- }
-
- public void removeFvImageNameValue (int i, String attributeName) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- removeFvImageNameValue (fi, attributeName);
- }
- cursor.dispose();
- }
- /**Remove from fi the attribute pair with attributeName in FvImageOptions.
- * @param fi
- * @param attributeName
- */
- public void removeFvImageNameValue (FvImagesDocument.FvImages.FvImage fi, String attributeName) {
- if (fi.getFvImageOptions() != null && fi.getFvImageOptions().getNameValueList() != null) {
- ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions().getNameValueList().listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = li.next();
- if (nv.getName().equals(attributeName)) {
- li.remove();
- }
- }
- }
- }
-
- public void removeTypedNamedFvImageNameValue (String fvName, String type, String optName) {
- Vector<FvImagesDocument.FvImages.FvImage> vFvImage = getFvImagesFvImageWithName(fvName, type);
- for (int i = 0; i < vFvImage.size(); ++i) {
- FvImagesDocument.FvImages.FvImage fi = vFvImage.get(i);
- removeFvImageNameValue (fi, optName);
- }
- }
-
- /**Add name-value pair to FvImage element with type.
- * @param fvName FV name to add name-value pair.
- * @param type FvImage attribute.
- * @param name
- * @param value
- */
- public void setTypedNamedFvImageNameValue (String fvName, String type, String name, String value, String newName) {
- boolean fvImageExists = false;
- if (getfpdFlash().getFvImages() != null) {
-
- List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
- if (l != null) {
- ListIterator li = l.listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage) li.next();
- if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
- continue;
- }
- if (!fi.getFvImageNamesList().contains(fvName)) {
- continue;
- }
- fvImageExists = true;
- setFvImagesFvImageNameValue(fi, name, value, newName);
- }
- }
- }
-
- if (!fvImageExists) {
- HashMap<String, String> map = new HashMap<String, String>();
- map.put(name, value);
- genFvImagesFvImage(new String[] { fvName }, type, map);
- }
- }
-
- /**Add to all FvImage elements with type, the name-value pair.
- * @param type
- * @param name
- * @param value
- */
- public void setTypedFvImageNameValue (String type, String name, String value) {
- if (getfpdFlash().getFvImages() == null) {
- return;
- }
- List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();
- if (l == null) {
- return;
- }
- ListIterator li = l.listIterator();
- while(li.hasNext()) {
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();
- if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {
- continue;
- }
- setFvImagesFvImageNameValue (fi, name, value, null);
- }
-
- }
-
- public void setFvImagesFvImageNameValue (int i, String name, String value) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- setFvImagesFvImageNameValue (fi, name, value, null);
- }
- cursor.dispose();
- }
-
- /**Add to FvImage the name-value pair, or replace old name with newName, or generate new name-value pair if not exists before.
- * @param fi
- * @param name
- * @param value
- * @param newName
- */
- public void setFvImagesFvImageNameValue (FvImagesDocument.FvImages.FvImage fi, String name, String value, String newName) {
- if (fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null) {
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = fi.addNewFvImageOptions().addNewNameValue();
- nv.setName(name);
- nv.setValue(value);
- if (newName != null && !newName.equals(name)) {
- nv.setName(newName);
- }
- return;
- }
-
- XmlCursor cursor = fi.getFvImageOptions().newCursor();
- if (cursor.toFirstChild()) {
- do {
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = (FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue)cursor.getObject();
- if (nv.getName().equals(name)) {
- nv.setValue(value);
- if (newName != null && !newName.equals(name)) {
- nv.setName(newName);
- }
- cursor.dispose();
- return;
- }
- }while (cursor.toNextSibling());
- }
-
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = fi.getFvImageOptions().addNewNameValue();
- nv.setName(name);
- nv.setValue(value);
- if (newName != null && !newName.equals(name)) {
- nv.setName(newName);
- }
- cursor.dispose();
- }
-
- public void getFvImagesFvImageOptions (String fvName, Map<String, String> m) {
- Vector<FvImagesDocument.FvImages.FvImage> vFvImage = getFvImagesFvImageWithName (fvName, "Options");
- for (int i = 0; i < vFvImage.size(); ++i) {
- FvImagesDocument.FvImages.FvImage fi = vFvImage.get(i);
- if (fi == null || fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null) {
- continue;
- }
-
- ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions()
- .getNameValueList()
- .listIterator();
- while (li.hasNext()) {
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = li.next();
- m.put(nv.getName(), nv.getValue());
- }
- }
- }
-
- public int getFvImagePosInFvImages (String fvNameList, String type) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return -1;
- }
-
- int pos = -1;
- String[] fvNameArray = fvNameList.trim().split(" ");
- Vector<String> vFvNames = new Vector<String>();
-
-
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- do {
- pos++;
- vFvNames.removeAllElements();
- for (int i = 0; i < fvNameArray.length; ++i) {
- vFvNames.add(fvNameArray[i]);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- if (!fi.getType().toString().equals(type)) {
- continue;
- }
- if (fi.getFvImageNamesList() == null || fi.getFvImageNamesList().size() != vFvNames.size()) {
- continue;
- }
- ListIterator<String> li = fi.getFvImageNamesList().listIterator();
- while (li.hasNext()) {
- String name = li.next();
- vFvNames.remove(name);
- }
- if (vFvNames.size() == 0) {
- cursor.dispose();
- return pos;
- }
-
- }while (cursor.toNextSibling(qFvImage));
-
- }
- cursor.dispose();
- return -1;
- }
- /**Get FvImage Options for FvImage i
- * @param i the ith FvImage
- */
- public void getFvImagesFvImageOptions(int i, Map<String, String> m) {
- XmlObject o = getfpdFlash().getFvImages();
- if (o == null) {
- return;
- }
- XmlCursor cursor = o.newCursor();
- QName qFvImage = new QName(xmlNs, "FvImage");
- if (cursor.toChild(qFvImage)) {
- for (int j = 0; j < i; ++j) {
- cursor.toNextSibling(qFvImage);
- }
- FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();
- if (fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null){
- cursor.dispose();
- return;
- }
- ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions().getNameValueList().listIterator();
- while(li.hasNext()){
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = li.next();
- m.put(nv.getName(), nv.getValue());
- }
- }
- cursor.dispose();
- }
-
- /**
- Get platform header element
- @return PlatformHeaderDocument.PlatformHeader
- **/
- public PlatformHeaderDocument.PlatformHeader getFpdHdr() {
- if (fpdHdr == null) {
- fpdHdr = fpdRoot.addNewPlatformHeader();
- }
-
- return fpdHdr;
- }
-
- public String getFpdHdrPlatformName() {
- return getFpdHdr().getPlatformName();
- }
-
- public String getFpdHdrGuidValue() {
- return getFpdHdr().getGuidValue();
- }
-
- public String getFpdHdrVer() {
- return getFpdHdr().getVersion();
- }
-
- public String getFpdHdrAbs() {
- return getFpdHdr().getAbstract();
- }
-
- public String getFpdHdrDescription() {
- return getFpdHdr().getDescription();
- }
-
- public String getFpdHdrCopyright() {
- return getFpdHdr().getCopyright();
- }
-
- public String getFpdHdrLicense() {
- LicenseDocument.License l = getFpdHdr().getLicense();
- if (l == null) {
- return null;
- }
- return l.getStringValue();
- }
-
- public String getFpdHdrUrl() {
- LicenseDocument.License l = getFpdHdr().getLicense();
- if (l == null) {
- return null;
- }
- return l.getURL();
- }
-
- public String getFpdHdrSpec() {
-
- return "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
-// return getFpdHdr().getSpecification();
- }
-
- public void setFpdHdrPlatformName(String name){
- getFpdHdr().setPlatformName(name);
- }
-
- public void setFpdHdrGuidValue(String guid){
- getFpdHdr().setGuidValue(guid);
- }
-
- public void setFpdHdrVer(String v){
- getFpdHdr().setVersion(v);
- }
-
- public void setFpdHdrAbs(String abs) {
- getFpdHdr().setAbstract(abs);
- }
-
- public void setFpdHdrDescription(String desc){
- getFpdHdr().setDescription(desc);
- }
-
- public void setFpdHdrCopyright(String cr) {
- getFpdHdr().setCopyright(cr);
- }
-
- public void setFpdHdrLicense(String license){
- LicenseDocument.License l = getFpdHdr().getLicense();
- if (l == null) {
- getFpdHdr().addNewLicense().setStringValue(license);
- }
- else {
- l.setStringValue(license);
- }
- }
-
- public void setFpdHdrUrl(String url){
- LicenseDocument.License l = getFpdHdr().getLicense();
-
- l.setURL(url);
-
- }
-
- public void setFpdHdrSpec(String s){
- s = "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
- getFpdHdr().setSpecification(s);
- }
- /**
- Save the processed xml contents to file
-
- @param fpdFile The file to save xml contents
- @throws IOException Exceptions during file operation
- **/
- public void saveAs(File fpdFile) throws IOException {
-
- XmlOptions options = new XmlOptions();
-
- options.setCharacterEncoding("UTF-8");
- options.setSavePrettyPrint();
- options.setSavePrettyPrintIndent(2);
- try {
- fpdd.save(fpdFile, options);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
-
- private String listToString(List l) {
- if (l == null) {
- return null;
- }
- String s = " ";
- ListIterator li = l.listIterator();
- while(li.hasNext()) {
- s += li.next();
- s += " ";
- }
- return s.trim();
- }
-
- private void removeElement(XmlObject o) {
- XmlCursor cursor = o.newCursor();
- cursor.removeXml();
- cursor.dispose();
- }
-}
-
-class PcdItemTypeConflictException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private String details = null;
-
- PcdItemTypeConflictException (String pcdName, String info) {
- ModuleIdentification mi = WorkspaceProfile.getModuleId(info);
- if (mi != null) {
- details = pcdName + " ItemType Conflicts with " + mi.getName() + "\n in Pkg " + mi.getPackageId().getName();
- }
- else {
- details = pcdName + " ItemType Conflicts with \n" + info;
- }
- }
-
- PcdItemTypeConflictException (String pcdName, String info1, String info2) {
- ModuleIdentification mi1 = WorkspaceProfile.getModuleId(info1);
- ModuleIdentification mi2 = WorkspaceProfile.getModuleId(info2);
- String moduleInfo1 = "";
- String moduleInfo2 = "";
- if (mi1 != null) {
- moduleInfo1 = mi1.getName() + " in Pkg " + mi1.getPackageId().getName();
- }
- else {
- moduleInfo1 = info1;
- }
-
- if (mi2 != null) {
- moduleInfo2 = mi2.getName() + " in Pkg " + mi2.getPackageId().getName();
- }
- else {
- moduleInfo2 = info2;
- }
-
- details = pcdName + " ItemType Conflicts in \n" + moduleInfo1 + "\n and " + moduleInfo2;
- }
-
- public String getMessage() {
- return details;
- }
-}
-
-class PcdDeclNotFound extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private String details = null;
-
- PcdDeclNotFound(String info) {
- details = "PcdDeclNotFound: " + info;
- }
-
- public String getMessage() {
- return details;
- }
-}
-
-class PcdValueMalFormed extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private String details = null;
-
- PcdValueMalFormed(String info) {
- details = "PcdValueMalFormed: " + info;
- }
-
- public String getMessage() {
- return details;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java deleted file mode 100644 index 29a6219e51..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java +++ /dev/null @@ -1,3239 +0,0 @@ -/** @file
- Java class FpdFlash is GUI for Flash element operation in SPD file.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import javax.swing.JPanel;
-
-import javax.swing.AbstractAction;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JTabbedPane;
-import javax.swing.JButton;
-import javax.swing.ListSelectionModel;
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.JCheckBox;
-import javax.swing.JTextField;
-import java.awt.GridLayout;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-import javax.swing.JComboBox;
-import java.awt.Dimension;
-import javax.swing.JSplitPane;
-
-public class FpdFlash extends IInternalFrame {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private final int startIndexOfDynamicTab = 2;
- private JPanel jContentPane = null;
- private JPanel jPanelContentEast = null;
- private JPanel jPanelContentSouth = null;
- private JPanel jPanelContentWest = null;
- private JPanel jPanelContentNorth = null;
- private JTabbedPane jTabbedPane = null;
- private JPanel jPanelFvImages = null;
- private JPanel jPanelFvImageS = null;
- private JPanel jPanelFvImageN = null;
- private JCheckBox jCheckBoxFvProperty = null;
- private JLabel jLabelFvPropName = null;
- private JTextField jTextFieldFvPropName = null;
- private JLabel jLabelFvPropValue = null;
- private JTextField jTextFieldFvPropValue = null;
- private JButton jButtonFvPropAdd = null;
- private JScrollPane jScrollPaneFvProp = null;
- private JTable jTableFvProp = null;
- private JPanel jPanelFvPropButtonGroup = null;
- private JButton jButtonFvPropDel = null;
- private DefaultTableModel fvPropertyTableModel = null;
- private DefaultTableModel fvImageNameTableModel = null;
- private ImageParaTableModel fvImageParaTableModel = null;
- private DefaultTableModel fvOptionTableModel = null;
- private JPanel jPanelFvImageC = null;
- private JLabel jLabelFvParaType = null;
- private JComboBox jComboBoxFvParaType = null;
- private JLabel jLabelFvImageNames = null;
- private JLabel jLabelFvParaName = null;
- private JTextField jTextFieldFvParaName = null;
- private JButton jButtonFvNameAdd = null;
- private JScrollPane jScrollPaneFvImageNames = null;
- private JTable jTableFvImageNames = null;
- private JButton jButtonFvNameDel = null;
- private JPanel jPanelFvImageOpts = null;
- private JButton jButtonAddFvImage = null;
- private JScrollPane jScrollPaneFvInfo = null;
- private JTable jTableFvInfo = null;
- private JButton jButtonDelFvImage = null;
- private JPanel jPanelFvImagePara = null;
- private OpeningPlatformType docConsole = null;
- private FpdFileContents ffc = null;
- private JPanel jPanelFdf = null;
- private JCheckBox jCheckBoxFdf = null;
- private JTextField jTextFieldFdf = null;
- private JButton jButtonFdfBrowse = null;
- private JLabel jLabelFvImageOptName = null;
- private JTextField jTextFieldFvImageOptName = null;
- private JLabel jLabelFvImageOptValue = null;
- private JTextField jTextFieldFvImageOptValue = null;
- private JPanel jPanelFvImageOptsButtonGroup = null;
- private JButton jButtonFvImageOptAdd = null;
- private JButton jButtonFvImageOptDel = null;
- private JScrollPane jScrollPane = null;
- private JTable jTableFvImageOpts = null;
- private JButton jButtonUpdateFvImage = null;
- private JPanel jPanelFdfN = null;
- private JPanel jPanelFdfS = null;
- private JSplitPane jSplitPaneFdfC = null;
- private JPanel jPanelFdfCTop = null;
- private JPanel jPanelFdfCBottom = null;
- private JPanel jPanelFdfCTopN = null;
- private JPanel jPanelFdfCTopS = null;
-// private JPanel jPanelFdfCTopC = null;
- private JPanel jPanelFdfCBottomN = null;
-// private JPanel jPanelFdfCBottomC = null;
- private JLabel jLabelFvInFdf = null;
- private JLabel jLabelFvAdditional = null;
- private JScrollPane jScrollPaneFvInFdf = null;
- private JTable jTableFvInFdf = null;
- private IDefaultTableModel fvInFdfTableModel = null; // @jve:decl-index=0:visual-constraint=""
- private JButton jButtonFvInFdfOptions = null;
- private JScrollPane jScrollPaneFvAdditional = null;
- private JTable jTableFvAdditional = null;
- private DefaultTableModel fvAdditionalTableModel = null; // @jve:decl-index=0:visual-constraint=""
- private JButton jButtonAddFv = null;
- private JButton jButtonDelFv = null;
- private JButton jButtonAddFvOptions = null;
- private int tabIndexForFv = -1;
- private int selectedRowInFvAdditionalTable = -1;
- private String oldFvName = null;
- private Vector<String> vBlockSize = new Vector<String>();
- private String determinedFvBlockSize = null;
- private final String defaultBlkSize = "0x10000";
- private String erasePolarity = "";
- boolean memModified = false;
- private FvOptsTableModel fvInFdfOptTableModel = null;
- private FvOptsTableModel fvAdditionalOptTableModel = null;
- private boolean sizeFromOptionDlg = false;
- private boolean fileFromOptionDlg = false;
- private JLabel jLabelOptions = null;
- private JPanel jPanelBgFvName = null;
- private JPanel jPanelBgFvImage = null;
- private JPanel jPanelW = null;
- private JPanel jPanelFvImageParaN = null;
- private JPanel jPanelFvImageParaS = null;
-// private JPanel jPanelFvImageParaC = null;
- private JPanel jPanelFvImageOptsN = null;
- private JPanel jPanelFvImageOptsS = null;
-// private JPanel jPanelFvImageOptsC = null;
- private JPanel jPanelFvImageParaE = null;
- private JPanel jPanelFvImageOptsE = null;
- private JPanel jPanelFvImageSN = null;
- private JPanel jPanelFvImageSE = null;
- private JPanel jPanelFvImageSS = null;
-
- public FpdFlash() {
- super();
- // TODO Auto-generated constructor stub
-
- initialize();
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
- this.setVisible(true);
- }
-
- public FpdFlash(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd){
- this();
- ffc = new FpdFileContents(fpd);
- init(ffc);
- }
-
- public FpdFlash(OpeningPlatformType opt) {
- this(opt.getXmlFpd());
- docConsole = opt;
- if (memModified) {
- docConsole.setSaved(false);
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Platform Synced with FDF file.");
- memModified = false;
- }
- }
-
- /**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentEast() {
- if (jPanelContentEast == null) {
- FlowLayout flowLayout7 = new FlowLayout();
- flowLayout7.setVgap(50);
- jPanelContentEast = new JPanel();
- jPanelContentEast.setLayout(flowLayout7);
- }
- return jPanelContentEast;
- }
-
- /**
- * This method initializes jPanel1
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentSouth() {
- if (jPanelContentSouth == null) {
- FlowLayout flowLayout = new FlowLayout();
- flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
- flowLayout.setHgap(15);
- jPanelContentSouth = new JPanel();
- jPanelContentSouth.setLayout(flowLayout);
- jPanelContentSouth.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT);
- }
- return jPanelContentSouth;
- }
-
- /**
- * This method initializes jPanel2
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentWest() {
- if (jPanelContentWest == null) {
- jPanelContentWest = new JPanel();
- }
- return jPanelContentWest;
- }
-
- /**
- * This method initializes jPanel3
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentNorth() {
- if (jPanelContentNorth == null) {
- jPanelContentNorth = new JPanel();
- }
- return jPanelContentNorth;
- }
-
- /**
- * This method initializes jTabbedPane
- *
- * @return javax.swing.JTabbedPane
- */
- private JTabbedPane getJTabbedPane() {
- if (jTabbedPane == null) {
- jTabbedPane = new JTabbedPane();
- jTabbedPane.addTab("General", null, getJPanelFdf(), null);
- jTabbedPane.addTab("Advanced", null, getJPanelFvImages(), null);
-
- }
- return jTabbedPane;
- }
-
- /**
- * This method initializes jPanelFvImages
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImages() {
- if (jPanelFvImages == null) {
- jPanelFvImages = new JPanel();
- jPanelFvImages.setLayout(new BorderLayout());
- jPanelFvImages.add(getJPanelFvImageN(), java.awt.BorderLayout.NORTH);
- jPanelFvImages.add(getJPanelFvImageS(), java.awt.BorderLayout.SOUTH);
- jPanelFvImages.add(getJPanelFvImageC(), java.awt.BorderLayout.CENTER);
- jPanelFvImages.add(getJPanelW(), java.awt.BorderLayout.EAST);
- jPanelFvImages.addComponentListener(new java.awt.event.ComponentAdapter() {
- public void componentShown(java.awt.event.ComponentEvent e) {
-// fvImageParaTableModel.setRowCount(0);
-// fvPropertyTableModel.setRowCount(0);
-
-
- }
- });
-
- }
- return jPanelFvImages;
- }
-
- /**
- * This method initializes jPanelFvImageN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageS() {
- if (jPanelFvImageS == null) {
- jLabelFvPropValue = new JLabel();
- jLabelFvPropValue.setText("Value");
- jLabelFvPropValue.setEnabled(false);
- jLabelFvPropValue.setPreferredSize(new java.awt.Dimension(38,20));
- jLabelFvPropName = new JLabel();
- jLabelFvPropName.setText("Name");
- jLabelFvPropName.setEnabled(false);
- jLabelFvPropName.setPreferredSize(new java.awt.Dimension(38,20));
- jPanelFvImageS = new JPanel();
- jPanelFvImageS.setPreferredSize(new java.awt.Dimension(576,130));
- jPanelFvImageS.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
- jPanelFvImageS.setLayout(new BorderLayout());
- jPanelFvImageS.add(getJPanelFvImageSN(), java.awt.BorderLayout.NORTH);
- jPanelFvImageS.add(getJPanelFvImageSE(), java.awt.BorderLayout.EAST);
- jPanelFvImageS.add(getJPanelFvImageSS(), java.awt.BorderLayout.SOUTH);
- jPanelFvImageS.add(getJScrollPaneFvProp(), java.awt.BorderLayout.CENTER);
-
- }
- return jPanelFvImageS;
- }
-
- /**
- * This method initializes jPanelFvImageS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageN() {
- if (jPanelFvImageN == null) {
- GridLayout gridLayout2 = new GridLayout();
- gridLayout2.setRows(1);
- jPanelFvImageN = new JPanel();
- jPanelFvImageN.setPreferredSize(new java.awt.Dimension(480,150));
- jPanelFvImageN.setLayout(gridLayout2);
- jPanelFvImageN.add(getJScrollPaneFvInfo(), null);
- }
- return jPanelFvImageN;
- }
-
-
- /**
- * This method initializes jCheckBox1
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxFvProperty() {
- if (jCheckBoxFvProperty == null) {
- jCheckBoxFvProperty = new JCheckBox();
- jCheckBoxFvProperty.setText("Global FV Variables");
- jCheckBoxFvProperty.addItemListener(new ItemListener(){
-
- public void itemStateChanged(ItemEvent arg0) {
- // TODO Auto-generated method stub
- boolean seleted = jCheckBoxFvProperty.isSelected();
-
- jLabelFvPropName.setEnabled(seleted);
- jTextFieldFvPropName.setEnabled(seleted);
- jLabelFvPropValue.setEnabled(seleted);
- jTextFieldFvPropValue.setEnabled(seleted);
- jTableFvProp.setEnabled(seleted);
- jButtonFvPropAdd.setEnabled(seleted);
- jButtonFvPropDel.setEnabled(seleted);
-
-
- }
-
- });
- }
- return jCheckBoxFvProperty;
- }
-
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFvPropName() {
- if (jTextFieldFvPropName == null) {
- jTextFieldFvPropName = new JTextField();
- jTextFieldFvPropName.setPreferredSize(new java.awt.Dimension(100,20));
- jTextFieldFvPropName.setEnabled(false);
- }
- return jTextFieldFvPropName;
- }
-
-
- /**
- * This method initializes jTextField1
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFvPropValue() {
- if (jTextFieldFvPropValue == null) {
- jTextFieldFvPropValue = new JTextField();
- jTextFieldFvPropValue.setPreferredSize(new java.awt.Dimension(100,20));
- jTextFieldFvPropValue.setEnabled(false);
- }
- return jTextFieldFvPropValue;
- }
-
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvPropAdd() {
- if (jButtonFvPropAdd == null) {
- jButtonFvPropAdd = new JButton();
- jButtonFvPropAdd.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonFvPropAdd.setEnabled(false);
- jButtonFvPropAdd.setText("Add");
- jButtonFvPropAdd.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- if (jTextFieldFvPropName.getText().length() > 0 && jTextFieldFvPropValue.getText().length() > 0){
- String[] row = {jTextFieldFvPropName.getText(), jTextFieldFvPropValue.getText()};
- fvPropertyTableModel.addRow(row);
- docConsole.setSaved(false);
- ffc.genFvImagesNameValue(row[0], row[1]);
- }
- }
- });
- }
- return jButtonFvPropAdd;
- }
-
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFvProp() {
- if (jScrollPaneFvProp == null) {
- jScrollPaneFvProp = new JScrollPane();
- jScrollPaneFvProp.setPreferredSize(new java.awt.Dimension(350,100));
- jScrollPaneFvProp.setViewportView(getJTableFvProp());
- }
- return jScrollPaneFvProp;
- }
-
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvProp() {
- if (jTableFvProp == null) {
- fvPropertyTableModel = new DefaultTableModel();
- jTableFvProp = new JTable(fvPropertyTableModel);
- fvPropertyTableModel.addColumn("Name");
- fvPropertyTableModel.addColumn("Value");
- jTableFvProp.setRowHeight(20);
- jTableFvProp.setEnabled(false);
-
- jTableFvProp.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFvProp.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
-// selectedRow = lsm.getMinSelectionIndex();
- }
- }
- });
-
- jTableFvProp.getModel().addTableModelListener(new TableModelListener(){
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel)arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE){
-
- String name = m.getValueAt(row, 0) + "";
- String value = m.getValueAt(row, 1) + "";
- docConsole.setSaved(false);
- ffc.updateFvImagesNameValue(row, name, value);
- }
- }
- });
- }
- return jTableFvProp;
- }
-
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvPropButtonGroup() {
- if (jPanelFvPropButtonGroup == null) {
- jPanelFvPropButtonGroup = new JPanel();
- jPanelFvPropButtonGroup.setPreferredSize(new java.awt.Dimension(80,55));
-
- jPanelFvPropButtonGroup.add(getJButtonFvPropAdd(), null);
- jPanelFvPropButtonGroup.add(getJButtonFvPropDel(), null);
- }
- return jPanelFvPropButtonGroup;
- }
-
-
- /**
- * This method initializes jButton1
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvPropDel() {
- if (jButtonFvPropDel == null) {
- jButtonFvPropDel = new JButton();
- jButtonFvPropDel.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonFvPropDel.setEnabled(false);
- jButtonFvPropDel.setText("Delete");
- jButtonFvPropDel.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- if (jTableFvProp.getSelectedRow() >= 0){
- fvPropertyTableModel.removeRow(jTableFvProp.getSelectedRow());
- docConsole.setSaved(false);
- ffc.removeFvImagesNameValue(jTableFvProp.getSelectedRow());
- }
- }
- });
- }
- return jButtonFvPropDel;
- }
-
-
- /**
- * This method initializes jPanelFvImageC
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageC() {
- if (jPanelFvImageC == null) {
- GridLayout gridLayout = new GridLayout();
- gridLayout.setRows(2);
- jLabelFvParaName = new JLabel();
- jLabelFvParaName.setPreferredSize(new Dimension(38, 20));
- jLabelFvParaName.setText("Name");
- jLabelFvImageNames = new JLabel();
- jLabelFvImageNames.setText("FV Image Names");
- jLabelFvImageNames.setPreferredSize(new java.awt.Dimension(150,20));
- jLabelFvParaType = new JLabel();
- jLabelFvParaType.setText("Type");
- jLabelFvParaType.setPreferredSize(new java.awt.Dimension(70,20));
- jPanelFvImageC = new JPanel();
- jPanelFvImageC.setLayout(gridLayout);
- jPanelFvImageC.add(getJPanelFvImagePara(), null);
- jPanelFvImageC.add(getJPanelFvImageOpts(), null);
-
-
- }
- return jPanelFvImageC;
- }
-
-
- /**
- * This method initializes jComboBox
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxFvParaType() {
- if (jComboBoxFvParaType == null) {
- jComboBoxFvParaType = new JComboBox();
- jComboBoxFvParaType.addItem("Attributes");
- jComboBoxFvParaType.addItem("Components");
- jComboBoxFvParaType.setSelectedIndex(0);
- jComboBoxFvParaType.setPreferredSize(new java.awt.Dimension(180,20));
- jComboBoxFvParaType.addItemListener(new ItemListener() {
-
- public void itemStateChanged(ItemEvent arg0) {
- // TODO disable attribute settings when ValidImageNames selected.
- int selectedRow = jTableFvInfo.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
- String oldType = jTableFvInfo.getValueAt(selectedRow, 1)+"";
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, oldType);
- if (fvImagePos < 0) {
- return;
- }
-
- String type = jComboBoxFvParaType.getSelectedItem()+"";
- ffc.updateFvImagesFvImageType(fvImagePos, type);
- jTableFvInfo.setValueAt(type, selectedRow, 1);
- docConsole.setSaved(false);
- }
-
- });
- }
- return jComboBoxFvParaType;
- }
-
-
- /**
- * This method initializes jTextField2
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFvParaName() {
- if (jTextFieldFvParaName == null) {
- jTextFieldFvParaName = new JTextField();
- jTextFieldFvParaName.setPreferredSize(new java.awt.Dimension(140,20));
- }
- return jTextFieldFvParaName;
- }
-
-
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvNameAdd() {
- if (jButtonFvNameAdd == null) {
- jButtonFvNameAdd = new JButton();
- jButtonFvNameAdd.setPreferredSize(new Dimension(80, 20));
- jButtonFvNameAdd.setEnabled(true);
- jButtonFvNameAdd.setText("Add");
- jButtonFvNameAdd.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTextFieldFvParaName.getText().length() > 0){
- String[] row = {jTextFieldFvParaName.getText()};
- int selectedRow = jTableFvInfo.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
-
- String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
- String type = jTableFvInfo.getValueAt(selectedRow, 1)+"";
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
-
- if (fvImagePos < 0) {
- // new FvImage.
- ffc.genFvImagesFvImage(row, jComboBoxFvParaType.getSelectedItem()+"", null);
- }
- else {
- //append Fv name.
- ffc.addFvImageNamesInFvImage(fvImagePos, row);
- }
- docConsole.setSaved(false);
- fvImageNameTableModel.addRow(row);
- fvNameList += " ";
- fvNameList += row[0];
- jTableFvInfo.setValueAt(fvNameList.trim(), selectedRow, 0);
- jTableFvImageNames.changeSelection(jTableFvImageNames.getRowCount() - 1, 0, false, false);
- }
- }
- });
- }
- return jButtonFvNameAdd;
- }
-
-
- /**
- * This method initializes jScrollPane2
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFvImageNames() {
- if (jScrollPaneFvImageNames == null) {
- jScrollPaneFvImageNames = new JScrollPane();
- jScrollPaneFvImageNames.setPreferredSize(new java.awt.Dimension(350,80));
- jScrollPaneFvImageNames.setViewportView(getJTableFvImageNames());
- }
- return jScrollPaneFvImageNames;
- }
-
-
- /**
- * This method initializes jTable1
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvImageNames() {
- if (jTableFvImageNames == null) {
- fvImageNameTableModel = new IDefaultTableModel();
- jTableFvImageNames = new JTable(fvImageNameTableModel);
- jTableFvImageNames.setRowHeight(20);
- fvImageNameTableModel.addColumn("FV Image Name");
-
- }
- return jTableFvImageNames;
- }
-
-
- /**
- * This method initializes jButton3
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvNameDel() {
- if (jButtonFvNameDel == null) {
- jButtonFvNameDel = new JButton();
- jButtonFvNameDel.setPreferredSize(new Dimension(80, 20));
- jButtonFvNameDel.setEnabled(true);
- jButtonFvNameDel.setText("Delete");
- jButtonFvNameDel.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFvImageNames.getSelectedRow() >= 0){
- int selectedRow = jTableFvInfo.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
-
- String selectedFvName = jTableFvImageNames.getValueAt(jTableFvImageNames.getSelectedRow(), 0)+"";
- String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
- String type = jTableFvInfo.getValueAt(selectedRow, 1)+"";
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
-
- if (fvImagePos < 0) {
- return;
- }
- else {
- //delete Fv name.
- ffc.updateFvImageNamesInFvImage(fvImagePos, selectedFvName, null);
- }
- docConsole.setSaved(false);
- String newList = removeFvNameFromList(fvNameList, selectedFvName);
- jTableFvInfo.setValueAt(newList, selectedRow, 0);
- fvImageNameTableModel.removeRow(jTableFvImageNames.getSelectedRow());
- }
- }
- });
- }
- return jButtonFvNameDel;
- }
-
- private String removeFvNameFromList (String list, String name) {
- String[] nameArray = list.split(" ");
- int occursAt = -1;
- for (int i = 0; i < nameArray.length; ++i) {
- if (nameArray[i].equals(name)) {
- occursAt = i;
- break;
- }
- }
-
- if (occursAt == -1) {
- return list;
- }
-
- String newList = " ";
- for (int j = 0; j < nameArray.length; ++j) {
- if (j != occursAt) {
- newList += nameArray[j];
- newList += " ";
- }
- }
-
- return newList.trim();
- }
-
-
- private JPanel getJPanelFvImageOpts() {
-
-
- if (jPanelFvImageOpts == null) {
- //ToDo add ButtonGroup for RadioButtons
- jLabelOptions = new JLabel();
- jLabelOptions.setText("Attribute");
- jLabelFvImageOptValue = new JLabel();
- jLabelFvImageOptValue.setEnabled(true);
- jLabelFvImageOptValue.setText("Value");
- jLabelFvImageOptValue.setPreferredSize(new Dimension(38, 20));
- jLabelFvImageOptName = new JLabel();
- jLabelFvImageOptName.setEnabled(true);
- jLabelFvImageOptName.setText("Name");
- jLabelFvImageOptName.setPreferredSize(new Dimension(38, 20));
- jPanelFvImageOpts = new JPanel();
- jPanelFvImageOpts.setLayout(new BorderLayout());
- jPanelFvImageOpts.setPreferredSize(new java.awt.Dimension(450,130));
-
-
- jPanelFvImageOpts.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED));
-
- jPanelFvImageOpts.add(getJPanelFvImageOptsN(), java.awt.BorderLayout.NORTH);
- jPanelFvImageOpts.add(getJPanelFvImageOptsS(), java.awt.BorderLayout.SOUTH);
- jPanelFvImageOpts.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
-
- jPanelFvImageOpts.add(getJPanelFvImageOptsE(), java.awt.BorderLayout.EAST);
- }
- return jPanelFvImageOpts;
- }
-
-
- /**
- * This method initializes jButton4
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAddFvImage() {
- if (jButtonAddFvImage == null) {
- jButtonAddFvImage = new JButton();
- jButtonAddFvImage.setPreferredSize(new java.awt.Dimension(150,20));
- jButtonAddFvImage.setText("New FV Attributes");
- jButtonAddFvImage.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(java.awt.event.ActionEvent e) {
-
-// String imageName = " ";
-// for (int i = 0; i < jTableFvImageNames.getRowCount(); ++i){
-// imageName += (String)jTableFvImageNames.getValueAt(i, 0);
-// imageName += " ";
-// }
-// imageName = imageName.trim();
-
-// LinkedHashMap<String, String> m = null;
-// m = new LinkedHashMap<String, String>();
-// getOptionNameValue(m);
-// ffc.genFvImagesFvImage(imageName.split(" "), jComboBoxFvParaType.getSelectedItem()+"", m);
-// docConsole.setSaved(false);
- fvImageNameTableModel.setRowCount(0);
- fvOptionTableModel.setRowCount(0);
- Object[] row = {"", jComboBoxFvParaType.getSelectedItem()};
- fvImageParaTableModel.addRow(row);
- jTableFvInfo.changeSelection(jTableFvInfo.getRowCount() - 1, 0, false, false);
- }
- });
- }
- return jButtonAddFvImage;
- }
-
-
- /**
- * This method initializes jScrollPane3
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFvInfo() {
- if (jScrollPaneFvInfo == null) {
- jScrollPaneFvInfo = new JScrollPane();
- jScrollPaneFvInfo.setPreferredSize(new java.awt.Dimension(480,150));
- jScrollPaneFvInfo.setViewportView(getJTableFvInfo());
- }
- return jScrollPaneFvInfo;
- }
-
-
- /**
- * This method initializes jTable2
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvInfo() {
- if (jTableFvInfo == null) {
- fvImageParaTableModel = new ImageParaTableModel();
- jTableFvInfo = new JTable(fvImageParaTableModel);
- fvImageParaTableModel.addColumn("FvImageNames");
- fvImageParaTableModel.addColumn("Type");
-
- jTableFvInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFvInfo.setRowHeight(20);
- jTableFvInfo.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- int selectedRow = lsm.getMinSelectionIndex();
- String fvNameList = fvImageParaTableModel.getValueAt(selectedRow, 0)+"";
- String type = fvImageParaTableModel.getValueAt(selectedRow, 1)+"";
- jComboBoxFvParaType.setSelectedItem(type);
- String[] fvNames = fvNameList.split(" ");
- fvImageNameTableModel.setRowCount(0);
- fvOptionTableModel.setRowCount(0);
- for (int i = 0; i < fvNames.length; ++i) {
- String[] row = { fvNames[i] };
- if (row[0].length() > 0) {
- fvImageNameTableModel.addRow(row);
- }
- }
-
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
- if (fvImagePos < 0) {
- return;
- }
- LinkedHashMap<String, String> optionMap = new LinkedHashMap<String, String>();
- ffc.getFvImagesFvImageOptions(fvImagePos, optionMap);
- if (optionMap.size() > 0){
- Set<String> key = optionMap.keySet();
- Iterator<String> i = key.iterator();
- while (i.hasNext()) {
- String k = (String)i.next();
- String[] row = {k, optionMap.get(k)};
- fvOptionTableModel.addRow(row);
- }
- }
- }
- }
- });
-
-
- }
- return jTableFvInfo;
- }
-
-
- /**
- * This method initializes jButton6
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDelFvImage() {
- if (jButtonDelFvImage == null) {
- jButtonDelFvImage = new JButton();
- jButtonDelFvImage.setPreferredSize(new java.awt.Dimension(150,20));
- jButtonDelFvImage.setText("Delete FV Attributes");
- jButtonDelFvImage.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- if (jTableFvInfo.getSelectedRow() >= 0 ) {
- String fvNameList = fvImageParaTableModel.getValueAt(jTableFvInfo.getSelectedRow(), 0)+"";
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, jComboBoxFvParaType.getSelectedItem()+"");
-
- ffc.removeFvImagesFvImage(fvImagePos);
- fvImageParaTableModel.removeRow(jTableFvInfo.getSelectedRow());
- docConsole.setSaved(false);
-
- fvImageNameTableModel.setRowCount(0);
- fvOptionTableModel.setRowCount(0);
- }
- }
-
- });
- }
- return jButtonDelFvImage;
- }
-
-
- /**
- * This method initializes jPanel6
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImagePara() {
- if (jPanelFvImagePara == null) {
- StarLabel starLabel = new StarLabel();
- starLabel.setVisible(false);
- jPanelFvImagePara = new JPanel();
- jPanelFvImagePara.setLayout(new BorderLayout());
- jPanelFvImagePara.setPreferredSize(new java.awt.Dimension(450,140));
- jPanelFvImagePara.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
-
- jPanelFvImagePara.add(getJPanelFvImageParaN(), java.awt.BorderLayout.NORTH);
- jPanelFvImagePara.add(getJPanelFvImageParaS(), java.awt.BorderLayout.SOUTH);
- jPanelFvImagePara.add(getJScrollPaneFvImageNames(), java.awt.BorderLayout.CENTER);
-
- jPanelFvImagePara.add(getJPanelFvImageParaE(), java.awt.BorderLayout.EAST);
-//
-//
-//
- }
- return jPanelFvImagePara;
- }
-
- /**
- * This method initializes jPanel7
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdf() {
- if (jPanelFdf == null) {
- jPanelFdf = new JPanel();
- jPanelFdf.setLayout(new BorderLayout());
-
- jPanelFdf.add(getJPanelFdfN(), java.awt.BorderLayout.NORTH);
- jPanelFdf.add(getJPanelFdfS(), java.awt.BorderLayout.SOUTH);
- jPanelFdf.add(getJSplitPaneFdfC(), java.awt.BorderLayout.CENTER);
- jPanelFdf.addComponentListener(new ComponentAdapter(){
- public void componentShown(ComponentEvent e) {
-// if (ffc.getFlashDefinitionFile() != null) {
-// jTextFieldFdf.setText(ffc.getFlashDefinitionFile());
-// initFvInFdfTable(Workspace.getCurrenetWorkspace() + File.separator + jTextFieldFdf.getText());
-//
-// }
- }
- public void componentHidden(ComponentEvent e) {
- if (jCheckBoxFdf.isSelected()) {
- ffc.genFlashDefinitionFile(jTextFieldFdf.getText());
- }
- }
- });
- }
- return jPanelFdf;
- }
-
- /**
- * This method initializes jCheckBox
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxFdf() {
- if (jCheckBoxFdf == null) {
- jCheckBoxFdf = new JCheckBox();
- jCheckBoxFdf.setText("Flash Definition File");
- jCheckBoxFdf.addItemListener(new ItemListener() {
-
- public void itemStateChanged(ItemEvent arg0) {
- // TODO Auto-generated method stub
- if (jCheckBoxFdf.isSelected()){
- jTextFieldFdf.setEnabled(true);
- jButtonFdfBrowse.setEnabled(true);
- }
- else {
- getFvInFdfTableModel().setRowCount(0);
- jTextFieldFdf.setEnabled(false);
- jTextFieldFdf.setText("");
- jButtonFdfBrowse.setEnabled(false);
- ffc.genFlashDefinitionFile("");
- docConsole.setSaved(false);
- int selectedBackup = selectedRowInFvAdditionalTable;
- selectedRowInFvAdditionalTable = -1;
- initFvAdditionalTable();
- selectedRowInFvAdditionalTable = selectedBackup;
- }
- }
- });
- }
- return jCheckBoxFdf;
- }
-
- /**
- * This method initializes jTextField3
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFdf() {
- if (jTextFieldFdf == null) {
- jTextFieldFdf = new JTextField();
- jTextFieldFdf.setEnabled(false);
- jTextFieldFdf.setEditable(false);
- jTextFieldFdf.setPreferredSize(new Dimension(300, 20));
- jTextFieldFdf.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusLost(java.awt.event.FocusEvent e) {
- ffc.genFlashDefinitionFile(jTextFieldFdf.getText());
- }
- });
- }
- return jTextFieldFdf;
- }
-
- /**
- * This method initializes jButton5
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFdfBrowse() {
- if (jButtonFdfBrowse == null) {
- jButtonFdfBrowse = new JButton();
- jButtonFdfBrowse.setEnabled(false);
- jButtonFdfBrowse.setText("Browse");
- jButtonFdfBrowse.setPreferredSize(new Dimension(78, 20));
- jButtonFdfBrowse.addActionListener(new AbstractAction(){
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- // TODO Auto-generated method stub
- String wsDir = Workspace.getCurrentWorkspace();
- JFileChooser chooser = new JFileChooser(wsDir);
- chooser.setMultiSelectionEnabled(false);
- chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
- int retval = chooser.showOpenDialog(FpdFlash.this);
- if (retval == JFileChooser.APPROVE_OPTION) {
-
- File theFile = chooser.getSelectedFile();
- String filePath = theFile.getPath();
- if (!filePath.startsWith(wsDir)) {
- JOptionPane.showMessageDialog(FpdFlash.this, "You can only select files in current WORKSPACE.");
- return;
- }
- jTextFieldFdf.setText(filePath.substring(wsDir.length() + 1).replace('\\', '/'));
- ffc.genFlashDefinitionFile(jTextFieldFdf.getText());
- docConsole.setSaved(false);
- initFvInFdfTable(filePath);
- }
- }
-
- });
- }
- return jButtonFdfBrowse;
- }
-
- private void initFvAttributes () {
- if (ffc.getFvImagesFvImageCount("Attributes") == 0 && ffc.getFvImagesFvImageCount("Components") == 0) {
- return;
- }
- String[][] saa = new String[ffc.getFvImagesFvImageCount("Attributes")][2];
- ffc.getFvImagesFvImages(saa, "Attributes");
-
- int i = 0;
- while (i < saa.length) {
- fvImageParaTableModel.addRow(saa[i]);
- ++i;
- }
-
- saa = new String[ffc.getFvImagesFvImageCount("Components")][2];
- ffc.getFvImagesFvImages(saa, "Components");
- i = 0;
- while (i < saa.length) {
- fvImageParaTableModel.addRow(saa[i]);
- ++i;
- }
-
- saa = new String[ffc.getFvImagesNameValueCount()][2];
- ffc.getFvImagesNameValues(saa);
- for (int m = 0; m < saa.length; ++m) {
- fvPropertyTableModel.addRow(saa[m]);
- }
- }
-
- private void initFvAdditionalTable() {
- Vector<String> vFvNames = new Vector<String>();
- ffc.getFvImagesFvImageFvImageNames(vFvNames);
- for (int i = 0; i < vFvNames.size(); ++i) {
- String fvName = vFvNames.get(i);
- if (fvNameExists(fvName)) {
- continue;
- }
- fvAdditionalTableModel.addRow(getBasicFvInfo(fvName));
- addTabForFv(new FvInfoFromFdf(fvName, "", ""));
- }
- }
-
- private void initFvInFdfTable(String fdfPath){
- Vector<FvInfoFromFdf> vFvInfo = new Vector<FvInfoFromFdf>();
- getFvInfoFromFdf(fdfPath, vFvInfo);
- getFlashInfoFromFdf (fdfPath);
- if (!erasePolarity.equals("1") && !erasePolarity.equals("0")) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "FDF file does NOT contain valid Erase Polarity.");
- }
- else {
- ffc.setTypedFvImageNameValue("Attributes", "EFI_ERASE_POLARITY", erasePolarity);
- }
-
- // BugBug: assume all blocks have same size;
-
- String blkSize = defaultBlkSize;
- if (vBlockSize.size() > 0) {
- blkSize = vBlockSize.get(0);
- if (!DataValidation.isInt(blkSize) && !DataValidation.isHexDoubleWordDataType(blkSize)) {
- JOptionPane.showMessageDialog(FpdFlash.this, "FDF file does NOT contain valid FV block size. Default size 0x10000 will be used.");
- blkSize = defaultBlkSize;
- }
- }
- determinedFvBlockSize = blkSize;
-
- getFvInFdfTableModel().setRowCount(0);
- Vector<String> vExistingFvNameInFpd = new Vector<String>();
- ffc.getFvImagesFvImageFvImageNames(vExistingFvNameInFpd);
- for (int j = 0; j < vFvInfo.size(); ++j) {
- FvInfoFromFdf fvInfo = vFvInfo.get(j);
- String[] row = {fvInfo.getFvName(), fvInfo.getSize(), fvInfo.getEfiFileName()};
-
- if (row[0].length() > 0 && !vExistingFvNameInFpd.contains(row[0])) {
- ffc.addFvImageFvImageNames(new String[]{row[0]});
- }
-
- // if FV addtional table contains the same FV from fdf file, remove that row.
- for (int k = 0; k < jTableFvAdditional.getRowCount(); ++k) {
- if (fvAdditionalTableModel.getValueAt(k, 0).equals(row[0])) {
- fvAdditionalTableModel.removeRow(k);
- }
- }
- getFvInFdfTableModel().addRow(row);
- try {
- int blockSize = Integer.decode(blkSize);
- int fvSize = Integer.decode(row[1]);
- int numBlocks = fvSize/blockSize;
- HashMap<String, String> mOptions = new HashMap<String, String>();
- // if no options for this FV before, generate a new options entry for this FV.
- if (ffc.getFvImagesFvImageWithName(row[0], "Options") == null) {
-
- mOptions.put("EFI_BLOCK_SIZE", blkSize);
- mOptions.put("EFI_NUM_BLOCKS", numBlocks+"");
- mOptions.put("EFI_FILE_NAME", row[2]);
- ffc.genFvImagesFvImage(new String[]{row[0]}, "Options", mOptions);
- memModified = true;
- }
- else {
- ffc.getFvImagesFvImageOptions(row[0], mOptions);
- if (mOptions.get("EFI_BLOCK_SIZE") == null || !mOptions.get("EFI_BLOCK_SIZE").equalsIgnoreCase(blkSize)) {
- ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_BLOCK_SIZE", blkSize, null);
- memModified = true;
- }
- if (mOptions.get("EFI_NUM_BLOCKS") == null || Integer.decode(mOptions.get("EFI_NUM_BLOCKS")) != numBlocks) {
- ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_NUM_BLOCKS", numBlocks + "", null);
- memModified = true;
- }
- if (mOptions.get("EFI_FILE_NAME") == null || !mOptions.get("EFI_FILE_NAME").equals(row[2])) {
- ffc.setTypedNamedFvImageNameValue(row[0], "Options", "EFI_FILE_NAME", row[2], null);
- memModified = true;
- }
-
- }
- }
- catch (NumberFormatException e){
- JOptionPane.showMessageDialog(FpdFlash.this, e.getMessage());
- }
- }
-
- for (int k = 0; k < vFvInfo.size(); ++k) {
- FvInfoFromFdf fvInfo = vFvInfo.get(k);
- addTabForFv(fvInfo);
- }
-
- }
-
- private void addTabForFv (FvInfoFromFdf fvInfo) {
- String fvName = fvInfo.getFvName();
- String outputFile = fvInfo.getEfiFileName();
- int index = jTabbedPane.indexOfTab(fvName);
- if (index >= startIndexOfDynamicTab) {
- return;
- }
- ModuleOrderPane pane = new ModuleOrderPane(fvName, outputFile, ffc, this);
- pane.showModulesInFv(fvName);
- pane.showAllModulesInPlatform();
- jTabbedPane.addTab(fvName, null, pane, null);
- }
- /**
- * This method initializes jTextField4
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFvImageOptName() {
- if (jTextFieldFvImageOptName == null) {
- jTextFieldFvImageOptName = new JTextField();
- jTextFieldFvImageOptName.setEnabled(true);
- jTextFieldFvImageOptName.setPreferredSize(new Dimension(100, 20));
- }
- return jTextFieldFvImageOptName;
- }
-
- /**
- * This method initializes jTextField5
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFvImageOptValue() {
- if (jTextFieldFvImageOptValue == null) {
- jTextFieldFvImageOptValue = new JTextField();
- jTextFieldFvImageOptValue.setEnabled(true);
- jTextFieldFvImageOptValue.setPreferredSize(new Dimension(100, 20));
- }
- return jTextFieldFvImageOptValue;
- }
-
- /**
- * This method initializes jPanel8
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageOptsButtonGroup() {
- if (jPanelFvImageOptsButtonGroup == null) {
- jPanelFvImageOptsButtonGroup = new JPanel();
- jPanelFvImageOptsButtonGroup.setPreferredSize(new Dimension(80, 55));
- jPanelFvImageOptsButtonGroup.add(getJButtonFvImageOptAdd(), null);
- jPanelFvImageOptsButtonGroup.add(getJButtonFvImageOptDel(), null);
- }
- return jPanelFvImageOptsButtonGroup;
- }
-
- /**
- * This method initializes jButton7
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvImageOptAdd() {
- if (jButtonFvImageOptAdd == null) {
- jButtonFvImageOptAdd = new JButton();
- jButtonFvImageOptAdd.setEnabled(true);
- jButtonFvImageOptAdd.setText("Add");
- jButtonFvImageOptAdd.setPreferredSize(new Dimension(80, 20));
- jButtonFvImageOptAdd.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- if (jTextFieldFvImageOptName.getText().length() > 0 && jTextFieldFvImageOptValue.getText().length() > 0){
- int selectedRow = jTableFvInfo.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
-
- String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
- String type = jTableFvInfo.getValueAt(selectedRow, 1)+"";
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
- String[] row = {jTextFieldFvImageOptName.getText(), jTextFieldFvImageOptValue.getText()};
-
- if (fvImagePos < 0) {
- return;
- }
- else {
- //append options to FvImage.
- ffc.setFvImagesFvImageNameValue(fvImagePos, row[0], row[1]);
- }
- docConsole.setSaved(false);
- fvOptionTableModel.addRow(row);
- jTableFvImageOpts.changeSelection(jTableFvImageOpts.getRowCount() - 1, 0, false, false);
- }
- }
- });
- }
- return jButtonFvImageOptAdd;
- }
-
- /**
- * This method initializes jButton8
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvImageOptDel() {
- if (jButtonFvImageOptDel == null) {
- jButtonFvImageOptDel = new JButton();
- jButtonFvImageOptDel.setEnabled(true);
- jButtonFvImageOptDel.setText("Delete");
- jButtonFvImageOptDel.setPreferredSize(new Dimension(80, 20));
- jButtonFvImageOptDel.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- if (jTableFvImageOpts.getSelectedRow() >= 0){
- int selectedRow = jTableFvInfo.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
-
- String fvNameList = jTableFvInfo.getValueAt(selectedRow, 0)+"";
- String type = jTableFvInfo.getValueAt(selectedRow, 1)+"";
- int fvImagePos = ffc.getFvImagePosInFvImages(fvNameList, type);
- if (fvImagePos < 0) {
- return;
- }
-
- String optName = fvOptionTableModel.getValueAt(jTableFvImageOpts.getSelectedRow(), 0)+"";
- ffc.removeFvImageNameValue(fvImagePos, optName);
- docConsole.setSaved(false);
- fvOptionTableModel.removeRow(jTableFvImageOpts.getSelectedRow());
- }
- }
- });
- }
- return jButtonFvImageOptDel;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setPreferredSize(new java.awt.Dimension(350,100));
- jScrollPane.setViewportView(getJTableFvImageOpts());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTable3
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvImageOpts() {
- if (jTableFvImageOpts == null) {
- fvOptionTableModel = new IDefaultTableModel();
- fvOptionTableModel.addColumn("Name");
- fvOptionTableModel.addColumn("Value");
- jTableFvImageOpts = new JTable(fvOptionTableModel);
-
- jTableFvImageOpts.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFvImageOpts.setRowHeight(20);
-
- }
- return jTableFvImageOpts;
- }
-
- /**
- * This method initializes jButton9
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonUpdateFvImage() {
- if (jButtonUpdateFvImage == null) {
- jButtonUpdateFvImage = new JButton();
- jButtonUpdateFvImage.setPreferredSize(new java.awt.Dimension(150,20));
- jButtonUpdateFvImage.setActionCommand("Update");
- jButtonUpdateFvImage.setText("Update FV Attributes");
- jButtonUpdateFvImage.setVisible(false);
- jButtonUpdateFvImage.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int row = jTableFvInfo.getSelectedRow();
- if (jTableFvInfo.isEditing()) {
- jTableFvInfo.getCellEditor().stopCellEditing();
- }
- if (jTableFvImageOpts.isEditing()) {
- jTableFvImageOpts.getCellEditor().stopCellEditing();
- }
-
- //ToDo Check data validity before update
- String name = fvImageParaTableModel.getValueAt(row, 0) + "";
- String type = fvImageParaTableModel.getValueAt(row, 1) + "";
-
- LinkedHashMap<String, String> lhm = new LinkedHashMap<String, String>();
- getOptionNameValue(lhm);
-
- docConsole.setSaved(false);
- ffc.updateFvImagesFvImage(row, name.split(" "), type, lhm);
-
- }
- });
- }
- return jButtonUpdateFvImage;
- }
-
- /**
- * This method initializes jPanelFdfN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfN() {
- if (jPanelFdfN == null) {
- jPanelFdfN = new JPanel();
- jPanelFdfN.add(getJCheckBoxFdf(), null);
- jPanelFdfN.add(getJTextFieldFdf(), null);
- jPanelFdfN.add(getJButtonFdfBrowse(), null);
- }
- return jPanelFdfN;
- }
-
- /**
- * This method initializes jPanelFdfS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfS() {
- if (jPanelFdfS == null) {
- FlowLayout flowLayout4 = new FlowLayout();
- flowLayout4.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelFdfS = new JPanel();
- jPanelFdfS.setLayout(flowLayout4);
- jPanelFdfS.add(getJButtonAddFv(), null);
- jPanelFdfS.add(getJButtonDelFv(), null);
- jPanelFdfS.add(getJButtonAddFvOptions(), null);
- }
- return jPanelFdfS;
- }
-
- /**
- * This method initializes jSplitPaneFdfC
- *
- * @return javax.swing.JSplitPane
- */
- private JSplitPane getJSplitPaneFdfC() {
- if (jSplitPaneFdfC == null) {
- jSplitPaneFdfC = new JSplitPane();
- jSplitPaneFdfC.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
- jSplitPaneFdfC.setDividerSize(5);
- jSplitPaneFdfC.setTopComponent(getJPanelFdfCTop());
- jSplitPaneFdfC.setBottomComponent(getJPanelFdfCBottom());
- jSplitPaneFdfC.setDividerLocation(280);
- }
- return jSplitPaneFdfC;
- }
-
- /**
- * This method initializes jPanelFdfCTop
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfCTop() {
- if (jPanelFdfCTop == null) {
- jPanelFdfCTop = new JPanel();
- jPanelFdfCTop.setLayout(new BorderLayout());
- jPanelFdfCTop.add(getJPanelFdfCTopN(), java.awt.BorderLayout.NORTH);
- jPanelFdfCTop.add(getJPanelFdfCTopS(), java.awt.BorderLayout.SOUTH);
- jPanelFdfCTop.add(getJScrollPaneFvInFdf(), java.awt.BorderLayout.CENTER);
- }
- return jPanelFdfCTop;
- }
-
- /**
- * This method initializes jPanelFdfCBottom
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfCBottom() {
- if (jPanelFdfCBottom == null) {
- jPanelFdfCBottom = new JPanel();
- jPanelFdfCBottom.setLayout(new BorderLayout());
- jPanelFdfCBottom.add(getJPanelFdfCBottomN(), java.awt.BorderLayout.NORTH);
- jPanelFdfCBottom.add(getJScrollPaneFvAdditional(), java.awt.BorderLayout.CENTER);
- }
- return jPanelFdfCBottom;
- }
-
- /**
- * This method initializes jPanelFdfCTopN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfCTopN() {
- if (jPanelFdfCTopN == null) {
- jLabelFvInFdf = new JLabel();
- jLabelFvInFdf.setText("FVs in Flash Definition File");
- jPanelFdfCTopN = new JPanel();
- jPanelFdfCTopN.add(jLabelFvInFdf, null);
- }
- return jPanelFdfCTopN;
- }
-
- /**
- * This method initializes jPanelFdfCTopS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfCTopS() {
- if (jPanelFdfCTopS == null) {
- FlowLayout flowLayout1 = new FlowLayout();
- flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelFdfCTopS = new JPanel();
- jPanelFdfCTopS.setLayout(flowLayout1);
- jPanelFdfCTopS.add(getJButtonFvInFdfOptions(), null);
- }
- return jPanelFdfCTopS;
- }
-
- /**
- * This method initializes jPanelFdfCTopC
- *
- * @return javax.swing.JPanel
- */
-// private JPanel getJPanelFdfCTopC() {
-// if (jPanelFdfCTopC == null) {
-// jPanelFdfCTopC = new JPanel();
-// jPanelFdfCTopC.add(getJScrollPaneFvInFdf(), null);
-// }
-// return jPanelFdfCTopC;
-// }
-
- /**
- * This method initializes jPanelFdfCBottomN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFdfCBottomN() {
- if (jPanelFdfCBottomN == null) {
- jLabelFvAdditional = new JLabel();
- jLabelFvAdditional.setText("Additional FVs");
- jPanelFdfCBottomN = new JPanel();
- jPanelFdfCBottomN.add(jLabelFvAdditional, null);
- }
- return jPanelFdfCBottomN;
- }
-
- /**
- * This method initializes jPanelFdfCBottomC
- *
- * @return javax.swing.JPanel
- */
-// private JPanel getJPanelFdfCBottomC() {
-// if (jPanelFdfCBottomC == null) {
-// jPanelFdfCBottomC = new JPanel();
-// jPanelFdfCBottomC.add(getJScrollPaneFvAdditional(), null);
-// }
-// return jPanelFdfCBottomC;
-// }
-
- /**
- * This method initializes jScrollPaneFvInFdf
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFvInFdf() {
- if (jScrollPaneFvInFdf == null) {
- jScrollPaneFvInFdf = new JScrollPane();
- jScrollPaneFvInFdf.setPreferredSize(new java.awt.Dimension(653,200));
- jScrollPaneFvInFdf.setViewportView(getJTableFvInFdf());
- }
- return jScrollPaneFvInFdf;
- }
-
- /**
- * This method initializes jTableFvInFdf
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvInFdf() {
- if (jTableFvInFdf == null) {
- jTableFvInFdf = new JTable();
- jTableFvInFdf.setRowHeight(20);
- jTableFvInFdf.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
- jTableFvInFdf.setModel(getFvInFdfTableModel());
- }
- return jTableFvInFdf;
- }
-
- /**
- * This method initializes fvInFdfTableModel
- *
- * @return org.tianocore.frameworkwizard.platform.ui.NonEditableTableModel
- */
- private IDefaultTableModel getFvInFdfTableModel() {
- if (fvInFdfTableModel == null) {
- fvInFdfTableModel = new IDefaultTableModel();
- fvInFdfTableModel.addColumn("FV Name");
- fvInFdfTableModel.addColumn("Size");
- fvInFdfTableModel.addColumn("Corresponding File Name");
- }
- return fvInFdfTableModel;
- }
-
- /**
- * This method initializes jButtonFvInFdfOptions
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFvInFdfOptions() {
- if (jButtonFvInFdfOptions == null) {
- jButtonFvInFdfOptions = new JButton();
- jButtonFvInFdfOptions.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonFvInFdfOptions.setEnabled(true);
- jButtonFvInFdfOptions.setText("Options");
- jButtonFvInFdfOptions.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableFvInFdf.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- String fvName = jTableFvInFdf.getValueAt(selectedRow, 0)+"";
- if (fvName.length() == 0) {
- return;
- }
- DefaultTableModel dtm = getFvInFdfOptTableModel();
- new FpdFvOptions(fvName, dtm, ffc, docConsole);
- }
- });
- }
- return jButtonFvInFdfOptions;
- }
-
- private DefaultTableModel getFvInFdfOptTableModel() {
- if (fvInFdfOptTableModel == null) {
- fvInFdfOptTableModel = new FvOptsTableModel();
- fvInFdfOptTableModel.addColumn("Name");
- fvInFdfOptTableModel.addColumn("Value");
- Vector<Object> v = new Vector<Object>();
- v.add("EFI_BLOCK_SIZE");
- v.add("EFI_NUM_BLOCKS");
- v.add("EFI_FILE_NAME");
- fvInFdfOptTableModel.setVKeyWords(v);
- fvInFdfOptTableModel.setVNonEditableName(v);
- }
- return fvInFdfOptTableModel;
- }
-
- private DefaultTableModel getFvAdditionalOptTableModel() {
- if (fvAdditionalOptTableModel == null) {
- fvAdditionalOptTableModel = new FvOptsTableModel();
- fvAdditionalOptTableModel.addColumn("Name");
- fvAdditionalOptTableModel.addColumn("Value");
- Vector<Object> v = new Vector<Object>();
- v.add("EFI_BLOCK_SIZE");
- v.add("EFI_NUM_BLOCKS");
- v.add("EFI_FILE_NAME");
- fvAdditionalOptTableModel.setVNonEditableName(v);
- }
- return fvAdditionalOptTableModel;
- }
-
- /**
- * This method initializes jScrollPaneFvAdditional
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFvAdditional() {
- if (jScrollPaneFvAdditional == null) {
- jScrollPaneFvAdditional = new JScrollPane();
- jScrollPaneFvAdditional.setPreferredSize(new java.awt.Dimension(653,200));
- jScrollPaneFvAdditional.setViewportView(getJTableFvAdditional());
- }
- return jScrollPaneFvAdditional;
- }
-
- /**
- * This method initializes jTableFvAdditional
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvAdditional() {
- if (jTableFvAdditional == null) {
- jTableFvAdditional = new JTable();
- jTableFvAdditional.setRowHeight(20);
- jTableFvAdditional.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
- jTableFvAdditional.setModel(getFvAdditionalTableModel());
-
- jTableFvAdditional.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRowInFvAdditionalTable = lsm.getMinSelectionIndex();
- oldFvName = jTableFvAdditional.getValueAt(selectedRowInFvAdditionalTable, 0)+"";
- }
- }
- });
-
- jTableFvAdditional.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int col = arg0.getColumn();
- TableModel m = (TableModel) arg0.getSource();
-
- if (arg0.getType() == TableModelEvent.UPDATE) {
- if (col == 0) {
- String newFvName = m.getValueAt(row, 0) + "";
- if (newFvName.equals(oldFvName)) {
- return;
- }
- if (fvNameExists(newFvName)) {
- JOptionPane.showMessageDialog(FpdFlash.this, "This FV already exists. Please choose another FV name.");
- m.setValueAt(oldFvName, row, 0);
- return;
- }
-
- tabIndexForFv = jTabbedPane.indexOfTab(oldFvName);
- if (tabIndexForFv >= startIndexOfDynamicTab) {
- jTabbedPane.setTitleAt(tabIndexForFv, newFvName);
- // change FvName in UserExtensions
- ffc.updateBuildOptionsUserExtensions(oldFvName, newFvName);
- // change FvBinding in ModuleSA
- ffc.appendFvBindingFor(oldFvName, newFvName);
- ffc.removeFvBindingAll(oldFvName);
- // change FvImageNames in Flash
- ffc.updateFvImageNameAll(oldFvName, newFvName);
-
- } else {
- ModuleOrderPane pane = new ModuleOrderPane(newFvName, "", ffc, FpdFlash.this);
- pane.showModulesInFv(newFvName);
- pane.showAllModulesInPlatform();
- jTabbedPane.addTab(newFvName, pane);
- // Add FvImageNames in Flash
- String[] fvNames = {newFvName};
- ffc.addFvImageFvImageNames(fvNames);
- }
- docConsole.setSaved(false);
- oldFvName = newFvName;
- }
-
- if (col == 1 && !sizeFromOptionDlg) {
- String fvSize = m.getValueAt(row, col) + "";
- if (!DataValidation.isInt(fvSize) && !DataValidation.isHexDoubleWordDataType(fvSize)) {
- JOptionPane.showMessageDialog(FpdFlash.this, "FV size should be Integer or Hex format.");
- return;
- }
- HashMap<String, String> mFvOpts = new HashMap<String, String>();
- ffc.getFvImagesFvImageOptions(oldFvName, mFvOpts);
- String blkSize = mFvOpts.get("EFI_BLOCK_SIZE");
- if (blkSize == null) {
- if (determinedFvBlockSize != null) {
- blkSize = determinedFvBlockSize;
- }
- else {
- blkSize = defaultBlkSize;
- }
- ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_BLOCK_SIZE", blkSize, null);
- int fs = Integer.decode(fvSize);
- int bs = Integer.decode(blkSize);
- ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_NUM_BLOCKS", (fs/bs)+"", null);
- docConsole.setSaved(false);
- }
- else {
- if (!DataValidation.isInt(blkSize) && !DataValidation.isHexDoubleWordDataType(blkSize)) {
- int retVal = JOptionPane.showConfirmDialog(FpdFlash.this, "Confirm", "FPD file contains error block size format. Would you like to replace it with a default value?", JOptionPane.YES_NO_OPTION);
- if (retVal == JOptionPane.YES_OPTION) {
- ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_BLOCK_SIZE", defaultBlkSize, null);
- int fs = Integer.decode(fvSize);
- int bs = Integer.decode(defaultBlkSize);
- ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_NUM_BLOCKS", (fs/bs)+"", null);
- docConsole.setSaved(false);
- return;
- }
- else {
- return;
- }
-
- }
- int fs = Integer.decode(fvSize);
- int bs = Integer.decode(blkSize);
- ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_NUM_BLOCKS", (fs/bs)+"", null);
- docConsole.setSaved(false);
- }
- }
-
- if (col == 2 && !fileFromOptionDlg) {
- ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_FILE_NAME", m.getValueAt(row, col)+"", null);
- docConsole.setSaved(false);
- }
-
- }
- }
- });
- }
- return jTableFvAdditional;
- }
-
- private boolean fvNameExistsInFvInFdfTable (String fvName) {
- for (int i = 0; i < jTableFvInFdf.getRowCount(); ++i) {
- if (fvInFdfTableModel.getValueAt(i, 0).equals(fvName)) {
- return true;
- }
- }
- return false;
- }
-
- private boolean fvNameExists (String fvName) {
- if (fvNameExistsInFvInFdfTable(fvName)) {
- return true;
- }
-
- for (int j = 0; j < jTableFvAdditional.getRowCount(); ++j) {
- if (fvAdditionalTableModel.getValueAt(j, 0).equals(fvName) && j != selectedRowInFvAdditionalTable) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * This method initializes fvAdditionalTableModel
- *
- * @return javax.swing.table.DefaultTableModel
- */
- private DefaultTableModel getFvAdditionalTableModel() {
- if (fvAdditionalTableModel == null) {
- fvAdditionalTableModel = new DefaultTableModel();
- fvAdditionalTableModel.addColumn("FV Name");
- fvAdditionalTableModel.addColumn("Size");
- fvAdditionalTableModel.addColumn("Corresponding File Name");
- }
- return fvAdditionalTableModel;
- }
-
- /**
- * This method initializes jButtonAddFv
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAddFv() {
- if (jButtonAddFv == null) {
- jButtonAddFv = new JButton();
- jButtonAddFv.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonAddFv.setEnabled(true);
- jButtonAddFv.setText("New");
- jButtonAddFv.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableFvAdditional.isEditing()) {
- jTableFvAdditional.getCellEditor().stopCellEditing();
- }
- String[] row = {"", "", ""};
- fvAdditionalTableModel.addRow(row);
- }
- });
- }
- return jButtonAddFv;
- }
-
- /**
- * This method initializes jButtonDelFv
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDelFv() {
- if (jButtonDelFv == null) {
- jButtonDelFv = new JButton();
- jButtonDelFv.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonDelFv.setEnabled(true);
- jButtonDelFv.setText("Delete");
- jButtonDelFv.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- //delete row in FvAdditional table.
- int selectedRow = jTableFvAdditional.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- String fvName = fvAdditionalTableModel.getValueAt(selectedRow, 0) + "";
- fvAdditionalTableModel.removeRow(selectedRow);
- //
- //delete tab with selected FV name.
- //
- jTabbedPane.removeTabAt(jTabbedPane.indexOfTab(fvName));
- //delete FV Name from FvImages element.
- ffc.updateFvImageNameAll(fvName, null);
- //delete FvBinding from ModuleSA.
- ffc.removeFvBindingAll(fvName);
- docConsole.setSaved(false);
- }
- });
- }
- return jButtonDelFv;
- }
-
- /**
- * This method initializes jButtonAddFvOptions
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAddFvOptions() {
- if (jButtonAddFvOptions == null) {
- jButtonAddFvOptions = new JButton();
- jButtonAddFvOptions.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonAddFvOptions.setEnabled(true);
- jButtonAddFvOptions.setText("Options");
- jButtonAddFvOptions.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableFvAdditional.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- String fvName = jTableFvAdditional.getValueAt(selectedRow, 0)+"";
- String oldFvSize = jTableFvAdditional.getValueAt(selectedRow, 1)+"";
- String oldFileName = jTableFvAdditional.getValueAt(selectedRow, 2)+"";
- if (fvName.length() == 0) {
- return;
- }
- DefaultTableModel dtm = getFvAdditionalOptTableModel();
- new FpdFvOptions(fvName, dtm, ffc, docConsole);
-
- String[] updatedFvInfo = getBasicFvInfo (fvName);
- if (!oldFvSize.equalsIgnoreCase(updatedFvInfo[1])) {
- sizeFromOptionDlg = true;
- jTableFvAdditional.setValueAt(updatedFvInfo[1], selectedRow, 1);
- sizeFromOptionDlg = false;
- }
- if (!oldFileName.equals(updatedFvInfo[2])) {
- fileFromOptionDlg = true;
- jTableFvAdditional.setValueAt(updatedFvInfo[2], selectedRow, 2);
- fileFromOptionDlg = false;
- }
- }
- });
- }
- return jButtonAddFvOptions;
- }
-
- private String[] getBasicFvInfo (String fvName) {
- HashMap<String, String> mFvOpts = new HashMap<String, String>();
- ffc.getFvImagesFvImageOptions(fvName, mFvOpts);
- String bSize = "";
- String numBlks = "";
- String fvSize = "";
- String fvFile = "";
- if (mFvOpts.get("EFI_FILE_NAME") != null) {
- fvFile = mFvOpts.get("EFI_FILE_NAME");
- }
- if (mFvOpts.get("EFI_BLOCK_SIZE") != null && mFvOpts.get("EFI_NUM_BLOCKS") != null) {
- bSize = mFvOpts.get("EFI_BLOCK_SIZE");
- numBlks = mFvOpts.get("EFI_NUM_BLOCKS");
- boolean blockSizeWellFormat = true;
- boolean numOfBlockWellFormat = true;
- if (!DataValidation.isHexDoubleWordDataType(bSize) && !DataValidation.isInt(bSize)) {
- blockSizeWellFormat = false;
- JOptionPane.showMessageDialog(FpdFlash.this, fvName + " block size bad format.");
- }
- if (!DataValidation.isHexDoubleWordDataType(numBlks) && !DataValidation.isInt(numBlks)) {
- numOfBlockWellFormat = false;
- JOptionPane.showMessageDialog(FpdFlash.this, fvName + " number of blocks bad format.");
- }
- if (blockSizeWellFormat && numOfBlockWellFormat) {
- int size = Integer.decode(bSize);
- int num = Integer.decode(numBlks);
- fvSize = "0x" + Integer.toHexString(size*num);
- }
- }
-
- return new String[]{fvName, fvSize, fvFile};
-
- }
-
- /**
- * This method initializes jPanelBgFvName
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelBgFvName() {
- if (jPanelBgFvName == null) {
- jPanelBgFvName = new JPanel();
- jPanelBgFvName.setPreferredSize(new java.awt.Dimension(80,55));
- jPanelBgFvName.add(getJButtonFvNameAdd(), null);
- jPanelBgFvName.add(getJButtonFvNameDel(), null);
- }
- return jPanelBgFvName;
- }
-
- /**
- * This method initializes jPanelBgFvImage
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelBgFvImage() {
- if (jPanelBgFvImage == null) {
- jPanelBgFvImage = new JPanel();
- jPanelBgFvImage.setPreferredSize(new java.awt.Dimension(150,100));
- jPanelBgFvImage.add(getJButtonAddFvImage(), null);
- jPanelBgFvImage.add(getJButtonDelFvImage(), null);
- jPanelBgFvImage.add(getJButtonUpdateFvImage(), null);
- }
- return jPanelBgFvImage;
- }
-
- /**
- * This method initializes jPanelW
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelW() {
- if (jPanelW == null) {
- jPanelW = new JPanel();
- jPanelW.add(getJPanelBgFvImage(), null);
- }
- return jPanelW;
- }
-
- /**
- * This method initializes jPanelFvImageParaN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageParaN() {
- if (jPanelFvImageParaN == null) {
- FlowLayout flowLayout3 = new FlowLayout();
- flowLayout3.setAlignment(java.awt.FlowLayout.CENTER);
- jPanelFvImageParaN = new JPanel();
- jPanelFvImageParaN.setLayout(flowLayout3);
- jPanelFvImageParaN.add(new StarLabel(), null);
- jPanelFvImageParaN.add(jLabelFvImageNames, null);
- jPanelFvImageParaN.add(jLabelFvParaName, null);
- jPanelFvImageParaN.add(getJTextFieldFvParaName(), null);
- }
- return jPanelFvImageParaN;
- }
-
- /**
- * This method initializes jPanelFvImageParaS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageParaS() {
- if (jPanelFvImageParaS == null) {
- FlowLayout flowLayout6 = new FlowLayout();
- flowLayout6.setAlignment(java.awt.FlowLayout.CENTER);
- jPanelFvImageParaS = new JPanel();
- jPanelFvImageParaS.setLayout(flowLayout6);
- jPanelFvImageParaS.add(jLabelFvParaType, null);
- jPanelFvImageParaS.add(getJComboBoxFvParaType(), null);
- }
- return jPanelFvImageParaS;
- }
-
- /**
- * This method initializes jPanelFvImageParaC
- *
- * @return javax.swing.JPanel
- */
-// private JPanel getJPanelFvImageParaC() {
-// if (jPanelFvImageParaC == null) {
-// jPanelFvImageParaC = new JPanel();
-// jPanelFvImageParaC.add(getJScrollPaneFvImageNames(), null);
-// }
-// return jPanelFvImageParaC;
-// }
-
- /**
- * This method initializes jPanelFvImageOptsN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageOptsN() {
- if (jPanelFvImageOptsN == null) {
- jPanelFvImageOptsN = new JPanel();
- jPanelFvImageOptsN.add(jLabelOptions, null);
- jPanelFvImageOptsN.add(jLabelFvImageOptName, null);
- jPanelFvImageOptsN.add(getJTextFieldFvImageOptName(), null);
- jPanelFvImageOptsN.add(jLabelFvImageOptValue, null);
- jPanelFvImageOptsN.add(getJTextFieldFvImageOptValue(), null);
- }
- return jPanelFvImageOptsN;
- }
-
- /**
- * This method initializes jPanelFvImageOptsS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageOptsS() {
- if (jPanelFvImageOptsS == null) {
- jPanelFvImageOptsS = new JPanel();
- }
- return jPanelFvImageOptsS;
- }
-
- /**
- * This method initializes jPanelFvImageOptsC
- *
- * @return javax.swing.JPanel
- */
-// private JPanel getJPanelFvImageOptsC() {
-// if (jPanelFvImageOptsC == null) {
-// jPanelFvImageOptsC = new JPanel();
-// jPanelFvImageOptsC.add(getJScrollPane(), null);
-// }
-// return jPanelFvImageOptsC;
-// }
-
- /**
- * This method initializes jPanelFvImageParaE
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageParaE() {
- if (jPanelFvImageParaE == null) {
- jPanelFvImageParaE = new JPanel();
- jPanelFvImageParaE.add(getJPanelBgFvName(), null);
- }
- return jPanelFvImageParaE;
- }
-
- /**
- * This method initializes jPanelFvImageOptsE
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageOptsE() {
- if (jPanelFvImageOptsE == null) {
- jPanelFvImageOptsE = new JPanel();
- jPanelFvImageOptsE.add(getJPanelFvImageOptsButtonGroup(), null);
- }
- return jPanelFvImageOptsE;
- }
-
- /**
- * This method initializes jPanelFvImageSN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageSN() {
- if (jPanelFvImageSN == null) {
- jPanelFvImageSN = new JPanel();
- jPanelFvImageSN.add(getJCheckBoxFvProperty(), null);
- jPanelFvImageSN.add(jLabelFvPropName, null);
- jPanelFvImageSN.add(getJTextFieldFvPropName(), null);
- jPanelFvImageSN.add(jLabelFvPropValue, null);
- jPanelFvImageSN.add(getJTextFieldFvPropValue(), null);
- }
- return jPanelFvImageSN;
- }
-
- /**
- * This method initializes jPanelFvImageSE
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageSE() {
- if (jPanelFvImageSE == null) {
- jPanelFvImageSE = new JPanel();
- jPanelFvImageSE.add(getJPanelFvPropButtonGroup(), null);
- }
- return jPanelFvImageSE;
- }
-
- /**
- * This method initializes jPanelFvImageSS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelFvImageSS() {
- if (jPanelFvImageSS == null) {
- jPanelFvImageSS = new JPanel();
- }
- return jPanelFvImageSS;
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- new FpdFlash().setVisible(true);
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(660, 650);
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- this.setContentPane(getJContentPane());
- this.setTitle("FPD Flash Definitions");
- this.addInternalFrameListener(new InternalFrameAdapter(){
- public void internalFrameDeactivated(InternalFrameEvent e){
- if (jTableFvProp.isEditing()) {
- jTableFvProp.getCellEditor().stopCellEditing();
- }
- if (jTableFvImageNames.isEditing()) {
- jTableFvImageNames.getCellEditor().stopCellEditing();
- }
- if (jTableFvInfo.isEditing()) {
- jTableFvInfo.getCellEditor().stopCellEditing();
- }
- if (jTableFvAdditional.isEditing()) {
- jTableFvAdditional.getCellEditor().stopCellEditing();
- }
- }
- });
- }
-
- private void init(FpdFileContents ffc) {
- initFvAttributes();
-
- jTextFieldFdf.setText("");
- String fdfFile = ffc.getFlashDefinitionFile();
- if (fdfFile != null && fdfFile.length() > 0) {
- jCheckBoxFdf.setSelected(true);
- jTextFieldFdf.setText(fdfFile);
- String fdfPath = Workspace.getCurrentWorkspace() + File.separator + fdfFile;
- initFvInFdfTable(fdfPath);
- }
-
- initFvAdditionalTable();
- }
-
- private void getOptionNameValue(Map<String, String> m){
- for (int i = 0; i < jTableFvImageOpts.getRowCount(); ++i) {
- m.put(fvOptionTableModel.getValueAt(i, 0)+"", fvOptionTableModel.getValueAt(i, 1)+"");
- }
- }
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.EAST);
- jContentPane.add(getJPanelContentSouth(), java.awt.BorderLayout.SOUTH);
- jContentPane.add(getJPanelContentWest(), java.awt.BorderLayout.WEST);
- jContentPane.add(getJPanelContentNorth(), java.awt.BorderLayout.NORTH);
- jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- private void getFlashInfoFromFdf (String fdfPath) {
- File fdf = new File(fdfPath);
- if (!fdf.exists()) {
- return;
- }
- int lines = 0;
-
- try {
- FileReader reader = new FileReader(fdf);
- BufferedReader in = new BufferedReader(reader);
- String str;
-
- while ((str = in.readLine()) != null) {
- ++lines;
- str = str.trim();
- //
- // skip empty line, comment (start with //)
- //
- if (str.length() == 0 || str.startsWith("//")) {
- continue;
- }
- //
- // ErasePolarity
- //
- if (str.startsWith("ErasePolarity")) {
- erasePolarity = str.substring(str.indexOf("=") + 1, str.lastIndexOf(",")).trim();
- }
- //
- // dig into Block section.
- //
- if (str.startsWith("Block") && str.endsWith("}")) {
- String[] blockSec = str.split(",");
- String nv = blockSec[1].trim();
- String[] sizeSec = nv.split("=");
- vBlockSize.add(sizeSec[1].trim());
- }
-
- }
-
- reader.close();
- in.close();
- }
- catch (Exception e) {
-
- }
- }
-
- private void getFvInfoFromFdf(String fdfPath, Vector<FvInfoFromFdf> vFvInfo) {
- File fdf = new File(fdfPath);
- if (!fdf.exists()) {
- return;
- }
- int lines = 0;
-
- try {
- FileReader reader = new FileReader(fdf);
- BufferedReader in = new BufferedReader(reader);
- String str;
-
- while ((str = in.readLine()) != null) {
- ++lines;
- str = str.trim();
- //
- // skip empty line, comment (start with //)
- //
- if (str.length() == 0 || str.startsWith("//")) {
- continue;
- }
- //
- // dig into Region {} section, create FvInfoFromFdf object for it.
- //
- if (str.startsWith("Region") && str.endsWith("{")) {
- FvInfoFromFdf fvInfo = new FvInfoFromFdf();
- boolean nameFound = false;
- boolean sizeFound = false;
- while ((str = in.readLine()) != null) {
- ++lines;
- str = str.trim();
- //
- // skip empty line, comment (start with //)
- //
- if (str.length() == 0 || str.startsWith("//")) {
- continue;
- }
-
- if (str.startsWith("Name")) {
- int firstQuote = str.indexOf("\"");
- int lastQuote = str.lastIndexOf("\"");
- fvInfo.setFvName(str.substring(firstQuote + 1, lastQuote));
- nameFound = true;
- }
-
- if (str.startsWith("Size")) {
- int equalIndex = str.indexOf("=");
- int commaIndex = str.indexOf(",");
- fvInfo.setSize(str.substring(equalIndex + 1, commaIndex).trim());
- sizeFound = true;
- }
-
- if (nameFound && sizeFound) {
- break;
- }
- }
-
- vFvInfo.add(fvInfo);
- }
- //
- // dig into File {} section, supply file name information to existing FvInfoFromFdf object.
- //
- if (str.startsWith("File")) {
- boolean fileNameFound = false;
- boolean fvFound = false;
- String fileName = "";
- String fvName = "";
- while ((str = in.readLine()) != null) {
- ++lines;
- str = str.trim();
- //
- // skip empty line, comment (start with //)
- //
- if (str.length() == 0 || str.startsWith("//")) {
- continue;
- }
-
- if (str.startsWith("Name")) {
- int firstQuote = str.indexOf("\"");
- int lastQuote = str.lastIndexOf("\"");
- fileName = str.substring(firstQuote + 1, lastQuote);
- fileNameFound = true;
- }
-
- if (str.startsWith("Region")) {
- int firstQuote = str.indexOf("\"");
- int lastQuote = str.lastIndexOf("\"");
- fvName = str.substring(firstQuote + 1, lastQuote);
- fvFound = true;
- }
-
- if (fileNameFound && fvFound) {
- break;
- }
- }
-
- for (int i = 0; i <vFvInfo.size(); ++i) {
- if (vFvInfo.get(i).getFvName().equals(fvName)) {
- vFvInfo.get(i).setEfiFileName(fileName);
- }
- }
- }
-
- }
-
- reader.close();
- in.close();
- }
- catch (Exception e) {
-
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.tianocore.frameworkwizard.common.ui.IInternalFrame#actionPerformed(java.awt.event.ActionEvent)
- */
- @Override
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getActionCommand().equals("ModuleOrderPaneOk")) {
- docConsole.setSaved(false);
- jTabbedPane.setSelectedIndex(0);
- }
- else if (arg0.getActionCommand().equals("ModuleOrderPaneCancel")) {
- jTabbedPane.setSelectedIndex(0);
- }
- else {
- return;
- }
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
-
-class ModuleOrderPane extends JPanel implements ActionListener{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private JPanel jPanelModOrderN = null;
- private JPanel jPanelModOrderS = null;
- private JPanel jPanelModOrderC = null;
- private JScrollPane jScrollPaneModInFv = null;
- private JTable jTableModInFv = null;
- private JPanel jPanelController = null;
- private JScrollPane jScrollPaneFpdModules = null;
- private JTable jTableFpdModules = null;
- private JButton jButtonUp = null;
- private JButton jButtonInsert = null;
- private JButton jButtonRemove = null;
- private JButton jButtonDown = null;
- private JButton jButtonOk = null;
- private JButton jButtonCancel = null;
- private IDefaultTableModel modInFvTableModel = null;
- private IDefaultTableModel fpdModTableModel = null;
- private FpdFileContents ffc = null;
- private String title = null;
- private String outputFileName = null;
-
- public ModuleOrderPane(String tabTitle, String file, FpdFileContents inputFfc, ActionListener action) {
- super(new BorderLayout());
- title = tabTitle;
- outputFileName = file;
- ffc = inputFfc;
- add(getJPanelModOrderN(), java.awt.BorderLayout.NORTH);
- add(getJPanelModOrderS(), java.awt.BorderLayout.SOUTH);
- add(getJPanelModOrderC(), java.awt.BorderLayout.CENTER);
- jButtonOk.addActionListener(action);
- jButtonCancel.addActionListener(action);
-
- }
-
- public void showModulesInFv(String fvName) {
-
- if (modInFvTableModel == null) {
- return;
- }
- int size = ffc.getUserExtsIncModCount(fvName, "IMAGES", "1");
-
- if (size != -1) {
- String[][] saa = new String[size][5];
- ffc.getUserExtsIncMods(fvName, "IMAGES", "1", saa);
-
- for (int i = 0; i < size; ++i) {
- String moduleKey = saa[i][0] + " " + saa[i][1] + " " + saa[i][2] + " " + saa[i][3];
- ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
- String name = "N/A";
- if (mi != null) {
- name = mi.getName();
- }
-
- String[] row = { name, saa[i][0] , saa[i][1], saa[i][2] , saa[i][3], saa[i][4] };
- modInFvTableModel.addRow(row);
- }
- }
- //
- // From ModuleSAs, get module guids with FvBinding = fvName.
- //
- Vector<String[]> vModuleSA = new Vector<String[]>();
- ffc.getFrameworkModuleSAByFvBinding(fvName, vModuleSA);
- //
- // If BuildOptions->UserExtensions already contain these module info,
- // no need to add them into table again.
- //
- Iterator<String[]> iter = vModuleSA.iterator();
- while (iter.hasNext()){
- String[] sa = iter.next();
- if (!moduleInfoInTable (sa, modInFvTableModel)) {
- String moduleKey = sa[0] + " " + sa[1] + " " + sa[2] + " " + sa[3];
- ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
- String name = "N/A";
- if (mi != null) {
- name = mi.getName();
- }
- String[] row = { name, sa[0] , sa[1], sa[2] , sa[3], sa[4] };
- modInFvTableModel.addRow(row);
- }
- }
-
- }
-
- public void showAllModulesInPlatform() {
-
- if (modInFvTableModel == null || fpdModTableModel == null) {
- return;
- }
- int size = ffc.getFrameworkModulesCount();
- String[][] saa = new String[size][5];
- ffc.getFrameworkModulesInfo(saa);
-
- for (int i = 0; i < size; ++i) {
- if (moduleInfoInTable(saa[i], modInFvTableModel) || moduleInfoInTable(saa[i], fpdModTableModel)) {
- continue;
- }
- String moduleKey = saa[i][0] + " " + saa[i][1] + " " + saa[i][2] + " " + saa[i][3];
- ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
- String name = "N/A";
- if (mi != null) {
- name = mi.getName();
- }
- String[] row = { name, saa[i][0] , saa[i][1], saa[i][2] , saa[i][3], saa[i][4] };
- fpdModTableModel.addRow(row);
- }
-
- TableSorter sorter = (TableSorter)jTableFpdModules.getModel();
- sorter.setSortState(0, TableSorter.ASCENDING);
- }
-
-
- protected boolean moduleInfoInTable (String[] moduleInfo, DefaultTableModel model) {
- boolean matched = false;
- int size = model.getDataVector().size();
- for (int i = 0; i < size; ++i) {
- Vector rowData = (Vector)model.getDataVector().elementAt(i);
- for (int j = 1; j < rowData.size(); ++j) {
- if (rowData.elementAt(j) == null && moduleInfo[j-1] == null) {
- matched = true;
- }
- else if (rowData.elementAt(j).equals("null") && moduleInfo[j-1] == null) {
- matched = true;
- }
- else if (rowData.elementAt(j) == null && moduleInfo[j-1].equals("null")) {
- matched = true;
- }
- else if (rowData.elementAt(j) != null && rowData.elementAt(j).toString().equalsIgnoreCase(moduleInfo[j-1])) {
- matched = true;
- }
- else {
- matched = false;
- break;
- }
- }
-
- if (matched) {
- return true;
- }
-
- }
- return false;
- }
-
-
-
- /**
- * This method initializes jPanelModOrderN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelModOrderN() {
- if (jPanelModOrderN == null) {
- jPanelModOrderN = new JPanel();
- }
- return jPanelModOrderN;
- }
-
- /**
- * This method initializes jPanelModOrderS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelModOrderS() {
- if (jPanelModOrderS == null) {
- FlowLayout flowLayout6 = new FlowLayout();
- flowLayout6.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelModOrderS = new JPanel();
- jPanelModOrderS.setLayout(flowLayout6);
- jPanelModOrderS.add(getJButtonOk(), null);
- jPanelModOrderS.add(getJButtonCancel(), null);
- }
- return jPanelModOrderS;
- }
-
- /**
- * This method initializes jPanelModOrderC
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelModOrderC() {
- if (jPanelModOrderC == null) {
- jPanelModOrderC = new JPanel();
- jPanelModOrderC.add(getJScrollPaneModInFv(), null);
- jPanelModOrderC.add(getJPanelController(), null);
- jPanelModOrderC.add(getJScrollPaneFpdModules(), null);
- }
- return jPanelModOrderC;
- }
-
- /**
- * This method initializes jScrollPaneModInFv
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneModInFv() {
- if (jScrollPaneModInFv == null) {
- jScrollPaneModInFv = new JScrollPane();
- jScrollPaneModInFv.setPreferredSize(new java.awt.Dimension(200,500));
- jScrollPaneModInFv.setViewportView(getJTableModInFv());
- }
- return jScrollPaneModInFv;
- }
-
- /**
- * This method initializes jTableModInFv
- *
- * @return javax.swing.JTable
- */
- protected JTable getJTableModInFv() {
- if (jTableModInFv == null) {
- modInFvTableModel = new IDefaultTableModel();
-
- jTableModInFv = new JTable(modInFvTableModel){
- /**
- *
- */
- private static final long serialVersionUID = 4903583933542581721L;
-
- public String getToolTipText(MouseEvent e) {
- String tip = null;
- java.awt.Point p = e.getPoint();
- int rowIndex = rowAtPoint(p);
-// int colIndex = columnAtPoint(p);
-// int realColumnIndex = convertColumnIndexToModel(colIndex);
-
- TableModel model = getModel();
- String mg = (String) model.getValueAt(rowIndex, 1);
- String mv = (String) model.getValueAt(rowIndex, 2);
- String pg = (String) model.getValueAt(rowIndex, 3);
- String pv = (String) model.getValueAt(rowIndex, 4);
- String arch = (String) model.getValueAt(rowIndex, 5);
- ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv);
- if (mi != null) {
- tip = "Path: " + mi.getPath() + "; Arch: " + arch + ";";
- }
- else {
- tip = "No Module Path Information.";
- }
-
- return tip;
- }
-
- };
- modInFvTableModel.addColumn("Module Orders in FV");
- modInFvTableModel.addColumn("mg");
- modInFvTableModel.addColumn("mv");
- modInFvTableModel.addColumn("pg");
- modInFvTableModel.addColumn("pv");
- modInFvTableModel.addColumn("arch");
-
- for (int i = 1; i < 6; ++i) {
- jTableModInFv.removeColumn(jTableModInFv.getColumnModel().getColumn(jTableModInFv.getColumnCount()-1));
- }
-
- jTableModInFv.setRowHeight(20);
- jTableModInFv.setShowGrid(false);
- jTableModInFv.setAutoCreateColumnsFromModel(false);
- jTableModInFv.addMouseListener(new MouseAdapter() {
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
- */
- @Override
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getButton() == MouseEvent.BUTTON3) {
- java.awt.Point p = arg0.getPoint();
- int rowIndex = jTableModInFv.rowAtPoint(p);
- TableModel model = jTableModInFv.getModel();
- String mg = (String) model.getValueAt(rowIndex, 1);
- String mv = (String) model.getValueAt(rowIndex, 2);
- String pg = (String) model.getValueAt(rowIndex, 3);
- String pv = (String) model.getValueAt(rowIndex, 4);
- ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv);
- String details = "PackageGuid: " + pg + "; ModuleVer:" + mv + "; PkgVer:" + pv;
- if (mi != null) {
- details = "In Package " + mi.getPackageId().getName() + "; ModuleVer:" + mv + "; PkgVer:" + pv;
- }
- JOptionPane.showMessageDialog(ModuleOrderPane.this, details);
- }
- }
-
- });
- }
- return jTableModInFv;
- }
-
- /**
- * This method initializes jPanelController
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelController() {
- if (jPanelController == null) {
- FlowLayout flowLayout5 = new FlowLayout();
- flowLayout5.setVgap(50);
- flowLayout5.setHgap(50);
- jPanelController = new JPanel();
- jPanelController.setLayout(flowLayout5);
- jPanelController.setPreferredSize(new java.awt.Dimension(150,500));
- jPanelController.add(getJButtonUp(), null);
- jPanelController.add(getJButtonInsert(), null);
- jPanelController.add(getJButtonRemove(), null);
- jPanelController.add(getJButtonDown(), null);
- }
- return jPanelController;
- }
-
- /**
- * This method initializes jScrollPaneFpdModules
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFpdModules() {
- if (jScrollPaneFpdModules == null) {
- jScrollPaneFpdModules = new JScrollPane();
- jScrollPaneFpdModules.setPreferredSize(new java.awt.Dimension(200,500));
- jScrollPaneFpdModules.setViewportView(getJTableFpdModules());
- }
- return jScrollPaneFpdModules;
- }
-
- /**
- * This method initializes jTableFpdModules
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFpdModules() {
- if (jTableFpdModules == null) {
- fpdModTableModel = new IDefaultTableModel();
- TableSorter sorter = new TableSorter(fpdModTableModel);
- jTableFpdModules = new JTable(sorter){
- /**
- *
- */
- private static final long serialVersionUID = -4666296888377637808L;
-
- public String getToolTipText(MouseEvent e) {
- String tip = null;
- java.awt.Point p = e.getPoint();
- int rowIndex = rowAtPoint(p);
-// int colIndex = columnAtPoint(p);
-// int realColumnIndex = convertColumnIndexToModel(colIndex);
-
- TableModel model = getModel();
- String mg = (String) model.getValueAt(rowIndex, 1);
- String mv = (String) model.getValueAt(rowIndex, 2);
- String pg = (String) model.getValueAt(rowIndex, 3);
- String pv = (String) model.getValueAt(rowIndex, 4);
- String arch = (String) model.getValueAt(rowIndex, 5);
- ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv);
- if (mi != null) {
- tip = "Path: " + mi.getPath() + "; Arch: " + arch + ";";
- }
- else {
- tip = "No Module Path Information.";
- }
-
- return tip;
- }
-
- };
-
- fpdModTableModel.addColumn("Modules in Platform");
- fpdModTableModel.addColumn("mg");
- fpdModTableModel.addColumn("mv");
- fpdModTableModel.addColumn("pg");
- fpdModTableModel.addColumn("pv");
- fpdModTableModel.addColumn("arch");
-
- for (int i = 1; i < 6; ++i) {
- jTableFpdModules.removeColumn(jTableFpdModules.getColumnModel().getColumn(jTableFpdModules.getColumnCount()-1));
- }
- jTableFpdModules.setRowHeight(20);
- jTableFpdModules.setShowGrid(false);
- jTableFpdModules.setAutoCreateColumnsFromModel(false);
- jTableFpdModules.addMouseListener(new MouseAdapter() {
-
- /* (non-Javadoc)
- * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
- */
- @Override
- public void mouseClicked(MouseEvent arg0) {
- if (arg0.getButton() == MouseEvent.BUTTON3) {
- java.awt.Point p = arg0.getPoint();
- int rowIndex = jTableFpdModules.rowAtPoint(p);
- TableModel model = jTableFpdModules.getModel();
- String mg = (String) model.getValueAt(rowIndex, 1);
- String mv = (String) model.getValueAt(rowIndex, 2);
- String pg = (String) model.getValueAt(rowIndex, 3);
- String pv = (String) model.getValueAt(rowIndex, 4);
- ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv);
- String details = "PackageGuid: " + pg + "; ModuleVer:" + mv + "; PkgVer:" + pv;
- if (mi != null) {
- details = "In Package " + mi.getPackageId().getName() + "; ModuleVer:" + mv + "; PkgVer:" + pv;
- }
- JOptionPane.showMessageDialog(ModuleOrderPane.this, details);
- }
- }
-
- });
-
- }
- return jTableFpdModules;
- }
-
- /**
- * This method initializes jButtonUp
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonUp() {
- if (jButtonUp == null) {
- jButtonUp = new JButton();
- jButtonUp.setPreferredSize(new java.awt.Dimension(60,20));
- jButtonUp.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 14));
- jButtonUp.setText("^");
- jButtonUp.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableModInFv.getSelectedRow();
- if (selectedRow <= 0) {
- return;
- }
- modInFvTableModel.moveRow(selectedRow, selectedRow, selectedRow - 1);
- jTableModInFv.changeSelection(selectedRow - 1, 0, false, false);
- }
- });
- }
- return jButtonUp;
- }
-
- /**
- * This method initializes jButtonInsert
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonInsert() {
- if (jButtonInsert == null) {
- jButtonInsert = new JButton();
- jButtonInsert.setText("<");
- jButtonInsert.setPreferredSize(new java.awt.Dimension(60,20));
- jButtonInsert.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRowRight = jTableFpdModules.getSelectedRow();
- if (selectedRowRight < 0) {
- return;
- }
-
- int rowInModel = ((TableSorter)jTableFpdModules.getModel()).getModelRowIndex(selectedRowRight);
- String name = fpdModTableModel.getValueAt(rowInModel, 0)+"";
- String mg = fpdModTableModel.getValueAt(rowInModel, 1)+"";
- String mv = fpdModTableModel.getValueAt(rowInModel, 2)+"";
- String pg = fpdModTableModel.getValueAt(rowInModel, 3)+"";
- String pv = fpdModTableModel.getValueAt(rowInModel, 4)+"";
- String arch = fpdModTableModel.getValueAt(rowInModel, 5)+"";
- String[] row = {name, mg, mv, pg, pv, arch};
- if (name.length() == 0 || name.equals("N/A")) {
- return;
- }
-
- int selectedRowLeft = jTableModInFv.getSelectedRow();
- if (selectedRowLeft < 0) {
- modInFvTableModel.addRow(row);
- jTableModInFv.changeSelection(jTableModInFv.getRowCount() - 1, 0, false, false);
- }
- else {
- modInFvTableModel.insertRow(selectedRowLeft, row);
- jTableModInFv.changeSelection(selectedRowLeft, 0, false, false);
- }
- fpdModTableModel.removeRow(rowInModel);
- }
- });
- }
- return jButtonInsert;
- }
-
- /**
- * This method initializes jButtonRemove
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonRemove() {
- if (jButtonRemove == null) {
- jButtonRemove = new JButton();
- jButtonRemove.setPreferredSize(new java.awt.Dimension(60,20));
- jButtonRemove.setText(">");
- jButtonRemove.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRowLeft = jTableModInFv.getSelectedRow();
- if (selectedRowLeft < 0) {
- return;
- }
-
- String name = modInFvTableModel.getValueAt(selectedRowLeft, 0)+"";
- String mg = modInFvTableModel.getValueAt(selectedRowLeft, 1)+"";
- String mv = modInFvTableModel.getValueAt(selectedRowLeft, 2)+"";
- String pg = modInFvTableModel.getValueAt(selectedRowLeft, 3)+"";
- String pv = modInFvTableModel.getValueAt(selectedRowLeft, 4)+"";
- String arch = modInFvTableModel.getValueAt(selectedRowLeft, 5)+"";
- String[] row = {name, mg, mv, pg, pv, arch};
- String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch;
- if (name.length() == 0 || name.equals("N/A") || ffc.getModuleSA(moduleKey) == null) {
- JOptionPane.showMessageDialog(ModuleOrderPane.this, "Module " + name + " not exists in platform. If you want to add back this module, please first add it into current platform. " + moduleKey );
- modInFvTableModel.removeRow(selectedRowLeft);
- return;
- }
-
- fpdModTableModel.addRow(row);
- int viewIndex = ((TableSorter) jTableFpdModules.getModel()).getViewIndexArray()[jTableFpdModules
- .getRowCount() - 1];
- jTableFpdModules.changeSelection(viewIndex, 0, false, false);
- modInFvTableModel.removeRow(selectedRowLeft);
- }
- });
- }
- return jButtonRemove;
- }
-
- /**
- * This method initializes jButtonDown
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDown() {
- if (jButtonDown == null) {
- jButtonDown = new JButton();
- jButtonDown.setPreferredSize(new java.awt.Dimension(60,20));
- jButtonDown.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
- jButtonDown.setText("v");
- jButtonDown.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableModInFv.getSelectedRow();
- if (selectedRow >= jTableModInFv.getRowCount() - 1) {
- return;
- }
- modInFvTableModel.moveRow(selectedRow, selectedRow, selectedRow + 1);
- jTableModInFv.changeSelection(selectedRow + 1, 0, false, false);
- }
- });
- }
- return jButtonDown;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- */
- protected JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonOk.setText("Ok");
- jButtonOk.setActionCommand("ModuleOrderPaneOk");
- jButtonOk.addActionListener(this);
-
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- protected JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.setActionCommand("ModuleOrderPaneCancel");
-
- }
- return jButtonCancel;
- }
-
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getSource() == jButtonOk) {
- // need reset FvBindings in ModuleSA.
- ffc.removeFvBindingAll(title);
- //
- // collect module order information to store them into <BuildOptions> -> <UserExtensions>.
- // also update the FvBinding info in <ModuleSA>.
- //
- Vector<String[]> vModInFv = new Vector<String[]>();
- for (int i = 0; i < jTableModInFv.getRowCount(); ++i) {
- String moduleName = modInFvTableModel.getValueAt(i, 0)+"";
- if (moduleName.length() == 0 || moduleName.equals("N/A")) {
- continue;
- }
-
- String mg = modInFvTableModel.getValueAt(i, 1)+"";
- String mv = modInFvTableModel.getValueAt(i, 2)+"";
- String pg = modInFvTableModel.getValueAt(i, 3)+"";
- String pv = modInFvTableModel.getValueAt(i, 4)+"";
- String arch = modInFvTableModel.getValueAt(i, 5)+"";
-
- String moduleInfo = mg + " " + mv + " " + pg + " " + pv + " " + arch;
-
- String[] sa = { mg, mv, pg, pv, arch};
- vModInFv.add(sa);
- ffc.updateFvBindingInModuleSA(moduleInfo, title);
-
- }
- ffc.removeBuildOptionsUserExtensions(title, "IMAGES", "1");
- ffc.genBuildOptionsUserExtensions(title, "IMAGES", "1", outputFileName, vModInFv);
-
- }
- }
-
- /**
- * @return Returns the fpdModTableModel.
- */
- protected IDefaultTableModel getFpdModTableModel() {
- return fpdModTableModel;
- }
-
- /**
- * @return Returns the modInFvTableModel.
- */
- protected IDefaultTableModel getModInFvTableModel() {
- return modInFvTableModel;
- }
-}
-
-
-class FvOptsTableModel extends DefaultTableModel {
-
- private static final long serialVersionUID = 1L;
-
- private Vector<Object> vNonEditableName = new Vector<Object>();
- private Vector<Object> vKeyWords = new Vector<Object>();
-
- public boolean isCellEditable(int row, int col) {
-
- if (vNonEditableName.size() > 0 || vKeyWords.size() > 0) {
- if (vKeyWords.contains(getValueAt(row, 0))) {
- return false;
- }
- if (vNonEditableName.contains(getValueAt(row, 0)) && col == 0) {
- return false;
- }
- }
-
- if (col == 0 && getValueAt(row, 0) != null && getValueAt(row, 0).toString().length() > 0) {
- return false;
- }
-
- return true;
- }
-
- /**
- * @return Returns the vKeyWords.
- */
- protected Vector<Object> getVKeyWords() {
- return vKeyWords;
- }
-
- /**
- * @param keyWords The vKeyWords to set.
- */
- protected void setVKeyWords(Vector<Object> keyWords) {
- vKeyWords.removeAllElements();
- vKeyWords.addAll(keyWords);
- }
-
- /**
- * @return Returns the vNonEditableName.
- */
- protected Vector<Object> getVNonEditableName() {
- return vNonEditableName;
- }
-
- /**
- * @param nonEditableName The vNonEditableName to set.
- */
- protected void setVNonEditableName(Vector<Object> nonEditableName) {
- vNonEditableName.removeAllElements();
- vNonEditableName.addAll(nonEditableName);
- }
-
-}
-class ImageParaTableModel extends DefaultTableModel {
-
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int col) {
-// if (getValueAt(row, 1).equals("ImageName") && col >=1) {
-// return false;
-// }
-// return true;
- return false;
- }
-}
-
-class FvInfoFromFdf {
- private String fvName;
- private String size;
- private String efiFileName;
-
- public FvInfoFromFdf () {
- fvName = "";
- size = "";
- efiFileName = "";
- }
- public FvInfoFromFdf (String f, String s, String e) {
- this();
- fvName = f;
- size = s;
- efiFileName = e;
- }
- public String getEfiFileName() {
- return efiFileName;
- }
- public void setEfiFileName(String efiFileName) {
- this.efiFileName = efiFileName;
- }
- public String getFvName() {
- return fvName;
- }
- public void setFvName(String fvName) {
- this.fvName = fvName;
- }
- public String getSize() {
- return size;
- }
- public void setSize(String size) {
- this.size = size;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java deleted file mode 100644 index ae5fce8340..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java +++ /dev/null @@ -1,1084 +0,0 @@ -/** @file
-
- The file is used to create, update FrameworkModules of Fpd file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.FontMetrics;
-
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JSplitPane;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JButton;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.TableModelEvent;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseEvent;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Vector;
-
-public class FpdFrameworkModules extends IInternalFrame {
-
- /**
- * Initialize Globals
- */
- private static final long serialVersionUID = 1L;
-
- private static final int timeToWait = 2000;
-
- private static final int pcdSyncThreadNumber = 10;
-
- private long savedMs = 0;
-
- String searchField = "";
-
- public static final int forceDbgColForFpdModTable = 7;
-
- private JSplitPane jSplitPane = null;
-
- private JPanel jPanelTop = null;
-
- private JPanel jPanelBottom = null;
-
- private JLabel jLabel = null;
-
- private JScrollPane jScrollPaneAllModules = null;
-
- private JTable jTableAllModules = null;
-
- private JPanel jPanelTopSouth = null;
-
- private JButton jButtonAddModule = null;
-
- private JLabel jLabelModulesAdded = null;
-
- private JPanel jPanelBottomSouth = null;
-
- private JScrollPane jScrollPaneFpdModules = null;
-
- private JTable jTableFpdModules = null;
-
- private JButton jButtonSettings = null;
-
- private JButton jButtonRemoveModule = null;
-
- private NonEditableTableModel modelAllModules = null;
-
- private FpdModulesTableModel modelFpdModules = null;
-
- private FpdModuleSA settingDlg = null;
-
- private FpdFileContents ffc = null;
-
- private OpeningPlatformType docConsole = null;
-
- private Map<String, ArrayList<String>> fpdMsa = null;
-
- private ArrayList<ModuleIdentification> miList = null;
-
- /**
- * Column settings for displaying all modules in workspace
- */
- private final int modNameColForAllModTable = 0;
-
- private final int pkgNameColForAllModTable = 1;
-
- private final int pathColForAllModTable = 2;
-
- private final int typeColForAllModTable = 3;
-
- private final int pkgVerColForAllModTable = 5;
-
- private final int modVerColForAllModTable = 4;
-
- /**
- * Column settings for display modules in the FPD file
- */
- private final int modNameColForFpdModTable = 0;
-
- private final int pkgNameColForFpdModTable = 1;
-
- private final int pathColForFpdModTable = 2;
-
- private final int archColForFpdModTable = 3;
-
- private final int pkgVerColForFpdModTable = 6;
-
- private final int modVerColForFpdModTable = 5;
-
- private final int typeColForFpdModTable = 4;
-
- /**
- * FpdFileContents structure
- */
- private final int ffcModGuid = 0;
-
- private final int ffcModVer = 1;
-
- private final int ffcPkgGuid = 2;
-
- private final int ffcPkgVer = 3;
-
- private final int ffcModArch = 4;
-
- /**
- * Set Column Widths, Only the PATH should not have a max width.
- */
- private final int modNameMinWidth = 168;
-
- private final int modNamePrefWidth = 200;
-
- private final int modNameMaxWidth = 350;
-
- private final int pkgNameMinWidth = 100;
-
- private final int pkgNamePrefWidth = 130;
-
- private final int pkgNameMaxWidth = 150;
-
- private final int verMinWidth = 60;
-
- private final int verMaxWidth = 80;
-
- private final int verPrefWidth = 70;
-
- private final int pathPrefWidth = 600;
-
- private final int pathMinWidth = 280;
-
- private final int archPrefWidth = 80;
-
- private final int archMinWidth = 60;
-
- private final int archMaxWidth = 100;
-
- private final int typePrefWidth = 145;
-
- private final int typeMinWidth = 100;
-
- private final int typeMaxWidth = 155;
-
- private JButton jButtonApriori = null;
-
- /**
- * This method initializes jSplitPane
- *
- * This is the main edit window
- *
- * @return javax.swing.JSplitPane jSplitPane
- */
- private JSplitPane getJSplitPane() {
- if (jSplitPane == null) {
- jSplitPane = new JSplitPane();
- jSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
- jSplitPane.setDividerLocation(250);
- jSplitPane.setBottomComponent(getJPanelBottom());
- jSplitPane.setTopComponent(getJPanelTop());
- }
- return jSplitPane;
- }
-
- /**
- * This method initializes jPanelTop
- *
- * This panel contains the All Modules Table
- *
- * @return javax.swing.JPanel jPanelTop
- */
- private JPanel getJPanelTop() {
- if (jPanelTop == null) {
- jLabel = new JLabel();
- jLabel.setText(" Modules in Workspace");
- jPanelTop = new JPanel();
- jPanelTop.setLayout(new BorderLayout());
- jPanelTop.add(jLabel, java.awt.BorderLayout.NORTH);
- jPanelTop.add(getJScrollPaneAllModules(), java.awt.BorderLayout.CENTER);
- jPanelTop.add(getJPanelTopSouth(), java.awt.BorderLayout.SOUTH);
- }
- return jPanelTop;
- }
-
- /**
- * This method initializes jPanelBottom
- *
- * This panel contains the FPD Modules Table
- *
- * @return javax.swing.JPanel jPanelBottom
- */
- private JPanel getJPanelBottom() {
- if (jPanelBottom == null) {
- jLabelModulesAdded = new JLabel();
- jLabelModulesAdded.setText(" Modules Added into Platform");
- jPanelBottom = new JPanel();
- jPanelBottom.setLayout(new BorderLayout());
- jPanelBottom.add(jLabelModulesAdded, java.awt.BorderLayout.NORTH);
- jPanelBottom.add(getJPanelBottomSouth(), java.awt.BorderLayout.SOUTH);
- jPanelBottom.add(getJScrollPaneFpdModules(), java.awt.BorderLayout.CENTER);
- }
- return jPanelBottom;
- }
-
- /**
- * This method initializes jScrollPaneAllModules
- *
- * @return javax.swing.JScrollPane jScrollPaneAllModules
- */
- private JScrollPane getJScrollPaneAllModules() {
- if (jScrollPaneAllModules == null) {
- jScrollPaneAllModules = new JScrollPane();
- jScrollPaneAllModules.setPreferredSize(new java.awt.Dimension(600, 200));
- jScrollPaneAllModules.setViewportView(getJTableAllModules());
- }
- return jScrollPaneAllModules;
- }
-
- /**
- * This method initializes jTableAllModules
- *
- * @return javax.swing.JTable jTableAllModules
- */
- private JTable getJTableAllModules() {
- if (jTableAllModules == null) {
- modelAllModules = new NonEditableTableModel();
- TableSorter sorter = new TableSorter(modelAllModules);
- jTableAllModules = new JTable(sorter);
- sorter.setTableHeader(jTableAllModules.getTableHeader());
- jTableAllModules.setRowHeight(20);
- modelAllModules.addColumn("<html>Module<br>Name</html>");
- modelAllModules.addColumn("<html>Package<br>Name</html>");
- modelAllModules.addColumn("Path");
- modelAllModules.addColumn("<html>Module<br>Type</html>");
- modelAllModules.addColumn("<html>Module<br>Version</html>");
- modelAllModules.addColumn("<html>Package<br>Version</html>");
-
- javax.swing.table.TableColumn column = null;
- column = jTableAllModules.getColumnModel().getColumn(modNameColForAllModTable);
- column.setPreferredWidth(modNamePrefWidth);
- column.setMinWidth(modNameMinWidth);
- column.setMaxWidth(modNameMaxWidth);
- column = jTableAllModules.getColumnModel().getColumn(modVerColForAllModTable);
- column.setPreferredWidth(verPrefWidth);
- column.setMaxWidth(verMaxWidth);
- column.setMinWidth(verMinWidth);
- column = jTableAllModules.getColumnModel().getColumn(pkgNameColForAllModTable);
- column.setPreferredWidth(pkgNamePrefWidth);
- column.setMinWidth(pkgNameMinWidth);
- column.setMaxWidth(pkgNameMaxWidth);
- column = jTableAllModules.getColumnModel().getColumn(pkgVerColForAllModTable);
- column.setPreferredWidth(verPrefWidth);
- column.setMaxWidth(verMaxWidth);
- column.setMinWidth(verMinWidth);
- column = jTableAllModules.getColumnModel().getColumn(typeColForAllModTable);
- column.setPreferredWidth(typePrefWidth);
- column.setMaxWidth(typeMaxWidth);
- column.setMinWidth(typeMinWidth);
- column = jTableAllModules.getColumnModel().getColumn(pathColForAllModTable);
- column.setPreferredWidth(pathPrefWidth);
- column.setMinWidth(pathMinWidth);
-
- jTableAllModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableAllModules.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
- jTableAllModules.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent e) {
- if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
- java.awt.Point p = e.getPoint();
- int rowIndex = jTableAllModules.rowAtPoint(p);
- TableSorter sorter = (TableSorter) jTableAllModules.getModel();
- rowIndex = sorter.getModelRowIndex(rowIndex);
- addModuleIntoPlatform (rowIndex);
- }
- }
- });
- jTableAllModules.addKeyListener(new java.awt.event.KeyAdapter() {
- public void keyPressed(java.awt.event.KeyEvent e) {
- if (e.getKeyCode() == KeyEvent.VK_ENTER) {
- int selectedRow = jTableAllModules.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- TableSorter sorter = (TableSorter) jTableAllModules.getModel();
- selectedRow = sorter.getModelRowIndex(selectedRow);
- addModuleIntoPlatform (selectedRow);
- }
- }
- });
-
- jTableAllModules.addKeyListener(new java.awt.event.KeyAdapter() {
- public void keyTyped(java.awt.event.KeyEvent e) {
-
- if (System.currentTimeMillis() - savedMs < timeToWait) {
- searchField += e.getKeyChar();
- }
- else {
- searchField = "" + e.getKeyChar();
- }
-
- int viewIndex = gotoFoundRow (searchField, jTableAllModules);
- if (viewIndex >= 0){
- jTableAllModules.changeSelection(viewIndex, 0, false, false);
- }
- savedMs = System.currentTimeMillis();
- }
- });
-
-
- }
- return jTableAllModules;
- }
-
- private int gotoFoundRow (String s, JTable model) {
- for (int i = 0; i < model.getRowCount(); ++i) {
- if (model.getValueAt(i, 0) != null && model.getValueAt(i, 0).toString().regionMatches(true, 0, s, 0, s.length())) {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * This method initializes jPanelTopSouth
- *
- * This panel contains the ADD button
- *
- * @return javax.swing.JPanel jPanelTopSouth
- */
- private JPanel getJPanelTopSouth() {
- if (jPanelTopSouth == null) {
- FlowLayout flowLayout = new FlowLayout();
- flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelTopSouth = new JPanel();
- jPanelTopSouth.setLayout(flowLayout);
- jPanelTopSouth.add(getJButtonAddModule(), null);
- }
- return jPanelTopSouth;
- }
-
- private void addModuleIntoPlatform (int selectedRow) {
- String path = modelAllModules.getValueAt(selectedRow, pathColForAllModTable) + "";
- ModuleIdentification mi = miList.get(selectedRow);
- Vector<String> vArchs = null;
-
- vArchs = WorkspaceProfile.getModuleSupArchs(mi);
-
- if (vArchs == null) {
- JOptionPane.showMessageDialog(this, "No Supported Architectures specified in MSA file.");
- return;
- }
-
- Vector<Object> platformSupArch = new Vector<Object>();
- ffc.getPlatformDefsSupportedArchs(platformSupArch);
- platformSupArch.retainAll(vArchs);
- if (platformSupArch.size() == 0) {
- JOptionPane.showMessageDialog(this, "This Module does not support this platform architectures.");
- return;
- }
-
- String archsAdded = "";
- String mg = mi.getGuid();
- String mv = mi.getVersion();
- String pg = mi.getPackageId().getGuid();
- String pv = mi.getPackageId().getVersion();
- String mType = SurfaceAreaQuery.getModuleType(mi);
-
- ArrayList<String> al = fpdMsa.get(mg + mv + pg + pv);
- if (al == null) {
- //
- // if existing ModuleSA does not specify version info.
- //
- al = fpdMsa.get(mg + "null" + pg + "null");
- if (al == null) {
- al = fpdMsa.get(mg + "null" + pg + pv);
- if (al == null){
- al = fpdMsa.get(mg + mv + pg + "null");
- if (al == null) {
- al = new ArrayList<String>();
- fpdMsa.put(mg + mv + pg + pv, al);
- }
- }
- }
- }
- //
- // filter from module SupArchs what archs has been added.
- //
- for (int i = 0; i < al.size(); ++i) {
- vArchs.remove(al.get(i));
- }
- //
- // check whether archs conform to SupArch of platform.
- //
- platformSupArch.removeAllElements();
- ffc.getPlatformDefsSupportedArchs(platformSupArch);
- vArchs.retainAll(platformSupArch);
- //
- // Archs this Module supported have already been added.
- //
- if (vArchs.size() == 0) {
- JOptionPane.showMessageDialog(this, "This Module has already been added.");
- return;
- }
- //ToDo put Arch instead of null
- boolean errorOccurred = false;
- for (int i = 0; i < vArchs.size(); ++i) {
- String arch = vArchs.get(i);
- al.add(arch);
- archsAdded += arch + " ";
- String[] row = { "", "", "", "", "", "", "" };
-
- if (mi != null) {
- row[modNameColForFpdModTable] = mi.getName();
- row[pkgNameColForFpdModTable] = mi.getPackageId().getName();
- row[pathColForFpdModTable] = path;
- row[archColForFpdModTable] = arch;
- row[pkgVerColForFpdModTable] = pv;
- row[modVerColForFpdModTable] = mv;
- row[typeColForFpdModTable] = mType;
-
- }
- modelFpdModules.addRow(row);
-
- docConsole.setSaved(false);
- try {
- //ToDo : specify archs need to add.
- ffc.addFrameworkModulesPcdBuildDefs(mi, arch, null);
- } catch (Exception exception) {
- JOptionPane.showMessageDialog(this, "Adding " + row[modNameColForFpdModTable] + " with Supporting Architectures: " + arch
- + ": " + exception.getMessage());
- errorOccurred = true;
- }
- }
-
- String s = "This Module with Architecture " + archsAdded;
- if (errorOccurred) {
- s += " was added with Error. Platform may NOT Build.";
- } else {
- s += " was added Successfully.";
- }
- JOptionPane.showMessageDialog(this, s);
- TableSorter sorterFpdModules = (TableSorter)jTableFpdModules.getModel();
- int viewIndex = sorterFpdModules.getViewIndexArray()[modelFpdModules.getRowCount() - 1];
- jTableFpdModules.changeSelection(viewIndex, 0, false, false);
-
- }
-
- /**
- * This method initializes jButtonAddModule
- *
- * @return javax.swing.JButton jButtonAddModule
- */
- private JButton getJButtonAddModule() {
- if (jButtonAddModule == null) {
- jButtonAddModule = new JButton();
- jButtonAddModule.setPreferredSize(new java.awt.Dimension(130, 20));
- jButtonAddModule.setText("Add a Module");
- jButtonAddModule.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableAllModules.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
-
- TableSorter sorter = (TableSorter) jTableAllModules.getModel();
- selectedRow = sorter.getModelRowIndex(selectedRow);
- addModuleIntoPlatform (selectedRow);
- }
- });
- }
- return jButtonAddModule;
- }
-
- /**
- * This method initializes jPanelBottomSouth
- *
- * This panel contains the Settings and Remove Buttons
- *
- * @return javax.swing.JPanel jPanelBottomSouth
- */
- private JPanel getJPanelBottomSouth() {
- if (jPanelBottomSouth == null) {
- FlowLayout flowLayout1 = new FlowLayout();
- flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelBottomSouth = new JPanel();
- jPanelBottomSouth.setLayout(flowLayout1);
- jPanelBottomSouth.add(getJButtonSettings(), null);
- jPanelBottomSouth.add(getJButtonRemoveModule(), null);
- jPanelBottomSouth.add(getJButtonApriori(), null);
- }
- return jPanelBottomSouth;
- }
-
- /**
- * This method initializes jScrollPaneFpdModules
- *
- * @return javax.swing.JScrollPane jScrollPaneFpdModules
- */
- private JScrollPane getJScrollPaneFpdModules() {
- if (jScrollPaneFpdModules == null) {
- jScrollPaneFpdModules = new JScrollPane();
- jScrollPaneFpdModules.setPreferredSize(new java.awt.Dimension(453, 200));
- jScrollPaneFpdModules.setViewportView(getJTableFpdModules());
- }
- return jScrollPaneFpdModules;
- }
-
- /**
- * This method initializes jTableFpdModules
- *
- * @return javax.swing.JTable jTableFpdModules
- */
- private JTable getJTableFpdModules() {
- if (jTableFpdModules == null) {
- modelFpdModules = new FpdModulesTableModel();
- TableSorter sorter = new TableSorter(modelFpdModules);
- jTableFpdModules = new JTable(sorter);
- sorter.setTableHeader(jTableFpdModules.getTableHeader());
- jTableFpdModules.setRowHeight(20);
- modelFpdModules.addColumn("<html>Module<br>Name</html>");
- modelFpdModules.addColumn("<html>Package<br>Name</html>");
- modelFpdModules.addColumn("Path");
- modelFpdModules.addColumn("<html>Supported<br>Architectures</html>");
- modelFpdModules.addColumn("<html>Module<br>Type</html>");
- modelFpdModules.addColumn("<html>Module<br>Version</html>");
- modelFpdModules.addColumn("<html>Package<br>Version</html>");
- modelFpdModules.addColumn("<html>Force<br>Debug</html>");
-
- javax.swing.table.TableColumn column = null;
- column = jTableFpdModules.getColumnModel().getColumn(modNameColForFpdModTable);
- column.setPreferredWidth(modNamePrefWidth);
- column.setMinWidth(modNameMinWidth);
- column.setMaxWidth(modNameMaxWidth);
- column = jTableFpdModules.getColumnModel().getColumn(modVerColForFpdModTable);
- column.setPreferredWidth(verPrefWidth);
- column.setMaxWidth(verMaxWidth);
- column.setMinWidth(verMinWidth);
- column = jTableFpdModules.getColumnModel().getColumn(pkgNameColForFpdModTable);
- column.setPreferredWidth(pkgNamePrefWidth);
- column.setMinWidth(pkgNameMinWidth);
- column.setMaxWidth(pkgNameMaxWidth);
- column = jTableFpdModules.getColumnModel().getColumn(pkgVerColForFpdModTable);
- column.setPreferredWidth(verPrefWidth);
- column.setMaxWidth(verMaxWidth);
- column.setMinWidth(verMinWidth);
- column = jTableFpdModules.getColumnModel().getColumn(archColForFpdModTable);
- column.setPreferredWidth(archPrefWidth);
- column.setMaxWidth(archMaxWidth);
- column.setMinWidth(archMinWidth);
- column = jTableFpdModules.getColumnModel().getColumn(pathColForFpdModTable);
- column.setPreferredWidth(pathPrefWidth);
- column.setMinWidth(pathMinWidth);
- column = jTableFpdModules.getColumnModel().getColumn(typeColForFpdModTable);
- column.setPreferredWidth(typePrefWidth);
- column.setMaxWidth(typeMaxWidth);
- column.setMinWidth(typeMinWidth);
-
- jTableFpdModules.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableFpdModules.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
-
- jTableFpdModules.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent e) {
- if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
- java.awt.Point p = e.getPoint();
- int rowIndex = jTableFpdModules.rowAtPoint(p);
- TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
- rowIndex = sorter.getModelRowIndex(rowIndex);
- showSettingsDlg (rowIndex);
- }
- }
- });
-
- jTableFpdModules.addKeyListener(new java.awt.event.KeyAdapter() {
- public void keyPressed(java.awt.event.KeyEvent e) {
- if (e.getKeyCode() == KeyEvent.VK_ENTER) {
- int selectedRow = jTableFpdModules.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
- selectedRow = sorter.getModelRowIndex(selectedRow);
- showSettingsDlg (selectedRow);
- }
- }
- });
-
- jTableFpdModules.addKeyListener(new java.awt.event.KeyAdapter() {
- public void keyTyped(java.awt.event.KeyEvent e) {
-
- if (System.currentTimeMillis() - savedMs < timeToWait) {
- searchField += e.getKeyChar();
- }
- else {
- searchField = "" + e.getKeyChar();
- }
-
- int viewIndex = gotoFoundRow (searchField, jTableFpdModules);
- if (viewIndex >= 0){
- jTableFpdModules.changeSelection(viewIndex, 0, false, false);
- }
- savedMs = System.currentTimeMillis();
- }
- });
-
- jTableFpdModules.getModel().addTableModelListener(this);
- }
- return jTableFpdModules;
- }
-
- public void tableChanged(TableModelEvent arg0) {
- if (arg0.getType() == TableModelEvent.UPDATE){
- int row = arg0.getFirstRow();
- int column = arg0.getColumn();
- TableModel m = (TableModel)arg0.getSource();
-
- if (column != forceDbgColForFpdModTable) {
- return;
- }
- String s = m.getValueAt(row, column)+"";
- boolean dbgEnable = new Boolean(s);
- ffc.setModuleSAForceDebug(row, dbgEnable);
- docConsole.setSaved(false);
- }
- }
-
- private void showSettingsDlg (int row) {
-// As PCD sync. check is full platform range now during opening FrameworkModules editor,
-// the following check is no longer needed.
-// try {
-// Vector<String> vExceptions = new Vector<String>();
-// if (ffc.adjustPcd(row, vExceptions)) {
-// JOptionPane.showMessageDialog(frame, "Pcd entries sync. with those in MSA files.");
-// docConsole.setSaved(false);
-// }
-// }
-// catch (Exception exp) {
-// JOptionPane.showMessageDialog(frame, exp.getMessage());
-// }
-
- if (settingDlg == null) {
- settingDlg = new FpdModuleSA(ffc);
- }
-
- String[] sa = new String[5];
- ffc.getFrameworkModuleInfo(row, sa);
- String mg = sa[ffcModGuid];
- String mv = sa[ffcModVer];
- String pg = sa[ffcPkgGuid];
- String pv = sa[ffcPkgVer];
- String arch = sa[ffcModArch];
- settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv + " " + arch, row, docConsole);
- settingDlg.setVisible(true);
- }
- /**
- * This method initializes jButtonSettings
- *
- * @return javax.swing.JButton jButtonSettings
- */
- private JButton getJButtonSettings() {
- if (jButtonSettings == null) {
- jButtonSettings = new JButton();
- jButtonSettings.setPreferredSize(new java.awt.Dimension(130,20));
- jButtonSettings.setText("Settings");
- jButtonSettings.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableFpdModules.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
-
- TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
- selectedRow = sorter.getModelRowIndex(selectedRow);
- showSettingsDlg (selectedRow);
- }
- });
- }
- return jButtonSettings;
- }
-
- /**
- * This method initializes jButtonRemoveModule
- *
- * @return javax.swing.JButton jButtonRemoveModule
- */
- private JButton getJButtonRemoveModule() {
- if (jButtonRemoveModule == null) {
- jButtonRemoveModule = new JButton();
- jButtonRemoveModule.setText("Remove Module");
- FontMetrics fm = jButtonRemoveModule.getFontMetrics(jButtonRemoveModule.getFont());
- jButtonRemoveModule.setPreferredSize(new Dimension (fm.stringWidth(jButtonRemoveModule.getText()) + 40, 20));
- jButtonRemoveModule.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableFpdModules.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- int nextSelection = selectedRow;
-
- TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
- selectedRow = sorter.getModelRowIndex(selectedRow);
-
- String[] sa = new String[5];
- ffc.getFrameworkModuleInfo(selectedRow, sa);
- String mg = sa[ffcModGuid];
- String mv = sa[ffcModVer];
- String pg = sa[ffcPkgGuid];
- String pv = sa[ffcPkgVer];
- String arch = sa[ffcModArch];
- //
- // sync. module order list in BuildOptions-UserExtensions.
- //
- String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch;
- String fvBindings = ffc.getFvBinding(moduleKey);
- if (fvBindings != null) {
- String[] fvArray = fvBindings.split(" ");
- for (int i = 0; i < fvArray.length; ++i) {
- ffc.removeModuleInBuildOptionsUserExtensions(fvArray[i].trim(), "IMAGES", "1", mg, mv, pg, pv, arch);
- }
- }
-
- ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv + " " + arch);
- if (mi != null) {
- mv = mi.getVersion();
- pv = mi.getPackageId().getVersion();
- }
-
- try {
- ffc.removeModuleSA(selectedRow);
- }
- catch (Exception exp) {
- JOptionPane.showMessageDialog(FpdFrameworkModules.this, exp.getMessage());
- return;
- }
-
- if (arch == null) {
- // if no arch specified in ModuleSA
- fpdMsa.remove(mg + mv + pg + pv);
-
- } else {
- ArrayList<String> al = fpdMsa.get(mg + mv + pg + pv);
- if (al != null) {
- al.remove(arch);
- if (al.size() == 0) {
- fpdMsa.remove(mg + mv + pg + pv);
- }
- }
- }
-
- modelFpdModules.removeRow(selectedRow);
- if (nextSelection >= jTableFpdModules.getRowCount()) {
- nextSelection = jTableFpdModules.getRowCount() - 1;
- }
- jTableFpdModules.changeSelection(nextSelection, 0, false, false);
- docConsole.setSaved(false);
- }
- });
- }
- return jButtonRemoveModule;
- }
-
- /**
- * This method initializes jButtonApriori
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonApriori() {
- if (jButtonApriori == null) {
- jButtonApriori = new JButton();
- jButtonApriori.setText("Apriori Files");
- FontMetrics fm = jButtonApriori.getFontMetrics(jButtonApriori.getFont());
- int buttonWidth = fm.stringWidth(jButtonApriori.getText()) + 40;
- if (jButtonRemoveModule.getWidth() > buttonWidth) {
- buttonWidth = jButtonRemoveModule.getWidth();
- }
- jButtonApriori.setPreferredSize(new Dimension (buttonWidth, 20));
- jButtonApriori.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- new GenAprioriFileDialog(ffc, docConsole).setVisible(true);
- }});
- }
- return jButtonApriori;
- }
-
- /**
- *
- * @param args
- */
- public static void main(String[] args) {
- // Set the pane visable
- new FpdFrameworkModules().setVisible(true);
- }
-
- private class PcdSyncTask extends Thread {
-
- boolean pcdSynced = false;
- public void run () {
- Vector<String> vExceptions = new Vector<String>();
- pcdSync(vExceptions);
- if (pcdSynced) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "PCD in this platform are synchronized with those in MSA files.");
- docConsole.setSaved(false);
- }
- if (vExceptions.size() > 0) {
- String errorMsg = "";
- for (int i = 0; i < vExceptions.size(); ++i) {
- errorMsg += " " + vExceptions.get(i) + "\n";
- }
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Error occurred during synchronization:\n" + errorMsg);
- }
- }
-
- private void pcdSync(Vector<String> v) {
-
- Vector<PcdSyncSubTask> vThreads = new Vector<PcdSyncSubTask> ();
- int moduleCount = jTableFpdModules.getRowCount();
- int start = 0;
- for (int i = 0; i < FpdFrameworkModules.pcdSyncThreadNumber; ++i) {
- int end = start + moduleCount/FpdFrameworkModules.pcdSyncThreadNumber + 1;
- if (end > moduleCount) {
- end = moduleCount;
- }
- vThreads.add(new PcdSyncSubTask (start, end, v));
- start = end;
- }
-
- for (int i = 0; i < vThreads.size(); ++i) {
- vThreads.get(i).start();
- }
-
- try {
- for (int i = 0; i < vThreads.size(); ++i) {
- vThreads.get(i).join();
- }
- }
- catch (InterruptedException e) {
-
- }
-
- }
-
- private class PcdSyncSubTask extends Thread {
-
- private int startModule = 0;
- private int endModulePlusOne = 1;
- private Vector<String> v = null;
-
- PcdSyncSubTask (int start, int endPlusOne, Vector<String> vErr) {
- startModule = start;
- endModulePlusOne = endPlusOne;
- v = vErr;
- }
-
- public void run () {
- String[] sa = new String[5];
- for (int i = startModule; i < endModulePlusOne; ++i) {
- try {
- ffc.getFrameworkModuleInfo(i, sa);
- String mg = sa[ffcModGuid];
- String mv = sa[ffcModVer];
- String pg = sa[ffcPkgGuid];
- String pv = sa[ffcPkgVer];
- String arch = sa[ffcModArch];
- String key = mg + " " + mv + " " + pg + " " + pv + " " + arch;
- if (ffc.adjustPcd(key, v)) {
- pcdSynced = true;
- }
- }
- catch (Exception exp) {
-// JOptionPane.showMessageDialog(frame, exp.getMessage());
- continue;
- }
- }
- }
- }
- }
-
- /**
- * This is the default constructor
- */
- public FpdFrameworkModules() {
- super();
- initialize();
- }
-
- public FpdFrameworkModules(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
- this();
- init(fpd);
-
- }
-
- private PcdSyncTask pst = null;
- public FpdFrameworkModules(OpeningPlatformType opt) {
- this(opt.getXmlFpd());
- docConsole = opt;
- if (pst == null) {
- pst = new PcdSyncTask();
- }
- pst.start();
- }
-
- private void init(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
-
- if (ffc == null) {
- ffc = new FpdFileContents(fpd);
- ffc.initDynPcdMap();
- }
-
- if (fpdMsa == null) {
- fpdMsa = new HashMap<String, ArrayList<String>>();
- }
-
- if (ffc.getFrameworkModulesCount() > 0) {
- String[][] saa = new String[ffc.getFrameworkModulesCount()][5];
- ffc.getFrameworkModulesInfo(saa);
- for (int i = 0; i < saa.length; ++i) {
- ModuleIdentification mi = WorkspaceProfile.getModuleId(saa[i][ffcModGuid] + " " + saa[i][ffcModVer] + " "
- + saa[i][ffcPkgGuid] + " " + saa[i][ffcPkgVer]);
- Object[] row = { "", "", "", "", "", "", "", "" };
- if (mi != null) {
- row[modNameColForFpdModTable] = mi.getName();
- row[modVerColForFpdModTable] = mi.getVersion();
- row[typeColForFpdModTable] = SurfaceAreaQuery.getModuleType(mi);
- row[pkgNameColForFpdModTable] = mi.getPackageId().getName();
- row[pkgVerColForFpdModTable] = mi.getPackageId().getVersion();
- row[archColForFpdModTable] = saa[i][ffcModArch];
- try {
- row[pathColForFpdModTable] = mi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1);
- } catch (Exception e) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Show FPD Modules:" + e.getMessage());
- }
-
- String fpdMsaKey = saa[i][ffcModGuid] + row[modVerColForFpdModTable]
- + saa[i][ffcPkgGuid] + row[pkgVerColForFpdModTable];
- ArrayList<String> al = fpdMsa.get(fpdMsaKey);
- if (al == null) {
- al = new ArrayList<String>();
- fpdMsa.put(fpdMsaKey, al);
- }
- al.add(saa[i][ffcModArch]);
- }
- else {
- row[modNameColForFpdModTable] = saa[i][ffcModGuid];
- row[modVerColForFpdModTable] = saa[i][ffcModVer];
- row[pkgNameColForFpdModTable] = saa[i][ffcPkgGuid];
- row[pkgVerColForFpdModTable] = saa[i][ffcPkgVer];
- row[archColForFpdModTable] = saa[i][ffcModArch];
- }
- row[forceDbgColForFpdModTable] = ffc.getModuleSAForceDebug(i);
- modelFpdModules.addRow(row);
-
- }
- TableSorter sorter = (TableSorter)jTableFpdModules.getModel();
- sorter.setSortState(modNameColForFpdModTable, TableSorter.ASCENDING);
- }
-
- showAllModules();
-
- }
-
- private void showAllModules() {
-
- if (miList == null) {
- miList = new ArrayList<ModuleIdentification>();
- }
-
- String[] s = { "", "", "", "", "", "" };
-
- Iterator ismi = GlobalData.vModuleList.iterator();
- while (ismi.hasNext()) {
- ModuleIdentification mi = (ModuleIdentification) ismi.next();
- s[modNameColForAllModTable] = mi.getName();
- s[modVerColForAllModTable] = mi.getVersion();
- s[typeColForAllModTable] = SurfaceAreaQuery.getModuleType(mi);
- s[pkgNameColForAllModTable] = mi.getPackageId().getName();
- s[pkgVerColForAllModTable] = mi.getPackageId().getVersion();
- try {
- s[pathColForAllModTable] = mi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1);
- } catch (Exception e) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Show All Modules:" + e.getMessage());
- }
- modelAllModules.addRow(s);
- miList.add(mi);
- }
-
-
- TableSorter sorter = (TableSorter)jTableAllModules.getModel();
- sorter.setSortState(modNameColForAllModTable, TableSorter.ASCENDING);
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(633, 533);
- this.setTitle("Framework Modules");
- this.setContentPane(getJSplitPane());
- this.setVisible(true);
-
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
-
-class NonEditableTableModel extends DefaultTableModel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int col) {
- return false;
- }
-}
-
-class FpdModulesTableModel extends DefaultTableModel {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public Class<?> getColumnClass (int c) {
- if (getValueAt(0, c) != null){
- return getValueAt(0, c).getClass();
- }
- return String.class;
- }
-
- public boolean isCellEditable (int row, int col) {
- if (col == FpdFrameworkModules.forceDbgColForFpdModTable) {
- return true;
- }
- return false;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFvOptions.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFvOptions.java deleted file mode 100644 index b91f0c8f03..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFvOptions.java +++ /dev/null @@ -1,368 +0,0 @@ -/** @file
- Java class FpdFvOptions is GUI for FV options in FPD file.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.MouseEvent;
-import java.awt.event.WindowEvent;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Set;
-
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JDialog;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-import javax.swing.JButton;
-
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-
-/**
- *
- *
- */
-public class FpdFvOptions extends JDialog {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private static JFrame frame;
- private JPanel jContentPane = null;
- private JPanel jPanelN = null;
- private JPanel jPanelS = null;
- private JPanel jPanelC = null;
- private JScrollPane jScrollPaneFvOptions = null;
- private JTable jTableFvOptions = null;
- private DefaultTableModel tableModel = null;
- private String fvName = null;
- private FpdFileContents ffc = null;
- private OpeningPlatformType docConsole = null;
- private JButton jButtonNew = null;
- private JButton jButtonDelete = null;
- private String oldOptionName = "";
- private int selectedRow = -1;
- private TableModelListener tableModelListener = null;
-
- /**
- * This is the default constructor
- */
- public FpdFvOptions(String name, DefaultTableModel tm, FpdFileContents ffc, OpeningPlatformType dc) {
- super(FrameworkWizardUI.getInstance());
- fvName = name;
- this.ffc = ffc;
- this.docConsole = dc;
- setTableModel(tm);
- initOptions();
- initialize();
-
- }
-
- protected void processWindowEvent (WindowEvent e) {
- if (e.getID() == WindowEvent.WINDOW_CLOSING) {
- if (jTableFvOptions.isEditing()) {
- jTableFvOptions.getCellEditor().stopCellEditing();
- }
- tableModel.removeTableModelListener(tableModelListener);
- this.dispose();
- }
- }
-
- private void initOptions() {
- tableModel.setRowCount(0);
- LinkedHashMap<String, String> mOpts = new LinkedHashMap<String, String>();
- ffc.getFvImagesFvImageOptions(fvName, mOpts);
- Set<String> sKey = mOpts.keySet();
- Iterator<String> iter = sKey.iterator();
- while (iter.hasNext()) {
- String name = iter.next();
- String value = mOpts.get(name);
- tableModel.addRow(new String[]{name, value});
- }
- }
-
- private boolean fvOptionNameExists (String name) {
- int count = 0;
- for (int i = 0; i < jTableFvOptions.getRowCount(); ++i) {
- if (getTableModel().getValueAt(i, 0).equals(name)) {
- ++count;
- }
- }
- if (count > 1) {
- return true;
- }
- return false;
- }
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(650, 400);
- this.setModal(true);
- this.setTitle("FV Options");
- this.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
- this.setContentPane(getJContentPane());
- this.centerWindow();
- this.setVisible(true);
-
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJPanelN(), java.awt.BorderLayout.NORTH);
- jContentPane.add(getJPanelS(), java.awt.BorderLayout.SOUTH);
- jContentPane.add(getJPanelC(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes jPanelN
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelN() {
- if (jPanelN == null) {
- jPanelN = new JPanel();
- }
- return jPanelN;
- }
-
- /**
- * This method initializes jPanelS
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelS() {
- if (jPanelS == null) {
- jPanelS = new JPanel();
- jPanelS.add(getJButtonNew(), null);
- jPanelS.add(getJButtonDelete(), null);
- }
- return jPanelS;
- }
-
- /**
- * This method initializes jPanelC
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelC() {
- if (jPanelC == null) {
- jPanelC = new JPanel();
- jPanelC.add(getJScrollPaneFvOptions(), null);
- }
- return jPanelC;
- }
-
- /**
- * This method initializes jScrollPaneFvOptions
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneFvOptions() {
- if (jScrollPaneFvOptions == null) {
- jScrollPaneFvOptions = new JScrollPane();
- jScrollPaneFvOptions.setPreferredSize(new java.awt.Dimension(600,320));
- jScrollPaneFvOptions.setViewportView(getJTableFvOptions());
- }
- return jScrollPaneFvOptions;
- }
-
- /**
- * This method initializes jTableFvOptions
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableFvOptions() {
- if (jTableFvOptions == null) {
- jTableFvOptions = new JTable(getTableModel()) {
- /**
- *
- */
- private static final long serialVersionUID = -1941328952828651192L;
-
- public String getToolTipText(MouseEvent e) {
- String tip = null;
- java.awt.Point p = e.getPoint();
- int rowIndex = rowAtPoint(p);
-// int colIndex = columnAtPoint(p);
-// int realColumnIndex = convertColumnIndexToModel(colIndex);
-
- TableModel model = getModel();
- String optName = (String) model.getValueAt(rowIndex, 0);
- if (((FvOptsTableModel)model).getVKeyWords().contains(optName)){
- tip = optName + " is from Flash Definition File and it is NOT editable.";
- }
-
- return tip;
- }
-
- };
-
- jTableFvOptions.setRowHeight(20);
-
- jTableFvOptions.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()) {
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- } else {
- selectedRow = lsm.getMinSelectionIndex();
- oldOptionName = getTableModel().getValueAt(selectedRow, 0)+"";
- }
- }
- });
-
- tableModelListener = new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- int col = arg0.getColumn();
- TableModel m = (TableModel) arg0.getSource();
-
- if (arg0.getType() == TableModelEvent.UPDATE) {
- String newOptionName = m.getValueAt(row, 0) + "";
- if (col == 0) {
- if (newOptionName.equals(oldOptionName)) {
- return;
- }
- if (fvOptionNameExists(newOptionName)) {
- JOptionPane.showMessageDialog(frame, "This Option already exists. Please choose another Option name.");
- m.setValueAt(oldOptionName, row, 0);
- return;
- }
-
- ffc.setTypedNamedFvImageNameValue(fvName, "Options", oldOptionName, m.getValueAt(row, 1)+"", newOptionName);
- docConsole.setSaved(false);
- oldOptionName = newOptionName;
- }
-
- if (col == 1) {
- ffc.setTypedNamedFvImageNameValue(fvName, "Options", oldOptionName, m.getValueAt(row, 1)+"", newOptionName);
- docConsole.setSaved(false);
- }
-
- }
- }
- };
-
- jTableFvOptions.getModel().addTableModelListener(tableModelListener);
- }
- return jTableFvOptions;
- }
-
- protected DefaultTableModel getTableModel() {
- return tableModel;
- }
-
- protected void setTableModel(DefaultTableModel tableModel) {
-
- this.tableModel = tableModel;
-
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-
-/**
- * This method initializes jButtonNew
- *
- * @return javax.swing.JButton
- */
-private JButton getJButtonNew() {
- if (jButtonNew == null) {
- jButtonNew = new JButton();
- jButtonNew.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonNew.setText("New");
- jButtonNew.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- tableModel.addRow(new String[]{"", ""});
- oldOptionName = "";
- }
- });
- }
- return jButtonNew;
-}
-
-/**
- * This method initializes jButtonDelete
- *
- * @return javax.swing.JButton
- */
-private JButton getJButtonDelete() {
- if (jButtonDelete == null) {
- jButtonDelete = new JButton();
- jButtonDelete.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonDelete.setText("Delete");
- jButtonDelete.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int selectedRow = jTableFvOptions.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- String optName = tableModel.getValueAt(selectedRow, 0)+"";
- if (((FvOptsTableModel)tableModel).getVKeyWords().contains(optName)){
- return;
- }
- if (((FvOptsTableModel)tableModel).getVNonEditableName().contains(optName)){
- return;
- }
-
- ffc.removeTypedNamedFvImageNameValue(fvName, "Options", optName);
- tableModel.removeRow(selectedRow);
- docConsole.setSaved(false);
- }
- });
- }
- return jButtonDelete;
-}
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java deleted file mode 100644 index 516b063d66..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java +++ /dev/null @@ -1,786 +0,0 @@ -/** @file
-
- The file is used to create, update FpdHeader of Fpd file
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentEvent;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-
-
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-
-/**
- The class is used to create, update FpdHeader of Fpd file
- It extends IInternalFrame
-
- @since PackageEditor 1.0
-
- **/
-public class FpdHeader extends IInternalFrame implements DocumentListener{
-
- private int dialogWidth = 560;
-
- private int labelColumn = 12;
-
- private int labelWidth = 155;
-
- private int buttonWidth = 60;
-
- private final int valueColumn = 168;
-
- private final int valueWidth = 320;
-
- private final int specWidth = 420;
-
- private int shortValueWidth = valueWidth - (buttonWidth + 5);
-
- private final int oneRowHeight = 20;
-
- private final int threeRowHeight = 60;
-
- private final int fourRowHeight = 80;
-
- private final int rowSep = 5;
-
- private final int rowOne = 12;
-
- private final int rowTwo = rowOne + oneRowHeight + rowSep;
-
- private final int rowThree = rowTwo + oneRowHeight + rowSep;
-
- private final int rowFour = rowThree + oneRowHeight + rowSep;
-
- private final int rowFive = rowFour + threeRowHeight + rowSep;
-
- private final int rowSix = rowFive + fourRowHeight + rowSep;
-
- private final int rowSeven = rowSix + oneRowHeight + rowSep;
-
- private final int rowEight = rowSeven + oneRowHeight + rowSep;
-
- private final int rowNine = rowEight + fourRowHeight + threeRowHeight +rowSep;
-
- private int dialogHeight = rowNine + threeRowHeight;
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = -8152099582923006900L;
-
- //
- //Define class members
- //
- private JPanel jContentPane = null; // @jve:decl-index=0:visual-constraint="10,53"
-
- private JLabel jLabelBaseName = null;
-
- private JTextField jTextFieldBaseName = null;
-
- private JLabel jLabelGuid = null;
-
- private JTextField jTextFieldGuid = null;
-
- private JLabel jLabelVersion = null;
-
- private JTextField jTextFieldVersion = null;
-
- private JButton jButtonGenerateGuid = null;
-
- private JLabel jLabelLicense = null;
-
- private JTextArea jTextAreaLicense = null;
-
- private JLabel jLabelCopyright = null;
-
- private JLabel jLabelDescription = null;
-
- private JTextArea jTextAreaDescription = null;
-
- private JTextField jTextFieldSpecification = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private JScrollPane jScrollPaneLicense = null;
-
- private JScrollPane jScrollPaneDescription = null;
-
- private JScrollPane jCopyrightScrollPane = null;
-
- private JLabel jLabelAbstract = null;
-
- private JTextField jTextFieldAbstract = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel2 = null;
-
- private StarLabel jStarLabel3 = null;
-
- private StarLabel jStarLabel4 = null;
-
- private StarLabel jStarLabel5 = null;
-
- private StarLabel jStarLabel7 = null;
-
- private StarLabel jStarLabel8 = null;
-
- private JTextArea jCopyrightTextArea = null;
-
- private JLabel jLabel = null;
-
- private JTextField jTextFieldUrl = null;
-
- private FpdFileContents ffc = null;
-
- private OpeningPlatformType docConsole = null;
-
- private boolean amended = false;
-
- /**
- This method initializes jTextFieldBaseName
-
- @return javax.swing.JTextField jTextFieldBaseName
-
- **/
- private JTextField getJTextFieldBaseName() {
- if (jTextFieldBaseName == null) {
- jTextFieldBaseName = new JTextField();
- jTextFieldBaseName.setBounds(new java.awt.Rectangle(valueColumn, rowOne, valueWidth, oneRowHeight));
- jTextFieldBaseName.setPreferredSize(new java.awt.Dimension(valueWidth,oneRowHeight));
- jTextFieldBaseName.getDocument().addDocumentListener(this);
- jTextFieldBaseName.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isUiNameType(jTextFieldBaseName.getText())) {
- JOptionPane.showMessageDialog(FpdHeader.this, "Package Name does not match the UiNameType datatype.");
- return;
- }
- if (jTextFieldBaseName.getText().equals(ffc.getFpdHdrPlatformName())) {
- return;
- }
- ffc.setFpdHdrPlatformName(jTextFieldBaseName.getText());
- }
- });
- }
- return jTextFieldBaseName;
- }
-
- /**
- This method initializes jTextFieldGuid
-
- @return javax.swing.JTextField jTextFieldGuid
-
- **/
- private JTextField getJTextFieldGuid() {
- if (jTextFieldGuid == null) {
- jTextFieldGuid = new JTextField();
- jTextFieldGuid.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, shortValueWidth, oneRowHeight));
- jTextFieldGuid.setPreferredSize(new java.awt.Dimension(shortValueWidth,oneRowHeight));
- jTextFieldGuid.getDocument().addDocumentListener(this);
- jTextFieldGuid.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isGuid(jTextFieldGuid.getText())) {
- JOptionPane.showMessageDialog(FpdHeader.this, "Guid must be in registry (8-4-4-4-12) format.");
- return;
- }
- if (jTextFieldGuid.getText().equals(ffc.getFpdHdrGuidValue())) {
- return;
- }
- ffc.setFpdHdrGuidValue(jTextFieldGuid.getText());
- }
- });
- }
- return jTextFieldGuid;
- }
-
- /**
- This method initializes jTextFieldVersion
-
- @return javax.swing.JTextField jTextFieldVersion
-
- **/
- private JTextField getJTextFieldVersion() {
- if (jTextFieldVersion == null) {
- jTextFieldVersion = new JTextField();
- jTextFieldVersion.setBounds(new java.awt.Rectangle(valueColumn, rowThree, valueWidth, oneRowHeight));
- jTextFieldVersion.setPreferredSize(new java.awt.Dimension(valueWidth,oneRowHeight));
- jTextFieldVersion.getDocument().addDocumentListener(this);
- jTextFieldVersion.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isVersion(jTextFieldVersion.getText())) {
- JOptionPane.showMessageDialog(FpdHeader.this, "Version does not match the Version datatype.");
- return;
- }
- if (jTextFieldVersion.getText().equals(ffc.getFpdHdrVer())) {
- return;
- }
- ffc.setFpdHdrVer(jTextFieldVersion.getText());
- }
- });
- }
- return jTextFieldVersion;
- }
-
- /**
- This method initializes jButtonGenerateGuid
-
- @return javax.swing.JButton jButtonGenerateGuid
-
- **/
- private JButton getJButtonGenerateGuid() {
- if (jButtonGenerateGuid == null) {
- jButtonGenerateGuid = new JButton();
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(valueColumn + shortValueWidth + 5, rowTwo, buttonWidth, oneRowHeight));
- jButtonGenerateGuid.setText("GEN");
- jButtonGenerateGuid.addActionListener(this);
- }
- return jButtonGenerateGuid;
- }
-
- /**
- This method initializes jTextAreaLicense
-
- @return javax.swing.JTextArea jTextAreaLicense
-
- **/
- private JTextArea getJTextAreaLicense() {
- if (jTextAreaLicense == null) {
- jTextAreaLicense = new JTextArea();
- jTextAreaLicense.setText("");
- jTextAreaLicense.setLineWrap(true);
- jTextAreaLicense.getDocument().addDocumentListener(this);
- jTextAreaLicense.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (jTextAreaLicense.getText().length() == 0) {
- JOptionPane.showMessageDialog(FpdHeader.this, "License must be entered!");
- return;
- }
- if (jTextAreaLicense.getText().equals(ffc.getFpdHdrLicense())) {
- return;
- }
- ffc.setFpdHdrLicense(jTextAreaLicense.getText());
- }
- });
- }
- return jTextAreaLicense;
- }
-
- /**
- This method initializes jTextAreaDescription
-
- @return javax.swing.JTextArea jTextAreaDescription
-
- **/
- private JTextArea getJTextAreaDescription() {
- if (jTextAreaDescription == null) {
- jTextAreaDescription = new JTextArea();
- jTextAreaDescription.setLineWrap(true);
- jTextAreaDescription.getDocument().addDocumentListener(this);
- jTextAreaDescription.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (jTextAreaDescription.getText().length() == 0) {
- JOptionPane.showMessageDialog(FpdHeader.this, "Description must be entered.");
- return;
- }
- if (jTextAreaDescription.getText().equals(ffc.getFpdHdrDescription())) {
- return;
- }
- ffc.setFpdHdrDescription(jTextAreaDescription.getText());
- }
- });
- }
- return jTextAreaDescription;
- }
-
- /**
- This method initializes jTextFieldSpecification
-
- @return javax.swing.JTextField jTextFieldSpecification
-
- **/
- private JTextField getJTextFieldSpecification() {
- if (jTextFieldSpecification == null) {
- jTextFieldSpecification = new JTextField();
- jTextFieldSpecification.setBounds(new java.awt.Rectangle(labelColumn,rowNine,specWidth,oneRowHeight));
- jTextFieldSpecification.setEditable(false);
- jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(specWidth,oneRowHeight));
- jTextFieldSpecification.setBorder(null);
-// jTextFieldSpecification.addFocusListener(new FocusAdapter(){
-// public void focusLost(FocusEvent e) {
-// ffc.setFpdHdrSpec(jTextFieldSpecification.getText());
-// }
-// });
- }
- return jTextFieldSpecification;
- }
-
- /**
- This method initializes jButtonOk
-
- @return javax.swing.JButton jButtonOk
-
- **/
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setText("OK");
- jButtonOk.setBounds(new java.awt.Rectangle(290,351,90,20));
- jButtonOk.setVisible(false);
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- This method initializes jButtonCancel
-
- @return javax.swing.JButton jButtonCancel
-
- **/
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setText("Cancel");
- jButtonCancel.setBounds(new java.awt.Rectangle(390,351,90,20));
- jButtonCancel.setVisible(false);
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- This method initializes jScrollPaneLicense
-
- @return javax.swing.JScrollPane jScrollPaneLicense
-
- **/
- private JScrollPane getJScrollPaneLicense() {
- if (jScrollPaneLicense == null) {
- jScrollPaneLicense = new JScrollPane();
- jScrollPaneLicense.setBounds(new java.awt.Rectangle(valueColumn,rowFive,valueWidth,fourRowHeight));
- jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneLicense.setPreferredSize(new java.awt.Dimension(valueWidth,fourRowHeight));
- jScrollPaneLicense.setViewportView(getJTextAreaLicense());
- }
- return jScrollPaneLicense;
- }
-
- /**
- This method initializes jScrollPaneDescription
-
- @return javax.swing.JScrollPane jScrollPaneDescription
-
- **/
- private JScrollPane getJScrollPaneDescription() {
- if (jScrollPaneDescription == null) {
- jScrollPaneDescription = new JScrollPane();
- jScrollPaneDescription.setBounds(new java.awt.Rectangle(valueColumn,rowEight,valueWidth,fourRowHeight));
- jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneDescription.setPreferredSize(new java.awt.Dimension(valueWidth, fourRowHeight));
- jScrollPaneDescription.setViewportView(getJTextAreaDescription());
- }
- return jScrollPaneDescription;
- }
-
- /**
- This method initializes jTextFieldAbstract
-
- @return javax.swing.JTextField jTextFieldAbstract
-
- **/
- private JTextField getJTextFieldAbstract() {
- if (jTextFieldAbstract == null) {
- jTextFieldAbstract = new JTextField();
- jTextFieldAbstract.setBounds(new java.awt.Rectangle(valueColumn,rowSeven,valueWidth,oneRowHeight));
- jTextFieldAbstract.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jTextFieldAbstract.getDocument().addDocumentListener(this);
- jTextFieldAbstract.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isAbstract(jTextFieldAbstract.getText())) {
- JOptionPane.showMessageDialog(FpdHeader.this, "Abstract must be entered.");
- return;
- }
- if (jTextFieldAbstract.getText().equals(ffc.getFpdHdrAbs())) {
- return;
- }
- ffc.setFpdHdrAbs(jTextFieldAbstract.getText());
- }
- });
- }
- return jTextFieldAbstract;
- }
-
- private JScrollPane getCopyrightScrollPane() {
- if (jCopyrightScrollPane == null) {
- jCopyrightScrollPane = new JScrollPane();
- jCopyrightScrollPane.setBounds(new java.awt.Rectangle(valueColumn, rowFour, valueWidth, threeRowHeight));
- jCopyrightScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jCopyrightScrollPane.setPreferredSize(new java.awt.Dimension(valueWidth, threeRowHeight));
- jCopyrightScrollPane.setViewportView(getJCopyrightTextArea());
- }
- return jCopyrightScrollPane;
- }
- /**
- This method initializes jTextFieldCopyright
-
- @return javax.swing.JTextField jTextFieldCopyright
-
- **/
- private JTextArea getJCopyrightTextArea() {
- if (jCopyrightTextArea == null) {
- jCopyrightTextArea = new JTextArea();
- jCopyrightTextArea.setWrapStyleWord(true);
- jCopyrightTextArea.setLineWrap(true);
- jCopyrightTextArea.getDocument().addDocumentListener(this);
- jCopyrightTextArea.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e) {
- if (!DataValidation.isCopyright(jCopyrightTextArea.getText())) {
- JOptionPane.showMessageDialog(FpdHeader.this, "Copyright must be entered.");
- return;
- }
- if (jCopyrightTextArea.getText().equals(ffc.getFpdHdrCopyright())) {
- return;
- }
- ffc.setFpdHdrCopyright(jCopyrightTextArea.getText());
- }
- });
- }
- return jCopyrightTextArea;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldUrl() {
- if (jTextFieldUrl == null) {
- jTextFieldUrl = new JTextField();
- jTextFieldUrl.setBounds(new java.awt.Rectangle(valueColumn,rowSix,valueWidth,oneRowHeight));
- jTextFieldUrl.setPreferredSize(new Dimension(valueWidth, oneRowHeight));
- jTextFieldUrl.getDocument().addDocumentListener(this);
- jTextFieldUrl.addFocusListener(new FocusAdapter(){
- public void focusLost(FocusEvent e){
- if (jTextFieldUrl.getText().length() == 0 && ffc.getFpdHdrUrl() == null) {
- return;
- }
- if (jTextFieldUrl.getText().equals(ffc.getFpdHdrUrl())) {
- return;
- }
- ffc.setFpdHdrLicense(jTextAreaLicense.getText());
- ffc.setFpdHdrUrl(jTextFieldUrl.getText());
- }
- });
- }
- return jTextFieldUrl;
- }
-
- public static void main(String[] args) {
- new FpdHeader().setVisible(true);
- }
-
- /**
- This is the default constructor
-
- **/
- public FpdHeader() {
- super();
- init();
- this.setVisible(true);
- }
-
- /**
- This is the override edit constructor
-
- @param inFpdHeader The input data of FpdHeaderDocument.FpdHeader
-
- **/
- public FpdHeader(PlatformSurfaceAreaDocument.PlatformSurfaceArea inFpd) {
- this();
- ffc = new FpdFileContents(inFpd);
- init(ffc);
-
- }
-
- public FpdHeader(OpeningPlatformType opt) {
- this(opt.getXmlFpd());
- docConsole = opt;
- if (amended) {
- docConsole.setSaved(false);
- amended = false;
- }
- }
-
- /**
- This method initializes this
-
- **/
- private void init() {
- //this.setSize(500, 515);
- this.setContentPane(getJContentPane());
- this.setTitle("Platform Surface Area Header");
- initFrame();
-
- }
-
- /**
- This method initializes this
- Fill values to all fields if these values are not empty
-
- @param inFpdHeader The input data of FpdHeaderDocument.FpdHeader
-
- **/
- private void init(FpdFileContents ffc) {
-
- if (ffc.getFpdHdrPlatformName() != null) {
- jTextFieldBaseName.setText(ffc.getFpdHdrPlatformName());
- }
- if (ffc.getFpdHdrGuidValue() != null) {
- jTextFieldGuid.setText(ffc.getFpdHdrGuidValue());
- }
- if (ffc.getFpdHdrVer() != null) {
- jTextFieldVersion.setText(ffc.getFpdHdrVer());
- }
- if (ffc.getFpdHdrLicense() != null) {
- jTextAreaLicense.setText(ffc.getFpdHdrLicense());
- }
- if (ffc.getFpdHdrAbs() != null) {
- jTextFieldAbstract.setText(ffc.getFpdHdrAbs());
- }
- if (ffc.getFpdHdrUrl() != null) {
- jTextFieldUrl.setText(ffc.getFpdHdrUrl());
- }
- if (ffc.getFpdHdrCopyright() != null) {
- jCopyrightTextArea.setText(ffc.getFpdHdrCopyright());
- }
- if (ffc.getFpdHdrDescription() != null) {
- jTextAreaDescription.setText(ffc.getFpdHdrDescription());
- }
- if (ffc.getFpdHdrSpec() != null) {
- jTextFieldSpecification.setText(ffc.getFpdHdrSpec());
- }
- ffc.setFpdHdrSpec(jTextFieldSpecification.getText());
-
- if (ffc.getPlatformDefsSkuInfoCount() == 0) {
- ffc.genPlatformDefsSkuInfo("0", "DEFAULT");
- amended = true;
- JOptionPane.showMessageDialog(this, "Default SKU set for this platform.");
- }
- Vector<Object> v = new Vector<Object>();
- ffc.getPlatformDefsSupportedArchs(v);
- if (v.size() == 0) {
- v.add("IA32");
- ffc.setPlatformDefsSupportedArchs(v);
- amended = true;
- JOptionPane.showMessageDialog(this, "Supported Arch. IA32 added for this platform.");
- }
- v.removeAllElements();
- ffc.getPlatformDefsBuildTargets(v);
- if (v.size() == 0) {
- v.add("DEBUG");
- ffc.setPlatformDefsBuildTargets(v);
- amended = true;
- JOptionPane.showMessageDialog(this, "Build target IA32 added for this platform.");
- }
- if (ffc.getPlatformDefsInterDir() == null) {
- ffc.setPlatformDefsInterDir("UNIFIED");
- amended = true;
- JOptionPane.showMessageDialog(this, "UNIFIED Intermediate Directory set for this platform.");
- }
- }
-
- /**
- This method initializes jContentPane
-
- @return javax.swing.JPanel jContentPane
-
- **/
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setLocation(new java.awt.Point(0, 0));
- jContentPane.setSize(new java.awt.Dimension(dialogWidth - 20 ,dialogHeight - 20));
-
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(labelColumn,rowSix,labelWidth,oneRowHeight));
- jLabel.setText("URL");
- jLabelAbstract = new JLabel();
- jLabelAbstract.setBounds(new java.awt.Rectangle(labelColumn,rowSeven,labelWidth,oneRowHeight));
- jLabelAbstract.setText("Abstract");
- jLabelDescription = new JLabel();
- jLabelDescription.setText("Description");
- jLabelDescription.setBounds(new java.awt.Rectangle(labelColumn,rowEight,labelWidth,oneRowHeight));
- jLabelCopyright = new JLabel();
- jLabelCopyright.setText("Copyright");
- jLabelCopyright.setBounds(new java.awt.Rectangle(labelColumn,rowFour,labelWidth,oneRowHeight));
- jLabelLicense = new JLabel();
- jLabelLicense.setText("License");
- jLabelLicense.setBounds(new java.awt.Rectangle(labelColumn,rowFive,labelWidth,oneRowHeight));
- jLabelVersion = new JLabel();
- jLabelVersion.setText("Version");
- jLabelVersion.setBounds(new java.awt.Rectangle(labelColumn, rowThree, labelWidth, oneRowHeight));
- jLabelGuid = new JLabel();
- jLabelGuid.setPreferredSize(new java.awt.Dimension(labelWidth, oneRowHeight));
- jLabelGuid.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));
- jLabelGuid.setText("Guid");
- jLabelBaseName = new JLabel();
- jLabelBaseName.setText("Platform Name");
- jLabelBaseName.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(0, rowOne));
- jStarLabel2 = new StarLabel();
- jStarLabel2.setLocation(new java.awt.Point(0, rowTwo));
- jStarLabel3 = new StarLabel();
- jStarLabel3.setLocation(new java.awt.Point(0, rowThree));
- jStarLabel4 = new StarLabel();
- jStarLabel4.setLocation(new java.awt.Point(0,rowFour));
- jStarLabel5 = new StarLabel();
- jStarLabel5.setLocation(new java.awt.Point(0,rowFive));
- jStarLabel7 = new StarLabel();
- jStarLabel7.setLocation(new java.awt.Point(0,rowSeven));
- jStarLabel8 = new StarLabel();
- jStarLabel8.setLocation(new java.awt.Point(0,rowEight));
-
- jContentPane.add(jLabelBaseName, null);
- jContentPane.add(getJTextFieldBaseName(), null);
- jContentPane.add(jLabelGuid, null);
- jContentPane.add(getJTextFieldGuid(), null);
- jContentPane.add(jLabelVersion, null);
- jContentPane.add(getJTextFieldVersion(), null);
- jContentPane.add(getJButtonGenerateGuid(), null);
- jContentPane.add(jLabelLicense, null);
- jContentPane.add(jLabelCopyright, null);
- jContentPane.add(jLabelDescription, null);
- jContentPane.add(getJTextFieldSpecification(), null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJScrollPaneLicense(), null);
- jContentPane.add(getJScrollPaneDescription(), null);
- jContentPane.add(jLabelAbstract, null);
- jContentPane.add(getJTextFieldAbstract(), null);
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel2, null);
- jContentPane.add(jStarLabel3, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(jStarLabel5, null);
- jContentPane.add(jStarLabel7, null);
- jContentPane.add(jStarLabel8, null);
- jContentPane.add(getCopyrightScrollPane(), null);
-
- jContentPane.add(jLabel, null);
- jContentPane.add(getJTextFieldUrl(), null);
- }
- 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() == jButtonGenerateGuid) {
- jTextFieldGuid.setText(Tools.generateUuidString());
- ffc.setFpdHdrGuidValue(jTextFieldGuid.getText());
- }
- }
-
-
- /**
- This method initializes Package type and Compontent type
-
- **/
- private void initFrame() {
-
-
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
- *
- * Override componentResized to resize all components when frame's size is changed
- */
- public void componentResized(ComponentEvent arg0) {
- int intPreferredWidth = dialogWidth;
- int intCurrentWidth = this.getJContentPane().getWidth();
-
- // Tools.resizeComponentWidth(this.jTextFieldBaseName, this.getWidth(), intPreferredWidth);
- // Tools.resizeComponentWidth(this.jTextFieldGuid, this.getWidth(), intPreferredWidth);
-// Tools.relocateComponentX(this.jButtonGenerateGuid, this.getWidth(), jButtonGenerateGuid.getWidth(), 25);
- // Tools.resizeComponentWidth(this.jTextFieldVersion, this.getWidth(), intPreferredWidth);
- // Tools.resizeComponentWidth(this.jTextFieldCopyright, this.getWidth(), intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPaneLicense, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldUrl, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jTextFieldAbstract, intCurrentWidth, intPreferredWidth);
- Tools.resizeComponentWidth(this.jScrollPaneDescription, intCurrentWidth, intPreferredWidth);
- // Tools.resizeComponentWidth(this.jTextFieldSpecification, this.getWidth(), intPreferredWidth);
-
-
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.DocumentListener#changedUpdate(javax.swing.event.DocumentEvent)
- */
- public void changedUpdate(DocumentEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.DocumentListener#insertUpdate(javax.swing.event.DocumentEvent)
- */
- public void insertUpdate(DocumentEvent arg0) {
- // TODO Auto-generated method stub
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-
- /* (non-Javadoc)
- * @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent)
- */
- public void removeUpdate(DocumentEvent arg0) {
- // TODO Auto-generated method stub
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java deleted file mode 100644 index b2d577e4dd..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java +++ /dev/null @@ -1,2240 +0,0 @@ -package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JDialog;
-import javax.swing.JTabbedPane;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JTextArea;
-import javax.swing.JSplitPane;
-import javax.swing.JButton;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableColumn;
-import javax.swing.table.TableModel;
-
-import org.tianocore.frameworkwizard.FrameworkWizardUI;
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.platform.ui.global.LibraryClassDescriptor;
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
-import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.Set;
-import java.util.Stack;
-import java.util.Vector;
-
-import javax.swing.JTextField;
-import java.awt.GridLayout;
-import javax.swing.JComboBox;
-
-public class FpdModuleSA extends JDialog implements ActionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private JPanel jContentPane = null;
- private JTabbedPane jTabbedPane = null;
- private JPanel jPanelPcd = null;
- private JPanel jPanelLibrary = null;
- private JLabel jLabelPcdData = null;
- private JScrollPane jScrollPaneTablePcd = null;
- private JTable jTablePcd = null;
- private JPanel jPanelPcdSouth = null;
- private JScrollPane jScrollPanePcdHelp = null;
- private JTextArea jTextAreaPcdHelp = null;
- private JPanel jPanelContentPaneSouth = null;
- private JSplitPane jSplitPane = null;
- private JPanel jPanelLibraryLeft = null;
- private JPanel jPanelLibraryRight = null;
- private JLabel jLabelLibClass = null;
- private JLabel jLabelQualifiedInstance = null;
- private JScrollPane jScrollPaneSelectedInstances = null;
- private JTable jTableSelectedInstances = null;
- private JScrollPane jScrollPaneLibClass = null;
- private JTable jTableLibClass = null;
- private JScrollPane jScrollPaneQualifiedInstance = null;
- private JTable jTableLibInstances = null;
- private JPanel jPanelLibrarySouth = null;
- private JPanel jPanelLibraryCenter = null;
- private JScrollPane jScrollPaneInstanceHelp = null;
- private JTextArea jTextAreaInstanceHelp = null;
- private JLabel jLabelSelectedInstances = null;
- private JLabel jLabelInstanceHelp = null;
- private JButton jButtonAdd = null;
- private JButton jButtonDeleteInstance = null;
- private JLabel jLabelPcdHelp = null;
- private JButton jButtonOk = null;
- private JButton jButtonCancel = null;
- private IDefaultTableModel model = null;
- private IDefaultTableModel selectedInstancesTableModel = null;
- private IDefaultTableModel libClassTableModel = null;
- private IDefaultTableModel libInstanceTableModel = null;
- private DefaultTableModel optionsTableModel = null;
- private FpdFileContents ffc = null;
- private String moduleKey = null;
- private ModuleIdentification moduleId = null;
- private HashMap<LibraryClassDescriptor, ArrayList<String>> classInstanceMap = null;
- //
- // map of <{libName, supArch, supMod}, list of Module information>
- //
- private HashMap<LibraryClassDescriptor, ArrayList<String>> classConsumed = null;
- private HashMap<LibraryClassDescriptor, ArrayList<String>> classProduced = null;
-
- private JPanel jPanelModuleSaOpts = null;
- private JLabel jLabelFvBinding = null;
- private JTextField jTextFieldFvBinding = null;
- private JLabel jLabelFfsFileGuid = null;
- private JTextField jTextFieldFileGuid = null;
- private JLabel jLabelFfsFormatKey = null;
- private JTextField jTextFieldFfsKey = null;
- private JScrollPane jScrollPaneModuleSaOptions = null;
- private JTable jTableModuleSaOptions = null;
- private JButton jButtonNew = null;
- private JButton jButtonDeleteOption = null;
- private JPanel jPanelPcdFields = null;
- private JPanel jPanelPcdFieldsSecondRow = null;
- private JPanel jPanelPcdFieldsThirdRow = null;
- private JPanel jPanelPcdFieldsFirstRow = null;
- private JLabel jLabelItemType = null;
- private JComboBox jComboBoxItemType = null;
- private JLabel jLabelMaxDatumSize = null;
- private JTextField jTextFieldMaxDatumSize = null;
- private JLabel jLabelPcdDefaultValue = null;
- private JTextField jTextFieldPcdDefault = null;
- private JButton jButtonUpdatePcd = null;
- private JComboBox jComboBoxFeatureFlagValue = null;
- private OpeningPlatformType docConsole = null;
- private JPanel jPanelCustomToolChain = null;
- private JPanel jPanelToolchainS = null;
- private JPanel jPanelLibraryCenterN = null;
- private JPanel jPanelLibraryCenterC = null; // @jve:decl-index=0:visual-constraint="20,224"
-
- private final int buildTargetWidth = 150;
- private final int toolChainFamilyWidth = 150;
- private final int supportArchWidth = 150;
- private final int toolCmdCodeWidth = 200;
- private final int tagNameWidth = 150;
- private final int argWidth = 400;
-
- /**
- * This is the default constructor
- */
- public FpdModuleSA() {
- super(FrameworkWizardUI.getInstance());
- initialize();
- }
- public FpdModuleSA(FpdFileContents ffc) {
- this();
- this.ffc = ffc;
- }
-
- public void setKey(String k, int i, OpeningPlatformType dc){
- this.moduleKey = k;
- this.docConsole = dc;
- classInstanceMap = null;
- classProduced = null;
- classConsumed = null;
- int tabIndex = jTabbedPane.indexOfTab("FV Info");
- jTabbedPane.setSelectedIndex(tabIndex);
- initFvInfo(moduleKey);
- initPcdBuildDefinition(moduleKey);
- moduleId = WorkspaceProfile.getModuleId(moduleKey);
- if (moduleId == null) {
- return;
- }
- tabIndex = jTabbedPane.indexOfTab("Libraries");
- if (moduleId.isLibrary()) {
- jTabbedPane.setEnabledAt(tabIndex, false);
- }
- else {
- jTabbedPane.setEnabledAt(tabIndex, true);
- }
- }
-
- /**
- init will be called each time FpdModuleSA object is to be shown.
- @param key Module information.
- **/
- public void initPcdBuildDefinition(String key) {
- //
- // display pcd for key.
- //
- model.setRowCount(0);
- jTextAreaPcdHelp.setText("");
- jComboBoxItemType.setSelectedIndex(-1);
- jTextFieldMaxDatumSize.setText("");
- jTextFieldPcdDefault.setText("");
- int pcdCount = ffc.getPcdDataCount(key);
- if (pcdCount != 0) {
- String[][] saa = new String[pcdCount][7];
- ffc.getPcdData(key, saa);
- for (int j = 0; j < saa.length; ++j) {
- model.addRow(saa[j]);
- }
- }
- }
-
- public void initLibraries(String key) {
- libClassTableModel.setRowCount(0);
- libInstanceTableModel.setRowCount(0);
- selectedInstancesTableModel.setRowCount(0);
- Vector<String> errorMsg = new Vector<String>();
- Vector<ModuleIdentification> newInstances = new Vector<ModuleIdentification>();
-
- addConsumedClassFromModule (key);
- addProducedClassFromModule (key);
-
- int instanceCount = ffc.getLibraryInstancesCount(key);
- if (instanceCount != 0) {
- String[][] saa = new String[instanceCount][5];
- ffc.getLibraryInstances(key, saa);
- for (int i = 0; i < saa.length; ++i) {
- String libInstanceKey = saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4];
- ModuleIdentification mi = WorkspaceProfile.getModuleId(libInstanceKey);
- if (mi != null) {
- //
- // ToDo: verify this instance first.
- //
- saa[i][0] = mi.getName();
- saa[i][2] = mi.getVersion();
- saa[i][4] = mi.getPackageId().getVersion();
- //
- // re-evaluate lib instance usage when adding a already-selected lib instance.
- //
- addConsumedClassFromModule (libInstanceKey);
- addProducedClassFromModule (libInstanceKey);
- selectedInstancesTableModel.addRow(saa[i]);
- }
- }
- }
-
- Set<LibraryClassDescriptor> sLcd = this.classConsumed.keySet();
- Iterator<LibraryClassDescriptor> iter = sLcd.iterator();
- Stack<LibraryClassDescriptor> lcdStack = new Stack<LibraryClassDescriptor>();
- while (iter.hasNext()) {
- LibraryClassDescriptor lcd = iter.next();
- if (this.classConsumed.get(lcd) == null || this.classConsumed.get(lcd).size() == 0) {
- continue;
- }
- if (isBoundedClass(lcd, errorMsg)) {
- continue;
- }
-
- if (!lcdStack.contains(lcd)) {
- lcdStack.push(lcd);
- }
- }
-
- try {
- resolveLibraryInstances(lcdStack, true, errorMsg, newInstances);
- } catch (Exception e) {
- String exceptionMsg = e.getCause() + " " + e.getMessage();
- if (!errorMsg.contains(exceptionMsg)) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), e.getCause() + " " + e.getMessage());
- }
- }
-
- String newInstancesAddedMsg = "Library instance automatically added to this module :\n";
- for (int i = 0; i < newInstances.size(); ++i) {
- ModuleIdentification libMi = newInstances.get(i);
- newInstancesAddedMsg += libMi.getName();
- newInstancesAddedMsg += " ";
- }
- if (newInstances.size() > 0) {
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), newInstancesAddedMsg);
- }
-
- showClassToResolved();
-
- if (errorMsg.size() > 0) {
- String errors = "";
- for (int i = 0; i < errorMsg.size(); ++i) {
- errors += " " + errorMsg.get(i) + "\n";
- }
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), errors);
- }
- }
-
- public void initFvInfo (String key) {
- //
- // display module SA options
- //
- jTextFieldFvBinding.setText("");
- String fvBinding = ffc.getFvBinding(key);
- if (fvBinding != null) {
- jTextFieldFvBinding.setText(fvBinding);
- }
- jTextFieldFileGuid.setText("");
- String fileGuid = ffc.getFfsFileNameGuid(key);
- if (fileGuid != null) {
- jTextFieldFileGuid.setText(fileGuid);
- }
- jTextFieldFfsKey.setText("");
- String ffsKey = ffc.getFfsFormatKey(key);
- if (ffsKey != null) {
- jTextFieldFfsKey.setText(ffsKey);
- }
- }
-
- public void initToolChainOptions(String key) {
-
- optionsTableModel.setRowCount(0);
- String[][] saa = new String[ffc.getModuleSAOptionsCount(key)][6];
- ffc.getModuleSAOptions(key, saa);
- for (int i = 0; i < saa.length; ++i) {
- optionsTableModel.addRow(saa[i]);
- }
- }
-
- private void filterClassConsumedByArch (Vector<LibraryClassDescriptor> v) {
- String[] moduleInfo = moduleKey.split(" ");
- Vector<String> vModuleArchs = new Vector<String>();
- //
- // Skip guid, version information, get archs to check.
- //
- for (int i = 4; i < moduleInfo.length; ++i) {
- vModuleArchs.add(moduleInfo[i]);
- }
- //
- // if module will be built on all platforms, no filter needed for lib classes.
- //
- if (vModuleArchs.size() == 0) {
- return;
- }
-
- Iterator<LibraryClassDescriptor> iter = v.iterator();
- while (iter.hasNext()) {
- LibraryClassDescriptor libInfo = iter.next();
-
- Vector<String> vSupArchs = libInfo.getVectorFromString(libInfo.supArchs);
-
- if (vSupArchs.size() == 0 || (vSupArchs.size() == 1 && vSupArchs.get(0).equalsIgnoreCase(""))) {
- //
- // update lib info to module archs only.
- //
- libInfo.supArchs = "";
- for (int i = 0; i < vModuleArchs.size(); ++i) {
- libInfo.supArchs += vModuleArchs.get(i);
- libInfo.supArchs += " ";
- }
- libInfo.supArchs.trim();
- continue;
- }
- //
- // only retain those lib class used by module archs.
- //
- vSupArchs.retainAll(vModuleArchs);
- if (vSupArchs.size() > 0) {
- //
- // update lib info to reflect which kind of arch need to select instance.
- //
- libInfo.supArchs = "";
- for (int i = 0; i < vSupArchs.size(); ++i) {
- libInfo.supArchs += vSupArchs.get(i);
- libInfo.supArchs += " ";
- }
- libInfo.supArchs.trim();
- continue;
- }
- //
- // remove this lib definition if it supports no archs module will be built under.
- //
- iter.remove();
- }
- }
-
- private void addProducedClassFromModule (String key) {
- ModuleIdentification mi = WorkspaceProfile.getModuleId(key);
- Vector<LibraryClassDescriptor> vClassProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
- if (this.classProduced == null) {
- this.classProduced = new HashMap<LibraryClassDescriptor, ArrayList<String>>();
- }
- for (int i = 0; i < vClassProduced.size(); ++i) {
- ArrayList<String> producedBy = this.classProduced.get(vClassProduced.get(i));
- if (producedBy == null) {
- producedBy = new ArrayList<String>();
- }
- //
- // class already produced by previous module (lib instance).
- /*
- if (producedBy.size() == 1) {
- String instanceKey = producedBy.get(0);
- ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);
- throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());
- }
- Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if (vClassProduced.get(i).hasInterSectionWith(lcd)) {
- ArrayList<String> alreadyProducedBy = this.classProduced.get(lcd);
- String instanceKey = alreadyProducedBy.get(0);
- ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);
- throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());
- }
- }
- */
- // normal case.
- //
- producedBy.add(key);
- this.classProduced.put(vClassProduced.get(i), producedBy);
-
- }
- }
-
- private Vector<LibraryClassDescriptor> addConsumedClassFromModule (String key) {
- ModuleIdentification mi = WorkspaceProfile.getModuleId(key);
-// PackageIdentification[] depPkgList = null;
-
- //
- // Get dependency pkg list into which we will search lib instances.
- //
- //depPkgList = SurfaceAreaQuery.getDependencePkg(null, mi);
- //
- // Get the lib class consumed, produced by this module itself.
- //
- Vector<LibraryClassDescriptor> vClassConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi);
- for (int i = 0; i < vClassConsumed.size(); ++i) {
- vClassConsumed.get(i).supModTypes = WorkspaceProfile.getModuleType(moduleId);
- }
- filterClassConsumedByArch(vClassConsumed);
- if (this.classConsumed == null) {
- this.classConsumed = new HashMap<LibraryClassDescriptor, ArrayList<String>>();
- }
-
- for (int i = 0; i < vClassConsumed.size(); ++i) {
- ArrayList<String> consumedBy = this.classConsumed.get(vClassConsumed.get(i));
- if (consumedBy == null) {
- consumedBy = new ArrayList<String>();
- }
- consumedBy.add(key);
- this.classConsumed.put(vClassConsumed.get(i), consumedBy);
- }
-
- return vClassConsumed;
- }
-
- private void resolveLibraryInstances(Stack<LibraryClassDescriptor> lcdStack, boolean autoSelectSingleInstance, Vector<String> errorMsg, Vector<ModuleIdentification> newInstances) throws MultipleInstanceException, NoInstanceException{
-
- if (classInstanceMap == null) {
- classInstanceMap = new HashMap<LibraryClassDescriptor, ArrayList<String>>();
- }
- while (!lcdStack.empty()) {
- LibraryClassDescriptor cls = lcdStack.pop();
- if (isBoundedClass(cls, errorMsg)) {
- continue;
- }
- ArrayList<String> instances = getInstancesForClass(cls, null);
- if (instances.size() == 0) {
-// throw new NoInstanceException (cls.className);
- String exceptionMsg = new NoInstanceException (cls.className).getMessage();
- if (!errorMsg.contains(exceptionMsg)) {
- errorMsg.add(exceptionMsg);
- }
-
- }
- classInstanceMap.put(cls, instances);
- if (instances.size() == 1 && autoSelectSingleInstance) {
- String instanceInfo = instances.get(0);
- ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceInfo);
- try {
- Object[] row = {libMi.getName(), libMi.getGuid(), libMi.getVersion(),
- libMi.getPackageId().getGuid(), libMi.getPackageId().getVersion()};
- if (!ffc.instanceExistsInModuleSA(moduleKey, row[1]+"", row[2]+"", row[3]+"", row[4]+"")) {
- addLibInstance(libMi);
- newInstances.add(libMi);
- docConsole.setSaved(false);
- selectedInstancesTableModel.addRow(row);
- addProducedClassFromModule (instanceInfo);
- Vector<LibraryClassDescriptor> vLcd = addConsumedClassFromModule(instanceInfo);
- for (int i = 0; i < vLcd.size(); ++i) {
- LibraryClassDescriptor lcd = vLcd.get(i);
- if (!lcdStack.contains(lcd)) {
- lcdStack.push(lcd);
- }
- }
- }
- }
- catch (Exception e) {
- if (!errorMsg.contains(e.getMessage())) {
- errorMsg.add(e.getMessage());
- }
- }
- }
- }
- }
-//
-
- /**Search classProduced map to see if this class has been produced by some instance (module).
- * @param cls
- * @return
- */
- private boolean isBoundedClass (LibraryClassDescriptor cls, Vector<String> errorMsg) {
-// if (this.classProduced.containsKey(cls)) {
-// return true;
-// }
- Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if (cls.className.equals(lcd.className)) {
- if (cls.isSubSetByArchs(lcd) && cls.isSubSetByModTypes(lcd)) {
- return true;
- }
- else {
- ArrayList<String> producedBy = this.classProduced.get(lcd);
- String instancesName = "";
- for (int i = 0; i < producedBy.size(); ++i) {
- ModuleIdentification mi = WorkspaceProfile.getModuleId(producedBy.get(i));
- instancesName += mi.getName();
- instancesName += " ";
- }
- String msg = new ImproperInstanceException(lcd.className, instancesName, lcd.supArchs, lcd.supModTypes).getMessage();
- if (!errorMsg.contains(msg)) {
- errorMsg.add(msg);
- }
- }
- }
- }
-
- return false;
- }
-
- private ArrayList<String> getInstancesForClass(LibraryClassDescriptor cls, PackageIdentification[] depPkgList){
- ArrayList<String> al = new ArrayList<String>();
-
-// for (int i = 0; i < depPkgList.length; ++i) {
- Iterator ismi = GlobalData.vModuleList.iterator();
- while(ismi.hasNext()) {
- ModuleIdentification mi = (ModuleIdentification)ismi.next();
-// if (!mi.getPackageId().getGuid().equalsIgnoreCase(depPkgList[i].getGuid())) {
-// continue;
-// }
- Vector<LibraryClassDescriptor> clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
-
- boolean isPotential = false;
- Iterator<LibraryClassDescriptor> lcdi = clsProduced.iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if (cls.isSubSetByArchs(lcd) && cls.isSubSetByModTypes(lcd)){
- isPotential = true;
- }
-
- if (isPotential && hasBeenProduced(lcd)) {
- isPotential = false;
- break;
- }
- }
- if (isPotential) {
- al.add(mi.getGuid() + " " + mi.getVersion() + " " +
- mi.getPackageId().getGuid() + " " + mi.getPackageId().getVersion());
- }
- }
-// }
-
- return al;
- }
-
- private boolean hasBeenProduced (LibraryClassDescriptor cls) {
- Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if (cls.isSubSetByArchs(lcd) && cls.isSubSetByModTypes(lcd)) {
- return true;
- }
- }
- return false;
- }
-
- private ArrayList<String> getConsumedBy (String className) {
- Iterator<LibraryClassDescriptor> lcdi = this.classConsumed.keySet().iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if ((lcd.className != null) && lcd.className.equals(className)) {
- return this.classConsumed.get(lcd);
- }
- }
- return null;
- }
-
- private ArrayList<String> getProducedBy (String className) {
- Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if ((lcd.className != null) && lcd.className.equals(className)) {
- return this.classProduced.get(lcd);
- }
- }
- return null;
- }
- //
- // Get class name list related with instanceKey from HashMap m<LibraryClass, ArrayList<instanceKey>>.
- //
- private ArrayList<String> getLibraryClassList (String instanceKey, HashMap<LibraryClassDescriptor, ArrayList<String>> m) {
- ArrayList<String> libraryClass = new ArrayList<String>();
- Iterator<LibraryClassDescriptor> lcdi = m.keySet().iterator();
- while (lcdi.hasNext()) {
- LibraryClassDescriptor lcd = lcdi.next();
- if ((m.get(lcd) != null) && m.get(lcd).contains(instanceKey)) {
- libraryClass.add(lcd.className);
- }
- }
- return libraryClass;
- }
-
- private void removeInstance(String key) {
- ModuleIdentification mi = WorkspaceProfile.getModuleId(key);
- //
- // remove pcd information of instance from current ModuleSA
- // Note that Pcd data SHOULD be removed prior to library instance
- // because Multi-Sourced PCD could not be removed, if we remove library instance first,
- // it will impact the judgement of whether a PCD entry is Multi-Sourced.
- //
- ffc.removePcdData(moduleKey, mi);
- ffc.removeLibraryInstance(moduleKey, key);
- //
- // remove class produced by this instance and add back these produced class to be bound.
- //
- Vector<LibraryClassDescriptor> clsProduced = getClassProduced(mi);
- for (int i = 0; i < clsProduced.size(); ++i) {
-
- classProduced.remove(clsProduced.get(i));
- }
- //
- // remove class consumed by this instance. we do not need to bound it now.
- //
- String[] clsConsumed = getClassConsumed(mi);
- for (int i = 0; i < clsConsumed.length; ++i) {
- ArrayList<String> al = getConsumedBy (clsConsumed[i]);
-
- if (al == null ) {
- continue;
- }
- al.remove(key);
- if (al.size() == 0) {
- ArrayList<String> from = getProducedBy (clsConsumed[i]);
- if (from == null) {
- continue;
- }
- boolean noUse = true;
- for (int j = 0; j < from.size(); ++j) {
- ArrayList<String> libClasses = getLibraryClassList(from.get(j), classProduced);
- for (int k = 0; k < libClasses.size(); ++k) {
- if (getConsumedBy (libClasses.get(k)) != null && getConsumedBy (libClasses.get(k)).size() > 0) {
- noUse = false;
- }
- }
- if (noUse) {
- removeInstance(from.get(j));
- }
- noUse = true;
- }
- }
- }
-
- }
-
-
- private Vector<LibraryClassDescriptor> getClassProduced(ModuleIdentification mi){
-
- Vector<LibraryClassDescriptor> clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
- return clsProduced;
-// String[] sClassProduced = new String[clsProduced.size()];
-// for (int i = 0; i < clsProduced.size(); ++i) {
-// sClassProduced[i] = clsProduced.get(i).className;
-// }
-// return sClassProduced;
- }
-
- private String[] getClassConsumed(ModuleIdentification mi){
-
- Vector<LibraryClassDescriptor> clsConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi);
- String[] sClassConsumed = new String[clsConsumed.size()];
- for (int i = 0; i < clsConsumed.size(); ++i) {
- sClassConsumed[i] = clsConsumed.get(i).className;
- }
- return sClassConsumed;
- }
-
- private void showClassToResolved(){
- Vector<String> errorMsg = new Vector<String>();
- libClassTableModel.setRowCount(0);
- libInstanceTableModel.setRowCount(0);
- if (classConsumed == null || classConsumed.size() == 0) {
- return;
- }
-
- Iterator<LibraryClassDescriptor> li = classConsumed.keySet().iterator();
- while(li.hasNext()){
- LibraryClassDescriptor lcd = li.next();
- if (classConsumed.get(lcd) == null || classConsumed.get(lcd).size() == 0) {
- continue;
- }
-
- if (!isBoundedClass(lcd, errorMsg)){
-
- String[] s = { lcd.className, lcd.supArchs, lcd.supModTypes };
- libClassTableModel.addRow(s);
- }
- }
-
- if (errorMsg.size() > 0) {
- String errors = "";
- for (int i = 0; i < errorMsg.size(); ++i) {
- errors += " " + errorMsg.get(i) + "\n";
- }
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), errors);
- }
- }
-
- private String getModuleArch () {
- String arch = "";
- String[] moduleInfo = moduleKey.split(" ");
- for (int i = 4; i < moduleInfo.length; ++i) {
- arch += moduleInfo[i];
- arch += " ";
- }
- return arch.trim();
- }
- private void addLibInstance (ModuleIdentification libMi) throws Exception{
-
- //
- // Add pcd information of selected instance to current moduleSA
- //
- ffc.addFrameworkModulesPcdBuildDefs(libMi, getModuleArch(), ffc.getModuleSA(moduleKey));
-
- ffc.genLibraryInstance(libMi, moduleKey);
- }
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(877, 555);
- this.setResizable(false);
- this.centerWindow();
- this.setModal(true);
- this.setTitle("Module Settings");
- this.setContentPane(getJContentPane());
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
- jContentPane.add(getJPanelContentPaneSouth(), java.awt.BorderLayout.SOUTH);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes jTabbedPane
- *
- * @return javax.swing.JTabbedPane
- */
- private JTabbedPane getJTabbedPane() {
- if (jTabbedPane == null) {
- jTabbedPane = new JTabbedPane();
- jTabbedPane.addTab("PCD Build Definition", null, getJPanelPcd(), null);
- jTabbedPane.addTab("Libraries", null, getJPanelLibrary(), null);
- jTabbedPane.addTab("FV Info", null, getJPanelModuleSaOpts(), null);
- jTabbedPane.addTab("Custom Toolchain", null, getJPanelCustomToolChain(), null);
-
- }
- return jTabbedPane;
- }
-
- /**
- * This method initializes jPanelPcd
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelPcd() {
- if (jPanelPcd == null) {
- jLabelPcdData = new JLabel();
- jLabelPcdData.setText(" PCD Data");
- jPanelPcd = new JPanel();
- jPanelPcd.setLayout(new BorderLayout());
- jPanelPcd.add(jLabelPcdData, java.awt.BorderLayout.NORTH);
- jPanelPcd.add(getJScrollPaneTablePcd(), java.awt.BorderLayout.CENTER);
- jPanelPcd.add(getJPanelPcdSouth(), java.awt.BorderLayout.SOUTH);
- jPanelPcd.addComponentListener(new java.awt.event.ComponentAdapter() {
- public void componentShown(java.awt.event.ComponentEvent e) {
- initPcdBuildDefinition(moduleKey);
- }
- });
-
- }
- return jPanelPcd;
- }
-
- /**
- * This method initializes jPanelLibrary
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelLibrary() {
- if (jPanelLibrary == null) {
- jPanelLibrary = new JPanel();
- jPanelLibrary.setLayout(new BorderLayout());
- jPanelLibrary.add(getJSplitPane(), java.awt.BorderLayout.NORTH);
- jPanelLibrary.add(getJPanelLibrarySouth(), java.awt.BorderLayout.SOUTH);
- jPanelLibrary.add(getJPanelLibraryCenter(), java.awt.BorderLayout.CENTER);
- jPanelLibrary.addComponentListener(new java.awt.event.ComponentAdapter() {
- public void componentShown(java.awt.event.ComponentEvent e) {
- initLibraries(moduleKey);
- }
- });
- }
- return jPanelLibrary;
- }
-
- /**
- * This method initializes jScrollPaneTablePcd
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneTablePcd() {
- if (jScrollPaneTablePcd == null) {
- jScrollPaneTablePcd = new JScrollPane();
- jScrollPaneTablePcd.setViewportView(getJTablePcd());
- }
- return jScrollPaneTablePcd;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTablePcd() {
- if (jTablePcd == null) {
- model = new IDefaultTableModel();
- jTablePcd = new JTable(model);
- jTablePcd.setRowHeight(20);
- jTablePcd.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS);
- model.addColumn("CName");
- model.addColumn("TokenSpaceGUID");
- model.addColumn("ItemType");
- model.addColumn("Token");
- model.addColumn("MaxDatumSize");
- model.addColumn("DataType");
- model.addColumn("DefaultValue");
-
- jTablePcd.getColumnModel().getColumn(0).setMinWidth(250);
-
- TableColumn tokenColumn = jTablePcd.getColumnModel().getColumn(3);
- jTablePcd.removeColumn(tokenColumn);
-
- jTablePcd.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTablePcd.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
-
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- int selectedRow = lsm.getMinSelectionIndex();
- String cName = model.getValueAt(selectedRow, 0)+"";
- String tsGuid = model.getValueAt(selectedRow, 1)+"";
- String itemType = model.getValueAt(selectedRow, 2)+"";
- //
- // array for pcd related information: helpText, itemType, moduleType.
- //
- String[] pcdInfo = {"", "", ""};
- Vector<String> validPcdTypes = new Vector<String>();
- getPcdInfo(moduleKey, cName, tsGuid, pcdInfo, validPcdTypes);
- jTextAreaPcdHelp.setText(pcdInfo[0]);
- initComboBox(pcdInfo[1], pcdInfo[2], validPcdTypes);
- jComboBoxItemType.setSelectedItem(itemType);
- jTextFieldMaxDatumSize.setEnabled(true);
- jTextFieldMaxDatumSize.setVisible(true);
- jTextFieldMaxDatumSize.setText(model.getValueAt(selectedRow, 4)+"");
- jTextFieldPcdDefault.setEnabled(true);
- jTextFieldPcdDefault.setText(model.getValueAt(selectedRow, 6)+"");
- if ((model.getValueAt(selectedRow, 5) != null) && model.getValueAt(selectedRow, 5).equals("VOID*")) {
- if (pcdInfo[1].equals("FEATURE_FLAG")) {
- jTextFieldMaxDatumSize.setVisible(false);
- }
- else if (pcdInfo[1].equals("FIXED_AT_BUILD")) {
- try{
- jTextFieldMaxDatumSize.setEnabled(false);
- jTextFieldMaxDatumSize.setText(ffc.setMaxSizeForPointer(model.getValueAt(selectedRow, 6)+"")+"");
- }
- catch(Exception except){
- JOptionPane.showMessageDialog(FpdModuleSA.this, "Unacceptable PCD Value: " + except.getMessage());
- }
- }
- else{
- jTextFieldMaxDatumSize.setText(model.getValueAt(selectedRow, 4)+"");
- }
- }
- else {
- jTextFieldMaxDatumSize.setEnabled(false);
- }
-
- if (!model.getValueAt(selectedRow, 2).equals("DYNAMIC") && !model.getValueAt(selectedRow, 2).equals("DYNAMIC_EX")) {
- jTextFieldPcdDefault.setText(model.getValueAt(selectedRow, 6)+"");
- if (model.getValueAt(selectedRow, 2).equals("FEATURE_FLAG")){
- jTextFieldPcdDefault.setVisible(false);
- jComboBoxFeatureFlagValue.setVisible(true);
- jComboBoxFeatureFlagValue.setSelectedItem(model.getValueAt(selectedRow, 6)+"");
- }
- else{
- jTextFieldPcdDefault.setVisible(true);
- jTextFieldPcdDefault.setEnabled(true);
- jComboBoxFeatureFlagValue.setVisible(false);
- }
- }
- else{
- jTextFieldPcdDefault.setEnabled(false);
- }
- }
-
-
- }
- });
-
- }
- return jTablePcd;
- }
-
- private void initComboBox(String originalType, String mType, Vector<String> validPcdTypes) {
- jComboBoxItemType.removeAllItems();
-
- if (originalType.equals("DYNAMIC")) {
- for (int i = 0; i < validPcdTypes.size(); ++i) {
- jComboBoxItemType.addItem(validPcdTypes.get(i));
- }
- }
- else {
- jComboBoxItemType.addItem(originalType);
- }
- }
-
- /**
- * @param cName
- * @param tsGuid
- * @param sa sa[0]: HelpText; sa[1]: itemType in Msa; sa[2]: isBinary;
- */
- private void getPcdInfo(String moduleKey, String cName, String tsGuid, String[] sa, Vector<String> validPcdTypes) {
- String[][] saa = new String[ffc.getLibraryInstancesCount(moduleKey)][5];
- ffc.getLibraryInstances(moduleKey, saa);
-
- try{
- if (ffc.getPcdBuildDataInfo(WorkspaceProfile.getModuleId(moduleKey), cName, tsGuid, sa, validPcdTypes)) {
- return;
- }
- for (int j = 0; j < saa.length; ++j) {
- if (ffc.getPcdBuildDataInfo(WorkspaceProfile.getModuleId(saa[j][1] + " " + saa[j][2] + " " + saa[j][3] + " " + saa[j][4]),
- cName, tsGuid, sa, validPcdTypes)) {
- return;
- }
- }
- }
- catch(Exception e) {
- JOptionPane.showMessageDialog(this, "Get PCD details fail: " + e.getMessage());
- }
- }
-
- /**
- * This method initializes jPanelPcdSouth
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelPcdSouth() {
- if (jPanelPcdSouth == null) {
- jLabelPcdHelp = new JLabel();
- jLabelPcdHelp.setText("PCD Description");
- jPanelPcdSouth = new JPanel();
- jPanelPcdSouth.setPreferredSize(new java.awt.Dimension(607,200));
- jPanelPcdSouth.add(jLabelPcdHelp, null);
- jPanelPcdSouth.add(getJScrollPanePcdHelp(), null);
- jPanelPcdSouth.add(getJPanelPcdFields(), null);
- }
- return jPanelPcdSouth;
- }
-
- /**
- * This method initializes jScrollPanePcdHelp
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPanePcdHelp() {
- if (jScrollPanePcdHelp == null) {
- jScrollPanePcdHelp = new JScrollPane();
- jScrollPanePcdHelp.setPreferredSize(new java.awt.Dimension(500,100));
- jScrollPanePcdHelp.setViewportView(getJTextAreaPcdHelp());
- }
- return jScrollPanePcdHelp;
- }
-
- /**
- * This method initializes jTextAreaPcdHelp
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextAreaPcdHelp() {
- if (jTextAreaPcdHelp == null) {
- jTextAreaPcdHelp = new JTextArea();
- jTextAreaPcdHelp.setEditable(false);
- }
- return jTextAreaPcdHelp;
- }
-
- /**
- * This method initializes jPanelContentPaneSouth
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentPaneSouth() {
- if (jPanelContentPaneSouth == null) {
- FlowLayout flowLayout = new FlowLayout();
- flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelContentPaneSouth = new JPanel();
- jPanelContentPaneSouth.setLayout(flowLayout);
- jPanelContentPaneSouth.add(getJButtonOk(), null);
- jPanelContentPaneSouth.add(getJButtonCancel(), null);
- }
- return jPanelContentPaneSouth;
- }
-
- /**
- * This method initializes jSplitPane
- *
- * @return javax.swing.JSplitPane
- */
- private JSplitPane getJSplitPane() {
- if (jSplitPane == null) {
- jSplitPane = new JSplitPane();
- jSplitPane.setDividerLocation(200);
- jSplitPane.setLeftComponent(getJPanelLibraryLeft());
- jSplitPane.setRightComponent(getJPanelLibraryRight());
- jSplitPane.setPreferredSize(new java.awt.Dimension(202,200));
- }
- return jSplitPane;
- }
-
- /**
- * This method initializes jPanelLibraryLeft
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelLibraryLeft() {
- if (jPanelLibraryLeft == null) {
- jLabelLibClass = new JLabel();
- jLabelLibClass.setText("Library Classes Uninstantiated");
- jPanelLibraryLeft = new JPanel();
- jPanelLibraryLeft.add(jLabelLibClass, null);
- jPanelLibraryLeft.add(getJScrollPaneLibClass(), null);
- }
- return jPanelLibraryLeft;
- }
-
- /**
- * This method initializes jPanelLibraryRight
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelLibraryRight() {
- if (jPanelLibraryRight == null) {
- jLabelQualifiedInstance = new JLabel();
- jLabelQualifiedInstance.setText("Instances Available");
- jPanelLibraryRight = new JPanel();
- jPanelLibraryRight.add(jLabelQualifiedInstance, null);
- jPanelLibraryRight.add(getJScrollPaneQualifiedInstance(), null);
- }
- return jPanelLibraryRight;
- }
-
- /**
- * This method initializes jScrollPaneSelectedInstances
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneSelectedInstances() {
- if (jScrollPaneSelectedInstances == null) {
- jScrollPaneSelectedInstances = new JScrollPane();
- jScrollPaneSelectedInstances.setPreferredSize(new java.awt.Dimension(600,150));
- jScrollPaneSelectedInstances.setViewportView(getJTableSelectedInstances());
- }
- return jScrollPaneSelectedInstances;
- }
-
- /**
- * This method initializes jTableSelectedInstances
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableSelectedInstances() {
- if (jTableSelectedInstances == null) {
- selectedInstancesTableModel = new IDefaultTableModel();
- selectedInstancesTableModel.addColumn("Name");
- selectedInstancesTableModel.addColumn("ModuleGUID");
- selectedInstancesTableModel.addColumn("ModuleVersion");
- selectedInstancesTableModel.addColumn("PackageGUID");
- selectedInstancesTableModel.addColumn("PackageVersion");
- jTableSelectedInstances = new JTable(selectedInstancesTableModel);
- jTableSelectedInstances.setRowHeight(20);
-
- jTableSelectedInstances.getColumnModel().getColumn(0).setMinWidth(250);
-
- jTableSelectedInstances.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- jTableSelectedInstances.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- }
- return jTableSelectedInstances;
- }
-
- /**
- * This method initializes jScrollPaneLibClass
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneLibClass() {
- if (jScrollPaneLibClass == null) {
- jScrollPaneLibClass = new JScrollPane();
- jScrollPaneLibClass.setPreferredSize(new java.awt.Dimension(200,170));
- jScrollPaneLibClass.setViewportView(getJTableLibClass());
- }
- return jScrollPaneLibClass;
- }
-
- /**
- * This method initializes jTableLibClass
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableLibClass() {
- if (jTableLibClass == null) {
- libClassTableModel = new IDefaultTableModel();
- libClassTableModel.addColumn("LibraryClass");
- libClassTableModel.addColumn("Arch");
- libClassTableModel.addColumn("ModType");
- jTableLibClass = new JTable(libClassTableModel);
- jTableLibClass.setRowHeight(20);
- jTableLibClass.setShowGrid(false);
- jTableLibClass.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- TableColumn column = jTableLibClass.getColumnModel().getColumn(1);
- jTableLibClass.getColumnModel().removeColumn(column);
- column = jTableLibClass.getColumnModel().getColumn(1);
- jTableLibClass.getColumnModel().removeColumn(column);
-
- jTableLibClass.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent e) {
- if (e.getValueIsAdjusting()){
- return;
- }
- ListSelectionModel lsm = (ListSelectionModel)e.getSource();
- if (lsm.isSelectionEmpty()) {
- return;
- }
- else{
- int selectedRow2 = lsm.getMinSelectionIndex();
- if (selectedRow2 < 0) {
- return;
- }
- //
- // display potential lib instances according to class selection
- //
- libInstanceTableModel.setRowCount(0);
- String cls = libClassTableModel.getValueAt(selectedRow2, 0).toString();
- String arch = libClassTableModel.getValueAt(selectedRow2, 1).toString();
- String modType = libClassTableModel.getValueAt(selectedRow2, 2).toString();
- LibraryClassDescriptor lcd = new LibraryClassDescriptor(cls, arch, modType);
- ArrayList<String> al = classInstanceMap.get(lcd);
- if (al == null) {
- al = getInstancesForClass(lcd, null);
- if (al.size() != 0) {
- classInstanceMap.put(lcd, al);
- }
-
- }
- ListIterator<String> li = al.listIterator();
- while(li.hasNext()) {
- String instance = li.next();
- String[] s = {"", "", "", "", ""};
- if (WorkspaceProfile.getModuleId(instance) != null) {
- s[0] = WorkspaceProfile.getModuleId(instance).getName();
- }
-
- String[] instancePart = instance.split(" ");
- for (int i = 0; i < instancePart.length; ++i){
- s[i+1] = instancePart[i];
- }
- libInstanceTableModel.addRow(s);
- }
-
- }
- }
- });
- }
- return jTableLibClass;
- }
-
- /**
- * This method initializes jScrollPaneQualifiedInstance
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneQualifiedInstance() {
- if (jScrollPaneQualifiedInstance == null) {
- jScrollPaneQualifiedInstance = new JScrollPane();
- jScrollPaneQualifiedInstance.setPreferredSize(new java.awt.Dimension(600,170));
- jScrollPaneQualifiedInstance.setViewportView(getJTableLibInstances());
- }
- return jScrollPaneQualifiedInstance;
- }
-
- /**
- * This method initializes jTableLibInstances
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableLibInstances() {
- if (jTableLibInstances == null) {
- libInstanceTableModel = new IDefaultTableModel();
- libInstanceTableModel.addColumn("Name");
- libInstanceTableModel.addColumn("ModuleGUID");
- libInstanceTableModel.addColumn("ModuleVersion");
- libInstanceTableModel.addColumn("PackageGUID");
- libInstanceTableModel.addColumn("PackageVersion");
- jTableLibInstances = new JTable(libInstanceTableModel);
- jTableLibInstances.setRowHeight(20);
-
- jTableLibInstances.getColumnModel().getColumn(0).setMinWidth(250);
-
- jTableLibInstances.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- jTableLibInstances.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- }
- return jTableLibInstances;
- }
-
- /**
- * This method initializes jPanelLibrarySouth
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelLibrarySouth() {
- if (jPanelLibrarySouth == null) {
- jPanelLibrarySouth = new JPanel();
- }
- return jPanelLibrarySouth;
- }
-
- /**
- * This method initializes jPanelLibraryCenter
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelLibraryCenter() {
- if (jPanelLibraryCenter == null) {
- jLabelInstanceHelp = new JLabel();
- jLabelInstanceHelp.setText("Instance Description");
- jLabelSelectedInstances = new JLabel();
- jLabelSelectedInstances.setText("Selected Instances");
- jPanelLibraryCenter = new JPanel();
- jPanelLibraryCenter.setLayout(new BorderLayout());
-
- jPanelLibraryCenter.add(getJPanelLibraryCenterC(), java.awt.BorderLayout.CENTER);
- jPanelLibraryCenter.add(getJPanelLibraryCenterN(), java.awt.BorderLayout.NORTH);
-
- }
- return jPanelLibraryCenter;
- }
-
- /**
- * This method initializes jScrollPaneInstanceHelp
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneInstanceHelp() {
- if (jScrollPaneInstanceHelp == null) {
- jScrollPaneInstanceHelp = new JScrollPane();
- jScrollPaneInstanceHelp.setPreferredSize(new java.awt.Dimension(400,50));
- jScrollPaneInstanceHelp.setViewportView(getJTextAreaInstanceHelp());
- }
- return jScrollPaneInstanceHelp;
- }
-
- /**
- * This method initializes jTextAreaInstanceHelp
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextAreaInstanceHelp() {
- if (jTextAreaInstanceHelp == null) {
- jTextAreaInstanceHelp = new JTextArea();
- jTextAreaInstanceHelp.setEditable(false);
- }
- return jTextAreaInstanceHelp;
- }
-
- /**
- * This method initializes jButtonAdd
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAdd() {
- if (jButtonAdd == null) {
- jButtonAdd = new JButton();
- jButtonAdd.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonAdd.setText("Add");
- jButtonAdd.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int row = jTableLibInstances.getSelectedRow();
- if (row < 0) {
- return;
- }
-
- String libInstanceKey = libInstanceTableModel.getValueAt(row, 1) + " " +
- libInstanceTableModel.getValueAt(row, 2) + " " +
- libInstanceTableModel.getValueAt(row, 3) + " " +
- libInstanceTableModel.getValueAt(row, 4);
- ModuleIdentification libMi = WorkspaceProfile.getModuleId(libInstanceKey);
- try {
- addLibInstance (libMi);
- }
- catch (Exception exception) {
- JOptionPane.showMessageDialog(FpdModuleSA.this, "Adding Instance " + libMi.getName() + " : \n"+ exception.getMessage());
- return;
- }
- docConsole.setSaved(false);
- Object[] s = {libInstanceTableModel.getValueAt(row, 0), libInstanceTableModel.getValueAt(row, 1),
- libInstanceTableModel.getValueAt(row, 2), libInstanceTableModel.getValueAt(row, 3),
- libInstanceTableModel.getValueAt(row, 4)};
- selectedInstancesTableModel.addRow(s);
-
- Vector<LibraryClassDescriptor> vLcd = addConsumedClassFromModule (libInstanceKey);
- addProducedClassFromModule (libInstanceKey);
-
- Vector<String> errorMsg = new Vector<String>();
- Vector<ModuleIdentification> newInstances = new Vector<ModuleIdentification>();
- Stack<LibraryClassDescriptor> lcdStack = new Stack<LibraryClassDescriptor>();
- for (int i = 0; i < vLcd.size(); ++i) {
- LibraryClassDescriptor lcd = vLcd.get(i);
- if (!lcdStack.contains(lcd)) {
- lcdStack.push(lcd);
- }
- }
- try {
- resolveLibraryInstances(lcdStack, true, errorMsg, newInstances);
- }
- catch (Exception exp) {
- JOptionPane.showMessageDialog(FpdModuleSA.this, exp.getMessage());
- }
-
- showClassToResolved();
-
- if (errorMsg.size() > 0) {
- String errors = "";
- for (int i = 0; i < errorMsg.size(); ++i) {
- errors += " " + errorMsg.get(i) + "\n";
- }
- JOptionPane.showMessageDialog(FpdModuleSA.this, errors);
- }
- }
- });
- }
- return jButtonAdd;
- }
-
- /**
- * This method initializes jButton1
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDeleteInstance() {
- if (jButtonDeleteInstance == null) {
- jButtonDeleteInstance = new JButton();
- jButtonDeleteInstance.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonDeleteInstance.setText("Delete");
- jButtonDeleteInstance.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int row = jTableSelectedInstances.getSelectedRow();
- if (row < 0) {
- return;
- }
- docConsole.setSaved(false);
- String instanceKey = selectedInstancesTableModel.getValueAt(row, 1) + " "
- + selectedInstancesTableModel.getValueAt(row, 2) + " "
- + selectedInstancesTableModel.getValueAt(row, 3) + " "
- + selectedInstancesTableModel.getValueAt(row, 4);
- removeInstance(instanceKey);
-
- selectedInstancesTableModel.setRowCount(0);
- int instanceCount = ffc.getLibraryInstancesCount(moduleKey);
- if (instanceCount != 0) {
- String[][] saa = new String[instanceCount][5];
- ffc.getLibraryInstances(moduleKey, saa);
- for (int i = 0; i < saa.length; ++i) {
- String libInstanceKey = saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4];
- ModuleIdentification mi = WorkspaceProfile.getModuleId(libInstanceKey);
- if (mi != null) {
- //
- // ToDo: verify this instance first.
- //
- saa[i][0] = mi.getName();
- saa[i][2] = mi.getVersion();
- saa[i][4] = mi.getPackageId().getVersion();
- selectedInstancesTableModel.addRow(saa[i]);
- }
- }
- }
- showClassToResolved();
- }
- });
- }
- return jButtonDeleteInstance;
- }
-
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonOk.setText("Close");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jButton3
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.setVisible(false);
- }
- return jButtonCancel;
- }
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonOk) {
- if (jTableModuleSaOptions.isEditing()) {
- jTableModuleSaOptions.getCellEditor().stopCellEditing();
- }
- this.setVisible(false);
- }
- }
- /**
- * This method initializes jPanelModuleSaOpts
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelModuleSaOpts() {
- if (jPanelModuleSaOpts == null) {
- FlowLayout flowLayout4 = new FlowLayout();
- flowLayout4.setAlignment(java.awt.FlowLayout.LEFT);
- jLabelFfsFormatKey = new JLabel();
- jLabelFfsFormatKey.setText("FFS Format Key");
- jLabelFfsFormatKey.setPreferredSize(new java.awt.Dimension(90,16));
- jLabelFfsFileGuid = new JLabel();
- jLabelFfsFileGuid.setText("FFS File GUID");
- jLabelFfsFileGuid.setPreferredSize(new java.awt.Dimension(90,16));
- jLabelFfsFileGuid.setVisible(false);
- jLabelFvBinding = new JLabel();
- jLabelFvBinding.setText("FV Binding");
- jLabelFvBinding.setPreferredSize(new java.awt.Dimension(90,16));
- jPanelModuleSaOpts = new JPanel();
- jPanelModuleSaOpts.setLayout(flowLayout4);
- jPanelModuleSaOpts.add(jLabelFvBinding, null);
- jPanelModuleSaOpts.add(getJTextFieldFvBinding(), null);
- jPanelModuleSaOpts.add(jLabelFfsFileGuid, null);
- jPanelModuleSaOpts.add(getJTextFieldFileGuid(), null);
- jPanelModuleSaOpts.add(jLabelFfsFormatKey, null);
- jPanelModuleSaOpts.add(getJTextFieldFfsKey(), null);
- jPanelModuleSaOpts.addComponentListener(new java.awt.event.ComponentAdapter() {
- public void componentShown(java.awt.event.ComponentEvent e) {
- initFvInfo(moduleKey);
- }
- });
- }
- return jPanelModuleSaOpts;
- }
-
- private Vector<String> getVectorFromString (String s) {
- if (s == null || s.equals("null")) {
- s = "";
- }
- String[] sa1 = s.split(" ");
- Vector<String> v = new Vector<String>();
- for (int i = 0; i < sa1.length; ++i) {
- v.add(sa1[i]);
- }
- return v;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFvBinding() {
- if (jTextFieldFvBinding == null) {
- jTextFieldFvBinding = new JTextField();
- jTextFieldFvBinding.setPreferredSize(new java.awt.Dimension(400,20));
- jTextFieldFvBinding.setEditable(true);
- jTextFieldFvBinding.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusLost(java.awt.event.FocusEvent e) {
- String originalFvBinding = ffc.getFvBinding(moduleKey);
- String newFvBinding = jTextFieldFvBinding.getText();
- if (newFvBinding.equals(originalFvBinding)) {
- return;
- }
- if (newFvBinding.length() == 0 && originalFvBinding == null) {
- return;
- }
-
- Vector<String> oldFvList = getVectorFromString (originalFvBinding);
- Vector<String> newFvList = getVectorFromString (newFvBinding);
- String moduleInfo[] = moduleKey.split(" ");
- ffc.setFvBinding(moduleKey, newFvBinding);
- //
- // remove module from Fvs that not in newFvList now.
- //
- oldFvList.removeAll(newFvList);
- for (int j = 0; j < oldFvList.size(); ++j) {
- ffc.removeModuleInBuildOptionsUserExtensions(oldFvList.get(j), "IMAGES", "1", moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]);
- }
- //
- // add module to Fvs that were not in oldFvList.
- //
- oldFvList = getVectorFromString (originalFvBinding);
- newFvList.removeAll(oldFvList);
- for (int i = 0; i < newFvList.size(); ++i) {
- ffc.addModuleIntoBuildOptionsUserExtensions(newFvList.get(i), "IMAGES", "1", moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]);
- }
- docConsole.setSaved(false);
- }
- });
-
- }
- return jTextFieldFvBinding;
- }
- /**
- * This method initializes jTextField1
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFileGuid() {
- if (jTextFieldFileGuid == null) {
- jTextFieldFileGuid = new JTextField();
- jTextFieldFileGuid.setPreferredSize(new java.awt.Dimension(300,20));
- jTextFieldFileGuid.setVisible(false);
- jTextFieldFileGuid.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusLost(java.awt.event.FocusEvent e) {
- String originalFileGuid = ffc.getFfsFileNameGuid(moduleKey);
- String newFileGuid = jTextFieldFileGuid.getText();
- if (newFileGuid.equals(originalFileGuid)) {
- return;
- }
- if (newFileGuid.length() == 0 && originalFileGuid == null) {
- return;
- }
- if (newFileGuid.length() > 0) {
- if (!DataValidation.isGuid(newFileGuid)) {
- JOptionPane.showMessageDialog(FpdModuleSA.this, "FFS File Guid is NOT GUID Type.");
- return;
- }
- }
-
- docConsole.setSaved(false);
- if (newFileGuid.length() == 0) {
- newFileGuid = null;
- }
- ffc.setFfsFileNameGuid(moduleKey, newFileGuid);
- }
- });
-
- }
- return jTextFieldFileGuid;
- }
- /**
- * This method initializes jTextFieldFfsKey
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFfsKey() {
- if (jTextFieldFfsKey == null) {
- jTextFieldFfsKey = new JTextField();
- jTextFieldFfsKey.setPreferredSize(new java.awt.Dimension(250,20));
- jTextFieldFfsKey.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusLost(java.awt.event.FocusEvent e) {
- String originalFfsKey = ffc.getFfsFormatKey(moduleKey);
- String newFfsKey = jTextFieldFfsKey.getText();
- if (newFfsKey.equals(originalFfsKey)) {
- return;
- }
- if (newFfsKey.length() == 0 && originalFfsKey == null) {
- return;
- }
- docConsole.setSaved(false);
- ffc.setFfsFormatKey(moduleKey, newFfsKey);
- }
- });
-
- }
- return jTextFieldFfsKey;
- }
- /**
- * This method initializes jScrollPaneModuleSaOptions
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneModuleSaOptions() {
- if (jScrollPaneModuleSaOptions == null) {
- jScrollPaneModuleSaOptions = new JScrollPane();
- jScrollPaneModuleSaOptions.setPreferredSize(new java.awt.Dimension(600,350));
- jScrollPaneModuleSaOptions.setViewportView(getJTableModuleSaOptions());
- }
- return jScrollPaneModuleSaOptions;
- }
- /**
- * This method initializes jTableModuleSaOptions
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableModuleSaOptions() {
- if (jTableModuleSaOptions == null) {
- optionsTableModel = new DefaultTableModel();
- optionsTableModel.addColumn("BuildTargets");
- optionsTableModel.addColumn("ToolChainFamily");
- optionsTableModel.addColumn("TagName");
- optionsTableModel.addColumn("ToolCode");
- optionsTableModel.addColumn("SupportedArchs");
- optionsTableModel.addColumn("Contents");
- jTableModuleSaOptions = new JTable(optionsTableModel);
- jTableModuleSaOptions.setRowHeight(20);
-
- jTableModuleSaOptions.getColumnModel().getColumn(0).setMinWidth(buildTargetWidth);
- jTableModuleSaOptions.getColumnModel().getColumn(1).setMinWidth(toolChainFamilyWidth);
- jTableModuleSaOptions.getColumnModel().getColumn(2).setMinWidth(tagNameWidth);
- jTableModuleSaOptions.getColumnModel().getColumn(3).setMinWidth(toolCmdCodeWidth);
- jTableModuleSaOptions.getColumnModel().getColumn(4).setMinWidth(supportArchWidth);
- jTableModuleSaOptions.getColumnModel().getColumn(5).setMinWidth(argWidth);
-// javax.swing.table.TableColumn toolFamilyCol = jTableModuleSaOptions.getColumnModel().getColumn(1);
-// JComboBox cb = new JComboBox();
-// cb.addItem("MSFT");
-// cb.addItem("GCC");
-// cb.addItem("CYGWIN");
-// cb.addItem("INTEL");
-// cb.addItem("USER_DEFINED");
-// toolFamilyCol.setCellEditor(new DefaultCellEditor(cb));
-
- Vector<String> vArch = new Vector<String>();
- vArch.add("IA32");
- vArch.add("X64");
- vArch.add("IPF");
- vArch.add("EBC");
- vArch.add("ARM");
- vArch.add("PPC");
- jTableModuleSaOptions.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch, FrameworkWizardUI.getInstance()));
-
- jTableModuleSaOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor(FrameworkWizardUI.getInstance()));
-
- jTableModuleSaOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableModuleSaOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
- jTableModuleSaOptions.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel)arg0.getSource();
-
- if (arg0.getType() == TableModelEvent.UPDATE){
- //ToDo Data Validition check.
- String targets = m.getValueAt(row, 0) + "";
- Vector<Object> targetName = null;
- if (targets.length() > 0) {
- targetName = new Vector<Object>();
- String[] sArray = targets.split(" ");
- for (int i = 0; i < sArray.length; ++i) {
- targetName.add(sArray[i]);
- }
- }
-
- String toolChain = m.getValueAt(row, 1) + "";
- String tagName = m.getValueAt(row, 2) + "";
- String toolCode = m.getValueAt(row, 3) + "";
- String archs = m.getValueAt(row, 4) + "";
- Vector<Object> supArch = null;
- if (archs.length() > 0) {
- supArch = new Vector<Object>();
- String[] sArray1 = archs.split(" ");
- for (int i = 0; i < sArray1.length; ++i) {
- supArch.add(sArray1[i]);
- }
- }
-
- String contents = m.getValueAt(row, 5) + "";
- docConsole.setSaved(false);
- ffc.updateModuleSAOptionsOpt(moduleKey, row, targetName, toolChain, tagName, toolCode, supArch, contents);
- }
- }
- });
- }
- return jTableModuleSaOptions;
- }
- /**
- * This method initializes jButtonNew
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNew() {
- if (jButtonNew == null) {
- jButtonNew = new JButton();
- jButtonNew.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonNew.setText("New");
- jButtonNew.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- String[] row = {"", "", "", "", "", ""};
- optionsTableModel.addRow(row);
- Vector<Object> v = null;
- Vector<Object> v1 = null;
- docConsole.setSaved(false);
- ffc.genModuleSAOptionsOpt(moduleKey, v, "", "", "", v1, "");
- }
- });
- }
- return jButtonNew;
- }
- /**
- * This method initializes jButtonDelete
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDeleteOption() {
- if (jButtonDeleteOption == null) {
- jButtonDeleteOption = new JButton();
- jButtonDeleteOption.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonDeleteOption.setText("Delete");
- jButtonDeleteOption.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableModuleSaOptions.getSelectedRow() < 0) {
- return;
- }
- docConsole.setSaved(false);
- ffc.removeModuleSAOptionsOpt(moduleKey, jTableModuleSaOptions.getSelectedRow());
- optionsTableModel.removeRow(jTableModuleSaOptions.getSelectedRow());
- }
- });
- }
- return jButtonDeleteOption;
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-/**
- * This method initializes jPanelPcdFields
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelPcdFields() {
- if (jPanelPcdFields == null) {
- GridLayout gridLayout = new GridLayout();
- gridLayout.setRows(3);
- gridLayout.setColumns(2);
- jPanelPcdFields = new JPanel();
- jPanelPcdFields.setLayout(gridLayout);
- jPanelPcdFields.setPreferredSize(new java.awt.Dimension(600,90));
- jPanelPcdFields.add(getJPanelPcdFieldsFirstRow(), null);
- jPanelPcdFields.add(getJPanelPcdFieldsSecondRow(), null);
- jPanelPcdFields.add(getJPanelPcdFieldsThirdRow(), null);
- }
- return jPanelPcdFields;
-}
-/**
- * This method initializes jPanelPcdFieldsSecondRow
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelPcdFieldsSecondRow() {
- if (jPanelPcdFieldsSecondRow == null) {
- FlowLayout flowLayout2 = new FlowLayout();
- flowLayout2.setAlignment(java.awt.FlowLayout.LEFT);
- jLabelMaxDatumSize = new JLabel();
- jLabelMaxDatumSize.setText("Max Datum Size");
- jPanelPcdFieldsSecondRow = new JPanel();
- jPanelPcdFieldsSecondRow.setLayout(flowLayout2);
- jPanelPcdFieldsSecondRow.add(jLabelMaxDatumSize, null);
- jPanelPcdFieldsSecondRow.add(getJTextFieldMaxDatumSize(), null);
- }
- return jPanelPcdFieldsSecondRow;
-}
-/**
- * This method initializes jPanelPcdFieldsThirdRow
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelPcdFieldsThirdRow() {
- if (jPanelPcdFieldsThirdRow == null) {
- FlowLayout flowLayout3 = new FlowLayout();
- flowLayout3.setAlignment(java.awt.FlowLayout.LEFT);
- jLabelPcdDefaultValue = new JLabel();
- jLabelPcdDefaultValue.setText("Default Value");
- jLabelPcdDefaultValue.setPreferredSize(new java.awt.Dimension(91,16));
- jPanelPcdFieldsThirdRow = new JPanel();
- jPanelPcdFieldsThirdRow.setLayout(flowLayout3);
- jPanelPcdFieldsThirdRow.add(jLabelPcdDefaultValue, null);
- jPanelPcdFieldsThirdRow.add(getJTextFieldPcdDefault(), null);
- jPanelPcdFieldsThirdRow.add(getJComboBoxFeatureFlagValue(), null);
- jPanelPcdFieldsThirdRow.add(getJButtonUpdatePcd(), null);
- }
- return jPanelPcdFieldsThirdRow;
-}
-/**
- * This method initializes jPanelPcdFieldsFirstRow
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelPcdFieldsFirstRow() {
- if (jPanelPcdFieldsFirstRow == null) {
- FlowLayout flowLayout1 = new FlowLayout();
- flowLayout1.setAlignment(java.awt.FlowLayout.LEFT);
- jLabelItemType = new JLabel();
- jLabelItemType.setText("Item Type");
- jLabelItemType.setPreferredSize(new java.awt.Dimension(91,16));
- jPanelPcdFieldsFirstRow = new JPanel();
- jPanelPcdFieldsFirstRow.setLayout(flowLayout1);
- jPanelPcdFieldsFirstRow.add(jLabelItemType, null);
- jPanelPcdFieldsFirstRow.add(getJComboBoxItemType(), null);
- }
- return jPanelPcdFieldsFirstRow;
-}
-/**
- * This method initializes jComboBoxItemType
- *
- * @return javax.swing.JComboBox
- */
-private JComboBox getJComboBoxItemType() {
- if (jComboBoxItemType == null) {
- jComboBoxItemType = new JComboBox();
- jComboBoxItemType.setPreferredSize(new java.awt.Dimension(200,20));
- jComboBoxItemType.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
-
- int row = jTablePcd.getSelectedRow();
- if (row < 0) {
- return;
- }
-
- if (jComboBoxItemType.getSelectedItem() != null && jComboBoxItemType.getSelectedItem().equals("FIXED_AT_BUILD")) {
- jTextFieldPcdDefault.setEnabled(true);
- }
- else {
- jTextFieldPcdDefault.setEnabled(false);
- }
- }
- });
- }
- return jComboBoxItemType;
-}
-
-private void pcdDynamicToNonDynamic(String cName, String tsGuid) {
- String[][] saa = new String[ffc.getDynamicPcdBuildDataCount()][5];
- ffc.getDynamicPcdBuildData(saa);
- String maxSize = "";
- String value = "";
- for (int i = 0; i < saa.length; ++i) {
- if (saa[i][0].equals(cName) && saa[i][2].equals(tsGuid)) {
- maxSize = saa[i][3];
- value = ffc.getDynamicPcdBuildDataValue(i);
- break;
- }
- }
-
- ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- for (int i = 0; i < al.size(); ++i) {
- String mKey = moduleInfo (al.get(i));
- value = null;
- String itemType = jComboBoxItemType.getSelectedItem()+"";
- ffc.updatePcdData(mKey, cName, tsGuid, itemType, maxSize, value);
- al.set(i, mKey + " " + itemType);
- }
-
- ffc.removeDynamicPcdBuildData(cName, tsGuid);
-}
-
-private void pcdNonDynamicToDynamic(String cName, String tsGuid) {
- ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- for (int i = 0; i < al.size(); ++i) {
- String mKey = moduleInfo (al.get(i));
- String itemType = jComboBoxItemType.getSelectedItem()+"";
- ffc.updatePcdData(mKey, cName, tsGuid, itemType, jTextFieldMaxDatumSize.getText(), jTextFieldPcdDefault.isVisible() ? jTextFieldPcdDefault.getText() : jComboBoxFeatureFlagValue.getSelectedItem()+"");
- al.set(i, mKey + " " + itemType);
- }
- try{
- ffc.addDynamicPcdBuildData(cName, model.getValueAt(jTablePcd.getSelectedRow(), 3), tsGuid, "DYNAMIC", model.getValueAt(jTablePcd.getSelectedRow(), 5)+"", jTextFieldPcdDefault.isVisible() ? jTextFieldPcdDefault.getText() : jComboBoxFeatureFlagValue.getSelectedItem()+"");
- }
- catch(Exception e){
- JOptionPane.showMessageDialog(FpdModuleSA.this, "PCD value format: " + e.getMessage());
- }
-}
-
-private void changePcdTypeWithinSameCategory (String cName, String tsGuid) {
- ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- for (int i = 0; i < al.size(); ++i) {
- String mKey = moduleInfo (al.get(i));
- String itemType = jComboBoxItemType.getSelectedItem()+"";
- ffc.updatePcdData(mKey, cName, tsGuid, itemType, null, null);
- al.set(i, mKey + " " + itemType);
- }
-}
-
-private String moduleInfo (String pcdInfo) {
-
- return pcdInfo.substring(0, pcdInfo.lastIndexOf(" "));
-}
-
-/**
- * This method initializes jTextFieldMaxDatumSize
- *
- * @return javax.swing.JTextField
- */
-private JTextField getJTextFieldMaxDatumSize() {
- if (jTextFieldMaxDatumSize == null) {
- jTextFieldMaxDatumSize = new JTextField();
- jTextFieldMaxDatumSize.setPreferredSize(new java.awt.Dimension(200,20));
- }
- return jTextFieldMaxDatumSize;
-}
-/**
- * This method initializes jTextField4
- *
- * @return javax.swing.JTextField
- */
-private JTextField getJTextFieldPcdDefault() {
- if (jTextFieldPcdDefault == null) {
- jTextFieldPcdDefault = new JTextField();
- jTextFieldPcdDefault.setPreferredSize(new java.awt.Dimension(200,20));
- }
- return jTextFieldPcdDefault;
-}
-/**
- * This method initializes jButton6
- *
- * @return javax.swing.JButton
- */
-private JButton getJButtonUpdatePcd() {
- if (jButtonUpdatePcd == null) {
- jButtonUpdatePcd = new JButton();
- jButtonUpdatePcd.setPreferredSize(new java.awt.Dimension(150,20));
- jButtonUpdatePcd.setText("Update PCD Data");
- jButtonUpdatePcd.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- int row = jTablePcd.getSelectedRow();
- if (row < 0) {
- return;
- }
-
- String cName = model.getValueAt(row, 0)+"";
- String tsGuid = model.getValueAt(row, 1)+"";
- String oldItemType = model.getValueAt(row, 2)+"";
- String dataType = model.getValueAt(row, 5)+"";
- String newItemType = jComboBoxItemType.getSelectedItem()+"";
- String newValue = jTextFieldPcdDefault.isVisible()? jTextFieldPcdDefault.getText():jComboBoxFeatureFlagValue.getSelectedItem()+"";
- if (newValue.length() == 0){
-
- if (dataType.equals("UINT8") || dataType.equals("UINT16") || dataType.equals("UINT32") || dataType.equals("UINT64")) {
- newValue = "0";
- }
- if (dataType.equals("BOOLEAN")){
- newValue = "FALSE";
- }
- if (dataType.equals("VOID*")) {
- newValue = "L\"\"";
- }
- }
-
- String[] pcdInfo = {"", "", ""};
- Vector<String> validPcdTypes = new Vector<String>();
- getPcdInfo (moduleKey, cName, tsGuid, pcdInfo, validPcdTypes);
- if (pcdInfo[1].equals("FIXED_AT_BUILD") && model.getValueAt(row, 5).equals("VOID*")) {
- try {
- jTextFieldMaxDatumSize.setText(ffc.setMaxSizeForPointer(newValue)+"");
- }
- catch (Exception exp) {
- JOptionPane.showMessageDialog(FpdModuleSA.this, "PCD Value MalFormed: " + exp.getMessage());
- return;
- }
- }
- String newMaxDatumSize = jTextFieldMaxDatumSize.getText();
-
- if (!newItemType.equals(oldItemType)) {
- Vector<ModuleIdentification> moduleInfo = new Vector<ModuleIdentification>();
- try {
- boolean changable = itemTypeCouldBeChanged (cName, tsGuid, newItemType, moduleInfo);
- if (!changable) {
- JOptionPane.showMessageDialog(FpdModuleSA.this, "Can NOT Change Pcd Type in: " + moduleInfo.get(0).getName() + " contained in package " + moduleInfo.get(0).getPackageId().getName());
- return;
- }
- }
- catch (Exception exp) {
- JOptionPane.showMessageDialog(FpdModuleSA.this, "Can NOT Change Pcd Type in: " + moduleInfo.get(0).getName() + " contained in package " + moduleInfo.get(0).getPackageId().getName() + " " + exp.getMessage());
- return;
- }
-
- if ((oldItemType.equals("DYNAMIC") || oldItemType.equals("DYNAMIC_EX")) && !newItemType.equals("DYNAMIC") && !newItemType.equals("DYNAMIC_EX")) {
- pcdDynamicToNonDynamic(cName, tsGuid);
- }
- if (!oldItemType.equals("DYNAMIC") && !oldItemType.equals("DYNAMIC_EX") && (newItemType.equals("DYNAMIC") || newItemType.equals("DYNAMIC_EX"))) {
- pcdNonDynamicToDynamic(cName, tsGuid);
- }
- else {
- changePcdTypeWithinSameCategory (cName, tsGuid);
- }
- model.setValueAt(newItemType, row, 2);
- }
-
- ffc.updatePcdData(moduleKey, cName, tsGuid, model.getValueAt(row, 2)+"", newMaxDatumSize, newValue);
- docConsole.setSaved(false);
- model.setValueAt(newValue, row, 6);
- model.setValueAt(newMaxDatumSize, row, 4);
-
- }
- });
- }
- return jButtonUpdatePcd;
-}
-
-private boolean itemTypeCouldBeChanged (String cName, String tsGuid, String newItemType, Vector<ModuleIdentification> mi) throws Exception{
- ArrayList<String> pcdConsumers = ffc.getDynPcdMapValue(cName + " " + tsGuid);
- for (int i = 0; i < pcdConsumers.size(); ++i) {
- String consumerInfo = moduleInfo (pcdConsumers.get(i));
- mi.removeAllElements();
- mi.add(WorkspaceProfile.getModuleId(consumerInfo));
- String[] sa = {"", "", ""};
- Vector<String> validPcdTypes = new Vector<String>();
- getPcdInfo (consumerInfo, cName, tsGuid, sa, validPcdTypes);
- if (validPcdTypes.size() == 0) {
- return false;
- }
- if (!sa[1].equals("DYNAMIC")) {
- return false;
- }
- if (!validPcdTypes.contains(newItemType)) {
- return false;
- }
- }
- return true;
-}
-
-/**
- * This method initializes jComboBoxFeatureFlagValue
- *
- * @return javax.swing.JComboBox
- */
-private JComboBox getJComboBoxFeatureFlagValue() {
- if (jComboBoxFeatureFlagValue == null) {
- jComboBoxFeatureFlagValue = new JComboBox();
- jComboBoxFeatureFlagValue.setPreferredSize(new java.awt.Dimension(100,20));
- jComboBoxFeatureFlagValue.setVisible(false);
- jComboBoxFeatureFlagValue.addItem("TRUE");
- jComboBoxFeatureFlagValue.addItem("FALSE");
- }
- return jComboBoxFeatureFlagValue;
-}
-/**
- * This method initializes jPanelCustomToolChain
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelCustomToolChain() {
- if (jPanelCustomToolChain == null) {
- jPanelCustomToolChain = new JPanel();
- jPanelCustomToolChain.setLayout(new BorderLayout());
- jPanelCustomToolChain.add(getJPanelToolchainS(), java.awt.BorderLayout.SOUTH);
- jPanelCustomToolChain.add(getJScrollPaneModuleSaOptions(), java.awt.BorderLayout.CENTER);
- jPanelCustomToolChain.addComponentListener(new java.awt.event.ComponentAdapter() {
- public void componentShown(java.awt.event.ComponentEvent e) {
- initToolChainOptions(moduleKey);
- }
- });
- }
- return jPanelCustomToolChain;
-}
-/**
- * This method initializes jPanelToolchainS
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelToolchainS() {
- if (jPanelToolchainS == null) {
- jPanelToolchainS = new JPanel();
- jPanelToolchainS.add(getJButtonNew(), null);
- jPanelToolchainS.add(getJButtonDeleteOption(), null);
- }
- return jPanelToolchainS;
-}
-
-/**
- * This method initializes jPanelLibraryCenterN
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelLibraryCenterN() {
- if (jPanelLibraryCenterN == null) {
- FlowLayout flowLayout5 = new FlowLayout();
- flowLayout5.setAlignment(java.awt.FlowLayout.CENTER);
- flowLayout5.setHgap(10);
- jPanelLibraryCenterN = new JPanel();
- jPanelLibraryCenterN.setLayout(flowLayout5);
- jPanelLibraryCenterN.add(jLabelInstanceHelp, null);
- jPanelLibraryCenterN.add(getJScrollPaneInstanceHelp(), null);
- jPanelLibraryCenterN.add(getJButtonAdd(), null);
- jPanelLibraryCenterN.add(getJButtonDeleteInstance(), null);
- }
- return jPanelLibraryCenterN;
-}
-/**
- * This method initializes jPanelLibraryCenterC
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelLibraryCenterC() {
- if (jPanelLibraryCenterC == null) {
- jPanelLibraryCenterC = new JPanel();
- jPanelLibraryCenterC.add(jLabelSelectedInstances, null);
- jPanelLibraryCenterC.add(getJScrollPaneSelectedInstances(), null);
- }
- return jPanelLibraryCenterC;
-}
-
-
-} // @jve:decl-index=0:visual-constraint="10,10"
-
-class MultipleInstanceException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = -9148463005930920297L;
- private String className = null;
- private String libInstance1 = null;
- private String libInstance2 = null;
-
- MultipleInstanceException (String libClass, String instance1, String instance2) {
- super();
- className = libClass;
- libInstance1 = instance1;
- libInstance2 = instance2;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Throwable#getMessage()
- */
- @Override
- public String getMessage() {
- // TODO Auto-generated method stub
- return " Library Class " + className + "is Produced by Two Instances: "
- + libInstance1 + " and " + libInstance2 + ". Platform Build will Fail.";
- }
-
-}
-
-class ImproperInstanceException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = -5279700566993277033L;
- private String className = null;
- private String libInstance = null;
- private String instanceSupArch = null;
- private String instanceSupModType = null;
-
- ImproperInstanceException (String libClass, String instance1, String arch, String type) {
- super();
- className = libClass;
- libInstance = instance1;
- instanceSupArch = arch;
- instanceSupModType = type;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Throwable#getMessage()
- */
- @Override
- public String getMessage() {
- // TODO Auto-generated method stub
- return " Library Class " + className + " Produced by Library Instance: "
- + libInstance + "\nOnly Supports " + instanceSupArch + " and Module Type " + instanceSupModType + ".\n This instance should be removed.\n";
- }
-
-}
-
-class NoInstanceException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1987122786598970598L;
-
- private String className = null;
-
- NoInstanceException (String libClass) {
- className = libClass;
- }
-
- public String getMessage() {
- return "No Applicable Instance for Library Class " + className
- + ", Platform Build will Fail.";
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java deleted file mode 100644 index c87f466bdd..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java +++ /dev/null @@ -1,1043 +0,0 @@ -/** @file
- Java class FpdPlatformDefs is GUI for Flash element operation in SPD file.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
- **/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import javax.swing.JPanel;
-
-import javax.swing.JTabbedPane;
-import javax.swing.JButton;
-import javax.swing.ListSelectionModel;
-
-import org.tianocore.PlatformSurfaceAreaDocument;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
-import org.tianocore.frameworkwizard.toolchain.ToolChainId;
-
-import javax.swing.JCheckBox;
-import javax.swing.JOptionPane;
-import javax.swing.JTextField;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.event.InternalFrameAdapter;
-import javax.swing.event.InternalFrameEvent;
-//import javax.swing.event.ListSelectionEvent;
-//import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableModel;
-import javax.swing.JComboBox;
-import java.awt.Dimension;
-import java.util.Vector;
-
-public class FpdPlatformDefs extends IInternalFrame {
-
- private static boolean Debug = false;
-
- private final int dialogWidth = 600;
-
- private final int oneRowHeight = 20;
-
- private final int twoRowHeight = 40;
-
- // private final int threeRowHeight = 60;
-
- private final int fourRowHeight = 80;
-
- private final int sepHeight = 6;
-
- // private final int sepWidth = 10;
-
- private final int offsetWidth = 70;
-
- private final int buttonWidth = 90;
-
- private final int rowOne = 12;
-
- private final int rowTwo = rowOne + oneRowHeight + sepHeight * 3;
-
- private final int rowThree = rowTwo + oneRowHeight + sepHeight;
-
- private final int rowFour = rowThree + oneRowHeight + sepHeight;
-
- private final int rowFive = rowFour + fourRowHeight + sepHeight * 3;
-
- private final int rowSix = rowFive + oneRowHeight + sepHeight;
-
- private final int rowSeven = rowSix + oneRowHeight + sepHeight;
-
- private final int rowEight = rowSeven + oneRowHeight + sepHeight;
-
- private final int rowNine = rowEight + oneRowHeight + sepHeight;
-
- private final int rowTen = rowNine + fourRowHeight + sepHeight + sepHeight * 3;
-
- private final int rowEleven = rowTen + oneRowHeight + sepHeight;
-
- private final int rowTwelve = rowEleven + oneRowHeight + sepHeight;
-
- private final int dialogHeight = rowTwelve + twoRowHeight;
-
- private final int labelColumn = 12;
-
- private final int valueColumn = 168;
-
- private final int labelWidth = 155;
-
- private final int valueWidth = 320;
-
- private final int valueCenter = valueColumn + (valueWidth / 2);
-
- private final int tableHeight = fourRowHeight;
-
- private final int tableWidth = valueWidth;
-
- private JPanel jContentPane = null;
-
- private JTabbedPane jTabbedPane = null;
-
- private TargetTableModel buildTargetTableModel = null;
-
- private SkuInfoTableModel skuInfoTableModel = null;
-
- private OpeningPlatformType docConsole = null;
-
- private FpdFileContents ffc = null;
-
- private JPanel jPanelGeneralTab = null;
-
- private JPanel jPanelGeneralContainer = null;
-
- private JLabel jLabelSupArch = null;
-
- private JCheckBox jCheckBoxIa32 = null;
-
- private JCheckBox jCheckBoxX64 = null;
-
- private JCheckBox jCheckBoxIpf = null;
-
- private JComboBox jComboBoxInterDir = null;
-
- private JComboBox jBuildTargetComboBox = null;
-
- private JTable jTableBuildTargets = null;
-
- private JPanel jArchitectureSelections = null;
-
- private JLabel jLabelBuildTargets = null;
-
- // private JTextField jTextFieldBuildTarget = null;
-
- private JButton jButtonAddBuildTarget = null;
-
- private JButton jButtonDelBuildTarget = null;
-
- private JScrollPane jScrollPaneBuildTargets = null;
-
- private JScrollPane jScrollPaneSkuInfo = null;
-
- private JTable jTableSkuInfo = null;
-
- private JCheckBox jCheckBoxEbc = null;
-
- private JCheckBox jCheckBoxArm = null;
-
- private JCheckBox jCheckBoxPpc = null;
-
- private JLabel jLabelSkuInfo = null;
-
- private JLabel jLabelSkuId = null;
-
- private JTextField jTextFieldSkuId = null;
-
- private JLabel jLabelSkuName = null;
-
- private JTextField jTextFieldSkuName = null;
-
- private JButton jButtonSkuAdd = null;
-
- private JButton jButtonSkuDel = null;
-
- private JLabel jLabelIntermediateDirs = null;
-
- private JLabel jLabelOutputDir = null;
-
- private JTextField jTextFieldOutputDir = null;
-
- private JLabel jLabelOutputInfo = null;
-
- private int selectedRow = -1;
-
- /**
- * The following are not used by the UI
- */
- private static final long serialVersionUID = 1L;
-
- private ToolChainId tid = new ToolChainId();
-
- public FpdPlatformDefs() {
- super();
- initialize();
- this.setBounds(new java.awt.Rectangle(0, 0, 500, 370));
- this.setVisible(true);
- }
-
- public FpdPlatformDefs(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
- this();
- ffc = new FpdFileContents(fpd);
- init(ffc);
- }
-
- public FpdPlatformDefs(OpeningPlatformType opt) {
- this(opt.getXmlFpd());
- docConsole = opt;
- }
-
- /**
- * This method initializes jTabbedPane
- *
- * @return javax.swing.JTabbedPane
- */
- private JTabbedPane getJTabbedPane() {
- if (jTabbedPane == null) {
- jTabbedPane = new JTabbedPane();
- jTabbedPane.addTab("General", null, getJPanelGeneralTab(), null);
- }
- return jTabbedPane;
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(dialogWidth, dialogHeight);
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- this.setTitle("FPD Platform Definitions");
- this.setContentPane(getJContentPane());
- this.addInternalFrameListener(new InternalFrameAdapter() {
- public void internalFrameDeactivated(InternalFrameEvent e) {
- if (jTableBuildTargets.isEditing()) {
- jTableBuildTargets.getCellEditor().stopCellEditing();
- }
- if (jTableSkuInfo.isEditing()) {
- jTableSkuInfo.getCellEditor().stopCellEditing();
- }
-
- }
- });
- }
-
- private void init(FpdFileContents ffc) {
- Vector<Object> v = new Vector<Object>();
- ffc.getPlatformDefsSupportedArchs(v);
- showSupportedArchitectures(v);
- v.removeAllElements();
-
- ffc.getPlatformDefsBuildTargets(v);
- buildTargetTableModel.setRowCount(0);
- for (int i = 0; i < v.size(); ++i) {
- Object[] row = { v.get(i) };
- buildTargetTableModel.addRow(row);
- }
-
- String[][] saa = new String[ffc.getPlatformDefsSkuInfoCount()][2];
- ffc.getPlatformDefsSkuInfos(saa);
- for (int i = 0; i < saa.length; ++i) {
- skuInfoTableModel.addRow(saa[i]);
- }
-
- String interDir = ffc.getPlatformDefsInterDir();
- if (interDir != null) {
- jComboBoxInterDir.setSelectedItem(interDir);
- }
-
- String outputDir = ffc.getPlatformDefsOutputDir();
- if (outputDir != null) {
- jTextFieldOutputDir.setText(outputDir);
- }
- }
-
- private void showSupportedArchitectures(Vector<Object> v) {
- if (v.contains("IA32")) {
- jCheckBoxIa32.setSelected(true);
- } else {
- jCheckBoxIa32.setSelected(false);
- }
- if (v.contains("X64")) {
- jCheckBoxX64.setSelected(true);
- } else {
- jCheckBoxX64.setSelected(false);
- }
- if (v.contains("IPF")) {
- jCheckBoxIpf.setSelected(true);
- } else {
- jCheckBoxIpf.setSelected(false);
- }
- if (v.contains("EBC")) {
- jCheckBoxEbc.setSelected(true);
- } else {
- jCheckBoxEbc.setSelected(false);
- }
- if (v.contains("ARM")) {
- jCheckBoxArm.setSelected(true);
- } else {
- jCheckBoxArm.setSelected(false);
- }
- if (v.contains("PPC")) {
- jCheckBoxPpc.setSelected(true);
- } else {
- jCheckBoxPpc.setSelected(false);
- }
- }
-
- private void getSupportedArchitectures(Vector<Object> v) {
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- v.removeAllElements();
- if (jCheckBoxIa32.isSelected()) {
- v.add("IA32");
- }
- if (jCheckBoxX64.isSelected()) {
- v.add("X64");
- }
- if (jCheckBoxIpf.isSelected()) {
- v.add("IPF");
- }
- if (jCheckBoxEbc.isSelected()) {
- v.add("EBC");
- }
- if (jCheckBoxArm.isSelected()) {
- v.add("ARM");
- }
- if (jCheckBoxPpc.isSelected()) {
- v.add("PPC");
- }
-
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelGeneralTab() {
- if (jPanelGeneralTab == null) {
- jPanelGeneralTab = new JPanel();
- jPanelGeneralTab.setBounds(new java.awt.Rectangle(0, 0, dialogWidth * 2, dialogHeight * 3));
- jPanelGeneralTab.setPreferredSize(new java.awt.Dimension(dialogWidth + 10, (dialogHeight * 3) + 10));
- jPanelGeneralTab.setAutoscrolls(true);
- jPanelGeneralTab.setLocation(0, 0);
- jPanelGeneralTab.setLayout(null);
- jPanelGeneralTab.add(getJPanelGeneralContainer(), null);
- }
- return jPanelGeneralTab;
- }
-
- /**
- * This method initializes jPanel5
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelGeneralContainer() {
- if (jPanelGeneralContainer == null) {
- jLabelSupArch = new JLabel();
- jLabelSupArch.setText("Supported Architectures");
- jLabelSupArch.setBounds(new java.awt.Rectangle(labelColumn, rowOne, labelWidth, oneRowHeight));
- jLabelBuildTargets = new JLabel();
- jLabelBuildTargets.setText("Build Targets");
- jLabelBuildTargets.setBounds(new java.awt.Rectangle(labelColumn, rowTwo, labelWidth, oneRowHeight));
- jLabelSkuInfo = new JLabel();
- jLabelSkuInfo.setText("SKU Information");
- jLabelSkuInfo.setBounds(new java.awt.Rectangle(labelColumn, rowFive, labelWidth, oneRowHeight));
- jLabelSkuId = new JLabel();
- jLabelSkuId.setText("SKU ID Number");
- jLabelSkuId.setBounds(new java.awt.Rectangle(labelColumn + 10, rowSix, labelWidth, oneRowHeight));
- jLabelSkuName = new JLabel();
- jLabelSkuName.setText("SKU Name");
- jLabelSkuName.setBounds(new java.awt.Rectangle(labelColumn + 10, rowSeven, labelWidth, oneRowHeight));
- jLabelOutputInfo = new JLabel();
- jLabelOutputInfo.setText("Output Directory Configuration");
- jLabelOutputInfo.setBounds(new java.awt.Rectangle(labelColumn, rowTen, valueWidth, oneRowHeight));
- jLabelIntermediateDirs = new JLabel();
- jLabelIntermediateDirs.setText("Intermediate Build Directories");
- jLabelIntermediateDirs.setBounds(new java.awt.Rectangle(labelColumn + 10, rowEleven, valueWidth,
- oneRowHeight));
- jLabelOutputDir = new JLabel();
- jLabelOutputDir.setText("Name of the Output Directory");
- jLabelOutputDir.setBounds(new java.awt.Rectangle(labelColumn + 10, rowTwelve, valueWidth, oneRowHeight));
-
- jPanelGeneralContainer = new JPanel();
- jPanelGeneralContainer.setLayout(null);
- jPanelGeneralContainer.setLocation(new java.awt.Point(2, 2));
- jPanelGeneralContainer.setBounds(new java.awt.Rectangle(2, 2, dialogWidth * 2, dialogHeight));
- jPanelGeneralContainer.setPreferredSize(new java.awt.Dimension(dialogWidth, dialogHeight));
-
- jPanelGeneralContainer.add(jLabelSupArch, null);
- jPanelGeneralContainer.add(getArchitectureSelections(), null);
-
- jPanelGeneralContainer.add(jLabelBuildTargets, null);
- // jPanelGeneralContainer.add(getJTextFieldBuildTarget(), null);
- jPanelGeneralContainer.add(getJBuildTargetComboBox(), null);
-
- jPanelGeneralContainer.add(getJButtonAddBuildTarget(), null);
- jPanelGeneralContainer.add(getJButtonDelBuildTarget(), null);
- jPanelGeneralContainer.add(getJScrollPaneBuildTargets(), null);
-
- jPanelGeneralContainer.add(jLabelSkuInfo, null);
- jPanelGeneralContainer.add(jLabelSkuId, null);
- jPanelGeneralContainer.add(getJTextFieldSkuId(), null);
- jPanelGeneralContainer.add(jLabelSkuName, null);
- jPanelGeneralContainer.add(getJTextFieldSkuName(), null);
- jPanelGeneralContainer.add(getJButtonSkuAdd(), null);
- jPanelGeneralContainer.add(getJButtonSkuDel(), null);
- jPanelGeneralContainer.add(getJScrollPaneSkuInfo(), null);
-
- jPanelGeneralContainer.add(jLabelOutputInfo, null);
- jPanelGeneralContainer.add(jLabelIntermediateDirs, null);
- jPanelGeneralContainer.add(getJComboBoxInterDir(), null);
- jPanelGeneralContainer.add(jLabelOutputDir, null);
- jPanelGeneralContainer.add(getJTextFieldOutputDir(), null);
-
- }
- return jPanelGeneralContainer;
- }
-
- /**
- * This method initializes jArchitectureSelections Row 4
- *
- * @return jArchitectureSelections
- */
- private JPanel getArchitectureSelections() {
- if (jArchitectureSelections == null) {
- jArchitectureSelections = new JPanel();
- jArchitectureSelections.setLayout(null);
- jArchitectureSelections.add(getJCheckBoxIa32(), null);
- jArchitectureSelections.add(getJCheckBoxX64(), null);
- jArchitectureSelections.add(getJCheckBoxIpf(), null);
- jArchitectureSelections.add(getJCheckBoxEbc(), null);
- jArchitectureSelections.add(getJCheckBoxArm(), null);
- jArchitectureSelections.add(getJCheckBoxPpc(), null);
- jArchitectureSelections.setBounds(new java.awt.Rectangle(valueColumn, rowOne, valueWidth, oneRowHeight));
- jArchitectureSelections.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jArchitectureSelections.setLocation(new java.awt.Point(valueColumn, rowOne));
- jArchitectureSelections.setToolTipText("<html>A Platform may support one or more architectures,"
- + "<br>at least one architecture must be selected!</html>");
- }
- return jArchitectureSelections;
- }
-
- /**
- * This method initializes jCheckBox1
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxIa32() {
- if (jCheckBoxIa32 == null) {
- jCheckBoxIa32 = new JCheckBox();
- jCheckBoxIa32.setText("IA32");
- jCheckBoxIa32.setBounds(new java.awt.Rectangle(0, 0, 55, 20));
- jCheckBoxIa32.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- Vector<Object> v = new Vector<Object>();
- getSupportedArchitectures(v);
- if (v.size() == 0) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture.");
- jCheckBoxIa32.setSelected(true);
- return;
- }
- ffc.setPlatformDefsSupportedArchs(v);
- }
- });
- }
- return jCheckBoxIa32;
- }
-
- /**
- * This method initializes jCheckBox2
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxX64() {
- if (jCheckBoxX64 == null) {
- jCheckBoxX64 = new JCheckBox();
- jCheckBoxX64.setText("X64");
- jCheckBoxX64.setBounds(new java.awt.Rectangle(55, 0, 53, 20));
- jCheckBoxX64.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- Vector<Object> v = new Vector<Object>();
- getSupportedArchitectures(v);
- if (v.size() == 0) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture.");
- jCheckBoxX64.setSelected(true);
- return;
- }
- ffc.setPlatformDefsSupportedArchs(v);
- }
- });
- }
- return jCheckBoxX64;
- }
-
- /**
- * This method initializes jCheckBox3
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxIpf() {
- if (jCheckBoxIpf == null) {
- jCheckBoxIpf = new JCheckBox();
- jCheckBoxIpf.setText("IPF");
- jCheckBoxIpf.setBounds(new java.awt.Rectangle(108, 0, 52, 20));
- jCheckBoxIpf.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- Vector<Object> v = new Vector<Object>();
- getSupportedArchitectures(v);
- if (v.size() == 0) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture.");
- jCheckBoxIpf.setSelected(true);
- return;
- }
- ffc.setPlatformDefsSupportedArchs(v);
- }
- });
- }
- return jCheckBoxIpf;
- }
-
- /**
- * This method initializes jCheckBox
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxEbc() {
- if (jCheckBoxEbc == null) {
- jCheckBoxEbc = new JCheckBox();
- // jCheckBoxEbc.setPreferredSize(new java.awt.Dimension(50, 20));
- jCheckBoxEbc.setBounds(new java.awt.Rectangle(160, 0, 53, 20));
- jCheckBoxEbc.setText("EBC");
- jCheckBoxEbc.setVisible(true);
- jCheckBoxEbc.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- Vector<Object> v = new Vector<Object>();
- getSupportedArchitectures(v);
- if (v.size() == 0) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture.");
- jCheckBoxEbc.setSelected(true);
- return;
- }
- ffc.setPlatformDefsSupportedArchs(v);
- }
- });
- }
- return jCheckBoxEbc;
- }
-
- /**
- * This method initializes jCheckBox5
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxArm() {
- if (jCheckBoxArm == null) {
- jCheckBoxArm = new JCheckBox();
- // jCheckBoxArm.setPreferredSize(new java.awt.Dimension(52, 20));
- jCheckBoxArm.setBounds(new java.awt.Rectangle(213, 0, 54, 20));
- jCheckBoxArm.setText("ARM");
- jCheckBoxArm.setVisible(true);
- jCheckBoxArm.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- Vector<Object> v = new Vector<Object>();
- getSupportedArchitectures(v);
- if (v.size() == 0) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture.");
- jCheckBoxArm.setSelected(true);
- return;
- }
- ffc.setPlatformDefsSupportedArchs(v);
- }
- });
- }
- return jCheckBoxArm;
- }
-
- /**
- * This method initializes jCheckBox6
- *
- * @return javax.swing.JCheckBox
- */
- private JCheckBox getJCheckBoxPpc() {
- if (jCheckBoxPpc == null) {
- jCheckBoxPpc = new JCheckBox();
- // jCheckBoxPpc.setPreferredSize(new Dimension(50, 20));
- jCheckBoxPpc.setBounds(new java.awt.Rectangle(267, 0, 53, 20));
- jCheckBoxPpc.setText("PPC");
- jCheckBoxPpc.setVisible(true);
- jCheckBoxPpc.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- Vector<Object> v = new Vector<Object>();
- getSupportedArchitectures(v);
- if (v.size() == 0) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture.");
- jCheckBoxPpc.setSelected(true);
- return;
- }
- ffc.setPlatformDefsSupportedArchs(v);
- }
- });
- }
- return jCheckBoxPpc;
- }
-
- /**
- * Use a ComboBox for BuildTargets
- *
- * @return javax.swing.JComboBox jBuildTargetComboBox
- */
- private JComboBox getJBuildTargetComboBox() {
- if (jBuildTargetComboBox == null) {
- String toolBt = null;
- if (tid.getToolsDefTargetNames() == null)
- toolBt = "DEBUG RELEASE";
- else
- toolBt = tid.getToolsDefTargetNames().trim();
-
- if ((toolBt.contains("*")) || (toolBt.length() < 1)) {
- toolBt = "DEBUG RELEASE";
- }
- if (Debug)
- System.out.println("Using Build Targets: " + toolBt.trim());
-
- toolBt = toolBt.replaceAll(" ", ":");
- toolBt = " :" + toolBt;
- if (Debug)
- System.out.println("Using Build Targets: " + toolBt.trim());
- String[] buildTargets = toolBt.trim().split(":");
-
- jBuildTargetComboBox = new JComboBox(buildTargets);
- jBuildTargetComboBox.setEditable(true);
- jBuildTargetComboBox.setPreferredSize(new Dimension(valueWidth, oneRowHeight));
- jBuildTargetComboBox.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, valueWidth, oneRowHeight));
- jBuildTargetComboBox.setLocation(new java.awt.Point(valueColumn, rowTwo));
- jBuildTargetComboBox.setToolTipText("<html>Select a defined Target and then click Add,<br>"
- + "or enter a new, one word TargetName and then click Add.<br>"
- + "Remember to define the Targetname in the tool defintion file."
- + "</html>");
-
- }
- return jBuildTargetComboBox;
- }
-
- /**
- * This method initializes jTextField1
- *
- * @return javax.swing.JTextField
- */
- // private JTextField getJTextFieldBuildTarget() {
- // if (jTextFieldBuildTarget == null) {
- // jTextFieldBuildTarget = new JTextField();
- // jTextFieldBuildTarget.setPreferredSize(new Dimension(valueWidth, oneRowHeight));
- // jTextFieldBuildTarget.setBounds(new java.awt.Rectangle(valueColumn, rowTwo, valueWidth, oneRowHeight));
- // jTextFieldBuildTarget.setLocation(new java.awt.Point(valueColumn, rowTwo));
- // }
- // return jTextFieldBuildTarget;
- // }
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonAddBuildTarget() {
- if (jButtonAddBuildTarget == null) {
- jButtonAddBuildTarget = new JButton();
- jButtonAddBuildTarget.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
- jButtonAddBuildTarget.setBounds(new java.awt.Rectangle(valueCenter - buttonWidth - 5, rowThree,
- buttonWidth, oneRowHeight));
- jButtonAddBuildTarget.setLocation(new java.awt.Point(valueCenter - buttonWidth - 5, rowThree));
- jButtonAddBuildTarget.setText("Add");
- jButtonAddBuildTarget.setVisible(true);
-
- jButtonAddBuildTarget.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- // Used with Text Field
- // if (jTextFieldBuildTarget.getText().length() > 0) {
- // String[] row = { jTextFieldBuildTarget.getText() };
- // jTextFieldBuildTarget.setText("");
- // buildTargetTableModel.addRow(row);
- // Vector<Object> v = new Vector<Object>();
- // for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {
- // v.add(buildTargetTableModel.getValueAt(i, 0));
- // }
- // docConsole.setSaved(false);
- // ffc.setPlatformDefsBuildTargets(v);
- // }
- // Use with ComboBox
- if (jBuildTargetComboBox.getSelectedItem().toString().length() > 0) {
- String[] row = { jBuildTargetComboBox.getSelectedItem().toString() };
- buildTargetTableModel.addRow(row);
- Vector<Object> v = new Vector<Object>();
- for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {
- v.add(buildTargetTableModel.getValueAt(i, 0));
- }
- docConsole.setSaved(false);
- ffc.setPlatformDefsBuildTargets(v);
- }
- }
- });
- }
- return jButtonAddBuildTarget;
- }
-
- /**
- * This method initializes jButton3
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDelBuildTarget() {
- if (jButtonDelBuildTarget == null) {
- jButtonDelBuildTarget = new JButton();
- jButtonDelBuildTarget.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
- jButtonDelBuildTarget
- .setBounds(new java.awt.Rectangle(valueCenter + 5, rowThree, buttonWidth, oneRowHeight));
- jButtonDelBuildTarget.setLocation(new java.awt.Point(valueCenter + 5, rowThree));
- jButtonDelBuildTarget.setText("Delete");
- jButtonDelBuildTarget.setVisible(true);
-
- jButtonDelBuildTarget.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableBuildTargets.getSelectedRow() < 0) {
- return;
- }
- if (jTableBuildTargets.getRowCount() == 1) {
- JOptionPane.showMessageDialog(FpdPlatformDefs.this, "At least one build target should be set for this platform.");
- return;
- }
- buildTargetTableModel.removeRow(jTableBuildTargets.getSelectedRow());
- Vector<Object> v = new Vector<Object>();
- for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {
- v.add(buildTargetTableModel.getValueAt(i, 0));
- }
- docConsole.setSaved(false);
- ffc.setPlatformDefsBuildTargets(v);
- }
- });
- }
- return jButtonDelBuildTarget;
- }
-
- /**
- * This method initializes jScrollPane2
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneBuildTargets() {
- if (jScrollPaneBuildTargets == null) {
- jScrollPaneBuildTargets = new JScrollPane();
- jScrollPaneBuildTargets.setPreferredSize(new Dimension(tableWidth - 20, tableHeight - 20));
- jScrollPaneBuildTargets.setBounds(new java.awt.Rectangle(valueColumn, rowFour, tableWidth - 5,
- tableHeight - 5));
- jScrollPaneBuildTargets.setLocation(new java.awt.Point(valueColumn, rowFour));
- jScrollPaneBuildTargets
- .setBorder(javax.swing.BorderFactory
- .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
-
- jScrollPaneBuildTargets.setViewportView(getJTableBuildTargets());
- }
- return jScrollPaneBuildTargets;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableBuildTargets() {
- if (jTableBuildTargets == null) {
- buildTargetTableModel = new TargetTableModel();
-
- jTableBuildTargets = new JTable(buildTargetTableModel);
- jTableBuildTargets.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- jTableBuildTargets.setRowHeight(oneRowHeight);
- jTableBuildTargets.setToolTipText("<html>Select one of the Targets from the table and<br>"
- + "click Delete to remove the target from the platform.</html>");
- buildTargetTableModel.addColumn("Build Target");
-
- jTableBuildTargets.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- selectedRow = jTableBuildTargets.getSelectedRow();
- if (selectedRow < 0) {
- return;
- }
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- Vector<Object> v = new Vector<Object>();
- for (int i = 0; i < jTableBuildTargets.getRowCount(); ++i) {
- v.add(m.getValueAt(i, 0));
- }
- docConsole.setSaved(false);
- ffc.setPlatformDefsBuildTargets(v);
- }
- }
- });
-
- }
- return jTableBuildTargets;
- }
-
- /**
- * This method initializes jTextField2
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldSkuId() {
- if (jTextFieldSkuId == null) {
- jTextFieldSkuId = new JTextField();
- jTextFieldSkuId.setPreferredSize(new Dimension(40, oneRowHeight));
- jTextFieldSkuId.setBounds(new java.awt.Rectangle(valueColumn, rowSix, 40, oneRowHeight));
- jTextFieldSkuId.setLocation(new java.awt.Point(valueColumn, rowSix));
- jTextFieldSkuId.setToolTipText("Enter a unique integer value.");
- }
- return jTextFieldSkuId;
- }
-
- /**
- * This method initializes jTextField3
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldSkuName() {
- if (jTextFieldSkuName == null) {
- jTextFieldSkuName = new JTextField();
- jTextFieldSkuName.setPreferredSize(new Dimension(valueWidth, oneRowHeight));
- jTextFieldSkuName.setBounds(new java.awt.Rectangle(valueColumn, rowSeven, valueWidth, oneRowHeight));
- jTextFieldSkuName.setLocation(new java.awt.Point(valueColumn, rowSeven));
- jTextFieldSkuName.setToolTipText("<html>Enter a name to help identify this SKU.<br>"
- + "This entry is not used by the build system, it is<br>"
- + "used only by this user interface.</html>");
- }
- return jTextFieldSkuName;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonSkuAdd() {
- if (jButtonSkuAdd == null) {
- jButtonSkuAdd = new JButton();
-
- jButtonSkuAdd.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
- jButtonSkuAdd.setBounds(new java.awt.Rectangle(valueCenter - buttonWidth - 5, rowEight, buttonWidth,
- oneRowHeight));
- jButtonSkuAdd.setLocation(new java.awt.Point(valueCenter - buttonWidth - 5, rowEight));
- jButtonSkuAdd.setText("Add");
- jButtonSkuAdd.setVisible(true);
-
- jButtonSkuAdd.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTextFieldSkuId.getText().length() > 0) {
- String[] row = { jTextFieldSkuId.getText(), jTextFieldSkuName.getText() };
- skuInfoTableModel.addRow(row);
- docConsole.setSaved(false);
- ffc.genPlatformDefsSkuInfo(row[0], row[1]);
- }
- }
- });
- }
- return jButtonSkuAdd;
- }
-
- /**
- * This method initializes jButton1
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonSkuDel() {
- if (jButtonSkuDel == null) {
- jButtonSkuDel = new JButton();
- jButtonSkuDel.setPreferredSize(new Dimension(buttonWidth, oneRowHeight));
- jButtonSkuDel.setBounds(new java.awt.Rectangle(valueCenter + 5, rowEight, buttonWidth, oneRowHeight));
- jButtonSkuDel.setLocation(new java.awt.Point(valueCenter + 5, rowEight));
- jButtonSkuDel.setText("Delete");
- jButtonSkuDel.setVisible(true);
- jButtonSkuDel.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent e) {
- if (jTableSkuInfo.isEditing()) {
- jTableSkuInfo.getCellEditor().stopCellEditing();
- }
- if (jTableSkuInfo.getSelectedRow() < 1) {
- return;
- }
- docConsole.setSaved(false);
- ffc.removePlatformDefsSkuInfo(jTableSkuInfo.getSelectedRow());
- skuInfoTableModel.removeRow(jTableSkuInfo.getSelectedRow());
- }
- });
- }
- return jButtonSkuDel;
- }
-
- /**
- * This method initializes jScrollPane3
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneSkuInfo() {
- if (jScrollPaneSkuInfo == null) {
- jScrollPaneSkuInfo = new JScrollPane();
- jScrollPaneSkuInfo.setPreferredSize(new Dimension(tableWidth - 20, tableHeight - 20));
- jScrollPaneSkuInfo.setBounds(new java.awt.Rectangle(valueColumn, rowNine, tableWidth - 5, tableHeight - 5));
- jScrollPaneSkuInfo.setLocation(new java.awt.Point(valueColumn, rowNine));
-
- jScrollPaneSkuInfo
- .setBorder(javax.swing.BorderFactory
- .createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
-
- jScrollPaneSkuInfo.setViewportView(getJTableSkuInfo());
- }
- return jScrollPaneSkuInfo;
- }
-
- /**
- * This method initializes jTable2
- *
- * @return javax.swing.JTable
- */
- private JTable getJTableSkuInfo() {
- if (jTableSkuInfo == null) {
- skuInfoTableModel = new SkuInfoTableModel();
- skuInfoTableModel.addColumn("SKU ID");
- skuInfoTableModel.addColumn("Name");
- jTableSkuInfo = new JTable(skuInfoTableModel);
- jTableSkuInfo.setToolTipText("<html>SKU ID 0 must always be defined as the default.<br>"
- + "0 can mean either SKU disabled, or it can be the<br>"
- + "default value if more than one SKU is defined, and the<br>"
- + "platform is not jumpered to use one of the other SKU values.</html>");
-
- jTableSkuInfo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- jTableSkuInfo.getModel().addTableModelListener(new TableModelListener() {
- public void tableChanged(TableModelEvent arg0) {
- // TODO Auto-generated method stub
- int row = arg0.getFirstRow();
- TableModel m = (TableModel) arg0.getSource();
- if (arg0.getType() == TableModelEvent.UPDATE) {
- //ToDo Data Validition check.
- String id = m.getValueAt(row, 0) + "";
- String name = m.getValueAt(row, 1) + "";
- docConsole.setSaved(false);
- ffc.updatePlatformDefsSkuInfo(row, id, name);
- }
- }
- });
- }
- return jTableSkuInfo;
- }
-
- /**
- * This method initializes jComboBox
- *
- * @return javax.swing.JComboBox
- */
- private JComboBox getJComboBoxInterDir() {
- if (jComboBoxInterDir == null) {
- jComboBoxInterDir = new JComboBox();
- jComboBoxInterDir.setPreferredSize(new Dimension(75, oneRowHeight));
- jComboBoxInterDir.setBounds(new java.awt.Rectangle(valueColumn + offsetWidth, rowEleven, 95, oneRowHeight));
- jComboBoxInterDir.setLocation(new java.awt.Point(valueColumn + offsetWidth, rowEleven));
- jComboBoxInterDir.addItem("UNIFIED");
- jComboBoxInterDir.addItem("MODULE");
- jComboBoxInterDir.setSelectedIndex(0);
- jComboBoxInterDir.setToolTipText("<html>Select UNIFIED to generate intermediate directories under<br>"
- + "under platform directory tree.<br>"
- + "Select MODULE to generate intermediate directories under the<br>"
- + "individual module directories.</html>");
- jComboBoxInterDir.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- if (docConsole != null) {
- docConsole.setSaved(false);
- }
- ffc.setPlatformDefsInterDir(jComboBoxInterDir.getSelectedItem() + "");
- }
- });
- }
- return jComboBoxInterDir;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField Row Twelve
- */
- private JTextField getJTextFieldOutputDir() {
- if (jTextFieldOutputDir == null) {
- jTextFieldOutputDir = new JTextField();
- jTextFieldOutputDir.setPreferredSize(new java.awt.Dimension(290, 20));
- jTextFieldOutputDir.setBounds(new java.awt.Rectangle(valueColumn + offsetWidth, rowTwelve, valueWidth - 30,
- oneRowHeight));
- jTextFieldOutputDir.setLocation(new java.awt.Point(valueColumn + offsetWidth, rowTwelve));
- jTextFieldOutputDir.setToolTipText("Select the name or URL for the output directory tree.");
- jTextFieldOutputDir.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusLost(java.awt.event.FocusEvent e) {
- docConsole.setSaved(false);
- ffc.setPlatformDefsOutputDir(jTextFieldOutputDir.getText());
- }
- });
- }
- return jTextFieldOutputDir;
- }
-
-} // @jve:decl-index=0:visual-constraint="10,10"
-
-class SkuInfoTableModel extends DefaultTableModel {
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int column) {
- if (row == 0) {
- return false;
- }
- return true;
- }
-}
-
-class TargetTableModel extends DefaultTableModel {
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int column) {
- if (row < 2) {
- return false;
- }
- return true;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenAprioriFileDialog.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenAprioriFileDialog.java deleted file mode 100644 index 401772f28a..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenAprioriFileDialog.java +++ /dev/null @@ -1,265 +0,0 @@ -/**
- *
- */
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-
-import javax.swing.JPanel;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Vector;
-
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JComboBox;
-import javax.swing.JTabbedPane;
-
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;
-
-/**
- * @author jlin16
- *
- */
-public class GenAprioriFileDialog extends JDialog implements ActionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 3627991301208644354L;
- private JPanel jContentPane = null;
- private JPanel jPanelN = null;
- private JLabel jLabelFvName = null;
- private JComboBox jComboBoxFvNames = null;
- private JTabbedPane jTabbedPane = null;
- private FpdFileContents ffc = null;
- private OpeningPlatformType docConsole = null;
-
- /**
- * This is the default constructor
- */
- public GenAprioriFileDialog(FpdFileContents inputFfc, OpeningPlatformType dc) {
- super();
- ffc = inputFfc;
- docConsole = dc;
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(670, 670);
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- this.setTitle("Apriori Files");
- this.setContentPane(getJContentPane());
- this.setResizable(false);
- this.setModal(true);
-
- String fvName = jComboBoxFvNames.getSelectedItem()+"";
- if (fvName.length() > 0) {
- jTabbedPane.removeAll();
- AprioriModuleOrderPane peiPane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, true);
- peiPane.showModulesInFv(fvName);
- peiPane.showAllModulesInPlatform();
- jTabbedPane.addTab("PEIMs", peiPane);
- AprioriModuleOrderPane dxePane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, false);
- dxePane.showModulesInFv(fvName);
- dxePane.showAllModulesInPlatform();
- jTabbedPane.addTab("DXE Drivers", dxePane);
- }
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJPanelN(), java.awt.BorderLayout.NORTH);
- jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- if (arg0.getActionCommand().equals("ModuleOrderPaneOk")) {
- docConsole.setSaved(false);
- return;
- }
- if (arg0.getActionCommand().equals("ModuleOrderPaneCancel")) {
- this.dispose();
- }
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-
-/**
- * This method initializes jPanelN
- *
- * @return javax.swing.JPanel
- */
-private JPanel getJPanelN() {
- if (jPanelN == null) {
- jLabelFvName = new JLabel();
- jLabelFvName.setText("FV Name");
- jPanelN = new JPanel();
- jPanelN.add(jLabelFvName, null);
- jPanelN.add(getJComboBoxFvNames(), null);
- }
- return jPanelN;
-}
-
-/**
- * This method initializes jComboBoxFvNames
- *
- * @return javax.swing.JComboBox
- */
-private JComboBox getJComboBoxFvNames() {
- if (jComboBoxFvNames == null) {
- jComboBoxFvNames = new JComboBox();
- jComboBoxFvNames.setPreferredSize(new java.awt.Dimension(200,20));
- Vector<String> vFvNames = new Vector<String>();
- ffc.getFvImagesFvImageFvImageNames(vFvNames);
- for (int i = 0; i < vFvNames.size(); ++i) {
- jComboBoxFvNames.addItem(vFvNames.get(i));
- }
-// if (jComboBoxFvNames.getItemCount() > 0) {
-// jComboBoxFvNames.setSelectedIndex(0);
-//
-// }
- jComboBoxFvNames.addItemListener(new java.awt.event.ItemListener() {
- public void itemStateChanged(java.awt.event.ItemEvent e) {
- String fvName = jComboBoxFvNames.getSelectedItem()+"";
- if (fvName.length() > 0) {
- jTabbedPane.removeAll();
- AprioriModuleOrderPane peiPane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, true);
- peiPane.showModulesInFv(fvName);
- peiPane.showAllModulesInPlatform();
- jTabbedPane.addTab("PEIMs", peiPane);
- AprioriModuleOrderPane dxePane = new AprioriModuleOrderPane(fvName, "", GenAprioriFileDialog.this, false);
- dxePane.showModulesInFv(fvName);
- dxePane.showAllModulesInPlatform();
- jTabbedPane.addTab("DXE Drivers", dxePane);
- }
-
- }
- });
- }
- return jComboBoxFvNames;
-}
-
-/**
- * This method initializes jTabbedPane
- *
- * @return javax.swing.JTabbedPane
- */
-private JTabbedPane getJTabbedPane() {
- if (jTabbedPane == null) {
- jTabbedPane = new JTabbedPane();
- }
- return jTabbedPane;
-}
-
-private class AprioriModuleOrderPane extends ModuleOrderPane {
- /**
- *
- */
- private static final long serialVersionUID = -7952853414833230546L;
- private boolean forPEI = false;
- private String fvName = null;
-
- AprioriModuleOrderPane (String fvName, String file, ActionListener action, boolean b) {
-
- super(fvName, file, ffc, action);
- this.fvName = fvName;
- forPEI = b;
- getJTableModInFv().getColumnModel().getColumn(0).setHeaderValue("Modules in Apriori File");
- getJButtonOk().setText("Save");
- getJButtonCancel().setText("Close");
- }
-
- public void showModulesInFv (String fvName) {
- String id = "1";
- if (forPEI) {
- id = "0";
- }
- int size = ffc.getUserExtsIncModCount(fvName, "APRIORI", id);
-
- if (size != -1) {
- String[][] saa = new String[size][5];
- ffc.getUserExtsIncMods(fvName, "APRIORI", id, saa);
-
- for (int i = 0; i < size; ++i) {
- String moduleKey = saa[i][0] + " " + saa[i][1] + " " + saa[i][2] + " " + saa[i][3];
- ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
- String name = "N/A";
- if (mi != null) {
- name = mi.getName();
- }
-
- String[] row = { name, saa[i][0] , saa[i][1], saa[i][2] , saa[i][3], saa[i][4] };
- getModInFvTableModel().addRow(row);
- }
- }
- }
-
- public void actionPerformed(ActionEvent arg0) {
- if (arg0.getActionCommand().equals("ModuleOrderPaneOk")) {
- String id = "1";
- if (forPEI) {
- id = "0";
- }
-
- Vector<String[]> vModInFv = new Vector<String[]>();
- for (int i = 0; i < getJTableModInFv().getRowCount(); ++i) {
- String moduleName = getModInFvTableModel().getValueAt(i, 0)+"";
- if (moduleName.length() == 0 || moduleName.equals("N/A")) {
- continue;
- }
-
- String mg = getModInFvTableModel().getValueAt(i, 1)+"";
- String mv = getModInFvTableModel().getValueAt(i, 2)+"";
- String pg = getModInFvTableModel().getValueAt(i, 3)+"";
- String pv = getModInFvTableModel().getValueAt(i, 4)+"";
- String arch = getModInFvTableModel().getValueAt(i, 5)+"";
-
- String[] sa = { mg, mv, pg, pv, arch};
- vModInFv.add(sa);
-
- }
-
- ffc.removeBuildOptionsUserExtensions(fvName, "APRIORI", id);
- ffc.genBuildOptionsUserExtensions(fvName, "APRIORI", id, "", vModInFv);
-
- }
- }
-}
-} // @jve:decl-index=0:visual-constraint="10,10"
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenListDialog.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenListDialog.java deleted file mode 100644 index ef918f0cd7..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenListDialog.java +++ /dev/null @@ -1,244 +0,0 @@ -/** @file
- Java class GenListDialog.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JDialog;
-import javax.swing.KeyStroke;
-
-import javax.swing.JButton;
-
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-import java.util.Vector;
-
-import javax.swing.JScrollPane;
-
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-
-
-/**
- Dialog for List generation.
- @since PackageEditor 1.0
-**/
-public class GenListDialog extends JDialog implements ActionListener{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JPanel jContentPane = null;
- private JPanel jPanelContentEast = null;
- private JPanel jPanelContentCenter = null;
- private JButton jButtonCancel = null;
- private JButton jButtonOk = null;
- private ICheckBoxList checkBoxList = null;
-
-
- private JScrollPane jScrollPane = null;
-
-
-
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonOk){
-
-// this.dispose();
- }
-
- if (arg0.getSource() == jButtonCancel){
- this.dispose();
- }
- }
-
- /**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentEast() {
- if (jPanelContentEast == null) {
- FlowLayout flowLayout = new FlowLayout();
- flowLayout.setVgap(10);
- jPanelContentEast = new JPanel();
- jPanelContentEast.setLayout(flowLayout);
- jPanelContentEast.setPreferredSize(new java.awt.Dimension(100,30));
- jPanelContentEast.add(getJButtonOk(), null);
- jPanelContentEast.add(getJButtonCancel(), null);
- }
- return jPanelContentEast;
- }
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentCenter() {
- if (jPanelContentCenter == null) {
- jPanelContentCenter = new JPanel();
- jPanelContentCenter.setLayout(new FlowLayout());
- jPanelContentCenter.add(getJScrollPane(), null);
-
- }
- return jPanelContentCenter;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- jButtonCancel.registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonOk.setText("Ok");
- jButtonOk.setActionCommand("GenGuidValue");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setPreferredSize(new java.awt.Dimension(300,100));
- jScrollPane.setViewportView(getICheckBoxList());
- }
- return jScrollPane;
- }
-
- private ICheckBoxList getICheckBoxList() {
- if (checkBoxList == null) {
- checkBoxList = new ICheckBoxList();
- checkBoxList.setBounds(new java.awt.Rectangle(40,20,177,74));
-
- }
- return checkBoxList;
- }
-
- public void initList(Vector<String> v){
- checkBoxList.setAllItems(v);
- }
- public Vector<String> getList(){
- Vector<String> v = checkBoxList.getAllCheckedItemsString();
- return v;
- }
-
- public void setList(String s){
- Vector<String> v = new Vector<String>();
- if (s == null) {
- checkBoxList.setAllItemsUnchecked();
- return;
- }
- String[] sArray = s.split(" ");
- for (int i = 0; i < sArray.length; ++i){
- v.add(sArray[i]);
- }
- checkBoxList.initCheckedItem(true, v);
- }
- /**
- * This is the default constructor
- */
- public GenListDialog(JFrame frame) {
- super(frame);
- initialize();
- }
-
- public GenListDialog(ActionListener i, JFrame frame){
- this(frame);
- jButtonOk.addActionListener(i);
- jButtonOk.registerKeyboardAction(i, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(466, 157);
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- this.setModal(true);
- this.setTitle("List");
- this.setContentPane(getJContentPane());
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.EAST);
- jContentPane.add(getJPanelContentCenter(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-
-
-
-} // @jve:decl-index=0:visual-constraint="10,10"
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenLongTextDialog.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenLongTextDialog.java deleted file mode 100644 index 856e227180..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenLongTextDialog.java +++ /dev/null @@ -1,229 +0,0 @@ -/** @file
- Java class GenLongTextDialog.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JDialog;
-import javax.swing.JTextArea;
-import javax.swing.JButton;
-import javax.swing.KeyStroke;
-
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-
-import javax.swing.JScrollPane;
-
-
-
-/**
- Dialog for Long Text generation.
- @since PackageEditor 1.0
-**/
-public class GenLongTextDialog extends JDialog implements ActionListener{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private JPanel jContentPane = null;
- private JPanel jPanelContentEast = null;
- private JPanel jPanelContentCenter = null;
- private JButton jButtonCancel = null;
- private JButton jButtonOk = null;
- private JTextArea jTextArea = null;
-
-
- private JScrollPane jScrollPane = null;
-
- public void actionPerformed(ActionEvent arg0) {
-
- if (arg0.getSource() == jButtonOk){
-
-// this.dispose();
- }
-
- if (arg0.getSource() == jButtonCancel){
- this.dispose();
- }
- }
-
- /**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentEast() {
- if (jPanelContentEast == null) {
- FlowLayout flowLayout = new FlowLayout();
- flowLayout.setVgap(5);
- flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
- jPanelContentEast = new JPanel();
- jPanelContentEast.setLayout(flowLayout);
- jPanelContentEast.setPreferredSize(new java.awt.Dimension(100,30));
- jPanelContentEast.add(getJButtonOk(), null);
- jPanelContentEast.add(getJButtonCancel(), null);
- }
- return jPanelContentEast;
- }
-
- /**
- * This method initializes jPanel4
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJPanelContentCenter() {
- if (jPanelContentCenter == null) {
- jPanelContentCenter = new JPanel();
- jPanelContentCenter.setLayout(new FlowLayout());
- jPanelContentCenter.add(getJScrollPane(), null);
-
- }
- return jPanelContentCenter;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- jButtonCancel.registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));
- jButtonOk.setText("Ok");
- jButtonOk.setActionCommand("GenGuidValue");
- jButtonOk.addActionListener(this);
- }
- return jButtonOk;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setPreferredSize(new java.awt.Dimension(600,40));
- jScrollPane.setViewportView(getJTextArea());
- }
- return jScrollPane;
- }
-
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
-// jTextArea.setBounds(new java.awt.Rectangle(40,20,300,54));
-
- }
- return jTextArea;
- }
-
-
- public String getText(){
-
- return jTextArea.getText();
- }
-
- public void setText(String s){
- jTextArea.setText(s);
- }
- /**
- * This is the default constructor
- */
- public GenLongTextDialog(JFrame frame) {
- super(frame);
- initialize();
- }
-
- public GenLongTextDialog(ActionListener i, JFrame frame){
- this(frame);
- jButtonOk.addActionListener(i);
- jButtonOk.registerKeyboardAction(i, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED);
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(620, 120);
- this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- this.setModal(true);
- this.setTitle("Text Content");
- this.setContentPane(getJContentPane());
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jContentPane = new JPanel();
- jContentPane.setLayout(new BorderLayout());
- jContentPane.add(getJPanelContentEast(), java.awt.BorderLayout.SOUTH);
- jContentPane.add(getJPanelContentCenter(), java.awt.BorderLayout.CENTER);
- }
- return jContentPane;
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow(int intWidth, int intHeight) {
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
- }
-
- /**
- Start the window at the center of screen
-
- **/
- protected void centerWindow() {
- centerWindow(this.getSize().width, this.getSize().height);
- }
-
-
-
-} // @jve:decl-index=0:visual-constraint="10,10"
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/ListEditor.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/ListEditor.java deleted file mode 100644 index 804dc605f4..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/ListEditor.java +++ /dev/null @@ -1,119 +0,0 @@ -/** @file
- Java class GuidEditor.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Vector;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-import javax.swing.JTable;
-import javax.swing.table.TableCellEditor;
-
-
-/**
- Editor for table cell with GUID value.
- @since PackageEditor 1.0
- **/
-public class ListEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private boolean canNotBeEmpty = false;
- private JFrame topFrame = null;
- String archs;
- JButton button;
- GenListDialog dialog;
- protected static final String EDIT = "edit";
-
- public ListEditor(JFrame frame) {
- topFrame = frame;
- button = new JButton();
- button.setActionCommand(EDIT);
- button.addActionListener(this);
- button.setBorderPainted(false);
-
-
- dialog = new GenListDialog(this, frame);
-
- }
-
- public ListEditor(Vector<String> v, JFrame frame) {
- this(frame);
- dialog.initList(v);
- }
-
- /* (non-Javadoc)
- * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int)
- */
- public Component getTableCellEditorComponent(JTable arg0, Object arg1, boolean arg2, int arg3, int arg4) {
- // TODO Auto-generated method stub
- archs = (String)arg1;
- return button;
- }
-
- /* (non-Javadoc)
- * @see javax.swing.CellEditor#getCellEditorValue()
- */
- public Object getCellEditorValue() {
- // TODO Auto-generated method stub
- return archs;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- if (EDIT.equals(arg0.getActionCommand())) {
- //The user has clicked the cell, so
- //bring up the dialog.
- button.setText(archs);
- dialog.setList(archs);
- dialog.setVisible(true);
-
- //Make the renderer reappear.
- fireEditingStopped();
- }
- else { //User pressed dialog's "OK" button.
- Vector<String> v = dialog.getList();
- if (canNotBeEmpty && v.size() == 0) {
- JOptionPane.showMessageDialog(topFrame, "You must select at least one item.");
- return;
- }
- String s = " ";
- for (int i = 0; i < v.size(); ++i) {
- s += v.get(i);
- s += " ";
- }
- archs = s.trim();
- dialog.dispose();
- }
-
- }
-
- /**
- * @param canNotBeEmpty The canNotBeEmpty to set.
- */
- public void setCanNotBeEmpty(boolean canNotBeEmpty) {
- this.canNotBeEmpty = canNotBeEmpty;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/LongTextEditor.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/LongTextEditor.java deleted file mode 100644 index 6e89ba7334..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/LongTextEditor.java +++ /dev/null @@ -1,93 +0,0 @@ -/** @file
- Java class LongTextEditor.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-package org.tianocore.frameworkwizard.platform.ui;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JTable;
-import javax.swing.table.TableCellEditor;
-
-
-/**
- Editor for table cell with Long Text.
- @since PackageEditor 1.0
- **/
-public class LongTextEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- String text;
- JButton button;
- GenLongTextDialog dialog;
- protected static final String EDIT = "editLongText";
-
- public LongTextEditor(JFrame frame) {
-
- button = new JButton();
- button.setActionCommand(EDIT);
- button.addActionListener(this);
- button.setBorderPainted(false);
-
- dialog = new GenLongTextDialog(this, frame);
-
- }
-
- /* (non-Javadoc)
- * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int)
- */
- public Component getTableCellEditorComponent(JTable arg0, Object arg1, boolean arg2, int arg3, int arg4) {
- // TODO Auto-generated method stub
- text = (String)arg1;
- return button;
- }
-
- /* (non-Javadoc)
- * @see javax.swing.CellEditor#getCellEditorValue()
- */
- public Object getCellEditorValue() {
- // TODO Auto-generated method stub
- return text;
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
- if (EDIT.equals(arg0.getActionCommand())) {
- //The user has clicked the cell, so
- //bring up the dialog.
- button.setText(text);
- dialog.setText(text);
- dialog.setVisible(true);
-
- //Make the renderer reappear.
- fireEditingStopped();
- }
- else { //User pressed dialog's "OK" button.
-
- text = dialog.getText().trim();
- dialog.dispose();
- }
-
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/TableSorter.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/TableSorter.java deleted file mode 100644 index 3f37efb38c..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/TableSorter.java +++ /dev/null @@ -1,277 +0,0 @@ -/** @file - - The file is used to sort FrameworkModules of Fpd file - - Copyright (c) 2006, Intel Corporation - All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - **/ -package org.tianocore.frameworkwizard.platform.ui; - -import java.awt.event.*; -import java.util.*; - -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.*; - - -public class TableSorter extends AbstractTableModel { - /** - * - */ - private static final long serialVersionUID = 1L; - - protected DefaultTableModel tableModel; - private TableRow[] rowInView; - private int[] viewPos; - - public static final String DESCENDING = "down"; - public static final String NOT_SORTED = "none"; - public static final String ASCENDING = "up"; - - private JTableHeader tableHeader; - private MouseListener mouseListener = new MouseHandler(); - private TableModelListener tableModelListener = new TableModelHandler(); - - private HashMap<Integer, String> sortingOrders = new HashMap<Integer, String>(); - - public TableSorter(DefaultTableModel tableModel) { - setTableModel(tableModel); - } - - - private void resetSortState() { - rowInView = null; - viewPos = null; - } - - public DefaultTableModel getTableModel() { - return tableModel; - } - - public void setTableModel(DefaultTableModel dtm) { - if (tableModel != null) { - tableModel.removeTableModelListener(tableModelListener); - } - - tableModel = dtm; - if (tableModel != null) { - tableModel.addTableModelListener(tableModelListener); - } - - resetSortState(); - fireTableStructureChanged(); - } - - public JTableHeader getTableHeader() { - return tableHeader; - } - - public void setTableHeader(JTableHeader th) { - if (tableHeader != null) { - tableHeader.removeMouseListener(mouseListener); - } - tableHeader = th; - if (tableHeader != null) { - tableHeader.addMouseListener(mouseListener); - - } - } - - private String getSortState(int column) { - - Integer i = new Integer(column); - if (sortingOrders.get(i) != null) { - return sortingOrders.get(i); - } - return NOT_SORTED; - } - - private void sortStateChanged() { - resetSortState(); - fireTableDataChanged(); - - } - - public void setSortState(int column, String status) { - Integer i = new Integer(column); - sortingOrders.put(i, status); - sortStateChanged(); - } - - private TableRow[] getSortedViewRows() { - if (rowInView == null) { - int rowCount = tableModel.getRowCount(); - rowInView = new TableRow[rowCount]; - int i = 0; - while ( i < rowCount ) { - rowInView[i] = new TableRow(i); - ++i; - } - - if (sortingOrders.size() != 0) { - Arrays.sort(rowInView); - } - } - return rowInView; - } - - public int getModelRowIndex(int viewIndex) { - TableRow[] rArray = getSortedViewRows(); - return rArray[viewIndex].modelIndex; - } - - public int[] getViewIndexArray() { - if (viewPos == null) { - int n = getSortedViewRows().length; - viewPos = new int[n]; - for (int i = 0; i < n; i++) { - viewPos[getModelRowIndex(i)] = i; - } - } - return viewPos; - } - - - - public int getRowCount() { - if (tableModel == null) { - return 0; - } - return tableModel.getRowCount(); - } - - public String getColumnName(int col) { - return tableModel.getColumnName(col); - } - - public int getColumnCount() { - if (tableModel == null) { - return 0; - } - return tableModel.getColumnCount(); - } - - public Class<?> getColumnClass(int col) { - return tableModel.getColumnClass(col); - } - - public boolean isCellEditable(int row, int col) { - int modelIndex = getModelRowIndex(row); - return tableModel.isCellEditable(modelIndex, col); - } - - public Object getValueAt(int row, int col) { - int modelIndex = getModelRowIndex(row); - return tableModel.getValueAt(modelIndex, col); - } - - public void setValueAt(Object val, int row, int col) { - int modelIndex = getModelRowIndex(row); - tableModel.setValueAt(val, modelIndex, col); - } - - // Helper classes - - private class TableRow implements Comparable { - private int modelIndex; - - public TableRow(int index) { - this.modelIndex = index; - } - - public int compareTo(Object o) { - int row1 = modelIndex; - int row2 = ((TableRow) o).modelIndex; - - Iterator<Integer> mapIter = sortingOrders.keySet().iterator(); - - while (mapIter.hasNext()) { - - Integer column = mapIter.next(); - Object o1 = tableModel.getValueAt(row1, column); - Object o2 = tableModel.getValueAt(row2, column); - - int comparison = 0; - if (o1 == null && o2 == null) { - comparison = 0; - } else if (o1 == null) { - comparison = -1; - } else if (o2 == null) { - comparison = 1; - } else { - comparison = o1.toString().compareTo(o2.toString());; - } - if (comparison != 0) { - if (getSortState(column.intValue()).equals(DESCENDING)) { - return -comparison; - } - return comparison; - } - } - return 0; - } - } - - private class TableModelHandler implements TableModelListener { - public void tableChanged(TableModelEvent e) { - if (sortingOrders.size() != 0) { - resetSortState(); - fireTableChanged(e); - return; - } - if (e.getFirstRow() == TableModelEvent.HEADER_ROW) { - - fireTableChanged(e); - return; - } - int column = e.getColumn(); - if (e.getFirstRow() == e.getLastRow() - && column != TableModelEvent.ALL_COLUMNS - && getSortState(column).equals(NOT_SORTED) - && viewPos != null) { - int viewIndex = getViewIndexArray()[e.getFirstRow()]; - fireTableChanged(new TableModelEvent(TableSorter.this, - viewIndex, viewIndex, - column, e.getType())); - return; - } - - resetSortState(); - fireTableDataChanged(); - return; - } - } - - private class MouseHandler extends MouseAdapter { - public void mouseClicked(MouseEvent e) { - JTableHeader h = (JTableHeader) e.getSource(); - TableColumnModel columnModel = h.getColumnModel(); - int viewColumn = columnModel.getColumnIndexAtX(e.getX()); - int column = columnModel.getColumn(viewColumn).getModelIndex(); - if (column == 0) { - String status = getSortState(column); - - - if (status.equals(ASCENDING)) { - status = DESCENDING; - } - else if (status.equals(DESCENDING)) { - status = NOT_SORTED; - } - else if (status.equals(NOT_SORTED)) { - status = ASCENDING; - } - setSortState(column, status); - } - } - } - -} diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/LibraryClassDescriptor.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/LibraryClassDescriptor.java deleted file mode 100644 index df689c6ef1..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/LibraryClassDescriptor.java +++ /dev/null @@ -1,132 +0,0 @@ -/** @file
- This file is for surface area information retrieval.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.platform.ui.global;
-
-import java.util.Vector;
-
-public class LibraryClassDescriptor {
- public String className = "";
- public String supArchs = "";
- public String supModTypes = "";
-
- public LibraryClassDescriptor (String s1, String s2, String s3) {
- className = s1;
- if (s2 != null) {
- supArchs = s2;
- }
- if (s3 != null) {
- supModTypes = s3;
- }
-
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof LibraryClassDescriptor) {
- LibraryClassDescriptor id = (LibraryClassDescriptor)obj;
- if (className.equals(id.className) && sameArchs (supArchs, id.supArchs) && sameModTypes(supModTypes, id.supModTypes)) {
- return true;
- }
- return false;
- }
- else {
- return super.equals(obj);
- }
- }
-
- public int hashCode(){
- return (className + supArchs + supModTypes).toLowerCase().hashCode();
- }
-
- public String toString() {
- return "Library Class "+ className + " [SupArchs: " + supArchs + " SupModTypes: " + supModTypes + "]";
- }
-
- public boolean isSubSetByArchs (LibraryClassDescriptor lcd) {
- if (className.equals(lcd.className)) {
- Vector<String> vArchs1 = getVectorFromString(supArchs);
- Vector<String> vArchs2 = getVectorFromString(lcd.supArchs);
-
- if (isSubSet(vArchs1, vArchs2)) {
- return true;
- }
- }
- return false;
- }
-
- public boolean isSubSetByModTypes (LibraryClassDescriptor lcd) {
- if (className.equals(lcd.className)) {
- Vector<String> vModTypes1 = getVectorFromString(supModTypes);
- Vector<String> vModTypes2 = getVectorFromString(lcd.supModTypes);
-
- if (isSubSet(vModTypes1, vModTypes2)) {
- return true;
- }
- }
- return false;
- }
-
- public boolean hasInterSectionWith (LibraryClassDescriptor lcd) {
- if (className.equals(lcd.className)) {
- Vector<String> vArchs1 = getVectorFromString(supArchs);
- Vector<String> vArchs2 = getVectorFromString(lcd.supArchs);
- if (vArchs1.size() == 0 || (vArchs1.size() == 1 && vArchs1.get(0).equalsIgnoreCase(""))) {
- return true;
- }
- if (vArchs2.size() == 0 || (vArchs2.size() == 1 && vArchs2.get(0).equalsIgnoreCase(""))) {
- return true;
- }
- vArchs1.retainAll(vArchs2);
- if (vArchs1.size() > 0) {
- return true;
- }
- }
- return false;
- }
-
- private boolean isSubSet (Vector<String> v1, Vector<String> v2) {
- if (v2.size() == 0 || (v2.size() == 1 && v2.get(0).equalsIgnoreCase(""))) {
- return true;
- }
- if (v2.containsAll(v1)) {
- return true;
- }
- return false;
- }
-
- public Vector<String> getVectorFromString (String s) {
- if (s == null || s.equals("null")) {
- s = "";
- }
- String[] sa1 = s.split(" ");
- Vector<String> v = new Vector<String>();
- for (int i = 0; i < sa1.length; ++i) {
- v.add(sa1[i]);
- }
- return v;
- }
-
- private boolean sameArchs (String archs1, String archs2) {
- Vector<String> vArchs1 = getVectorFromString(archs1);
- Vector<String> vArchs2 = getVectorFromString(archs2);
-
- if (vArchs1.containsAll(vArchs2) && vArchs2.containsAll(vArchs1)) {
- return true;
- }
- return false;
- }
-
- private boolean sameModTypes (String modTypes1, String modTypes2) {
- return sameArchs(modTypes1, modTypes2);
- }
-}
\ No newline at end of file diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java deleted file mode 100644 index ad0e82ca3f..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java +++ /dev/null @@ -1,413 +0,0 @@ -/** @file
- This file is for surface area information retrieval.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.platform.ui.global;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Stack;
-import java.util.Vector;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.xmlbeans.XmlObject;
-import org.tianocore.BuildTargetList;
-import org.tianocore.LibraryClassDocument;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.PackageDependenciesDocument;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.FilenameDocument.Filename;
-
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-/**
- * SurfaceAreaQuery class is used to query Surface Area information from msa,
- * mbd, spd and fpd files.
- *
- * This class should not instantiated. All the public interfaces is static.
- *
- * @since GenBuild 1.0
- */
-public class SurfaceAreaQuery {
-
- public static String prefix = "http://www.TianoCore.org/2006/Edk2.0";
-
- // /
- // / Contains name/value pairs of Surface Area document object. The name is
- // / always the top level element name.
- // /
- private static Map<String, XmlObject> map = null;
-
- // /
- // / mapStack is used to do nested query
- // /
- private static Stack<Map<String, XmlObject>> mapStack = new Stack<Map<String, XmlObject>>();
-
- // /
- // / prefix of name space
- // /
- private static String nsPrefix = "sans";
-
- // /
- // / xmlbeans needs a name space for each Xpath element
- // /
- private static String ns = null;
-
- // /
- // / keep the namep declaration for xmlbeans Xpath query
- // /
- private static String queryDeclaration = null;
-
- /**
- * Set a Surface Area document for query later
- *
- * @param map
- * A Surface Area document in TopLevelElementName/XmlObject
- * format.
- */
- public static void setDoc(Map<String, XmlObject> map) {
- ns = prefix;
- queryDeclaration = "declare namespace " + nsPrefix + "='" + ns + "'; ";
- SurfaceAreaQuery.map = map;
- }
-
- /**
- * Push current used Surface Area document into query stack. The given new
- * document will be used for any immediately followed getXXX() callings,
- * untill pop() is called.
- *
- * @param newMap
- * The TopLevelElementName/XmlObject format of a Surface Area
- * document.
- */
- public static void push(Map<String, XmlObject> newMap) {
- mapStack.push(SurfaceAreaQuery.map);
- SurfaceAreaQuery.map = newMap;
- }
-
- /**
- * Discard current used Surface Area document and use the top document in
- * stack instead.
- */
- public static void pop() {
- SurfaceAreaQuery.map = mapStack.pop();
- }
-
- // /
- // / Convert xPath to be namespace qualified, which is necessary for
- // XmlBeans
- // / selectPath(). For example, converting /MsaHeader/ModuleType to
- // / /ns:MsaHeader/ns:ModuleType
- // /
- private static String normalizeQueryString(String[] exp, String from) {
- StringBuffer normQueryString = new StringBuffer(4096);
-
- int i = 0;
- while (i < exp.length) {
- String newExp = from + exp[i];
- Pattern pattern = Pattern.compile("([^/]*)(/|//)([^/]+)");
- Matcher matcher = pattern.matcher(newExp);
-
- while (matcher.find()) {
- String starter = newExp.substring(matcher.start(1), matcher
- .end(1));
- String seperator = newExp.substring(matcher.start(2), matcher
- .end(2));
- String token = newExp.substring(matcher.start(3), matcher
- .end(3));
-
- normQueryString.append(starter);
- normQueryString.append(seperator);
- normQueryString.append(nsPrefix);
- normQueryString.append(":");
- normQueryString.append(token);
- }
-
- ++i;
- if (i < exp.length) {
- normQueryString.append(" | ");
- }
- }
-
- return normQueryString.toString();
- }
-
- /**
- * Search all XML documents stored in "map" for the specified xPath, using
- * relative path (starting with '$this')
- *
- * @param xPath
- * xpath query string array
- * @returns An array of XmlObject if elements are found at the specified
- * xpath
- * @returns NULL if nothing is at the specified xpath
- */
- public static XmlObject[] get(String[] xPath) {
- if (map == null) {
- return null;
- }
-
- String[] keys = (String[]) map.keySet().toArray(new String[map.size()]);
- List<XmlObject> result = new ArrayList<XmlObject>();
- for (int i = 0; i < keys.length; ++i) {
- XmlObject rootNode = (XmlObject) map.get(keys[i]);
- if (rootNode == null) {
- continue;
- }
-
- String query = queryDeclaration
- + normalizeQueryString(xPath, "$this/" + keys[i]);
- XmlObject[] tmp = rootNode.selectPath(query);
- for (int j = 0; j < tmp.length; ++j) {
- result.add(tmp[j]);
- }
- }
-
- int size = result.size();
- if (size <= 0) {
- return null;
- }
-
- return (XmlObject[]) result.toArray(new XmlObject[size]);
- }
-
- /**
- * Search XML documents named by "rootName" for the given xPath, using
- * relative path (starting with '$this')
- *
- * @param rootName
- * The top level element name
- * @param xPath
- * The xpath query string array
- * @returns An array of XmlObject if elements are found at the given xpath
- * @returns NULL if nothing is found at the given xpath
- */
- public static XmlObject[] get(String rootName, String[] xPath) {
- if (map == null) {
- return null;
- }
-
- XmlObject root = (XmlObject) map.get(rootName);
- if (root == null) {
- return null;
- }
-
- String query = queryDeclaration
- + normalizeQueryString(xPath, "$this/" + rootName);
- XmlObject[] result = root.selectPath(query);
- if (result.length > 0) {
- return result;
- }
-
- query = queryDeclaration + normalizeQueryString(xPath, "/" + rootName);
- result = root.selectPath(query);
- if (result.length > 0) {
- return result;
- }
-
- return null;
- }
-
- /**
- * Retrieve SourceFiles/Filename for specified ARCH type
- *
- * @param arch
- * architecture name
- * @returns An 2 dimension string array if elements are found at the known
- * xpath
- * @returns NULL if nothing is found at the known xpath
- */
- public static String[][] getSourceFiles(String arch) {
- String[] xPath;
- XmlObject[] returns;
-
- if (arch == null || arch.equals("")) {
- xPath = new String[] { "/Filename" };
- } else {
- xPath = new String[] { "/Filename[not(@SupArchList) or @SupArchList='"
- + arch + "']" };
- }
-
- returns = get("SourceFiles", xPath);
-
- if (returns == null || returns.length == 0) {
- return null;
- }
-
- Filename[] sourceFileNames = (Filename[]) returns;
- String[][] outputString = new String[sourceFileNames.length][2];
- for (int i = 0; i < sourceFileNames.length; i++) {
- outputString[i][0] = sourceFileNames[i].getToolCode();
- outputString[i][1] = sourceFileNames[i].getStringValue();
- }
- return outputString;
- }
-
- /**
- * Retrieve /PlatformDefinitions/OutputDirectory from FPD
- *
- * @returns Directory names array if elements are found at the known xpath
- * @returns Empty if nothing is found at the known xpath
- */
- public static String getFpdOutputDirectory() {
- String[] xPath = new String[] { "/PlatformDefinitions/OutputDirectory" };
-
- XmlObject[] returns = get("FrameworkPlatformDescription", xPath);
- if (returns != null && returns.length > 0) {
- // String TBD
- }
-
- return null;
- }
-
- public static String getFpdIntermediateDirectories() {
- String[] xPath = new String[] { "/PlatformDefinitions/IntermediateDirectories" };
-
- XmlObject[] returns = get("FrameworkPlatformDescription", xPath);
- if (returns != null && returns.length > 0) {
- // TBD
- }
- return "UNIFIED";
- }
-
- public static String getBuildTarget() {
- String[] xPath = new String[] { "/PlatformDefinitions/BuildTargets" };
-
- XmlObject[] returns = get("FrameworkPlatformDescription", xPath);
- if (returns != null && returns.length > 0) {
- return ((BuildTargetList) returns[0]).getStringValue();
- }
-
- return null;
- }
-
- /**
- * Retrieve <xxxHeader>/ModuleType
- *
- * @returns The module type name if elements are found at the known xpath
- * @returns null if nothing is there
- */
- public static String getModuleType(ModuleIdentification mi) {
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = WorkspaceProfile.getModuleXmlObject(mi);
-
- return msa.getMsaHeader().getModuleType()+"";
- }
-
- /**
- * Retrieve PackageDependencies/Package
- *
- * @param arch
- * Architecture name
- *
- * @returns package name list if elements are found at the known xpath
- * @returns null if nothing is there
- */
-
- public static PackageIdentification[] getDependencePkg(String arch, ModuleIdentification mi){
-
- String packageGuid = null;
- String packageVersion = null;
-
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) WorkspaceProfile.getModuleXmlObject(mi);
- if (msa.getPackageDependencies() == null) {
- return new PackageIdentification[0];
- }
- int size = msa.getPackageDependencies().getPackageList().size();
- XmlObject[] returns = new XmlObject[size];
- for (int i = 0; i < size; ++i) {
- returns[i] = msa.getPackageDependencies().getPackageList().get(i);
- }
-
- PackageIdentification[] packageIdList = new PackageIdentification[returns.length];
- for (int i = 0; i < returns.length; i++) {
- PackageDependenciesDocument.PackageDependencies.Package item = (PackageDependenciesDocument.PackageDependencies.Package) returns[i];
- packageGuid = item.getPackageGuid();
- packageVersion = item.getPackageVersion();
-
- Iterator<PackageIdentification> ispi = GlobalData.vPackageList.iterator();
- String ver = "";
- while(ispi.hasNext()) {
- PackageIdentification pi = ispi.next();
- if (packageVersion != null) {
- if (pi.getGuid().equalsIgnoreCase(packageGuid) && pi.getVersion().equals(packageVersion)) {
- packageIdList[i] = pi;
- break;
- }
- }
- else {
- if (pi.getGuid().equalsIgnoreCase(packageGuid)) {
- if (pi.getVersion() != null && pi.getVersion().compareTo(ver) > 0){
- ver = pi.getVersion();
- packageIdList[i] = pi;
- }
- else if (packageIdList[i] == null){
- packageIdList[i] = pi;
- }
- }
- }
-
- }
- }
- return packageIdList;
- }
-
- /**
- * Retrieve LibraryClassDefinitions/LibraryClass for specified usage
- *
- * @param usage
- * Library class usage
- *
- * @returns LibraryClass objects list if elements are found at the known
- * xpath
- * @returns null if nothing is there
- */
- public static Vector<LibraryClassDescriptor> getLibraryClasses(String usage, ModuleIdentification mi){
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)WorkspaceProfile.getModuleXmlObject(mi);
- Vector<LibraryClassDescriptor> libraryClassInfo = new Vector<LibraryClassDescriptor>();
- if (msa.getLibraryClassDefinitions() == null) {
- return libraryClassInfo;
- }
-
- int size = msa.getLibraryClassDefinitions().getLibraryClassList().size();
-
- for (int i = 0; i < size; i++) {
- LibraryClassDocument.LibraryClass libClass = msa.getLibraryClassDefinitions().getLibraryClassList().get(i);
- if (usage.equals(libClass.getUsage().toString())) {
-
- libraryClassInfo.add(new LibraryClassDescriptor(libClass.getKeyword(), libClass.getSupArchList()+"", libClass.getSupModuleList()+""));
- }
- }
-
- return libraryClassInfo;
- }
-
- public static XmlObject[] getSpdPcdDeclarations(PackageIdentification pi) {
- XmlObject[] returns = null;
- PackageSurfaceAreaDocument.PackageSurfaceArea psa = WorkspaceProfile.getPackageXmlObject(pi);
- if (psa.getPcdDeclarations() != null && psa.getPcdDeclarations().getPcdEntryList() != null) {
- int size = psa.getPcdDeclarations().getPcdEntryList().size();
- returns = new XmlObject[size];
- for (int i = 0; i < size; ++i) {
- returns[i] = psa.getPcdDeclarations().getPcdEntryList().get(i);
- }
- }
-
- return returns;
- }
-
-}
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/WorkspaceProfile.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/WorkspaceProfile.java deleted file mode 100644 index 954cda112c..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/WorkspaceProfile.java +++ /dev/null @@ -1,157 +0,0 @@ -/** @file
- WorkspaceProfile class.
-
- WorkspaceProfile provide initializing, instoring, querying and update global data.
- It is a bridge to intercommunicate between multiple component, such as AutoGen,
- PCD and so on.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-**/
-package org.tianocore.frameworkwizard.platform.ui.global;
-
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.PcdCodedDocument;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.Vector;
-
-/**
- WorkspaceProfile provide initializing, instoring, querying and update global data.
- It is a bridge to intercommunicate between multiple component, such as AutoGen,
- PCD and so on.
-
- <p>Note that all global information are initialized incrementally. All data will
- parse and record only of necessary during build time. </p>
-
- @since GenBuild 1.0
-**/
-public class WorkspaceProfile {
- ///
- /// Record current WORKSPACE Directory
- ///
- private static String workspaceDir = "";
-
- /**
- Get the current WORKSPACE Directory.
-
- @return current workspace directory
- **/
- public synchronized static String getWorkspacePath() {
- return workspaceDir;
- }
-
- public synchronized static PackageIdentification getPackageForModule(ModuleIdentification moduleId) {
- //
- // If package already defined in module
- //
- if (moduleId.getPackageId() != null) {
- return moduleId.getPackageId();
- }
-
- return null;
- }
- //
- // expanded by FrameworkWizard
- //
- public synchronized static ModuleSurfaceAreaDocument.ModuleSurfaceArea getModuleXmlObject(ModuleIdentification moduleId) {
- return GlobalData.openingModuleList.getModuleSurfaceAreaFromId(moduleId);
- }
-
- public synchronized static PackageSurfaceAreaDocument.PackageSurfaceArea getPackageXmlObject(PackageIdentification packageId) {
- return GlobalData.openingPackageList.getPackageSurfaceAreaFromId(packageId);
- }
-
- public static ModuleIdentification getModuleId(String key){
- //
- // Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion, Arch into string array.
- //
- String[] keyPart = key.split(" ");
-
- Iterator<ModuleIdentification> iMiList = GlobalData.vModuleList.iterator();
-
- while (iMiList.hasNext()) {
- ModuleIdentification mi = iMiList.next();
- if (mi.getGuid().equalsIgnoreCase(keyPart[0])){
- if (keyPart[1] != null && keyPart[1].length() > 0 && !keyPart[1].equals("null")){
- if(!mi.getVersion().equals(keyPart[1])){
- continue;
- }
- }
-
- PackageIdentification pi = mi.getPackageId();
- if ( !pi.getGuid().equalsIgnoreCase(keyPart[2])){
- continue;
- }
- if (keyPart[3] != null && keyPart[3].length() > 0 && !keyPart[3].equals("null")){
- if(!pi.getVersion().equals(keyPart[3])){
- continue;
- }
- }
- return mi;
- }
- }
-
- return null;
- }
-
- public static Vector<String> getModuleSupArchs(ModuleIdentification mi){
- Vector<String> vArchs = null;
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)getModuleXmlObject(mi);
- if (msa.getModuleDefinitions() == null || msa.getModuleDefinitions().getSupportedArchitectures() == null) {
- return vArchs;
- }
- ListIterator li = msa.getModuleDefinitions().getSupportedArchitectures().listIterator();
- while (li.hasNext()) {
- if (vArchs == null) {
- vArchs = new Vector<String>();
- }
- vArchs.add((String)li.next());
- }
-
- return vArchs;
- }
-
- public static String getModuleType (ModuleIdentification mi) {
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = getModuleXmlObject(mi);
- if (msa.getMsaHeader() == null || msa.getMsaHeader().getModuleType() == null) {
- return null;
- }
- return msa.getMsaHeader().getModuleType().toString();
- }
-
- public static boolean pcdInMsa (String cName, String tsGuid, String supArchList, ModuleIdentification mi) {
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)getModuleXmlObject(mi);
- if (msa.getPcdCoded() == null || msa.getPcdCoded().getPcdEntryList() == null) {
- return false;
- }
- ListIterator li = msa.getPcdCoded().getPcdEntryList().listIterator();
- while (li.hasNext()) {
- PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry)li.next();
- if (msaPcd.getCName().equals(cName) && msaPcd.getTokenSpaceGuidCName().equals(tsGuid)) {
- if (supArchList != null && msaPcd.getSupArchList() != null) {
- if (msaPcd.getSupArchList().toString().toLowerCase().contains(supArchList.trim().toLowerCase())) {
- return true;
- }
- }
- else{
- return true;
- }
- }
- }
- return false;
- }
-
-}
-
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java deleted file mode 100644 index 0c23b6a854..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java +++ /dev/null @@ -1,1152 +0,0 @@ -/** @file
- <<The file is used to update the Build Preferences file, target.txt>>
-
- <<The program will use target.txt, the tools config file specified in that file,
- or it will use the default tools_def.txt file, and it will also scan the
- FrameworkDatabase.db file for certain parameters. >>
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Package Name: Tools
- Module Name: FrameworkWizard
-
- **/
-
-package org.tianocore.frameworkwizard.toolchain;
-
-import java.awt.event.ActionEvent;
-import java.io.*;
-import java.util.Vector;
-import java.util.Iterator;
-import java.util.Scanner;
-
-import javax.swing.*;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.*;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.PlatformSurfaceAreaDocument;
-
-/**
- * The class is used to update the target.txt file.
- *
- * It extends IDialog
- *
- */
-public class Preferences extends IFrame {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -4777906991966638888L;
-
- private final boolean Debug = false;
-
- //
- // Define class members
- //
- private final int oneRowHeight = 20;
-
- private final int twoRowHeight = 40;
-
- private final int threeRowHeight = 60;
-
- private final int sepHeight = 6;
-
- private final int rowOne = 12;
-
- private final int rowTwo = rowOne + oneRowHeight + sepHeight;
-
- private final int rowThree = rowTwo + oneRowHeight + sepHeight;
-
- private final int rowFour = rowThree + threeRowHeight + sepHeight;
-
- private final int rowFive = rowFour + threeRowHeight + sepHeight;
-
- private final int rowSix = rowFive + oneRowHeight + sepHeight;
-
- private final int buttonRow = rowSix + oneRowHeight + sepHeight + sepHeight;
-
- private final int dialogHeight = buttonRow + twoRowHeight + twoRowHeight;
-
- private final int dialogWidth = 540;
-
- private final int lastButtonXLoc = 430;
-
- private final int next2LastButtonLoc = 329;
-
- /*
- * Define the contents for this dialog box
- */
- private static Preferences bTarget = null;
-
- private WorkspaceTools wt = new WorkspaceTools();
-
- private final int activePlatformId = 0;
-
- private final int buildTargetId = 1;
-
- private final int targetArchId = 2;
-
- private final int toolDefFileId = 3;
-
- private final int tagNameId = 4;
-
- private final int threadEnableId = 5;
-
- private final int threadCountId = 6;
-
- private final int maxTargetLines = threadCountId + 1;
-
- private JPanel jContentPane = null;
-
- private JLabel jLabelToolsConfigFile = null;
-
- private JTextField jTextFieldToolsConfigFile = null;
-
- private final int toolConfigFileRow = rowOne;
-
- private JLabel jLabelActivePlatform = null;
-
- private JComboBox jComboBoxActivePlatform = null;
-
- private final int activePlatformRow = rowTwo;
-
- private JLabel jLabelToolChainTagName = null;
-
- private JScrollPane jScrollPaneTagName = null;
-
- private ICheckBoxList iCheckBoxListTagName = null;
-
- private final int toolChainTagNameRow = rowThree;
-
- private JLabel jLabelBuildTarget = null;
-
- private JScrollPane jScrollPaneBuildTarget = null;
-
- private ICheckBoxList iCheckBoxListBuildTarget = null;
-
- private final int buildTargetRow = rowFour;
-
- private JLabel jLabelTargetArch = null;
-
- private ArchCheckBox jArchCheckBox = null;
-
- private final int targetArchRow = rowFive;
-
- private JLabel jLabelEnableThreads = null;
-
- private JLabel jLabelThreadCount = null;
-
- private final int threadRow = rowSix;
-
- private JCheckBox jCheckBoxEnableThreads = null;
-
- private JTextField jTextFieldThreadCount = null;
-
- private String threadCount = "";
-
- private boolean threadEnabled = false;
-
- private JButton jButtonBrowse = null;
-
- private JButton jButtonSave = null;
-
- private JButton jButtonCancel = null;
-
- private final int labelColumn = 12;
-
- private final int labelWidth = 155;
-
- private final int valueColumn = 168;
-
- private final int valueWidth = 352;
-
- private final int valueWidthShort = 260;
-
- private final int buttonWidth = 90;
-
- private String workspaceDir = Workspace.getCurrentWorkspace() + System.getProperty("file.separator");
-
- private String toolsDir = Workspace.getCurrentWorkspace() + System.getProperty("file.separator") + "Tools"
- + System.getProperty("file.separator") + "Conf";
-
- private String defaultToolsConf = toolsDir + System.getProperty("file.separator") + "tools_def.txt";
-
- private String targetFile = toolsDir + System.getProperty("file.separator") + "target.txt";
-
- private String[] targetFileContents = new String[500];
-
- // private String[] toolsConfContents;
-
- private String[] targetLines = new String[maxTargetLines];
-
- private int targetLineNumber[] = new int[maxTargetLines];
-
- private String toolsConfFile;
-
- private String toolsDefTargetNames = null;
-
- private final int toolsDefTargetNameField = 0;
-
- private String toolsDefTagNames = null;
-
- private final int toolsDefTagNameField = 1;
-
- private String toolsDefArchNames = null;
-
- private final int toolsDefArchNameField = 2;
-
- private String toolsDefIdentifier = null;
-
- private int targetLineNumberMax;
-
- private final int toolDefFieldCount = 5;
-
- private Vector<String> vArchList = null;
-
- private Vector<String> vDisableArchList = null;
-
- //
- // Not used by UI
- //
- // private Preferences id = null;
-
- // private EnumerationData ed = new EnumerationData();
-
- /**
- This method initializes jTextFieldToolsConfigFile
-
- @return javax.swing.JTextField jTextFieldToolsConfigFile
- **/
- private JTextField getJTextFieldToolsConfigFile() {
- if (jTextFieldToolsConfigFile == null) {
- if (targetLines[toolDefFileId] != null) {
- String sLine[] = targetLines[toolDefFileId].trim().split("=");
- jTextFieldToolsConfigFile = new JTextField(sLine[1].trim());
- } else
- jTextFieldToolsConfigFile = new JTextField();
-
- jTextFieldToolsConfigFile.setBounds(new java.awt.Rectangle(valueColumn, toolConfigFileRow, valueWidthShort,
- oneRowHeight));
- jTextFieldToolsConfigFile.setPreferredSize(new java.awt.Dimension(valueWidthShort, oneRowHeight));
- jTextFieldToolsConfigFile
- .setToolTipText("<html>"
- + "Specify the name of the filename to use for specifying"
- + "<br>the tools to use for the build. If not specified,"
- + "<br>tools_def.txt will be used for the build. This file"
- + "<br>MUST be located in the WORKSPACE/Tools/Conf directory.</html>");
-
- }
- return jTextFieldToolsConfigFile;
- }
-
- /**
- * This method initializes jComboBoxActivePlatform
- *
- * @return javax.swing.JComboBox jComboBoxActivePlatform
- *
- */
- private JComboBox getActivePlatform() {
- Vector<PlatformIdentification> vPlatformId = wt.getAllPlatforms();
-
- if (jComboBoxActivePlatform == null) {
- jComboBoxActivePlatform = new JComboBox();
- jComboBoxActivePlatform.setBounds(new java.awt.Rectangle(valueColumn, activePlatformRow, valueWidth,
- oneRowHeight));
- jComboBoxActivePlatform.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
- jComboBoxActivePlatform
- .setToolTipText("<html>Select "Do Not Set" if you want to build a platform"
- + "<br>from the directory where the FPD file exists,"
- + "<br>otherwise scroll down to select the platform.</html>");
-
- /*
- * Generate the data, selecting what is in target.txt
- */
- jComboBoxActivePlatform.addItem("Do Not Set");
- Iterator<PlatformIdentification> iter = vPlatformId.iterator();
- while (iter.hasNext()) {
- PlatformIdentification item = iter.next();
- String path = item.getPath().trim();
- String str = path.substring(workspaceDir.length(), path.length());
- str.replace(System.getProperty("file.separator"), "/");
- jComboBoxActivePlatform.addItem(str.trim());
- }
- if (targetLines[activePlatformId] == null)
- jComboBoxActivePlatform.setSelectedItem("Do Not Set");
- else
- jComboBoxActivePlatform.setSelectedItem(targetLines[activePlatformId]);
- }
- return jComboBoxActivePlatform;
- }
-
- /**
- * This method initializes jScrollPaneTagName
- *
- * @return javax.swing.JScrollPane jScrollPaneTagName
- *
- */
- private JScrollPane getJScrollPaneTagName() {
-
- if (jScrollPaneTagName == null) {
- jScrollPaneTagName = new JScrollPane();
- jScrollPaneTagName.setBounds(new java.awt.Rectangle(valueColumn, toolChainTagNameRow, valueWidth,
- threeRowHeight));
- jScrollPaneTagName.setPreferredSize(new java.awt.Dimension(valueWidth, threeRowHeight));
- jScrollPaneTagName.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneTagName.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
- jScrollPaneTagName.setViewportView(getICheckBoxListTagName());
- jScrollPaneTagName.setToolTipText("<html>"
- + "Specify the TagName(s) from the tool configuration file to use"
- + "<br>for your builds. If not specified, all applicable TagName"
- + " <br>tools will be used for the build.</html>");
- jScrollPaneTagName.setVisible(true);
-
- }
- return jScrollPaneTagName;
- }
-
- private ICheckBoxList getICheckBoxListTagName() {
- if (iCheckBoxListTagName == null) {
- iCheckBoxListTagName = new ICheckBoxList();
-
- if (toolsDefTagNames != null) {
- toolsDefTagNames.trim();
- String aTagNames[] = toolsDefTagNames.trim().split(" ");
- Vector<String> vTags = new Vector<String>();
- for (int i = 0; i < aTagNames.length; i++) {
- vTags.add(aTagNames[i]);
- }
- iCheckBoxListTagName.setAllItems(vTags);
- } else {
- Vector<String> defaultTags = stringToVector("MYTOOLS");
- iCheckBoxListTagName.setAllItems(defaultTags);
- }
-
- iCheckBoxListTagName.setAllItemsUnchecked();
- iCheckBoxListTagName.setToolTipText("<html>"
- + "Specify the TagName(s) from the tool configuration file to use"
- + "<br>for your builds. If not specified, all applicable TagName"
- + " <br>tools will be used for the build.</html>");
- Vector<String> vSelectedTags = new Vector<String>();
- if (targetLines[tagNameId] != null) {
- targetLines[tagNameId].trim();
- String targetTags[] = targetLines[tagNameId].trim().split(" ");
- for (int j = 0; j < targetTags.length; j++)
- vSelectedTags.add(targetTags[j]);
- iCheckBoxListTagName.initCheckedItem(true, vSelectedTags);
- }
- }
- return iCheckBoxListTagName;
- }
-
- /**
- * This method initializes jScrollPaneBuildTarget
- *
- * @return javax.swing.JComboBox jScrollPaneBuildTarget
- *
- */
- private JScrollPane getJScrollPaneBuildTarget() {
- if (jScrollPaneBuildTarget == null) {
- jScrollPaneBuildTarget = new JScrollPane();
- jScrollPaneBuildTarget.setBounds(new java.awt.Rectangle(valueColumn, buildTargetRow, valueWidth,
- threeRowHeight));
- jScrollPaneBuildTarget.setPreferredSize(new java.awt.Dimension(valueWidth, threeRowHeight));
- jScrollPaneBuildTarget.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneBuildTarget.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
- jScrollPaneBuildTarget.setViewportView(getICheckBoxListBuildTarget());
- jScrollPaneBuildTarget.setVisible(true);
- jScrollPaneBuildTarget.setToolTipText("<html>"
- + "Select the TARGET Names that you want to build, such as<BR>"
- + "BUILD or BUILD and RELEASE"
- + "<br>If you do not set any of these, all available targets"
- + "<br>will be built.</html>");
-
- }
- return jScrollPaneBuildTarget;
- }
-
- private JCheckBox getCheckBoxEnableThreads() {
- if (jCheckBoxEnableThreads == null) {
- jCheckBoxEnableThreads = new JCheckBox();
- jCheckBoxEnableThreads.setBounds(valueColumn, threadRow, 20, oneRowHeight);
- jCheckBoxEnableThreads.setToolTipText("Select this if you want to enable parallel compilation.");
- jCheckBoxEnableThreads.setSelected(threadEnabled);
- jCheckBoxEnableThreads.addActionListener(this);
-
- }
- return jCheckBoxEnableThreads;
- }
-
- private JTextField getTextFieldThreadCount() {
- if (jTextFieldThreadCount == null) {
- jTextFieldThreadCount = new JTextField();
- jTextFieldThreadCount.setBounds(valueColumn + 215, threadRow, 30, oneRowHeight);
- if (threadCount.length() > 0)
- jTextFieldThreadCount.setText(threadCount);
- jTextFieldThreadCount.setToolTipText("<html>Recommended setting is N+1,<br> where N is the number of physical processors or cores in the system</html>");
- // If CheckBoxEnableThreads is selected, then enable editing
-
- }
- return jTextFieldThreadCount;
- }
-
- private ICheckBoxList getICheckBoxListBuildTarget() {
- if (iCheckBoxListBuildTarget == null) {
-
- String aBuildTargets[] = toolsDefTargetNames.trim().split(" ");
- Vector<String> vBuildTargets = new Vector<String>();
- for (int i = 0; i < aBuildTargets.length; i++) {
- vBuildTargets.add(aBuildTargets[i]);
- }
- iCheckBoxListBuildTarget = new ICheckBoxList();
- iCheckBoxListBuildTarget.setAllItems(vBuildTargets);
- iCheckBoxListBuildTarget.setAllItemsUnchecked();
- iCheckBoxListBuildTarget.setToolTipText("<html>"
- + "Select the TARGET Names that you want to build, such as<BR>"
- + "BUILD or BUILD and RELEASE"
- + "<br>If you do not set any of these, all available targets"
- + "<br>will be built.</html>");
-
- Vector<String> vSelectedTags = new Vector<String>();
- if (targetLines[buildTargetId] != null) {
- targetLines[buildTargetId].trim();
- String targetTags[] = targetLines[buildTargetId].trim().split(" ");
- for (int j = 0; j < targetTags.length; j++)
- vSelectedTags.add(targetTags[j]);
- iCheckBoxListBuildTarget.initCheckedItem(true, vSelectedTags);
- }
- }
- return iCheckBoxListBuildTarget;
- }
-
- /**
- This method initializes jButtonBrowse
-
- @return javax.swing.JButton
- **/
- private JButton getJButtonBrowse() {
- if (jButtonBrowse == null) {
- jButtonBrowse = new JButton();
- jButtonBrowse
- .setBounds(new java.awt.Rectangle(lastButtonXLoc, toolConfigFileRow, buttonWidth, oneRowHeight));
- jButtonBrowse.setText("Browse");
- jButtonBrowse.setPreferredSize(new java.awt.Dimension(buttonWidth, oneRowHeight));
- jButtonBrowse.addActionListener(new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e) {
- //
- // Select files from current workspace
- //
- String dirPrefix = toolsDir + System.getProperty("file.separator");
- JFileChooser chooser = new JFileChooser(dirPrefix);
- File theFile = null;
- // String headerDest = null;
-
- chooser.setMultiSelectionEnabled(false);
- chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
- int retval = chooser.showOpenDialog(Preferences.this);
- if (retval == JFileChooser.APPROVE_OPTION) {
-
- theFile = chooser.getSelectedFile();
- String file = theFile.getPath();
- if (!file.startsWith(dirPrefix)) {
- JOptionPane.showMessageDialog(Preferences.this, "You can only select files in the Tools"
- + System.getProperty("file.separator")
- + "Conf directory!");
-
- return;
- }
-
- jTextFieldToolsConfigFile.setText("Tools/Conf/" + theFile.getName());
- } else {
- return;
- }
- }
- });
- }
- return jButtonBrowse;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonSave() {
- if (jButtonSave == null) {
- jButtonSave = new JButton();
- jButtonSave.setBounds(new java.awt.Rectangle(next2LastButtonLoc, buttonRow, buttonWidth, oneRowHeight));
- jButtonSave.setText("Save");
- jButtonSave.addActionListener(this);
- }
- return jButtonSave;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- *
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(lastButtonXLoc, buttonRow, buttonWidth, oneRowHeight));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
- public static Preferences getInstance() {
- if (bTarget == null) {
- bTarget = new Preferences();
- }
- return bTarget;
- }
-
- /**
- * This is the default constructor
- */
- public Preferences() {
- super();
- init();
- }
-
- /**
- * This method initializes this
- *
- */
- private void init() {
- for (int i = 0; i < maxTargetLines; i++) {
- targetLines[i] = null;
- targetLineNumber[i] = -1;
- }
- initReadFiles();
- this.setSize(dialogWidth, dialogHeight);
- this.setContentPane(getJContentPane());
- this.setTitle("Build Preferences [" + toolsDefIdentifier + "]");
- this.setDefaultCloseOperation(IFrame.DISPOSE_ON_CLOSE);
- this.centerWindow();
- this.setVisible(true);
- }
-
- /**
- * This method initializes this Fill values to all fields if these values are
- * not empty
- *
- * @param initReadFiles
- *
- */
- private void initReadFiles() {
- /*
- * TODO
- * Read Current target.txt file first
- * Read TOOL_CHAIN_CONF file if specified, otherwise use tools_def.txt
- */
- readTargetTxtFile();
- boolean haveBuildTargets = readToolDefinitionFile();
- if (!haveBuildTargets) {
- // Lookup Build Targets from the platforms
- readPlatformFileBuildTargets();
- }
- }
-
- private void readPlatformFileBuildTargets() {
- Vector<PlatformIdentification> vPlatformId = wt.getAllPlatforms();
- String sBuildTargets = "";
-
- // foreach platform, build a list of BuildTargets
- Iterator<PlatformIdentification> iter = vPlatformId.iterator();
- while (iter.hasNext()) {
- PlatformIdentification item = iter.next();
- PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd = GlobalData.openingPlatformList
- .getOpeningPlatformById(
- item)
- .getXmlFpd();
- sBuildTargets += fpd.getPlatformDefinitions().getBuildTargets().toString() + " ";
- }
- String allTargets[] = sBuildTargets.trim().split(" ");
- for (int i = 0; i < allTargets.length; i++) {
- if (!toolsDefTargetNames.contains(allTargets[i])) {
- toolsDefTargetNames += allTargets[i] + " ";
- }
- }
- }
-
- private boolean readToolDefinitionFile() {
-
- // Parse the tool definition file looking for targets and architectures
- toolsConfFile = null;
- boolean buildTargetsExist = true;
-
- if (targetLines[toolDefFileId] != null) {
- String[] result = new String[2];
- targetLines[toolDefFileId].trim();
- result = (targetLines[toolDefFileId]).split("=");
- String resString = (Tools.convertPathToCurrentOsType(result[1])).trim();
- toolsConfFile = workspaceDir.trim() + resString.trim();
- File toolsDefFile = new File(toolsConfFile);
- if (!toolsDefFile.exists()) {
- JOptionPane.showMessageDialog(this, "<html>" + "Tool Definition file, " + toolsConfFile
- + "<br>specified in the target.txt file does not exist!"
- + "<br>Using the default Tool Definition File:<br>"
- + defaultToolsConf);
- toolsConfFile = defaultToolsConf;
- }
- } else {
- toolsConfFile = defaultToolsConf;
- }
- String[] toolsDefFields = new String[toolDefFieldCount];
- for (int i = 0; i < toolDefFieldCount; i++)
- toolsDefFields[i] = null;
- File toolDefFile = new File(toolsConfFile);
- if (toolDefFile.exists()) {
- try {
- FileReader fileReader = new FileReader(toolDefFile);
- BufferedReader reader = new BufferedReader(fileReader);
- String rLine = null;
- String result[];
- int lineCounter = 0;
- while ((rLine = reader.readLine()) != null) {
-
- if (rLine.startsWith("IDENTIFIER")) {
- result = rLine.split("=");
- toolsDefIdentifier = (result[1]).trim();
- } else if ((!rLine.startsWith("#")) && (rLine.contains("="))) {
- result = rLine.split("=");
- toolsDefFields = ((result[0]).trim()).split("_");
- if (toolsDefTargetNames == null) {
- toolsDefTargetNames = (toolsDefFields[toolsDefTargetNameField]).trim() + " ";
- } else if (!toolsDefTargetNames.contains((toolsDefFields[toolsDefTargetNameField]).trim())) {
- toolsDefTargetNames += (toolsDefFields[toolsDefTargetNameField]).trim() + " ";
- }
- if (toolsDefTagNames == null) {
- toolsDefTagNames = (toolsDefFields[toolsDefTagNameField]).trim() + " ";
- } else if (!toolsDefTagNames.contains((toolsDefFields[toolsDefTagNameField]).trim())) {
- toolsDefTagNames += (toolsDefFields[toolsDefTagNameField]).trim() + " ";
- }
- if (toolsDefArchNames == null) {
- toolsDefArchNames = (toolsDefFields[toolsDefArchNameField]).trim() + " ";
- } else if (!toolsDefArchNames.contains((toolsDefFields[toolsDefArchNameField]).trim())) {
- toolsDefArchNames += (toolsDefFields[toolsDefArchNameField]).trim() + " ";
- }
- }
- lineCounter++;
- }
- reader.close();
- // Only enable Architecture selection based on tool chain installations
- String turnOff = "";
- if (!toolsDefArchNames.contains("EBC"))
- turnOff = "EBC ";
- if (!toolsDefArchNames.contains("PPC"))
- turnOff += "PPC ";
- if (!toolsDefArchNames.contains("IPF"))
- turnOff += "IPF ";
- if (!toolsDefArchNames.contains("X64"))
- turnOff += "X64 ";
- if (!toolsDefArchNames.contains("IA32"))
- turnOff += "X64 ";
- if (!toolsDefArchNames.contains("ARM"))
- turnOff += "ARM ";
- turnOff = turnOff.trim();
- vDisableArchList = stringToVector(turnOff);
-
- if (!toolsDefTargetNames.matches("[A-Z]+")) {
- toolsDefTargetNames = toolsDefTargetNames.replace("* ", "").trim();
- if (Debug)
- System.out.println("tools_def file does not define build targets: '" + toolsDefTargetNames
- + "'");
- buildTargetsExist = false;
- }
- } catch (IOException e) {
- Log.log(toolsConfFile + " Read Error ", e.getMessage());
- e.printStackTrace();
- }
- }
- return buildTargetsExist;
- }
-
- private void readTargetTxtFile() {
- File tFile = new File(targetFile);
-
- if (tFile.exists()) {
- try {
- FileReader fileReader = new FileReader(targetFile);
- BufferedReader reader = new BufferedReader(fileReader);
- targetLineNumberMax = 0;
- String rLine = null;
- while ((rLine = reader.readLine()) != null) {
- targetFileContents[targetLineNumberMax] = rLine;
- if (rLine.startsWith("ACTIVE_PLATFORM")) {
- // Only one active platform is permitted!
- targetLines[activePlatformId] = rLine;
- targetLineNumber[activePlatformId] = targetLineNumberMax;
- }
- if ((rLine.startsWith("TARGET" + " ")) || (rLine.startsWith("TARGET" + "\t"))
- || (rLine.startsWith("TARGET="))) {
- // Handle multiple Target Names
- if (rLine.contains(","))
- targetLines[buildTargetId] = rLine.trim().replaceAll(",", " ");
- else
- targetLines[buildTargetId] = rLine.trim();
- targetLineNumber[buildTargetId] = targetLineNumberMax;
- }
- if (rLine.startsWith("TARGET_ARCH")) {
- // Handle multiple Target Architectures
- if (rLine.contains(","))
- targetLines[targetArchId] = rLine.trim().replaceAll(",", " ");
- else
- targetLines[targetArchId] = rLine.trim();
- targetLineNumber[targetArchId] = targetLineNumberMax;
- }
- if (rLine.startsWith("TOOL_CHAIN_CONF")) {
- // Only one file is permitted
- targetLines[toolDefFileId] = rLine.trim();
- targetLineNumber[toolDefFileId] = targetLineNumberMax;
- }
-
- if (rLine.startsWith("TOOL_CHAIN_TAG")) {
- // Handle multiple Tool TagNames
- if (rLine.contains(","))
- targetLines[tagNameId] = rLine.trim().replaceAll(",", " ");
- else
- targetLines[tagNameId] = rLine.trim();
- targetLineNumber[tagNameId] = targetLineNumberMax;
- }
-
- if (rLine.startsWith("MULTIPLE_THREAD")) {
- // Handle Thread Enable flag
- targetLines[threadEnableId] = rLine.trim();
- targetLineNumber[threadEnableId] = targetLineNumberMax;
- if ((rLine.trim().toLowerCase().contains("enabled")) || (rLine.trim().toLowerCase().contains("true"))) {
- threadEnabled = true;
- } else {
- threadEnabled = false;
- }
- }
-
- if (rLine.startsWith("MAX_CONCURRENT_THREAD_NUMBER")) {
- // Handle Thread Enable flag
- targetLines[threadCountId] = rLine.trim();
- targetLineNumber[threadCountId] = targetLineNumberMax;
- }
- targetLineNumberMax++;
- }
- reader.close();
- String archLine[] = new String[2];
- if (targetLines[targetArchId] != null) {
- if (targetLines[targetArchId].contains("=")) {
- if (targetLines[targetArchId].contains(","))
- targetLines[targetArchId] = targetLines[targetArchId].trim().replaceAll(",", " ");
- if (targetLines[targetArchId].length() > 0)
- archLine = targetLines[targetArchId].trim().split("=");
- vArchList = stringToVector(archLine[1]);
- }
- }
-
- if (targetLines[threadCountId] != null) {
- String tcLine[] = new String[2];
- tcLine = targetLines[threadCountId].trim().split("=");
- threadCount = tcLine[1];
- } else
- threadCount = "";
-
- if (Debug == true)
- for (int i = 0; i <= maxTargetLines; i++)
- System.out.println("targetLines[" + i + "] contains: " + targetLines[i] + " index is: "
- + targetLineNumber[i]);
- } catch (IOException e) {
- Log.log(this.targetFile + " Read Error ", e.getMessage());
- e.printStackTrace();
- }
- }
-
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelToolsConfigFile = new JLabel();
- jLabelToolsConfigFile.setBounds(new java.awt.Rectangle(labelColumn, toolConfigFileRow, labelWidth,
- oneRowHeight));
- jLabelToolsConfigFile.setText("Tool Chain Definition File");
- jLabelActivePlatform = new JLabel();
- jLabelActivePlatform.setText("Select Active Platform");
- jLabelActivePlatform.setBounds(new java.awt.Rectangle(labelColumn, activePlatformRow, labelWidth,
- oneRowHeight));
- jLabelToolChainTagName = new JLabel();
- jLabelToolChainTagName.setBounds(new java.awt.Rectangle(labelColumn, toolChainTagNameRow, labelWidth,
- oneRowHeight));
- jLabelToolChainTagName.setText("Select Tool Tag Name");
- jLabelBuildTarget = new JLabel();
- jLabelBuildTarget.setBounds(new java.awt.Rectangle(labelColumn, buildTargetRow, labelWidth, oneRowHeight));
- jLabelBuildTarget.setText("Select Build Target");
- jLabelTargetArch = new JLabel();
- jLabelTargetArch.setBounds(new java.awt.Rectangle(labelColumn, targetArchRow, labelWidth, oneRowHeight));
- jLabelTargetArch.setText("Build Architectures");
-
- jArchCheckBox = new ArchCheckBox();
- jArchCheckBox.setBounds(new java.awt.Rectangle(valueColumn, targetArchRow, valueWidth, oneRowHeight));
- jArchCheckBox.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));
-
- jLabelEnableThreads = new JLabel();
- jLabelEnableThreads.setBounds(new java.awt.Rectangle(labelColumn, threadRow, labelWidth, oneRowHeight));
- jLabelEnableThreads.setText("Enable Compiler Threading");
-
- jLabelThreadCount = new JLabel();
- jLabelThreadCount.setBounds(new java.awt.Rectangle(valueColumn + 60, threadRow, labelWidth, oneRowHeight));
- jLabelThreadCount.setText("Number of threads to start");
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.setPreferredSize(new java.awt.Dimension(dialogWidth - 10, dialogHeight - 10));
-
- jContentPane.add(jLabelToolsConfigFile, null);
- jContentPane.add(getJTextFieldToolsConfigFile(), null);
- jContentPane.add(getJButtonBrowse(), null);
-
- jContentPane.add(jLabelActivePlatform, null);
- jContentPane.add(getActivePlatform(), null);
-
- jContentPane.add(jLabelToolChainTagName, null);
- jContentPane.add(getJScrollPaneTagName(), null);
-
- jContentPane.add(jLabelBuildTarget, null);
- jContentPane.add(getJScrollPaneBuildTarget(), null);
-
- jContentPane.add(jLabelTargetArch, null);
-
- jArchCheckBox.setDisabledItems(vDisableArchList);
- jArchCheckBox.setSelectedItems(vArchList);
- jContentPane.add(jArchCheckBox, null);
-
- jContentPane.add(jLabelEnableThreads, null);
- jContentPane.add(getCheckBoxEnableThreads(), null);
-
- jContentPane.add(jLabelThreadCount, null);
- jContentPane.add(getTextFieldThreadCount(), null);
-
- jContentPane.add(getJButtonSave(), null);
- jContentPane.add(getJButtonCancel(), null);
- }
- 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() == jButtonBrowse) {
- // TODO: Call file browser, starting in $WORKSPACE/Tools/Conf directory
-
- }
-
- if (arg0.getSource() == jButtonSave) {
- saveTargetFile();
- JOptionPane.showMessageDialog(this, "<html>The target.txt file has been saved!"
- + "<br>A copy of the original file, target.txt.bak has"
- + "<br>also been created.</html>");
- this.exit();
- }
-
- if (arg0.getSource() == jButtonCancel) {
- this.exit();
- }
-
- if (arg0.getSource() == jCheckBoxEnableThreads) {
- if (jCheckBoxEnableThreads.isSelected() == false) {
- threadCount = "";
- jTextFieldThreadCount.setText(threadCount);
- }
- }
- }
-
-
- private void updateActivePlatform() {
- int lineAP;
- if (targetLines[activePlatformId] != null) {
- lineAP = targetLineNumber[activePlatformId];
- } else {
- lineAP = targetLineNumberMax;
- targetLineNumber[activePlatformId] = lineAP;
- targetLineNumberMax++;
- }
- if (jComboBoxActivePlatform.getSelectedItem() == "Do Not Set") {
- targetFileContents[lineAP] = "";
- targetLines[activePlatformId] = "";
- } else {
- targetFileContents[lineAP] = "ACTIVE_PLATFORM = " + jComboBoxActivePlatform.getSelectedItem() + "\r\n";
- targetLines[activePlatformId] = targetFileContents[lineAP];
- }
- if (Debug)
- System.out.println("Active Platform: " + targetFileContents[lineAP]);
- }
-
- private void updateToolDefFile() {
- int lineTDF;
- if (targetLines[toolDefFileId] != null) {
- lineTDF = targetLineNumber[toolDefFileId];
- } else {
- lineTDF = targetLineNumberMax;
- targetLineNumber[toolDefFileId] = lineTDF;
- targetLineNumberMax++;
- }
- if (Debug)
- System.out.println("Tool Config File: " + jTextFieldToolsConfigFile.getText());
- if (jTextFieldToolsConfigFile.getText() == null) {
- targetFileContents[lineTDF] = "#MT#";
- targetLines[toolDefFileId] = "";
- } else {
- targetFileContents[lineTDF] = "TOOL_CHAIN_CONF = " + jTextFieldToolsConfigFile.getText();
- targetLines[toolDefFileId] = targetFileContents[lineTDF];
- }
- }
-
- private void updateToolTagNames() {
- String sTagNames = vectorToString(iCheckBoxListTagName.getAllCheckedItemsString());
- int lineTTN;
-
- if (targetLines[tagNameId] != null) {
- lineTTN = targetLineNumber[tagNameId];
- } else {
- lineTTN = targetLineNumberMax;
- targetLineNumber[tagNameId] = lineTTN;
- targetLineNumberMax++;
- }
-
- if (Debug)
- System.out.println("Tag Name(s): " + sTagNames);
-
- if (sTagNames.length() > 0) {
- targetFileContents[lineTTN] = "TOOL_CHAIN_TAG = " + sTagNames;
- targetLines[tagNameId] = targetFileContents[lineTTN];
- } else {
- targetFileContents[lineTTN] = "#MT#";
- targetLines[tagNameId] = "";
- }
- }
-
- private void updateBuildTargets() {
- String sBuildTargets = vectorToString(iCheckBoxListBuildTarget.getAllCheckedItemsString());
- int lineBT;
-
- if (targetLines[buildTargetId] != null) {
- lineBT = targetLineNumber[buildTargetId];
- } else {
- lineBT = targetLineNumberMax;
- targetLineNumber[buildTargetId] = lineBT;
- targetLineNumberMax++;
- }
- if (Debug)
- System.out.println("Build Target(s): " + sBuildTargets);
- if (sBuildTargets.length() > 0) {
- targetFileContents[lineBT] = "TARGET = " + sBuildTargets;
- targetLines[buildTargetId] = targetFileContents[lineBT];
- } else {
- targetFileContents[lineBT] = "#MT#";
- targetLines[buildTargetId] = "";
- }
-
- }
-
- private void updateArchitectures() {
- String sArchList = jArchCheckBox.getSelectedItemsString().trim();
-
- if (Debug)
- System.out.println("Architectures: " + sArchList);
-
- int lineSA;
- if (targetLines[targetArchId] != null) {
- lineSA = targetLineNumber[targetArchId];
- } else {
- lineSA = targetLineNumberMax;
- targetLineNumber[targetArchId] = lineSA;
- targetLineNumberMax++;
- }
- if (sArchList == "") {
- targetFileContents[lineSA] = "#MT#";
- targetLines[targetArchId] = "";
- } else {
- targetFileContents[lineSA] = "TARGET_ARCH = " + sArchList;
- targetLines[targetArchId] = targetFileContents[lineSA];
- }
-
- }
-
- private void updateEnableThreads() {
- int lineET;
- if (targetLines[threadEnableId] != null) {
- lineET = targetLineNumber[threadEnableId];
- } else {
- lineET = targetLineNumberMax;
- targetLineNumber[threadEnableId] = lineET;
- targetLineNumberMax++;
- }
- if (jCheckBoxEnableThreads.isSelected() == true) {
- targetFileContents[lineET] = "MULTIPLE_THREAD = enabled";
- targetLines[threadEnableId] = targetFileContents[lineET];
- } else {
- targetFileContents[lineET] = "#MT#";
- targetLines[threadEnableId] = "";
- }
- }
-
- private void updateThreadCount() {
- int lineTC;
-
- if (targetLines[threadCountId] != null) {
- lineTC = targetLineNumber[threadCountId];
- } else {
- lineTC = targetLineNumberMax;
- targetLineNumber[threadCountId] = lineTC;
- targetLineNumberMax++;
- }
- if (jCheckBoxEnableThreads.isSelected() == true) {
- // Threading must be enabled
- if (jTextFieldThreadCount.getText().length() > 0) {
- // Thread Count must be greater than 0
- Scanner scan = new Scanner(jTextFieldThreadCount.getText().trim());
- if (scan.nextInt() > 0) {
- targetFileContents[lineTC] = "MAX_CONCURRENT_THREAD_NUMBER = " + jTextFieldThreadCount.getText().trim();
- targetLines[threadCountId] = targetFileContents[lineTC];
- } else {
- Log.wrn("Build Preferences", "Threading Enabled, but thread count is not set, setting to default of 1.");
- targetFileContents[lineTC] = "MAX_CONCURRENT_THREAD_NUMBER = 1";
- targetLines[threadCountId] = "MAX_CONCURRENT_THREAD_NUMBER = 1";
- }
- } else {
- Log.wrn("Build Preferences", "Threading Enabled, but thread count is not set, setting to default of 1.");
- targetFileContents[lineTC] = "MAX_CONCURRENT_THREAD_NUMBER = 1";
- targetLines[threadCountId] = "MAX_CONCURRENT_THREAD_NUMBER = 1";
- }
- } else {
- // Don't track threads if threading is not enabled
- targetFileContents[lineTC] = "#MT#";
- targetLines[threadCountId] = "";
- threadCount = "";
- }
-
- }
- private String vectorToString(Vector<String> v) {
- String s = " ";
- for (int i = 0; i < v.size(); ++i) {
- s += v.get(i);
- s += " ";
- }
- return s.trim();
- }
-
- protected Vector<String> stringToVector(String s) {
- if (s == null) {
- return null;
- }
- String[] sArray = s.split(" ");
- Vector<String> v = new Vector<String>();
- for (int i = 0; i < sArray.length; ++i) {
- v.add(sArray[i]);
- }
- return v;
- }
-
- private void saveTargetFile() {
- updateActivePlatform();
- updateToolDefFile();
- updateToolTagNames();
- updateBuildTargets();
- updateArchitectures();
- updateEnableThreads();
- updateThreadCount();
-
- try {
- copy(targetFile, targetFile + ".bak");
- FileWriter fileWriter = new FileWriter(targetFile);
- BufferedWriter writer = new BufferedWriter(fileWriter);
- for (int i = 0; i < targetLineNumberMax; i++) {
- if (! targetFileContents[i].contains("#MT#"))
- writer.write(targetFileContents[i] + "\n");
- }
- writer.close();
- } catch (IOException e) {
- Log.err(toolsConfFile + " Write Error ", e.getMessage());
- e.printStackTrace();
- }
- }
-
- private void copy(String txtFile, String bakFile) throws IOException {
- File fromFile = new File(txtFile);
- File toFile = new File(bakFile);
- FileInputStream fromTxt = null;
- FileOutputStream toBak = null;
- if (!fromFile.exists()) {
- fromFile.createNewFile();
- }
- try {
- fromTxt = new FileInputStream(fromFile);
- toBak = new FileOutputStream(toFile);
- byte[] buffer = new byte[4096];
- int bytes_read;
- while ((bytes_read = fromTxt.read(buffer)) != -1) {
- toBak.write(buffer, 0, bytes_read);
- }
- } finally {
- if (fromTxt != null)
- try {
- fromTxt.close();
- } catch (IOException e) {
- Log.err(toolsConfFile + " Read Error ", e.getMessage());
-
- }
- if (toBak != null)
- try {
- toBak.close();
- } catch (IOException e) {
- Log.err(toolsConfFile + ".bak Write Error ", e.getMessage());
- }
- }
- }
-
- private void exit() {
- this.setVisible(false);
- if (bTarget != null) {
- bTarget.dispose();
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/ToolChainId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/ToolChainId.java deleted file mode 100644 index 65e20bd665..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/ToolChainId.java +++ /dev/null @@ -1,329 +0,0 @@ -/** @file - - This file is used to init tool chain and tool preference data - Copyright (c) 2006, Intel Corporation - All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - **/ - -package org.tianocore.frameworkwizard.toolchain; - -import java.io.*; -import java.io.File; -import java.lang.Integer; -import java.util.ArrayList; - -import javax.swing.JOptionPane; - -import org.tianocore.frameworkwizard.FrameworkWizardUI; -import org.tianocore.frameworkwizard.common.DataType; -import org.tianocore.frameworkwizard.common.Tools; -import org.tianocore.frameworkwizard.common.Log; -import org.tianocore.frameworkwizard.workspace.Workspace; - -public class ToolChainId { - // - // Define class members - // - - private final boolean Debug = false; - - private String toolDefinitionFile = null; - - private final int toolDefFieldCount = 5; - - private String toolsDefIdentifier = null; - - private String toolsDefTargetNames = null; - - private final int toolsDefTargetNameField = 0; - - private String toolsDefTagNames = null; - - private final int toolsDefTagNameField = 1; - - private String toolsDefArchNames = null; - - private final int toolsDefArchNameField = 2; - - private final int toolsDefToolArgumentField = 4; - - private String toolCommandCodes = null; - - private final int toolsDefCmdCodeArgumentField = 3; - - - private String activePlatform = null; - - private String targetArchs = null; - - private String tagNames = null; - - private String buildTargets = null; - - private String toolFamilies = null; - - private ArrayList<String> toolDefinitionContents = new ArrayList<String>(50); - - private static boolean threadEnabled = false; - - private static int maxThreadCount = 0; - - private String toolsDir = Workspace.getCurrentWorkspace() + System.getProperty("file.separator") + "Tools" - + System.getProperty("file.separator") + "Conf"; - - private String strTargetFile = toolsDir + DataType.FILE_SEPARATOR + "target.txt"; - - private String defaultToolsConf = toolsDir + DataType.FILE_SEPARATOR + "tools_def.txt"; - - public void init() { - readTargetTxtFile(); - readToolDefinitionFile(); - } - - public ToolChainId() { - super(); - init(); - } - - public String getToolDefinitionFile() { - return toolDefinitionFile; - } - - public String getActivePlatform() { - return activePlatform; - } - - public String getBuildTargets() { - return buildTargets; - } - - public String getTagNames() { - return tagNames; - } - - public String getTargetArchitectures() { - return targetArchs; - } - - public boolean getThreadEnabled() { - return threadEnabled; - } - - public int getMaxThreadCount() { - return maxThreadCount; - } - - public String getToolFamilies() { - return toolFamilies; - } - - public String getToolDefinitionIdentifier() { - return toolsDefIdentifier; - } - - public ArrayList<String> getToolDefinitionStatements() { - return toolDefinitionContents; - } - - public String getToolsDefTagNames() { - return toolsDefTagNames; - } - - public String getToolsDefTargetNames() { - return toolsDefTargetNames; - } - - public String getToolsDefCommandCodes() { - return toolCommandCodes; - } - - public String getToolsDefArchNames() { - return toolsDefArchNames; - } - - private void readTargetTxtFile() { - File tFile = new File(strTargetFile); - - if (tFile.exists()) { - try { - FileReader fileReader = new FileReader(strTargetFile); - BufferedReader reader = new BufferedReader(fileReader); - String rLine = null; - String inLine[] = new String[2]; - while ((rLine = reader.readLine()) != null) { - rLine = rLine.trim(); - if ((rLine.startsWith("ACTIVE_PLATFORM")) && (activePlatform == null)) { - // Only one active platform is permitted! - inLine = rLine.split("="); - if (inLine.length > 1) { - activePlatform = inLine[1].trim(); - } - } - if ((rLine.startsWith("TARGET" + " ")) || (rLine.startsWith("TARGET" + "\t")) - || (rLine.startsWith("TARGET="))) { - // Handle multiple Target Names - if (rLine.contains(",")) { - inLine = rLine.split("="); - if (inLine.length > 1) { - buildTargets = inLine[1].trim().replaceAll(",", " "); - } - } else { - inLine = rLine.trim().split("="); - if (inLine.length > 1) { - buildTargets = inLine[1].trim(); - } - } - } - if (rLine.startsWith("TARGET_ARCH")) { - // Handle multiple Target Architectures - if (rLine.contains(",")) { - inLine = rLine.split("="); - if (inLine.length > 1) { - targetArchs = inLine[1].trim().replaceAll(",", " "); - } - } else { - inLine = rLine.split("="); - if (inLine.length > 1) { - targetArchs = inLine[1].trim(); - } - } - } - if (rLine.startsWith("TOOL_CHAIN_CONF")) { - // Only one file is permitted - inLine = rLine.split("="); - if (inLine.length > 1) { - toolDefinitionFile = inLine[1].trim(); - } - } - - if (rLine.startsWith("TOOL_CHAIN_TAG")) { - // Handle multiple Tool TagNames - if (rLine.contains(",")) { - inLine = rLine.split("="); - if (inLine.length > 1) { - tagNames = inLine[1].trim().replaceAll(",", " "); - } - } else { - inLine = rLine.split("="); - if (inLine.length > 1) { - tagNames = inLine[1].trim(); - } - } - } - - if (rLine.startsWith("MULTIPLE_THREAD")) { - // Handle Thread Enable flag - if ((rLine.toLowerCase().contains("enabled")) - || (rLine.toLowerCase().contains("true"))) { - threadEnabled = true; - } else { - threadEnabled = false; - } - } - - if (rLine.startsWith("MAX_CONCURRENT_THREAD_NUMBER")) { - // Handle Thread Enable flag - inLine = rLine.split("="); - if (inLine.length > 1) { - maxThreadCount = Integer.valueOf(inLine[1].trim()); - } - } - } - reader.close(); - } catch (IOException e) { - Log.log(this.strTargetFile + " Read Error ", e.getMessage()); - e.printStackTrace(); - } - } else { - JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "<html>" + "Tool Preferences file: <br>" + strTargetFile - + "<br>does not exist!</html>"); - } - } - - private void readToolDefinitionFile() { - - // Parse the tool definition file looking for targets and architectures - String toolsConfFile = null; - if (toolDefinitionFile != null) { - String resString = (Tools.convertPathToCurrentOsType(toolDefinitionFile)).trim(); - toolsConfFile = Workspace.getCurrentWorkspace() + System.getProperty("file.separator") + resString.trim(); - File toolsDefFile = new File(toolsConfFile); - if (!toolsDefFile.exists()) { - JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "<html>" + "Tool Definition file, " + toolDefinitionFile - + "<br>specified in the target.txt file does not exist!" - + "<br>Using the default Tool Definition File:<br>" - + defaultToolsConf); - toolsConfFile = defaultToolsConf; - } - } else { - toolsConfFile = defaultToolsConf; - } - String[] toolsDefFields = new String[toolDefFieldCount]; - for (int i = 0; i < toolDefFieldCount; i++) - toolsDefFields[i] = null; - File toolDefFile = new File(toolsConfFile); - if (toolDefFile.exists()) { - try { - FileReader fileReader = new FileReader(toolDefFile); - BufferedReader reader = new BufferedReader(fileReader); - String rLine = null; - String result[]; - while ((rLine = reader.readLine()) != null) { - if ((rLine.startsWith("IDENTIFIER")) && (toolsDefIdentifier == null)) { - result = rLine.split("="); - toolsDefIdentifier = (result[1]).trim(); - } else if ((!rLine.startsWith("#")) && (rLine.contains("="))) { - result = rLine.split("="); - toolsDefFields = ((result[0]).trim()).split("_"); - if (toolsDefTargetNames == null) { - toolsDefTargetNames = (toolsDefFields[toolsDefTargetNameField]).toUpperCase().trim() + " "; - } else if (!toolsDefTargetNames.contains((toolsDefFields[toolsDefTargetNameField]).toUpperCase().trim())) { - toolsDefTargetNames += (toolsDefFields[toolsDefTargetNameField]).toUpperCase().trim() + " "; - } - if (toolsDefTagNames == null) { - toolsDefTagNames = (toolsDefFields[toolsDefTagNameField]).toUpperCase().toUpperCase().trim() + " "; - } else if (!toolsDefTagNames.contains((toolsDefFields[toolsDefTagNameField]).toUpperCase().trim())) { - toolsDefTagNames += (toolsDefFields[toolsDefTagNameField]).toUpperCase().trim() + " "; - } - if (toolsDefArchNames == null) { - toolsDefArchNames = (toolsDefFields[toolsDefArchNameField]).toUpperCase().trim() + " "; - } else if (!toolsDefArchNames.contains((toolsDefFields[toolsDefArchNameField]).toUpperCase().trim())) { - toolsDefArchNames += (toolsDefFields[toolsDefArchNameField]).toUpperCase().trim() + " "; - } - if ((toolFamilies == null) && (rLine.trim().contains("FAMILY"))) { - toolFamilies = (toolsDefFields[toolsDefToolArgumentField]).toUpperCase().trim() + " "; - } else if ((rLine.trim().contains("FAMILY")) - && (!toolFamilies.contains((toolsDefFields[toolsDefToolArgumentField]).toUpperCase().trim()))) { - toolFamilies += (toolsDefFields[toolsDefToolArgumentField]).toUpperCase().trim() + " "; - } - if ((toolCommandCodes == null)) { - toolCommandCodes = (toolsDefFields[toolsDefCmdCodeArgumentField]).toUpperCase().trim() + " "; - } else if ((!toolCommandCodes.contains((toolsDefFields[toolsDefCmdCodeArgumentField]).toUpperCase().trim()))) { - toolCommandCodes += (toolsDefFields[toolsDefCmdCodeArgumentField].toUpperCase().trim()) + " "; - } - - toolDefinitionContents.add(rLine.trim().replaceAll(" ", "")); - } - } - reader.close(); - if (!toolsDefTargetNames.matches("[A-Z]+")) { - toolsDefTargetNames = toolsDefTargetNames.replace("* ", "").trim(); - if (Debug) - System.out.println("tools_def file does not define build targets: '" + toolsDefTargetNames - + "'"); - } - } catch (IOException e) { - Log.log(toolsConfFile + " Read Error ", e.getMessage()); - e.printStackTrace(); - } - } - } - -} diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/Workspace.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/Workspace.java deleted file mode 100644 index 580086ff92..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/Workspace.java +++ /dev/null @@ -1,153 +0,0 @@ -/** @file
-
- The file is used to init workspace
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-
-package org.tianocore.frameworkwizard.workspace;
-
-import java.io.File;
-
-import org.tianocore.frameworkwizard.common.DataType;
-
-public class Workspace {
- //
- // Define static return value
- //
- public final static int WORKSPACE_VALID = 0;
-
- public final static int WORKSPACE_NOT_DEFINED = 1;
-
- public final static int WORKSPACE_NOT_EXIST = 2;
-
- public final static int WORKSPACE_NOT_DIRECTORY = 3;
-
- public final static int WORKSPACE_NOT_VALID = 4;
-
- public final static int WORKSPACE_NO_TARGET_FILE = 5;
-
- //
- // Define class members
- //
- private static String currentWorkspace = null;
-
- private static String strWorkspaceDatabaseFile = DataType.FILE_SEPARATOR + "Tools" + DataType.FILE_SEPARATOR
- + "Conf" + DataType.FILE_SEPARATOR + "FrameworkDatabase.db";
-
- private static String targetFile = DataType.FILE_SEPARATOR + "Tools" + DataType.FILE_SEPARATOR + "Conf"
- + DataType.FILE_SEPARATOR + "target.txt";
-
- /**
-
- @param args
-
- **/
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- Get Current Workspace
-
- @return currentWorkspace
-
- */
- public static String getCurrentWorkspace() {
- return currentWorkspace;
- }
-
- /**
- Set Current Workspace
-
- @param currentWorkspace
- The input data of currentWorkspace
-
- */
- public static void setCurrentWorkspace(String currentWorkspace) {
- Workspace.currentWorkspace = currentWorkspace;
- }
-
- /**
- Check if current workspace exists of not
-
- @retval true - The current WORKSPACE exists
- @retval false - The current WORKSPACE doesn't exist
-
- */
- public static int checkCurrentWorkspace() {
- return checkWorkspace(getCurrentWorkspace());
- }
-
- /**
- Check if current workspace exists or not via input workspace path
-
- @param strWorkspace
- The input data of WORKSPACE path
- @retval true - The current WORKSPACE exists
- @retval false - The current WORKSPACE doesn't exist
-
- */
- public static int checkWorkspace(String strWorkspace) {
- //
- // Check if WORKSPACE Environment is defined
- //
- if (strWorkspace == null || strWorkspace == "") {
- return Workspace.WORKSPACE_NOT_DEFINED;
- }
-
- //
- // Check if WORKSPACE Environment exists
- //
- File f = new File(strWorkspace);
- if (!f.exists()) {
- return Workspace.WORKSPACE_NOT_EXIST;
- }
-
- //
- // Check if WORKSPACE Environment is a directory
- //
- if (!f.isDirectory()) {
- return Workspace.WORKSPACE_NOT_DIRECTORY;
- }
-
- //
- // Check if FrameworkDatabase.db exists
- //
- f = new File(strWorkspace + Workspace.getStrWorkspaceDatabaseFile());
- if (!f.exists()) {
- return Workspace.WORKSPACE_NOT_VALID;
- }
-
- //
- // Check if Target.txt exists
- //
- f = new File(strWorkspace + Workspace.getTargetFile());
- if (!f.exists()) {
- return Workspace.WORKSPACE_NO_TARGET_FILE;
- }
-
- return Workspace.WORKSPACE_VALID;
- }
-
- public static String getStrWorkspaceDatabaseFile() {
- return strWorkspaceDatabaseFile;
- }
-
- public static void setStrWorkspaceDatabaseFile(String strWorkspaceDatabaseFile) {
- //Workspace.strWorkspaceDatabaseFile = strWorkspaceDatabaseFile;
- }
-
- public static String getTargetFile() {
- return targetFile;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java deleted file mode 100644 index 9db0fe587e..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java +++ /dev/null @@ -1,958 +0,0 @@ -/** @file
-
- The file is used to init workspace and get basic information of workspace
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.workspace;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-import java.util.Vector;
-
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.DbPathAndFilename;
-import org.tianocore.IndustryStdIncludesDocument.IndustryStdIncludes;
-import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations;
-import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.MsaFilesDocument.MsaFiles;
-import org.tianocore.PackageDependenciesDocument.PackageDependencies;
-import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
-import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
-import org.tianocore.SourceFilesDocument.SourceFiles;
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.GlobalData;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.OpenFile;
-import org.tianocore.frameworkwizard.common.SaveFile;
-import org.tianocore.frameworkwizard.common.Sort;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.Identifications.Identification;
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;
-import org.tianocore.frameworkwizard.far.FarHeader;
-import org.tianocore.frameworkwizard.far.FarIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdIdentification;
-import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdVector;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-public class WorkspaceTools {
-
- public void addFarToDb(List<String> packageList, List<String> platformList, FarHeader far) {
- //FrameworkDatabase fdb = openFrameworkDb();
-
- for (int i = 0; i < packageList.size(); i++) {
- DbPathAndFilename item = DbPathAndFilename.Factory.newInstance();
- item.setFarGuid(far.getGuidValue());
- item.setStringValue(packageList.get(i));
- GlobalData.fdb.getPackageList().getFilenameList().add(item);
- }
-
- for (int i = 0; i < platformList.size(); i++) {
- DbPathAndFilename item = DbPathAndFilename.Factory.newInstance();
- item.setFarGuid(far.getGuidValue());
- item.setStringValue(platformList.get(i));
- GlobalData.fdb.getPlatformList().getFilenameList().add(item);
- }
-
- DbPathAndFilename farItem = DbPathAndFilename.Factory.newInstance();
- farItem.setFarGuid(far.getGuidValue());
- farItem.setStringValue(far.getFarName());
- GlobalData.fdb.getFarList().getFilenameList().add(farItem);
-
- String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();
- strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);
-
- try {
- SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);
- } catch (Exception e) {
- Log.err("Save Database File", e.getMessage());
- }
- }
-
- public void removeFarFromDb(FarIdentification far) {
- //
- // Remove Packages
- //
- XmlCursor cursor = GlobalData.fdb.getPackageList().newCursor();
- cursor.toFirstChild();
- do {
- DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();
-
- if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {
- cursor.removeXml();
- }
- } while (cursor.toNextSibling());
- cursor.dispose();
-
- //
- // Remove Platforms
- //
- cursor = GlobalData.fdb.getPlatformList().newCursor();
- cursor.toFirstChild();
- do {
- DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();
- if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {
- cursor.removeXml();
- }
- } while (cursor.toNextSibling());
-
- //
- // Remove Far
- //
- cursor = GlobalData.fdb.getFarList().newCursor();
- cursor.toFirstChild();
- do {
- DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();
- if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {
- cursor.removeXml();
- }
- } while (cursor.toNextSibling());
- cursor.dispose();
-
- String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();
- strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);
- try {
- SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);
- } catch (Exception e) {
- Log.err("Save Database File", e.getMessage());
- }
- }
-
- public String getPackageFarGuid(Identification packageId) {
- for (int index = 0; index < GlobalData.fdb.getPackageList().getFilenameList().size(); index++) {
- DbPathAndFilename item = GlobalData.fdb.getPackageList().getFilenameArray(index);
- String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();
- File tempFile = new File(path);
- if (tempFile.getPath().equalsIgnoreCase(packageId.getPath())) {
- return GlobalData.fdb.getPackageList().getFilenameArray(index).getFarGuid();
- }
- }
-
- return null;
- }
-
- public String getPlatformFarGuid(Identification platformId) {
- for (int index = 0; index < GlobalData.fdb.getPlatformList().getFilenameList().size(); index++) {
- DbPathAndFilename item = GlobalData.fdb.getPlatformList().getFilenameArray(index);
- String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();
- File tempFile = new File(path);
- if (tempFile.getPath().equalsIgnoreCase(platformId.getPath())) {
- return GlobalData.fdb.getPlatformList().getFilenameArray(index).getFarGuid();
- }
- }
-
- return null;
- }
-
- public String getModuleFarGuid(Identification moduleId) {
- PackageIdentification packageId = getPackageIdByModuleId(moduleId);
- if (packageId != null) {
- return getPackageFarGuid(packageId);
- } else {
- return null;
- }
- }
-
- /**
- Get all modules' paths from one package
-
- @return a Vector with all modules' path
-
- **/
- public Vector<String> getAllModulesOfPackage(String path) {
- Vector<String> modulePath = new Vector<String>();
- PackageIdentification id = new PackageIdentification(null, null, null, path);
- MsaFiles files = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(id).getMsaFiles();
- if (files != null) {
- for (int index = 0; index < files.getFilenameList().size(); index++) {
- String msaPath = files.getFilenameList().get(index);
- msaPath = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + msaPath;
- msaPath = Tools.convertPathToCurrentOsType(msaPath);
- modulePath.addElement(msaPath);
- }
- }
-
- return modulePath;
- }
-
- /**
- Get all Industry Std Includes' paths from one package
-
- @return a Vector with all paths
-
- **/
- public Vector<String> getAllIndustryStdIncludesOfPackage(String path) {
- Vector<String> includePath = new Vector<String>();
- PackageIdentification id = new PackageIdentification(null, null, null, path);
- IndustryStdIncludes files = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(id)
- .getIndustryStdIncludes();
- if (files != null) {
- for (int index = 0; index < files.getIndustryStdHeaderList().size(); index++) {
- String temp = files.getIndustryStdHeaderList().get(index).getIncludeHeader();
- temp = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + temp;
- temp = Tools.convertPathToCurrentOsType(temp);
- includePath.addElement(temp);
- }
- }
- return includePath;
- }
-
- /**
- Get all package basic information form the FrameworkDatabase.db file
-
- @return vPackageList A vector includes all packages' basic information
-
- */
- public Vector<PackageIdentification> getAllPackages() {
- return GlobalData.vPackageList;
- }
-
- /**
- Get all package which match parameter isRepackagable
-
- @param isRepackagable
- @return
-
- **/
- public Vector<PackageIdentification> getAllRepackagablePackages() {
- Vector<PackageIdentification> v = new Vector<PackageIdentification>();
- for (int index = 0; index < GlobalData.openingPackageList.size(); index++) {
- OpeningPackageType opt = GlobalData.openingPackageList.getOpeningPackageByIndex(index);
- if (opt.getXmlSpd() != null) {
- if (opt.getXmlSpd().getPackageDefinitions() != null) {
- if (opt.getXmlSpd().getPackageDefinitions().getRePackage()) {
- v.addElement(opt.getId());
- }
- } else {
- v.addElement(opt.getId());
- }
- } else {
- v.addElement(opt.getId());
- }
- }
- return v;
- }
-
- public Vector<FarIdentification> getAllFars() {
-
- Vector<FarIdentification> v = new Vector<FarIdentification>();
- for (int index = 0; index < GlobalData.fdb.getFarList().getFilenameList().size(); index++) {
- DbPathAndFilename item = GlobalData.fdb.getFarList().getFilenameList().get(index);
- FarIdentification far = new FarIdentification(item.getFarGuid(), item.getMd5Sum(), item.getStringValue());
- v.addElement(far);
- }
- return v;
- }
-
- public Vector<PackageIdentification> getPackagesByFar(FarIdentification far) {
- Identification id = null;
-
- Vector<PackageIdentification> v = new Vector<PackageIdentification>();
-
- for (int index = 0; index < GlobalData.fdb.getPackageList().getFilenameList().size(); index++) {
- DbPathAndFilename item = GlobalData.fdb.getPackageList().getFilenameArray(index);
- String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();
- path = Tools.convertPathToCurrentOsType(path);
-
- if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {
-
- try {
- id = Tools.getId(path, OpenFile.openSpdFile(path));
- v.addElement(new PackageIdentification(id));
- } catch (IOException e) {
- Log.err("Open Package Surface Area " + path, e.getMessage());
- } catch (XmlException e) {
- Log.err("Open Package Surface Area " + path, e.getMessage());
- } catch (Exception e) {
- Log.err("Open Package Surface Area " + path, "Invalid file type");
- }
- }
- }
- return v;
- }
-
- public Vector<PlatformIdentification> getPlatformsByFar(FarIdentification far) {
- Identification id = null;
-
- Vector<PlatformIdentification> v = new Vector<PlatformIdentification>();
-
- for (int index = 0; index < GlobalData.fdb.getPlatformList().getFilenameList().size(); index++) {
- DbPathAndFilename item = GlobalData.fdb.getPlatformList().getFilenameArray(index);
- String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();
- path = Tools.convertPathToCurrentOsType(path);
-
- if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {
- try {
- id = Tools.getId(path, OpenFile.openFpdFile(path));
- v.addElement(new PlatformIdentification(id));
- } catch (IOException e) {
- Log.err("Open Platform Surface Area " + path, e.getMessage());
- } catch (XmlException e) {
- Log.err("Open Platform Surface Area " + path, e.getMessage());
- } catch (Exception e) {
- Log.err("Open Platform Surface Area " + path, "Invalid file type");
- }
- }
- }
- return v;
- }
-
- /**
- Get all module basic information from a package
-
- @param id Package id
- @return A vector includes all modules' basic information
-
- **/
- public Vector<ModuleIdentification> getAllModules(PackageIdentification pid) {
- Vector<ModuleIdentification> v = new Vector<ModuleIdentification>();
- Vector<String> modulePaths = this.getAllModulesOfPackage(pid.getPath());
- String modulePath = null;
-
- for (int index = 0; index < modulePaths.size(); index++) {
- modulePath = modulePaths.get(index);
- ModuleIdentification id = GlobalData.openingModuleList.getIdByPath(modulePath);
- if (id != null) {
- v.addElement(id);
- }
- }
- Sort.sortModules(v, DataType.SORT_TYPE_ASCENDING);
- return v;
- }
-
- /**
- Get all module basic information from a platform
-
- @param id Package id
- @return A vector includes all modules' basic information
-
- **/
- public Vector<ModuleIdentification> getAllModules(PlatformIdentification fid) {
- Vector<ModuleIdentification> v = new Vector<ModuleIdentification>();
- PlatformSurfaceArea fpd = GlobalData.openingPlatformList.getOpeningPlatformById(fid).getXmlFpd();
- if (fpd.getFrameworkModules() != null) {
- for (int index = 0; index < fpd.getFrameworkModules().getModuleSAList().size(); index++) {
- String guid = fpd.getFrameworkModules().getModuleSAList().get(index).getModuleGuid();
- String version = fpd.getFrameworkModules().getModuleSAList().get(index).getModuleVersion();
- ModuleIdentification id = GlobalData.openingModuleList.getIdByGuidVersion(guid, version);
- if (id != null) {
- boolean isFind = false;
- for (int indexOfModules = 0; indexOfModules < v.size(); indexOfModules++) {
- if (v.elementAt(indexOfModules).equals(id)) {
- isFind = true;
- break;
- }
- }
- if (!isFind) {
- v.addElement(id);
- }
- }
- }
- }
- Sort.sortModules(v, DataType.SORT_TYPE_ASCENDING);
- return v;
- }
-
- /**
- Get all module basic information form the FrameworkDatabase.db file
-
- @return vModuleList A vector includes all modules' basic information
-
- */
- public Vector<ModuleIdentification> getAllModules() {
- return GlobalData.vModuleList;
- }
-
- /**
- Get all platform basic information form the FrameworkDatabase.db file
-
- @return vplatformList A vector includes all platforms' basic information
-
- */
- public Vector<PlatformIdentification> getAllPlatforms() {
- return GlobalData.vPlatformList;
- }
-
- /**
- Get all Library Class Definitions from a package
-
- @return Vector
- **/
- public Vector<String> getAllLibraryClassDefinitionsFromPackage(PackageSurfaceArea spd) {
- Vector<String> vector = new Vector<String>();
- if (spd.getLibraryClassDeclarations() != null) {
- if (spd.getLibraryClassDeclarations().getLibraryClassList().size() > 0) {
- for (int index = 0; index < spd.getLibraryClassDeclarations().getLibraryClassList().size(); index++) {
- vector.addElement(spd.getLibraryClassDeclarations().getLibraryClassList().get(index).getName());
- }
- }
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- /**
- Get all Protocol Definitions from a package
-
- @return Vector
- **/
- public Vector<String> getAllProtocolDeclarationsFromPackage(PackageSurfaceArea spd) {
- Vector<String> vector = new Vector<String>();
- if (spd.getProtocolDeclarations() != null) {
- if (spd.getProtocolDeclarations().getEntryList().size() > 0) {
- for (int index = 0; index < spd.getProtocolDeclarations().getEntryList().size(); index++) {
- vector.addElement(spd.getProtocolDeclarations().getEntryList().get(index).getCName());
- }
- }
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- /**
- Get all Ppi Definitions from a package
-
- @return Vector
- **/
- public Vector<String> getAllPpiDeclarationsFromPackage(PackageSurfaceArea spd) {
- Vector<String> vector = new Vector<String>();
- if (spd.getPpiDeclarations() != null) {
- if (spd.getPpiDeclarations().getEntryList().size() > 0) {
- for (int index = 0; index < spd.getPpiDeclarations().getEntryList().size(); index++) {
- vector.addElement(spd.getPpiDeclarations().getEntryList().get(index).getCName());
- }
- }
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- /**
- Get all Guid Definitions from a package
-
- @return Vector
- **/
- public Vector<String> getAllGuidDeclarationsFromPackage(PackageSurfaceArea spd, String type) {
- Vector<String> vector = new Vector<String>();
- boolean isFound = false;
- if (spd.getGuidDeclarations() != null) {
- if (spd.getGuidDeclarations().getEntryList().size() > 0) {
- for (int index = 0; index < spd.getGuidDeclarations().getEntryList().size(); index++) {
- Vector<String> vArch = Tools.convertListToVector(spd.getGuidDeclarations().getEntryList()
- .get(index).getGuidTypeList());
- for (int indexOfArch = 0; indexOfArch < vArch.size(); indexOfArch++) {
- if (vArch.get(indexOfArch).equals(type)) {
- isFound = true;
- break;
- }
- }
- if ((isFound) || (vArch == null) || (vArch.size() < 1)) {
- vector.addElement(spd.getGuidDeclarations().getEntryList().get(index).getCName());
- isFound = false;
- }
- }
- }
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- /**
- Get all Pcd Definitions from a package
-
- @return Vector
- **/
- public PcdVector getAllPcdDeclarationsFromPackage(PackageSurfaceArea spd) {
- PcdVector vector = new PcdVector();
- if (spd.getPcdDeclarations() != null) {
- if (spd.getPcdDeclarations().getPcdEntryList().size() > 0) {
- for (int index = 0; index < spd.getPcdDeclarations().getPcdEntryList().size(); index++) {
- String name = spd.getPcdDeclarations().getPcdEntryList().get(index).getCName();
- String guidCName = spd.getPcdDeclarations().getPcdEntryList().get(index).getTokenSpaceGuidCName();
- String help = spd.getPcdDeclarations().getPcdEntryList().get(index).getHelpText();
- Vector<String> type = Tools.convertListToVector(spd.getPcdDeclarations().getPcdEntryList()
- .get(index).getValidUsage());
- //
- // The algorithm for PCD of msa should be:
- // 1. If the type of PCD from Spd is FEATURE_FLAG,
- // the type of Msa only can be FEATURE_FLAG.
- // 2. If the type of PCD from Spd is not FEATURE_FLAG,
- // the type of Msa could be selected from the PCD's all types and "DYNAMIC" type.
- //
- boolean hasFEATURE_FLAG = false;
- boolean hasDYNAMIC = false;
- for (int indexOfType = 0; indexOfType < type.size(); indexOfType++) {
- if (type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_DYNAMIC)) {
- hasDYNAMIC = true;
- }
- if (type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_FEATURE_FLAG)) {
- hasFEATURE_FLAG = true;
- }
- }
- if (hasFEATURE_FLAG) {
- type.removeAllElements();
- type.addElement(DataType.PCD_ITEM_TYPE_FEATURE_FLAG);
- } else {
- if (!hasDYNAMIC) {
- type.addElement(DataType.PCD_ITEM_TYPE_DYNAMIC);
- }
- }
- vector.addPcd(new PcdIdentification(name, guidCName, help, type));
- }
- }
- }
- Sort.sortPcds(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public Vector<String> getAllLibraryClassDefinitionsFromWorkspace() {
- Vector<String> vector = new Vector<String>();
- for (int index = 0; index < GlobalData.vPackageList.size(); index++) {
- Vector<String> v = getAllLibraryClassDefinitionsFromPackage(GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(GlobalData.vPackageList
- .get(index)));
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
-
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public Vector<String> getAllLibraryClassDefinitionsFromPackages(Vector<PackageIdentification> vpid) {
- Vector<String> vector = new Vector<String>();
- for (int index = 0; index < vpid.size(); index++) {
- Vector<String> v = getAllLibraryClassDefinitionsFromPackage(GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(vpid
- .get(index)));
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
-
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public Vector<String> getAllProtocolDeclarationsFromWorkspace() {
- Vector<String> vector = new Vector<String>();
- for (int index = 0; index < GlobalData.vPackageList.size(); index++) {
- Vector<String> v = getAllProtocolDeclarationsFromPackage(GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(GlobalData.vPackageList
- .get(index)));
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public Vector<String> getAllProtocolDeclarationsFromPackages(Vector<PackageIdentification> vpid) {
- Vector<String> vector = new Vector<String>();
- for (int index = 0; index < vpid.size(); index++) {
- Vector<String> v = getAllProtocolDeclarationsFromPackage(GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(vpid
- .get(index)));
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public Vector<String> getAllPpiDeclarationsFromWorkspace() {
- Vector<String> vector = new Vector<String>();
- for (int index = 0; index < GlobalData.vPackageList.size(); index++) {
- Vector<String> v = getAllPpiDeclarationsFromPackage(GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(GlobalData.vPackageList
- .get(index)));
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public Vector<String> getAllPpiDeclarationsFromPackages(Vector<PackageIdentification> vpid) {
- Vector<String> vector = new Vector<String>();
- for (int index = 0; index < vpid.size(); index++) {
- Vector<String> v = getAllPpiDeclarationsFromPackage(GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(vpid
- .get(index)));
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public Vector<String> getAllGuidDeclarationsFromWorkspace(String type) {
- Vector<String> vector = new Vector<String>();
- for (int index = 0; index < GlobalData.vPackageList.size(); index++) {
- Vector<String> v = getAllGuidDeclarationsFromPackage(
- GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(GlobalData.vPackageList
- .get(index)),
- type);
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
-
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public Vector<String> getAllGuidDeclarationsFromPackages(Vector<PackageIdentification> vpid, String type) {
- Vector<String> vector = new Vector<String>();
- for (int index = 0; index < vpid.size(); index++) {
- Vector<String> v = getAllGuidDeclarationsFromPackage(
- GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(vpid
- .get(index)),
- type);
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
-
- }
- Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public PcdVector getAllPcdDeclarationsFromWorkspace() {
- PcdVector vector = new PcdVector();
- for (int index = 0; index < GlobalData.openingPackageList.size(); index++) {
- PcdVector v = getAllPcdDeclarationsFromPackage(GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(GlobalData.vPackageList
- .get(index)));
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
-
- }
- Sort.sortPcds(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- public PcdVector getAllPcdDeclarationsFromPackages(Vector<PackageIdentification> vpid) {
- PcdVector vector = new PcdVector();
- for (int index = 0; index < vpid.size(); index++) {
- PcdVector v = getAllPcdDeclarationsFromPackage(GlobalData.openingPackageList
- .getPackageSurfaceAreaFromId(vpid
- .get(index)));
- if (v != null && v.size() > 0) {
- vector.addAll(v);
- }
-
- }
- Sort.sortPcds(vector, DataType.SORT_TYPE_ASCENDING);
- return vector;
- }
-
- /**
- Find a module's package's id
-
- @param id input module id
- @return package id
-
- **/
- public PackageIdentification getPackageIdByModuleId(Identification id) {
- Vector<String> modulePaths = new Vector<String>();
- Identification mid = null;
- String packagePath = null;
- String modulePath = null;
-
- //
- // For each package, get all modules list
- //
- for (int indexI = 0; indexI < GlobalData.vPackageList.size(); indexI++) {
- packagePath = GlobalData.vPackageList.elementAt(indexI).getPath();
- modulePaths = this.getAllModulesOfPackage(packagePath);
- for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {
- modulePath = modulePaths.get(indexJ);
- mid = GlobalData.openingModuleList.getIdByPath(modulePath);
- //
- // Check id
- //
- if (mid != null) {
- if (mid.equals(id)) {
- return GlobalData.vPackageList.elementAt(indexI);
- }
- }
- }
- }
-
- return null;
- }
-
- /**
- Add module information to package surface area
-
- @param mid
- @throws IOException
- @throws XmlException
- @throws Exception
-
- **/
- public void addModuleToPackage(ModuleIdentification mid, PackageSurfaceArea spd) throws IOException, XmlException,
- Exception {
- String packagePath = mid.getPackageId().getPath();
- String modulePath = mid.getPath();
- if (spd == null) {
- spd = OpenFile.openSpdFile(packagePath);
- }
- MsaFiles msaFile = spd.getMsaFiles();
- if (msaFile == null) {
- msaFile = MsaFiles.Factory.newInstance();
- }
- packagePath = packagePath.substring(0, packagePath.lastIndexOf(DataType.FILE_SEPARATOR));
- String fn = Tools.getRelativePath(modulePath, packagePath);
- msaFile.addNewFilename();
- msaFile.setFilenameArray(msaFile.getFilenameList().size() - 1, fn);
- spd.setMsaFiles(msaFile);
- SaveFile.saveSpdFile(mid.getPackageId().getPath(), spd);
- //
- // Update GlobalData
- //
- GlobalData.openingPackageList.getPackageSurfaceAreaFromId(mid.getPackageId()).setMsaFiles(msaFile);
- }
-
- /**
- Add input package into database
-
- @param id
- * @throws Exception
-
- **/
- public void addPackageToDatabase(PackageIdentification id) throws Exception {
- String path = id.getPath();
- path = Tools.getRelativePath(path, Workspace.getCurrentWorkspace());
-
- DbPathAndFilename filename = DbPathAndFilename.Factory.newInstance();
- filename.setStringValue(path);
- GlobalData.fdb.getPackageList().addNewFilename();
- GlobalData.fdb.getPackageList().setFilenameArray(GlobalData.fdb.getPackageList().sizeOfFilenameArray() - 1,
- filename);
- String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();
- strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);
- SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);
- }
-
- /**
- Add input package into database
-
- @param id
- * @throws Exception
-
- **/
- public void addPlatformToDatabase(PlatformIdentification id) throws Exception {
- String path = id.getPath();
- path = Tools.getRelativePath(path, Workspace.getCurrentWorkspace());
-
- DbPathAndFilename filename = DbPathAndFilename.Factory.newInstance();
- filename.setStringValue(path);
- GlobalData.fdb.getPlatformList().addNewFilename();
- GlobalData.fdb.getPlatformList().setFilenameArray(GlobalData.fdb.getPlatformList().sizeOfFilenameArray() - 1,
- filename);
- String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();
- strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);
- SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);
- }
-
- /**
- Get all file's path from one module
-
- @param path
- @return
- @throws IOException
- @throws XmlException
- @throws Exception
-
- **/
- public Vector<String> getAllFilesPathOfModule(String path) {
- Vector<String> v = new Vector<String>();
- path = Tools.convertPathToCurrentOsType(path);
-
- //
- // First add msa file's path
- //
- v.addElement(path);
-
- ModuleSurfaceArea msa = GlobalData.openingModuleList
- .getModuleSurfaceAreaFromId(GlobalData.openingModuleList
- .getIdByPath(path));
- //
- // Get common defined files of module
- //
- if (msa != null) {
- //
- // Get all files' path of a module
- //
- SourceFiles sf = msa.getSourceFiles();
- if (sf != null) {
- for (int index = 0; index < sf.getFilenameList().size(); index++) {
- String temp = sf.getFilenameList().get(index).getStringValue();
- temp = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + temp;
- v.addElement(Tools.convertPathToCurrentOsType(temp));
- }
- }
- }
-
- //
- // Get include header files for this module
- //
- if (msa.getLibraryClassDefinitions() != null) {
- LibraryClassDefinitions lcd = msa.getLibraryClassDefinitions();
- for (int index = 0; index < lcd.sizeOfLibraryClassArray(); index++) {
- if (lcd.getLibraryClassList().get(index).getUsage().toString()
- .equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
- || lcd.getLibraryClassList().get(index).getUsage().toString()
- .equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
- //
- // Get library class name
- //
- String name = lcd.getLibraryClassList().get(index).getKeyword();
-
- //
- // Find file path for this class
- //
- PackageIdentification pid = GlobalData.openingModuleList.getIdByPath(path).getPackageId();
- PackageSurfaceArea spd = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(pid);
- String headerFile = getHeaderFileFromPackageByLibraryClassName(spd, name);
- if (!Tools.isEmpty(headerFile)) {
- v.addElement(Tools.convertPathToCurrentOsType(Tools.getFilePathOnly(pid.getPath())
- + DataType.FILE_SEPARATOR + headerFile));
- }
- }
- }
- }
-
- return v;
- }
-
- /**
- Get all file's path from one package
-
- @param path
- @return
- @throws IOException
- @throws XmlException
- @throws Exception
-
- **/
- public Vector<String> getAllFilesPathOfPakcage(String path) {
- Vector<String> v = new Vector<String>();
- path = Tools.convertPathToCurrentOsType(path);
- //
- // First add package
- //
- v.addElement(path);
-
- //
- // Add the package's industry std includes one by one
- //
- Vector<String> f1 = new Vector<String>();
- f1 = getAllIndustryStdIncludesOfPackage(path);
- for (int index = 0; index < f1.size(); index++) {
- v.addElement(f1.get(index));
- }
-
- //
- // Add module's files one by one
- //
- f1 = new Vector<String>();
- f1 = getAllModulesOfPackage(path);
- for (int indexI = 0; indexI < f1.size(); indexI++) {
- Vector<String> f2 = getAllFilesPathOfModule(f1.get(indexI));
- for (int indexJ = 0; indexJ < f2.size(); indexJ++) {
- v.addElement(f2.get(indexJ));
- }
- }
-
- return v;
- }
-
- /**
- Get a module's all package dependencies
-
- @param mid The module id
- @return A vector of all package dependency ids
-
- **/
- public Vector<PackageIdentification> getPackageDependenciesOfModule(ModuleIdentification mid) {
- Vector<PackageIdentification> vpid = new Vector<PackageIdentification>();
- ModuleSurfaceArea msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(mid);
- if (msa != null) {
- PackageDependencies pd = msa.getPackageDependencies();
- if (pd != null) {
- for (int index = 0; index < pd.getPackageList().size(); index++) {
- String guid = pd.getPackageList().get(index).getPackageGuid();
- String version = pd.getPackageList().get(index).getPackageVersion();
- PackageIdentification pid = GlobalData.openingPackageList.getIdByGuidVersion(guid, version);
- if (pid != null) {
- vpid.addElement(pid);
- }
- }
- }
- }
- return vpid;
- }
-
- public Vector<String> getAllModuleGuidXref() {
- Vector<String> v = new Vector<String>();
- for (int index = 0; index < GlobalData.openingModuleList.size(); index++) {
- ModuleIdentification id = GlobalData.openingModuleList.getOpeningModuleByIndex(index).getId();
- v.addElement(id.getGuid() + " " + id.getName());
- }
- return v;
- }
-
- public Vector<String> getModuleArch(ModuleIdentification id) {
- Vector<String> v = new Vector<String>();
- ModuleSurfaceArea msa = null;
- if (id != null) {
- msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(id);
- }
- if (msa != null) {
- if (msa.getModuleDefinitions() != null) {
- v = Tools.convertListToVector(msa.getModuleDefinitions().getSupportedArchitectures());
- }
- }
- return v;
- }
-
- public String getHeaderFileFromPackageByLibraryClassName(PackageSurfaceArea spd, String name) {
- String headerFile = "";
- if (spd != null) {
- if (spd.getLibraryClassDeclarations() != null) {
- LibraryClassDeclarations lcdl = spd.getLibraryClassDeclarations();
- for (int indexOfLibOfSpd = 0; indexOfLibOfSpd < lcdl.sizeOfLibraryClassArray(); indexOfLibOfSpd++) {
- if (lcdl.getLibraryClassList().get(indexOfLibOfSpd).getName().equals(name)) {
- return lcdl.getLibraryClassList().get(indexOfLibOfSpd).getIncludeHeader();
- }
- }
- }
- }
-
- return headerFile;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/ui/SwitchWorkspace.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/ui/SwitchWorkspace.java deleted file mode 100644 index e5f28c56c4..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/ui/SwitchWorkspace.java +++ /dev/null @@ -1,217 +0,0 @@ -package org.tianocore.frameworkwizard.workspace.ui;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-public class SwitchWorkspace extends IDialog {
-
- ///
- /// Define class Serial Version UID
- ///
- private static final long serialVersionUID = 2184556370155608202L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- private JLabel jLabel = null;
-
- private JLabel jLabel1 = null;
-
- private JTextField jTextFieldOld = null;
-
- private JTextField jTextFieldNew = null;
-
- private JButton jButtonOk = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonBrowse = null;
-
- /**
- * This method initializes jTextFieldOld
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldOld() {
- if (jTextFieldOld == null) {
- jTextFieldOld = new JTextField();
- jTextFieldOld.setBounds(new java.awt.Rectangle(140, 10, 320, 20));
- jTextFieldOld.setEditable(false);
- jTextFieldOld.setText(Workspace.getCurrentWorkspace() == null ? "Not Defined"
- : Workspace.getCurrentWorkspace());
- }
- return jTextFieldOld;
- }
-
- /**
- * This method initializes jTextFieldNew
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldNew() {
- if (jTextFieldNew == null) {
- jTextFieldNew = new JTextField();
- jTextFieldNew.setBounds(new java.awt.Rectangle(140, 35, 220, 20));
- }
- return jTextFieldNew;
- }
-
- /**
- * This method initializes jButtonOk
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonOk() {
- if (jButtonOk == null) {
- jButtonOk = new JButton();
- jButtonOk.setBounds(new java.awt.Rectangle(290, 70, 80, 20));
- jButtonOk.setText("Ok");
- jButtonOk.addActionListener(this);
- }
- 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(380, 70, 80, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonBrowse
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonBrowse() {
- if (jButtonBrowse == null) {
- jButtonBrowse = new JButton();
- jButtonBrowse.setBounds(new java.awt.Rectangle(370, 35, 90, 20));
- jButtonBrowse.setText("Browse");
- jButtonBrowse.addActionListener(this);
- }
- return jButtonBrowse;
- }
-
- /**
- * This is the default constructor
- *
- */
- public SwitchWorkspace() {
- super();
- initialize();
- }
-
- /**
- * This is the override constructor
- *
- */
- public SwitchWorkspace(IFrame parentFrame, boolean modal) {
- super(parentFrame, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(472, 132);
- this.setContentPane(getJContentPane());
- this.setTitle("Select workspace");
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel1 = new JLabel();
- jLabel1.setBounds(new java.awt.Rectangle(15, 10, 120, 20));
- jLabel1.setText("Current Workspace");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(15, 35, 120, 20));
- jLabel.setText("Change to ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(jLabel, null);
- jContentPane.add(jLabel1, null);
- jContentPane.add(getJTextFieldOld(), null);
- jContentPane.add(getJTextFieldNew(), null);
- jContentPane.add(getJButtonOk(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonBrowse(), null);
- }
- return jContentPane;
- }
-
- private boolean check() {
- if (isEmpty(this.jTextFieldNew.getText())) {
- Log.wrn("Switch Workspace", "New workspace must be entered!");
- return false;
- }
- if (Workspace.checkWorkspace(this.jTextFieldNew.getText()) != Workspace.WORKSPACE_VALID) {
- Log.wrn("Switch Workspace", "Please select a valid workspace!");
- return false;
- }
- return true;
- }
-
- /* (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() == jButtonCancel) {
- this.setVisible(false);
- returnType = DataType.RETURN_TYPE_CANCEL;
- }
-
- if (arg0.getSource() == jButtonOk) {
- if (!check()) {
- return;
- } else {
- Workspace.setCurrentWorkspace(this.jTextFieldNew.getText());
- returnType = DataType.RETURN_TYPE_OK;
- this.setVisible(false);
- }
- }
-
- if (arg0.getSource() == jButtonBrowse) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
- fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- int result = fc.showOpenDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- this.jTextFieldNew.setText(Tools.convertPathToCurrentOsType(fc.getSelectedFile().getPath()));
- }
- }
- }
-}
|