1. Fix EDKT437 Save is to save current modified file, Save All is to save all modified files

2. Fix EDKT438 Close should save current modified file only, Close All should save all modified file


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1871 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
hche10x 2006-10-31 03:25:05 +00:00
parent 8b44bd1d51
commit e421fb258c
4 changed files with 45 additions and 21 deletions

View File

@ -1819,7 +1819,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
// //
SplashScreen ss = new SplashScreen(); SplashScreen ss = new SplashScreen();
ss.setVisible(true); ss.setVisible(true);
// //
// Init Global Data // Init Global Data
// //
@ -1905,7 +1905,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
if (arg0.getSource() == this.jMenuItemFileRefresh) { if (arg0.getSource() == this.jMenuItemFileRefresh) {
if (this.closeAll() == 0) { if (this.closeAll() == 0) {
this.refresh(); this.refresh();
this.makeEmptyTree(); this.makeEmptyTree();
} }
} }
@ -3086,7 +3086,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
if (!GlobalData.openingModuleList.getModuleSaved(currentOpeningModuleIndex)) { if (!GlobalData.openingModuleList.getModuleSaved(currentOpeningModuleIndex)) {
int result = showSaveDialog(); int result = showSaveDialog();
if (result == JOptionPane.YES_OPTION) { if (result == JOptionPane.YES_OPTION) {
this.saveAll(); this.save();
} }
if (result == JOptionPane.NO_OPTION) { if (result == JOptionPane.NO_OPTION) {
// Do nothing // Do nothing
@ -3121,7 +3121,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
if (!GlobalData.openingPackageList.getPackageSaved(currentOpeningPackageIndex)) { if (!GlobalData.openingPackageList.getPackageSaved(currentOpeningPackageIndex)) {
int result = showSaveDialog(); int result = showSaveDialog();
if (result == JOptionPane.YES_OPTION) { if (result == JOptionPane.YES_OPTION) {
this.saveAll(); this.save();
} }
if (result == JOptionPane.NO_OPTION) { if (result == JOptionPane.NO_OPTION) {
// Do nothing // Do nothing
@ -3156,7 +3156,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
if (!GlobalData.openingPlatformList.getPlatformSaved(currentOpeningPlatformIndex)) { if (!GlobalData.openingPlatformList.getPlatformSaved(currentOpeningPlatformIndex)) {
int result = showSaveDialog(); int result = showSaveDialog();
if (result == JOptionPane.YES_OPTION) { if (result == JOptionPane.YES_OPTION) {
this.saveAll(); this.save();
} }
if (result == JOptionPane.NO_OPTION) { if (result == JOptionPane.NO_OPTION) {
// Do nothing // Do nothing
@ -3211,7 +3211,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
GlobalData.openingModuleList.closeAll(); GlobalData.openingModuleList.closeAll();
GlobalData.openingPackageList.closeAll(); GlobalData.openingPackageList.closeAll();
GlobalData.openingPlatformList.closeAll(); GlobalData.openingPlatformList.closeAll();
return 0; return 0;
} }
@ -3557,9 +3557,32 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
// //
// Enable close/close all if some files are opened // Enable close/close all if some files are opened
// //
jMenuItemFileClose.setEnabled(GlobalData.openingModuleList.isOpen() switch (this.jTabbedPaneEditor.getSelectedIndex()) {
|| GlobalData.openingPackageList.isOpen() case 0:
|| GlobalData.openingPlatformList.isOpen()); 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() jMenuItemFileCloseAll.setEnabled(GlobalData.openingModuleList.isOpen()
|| GlobalData.openingPackageList.isOpen() || GlobalData.openingPackageList.isOpen()
|| GlobalData.openingPlatformList.isOpen()); || GlobalData.openingPlatformList.isOpen());
@ -3567,9 +3590,6 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
// //
// Enable save/save all if some files are changed // 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() jMenuItemFileSaveAll.setEnabled(!GlobalData.openingModuleList.isSaved()
|| !GlobalData.openingPackageList.isSaved() || !GlobalData.openingPackageList.isSaved()
|| !GlobalData.openingPlatformList.isSaved()); || !GlobalData.openingPlatformList.isSaved());
@ -3684,10 +3704,14 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
JOptionPane JOptionPane
.showConfirmDialog( .showConfirmDialog(
null, null,
"WORKSPACE Environment Variable Is Not Defined, Please select a valid WORKSPACE directory. " + "WORKSPACE Environment Variable Is Not Defined, Please select a valid WORKSPACE directory. "
DataType.LINE_SEPARATOR + DataType.LINE_SEPARATOR + "NOTICE:" + + DataType.LINE_SEPARATOR
DataType.LINE_SEPARATOR + "This does not change the System Environment Variable." + + DataType.LINE_SEPARATOR
DataType.LINE_SEPARATOR + "It only applies to where the Wizard will manage modification and file creations.", + "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); "Error", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
SwitchWorkspace sw = new SwitchWorkspace(this, true); SwitchWorkspace sw = new SwitchWorkspace(this, true);
int result = sw.showDialog(); int result = sw.showDialog();
@ -3714,8 +3738,8 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
this.dispose(); this.dispose();
System.exit(0); System.exit(0);
case Workspace.WORKSPACE_NO_TARGET_FILE: case Workspace.WORKSPACE_NO_TARGET_FILE:
JOptionPane.showConfirmDialog(null, "Target.txt File Is Not Existed", "Error", JOptionPane.showConfirmDialog(null, "Target.txt File Is Not Existed", "Error", JOptionPane.DEFAULT_OPTION,
JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
this.dispose(); this.dispose();
System.exit(0); System.exit(0);
} }

View File

@ -137,7 +137,7 @@ public class OpeningModuleList {
if (index > -1) { if (index > -1) {
return vOpeningModuleList.elementAt(index).isOpen(); return vOpeningModuleList.elementAt(index).isOpen();
} }
return true; return false;
} }
public void setTreePathById(ModuleIdentification id, Set<TreePath> treePath) { public void setTreePathById(ModuleIdentification id, Set<TreePath> treePath) {

View File

@ -137,7 +137,7 @@ public class OpeningPackageList {
if (index > -1) { if (index > -1) {
return vOpeningPackageList.elementAt(index).isOpen(); return vOpeningPackageList.elementAt(index).isOpen();
} }
return true; return false;
} }
public void setTreePathById(PackageIdentification id, Set<TreePath> treePath) { public void setTreePathById(PackageIdentification id, Set<TreePath> treePath) {

View File

@ -139,7 +139,7 @@ public class OpeningPlatformList {
if (index > -1) { if (index > -1) {
return vOpeningPlatformList.elementAt(index).isOpen(); return vOpeningPlatformList.elementAt(index).isOpen();
} }
return true; return false;
} }
public void setTreePathById(PlatformIdentification id, Set<TreePath> treePath) { public void setTreePathById(PlatformIdentification id, Set<TreePath> treePath) {