1. Fix EDKT308: Tool initialization should be supported by wizard

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1768 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
hche10x 2006-10-17 06:14:42 +00:00
parent 3c82f1a543
commit ae69d4dae8
2 changed files with 29 additions and 7 deletions

View File

@ -3711,6 +3711,11 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE); JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
this.dispose(); this.dispose();
System.exit(0); 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);
this.dispose();
System.exit(0);
} }
} }
} }

View File

@ -24,15 +24,17 @@ public class Workspace {
// Define static return value // Define static return value
// //
public final static int WORKSPACE_VALID = 0; public final static int WORKSPACE_VALID = 0;
public final static int WORKSPACE_NOT_DEFINED = 1; public final static int WORKSPACE_NOT_DEFINED = 1;
public final static int WORKSPACE_NOT_EXIST = 2; public final static int WORKSPACE_NOT_EXIST = 2;
public final static int WORKSPACE_NOT_DIRECTORY = 3; public final static int WORKSPACE_NOT_DIRECTORY = 3;
public final static int WORKSPACE_NOT_VALID = 4; public final static int WORKSPACE_NOT_VALID = 4;
public final static int WORKSPACE_NO_TARGET_FILE = 5;
// //
// Define class members // Define class members
// //
@ -41,6 +43,9 @@ public class Workspace {
private static String strWorkspaceDatabaseFile = DataType.FILE_SEPARATOR + "Tools" + DataType.FILE_SEPARATOR private static String strWorkspaceDatabaseFile = DataType.FILE_SEPARATOR + "Tools" + DataType.FILE_SEPARATOR
+ "Conf" + DataType.FILE_SEPARATOR + "FrameworkDatabase.db"; + "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 @param args
@ -99,7 +104,7 @@ public class Workspace {
if (strWorkspace == null || strWorkspace == "") { if (strWorkspace == null || strWorkspace == "") {
return Workspace.WORKSPACE_NOT_DEFINED; return Workspace.WORKSPACE_NOT_DEFINED;
} }
// //
// Check if WORKSPACE Environment exists // Check if WORKSPACE Environment exists
// //
@ -107,14 +112,14 @@ public class Workspace {
if (!f.exists()) { if (!f.exists()) {
return Workspace.WORKSPACE_NOT_EXIST; return Workspace.WORKSPACE_NOT_EXIST;
} }
// //
// Check if WORKSPACE Environment is a directory // Check if WORKSPACE Environment is a directory
// //
if (!f.isDirectory()) { if (!f.isDirectory()) {
return Workspace.WORKSPACE_NOT_DIRECTORY; return Workspace.WORKSPACE_NOT_DIRECTORY;
} }
// //
// Check if FrameworkDatabase.db exists // Check if FrameworkDatabase.db exists
// //
@ -123,6 +128,14 @@ public class Workspace {
return Workspace.WORKSPACE_NOT_VALID; 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; return Workspace.WORKSPACE_VALID;
} }
@ -133,4 +146,8 @@ public class Workspace {
public static void setStrWorkspaceDatabaseFile(String strWorkspaceDatabaseFile) { public static void setStrWorkspaceDatabaseFile(String strWorkspaceDatabaseFile) {
//Workspace.strWorkspaceDatabaseFile = strWorkspaceDatabaseFile; //Workspace.strWorkspaceDatabaseFile = strWorkspaceDatabaseFile;
} }
public static String getTargetFile() {
return targetFile;
}
} }