Obliterate this file.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
bbahnsen 2006-04-22 00:00:01 +00:00
parent 98cfd19a8d
commit 2b14801739
13 changed files with 0 additions and 2738 deletions

View File

@ -1,2 +0,0 @@
Manifest-Version: 1.0
Main-Class: org.tianocore.packaging.workspace.ui.Welcome

View File

@ -1,64 +0,0 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-->
<project name="Setup" default="all" basedir=".">
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<property environment="env"/>
<property name="WORKSPACE" value="${env.WORKSPACE}"/>
<path id="classpath">
<fileset dir="${WORKSPACE}/Tools/Jars" includes="*.jar"/>
<fileset dir="${WORKSPACE}/Tools/bin/xmlbeans/lib" includes="*.jar"/>
</path>
<property name="buildDir" value="build"/>
<property name="installLocation" value="${WORKSPACE}/Tools/bin"/>
<target name="all" depends="deleteTemp"/>
<target name="source">
<mkdir dir="${buildDir}"/>
<javac srcdir="src" destdir="${buildDir}">
<classpath refid="classpath"/>
<compilerarg value="-Xlint"/>
</javac>
</target>
<target name="clean">
<delete dir="${buildDir}"/>
</target>
<target name="cleanall">
<delete dir="${buildDir}"/>
<delete file="${installLocation}/CreateMdkPkg.jar"/>
</target>
<target name="relocate" depends="source">
<delete file="${installLocation}/CreateMdkPkg.jar"/>
<copy todir="${buildDir}/Tools">
<fileset dir="${WORKSPACE}/Tools"/>
</copy>
<copy todir="${buildDir}/MdePkg">
<fileset dir="${WORKSPACE}/MdePkg"/>
</copy>
<copy file="${WORKSPACE}/build.xml"
todir="${buildDir}"/>
<copy file="${WORKSPACE}/DeveloperManual.doc"
todir="${buildDir}"/>
<copy file="${WORKSPACE}/edksetup.bat"
todir="${buildDir}"/>
<copy file="${WORKSPACE}/edksetup.sh"
todir="${buildDir}"/>
</target>
<target name="install" depends="relocate">
<jar destfile="${installLocation}/CreateMdkPkg.jar"
basedir="${buildDir}"
includes="**"
manifest="MANIFEST.MF"
/>
</target>
<target name="deleteTemp" depends="install">
<delete dir="${buildDir}"/>
</target>
</project>

View File

@ -1,188 +0,0 @@
/** @file
The file is used to provides static interfaces to save log and error information
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.common;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import javax.swing.JOptionPane;
/**
The class is used to provides static interfaces to save log and error information
@since CreateMdkPkg 1.0
**/
public class Log {
//
//Log file
//
private static File fleLogFile = null;
//
//Err file
//
private static File fleErrFile = null;
//
//Log file name
//
static String strLogFileName = "Log.log";
//
//Err file name
//
static String strErrFileName = "Err.log";
/**
Main class, used for test
@param args
**/
public static void main(String[] args) {
try {
Log.log("Test", "test");
Log.err("Test1", "test1");
} catch (Exception e) {
e.printStackTrace();
}
}
/**
This is the default constructor
Do nothing
**/
public Log() {
}
/**
Call writeToLogFile to save log item and log information to log file
@param strItem The log item
@param strLog The log information
**/
public static void log(String strItem, String strLog) {
try {
writeToLogFile(strItem + ":" + strLog);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
Call writeToLogFile to save log information to log file
@param strLog The log information
**/
public static void log(String strLog) {
try {
writeToLogFile(strLog);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
Call writeToErrFile to save err item and err information to err file
@param strItem The err item
@param strLog The err information
**/
public static void err(String strItem, String strErr) {
try {
writeToErrFile("Error when " + strItem + ":" + strErr);
JOptionPane.showConfirmDialog(null, "Error when " + strItem + "::" + strErr, "Error",
JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
Call writeToErrFile to save err information to err file
@param strLog The err information
**/
public static void err(String strErr) {
try {
writeToErrFile("Error::" + strErr);
JOptionPane.showConfirmDialog(null, "Error::" + strErr, "Error", JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
Open log file and write log information
@param strLog The log information
@throws IOException
**/
private static void writeToLogFile(String strLog) throws IOException {
try {
if (fleLogFile == null) {
fleLogFile = new File(strLogFileName);
fleLogFile.createNewFile();
}
FileOutputStream fos = new FileOutputStream(fleLogFile, true);
fos.write((Tools.getCurrentDateTime() + "\r\n").getBytes());
fos.write((strLog + "\r\n").getBytes());
fos.flush();
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
Open err file and write err information
@param strLog The log information
@throws IOException
**/
private static void writeToErrFile(String strLog) throws IOException {
try {
if (fleErrFile == null) {
fleErrFile = new File(strErrFileName);
fleErrFile.createNewFile();
}
FileOutputStream fos = new FileOutputStream(fleErrFile, true);
fos.write((Tools.getCurrentDateTime() + "\r\n").getBytes());
fos.write((strLog + "\r\n").getBytes());
fos.flush();
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@ -1,120 +0,0 @@
/** @file
The file is used to provides some useful interfaces
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.common;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;
/**
The class is used to provides some useful interfaces
@since CreateMdkPkg 1.0
**/
public class Tools {
/**
Used for test
@param args
**/
public static void main(String[] args) {
System.out.println(getCurrentDateTime());
}
/**
Get current date and time and format it as "yyyy-MM-dd HH:mm"
@return formatted current date and time
**/
public static String getCurrentDateTime() {
Date now = new Date(System.currentTimeMillis());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
return sdf.format(now);
}
/**
Delete a folder and all its files
@param fleFolderName The name of the folder which need be deleted
@retval true - Delete successfully
@retval false - Delete successfully
**/
public static boolean deleteFolder(File fleFolderName) {
boolean blnIsDeleted = true;
File[] aryAllFiles = fleFolderName.listFiles();
for (int indexI = 0; indexI < aryAllFiles.length; indexI++) {
if (blnIsDeleted) {
if (aryAllFiles[indexI].isDirectory()) {
//
//If is a directory, recursively call this function to delete sub folders
//
blnIsDeleted = deleteFolder(aryAllFiles[indexI]);
} else if (aryAllFiles[indexI].isFile()) {
//
//If is a file, delete it
//
if (!aryAllFiles[indexI].delete()) {
blnIsDeleted = false;
}
}
}
}
if (blnIsDeleted) {
fleFolderName.delete();
}
return blnIsDeleted;
}
/**
Generate a UUID
@return the created UUID
**/
public static String generateUuidString() {
return UUID.randomUUID().toString();
}
/**
Get all system properties and output to the console
**/
public static void getSystemProperties() {
System.out.println(System.getProperty("java.class.version"));
System.out.println(System.getProperty("java.class.path"));
System.out.println(System.getProperty("java.ext.dirs"));
System.out.println(System.getProperty("os.name"));
System.out.println(System.getProperty("os.arch"));
System.out.println(System.getProperty("os.version"));
System.out.println(System.getProperty("file.separator"));
System.out.println(System.getProperty("path.separator"));
System.out.println(System.getProperty("line.separator"));
System.out.println(System.getProperty("user.name"));
System.out.println(System.getProperty("user.home"));
System.out.println(System.getProperty("user.dir"));
System.out.println(System.getProperty("PATH"));
System.out.println(System.getenv("PROCESSOR_REVISION"));
}
}

View File

@ -1,238 +0,0 @@
/** @file
The file is used to install .jar file
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.packaging;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import javax.swing.JFrame;
/**
The class is used to install .jar file
@since CreateMdkPkg 1.0
**/
public class FrameworkPkg {
//
// Define class members
//
static JFrame frame;
private String pkg = null;
private JarFile jf = null;
/**
Main clase, used to test
@param args
**/
public static void main(String[] args) {
FrameworkPkg fp = new FrameworkPkg("C:\\Documents and Settings\\hchen30\\Desktop\\com.jar");
try {
fp.install("C:\\MyWorkspace" + System.getProperty("file.separator"));
} catch (Exception e) {
e.printStackTrace();
}
}
/**
This is the default constructor
**/
public FrameworkPkg() {
}
/**
This is the override constructor
@param package_name
**/
public FrameworkPkg(String package_name) {
pkg = package_name;
}
/**
Get package name
@param package_name
**/
public void setPkg(String package_name) {
pkg = package_name;
}
/**
Set Jarfile
@throws IOException
**/
public void setJarFile() throws IOException {
jf = new JarFile(pkg);
}
/**
Install the jar file to specific path
@param dir The target path
@return 0 - success
@throws IOException
@throws BasePkgNotInstalled
@throws VerNotEqual
@throws GuidNotEqual
@throws SameAll
**/
public int install(final String dir) throws IOException, BasePkgNotInstalled, VerNotEqual, GuidNotEqual, SameAll {
pre_install();
extract(dir);
post_install();
return 0;
}
/**
@return
**/
public int uninstall() {
return 0;
}
/**
Check before install
@throws IOException
@throws BasePkgNotInstalled
@throws VerNotEqual
@throws GuidNotEqual
@throws SameAll
**/
protected void pre_install() throws IOException, BasePkgNotInstalled, VerNotEqual, GuidNotEqual, SameAll {
jf = new JarFile(pkg);
if (false) {
throw new BasePkgNotInstalled();
}
if (false) {
throw new VerNotEqual();
}
if (false) {
throw new GuidNotEqual();
}
if (false) {
throw new SameAll();
}
}
/**
End of install
@throws IOException
**/
protected void post_install() throws IOException {
jf.close();
}
/**
Extract the jar file to specific dir
@param dir The target path
@throws IOException
**/
private synchronized void extract(String dir) throws IOException {
int i = 0;
try {
for (Enumeration e = jf.entries(); e.hasMoreElements(); i++) {
JarEntry je = (JarEntry) e.nextElement();
if (je.getName().contains("META-INF"))
continue;
if (je.isDirectory()) {
new File(dir + je.getName()).mkdirs();
continue;
}
if (je != null) {
//
// Get an input stream for the entry.
//
InputStream entryStream = jf.getInputStream(je);
try {
//
// Create the output file (clobbering the file if it exists).
//
FileOutputStream file = new FileOutputStream(dir + je.getName());
try {
//
// Allocate a buffer for reading the entry data.
//
byte[] buffer = new byte[1024];
int bytesRead;
//
// Read the entry data and write it to the output file.
//
while ((bytesRead = entryStream.read(buffer)) != -1) {
file.write(buffer, 0, bytesRead);
}
System.out.println(je.getName() + " extracted.");
} finally {
file.close();
}
} finally {
entryStream.close();
}
}
}
} finally {
jf.close();
}
}
}
class BasePkgNotInstalled extends Exception {
final static long serialVersionUID = 0;
}
class VerNotEqual extends Exception {
final static long serialVersionUID = 0;
}
class GuidNotEqual extends Exception {
final static long serialVersionUID = 0;
}
class SameAll extends Exception {
final static long serialVersionUID = 0;
}

View File

@ -1,59 +0,0 @@
/** @file
The file is used to override FrameworkPkg to provides customized interfaces
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.packaging;
import java.io.IOException;
/**
The class is used to override FrameworkPkg to provides customized interfaces
@since CreateMdkPkg 1.0
**/
public class MdkPkg extends FrameworkPkg {
/**
Main class, reserved for test
@param args
**/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
/**
This is the default constructor
@param strJarFile The jar file need be installed
@throws IOException
**/
public MdkPkg(String strJarFile) throws IOException {
this.setPkg(strJarFile);
this.setJarFile();
}
/* (non-Javadoc)
* @see org.tianocore.packaging.FrameworkPkg#pre_install()
*
* Override pre_install to do nothing
*
*/
protected void pre_install() {
}
}

View File

@ -1,264 +0,0 @@
/** @file
The file is used to popup a exit confirmation window when program exists
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.packaging.common.ui;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
/**
The class is used to popup a exit confirmation window when program exists
It extends JDialog and implements ActionListener and WindowListener
@since CreateMdkPkg 1.0
**/
public class ExitConfirm extends JDialog implements ActionListener, WindowListener {
///
/// Define class Serial Version UID
///
private static final long serialVersionUID = -5875921789385911029L;
//
// Define class members
//
private JPanel jContentPane = null;
private JLabel jLabelMessage = null;
private JLabel jLabelResume = null;
private JLabel jLabelExit = null;
private JButton jButtonResume = null;
private JButton jButtonExit = null;
public boolean isCancel = false;
/**
This method initializes jButtonResume
@return javax.swing.JButton jButtonResume
**/
private JButton getJButtonResume() {
if (jButtonResume == null) {
jButtonResume = new JButton();
jButtonResume.setText("Resume");
jButtonResume.setSize(new java.awt.Dimension(90, 20));
jButtonResume.setLocation(new java.awt.Point(150, 105));
jButtonResume.setMnemonic('R');
jButtonResume.addActionListener(this);
}
return jButtonResume;
}
/**
This method initializes jButtonExit
@return javax.swing.JButton jButtonExit
**/
private JButton getJButtonExit() {
if (jButtonExit == null) {
jButtonExit = new JButton();
jButtonExit.setText("Exit");
jButtonExit.setSize(new java.awt.Dimension(90, 20));
jButtonExit.setLocation(new java.awt.Point(260, 105));
jButtonExit.setMnemonic('x');
jButtonExit.addActionListener(this);
}
return jButtonExit;
}
/**
Main clasee, reserved for test
@param args
**/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
/**
This is the default constructor
**/
public ExitConfirm(IFrame parentFrame, boolean modal) {
super(parentFrame, modal);
initialize();
}
/**
This method initializes this
**/
private void initialize() {
this.setSize(500, 170);
this.setTitle("Exit");
this.setResizable(false);
this.setContentPane(getJContentPane());
this.addWindowListener(this);
//
//Set DO_NOTHING_ON_CLOSE when click Close button on title bar
//
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
centerWindow();
}
/**
This method initializes jContentPane
@return javax.swing.JPanel jContentPane
**/
private JPanel getJContentPane() {
if (jContentPane == null) {
jLabelExit = new JLabel();
jLabelExit.setSize(new java.awt.Dimension(450, 20));
jLabelExit.setLocation(new java.awt.Point(25, 70));
jLabelResume = new JLabel();
jLabelResume.setSize(new java.awt.Dimension(450, 20));
jLabelResume.setLocation(new java.awt.Point(25, 40));
jLabelMessage = new JLabel();
jLabelMessage.setSize(new java.awt.Dimension(450, 20));
jLabelMessage.setLocation(new java.awt.Point(25, 10));
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(jLabelMessage, null);
jContentPane.add(jLabelResume, null);
jContentPane.add(jLabelExit, null);
jContentPane.add(getJButtonResume(), null);
jContentPane.add(getJButtonExit(), null);
}
return jContentPane;
}
/**
Call setWarningMessage to set messages of frame when it is used for Setup
**/
public void setSetupMessage() {
String strTitle = "Exit Setup";
String strMessage = "Setup is not complete. If you quit now, the program will not be installed.";
//String strResume = "You may run the setup program at a later time to complete the installation.";
String strResume = "";
String strExit = "To continue installing, click Resume. To quit the Setup program, click Exit.";
setWarningMessage(strTitle, strMessage, strResume, strExit);
}
/**
Call setWarningMessage to set messages of frame when it is used for Module Main GUI
**/
public void setModuleMessage() {
String strTitle = "Exit";
String strMessage = "Do you really want to quit now?";
String strResume = "All unsaved module information will be lost.";
String strExit = "To continue editing module, click Resume. To quit the program, click Exit.";
setWarningMessage(strTitle, strMessage, strResume, strExit);
}
/**
Set message information via input data
@param strTitle The title value
@param strMessage The main message value
@param strResume The resume message value
@param strExit The exit message value
**/
private void setWarningMessage(String strTitle, String strMessage, String strResume, String strExit) {
this.setTitle(strTitle);
jLabelMessage.setText(strMessage);
jLabelResume.setText(strResume);
jLabelExit.setText(strExit);
}
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listern all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
//
//Set isCancel true when click button "Exit"
//
Object obj = arg0.getSource();
if (obj == jButtonResume) {
isCancel = false;
}
if (obj == jButtonExit) {
isCancel = true;
}
this.setVisible(false);
}
/**
Make the window in the center of the screen
**/
private void centerWindow() {
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
}
public void windowActivated(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowClosed(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowClosing(WindowEvent arg0) {
isCancel = false;
this.setVisible(false);
}
public void windowDeactivated(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowDeiconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowIconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowOpened(WindowEvent arg0) {
// TODO Auto-generated method stub
}
}

View File

@ -1,203 +0,0 @@
/** @file
The file is used to override Frame to provides customized interfaces
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.packaging.common.ui;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JFrame;
/**
The class is used to override Frame to provides customized interfaces
It extends JFrame implements ActionListener and WindowListener
@since CreateMdkPkg 1.0
**/
public class IFrame extends JFrame implements ActionListener, WindowListener {
///
/// Define class Serial Version UID
///
private static final long serialVersionUID = -3324138961029300427L;
//
// Define class members
//
private ExitConfirm ec = null;
//
// To indicate the status while quit
// 0 - When setup (Default)
// 1 - Whne editing module
//
private int intExitType = 0;
/**
Main class, used for test
@param args
**/
public static void main(String[] args) {
IFrame i = new IFrame();
i.setVisible(true);
}
/**
This is the default constructor
**/
public IFrame() {
super();
initialize();
}
/**
This method initializes this
**/
public void initialize() {
this.setResizable(false);
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.addWindowListener(this);
}
/**
Start the dialog at the center of screen
@param intWidth The width of the dialog
@param intHeight The height of the dialog
**/
protected void centerWindow(int intWidth, int intHeight) {
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
}
/**
Start the dialog at the center of screen
**/
protected void centerWindow() {
centerWindow(this.getSize().width, this.getSize().height);
}
/**
Set the exit window type
@param ExitType The input data of ExitType
**/
protected void setExitType(int ExitType) {
this.intExitType = ExitType;
}
/* (non-Javadoc)
* @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
*
* Override windowClosing to call this.onDisvisible()
*
*/
public void windowClosing(WindowEvent arg0) {
this.onDisvisible();
}
public void windowOpened(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowClosed(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowIconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowDeiconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowActivated(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowDeactivated(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
/**
Define the actions when exit
**/
public void onExit() {
ec = new ExitConfirm(this, true);
//
//Show different warning message via different ExitType
//
switch (intExitType) {
case 0:
ec.setSetupMessage();
break;
case 1:
ec.setModuleMessage();
break;
}
ec.setVisible(true);
if (ec.isCancel) {
this.dispose();
System.exit(0);
}
}
/**
Define the actions when disvisible
**/
public void onDisvisible() {
ec = new ExitConfirm(this, true);
//
//Show different warning message via different ExitType
//
switch (intExitType) {
case 0:
ec.setSetupMessage();
break;
case 1:
ec.setModuleMessage();
break;
}
ec.setVisible(true);
if (ec.isCancel) {
this.dispose();
}
}
}

View File

@ -1,161 +0,0 @@
/** @file
The file is used to override AbstractCellEditor to provides customized interfaces
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.packaging.workspace.command;
import java.io.File;
import java.io.IOException;
import org.tianocore.common.Log;
import org.tianocore.common.Tools;
import org.tianocore.packaging.MdkPkg;
/**
The class is used to override AbstractCellEditor to provides customized interfaces
@since CreateMdkPkg 1.0
**/
public class InstallWorkspace {
/**
Main class, reserved for test
@param args
**/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
/**
This is the default constructor
Reserved
**/
public InstallWorkspace() {
// TODO
}
/**
Check if exist target dir
@param strInstallDir The install target dir
@retval true - The target exists
@retval false - The target doesn't exist
**/
public static boolean isExistInstallDir(String strInstallDir) {
File id = new File(strInstallDir);
return id.exists();
}
/**
Create install target dir
@param strInstallDir The install target dir
@retval true - Install success
@retval false - Install fail
**/
public static boolean createInstallDir(String strInstallDir) {
File id = new File(strInstallDir);
try {
return id.mkdir();
} catch (Exception e) {
System.out.print(e.getMessage());
return false;
}
}
/**
Reserved
@return boolean
**/
public static boolean setSystemEnvironment() {
return true;
}
/**
Reserved
@return boolean
**/
public static boolean setToolChainPath() {
return true;
}
/**
Reserved
@return boolean
**/
public static boolean setToolChain() {
return true;
}
/**
Reserved
@return boolean
**/
public static boolean setFrameworkDatabase() {
return true;
}
/**
Delete setup files and directory
@param strPath The delete target dir
@retval true - Delete success
@retval false - Delete fail
**/
public static boolean delSetupPackage(String strPath) {
File f = new File(strPath);
try {
Tools.deleteFolder(f);
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
/**
@param strInstallDir The install target dir
@param strJarFile The install target file
@retval true - Install success
@retval false - Install fail
@throws IOException
**/
public static boolean installPackage(String strInstallDir, String strJarFile) throws IOException {
Log.log("Install Dir", strInstallDir);
Log.log("Jar File Path", strJarFile);
MdkPkg mp = new MdkPkg(strJarFile);
try {
mp.install(strInstallDir + System.getProperty("file.separator"));
return true;
} catch (Exception e) {
e.printStackTrace();
Log.log("Install Err", e.toString());
}
return false;
}
}

View File

@ -1,295 +0,0 @@
/** @file
The file is used to show a Finish page in the last step of setup
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.packaging.workspace.ui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import org.tianocore.packaging.common.ui.IFrame;
/**
The class is used to show a Finish page in the last step of setup
@since CreateMdkPkg 1.0
**/
public class Finish extends IFrame implements ActionListener {
///
/// Define class Serial Version UID
///
private static final long serialVersionUID = 9055339173915836187L;
//
// Define class members
//
private JPanel jContentPane = null;
private JTextArea jTextAreaTitle = null;
private JTextArea jTextAreaContent = null;
private JPanel jPanel = null;
private JButton jButtonFinish = null;
private JLabel jLabel = null;
private JLabel jLabel1 = null;
private JScrollPane jScrollPane = null;
private JTextArea jTextAreaComment = null;
private String strInstallDir = "";
/**
This method initializes jTextAreaTitle
@return javax.swing.JTextArea jTextAreaTitle
**/
private JTextArea getJTextAreaTitle() {
if (jTextAreaTitle == null) {
jTextAreaTitle = new JTextArea();
jTextAreaTitle.setLocation(new java.awt.Point(0, 0));
jTextAreaTitle.setText(" Click button \"Install\" to start installation");
jTextAreaTitle.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 14));
jTextAreaTitle.setEditable(false);
jTextAreaTitle.setSize(new java.awt.Dimension(495, 20));
}
return jTextAreaTitle;
}
/**
This method initializes jTextAreaContent
@return javax.swing.JTextArea jTextAreaContent
**/
private JTextArea getJTextAreaContent() {
if (jTextAreaContent == null) {
jTextAreaContent = new JTextArea();
jTextAreaContent.setLocation(new java.awt.Point(0, 20));
jTextAreaContent.setText("");
jTextAreaContent.setEditable(false);
jTextAreaContent.setSize(new java.awt.Dimension(495, 35));
}
return jTextAreaContent;
}
/**
This method initializes jPanel
@return javax.swing.JPanel jPanel
**/
private JPanel getJPanel() {
if (jPanel == null) {
jLabel1 = new JLabel();
jLabel1.setText("");
jLabel1.setLocation(new java.awt.Point(30, 40));
jLabel1.setSize(new java.awt.Dimension(435, 20));
jLabel = new JLabel();
jLabel.setText("");
jLabel.setLocation(new java.awt.Point(30, 15));
jLabel.setSize(new java.awt.Dimension(435, 20));
jPanel = new JPanel();
jPanel.setLayout(null);
jPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
jPanel.setSize(new java.awt.Dimension(494, 251));
jPanel.setLocation(new java.awt.Point(0, 55));
jPanel.add(jLabel, null);
jPanel.add(jLabel1, null);
jPanel.add(getJScrollPane(), null);
}
return jPanel;
}
/**
This method initializes jButtonFinish
@return javax.swing.JButton jButtonFinish
**/
private JButton getJButtonCancel() {
if (jButtonFinish == null) {
jButtonFinish = new JButton();
jButtonFinish.setText("Finish");
jButtonFinish.setBounds(new java.awt.Rectangle(360, 315, 90, 20));
jButtonFinish.setEnabled(true);
jButtonFinish.setSelected(false);
jButtonFinish.setMnemonic('C');
jButtonFinish.addActionListener(this);
}
return jButtonFinish;
}
/**
This method initializes jScrollPane
@return javax.swing.JScrollPane jScrollPane
**/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setLocation(new java.awt.Point(30, 65));
jScrollPane.setSize(new java.awt.Dimension(435, 180));
jScrollPane.setViewportView(getJTextAreaComment());
}
return jScrollPane;
}
/**
This method initializes jTextAreaComment
@return javax.swing.JTextArea jTextAreaComment
**/
private JTextArea getJTextAreaComment() {
if (jTextAreaComment == null) {
jTextAreaComment = new JTextArea();
jTextAreaComment.setEditable(false);
jTextAreaComment.setLineWrap(true);
jTextAreaComment.setWrapStyleWord(false);
}
return jTextAreaComment;
}
/**
Main class, used for test
@param args
**/
public static void main(String[] args) {
Finish f = new Finish();
f.setVisible(true);
}
/**
This is the override constructor
@param InstallDir The install target dir
**/
public Finish(String InstallDir) {
super();
this.strInstallDir = InstallDir;
init();
}
/**
This is the default constructor
**/
public Finish() {
super();
init();
}
/**
This method initializes this
**/
private void init() {
this.setSize(500, 390);
this.setContentPane(getJContentPane());
this.setTitle("Setup - Installing");
this.centerWindow();
this.getRootPane().setDefaultButton(jButtonFinish);
switchFinish();
}
/**
This method initializes jContentPane
@return javax.swing.JPanel jContentPane
**/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
jContentPane.add(getJTextAreaTitle(), null);
jContentPane.add(getJTextAreaContent(), null);
jContentPane.add(getJPanel(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
Object obj = arg0.getSource();
if (obj == jButtonFinish) {
this.dispose();
System.exit(0);
}
}
/**
Change all message values to Finish contents.
**/
private void switchFinish() {
this.setTitle("Setup - Finish");
jTextAreaTitle.setText(" Congratulations");
jTextAreaContent.setText(" Your workspace was installed!");
jLabel.setText("The MDK package was installed successfully");
jLabel1.setText("Now you can start the trip with EFI");
jTextAreaComment.setText("Please add \"WORKSPACE=" + this.strInstallDir
+ "\" into your system environment variable");
jButtonFinish.setEnabled(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jButtonFinish.setText("Finish");
}
// private void switchInstall() {
// jTextAreaTitle.setText(" Installation is in process...");
// jLabel.setText("The MDK package was being installed...");
// jLabel1.setText("Just waiting for a second");
// jButtonFinish.setEnabled(false);
// jButtonFinish.setText("Finish");
// }
/* (non-Javadoc)
* @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
*
* Override windowClosing to exit directly
*
*/
public void windowClosing(WindowEvent arg0) {
this.dispose();
System.exit(0);
}
}

View File

@ -1,403 +0,0 @@
/** @file
The class is used to show a License Agreement page in
the process of setup
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.packaging.workspace.ui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import org.tianocore.packaging.common.ui.IFrame;
/**
The class is used to show a License Agreement page in
the process of setup
@since CreateMdkPkg 1.0
**/
public class LicenseAgreement extends IFrame implements ActionListener {
///
/// Define class Serial Version UID
///
private static final long serialVersionUID = 5507683268692334188L;
//
// Define class members
//
private JPanel jContentPane = null;
private JTextArea jTextArea = null;
private JTextArea jTextArea1 = null;
private JPanel jPanel = null;
private JButton jButtonBack = null;
private JButton jButtonNext = null;
private JButton jButtonCancel = null;
private JLabel jLabel = null;
private JRadioButton jRadioButtonAgree = null;
private JRadioButton jRadioButtonDisagree = null;
private JScrollPane jScrollPane = null;
private JTextArea jTextArea2 = null;
private JLabel jLabel1 = null;
private Welcome w = null;
private SelectDestinationDirectory sdd = null;
/**
This method initializes jTextArea
@return javax.swing.JTextArea jTextArea
**/
private JTextArea getJTextArea() {
if (jTextArea == null) {
jTextArea = new JTextArea();
jTextArea.setLocation(new java.awt.Point(0, 0));
jTextArea.setText(" License Agreement");
jTextArea.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 14));
jTextArea.setEditable(false);
jTextArea.setSize(new java.awt.Dimension(495, 20));
}
return jTextArea;
}
/**
This method initializes jTextArea1
@return javax.swing.JTextArea jTextArea1
**/
private JTextArea getJTextArea1() {
if (jTextArea1 == null) {
jTextArea1 = new JTextArea();
jTextArea1.setLocation(new java.awt.Point(0, 20));
jTextArea1.setText(" Please read the following important information before continuing.");
jTextArea1.setEditable(false);
jTextArea1.setSize(new java.awt.Dimension(495, 35));
}
return jTextArea1;
}
/**
This method initializes jPanel
@return javax.swing.JPanel jPanel
**/
private JPanel getJPanel() {
if (jPanel == null) {
jLabel1 = new JLabel();
jLabel1.setText(" this agreement before continuing with the installation.");
jLabel1.setLocation(new java.awt.Point(30, 35));
jLabel1.setSize(new java.awt.Dimension(435, 20));
jLabel = new JLabel();
jLabel.setText("Please read the following License Agreement. You must accept the terms of");
jLabel.setLocation(new java.awt.Point(30, 15));
jLabel.setSize(new java.awt.Dimension(435, 20));
jPanel = new JPanel();
jPanel.setLayout(null);
jPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
jPanel.setSize(new java.awt.Dimension(494, 251));
jPanel.setLocation(new java.awt.Point(0, 55));
jPanel.add(jLabel, null);
jPanel.add(getJRadioButtonAgree(), null);
jPanel.add(getJRadioButtonDisagree(), null);
jPanel.add(getJScrollPane(), null);
jPanel.add(jLabel1, null);
}
return jPanel;
}
/**
This method initializes jButtonBack
@return javax.swing.JButton jButtonBack
**/
private JButton getJButtonBack() {
if (jButtonBack == null) {
jButtonBack = new JButton();
jButtonBack.setText("Back");
jButtonBack.setSize(new java.awt.Dimension(90, 20));
jButtonBack.setLocation(new java.awt.Point(200, 315));
jButtonBack.setMnemonic('B');
jButtonBack.addActionListener(this);
}
return jButtonBack;
}
/**
This method initializes jButtonNext
@return javax.swing.JButton jButtonNext
**/
private JButton getJButtonNext() {
if (jButtonNext == null) {
jButtonNext = new JButton();
jButtonNext.setText("Next");
jButtonNext.setBounds(new java.awt.Rectangle(292, 315, 90, 20));
jButtonNext.setEnabled(false);
jButtonNext.setMnemonic('N');
jButtonNext.addActionListener(this);
}
return jButtonNext;
}
/**
This method initializes jButtonCancel
@return javax.swing.JButton jButtonCancel
**/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setText("Cancel");
jButtonCancel.setBounds(new java.awt.Rectangle(390, 315, 90, 20));
jButtonCancel.setMnemonic('C');
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
/**
This method initializes jRadioButtonAgree
@return javax.swing.JRadioButton jRadioButtonAgree
**/
private JRadioButton getJRadioButtonAgree() {
if (jRadioButtonAgree == null) {
jRadioButtonAgree = new JRadioButton();
jRadioButtonAgree.setText("I accept the agreement");
jRadioButtonAgree.setLocation(new java.awt.Point(30, 200));
jRadioButtonAgree.setSize(new java.awt.Dimension(156, 19));
jRadioButtonAgree.addActionListener(this);
}
return jRadioButtonAgree;
}
/**
This method initializes jRadioButtonDisagree
@return javax.swing.JRadioButton jRadioButtonDisagree
**/
private JRadioButton getJRadioButtonDisagree() {
if (jRadioButtonDisagree == null) {
jRadioButtonDisagree = new JRadioButton();
jRadioButtonDisagree.setText("I do not accept the agreement");
jRadioButtonDisagree.setLocation(new java.awt.Point(30, 220));
jRadioButtonDisagree.setSize(new java.awt.Dimension(248, 19));
jRadioButtonDisagree.addActionListener(this);
}
return jRadioButtonDisagree;
}
/**
This method initializes jScrollPane
@return javax.swing.JScrollPane jScrollPane
**/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setSize(new java.awt.Dimension(435, 140));
jScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
jScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
jScrollPane.setViewportView(getJTextArea2());
jScrollPane.setLocation(new java.awt.Point(30, 55));
}
return jScrollPane;
}
/**
This method initializes jTextArea2
@return javax.swing.JTextArea jTextArea2
**/
private JTextArea getJTextArea2() {
if (jTextArea2 == null) {
jTextArea2 = new JTextArea();
jTextArea2.setEditable(false);
jTextArea2.setWrapStyleWord(false);
jTextArea2.setLineWrap(true);
jTextArea2.setText("Copyright (c) 2006, Intel Corp.\n"
+ "All rights reserved. This program and the accompanying materials "
+ "are licensed and made available under the terms and conditions of the BSD License "
+ "which may be found at http://opensource.org/licenses/bsd-license.php\n\n\n"
+ "THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN \"AS IS\" BASIS, "
+ "WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.");
}
return jTextArea2;
}
/**
Main class, used for test
@param args
**/
public static void main(String[] args) {
LicenseAgreement la = new LicenseAgreement();
la.setVisible(true);
}
/**
This is the default constructor
**/
public LicenseAgreement() {
super();
init();
}
/**
This is the override constructor
@param welcome The input data of Welcome
**/
public LicenseAgreement(Welcome welcome) {
super();
init();
w = welcome;
}
/**
This method initializes this
**/
private void init() {
this.setSize(500, 390);
this.setContentPane(getJContentPane());
this.setTitle("Setup - License Agreement");
this.centerWindow();
this.getRootPane().setDefaultButton(jButtonNext);
}
/**
This method initializes jContentPane
@return javax.swing.JPanel jContentPane
**/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
jContentPane.add(getJTextArea(), null);
jContentPane.add(getJTextArea1(), null);
jContentPane.add(getJPanel(), null);
jContentPane.add(getJButtonBack(), null);
jContentPane.add(getJButtonNext(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
Object obj = arg0.getSource();
//
// Disable button next when select jRadioButtonDisagree
//
if (obj == jRadioButtonDisagree) {
if (jRadioButtonDisagree.isSelected()) {
jRadioButtonAgree.setSelected(false);
jButtonNext.setEnabled(false);
jButtonNext.setFocusable(false);
}
if (!jRadioButtonAgree.isSelected() && !jRadioButtonDisagree.isSelected()) {
jRadioButtonDisagree.setSelected(true);
}
}
//
// Enable button next when select jRadioButtonAgree
//
if (obj == jRadioButtonAgree) {
if (jRadioButtonAgree.isSelected()) {
jRadioButtonDisagree.setSelected(false);
jButtonNext.setEnabled(true);
jButtonNext.setFocusable(true);
}
if (!jRadioButtonAgree.isSelected() && !jRadioButtonDisagree.isSelected()) {
jRadioButtonAgree.setSelected(true);
}
}
if (obj == jButtonBack) {
this.setVisible(false);
w.setVisible(true);
}
//
// Show next page when click button Next
//
if (obj == jButtonNext) {
if (sdd == null) {
sdd = new SelectDestinationDirectory(this);
}
this.setVisible(false);
sdd.setVisible(true);
}
if (obj == jButtonCancel) {
this.onExit();
}
}
/* (non-Javadoc)
* @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
*
* Override windowClosing to show confirm quit dialog
*
*/
public void windowClosing(WindowEvent arg0) {
this.onExit();
}
}

View File

@ -1,469 +0,0 @@
/** @file
The file is used to show a Select Destination Directory page in
the process of setup
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.packaging.workspace.ui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import org.tianocore.common.Log;
import org.tianocore.packaging.common.ui.IFrame;
import org.tianocore.packaging.workspace.command.InstallWorkspace;
/**
The class is used to show a Select Destination Directory page in
the process of setup
@since CreateMdkPkg 1.0
**/
public class SelectDestinationDirectory extends IFrame implements ActionListener {
///
/// Define class Serial Version UID
///
private static final long serialVersionUID = -2924500118774744205L;
//
// Define class members
//
private JPanel jContentPane = null;
private JTextArea jTextArea = null;
private JTextArea jTextArea1 = null;
private JPanel jPanel = null;
private JButton jButtonBack = null;
private JButton jButtonNext = null;
private JButton jButtonCancel = null;
private JLabel jLabel = null;
private JLabel jLabel1 = null;
private JTextField jTextFieldInstallDir = null;
private JButton jButtonBrowse = null;
private JLabel jLabel2 = null;
private LicenseAgreement la = null;
/**
This method initializes jTextArea
@return javax.swing.JTextArea jTextArea
**/
private JTextArea getJTextArea() {
if (jTextArea == null) {
jTextArea = new JTextArea();
jTextArea.setLocation(new java.awt.Point(0, 0));
jTextArea.setText(" Select Destination Directory");
jTextArea.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 14));
jTextArea.setEditable(false);
jTextArea.setSize(new java.awt.Dimension(495, 20));
}
return jTextArea;
}
/**
This method initializes jTextArea1
@return javax.swing.JTextArea jTextArea1
**/
private JTextArea getJTextArea1() {
if (jTextArea1 == null) {
jTextArea1 = new JTextArea();
jTextArea1.setLocation(new java.awt.Point(0, 20));
jTextArea1.setText(" Where should MDK package be installed?");
jTextArea1.setEditable(false);
jTextArea1.setSize(new java.awt.Dimension(495, 35));
}
return jTextArea1;
}
/**
This method initializes jPanel
@return javax.swing.JPanel jPanel
**/
private JPanel getJPanel() {
if (jPanel == null) {
jLabel2 = new JLabel();
jLabel2.setText("At least 10 MB of free disk space is required");
jLabel2.setLocation(new java.awt.Point(30, 225));
jLabel2.setSize(new java.awt.Dimension(290, 20));
jLabel1 = new JLabel();
jLabel1.setText("To continue, click Next. If you wuold like to select different folder, click Browse.");
jLabel1.setLocation(new java.awt.Point(30, 55));
jLabel1.setSize(new java.awt.Dimension(435, 20));
jLabel = new JLabel();
jLabel.setText("Setup will install MDK package into the following folders:");
jLabel.setLocation(new java.awt.Point(30, 15));
jLabel.setSize(new java.awt.Dimension(435, 20));
jPanel = new JPanel();
jPanel.setLayout(null);
jPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
jPanel.setSize(new java.awt.Dimension(494, 251));
jPanel.setLocation(new java.awt.Point(0, 55));
jPanel.add(jLabel, null);
jPanel.add(jLabel1, null);
jPanel.add(getJTextField(), null);
jPanel.add(getJButtonBrowse(), null);
jPanel.add(jLabel2, null);
}
return jPanel;
}
/**
This method initializes jButtonBack
@return javax.swing.JButton jButtonBack
**/
private JButton getJButtonBack() {
if (jButtonBack == null) {
jButtonBack = new JButton();
jButtonBack.setText("Back");
jButtonBack.setSize(new java.awt.Dimension(90, 20));
jButtonBack.setLocation(new java.awt.Point(200, 315));
jButtonBack.setMnemonic('B');
jButtonBack.addActionListener(this);
}
return jButtonBack;
}
/**
This method initializes jButtonNext
@return javax.swing.JButton jButtonNext
**/
private JButton getJButtonNext() {
if (jButtonNext == null) {
jButtonNext = new JButton();
jButtonNext.setText("Next");
jButtonNext.setBounds(new java.awt.Rectangle(292, 315, 90, 20));
jButtonNext.setEnabled(true);
jButtonNext.setMnemonic('N');
jButtonNext.addActionListener(this);
}
return jButtonNext;
}
/**
This method initializes jButtonCancel
@return javax.swing.JButton jButtonCancel
**/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setText("Cancel");
jButtonCancel.setBounds(new java.awt.Rectangle(390, 315, 90, 20));
jButtonCancel.setMnemonic('C');
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
/**
This method initializes jTextFieldInstallDir
@return javax.swing.JTextField jTextFieldInstallDir
**/
private JTextField getJTextField() {
if (jTextFieldInstallDir == null) {
jTextFieldInstallDir = new JTextField();
jTextFieldInstallDir.setLocation(new java.awt.Point(30, 90));
jTextFieldInstallDir.setSize(new java.awt.Dimension(320, 20));
jTextFieldInstallDir.setText("C:\\MyWorkspace");
}
return jTextFieldInstallDir;
}
/**
This method initializes jButtonBrowse
@return javax.swing.JButton jButtonBrowse
**/
private JButton getJButtonBrowse() {
if (jButtonBrowse == null) {
jButtonBrowse = new JButton();
jButtonBrowse.setText("Browse");
jButtonBrowse.setSize(new java.awt.Dimension(90, 20));
jButtonBrowse.setLocation(new java.awt.Point(370, 90));
jButtonBrowse.addActionListener(this);
}
return jButtonBrowse;
}
/**
Main class, used for test
@param args
**/
public static void main(String[] args) {
SelectDestinationDirectory sdd = new SelectDestinationDirectory();
sdd.setVisible(true);
}
/**
This is the default constructor
**/
public SelectDestinationDirectory() {
super();
init();
}
/**
This is the override constructor
@param licenseagreement The input data of licenseagreement
**/
public SelectDestinationDirectory(LicenseAgreement licenseagreement) {
super();
init();
la = licenseagreement;
}
/**
This method initializes this
**/
private void init() {
this.setSize(500, 390);
this.setTitle("Setup - Select Destination Directory");
this.setContentPane(getJContentPane());
this.centerWindow();
this.getRootPane().setDefaultButton(jButtonNext);
}
/**
This method initializes jContentPane
@return javax.swing.JPanel jContentPane
**/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
jContentPane.add(getJTextArea(), null);
jContentPane.add(getJTextArea1(), null);
jContentPane.add(getJPanel(), null);
jContentPane.add(getJButtonBack(), null);
jContentPane.add(getJButtonNext(), null);
jContentPane.add(getJButtonCancel(), null);
}
return jContentPane;
}
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
Object obj = arg0.getSource();
if (obj == jButtonBack) {
this.setVisible(false);
la.setVisible(true);
}
//
// Show next page if click button Next
//
if (obj == jButtonNext) {
if (createWorkspace(jTextFieldInstallDir.getText())) {
if (initWorkspace(jTextFieldInstallDir.getText())) {
this.setVisible(false);
Finish f = new Finish(jTextFieldInstallDir.getText());
f.setVisible(true);
}
}
}
if (obj == jButtonCancel) {
this.onExit();
}
if (obj == jButtonBrowse) {
JFileChooser fc = new JFileChooser();
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int result = fc.showOpenDialog(new JPanel());
if (result == JFileChooser.APPROVE_OPTION) {
jTextFieldInstallDir.setText(fc.getCurrentDirectory().toString() + System.getProperty("file.separator")
+ fc.getSelectedFile().getName());
}
}
}
/**
Create workspace to target dir
@param strInstallDir The install target dir
@retval true - Create success
@retval false - Create fail
**/
private boolean createWorkspace(String strInstallDir) {
boolean bolCreateDirectory = true;
int intResult;
//
//Check if the Install Dir exists
//
Log.log("is Exist Install Dir");
if (InstallWorkspace.isExistInstallDir(strInstallDir)) {
intResult = JOptionPane.showConfirmDialog(null, strInstallDir + " already exists, continue anyway?",
"Override", JOptionPane.YES_NO_OPTION);
if (intResult != JOptionPane.YES_OPTION) {
return false;
} else {
bolCreateDirectory = false;
}
}
//
//Create the directory
//
Log.log("Create Directory");
if (bolCreateDirectory) {
if (!InstallWorkspace.createInstallDir(strInstallDir)) {
intResult = JOptionPane.showConfirmDialog(null, "Cannot create direcotry " + strInstallDir
+ " in system. Click OK to exist.", "Error",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);
return false;
}
}
return true;
}
/**
Init created workspace
@param strInstallDir The dir of workspace
@retval true - Init Success
@retval false - Init fail
**/
private boolean initWorkspace(String strInstallDir) {
String strJarFile = System.getProperty("user.dir") + System.getProperty("file.separator") + "CreateMdkPkg.jar";
//
//Install package
//
Log.log("Install Package");
try {
if (!InstallWorkspace.installPackage(strInstallDir, strJarFile)) {
JOptionPane.showConfirmDialog(null, "Cannot intall package in system. Click OK to exist.", "Error",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);
return false;
}
} catch (Exception e) {
e.printStackTrace();
}
//
//Update framework database
//
Log.log("Set Framework Database");
if (!InstallWorkspace.setFrameworkDatabase()) {
JOptionPane.showConfirmDialog(null, "Cannot create workspace database in system. Click OK to exist.",
"Error", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);
return false;
}
//
//Set System Environment
//
Log.log("Set System Environment");
if (!InstallWorkspace.setSystemEnvironment()) {
JOptionPane.showConfirmDialog(null, "Cannot set WORKSPACE variable in system. Click OK to exist.", "Error",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);
return false;
}
//
//Set Tool Chain Path
//
Log.log("Set Tool Chain Path");
if (!InstallWorkspace.setToolChainPath()) {
JOptionPane.showConfirmDialog(null, "Cannot set Tool Chain path variable in system. Click OK to exist.",
"Error", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);
return false;
}
//
//Install tool chain
//
Log.log("Set Tool Chain");
if (!InstallWorkspace.setToolChain()) {
JOptionPane.showConfirmDialog(null, "Cannot set Tool Chain in system. Click OK to exist.", "Error",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);
return false;
}
//
//Delete setup files
//
Log.log("Delete Setup Files");
try {
InstallWorkspace.delSetupPackage(strInstallDir + System.getProperty("file.separator") + "org");
} catch (Exception e) {
e.printStackTrace();
Log.log(e.getMessage());
}
return true;
}
/* (non-Javadoc)
* @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
*
* Override windowClosing to show confirm quit dialog
*
*/
public void windowClosing(WindowEvent arg0) {
this.onExit();
}
}

View File

@ -1,272 +0,0 @@
/** @file
The file is used to show a welcome page in the process of setup
Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.packaging.workspace.ui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import org.tianocore.packaging.common.ui.IFrame;
/**
The class is used to show a welcome page in the process of setup
@since CreateMdkPkg 1.0
**/
public class Welcome extends IFrame implements ActionListener {
///
/// Define class Serial Version UID
///
private static final long serialVersionUID = 8160041311175680637L;
//
// Define class members
//
private JPanel jContentPane = null;
private JPanel jPanel = null;
private JTextArea jTextArea = null;
private JTextArea jTextArea1 = null;
private JTextArea jTextArea2 = null;
private JTextArea jTextArea3 = null;
private JButton jButtonNext = null;
private JButton jButtonCancel = null;
private LicenseAgreement la = null;
/**
This method initializes jPanel
@return javax.swing.JPanel jPanel
**/
private JPanel getJPanel() {
if (jPanel == null) {
jPanel = new JPanel();
jPanel.setLayout(null);
jPanel.setSize(new java.awt.Dimension(495, 355));
jPanel.setLocation(new java.awt.Point(0, 0));
jPanel.add(getJTextArea(), null);
jPanel.add(getJTextArea1(), null);
jPanel.add(getJTextArea2(), null);
jPanel.add(getJTextArea3(), null);
jPanel.add(getJButtonNext(), null);
jPanel.add(getJButtonCancel(), null);
}
return jPanel;
}
/**
This method initializes jTextArea
@return javax.swing.JTextArea jTextArea
**/
private JTextArea getJTextArea() {
if (jTextArea == null) {
jTextArea = new JTextArea();
jTextArea.setFont(new java.awt.Font("Times New Roman", java.awt.Font.BOLD, 24));
jTextArea.setSize(new java.awt.Dimension(495, 70));
jTextArea.setLocation(new java.awt.Point(0, 0));
jTextArea.setEnabled(true);
jTextArea.setEditable(false);
jTextArea.setText("Welcome to the MDK Package Setup Wizard");
}
return jTextArea;
}
/**
This method initializes jTextArea1
@return javax.swing.JTextArea jTextArea1
**/
private JTextArea getJTextArea1() {
if (jTextArea1 == null) {
jTextArea1 = new JTextArea();
jTextArea1.setText("This will install MDK Package on your computer. ");
jTextArea1.setSize(new java.awt.Dimension(495, 40));
jTextArea1.setEnabled(true);
jTextArea1.setEditable(false);
jTextArea1.setLocation(new java.awt.Point(0, 70));
}
return jTextArea1;
}
/**
This method initializes jTextArea2
@return javax.swing.JTextArea jTextArea2
**/
private JTextArea getJTextArea2() {
if (jTextArea2 == null) {
jTextArea2 = new JTextArea();
jTextArea2.setSize(new java.awt.Dimension(495, 50));
jTextArea2
.setText("It is strongly recommended that you exit all other programs before running this installation program.");
jTextArea2.setLineWrap(true);
jTextArea2.setEnabled(true);
jTextArea2.setEditable(false);
jTextArea2.setLocation(new java.awt.Point(0, 110));
}
return jTextArea2;
}
/**
This method initializes jTextArea3
@return javax.swing.JTextArea jTextArea3
**/
private JTextArea getJTextArea3() {
if (jTextArea3 == null) {
jTextArea3 = new JTextArea();
jTextArea3.setBounds(new java.awt.Rectangle(0, 160, 495, 150));
jTextArea3.setEnabled(true);
jTextArea3.setEditable(false);
jTextArea3.setText("Click Nex to continue. Or click Cancel to exit Setup");
}
return jTextArea3;
}
/**
This method initializes jButtonNext
@return javax.swing.JButton jButtonNext
**/
private JButton getJButtonNext() {
if (jButtonNext == null) {
jButtonNext = new JButton();
jButtonNext.setText("Next");
jButtonNext.setSize(new java.awt.Dimension(90, 20));
jButtonNext.setLocation(new java.awt.Point(290, 320));
jButtonNext.setMnemonic('N');
jButtonNext.addActionListener(this);
}
return jButtonNext;
}
/**
This method initializes jButtonCancel
@return javax.swing.JButton jButtonCancel
**/
private JButton getJButtonCancel() {
if (jButtonCancel == null) {
jButtonCancel = new JButton();
jButtonCancel.setText("Cancel");
jButtonCancel.setSize(new java.awt.Dimension(90, 20));
jButtonCancel.setLocation(new java.awt.Point(390, 320));
jButtonCancel.setMnemonic('C');
jButtonCancel.addActionListener(this);
}
return jButtonCancel;
}
/**
Main class, used for test
@param args
**/
public static void main(String[] args) {
Welcome w = new Welcome();
w.setVisible(true);
}
/**
This is the default constructor
**/
public Welcome() {
super();
init();
}
/**
This method initializes this
**/
private void init() {
this.setSize(500, 390);
this.setContentPane(getJContentPane());
this.setTitle("Welcome");
this.centerWindow();
this.getRootPane().setDefaultButton(jButtonNext);
}
/**
This method initializes jContentPane
@return javax.swing.JPanel jContentPane
**/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getJPanel(), null);
}
return jContentPane;
}
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*
* Override actionPerformed to listen all actions
*
*/
public void actionPerformed(ActionEvent arg0) {
Object obj = arg0.getSource();
//
// Show next page if click button Next
//
if (obj == jButtonNext) {
if (la == null) {
la = new LicenseAgreement(this);
}
this.setVisible(false);
la.setVisible(true);
}
if (obj == jButtonCancel) {
this.onExit();
}
}
/* (non-Javadoc)
* @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
*
* Override windowClosing to show confirm quit dialog
*
*/
public void windowClosing(WindowEvent arg0) {
this.onExit();
}
}