private void buttonOKMouseDown(MouseEvent evt) {
Shell shell = new Shell(Display.getCurrent());
shell.setFocus();
//shell.setImage(image);
FileDialog dialog = new FileDialog(shell,
SWT.SAVE);
dialog.setFilterNames(new String[]{
"XML Documents"});
dialog.setFilterExtensions(new String[]{
"*.xml"}); // Wild
// cards
dialog.setFileName(".xml");
dialog.setText("Location to save the file");
String path = dialog.open();
FileOutputStream out;
try {
out = new FileOutputStream(path);
PrintStream newXML; // declare a print stream
// object
newXML = new PrintStream(out);
// Connect print stream to the output
// stream
/*
* now the convert method will simply
* convert and the o/p is put to file
* only after the user presses ok button
*/
//Write header
newXML.println("<?xml version=\"1.0\"?>");
//Start of the XML Data
String temp;
int length = dialog.getFileName().length();
temp = dialog.getFileName().substring(0, length - 4);
newXML.println("<" + temp + ">\n");
/*The row from A to L starts here*/