From 43dc3851cf49c09acba2224a3bd9b4c96931e526 Mon Sep 17 00:00:00 2001 From: hche10x Date: Thu, 3 Aug 2006 08:07:13 +0000 Subject: [PATCH] 1. Fix bug for wrong Variable name in msa file 2. Release cursor after saving files. 3. Adjust some file's coding style. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1183 6f19259b-4bc3-4df7-8a09-765794883524 --- .../org/tianocore/frameworkwizard/About.java | 13 +- .../org/tianocore/frameworkwizard/Clone.java | 307 ++++++++---- .../frameworkwizard/FrameworkWizardUI.java | 465 +++++++++--------- .../frameworkwizard/common/DataType.java | 5 + .../common/DataValidation.java | 2 +- .../frameworkwizard/common/SaveFile.java | 4 + .../frameworkwizard/common/Tools.java | 108 ++-- .../module/ui/ModuleVariables.java | 4 +- .../module/ui/dialog/VariablesDlg.java | 7 - 9 files changed, 542 insertions(+), 373 deletions(-) diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/About.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/About.java index fe97d8ac68..95c06b8200 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/About.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/About.java @@ -35,13 +35,13 @@ import javax.swing.ImageIcon; public class About extends IDialog { /// - /// Define class Serial Version UID + /// Define Class Serial Version UID /// private static final long serialVersionUID = 2958136136667310962L; - // - //Define class members - // + /// + /// Define Class Members + /// private JPanel jContentPane = null; private JLabel jLabel = null; @@ -70,11 +70,6 @@ public class About extends IDialog { return jButtonOK; } - public static void main(String[] args) { - About a = new About(); - a.setVisible(true); - } - /** This is the default constructor diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java index 9253793ca9..3d8c267484 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java @@ -51,14 +51,21 @@ 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 members - - **/ + /// + /// Define Class Serial Version UID + /// private static final long serialVersionUID = -5469299324965727137L; + /// + /// Define Class Members + /// private JPanel jContentPane = null; private JLabel jLabelType = null; @@ -93,16 +100,20 @@ public class Clone extends IDialog { private JButton jButtonGenerateGuid = null; + private JLabel jLabelBelong = null; + + private JComboBox jComboBoxExistingPackage = null; + + /// + /// Define members not for UI + /// + private int mode = -1; private Vector packages = null; private WorkspaceTools wt = new WorkspaceTools(); - private JLabel jLabelBelong = null; - - private JComboBox jComboBoxExistingPackage = null; - private Identification oldId = null; private Identification newId = null; @@ -114,10 +125,11 @@ public class Clone extends IDialog { private PlatformIdentification fid = null; /** - * This method initializes jTextFieldType - * - * @return javax.swing.JTextField - */ + This method initializes jTextFieldType + + @return javax.swing.JTextField + + **/ private JTextField getJTextFieldType() { if (jTextFieldType == null) { jTextFieldType = new JTextField(); @@ -128,10 +140,11 @@ public class Clone extends IDialog { } /** - * This method initializes jTextFieldSource - * - * @return javax.swing.JTextField - */ + This method initializes jTextFieldSource + + @return javax.swing.JTextField + + **/ private JTextField getJTextFieldSource() { if (jTextFieldSource == null) { jTextFieldSource = new JTextField(); @@ -142,10 +155,11 @@ public class Clone extends IDialog { } /** - * This method initializes jButtonBrowse - * - * @return javax.swing.JButton - */ + This method initializes jButtonBrowse + + @return javax.swing.JButton + + **/ private JButton getJButtonBrowse() { if (jButtonBrowse == null) { jButtonBrowse = new JButton(); @@ -157,10 +171,11 @@ public class Clone extends IDialog { } /** - * This method initializes jTextFieldDestinationFile - * - * @return javax.swing.JTextField - */ + This method initializes jTextFieldDestinationFile + + @return javax.swing.JTextField + + **/ private JTextField getJTextFieldFilePath() { if (jTextFieldFilePath == null) { jTextFieldFilePath = new JTextField(); @@ -170,10 +185,11 @@ public class Clone extends IDialog { } /** - * This method initializes jTextFieldBaseName - * - * @return javax.swing.JTextField - */ + This method initializes jTextFieldBaseName + + @return javax.swing.JTextField + + **/ private JTextField getJTextFieldBaseName() { if (jTextFieldBaseName == null) { jTextFieldBaseName = new JTextField(); @@ -183,10 +199,11 @@ public class Clone extends IDialog { } /** - * This method initializes jTextFieldGuid - * - * @return javax.swing.JTextField - */ + This method initializes jTextFieldGuid + + @return javax.swing.JTextField + + **/ private JTextField getJTextFieldGuid() { if (jTextFieldGuid == null) { jTextFieldGuid = new JTextField(); @@ -196,10 +213,11 @@ public class Clone extends IDialog { } /** - * This method initializes jTextFieldVersion - * - * @return javax.swing.JTextField - */ + This method initializes jTextFieldVersion + + @return javax.swing.JTextField + + **/ private JTextField getJTextFieldVersion() { if (jTextFieldVersion == null) { jTextFieldVersion = new JTextField(); @@ -209,10 +227,11 @@ public class Clone extends IDialog { } /** - * This method initializes jButtonOk - * - * @return javax.swing.JButton - */ + This method initializes jButtonOk + + @return javax.swing.JButton + + **/ private JButton getJButtonOk() { if (jButtonOk == null) { jButtonOk = new JButton(); @@ -224,10 +243,11 @@ public class Clone extends IDialog { } /** - * This method initializes jButtonCancel - * - * @return javax.swing.JButton - */ + This method initializes jButtonCancel + + @return javax.swing.JButton + + **/ private JButton getJButtonCancel() { if (jButtonCancel == null) { jButtonCancel = new JButton(); @@ -239,10 +259,11 @@ public class Clone extends IDialog { } /** - * This method initializes jButtonGenerateGuid - * - * @return javax.swing.JButton - */ + This method initializes jButtonGenerateGuid + + @return javax.swing.JButton + + **/ private JButton getJButtonGenerateGuid() { if (jButtonGenerateGuid == null) { jButtonGenerateGuid = new JButton(); @@ -254,10 +275,11 @@ public class Clone extends IDialog { } /** - * This method initializes jComboBoxExistingPackage - * - * @return javax.swing.JComboBox - */ + This method initializes jComboBoxExistingPackage + + @return javax.swing.JComboBox + + **/ private JComboBox getJComboBoxExistingPackage() { if (jComboBoxExistingPackage == null) { jComboBoxExistingPackage = new JComboBox(); @@ -267,24 +289,21 @@ public class Clone extends IDialog { } /** - - @param args + This is the default constructor **/ - public static void main(String[] args) { - - } - - /** - * This is the default constructor - */ public Clone() { super(); init(); } /** - This is the default constructor + 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) { @@ -311,10 +330,9 @@ public class Clone extends IDialog { } /** - * This method initializes this - * - * @return void - */ + This method initializes this + + **/ private void init() { this.setSize(550, 260); this.setContentPane(getJContentPane()); @@ -323,12 +341,17 @@ public class Clone extends IDialog { } /** - * This method initializes this - * - * @return void - */ + 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(); @@ -341,6 +364,9 @@ public class Clone extends IDialog { 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(); @@ -353,6 +379,9 @@ public class Clone extends IDialog { this.jTextFieldFilePath.setSize(320, this.jTextFieldFilePath.getSize().height); this.jLabelDestinationFile.setText("New Package Path and Filename"); } + // + // For PLATFORM_SURFACE_AREA + // if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) { this.jTextFieldType.setText(DataType.PLATFORM_SURFACE_AREA); this.jTextFieldSource.setText(oldId.getPath()); @@ -362,6 +391,9 @@ public class Clone extends IDialog { .setToolTipText("Select platform path here. For example, C:\\MyWorkspace\\EdkNt32Pkg\\Nt32.fpd"); 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()); @@ -380,10 +412,11 @@ public class Clone extends IDialog { } /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel - */ + This method initializes jContentPane + + @return javax.swing.JPanel + + **/ private JPanel getJContentPane() { if (jContentPane == null) { jLabelBelong = new JLabel(); @@ -446,6 +479,9 @@ public class Clone extends IDialog { if (arg0.getSource() == jButtonOk) { if (this.check()) { try { + // + // Save to file + // this.save(); } catch (IOException e) { Log.wrn("Clone", e.getMessage()); @@ -471,7 +507,7 @@ public class Clone extends IDialog { } // - // Use different file ext + // Use different file ext for different clone target type // if (arg0.getSource() == this.jButtonBrowse) { JFileChooser fc = new JFileChooser(); @@ -501,9 +537,14 @@ public class Clone extends IDialog { } } - // - // Check name, guid and version - // + /** + 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() { // // Check Basename @@ -555,7 +596,8 @@ public class Clone extends IDialog { /** Check before save - @return + @retval true All check points are passed + @retval false Any one of check points is failed **/ private boolean check() { @@ -598,10 +640,6 @@ public class Clone extends IDialog { // Check for Module // if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) { - // if (trg.indexOf(DataType.DOS_FILE_SEPARATOR) == -1 && trg.indexOf(DataType.UNIX_FILE_SEPARATOR) == -1) { - // Log.err("The module name must include a path"); - // return false; - // } trg = this.getModulePath(); if (src.equals(trg)) { Log.wrn("Clone", "The source and destination couldn't be same"); @@ -655,6 +693,14 @@ public class Clone extends IDialog { 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(); @@ -703,7 +749,7 @@ public class Clone extends IDialog { msa.getMsaHeader().setVersion(newId.getVersion()); // - // Update Cloned From element + // Update Section // updateModuleClonedId(msa, oldId); @@ -743,6 +789,9 @@ public class Clone extends IDialog { newId.setPath(trg); vFiles = wt.getAllPakcageFilesPath(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); @@ -750,16 +799,6 @@ public class Clone extends IDialog { FileOperation.copyFile(oldFile, newFile); } - // - // First copy all files to new directory - // - //FileOperation.copyFolder(Tools.getFilePathOnly(src), Tools.getFilePathOnly(trg)); - - // - // Delete old spd file - // - //FileOperation.delFile(Tools.getFilePathOnly(trg) + DataType.FILE_SEPARATOR + Tools.getFileNameOnly(src)); - // // Create new spd file // @@ -774,7 +813,7 @@ public class Clone extends IDialog { spd.getSpdHeader().setVersion(newId.getVersion()); // - // Update Cloned From element + // Update Section // updatePackageClonedId(spd, oldId); @@ -835,10 +874,23 @@ public class Clone extends IDialog { 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); @@ -847,6 +899,13 @@ public class Clone extends IDialog { 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); @@ -856,11 +915,11 @@ public class Clone extends IDialog { } /** - Set target item's Cloned From element - - @param id - @return - + Set msa file's section via given identification + + @param msa ModuleSurfaceArea for clone target + @param id Identification of clone source + **/ private void updateModuleClonedId(ModuleSurfaceArea msa, Identification id) { // @@ -914,10 +973,10 @@ public class Clone extends IDialog { } /** - Set target item's Cloned From element + Set spd file's section via given identification - @param id - @return + @param spd PackageSurfaceArea for clone target + @param id Identification of clone source **/ private void updatePackageClonedId(PackageSurfaceArea spd, Identification id) { @@ -970,10 +1029,10 @@ public class Clone extends IDialog { } /** - Set target item's Cloned From element + Set fpd file's section via given identification - @param id - @return + @param fpd PlatformSurfaceArea for clone target + @param id Identification of clone source **/ private void updatePlatformClonedId(PlatformSurfaceArea fpd, Identification id) { @@ -1025,26 +1084,62 @@ public class Clone extends IDialog { 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/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java index 3c960b4699..e916dbcd7f 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java @@ -108,8 +108,8 @@ import org.tianocore.frameworkwizard.workspace.WorkspaceTools; import org.tianocore.frameworkwizard.workspace.ui.SwitchWorkspace; /** - The class is used to show main GUI of ModuleEditor - It extends IFrame implements MouseListener, TreeSelectionListener + 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 MouseListener, TreeSelectionListener, ComponentListener, @@ -119,9 +119,9 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele /// private static final long serialVersionUID = -7103240960573031772L; - // - // To save information of all files - // + /// + /// Used to save information of all files + /// private Vector vModuleList = new Vector(); private Vector vPackageList = new Vector(); @@ -140,6 +140,9 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele private int currentOpeningPlatformIndex = -1; + /// + /// Used to generate tree structure + /// private IDefaultMutableTreeNode dmtnRoot = null; private IDefaultMutableTreeNode dmtnModuleDescription = null; @@ -148,6 +151,9 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele private IDefaultMutableTreeNode dmtnPlatformDescription = null; + /// + /// Used for UI + /// private JPanel jContentPane = null; private JMenuBar jMenuBar = null; @@ -292,16 +298,19 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele private JMenuItem jMenuItemProjectRemoveFar = null; - //private JToolBar jToolBarFile = null; - - //private JToolBar jToolBarEdit = null; - - //private JToolBar jToolBarWindow = null; + private JMenuItem jMenuItemProjectCreateFar = null; + /// + /// A static definition for this class itself + /// private static FrameworkWizardUI fwui = null; - private JMenuItem jMenuItemProjectCreateFar = null; - + /** + If the class hasn't an instnace, new one. + + @return FrameworkWizardUI The instance of this class + + **/ public static FrameworkWizardUI getInstance() { if (fwui == null) { fwui = new FrameworkWizardUI(); @@ -351,7 +360,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JTabbedPane - */ + **/ private JTabbedPane getJTabbedPaneEditor() { if (jTabbedPaneEditor == null) { jTabbedPaneEditor = new JTabbedPane(); @@ -363,7 +372,6 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele .setMinimumSize(new java.awt.Dimension( DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH, DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT)); - //jTabbedPaneEditor.addChangeListener(this); jTabbedPaneEditor.addTab("Module", null, getJDesktopPaneModule(), null); jTabbedPaneEditor.addTab("Package", null, getJDesktopPanePackage(), null); jTabbedPaneEditor.addTab("Platform", null, getJDesktopPanePlatform(), null); @@ -376,7 +384,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JTabbedPane - */ + **/ private JTabbedPane getJTabbedPaneTree() { if (jTabbedPaneTree == null) { jTabbedPaneTree = new JTabbedPane(); @@ -400,29 +408,35 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele **/ 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.addSeparator(); jMenuFile.add(getJMenuItemFileSave()); jMenuFile.add(getJMenuItemFileSaveAs()); jMenuFile.add(getJMenuItemFileSaveAll()); jMenuFile.addSeparator(); + jMenuFile.add(getJMenuItemFilePageSetup()); jMenuFile.add(getJMenuItemFilePrint()); - //jMenuFile.addSeparator(); jMenuFile.add(getJMenuItemFileImport()); - //jMenuFile.addSeparator(); jMenuFile.add(getJMenuItemFileProperties()); - //jMenuFile.addSeparator(); + jMenuFile.add(getJMenuItemFileExit()); - jMenuFile.addMenuListener(this); } return jMenuFile; } @@ -469,22 +483,31 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele **/ private JMenu getJMenuEdit() { if (jMenuEdit == null) { + // + // Set jMenuEdit's attributes + // jMenuEdit = new JMenu(); jMenuEdit.setText("Edit"); jMenuEdit.setMnemonic('E'); + jMenuEdit.setVisible(false); + + // + // 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(getJMenuItemEditFind()); jMenuEdit.add(getJMenuItemEditFindNext()); jMenuEdit.addSeparator(); - jMenuEdit.setVisible(false); } return jMenuEdit; } @@ -571,7 +594,6 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele private JScrollPane getJScrollPaneTree() { if (jScrollPaneTree == null) { jScrollPaneTree = new JScrollPane(); - //jScrollPaneTree.setBounds(new java.awt.Rectangle(0, 1, 290, 545)); jScrollPaneTree .setPreferredSize(new java.awt.Dimension( DataType.MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH, @@ -607,12 +629,19 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele **/ private JMenu getJMenuHelp() { if (jMenuHelp == null) { + // + // Set jMenuHelp's attributes + // jMenuHelp = new JMenu(); jMenuHelp.setText("Help"); + + // + // Add sub menu items + // jMenuHelp.add(getJMenuItemHelpContents()); jMenuHelp.add(getJMenuItemHelpIndex()); jMenuHelp.add(getJMenuItemHelpSearch()); - //jMenuHelp.addSeparator(); + jMenuHelp.add(getJMenuItemHelpAbout()); } return jMenuHelp; @@ -646,82 +675,13 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele jMenuItemEditDelete.setMnemonic('D'); jMenuItemEditDelete.addActionListener(this); // - //Disabled when no module is open + //Disabled first when no module is open // jMenuItemEditDelete.setEnabled(false); } return jMenuItemEditDelete; } - // /** - // This method initializes jPopupMenu - // - // @return javax.swing.JPopupMenu jPopupMenu - // - // **/ - // private JPopupMenu getJPopupMenu() { - // if (jPopupMenu == null) { - // jPopupMenu = new JPopupMenu(); - // // - // //Add menu items of popup menu - // // - // jPopupMenu.add(getJMenuItemPopupAdd()); - // jPopupMenu.add(getJMenuItemPopupUpdate()); - // jPopupMenu.add(getJMenuItemPopupDelete()); - // jPopupMenu.setBorder(new BevelBorder(BevelBorder.RAISED)); - // jPopupMenu.addMouseListener(this); - // } - // return jPopupMenu; - // } - // - // /** - // This method initializes jMenuItemPopupAdd - // - // @return javax.swing.JMenuItem jMenuItemPopupAdd - // - // **/ - // private JMenuItem getJMenuItemPopupAdd() { - // if (jMenuItemPopupAdd == null) { - // jMenuItemPopupAdd = new JMenuItem(); - // jMenuItemPopupAdd.setText("Add"); - // jMenuItemPopupAdd.addActionListener(this); - // jMenuItemPopupAdd.setEnabled(false); - // } - // return jMenuItemPopupAdd; - // } - // - // /** - // This method initializes jMenuItemPopupUpdate - // - // @return javax.swing.JMenuItem jMenuItemPopupUpdate - // - // **/ - // private JMenuItem getJMenuItemPopupUpdate() { - // if (jMenuItemPopupUpdate == null) { - // jMenuItemPopupUpdate = new JMenuItem(); - // jMenuItemPopupUpdate.setText("Update"); - // jMenuItemPopupUpdate.addActionListener(this); - // jMenuItemPopupUpdate.setEnabled(false); - // } - // return jMenuItemPopupUpdate; - // } - // - // /** - // This method initializes jMenuItemPopupDelete - // - // @return javax.swing.JMenuItem jMenuItemPopupDelete - // - // **/ - // private JMenuItem getJMenuItemPopupDelete() { - // if (jMenuItemPopupDelete == null) { - // jMenuItemPopupDelete = new JMenuItem(); - // jMenuItemPopupDelete.setText("Delete"); - // jMenuItemPopupDelete.addActionListener(this); - // jMenuItemPopupDelete.setEnabled(false); - // } - // return jMenuItemPopupDelete; - // } - /** This method initializes jMenuFileNew @@ -781,15 +741,22 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele **/ 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(getJMenuItemToolsToolChainConfiguration()); jMenuTools.addSeparator(); + jMenuTools.add(getJMenuItemToolsClone()); - //jMenuTools.addSeparator(); jMenuTools.add(getJMenuItemToolsCodeScan()); - jMenuTools.addMenuListener(this); } return jMenuTools; } @@ -803,25 +770,36 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele **/ 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()); - jMenuWindow.setVisible(false); } return jMenuWindow; } /** - This method initializes jPanelOperation + This method initializes jPanelOperation + Reserved @return javax.swing.JPanel jPanelOperation @@ -839,7 +817,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele } /** - This method initializes jButtonOk + This method initializes jButtonOk + Reserved @return javax.swing.JButton jButtonOk @@ -856,7 +835,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele } /** - This method initializes jButtonCancel + This method initializes jButtonCancel + Reserved @return javax.swing.JButton jButtonCancel @@ -877,7 +857,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele This method initializes jMenuItemFileOpen @return javax.swing.JMenuItem jMenuItemFileOpen - */ + + **/ private JMenuItem getJMenuItemFileOpen() { if (jMenuItemFileOpen == null) { jMenuItemFileOpen = new JMenuItem(); @@ -892,7 +873,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele This method initializes jMenuItemFileCloseAll @return javax.swing.JMenuItem jMenuItemFileOpen - */ + + **/ private JMenuItem getJMenuItemFileCloseAll() { if (jMenuItemFileCloseAll == null) { jMenuItemFileCloseAll = new JMenuItem(); @@ -907,7 +889,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele This method initializes jMenuItemFileSaveAll @return javax.swing.JMenuItem jMenuItemFileSaveAll - */ + + **/ private JMenuItem getJMenuItemFileSaveAll() { if (jMenuItemFileSaveAll == null) { jMenuItemFileSaveAll = new JMenuItem(); @@ -923,7 +906,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele This method initializes jMenuItemFilePageSetup @return javax.swing.JMenuItem - */ + + **/ private JMenuItem getJMenuItemFilePageSetup() { if (jMenuItemFilePageSetup == null) { jMenuItemFilePageSetup = new JMenuItem(); @@ -940,7 +924,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele This method initializes jMenuItemFilePrint @return javax.swing.JMenuItem - */ + + **/ private JMenuItem getJMenuItemFilePrint() { if (jMenuItemFilePrint == null) { jMenuItemFilePrint = new JMenuItem(); @@ -957,7 +942,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele This method initializes jMenuItemFileImport @return javax.swing.JMenuItem - */ + + **/ private JMenuItem getJMenuItemFileImport() { if (jMenuItemFileImport == null) { jMenuItemFileImport = new JMenuItem(); @@ -971,10 +957,11 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele } /** - * This method initializes jMenuItemFileProperties - * - * @return javax.swing.JMenuItem - */ + This method initializes jMenuItemFileProperties + + @return javax.swing.JMenuItem + + **/ private JMenuItem getJMenuItemFileProperties() { if (jMenuItemFileProperties == null) { jMenuItemFileProperties = new JMenuItem(); @@ -988,10 +975,11 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele } /** - * This method initializes jMenuFileRecentFiles - * - * @return javax.swing.JMenu - */ + This method initializes jMenuFileRecentFiles + + @return javax.swing.JMenu + + **/ private JMenu getJMenuFileRecentFiles() { if (jMenuFileRecentFiles == null) { jMenuFileRecentFiles = new JMenu(); @@ -1007,8 +995,9 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele /** This method initializes jMenuItemEditUndo - @return javax.swing.JMenuItem - */ + @return javax.swing.JMenuItem + + **/ private JMenuItem getJMenuItemEditUndo() { if (jMenuItemEditUndo == null) { jMenuItemEditUndo = new JMenuItem(); @@ -1024,7 +1013,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele This method initializes jMenuItemEditRedo @return javax.swing.JMenuItem - */ + + **/ private JMenuItem getJMenuItemEditRedo() { if (jMenuItemEditRedo == null) { jMenuItemEditRedo = new JMenuItem(); @@ -1040,7 +1030,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele This method initializes jMenuItemEditCut @return javax.swing.JMenuItem - */ + + **/ private JMenuItem getJMenuItemEditCut() { if (jMenuItemEditCut == null) { jMenuItemEditCut = new JMenuItem(); @@ -1056,7 +1047,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele This method initializes jMenuItemEditCopy @return javax.swing.JMenuItem - */ + + **/ private JMenuItem getJMenuItemEditCopy() { if (jMenuItemEditCopy == null) { jMenuItemEditCopy = new JMenuItem(); @@ -1072,7 +1064,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele This method initializes jMenuItemEditPaste return javax.swing.JMenuItem - */ + + **/ private JMenuItem getJMenuItemEditPaste() { if (jMenuItemEditPaste == null) { jMenuItemEditPaste = new JMenuItem(); @@ -1088,7 +1081,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele This method initializes jMenuItem @return javax.swing.JMenuItem - */ + + **/ private JMenuItem getJMenuItemEditSelectAll() { if (jMenuItemEditSelectAll == null) { jMenuItemEditSelectAll = new JMenuItem(); @@ -1104,7 +1098,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele This method initializes jMenuItemEditFind @return javax.swing.JMenuItem - */ + + **/ private JMenuItem getJMenuItemEditFind() { if (jMenuItemEditFind == null) { jMenuItemEditFind = new JMenuItem(); @@ -1121,7 +1116,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JMenuItem - */ + **/ private JMenuItem getJMenuItemEditFindNext() { if (jMenuItemEditFindNext == null) { jMenuItemEditFindNext = new JMenuItem(); @@ -1138,17 +1133,24 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @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()); - jMenuView.setVisible(false); } return jMenuView; } @@ -1158,12 +1160,13 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @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()); @@ -1176,7 +1179,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JCheckBoxMenuItem - */ + **/ private JCheckBoxMenuItem getJCheckBoxMenuItemViewToolbarsFile() { if (jCheckBoxMenuItemViewToolbarsFile == null) { jCheckBoxMenuItemViewToolbarsFile = new JCheckBoxMenuItem(); @@ -1192,7 +1195,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JCheckBoxMenuItem - */ + **/ private JCheckBoxMenuItem getJCheckBoxMenuItemViewToolbarsEdit() { if (jCheckBoxMenuItemViewToolbarsEdit == null) { jCheckBoxMenuItemViewToolbarsEdit = new JCheckBoxMenuItem(); @@ -1208,7 +1211,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JCheckBoxMenuItem - */ + **/ private JCheckBoxMenuItem getJCheckBoxMenuItemViewToolbarsWindow() { if (jCheckBoxMenuItemViewToolbarsWindow == null) { jCheckBoxMenuItemViewToolbarsWindow = new JCheckBoxMenuItem(); @@ -1224,7 +1227,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JMenuItem - */ + **/ private JMenuItem getJMenuItemViewStandard() { if (jMenuItemViewStandard == null) { jMenuItemViewStandard = new JMenuItem(); @@ -1241,7 +1244,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JMenuItem - */ + **/ private JMenuItem getJMenuItemViewAdvanced() { if (jMenuItemViewAdvanced == null) { jMenuItemViewAdvanced = new JMenuItem(); @@ -1258,21 +1261,29 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @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.addSeparator(); + jMenuProject.add(getJMenuItemProjectChangeWorkspace()); jMenuProject.addSeparator(); + jMenuProject.add(getJMenuItemProjectCreateFar()); jMenuProject.add(getJMenuItemProjectInstallFar()); jMenuProject.add(getJMenuItemProjectUpdateFar()); jMenuProject.add(getJMenuItemProjectRemoveFar()); - //jMenuProject.addSeparator(); + jMenuProject.add(getJMenuProjectBuildTargets()); } return jMenuProject; @@ -1283,7 +1294,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JMenuItem - */ + **/ private JMenuItem getJMenuItemProjectAdmin() { if (jMenuItemProjectAdmin == null) { jMenuItemProjectAdmin = new JMenuItem(); @@ -1301,7 +1312,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JMenuItem - */ + **/ private JMenuItem getJMenuItemProjectChangeWorkspace() { if (jMenuItemProjectChangeWorkspace == null) { jMenuItemProjectChangeWorkspace = new JMenuItem(); @@ -1318,15 +1329,16 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JMenu - */ + **/ private JMenu getJMenuProjectBuildTargets() { if (jMenuProjectBuildTargets == null) { jMenuProjectBuildTargets = new JMenu(); jMenuProjectBuildTargets.setText("Build Targets"); jMenuProjectBuildTargets.setMnemonic('T'); + jMenuProjectBuildTargets.setVisible(false); + jMenuProjectBuildTargets.add(getJCheckBoxMenuItemProjectBuildTargetsDebug()); jMenuProjectBuildTargets.add(getJCheckBoxMenuItemProjectBuildTargetsRelease()); - jMenuProjectBuildTargets.setVisible(false); } return jMenuProjectBuildTargets; } @@ -1336,7 +1348,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JCheckBoxMenuItem - */ + **/ private JCheckBoxMenuItem getJCheckBoxMenuItemProjectBuildTargetsDebug() { if (jCheckBoxMenuItemProjectBuildTargetsDebug == null) { jCheckBoxMenuItemProjectBuildTargetsDebug = new JCheckBoxMenuItem(); @@ -1351,7 +1363,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JCheckBoxMenuItem - */ + **/ private JCheckBoxMenuItem getJCheckBoxMenuItemProjectBuildTargetsRelease() { if (jCheckBoxMenuItemProjectBuildTargetsRelease == null) { jCheckBoxMenuItemProjectBuildTargetsRelease = new JCheckBoxMenuItem(); @@ -1366,7 +1378,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JMenuItem - */ + **/ private JMenuItem getJMenuItemToolsToolChainConfiguration() { if (jMenuItemToolsToolChainConfiguration == null) { jMenuItemToolsToolChainConfiguration = new JMenuItem(); @@ -1382,7 +1394,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JMenuItem - */ + **/ private JMenuItem getJMenuItemToolsClone() { if (jMenuItemToolsClone == null) { jMenuItemToolsClone = new JMenuItem(); @@ -1399,7 +1411,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JMenuItem - */ + **/ private JMenuItem getJMenuItemToolsCodeScan() { if (jMenuItemToolsCodeScan == null) { jMenuItemToolsCodeScan = new JMenuItem(); @@ -1417,7 +1429,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JMenuItem - */ + **/ private JMenuItem getJMenuItemWindowDisplaySide() { if (jMenuItemWindowDisplaySide == null) { jMenuItemWindowDisplaySide = new JMenuItem(); @@ -1434,7 +1446,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JMenuItem - */ + **/ private JMenuItem getJMenuItemWindowDisplayTopBottom() { if (jMenuItemWindowDisplayTopBottom == null) { jMenuItemWindowDisplayTopBottom = new JMenuItem(); @@ -1451,7 +1463,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JMenuItem - */ + **/ private JMenuItem getJMenuItemViewXML() { if (jMenuItemViewXML == null) { jMenuItemViewXML = new JMenuItem(); @@ -1468,7 +1480,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JMenuItem - */ + **/ private JMenuItem getJMenuItemWindowTabView() { if (jMenuItemWindowTabView == null) { jMenuItemWindowTabView = new JMenuItem(); @@ -1485,7 +1497,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JMenuItem - */ + **/ private JMenuItem getJMenuItemWindowSource() { if (jMenuItemWindowSource == null) { jMenuItemWindowSource = new JMenuItem(); @@ -1502,7 +1514,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JMenuItem - */ + **/ private JMenuItem getJMenuItemWindowXML() { if (jMenuItemWindowXML == null) { jMenuItemWindowXML = new JMenuItem(); @@ -1519,7 +1531,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JMenuItem - */ + **/ private JMenuItem getJMenuItemWindowPreferences() { if (jMenuItemWindowPreferences == null) { jMenuItemWindowPreferences = new JMenuItem(); @@ -1536,7 +1548,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JMenuItem - */ + **/ private JMenuItem getJMenuItemHelpContents() { if (jMenuItemHelpContents == null) { jMenuItemHelpContents = new JMenuItem(); @@ -1554,7 +1566,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele @return javax.swing.JMenuItem - */ + **/ private JMenuItem getJMenuItemHelpIndex() { if (jMenuItemHelpIndex == null) { jMenuItemHelpIndex = new JMenuItem(); @@ -1585,30 +1597,6 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele return jMenuItemHelpSearch; } - /** - * This method initializes jToolBar - * - * @return javax.swing.JToolBar - */ - // private JToolBar getJToolBarFile() { - // if (jToolBarFile == null) { - // jToolBarFile = new JToolBar(); - // jToolBarFile.setFloatable(false); - // } - // return jToolBarFile; - // } - /** - * This method initializes jToolBarEdit - * - * @return javax.swing.JToolBar - */ - // private JToolBar getJToolBarEdit() { - // if (jToolBarEdit == null) { - // jToolBarEdit = new JToolBar(); - // jToolBarEdit.setFloatable(false); - // } - // return jToolBarEdit; - // } /** * This method initializes jMenuItemToolsInstallPackage * @@ -1791,50 +1779,19 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele } if (arg0.getSource() == jMenuItemProjectCreateFar) { - CreateStepOne cso = new CreateStepOne(this, true); - int result = cso.showDialog(); - if (result == DataType.RETURN_TYPE_OK) { - String strReturn = "Create Far Done!"; - JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, - JOptionPane.INFORMATION_MESSAGE); - } - cso.dispose(); + createFar(); } if (arg0.getSource() == jMenuItemProjectInstallFar) { - InstallStepOne iso = new InstallStepOne(this, true); - int result = iso.showDialog(); - if (result == DataType.RETURN_TYPE_OK) { - String strReturn = "Install Far Done!
The WORKSPACE will be refreshed!"; - JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, - JOptionPane.INFORMATION_MESSAGE); - this.closeAll(); - } - iso.dispose(); + installFar(); } if (arg0.getSource() == jMenuItemProjectRemoveFar) { - DeleteStepOne dso = new DeleteStepOne(this, true); - int result = dso.showDialog(); - if (result == DataType.RETURN_TYPE_OK) { - String strReturn = "Delete Far Done!
The WORKSPACE will be refreshed!"; - JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, - JOptionPane.INFORMATION_MESSAGE); - this.closeAll(); - } - dso.dispose(); + removeFar(); } if (arg0.getSource() == jMenuItemProjectUpdateFar) { - UpdateStepOne uso = new UpdateStepOne(this, true); - int result = uso.showDialog(); - if (result == DataType.RETURN_TYPE_OK) { - String strReturn = "Update Far Done!
The WORKSPACE will be refreshed!"; - JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, - JOptionPane.INFORMATION_MESSAGE); - this.closeAll(); - } - uso.dispose(); + updateFar(); } if (arg0.getSource() == jMenuItemToolsClone) { @@ -1859,10 +1816,14 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele **/ private void makeEmptyTree() { + // // Make root + // dmtnRoot = new IDefaultMutableTreeNode("WORKSPACE", IDefaultMutableTreeNode.WORKSPACE, -1); + // // Make Module Description + // dmtnModuleDescription = new IDefaultMutableTreeNode("ModuleDescription", IDefaultMutableTreeNode.MODULE, -1); // @@ -1883,7 +1844,9 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele dmtnModulePackageModule = new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE, false, this.vPackageList.elementAt(index)); - + // + // And then add each module in its package + // Vector vModule = wt.getAllModules(this.vPackageList.elementAt(index)); for (int indexJ = 0; indexJ < vModule.size(); indexJ++) { if (vModule.get(indexJ).isLibrary()) { @@ -1907,15 +1870,9 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele } } - // if (this.vModuleList.size() > 0) { - // for (int index = 0; index < this.vModuleList.size(); index++) { - // dmtnModuleDescription.add(new IDefaultMutableTreeNode(this.vModuleList.elementAt(index).getName(), - // IDefaultMutableTreeNode.MSA_HEADER, false, - // this.vModuleList.elementAt(index))); - // } - // } - + // // Make Package Description + // dmtnPackageDescription = new IDefaultMutableTreeNode("PackageDescription", IDefaultMutableTreeNode.PACKAGE, -1); if (this.vPackageList.size() > 0) { for (int index = 0; index < this.vPackageList.size(); index++) { @@ -1925,7 +1882,9 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele } } + // // Make Platform Description + // dmtnPlatformDescription = new IDefaultMutableTreeNode("PlatformDescription", IDefaultMutableTreeNode.PLATFORM, -1); if (this.vPlatformList.size() > 0) { @@ -1936,6 +1895,9 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele } } + // + // Add sub nodes to root node + // dmtnRoot.add(dmtnModuleDescription); dmtnRoot.add(dmtnPackageDescription); dmtnRoot.add(dmtnPlatformDescription); @@ -3069,7 +3031,9 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele this.saveAll(); } if (result == JOptionPane.NO_OPTION) { + // // Do nothing + // } if (result == JOptionPane.CANCEL_OPTION) { return; @@ -3181,6 +3145,69 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele 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 = "Create Far Done!"; + JOptionPane.showConfirmDialog(null, 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 = "Install Far Done!
The WORKSPACE will be refreshed!"; + JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, + JOptionPane.INFORMATION_MESSAGE); + this.closeAll(); + } + 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 = "Delete Far Done!
The WORKSPACE will be refreshed!"; + JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, + JOptionPane.INFORMATION_MESSAGE); + this.closeAll(); + } + 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 = "Update Far Done!
The WORKSPACE will be refreshed!"; + JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, + JOptionPane.INFORMATION_MESSAGE); + this.closeAll(); + } + uso.dispose(); + } + /** Show Tool Chain Configuration Dialog to setup Tool Chain diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java index 22367795ec..5525b0a867 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java @@ -232,4 +232,9 @@ public class DataType { 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"; } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataValidation.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataValidation.java index aeff9ac2c6..d36f258dc1 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataValidation.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataValidation.java @@ -309,7 +309,7 @@ public class DataValidation { **/ public static boolean isHexWordArrayType(String arg0) { - return arg0.length() <=6 && isMatch("((\\s)*0x([a-fA-F0-9]){4}(,)?(\\s)*)+", arg0); + return arg0.length() >=6 && isMatch("((\\s)*0x([a-fA-F0-9]){4}(,)?(\\s)*)+", arg0); } /** diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/SaveFile.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/SaveFile.java index e28252239f..13e6786ca7 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/SaveFile.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/SaveFile.java @@ -228,6 +228,7 @@ public class SaveFile { //Save the file // msaDoc.save(f, options); + cursor.dispose(); } /** @@ -262,6 +263,7 @@ public class SaveFile { //Save the file // spdDoc.save(f, options); + cursor.dispose(); } /** @@ -296,6 +298,7 @@ public class SaveFile { //Save the file // fpdDoc.save(f, options); + cursor.dispose(); } /** @@ -326,5 +329,6 @@ public class SaveFile { //Save the file // dbDoc.save(f, options); + cursor.dispose(); } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java index 7cb2e9d526..d5d16b8d65 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java @@ -38,35 +38,6 @@ public class Tools { // public static String dirForNewSpd = null; - /** - Used for test - - @param args - - **/ - public static void main(String[] args) { - System.out.println(getCurrentDateTime()); - // Vector v = new Vector(); - // Vector v1 = new Vector(); - // - // v.addElement("CAC"); - // v1.addElement("1111"); - // v.addElement("1AC"); - // v1.addElement("2222"); - // v.addElement("ABC"); - // v1.addElement("3333"); - // v.addElement("0C"); - // v1.addElement("4444"); - // v.addElement("AAC"); - // v1.addElement("5555"); - // Vector vs = new Vector(); - // vs = Tools.getVectorSortSequence(v, DataType.Sort_Type_Ascending); - // Tools.sortVectorString(v1, Tools.getVectorSortSequence(v, DataType.Sort_Type_Ascending)); - // - // Tools.sortVectorString(v, DataType.Sort_Type_Ascending); - // Tools.sortVectorString(v, DataType.Sort_Type_Descending); - } - /** Get current date and time and format it as "yyyy-MM-dd HH:mm" @@ -407,4 +378,83 @@ public class Tools { 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", "Wrong 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(); + } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleVariables.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleVariables.java index ac16e2b31f..ed2f5aa0e1 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleVariables.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleVariables.java @@ -221,7 +221,7 @@ public class ModuleVariables extends IInternalFrame { if (this.variables != null) { if (this.variables.getVariableList().size() > 0) { for (int index = 0; index < this.variables.getVariableList().size(); index++) { - String arg0 = variables.getVariableList().get(index).getVariableName(); + 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) { @@ -376,7 +376,7 @@ public class ModuleVariables extends IInternalFrame { for (int index = 0; index < count; index++) { Variable p = Variable.Factory.newInstance(); if (!isEmpty(vid.getVariables(index).getName())) { - p.setVariableName(vid.getVariables(index).getName()); + p.setVariableName(Tools.convertStringToUnicodeHexString(vid.getVariables(index).getName())); } if (!isEmpty(vid.getVariables(index).getGuid())) { p.setGuidCName(vid.getVariables(index).getGuid()); diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/VariablesDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/VariablesDlg.java index 014e8a7220..20a9c329c8 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/VariablesDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/VariablesDlg.java @@ -430,13 +430,6 @@ public class VariablesDlg extends IDialog { return false; } - if (!isEmpty(this.jTextFieldVariableName.getText())) { - if (!DataValidation.isHexWordArrayType(this.jTextFieldVariableName.getText())) { - Log.wrn("Update Variables", "Incorrect data type for Variable Name"); - return false; - } - } - // // Check FeatureFlag // -- 2.39.2