From 8f4f211c8db9a1421c351fb237b6f8eee5967ac1 Mon Sep 17 00:00:00 2001 From: hche10x Date: Fri, 7 Jul 2006 08:10:20 +0000 Subject: [PATCH] 1. Fix displaying wrong file type bug. 2. Fix a typo bug in Tool Chain Config frame. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@819 6f19259b-4bc3-4df7-8a09-765794883524 --- .../frameworkwizard/FrameworkWizardUI.java | 19 +++++---- .../frameworkwizard/NewFileChooser.java | 4 +- .../frameworkwizard/SelectModuleBelong.java | 2 +- .../frameworkwizard/ToolChainConfig.java | 41 +++++++++++++++---- .../frameworkwizard/ToolChainConfigHelp.java | 15 +++++-- .../frameworkwizard/common/ui/IFrame.java | 26 +++++++++++- 6 files changed, 85 insertions(+), 22 deletions(-) diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java index af4c2a6fc5..c6f5b57973 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java @@ -293,6 +293,15 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele //private JToolBar jToolBarEdit = null; //private JToolBar jToolBarWindow = null; + + private static FrameworkWizardUI fwui = null; + + public static FrameworkWizardUI getInstance() { + if (fwui == null) { + fwui = new FrameworkWizardUI(); + } + return fwui; + } /** This method initializes jMenuBar @@ -1648,7 +1657,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele * */ public static void main(String[] args) { - FrameworkWizardUI module = new FrameworkWizardUI(); + FrameworkWizardUI module = FrameworkWizardUI.getInstance(); module.setVisible(true); } @@ -2885,12 +2894,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele **/ private void setupToolChainConfiguration() { - ToolChainConfig tcc = new ToolChainConfig(this, true); - int result = tcc.showDialog(); - - if (result == DataType.RETURN_TYPE_CANCEL) { - tcc.dispose(); - } + ToolChainConfig tcc = ToolChainConfig.getInstance(); + tcc.showDialog(); } /** diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/NewFileChooser.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/NewFileChooser.java index 9924d56a3a..18cbdb8a8b 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/NewFileChooser.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/NewFileChooser.java @@ -134,7 +134,7 @@ public class NewFileChooser extends IDialog { private JRadioButton getJRadioButtonPlatform() { if (jRadioButtonPlatform == null) { jRadioButtonPlatform = new JRadioButton(); - jRadioButtonPlatform.setText(DataType.PACKAGE_SURFACE_AREA); + jRadioButtonPlatform.setText(DataType.PLATFORM_SURFACE_AREA); jRadioButtonPlatform.setBounds(new java.awt.Rectangle(20, 80, 240, 20)); } return jRadioButtonPlatform; @@ -171,7 +171,7 @@ public class NewFileChooser extends IDialog { private void init() { this.setSize(310, 220); this.setContentPane(getJContentPane()); - this.setTitle("New Framework File"); + this.setTitle("Select New File Type"); this.centerWindow(); } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SelectModuleBelong.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SelectModuleBelong.java index 6b1731dc0e..7392e373ed 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SelectModuleBelong.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/SelectModuleBelong.java @@ -271,7 +271,7 @@ public class SelectModuleBelong extends IDialog { private void init() { this.setSize(500, 200); this.setContentPane(getJContentPane()); - this.setTitle("New Module"); + this.setTitle("New"); this.centerWindow(); } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfig.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfig.java index 8d0055a403..a859339d54 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfig.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfig.java @@ -15,6 +15,7 @@ package org.tianocore.frameworkwizard; import java.awt.event.ActionEvent; +import java.awt.event.WindowEvent; import java.io.File; import java.io.IOException; @@ -38,11 +39,10 @@ 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.IDialog; import org.tianocore.frameworkwizard.common.ui.IFrame; import org.tianocore.frameworkwizard.workspace.Workspace; -public class ToolChainConfig extends IDialog implements ListSelectionListener, TableModelListener{ +public class ToolChainConfig extends IFrame implements ListSelectionListener, TableModelListener{ /// /// Define Class Members @@ -86,6 +86,10 @@ public class ToolChainConfig extends IDialog implements ListSelectionListener, T private JButton jButtonHelp = null; + private static ToolChainConfig tcc = null; + + private ToolChainConfigHelp tcch = null; + /** This method initializes jScrollPane @@ -260,12 +264,19 @@ public class ToolChainConfig extends IDialog implements ListSelectionListener, T // TODO Auto-generated method stub } + + public static ToolChainConfig getInstance() { + if (tcc == null) { + tcc = new ToolChainConfig(); + } + return tcc; + } /** * This is the default constructor */ - public ToolChainConfig(IFrame parentFrame, boolean modal) { - super(parentFrame, modal); + public ToolChainConfig() { + super(); init(); } @@ -337,8 +348,7 @@ public class ToolChainConfig extends IDialog implements ListSelectionListener, T */ public void actionPerformed(ActionEvent arg0) { if (arg0.getSource() == jButtonClose) { - this.setVisible(false); - this.returnType = DataType.RETURN_TYPE_CANCEL; + this.exit(); } if (arg0.getSource() == jButtonOpen) { @@ -400,7 +410,7 @@ public class ToolChainConfig extends IDialog implements ListSelectionListener, T } if (arg0.getSource() == jButtonHelp) { - ToolChainConfigHelp tcch = new ToolChainConfigHelp(); + tcch = ToolChainConfigHelp.getInstance(); tcch.setVisible(true); } } @@ -477,4 +487,21 @@ public class ToolChainConfig extends IDialog implements ListSelectionListener, T 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/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfigHelp.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfigHelp.java index e6bbe16fa6..5d23469c5a 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfigHelp.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfigHelp.java @@ -25,6 +25,8 @@ public class ToolChainConfigHelp extends JFrame implements ActionListener { private JTextPane jTextPane = null; private JButton jButtonClose = null; + + private static ToolChainConfigHelp tcch = null; /** * This method initializes jTextPane @@ -38,7 +40,7 @@ public class ToolChainConfigHelp extends JFrame implements ActionListener { jTextPane.setBackground(new java.awt.Color(238,238,238)); jTextPane.setEditable(false); helpContent = helpContent - + "The coding forthe Property is: TARGET_TAGNAME_ARCH_COMMAND_ATTR" + DataType.UNIX_LINE_SEPARATOR + + "The coding for the Property is: TARGET_TAGNAME_ARCH_COMMAND_ATTR" + DataType.UNIX_LINE_SEPARATOR + "The Value, is either afull path, full path and filename or a reserved word." + DataType.UNIX_LINE_SEPARATOR + DataType.UNIX_LINE_SEPARATOR + DataType.UNIX_LINE_SEPARATOR @@ -57,7 +59,6 @@ public class ToolChainConfigHelp extends JFrame implements ActionListener { + "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; @@ -78,6 +79,13 @@ public class ToolChainConfigHelp extends JFrame implements ActionListener { return jButtonClose; } + public static ToolChainConfigHelp getInstance() { + if (tcch == null) { + tcch = new ToolChainConfigHelp(); + } + return tcch; + } + /** @param args @@ -103,6 +111,7 @@ public class ToolChainConfigHelp extends JFrame implements ActionListener { */ private void initialize() { this.setSize(625, 520); + this.setResizable(false); this.setTitle("How to Setup Tool Chain Configuration"); this.setContentPane(getJContentPane()); } @@ -126,7 +135,5 @@ public class ToolChainConfigHelp extends JFrame implements ActionListener { if (arg0.getSource() == jButtonClose) { this.dispose(); } - } - } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IFrame.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IFrame.java index 4778133a41..d0222e9574 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IFrame.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IFrame.java @@ -48,7 +48,7 @@ public class IFrame extends JFrame implements ActionListener, WindowListener { // 1 - Whne editing module // private int intExitType = 0; - + /** Main class, used for test @@ -214,4 +214,28 @@ public class IFrame extends JFrame implements ActionListener, WindowListener { public int showSaveDialog() { return JOptionPane.showConfirmDialog(null, "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) { + if (strValue.length() > 0) { + return false; + } + return true; + } + + /** + Display the dialog + + **/ + public void showDialog() { + this.setVisible(true); + } }