X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FJava%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2FFrameworkWizardUI.java;h=d57c777f1d6049a581ac09bc217d144178060d80;hp=3c31bac1f5ae25b3fab71431a6b602b07767ca41;hb=14a32a70c262396b9e384b3c385159da88356e84;hpb=d12f87d3b1c080026adbdfefb459fdaf3072eab3 diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java index 3c31bac1f5..d57c777f1d 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java @@ -44,6 +44,7 @@ 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; @@ -73,6 +74,7 @@ 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; @@ -120,6 +122,12 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe /// 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 @@ -683,7 +691,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe private JMenuItem getJMenuItemHelpAbout() { if (jMenuItemHelpAbout == null) { jMenuItemHelpAbout = new JMenuItem(); - jMenuItemHelpAbout.setText("About..."); + jMenuItemHelpAbout.setText("About"); jMenuItemHelpAbout.setMnemonic('A'); jMenuItemHelpAbout.addActionListener(this); } @@ -1358,7 +1366,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe private JMenuItem getJMenuItemToolsBuildPreferences() { if (jMenuItemToolsBuildPreferences == null) { jMenuItemToolsBuildPreferences = new JMenuItem(); - jMenuItemToolsBuildPreferences.setText("Build Preferences"); + jMenuItemToolsBuildPreferences.setText("Build Preferences..."); jMenuItemToolsBuildPreferences.setMnemonic('P'); jMenuItemToolsBuildPreferences.setEnabled(true); jMenuItemToolsBuildPreferences.addActionListener(this); @@ -1598,7 +1606,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe private JMenuItem getJMenuItemProjectInstallFar() { if (jMenuItemProjectInstallFar == null) { jMenuItemProjectInstallFar = new JMenuItem(); - jMenuItemProjectInstallFar.setText("Install FAR"); + jMenuItemProjectInstallFar.setText("Install FAR..."); jMenuItemProjectInstallFar.setMnemonic('I'); jMenuItemProjectInstallFar.setEnabled(true); jMenuItemProjectInstallFar.addActionListener(this); @@ -1614,7 +1622,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe private JMenuItem getJMenuItemProjectUpdateFar() { if (jMenuItemProjectUpdateFar == null) { jMenuItemProjectUpdateFar = new JMenuItem(); - jMenuItemProjectUpdateFar.setText("Update FAR"); + jMenuItemProjectUpdateFar.setText("Update FAR..."); jMenuItemProjectUpdateFar.setMnemonic('U'); jMenuItemProjectUpdateFar.setEnabled(true); jMenuItemProjectUpdateFar.addActionListener(this); @@ -1631,7 +1639,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe private JMenuItem getJMenuItemProjectRemoveFar() { if (jMenuItemProjectRemoveFar == null) { jMenuItemProjectRemoveFar = new JMenuItem(); - jMenuItemProjectRemoveFar.setText("Remove FAR"); + jMenuItemProjectRemoveFar.setText("Remove FAR..."); jMenuItemProjectRemoveFar.setMnemonic('R'); jMenuItemProjectRemoveFar.setEnabled(true); jMenuItemProjectRemoveFar.addActionListener(this); @@ -1647,7 +1655,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe private JMenuItem getJMenuItemProjectCreateFar() { if (jMenuItemProjectCreateFar == null) { jMenuItemProjectCreateFar = new JMenuItem(); - jMenuItemProjectCreateFar.setText("Create FAR"); + jMenuItemProjectCreateFar.setText("Create FAR..."); jMenuItemProjectCreateFar.setMnemonic('C'); jMenuItemProjectCreateFar.addActionListener(this); } @@ -1774,7 +1782,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe private JMenuItem getJMenuItemToolsGenerateGuidsXref() { if (jMenuItemToolsGenerateGuidsXref == null) { jMenuItemToolsGenerateGuidsXref = new JMenuItem(); - jMenuItemToolsGenerateGuidsXref.setText("Generate guids.xref"); + jMenuItemToolsGenerateGuidsXref.setText("Generate guids.xref..."); jMenuItemToolsGenerateGuidsXref.setMnemonic('G'); jMenuItemToolsGenerateGuidsXref.addActionListener(this); } @@ -1819,7 +1827,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe // SplashScreen ss = new SplashScreen(); ss.setVisible(true); - + // // Init Global Data // @@ -1829,7 +1837,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe // Close splash screen // ss.dispose(); - + // // Init the frame // @@ -1887,6 +1895,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe if (arg0.getSource() == this.jMenuItemFileCloseAll) { this.closeAll(); + this.refresh(); this.makeEmptyTree(); } @@ -1903,9 +1912,10 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe } if (arg0.getSource() == this.jMenuItemFileRefresh) { - this.closeAll(); - this.refresh(); - this.makeEmptyTree(); + if (this.closeAll() == 0) { + this.refresh(); + this.makeEmptyTree(); + } } if (arg0.getSource() == this.jMenuItemFileExit) { @@ -2533,6 +2543,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe 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) { @@ -2880,6 +2891,10 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe ModulePCDs frmPcd = new ModulePCDs(msa); getJDesktopPaneModule().add(frmPcd, 1); break; + case IDefaultMutableTreeNode.MSA_BUILDOPTIONS: + ModuleBuildOptions frmMbo = new ModuleBuildOptions(msa); + getJDesktopPaneModule().add(frmMbo, 1); + break; } this.jTabbedPaneEditor.setSelectedIndex(0); resizeDesktopPanel(); @@ -3085,7 +3100,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe if (!GlobalData.openingModuleList.getModuleSaved(currentOpeningModuleIndex)) { int result = showSaveDialog(); if (result == JOptionPane.YES_OPTION) { - this.saveAll(); + this.save(); } if (result == JOptionPane.NO_OPTION) { // Do nothing @@ -3107,7 +3122,10 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe 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; } @@ -3120,7 +3138,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe if (!GlobalData.openingPackageList.getPackageSaved(currentOpeningPackageIndex)) { int result = showSaveDialog(); if (result == JOptionPane.YES_OPTION) { - this.saveAll(); + this.save(); } if (result == JOptionPane.NO_OPTION) { // Do nothing @@ -3142,7 +3160,9 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe 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; } @@ -3155,7 +3175,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe if (!GlobalData.openingPlatformList.getPlatformSaved(currentOpeningPlatformIndex)) { int result = showSaveDialog(); if (result == JOptionPane.YES_OPTION) { - this.saveAll(); + this.save(); } if (result == JOptionPane.NO_OPTION) { // Do nothing @@ -3177,7 +3197,9 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe 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; } @@ -3189,8 +3211,8 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe Close all opening files and clean all showing internal frame **/ - private void closeAll() { - int result = -1; + private int closeAll() { + int result = JOptionPane.NO_OPTION; if (!GlobalData.openingModuleList.isSaved() || !GlobalData.openingPackageList.isSaved() || !GlobalData.openingPlatformList.isSaved()) { result = showSaveDialog(); @@ -3203,13 +3225,15 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe // Do nothing // } - if (result == JOptionPane.CANCEL_OPTION) { - return; + if (result == JOptionPane.CANCEL_OPTION || result == JOptionPane.CLOSED_OPTION) { + return -1; } this.cleanDesktopPane(); GlobalData.openingModuleList.closeAll(); GlobalData.openingPackageList.closeAll(); GlobalData.openingPlatformList.closeAll(); + + return 0; } /** @@ -3282,18 +3306,16 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe **/ private void exit() { - int result = -1; + 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) { + } else if (result == JOptionPane.NO_OPTION) { // Do nothing - } - if (result == JOptionPane.CANCEL_OPTION) { + } else if (result == JOptionPane.CANCEL_OPTION || result == JOptionPane.CLOSED_OPTION) { return; } this.dispose(); @@ -3556,9 +3578,32 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe // // Enable close/close all if some files are opened // - jMenuItemFileClose.setEnabled(GlobalData.openingModuleList.isOpen() - || GlobalData.openingPackageList.isOpen() - || GlobalData.openingPlatformList.isOpen()); + 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()); @@ -3566,9 +3611,6 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe // // Enable save/save all if some files are changed // - jMenuItemFileSave.setEnabled(!GlobalData.openingModuleList.isSaved() - || !GlobalData.openingPackageList.isSaved() - || !GlobalData.openingPlatformList.isSaved()); jMenuItemFileSaveAll.setEnabled(!GlobalData.openingModuleList.isSaved() || !GlobalData.openingPackageList.isSaved() || !GlobalData.openingPlatformList.isSaved()); @@ -3683,10 +3725,14 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe JOptionPane .showConfirmDialog( null, - "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.", + "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(); @@ -3713,8 +3759,8 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe this.dispose(); System.exit(0); case Workspace.WORKSPACE_NO_TARGET_FILE: - JOptionPane.showConfirmDialog(null, "Target.txt File Is Not Existed", "Error", - JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE); + JOptionPane.showConfirmDialog(null, "Target.txt File Is Not Existed", "Error", JOptionPane.DEFAULT_OPTION, + JOptionPane.ERROR_MESSAGE); this.dispose(); System.exit(0); }