summaryrefslogtreecommitdiff
path: root/scripting/workben/installer
diff options
context:
space:
mode:
Diffstat (limited to 'scripting/workben/installer')
-rw-r--r--scripting/workben/installer/Banner.java15
-rw-r--r--scripting/workben/installer/ExceptionTraceHelper.java35
-rw-r--r--scripting/workben/installer/ExecCmd.java149
-rw-r--r--scripting/workben/installer/FileUpdater.java219
-rw-r--r--scripting/workben/installer/Final.java82
-rw-r--r--scripting/workben/installer/IdeFinal.java64
-rw-r--r--scripting/workben/installer/IdeUpdater.java77
-rw-r--r--scripting/workben/installer/IdeVersion.java147
-rw-r--r--scripting/workben/installer/IdeWelcome.java16
-rw-r--r--scripting/workben/installer/InstUtil.java248
-rw-r--r--scripting/workben/installer/InstallListener.java3
-rw-r--r--scripting/workben/installer/InstallWizard.java235
-rw-r--r--scripting/workben/installer/InstallationEvent.java12
-rw-r--r--scripting/workben/installer/LogStream.java44
-rw-r--r--scripting/workben/installer/NavPanel.java29
-rw-r--r--scripting/workben/installer/Register.java83
-rw-r--r--scripting/workben/installer/Version.java122
-rw-r--r--scripting/workben/installer/Welcome.java25
-rw-r--r--scripting/workben/installer/XmlUpdater.java238
-rw-r--r--scripting/workben/installer/ZipData.java19
20 files changed, 938 insertions, 924 deletions
diff --git a/scripting/workben/installer/Banner.java b/scripting/workben/installer/Banner.java
index aea91a2caebd..d9945acd7331 100644
--- a/scripting/workben/installer/Banner.java
+++ b/scripting/workben/installer/Banner.java
@@ -20,31 +20,26 @@ package installer;
import java.awt.*;
-public class Banner extends Canvas
-{
+public class Banner extends Canvas {
Image img;
- Banner()
- {
+ Banner() {
setBackground(Color.white);
img = Toolkit.getDefaultToolkit().createImage("sidebar.jpg");
}
@Override
- public void paint(Graphics g)
- {
+ public void paint(Graphics g) {
g.drawImage(img, 0, 0, Color.white, null);
g.dispose();
}
@Override
- public void update(Graphics g)
- {
+ public void update(Graphics g) {
super.update(g);
}
@Override
- public Dimension getPreferredSize()
- {
+ public Dimension getPreferredSize() {
return new Dimension(137, 358);
}
diff --git a/scripting/workben/installer/ExceptionTraceHelper.java b/scripting/workben/installer/ExceptionTraceHelper.java
index e0e5c92558da..ecde5e448072 100644
--- a/scripting/workben/installer/ExceptionTraceHelper.java
+++ b/scripting/workben/installer/ExceptionTraceHelper.java
@@ -21,36 +21,29 @@ import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
// class for propagating the exception stack traces across the Java/UNO bridge
-public class ExceptionTraceHelper
-{
- public static String getTrace( Exception e )
- {
+public class ExceptionTraceHelper {
+ public static String getTrace(Exception e) {
ByteArrayOutputStream baos = null;
PrintStream ps = null;
String result = "";
- try
- {
- baos = new ByteArrayOutputStream( 128 );
- ps = new PrintStream( baos );
- e.printStackTrace( ps );
- }
- finally
- {
- try
- {
- if ( baos != null )
- {
+
+ try {
+ baos = new ByteArrayOutputStream(128);
+ ps = new PrintStream(baos);
+ e.printStackTrace(ps);
+ } finally {
+ try {
+ if (baos != null) {
baos.close();
}
- if ( ps != null )
- {
+
+ if (ps != null) {
ps.close();
}
- }
- catch ( Exception excp )
- {
+ } catch (Exception excp) {
}
}
+
return result;
}
}
diff --git a/scripting/workben/installer/ExecCmd.java b/scripting/workben/installer/ExecCmd.java
index c812ae6229b7..e52a63aefac0 100644
--- a/scripting/workben/installer/ExecCmd.java
+++ b/scripting/workben/installer/ExecCmd.java
@@ -18,99 +18,88 @@
package installer;
import java.io.*;
-public class ExecCmd
-{
+public class ExecCmd {
- public boolean exec( String cmd, String[] env )
- {
- System.out.println("About to exectute " + cmd);
- final Process p;
- boolean result = false;
- try
- {
- Runtime rt = Runtime.getRuntime();
- p=rt.exec( cmd, env );
- new Thread(new Runnable() {
- public void run()
- {
- BufferedReader br_in = null;
- try
- {
- br_in = new BufferedReader(new InputStreamReader(p.getInputStream()));
- String buff = null;
- while ((buff = br_in.readLine()) != null)
- {
- System.out.println("Process out :" + buff);
- /*try
- {
- Thread.sleep(100);
- }
- catch(Exception e) {}*/
- }
- System.out.println("finished reading out");
- }
- catch (IOException ioe)
- {
+ public boolean exec(String cmd, String[] env) {
+ System.out.println("About to exectute " + cmd);
+ final Process p;
+ boolean result = false;
+
+ try {
+ Runtime rt = Runtime.getRuntime();
+ p = rt.exec(cmd, env);
+ new Thread(new Runnable() {
+ public void run() {
+ BufferedReader br_in = null;
+
+ try {
+ br_in = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String buff = null;
+
+ while ((buff = br_in.readLine()) != null) {
+ System.out.println("Process out :" + buff);
+ /*try
+ {
+ Thread.sleep(100);
+ }
+ catch(Exception e) {}*/
+ }
+
+ System.out.println("finished reading out");
+ } catch (IOException ioe) {
System.out.println("Exception caught printing javac result");
ioe.printStackTrace();
+ } finally {
+ if (br_in != null) {
+ try {
+ br_in.close();
+ } catch (Exception e) {} // nothing can be done
+ }
}
- finally
- {
- if ( br_in != null )
- {
- try
- {
- br_in.close();
- }
- catch( Exception e ) {} // nothing can be done
- }
- }
- } } ).start();
+ }
+ }).start();
new Thread(new Runnable() {
public void run() {
- BufferedReader br_err = null;
- try {
- br_err = new BufferedReader(new InputStreamReader(p.getErrorStream()));
- String buff = null;
- while ((buff = br_err.readLine()) != null) {
- System.out.println("Process err :" + buff);
- }
- System.out.println("finished reading err");
- } catch (IOException ioe) {
- System.out.println("Exception caught printing javac result");
- ioe.printStackTrace();
- }
- finally
- {
- if ( br_err != null )
- {
- try
- {
- br_err.close();
+ BufferedReader br_err = null;
+
+ try {
+ br_err = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+ String buff = null;
+
+ while ((buff = br_err.readLine()) != null) {
+ System.out.println("Process err :" + buff);
+ }
+
+ System.out.println("finished reading err");
+ } catch (IOException ioe) {
+ System.out.println("Exception caught printing javac result");
+ ioe.printStackTrace();
+ } finally {
+ if (br_err != null) {
+ try {
+ br_err.close();
+ } catch (Exception e) {} // nothing can be done
}
- catch( Exception e ) {} // nothing can be done
}
- }
- } }).start();
+ }
+ }).start();
int exitcode = p.waitFor();
- if ( exitcode != 0 )
- {
- System.out.println("cmd [" + cmd + "] failed" );
- result= false;
- }
- else
- {
+
+ if (exitcode != 0) {
+ System.out.println("cmd [" + cmd + "] failed");
+ result = false;
+ } else {
System.out.println("cmd [" + cmd + "] completed successfully");
- result= true;
+ result = true;
}
+ } catch (Exception e) {
+ System.out.println("Exception");
+ e.printStackTrace();
}
- catch (Exception e) {
- System.out.println("Exception");
- e.printStackTrace();
- }
- System.out.println("command complete");
- return result;
+
+ System.out.println("command complete");
+ return result;
}
}
diff --git a/scripting/workben/installer/FileUpdater.java b/scripting/workben/installer/FileUpdater.java
index 5c628dbd89c4..6ba73692ca99 100644
--- a/scripting/workben/installer/FileUpdater.java
+++ b/scripting/workben/installer/FileUpdater.java
@@ -26,141 +26,158 @@ public class FileUpdater {
- public static boolean updateScriptXLC( String installPath, JLabel statusLabel ) {
+ public static boolean updateScriptXLC(String installPath, JLabel statusLabel) {
- File in_file = null;
- File out_file = null;
- FileWriter out = null;
- int count = 0;
+ File in_file = null;
+ File out_file = null;
+ FileWriter out = null;
+ int count = 0;
+
+ try {
+ in_file = new File(installPath + File.separator + "user" + File.separator +
+ "basic" + File.separator + "script.xlc");
+
+ String[] xmlArray = new String[50];
try {
- in_file = new File( installPath+File.separator+"user"+File.separator+"basic"+File.separator+"script.xlc" );
+ BufferedReader reader = new BufferedReader(new FileReader(in_file));
+ count = -1;
- String[] xmlArray = new String[50];
- try {
- BufferedReader reader = new BufferedReader(new FileReader(in_file));
- count = -1;
- for (String s = reader.readLine(); s != null; s = reader.readLine()) { //</oor:node>
- count = count + 1;
- xmlArray[count] = s;
+ for (String s = reader.readLine(); s != null;
+ s = reader.readLine()) { //</oor:node>
+ count = count + 1;
+ xmlArray[count] = s;
+ }
+
+ reader.close();
+ } catch (IOException ioe) {
+ String message = "Error reading script.xlc, please view SFrameworkInstall.log.";
+ System.out.println(message);
+ ioe.printStackTrace();
+ statusLabel.setText(message);
+ return false;
}
- reader.close();
- }
- catch( IOException ioe ) {
- String message = "Error reading script.xlc, please view SFrameworkInstall.log.";
- System.out.println(message);
- ioe.printStackTrace();
- statusLabel.setText(message);
- return false;
- }
- in_file.delete();
+ in_file.delete();
- out_file = new File( installPath+File.separator+"user"+File.separator+"basic"+File.separator+"script.xlc" );
- out_file.createNewFile();
- out = new FileWriter( out_file );
+ out_file = new File(installPath + File.separator + "user" + File.separator +
+ "basic" + File.separator + "script.xlc");
+ out_file.createNewFile();
+ out = new FileWriter(out_file);
- //split the string into a string array with one line of xml in each element
- for(int i=0; i<count + 1; i++) {
- out.write(xmlArray[i]+"\n");
- if( ( xmlArray[i].indexOf( "<library:libraries xmlns:library" ) != -1 ) && ( xmlArray[i+1].indexOf( "ScriptBindingLibrary" ) == -1 ) ) {
- String opSys = System.getProperty("os.name");
- if (opSys.indexOf("Windows") != -1) {
- out.write(" <library:library library:name=\"ScriptBindingLibrary\" library:link=\"true\"/>\n" );
- }
- else {
- out.write(" <library:library library:name=\"ScriptBindingLibrary\" xlink:href=\"file://"+installPath+"/share/basic/ScriptBindingLibrary/script.xlb/\" xlink:type=\"simple\" library:link=\"true\"/>\n" );
- }
- }
+ //split the string into a string array with one line of xml in each element
+ for (int i = 0; i < count + 1; i++) {
+ out.write(xmlArray[i] + "\n");
+
+ if ((xmlArray[i].indexOf("<library:libraries xmlns:library") != -1)
+ && (xmlArray[i + 1].indexOf("ScriptBindingLibrary") == -1)) {
+ String opSys = System.getProperty("os.name");
+
+ if (opSys.indexOf("Windows") != -1) {
+ out.write(" <library:library library:name=\"ScriptBindingLibrary\" library:link=\"true\"/>\n");
+ } else {
+ out.write(" <library:library library:name=\"ScriptBindingLibrary\" xlink:href=\"file://"
+ + installPath +
+ "/share/basic/ScriptBindingLibrary/script.xlb/\" xlink:type=\"simple\" library:link=\"true\"/>\n");
+ }
}
}
- catch( Exception e ) {
- String message = "\nError updating script.xlc, please view SFrameworkInstall.log.";
+ } catch (Exception e) {
+ String message =
+ "\nError updating script.xlc, please view SFrameworkInstall.log.";
System.out.println(message);
e.printStackTrace();
statusLabel.setText(message);
return false;
+ } finally {
+ try {
+ out.close();
+ } catch (Exception e) {
+ System.out.println("Update Script.xlc Failed, please view SFrameworkInstall.log.");
+ e.printStackTrace();
+ System.err.println(e);
}
- finally {
- try {
- out.close();
- }
- catch(Exception e) {
- System.out.println("Update Script.xlc Failed, please view SFrameworkInstall.log.");
- e.printStackTrace();
- System.err.println(e);
- }
- }
+ }
+
return true;
- }// updateScriptXLC
+ }// updateScriptXLC
- public static boolean updateDialogXLC( String installPath, JLabel statusLabel ) {
- File in_file = null;
- File out_file = null;
- FileWriter out = null;
- int count = 0;
+ public static boolean updateDialogXLC(String installPath, JLabel statusLabel) {
+ File in_file = null;
+ File out_file = null;
+ FileWriter out = null;
+ int count = 0;
+
+ try {
+ in_file = new File(installPath + File.separator + "user" + File.separator +
+ "basic" + File.separator + "dialog.xlc");
+
+ String[] xmlArray = new String[50];
try {
- in_file = new File( installPath+File.separator+"user"+File.separator+"basic"+File.separator+"dialog.xlc" );
+ BufferedReader reader = new BufferedReader(new FileReader(in_file));
+ count = -1;
- String[] xmlArray = new String[50];
- try {
- BufferedReader reader = new BufferedReader(new FileReader(in_file));
- count = -1;
- for (String s = reader.readLine(); s != null; s = reader.readLine()) {
- count = count + 1;
- xmlArray[count] = s;
+ for (String s = reader.readLine(); s != null; s = reader.readLine()) {
+ count = count + 1;
+ xmlArray[count] = s;
+ }
+
+ reader.close();
+ } catch (IOException ioe) {
+
+ String message =
+ "\nError reading dialog.xlc, please view SFrameworkInstall.log.";
+ System.out.println(message);
+ statusLabel.setText(message);
+ return false;
}
- reader.close();
- }
- catch( IOException ioe ) {
- String message = "\nError reading dialog.xlc, please view SFrameworkInstall.log.";
- System.out.println(message);
- statusLabel.setText(message);
- return false;
- }
- in_file.delete();
+ in_file.delete();
- out_file = new File( installPath+File.separator+"user"+File.separator+"basic"+File.separator+"dialog.xlc" );
- out_file.createNewFile();
+ out_file = new File(installPath + File.separator + "user" + File.separator +
+ "basic" + File.separator + "dialog.xlc");
+ out_file.createNewFile();
- out = new FileWriter( out_file );
+ out = new FileWriter(out_file);
- //split the string into a string array with one line of xml in each element
- for(int i=0; i<count + 1; i++) {
- out.write(xmlArray[i]+"\n");
- if( ( xmlArray[i].indexOf( "<library:libraries xmlns:library" ) != -1 ) && ( xmlArray[i+1].indexOf( "ScriptBindingLibrary" ) == -1 ) ) {
- String opSys = System.getProperty("os.name");
- if (opSys.indexOf("Windows") != -1) {
- out.write(" <library:library library:name=\"ScriptBindingLibrary\" library:link=\"true\"/>\n" );
- }
- else {
- out.write(" <library:library library:name=\"ScriptBindingLibrary\" xlink:href=\"file://"+installPath+"/share/basic/ScriptBindingLibrary/dialog.xlb/\" xlink:type=\"simple\" library:link=\"true\"/>\n" );
- }
- }
+ //split the string into a string array with one line of xml in each element
+ for (int i = 0; i < count + 1; i++) {
+ out.write(xmlArray[i] + "\n");
+
+ if ((xmlArray[i].indexOf("<library:libraries xmlns:library") != -1)
+ && (xmlArray[i + 1].indexOf("ScriptBindingLibrary") == -1)) {
+ String opSys = System.getProperty("os.name");
+
+ if (opSys.indexOf("Windows") != -1) {
+ out.write(" <library:library library:name=\"ScriptBindingLibrary\" library:link=\"true\"/>\n");
+ } else {
+ out.write(" <library:library library:name=\"ScriptBindingLibrary\" xlink:href=\"file://"
+ + installPath +
+ "/share/basic/ScriptBindingLibrary/dialog.xlb/\" xlink:type=\"simple\" library:link=\"true\"/>\n");
+ }
}
}
- catch( Exception e ) {
- String message = "\nError updating dialog.xlc, please view SFrameworkInstall.log.";
+ } catch (Exception e) {
+ String message =
+ "\nError updating dialog.xlc, please view SFrameworkInstall.log.";
System.out.println(message);
e.printStackTrace();
statusLabel.setText(message);
return false;
+ } finally {
+ try {
+ out.close();
+ } catch (Exception e) {
+ System.out.println("Update dialog.xlc Failed, please view SFrameworkInstall.log.");
+ e.printStackTrace();
+ System.err.println(e);
}
- finally {
- try {
- out.close();
- }
- catch(Exception e) {
- System.out.println("Update dialog.xlc Failed, please view SFrameworkInstall.log.");
- e.printStackTrace();
- System.err.println(e);
- }
- }
+ }
+
return true;
- }// updateScriptXLC
+ }// updateScriptXLC
}
diff --git a/scripting/workben/installer/Final.java b/scripting/workben/installer/Final.java
index 640bd93d0054..b951537e8e0c 100644
--- a/scripting/workben/installer/Final.java
+++ b/scripting/workben/installer/Final.java
@@ -22,7 +22,8 @@ import java.awt.event.*;
import java.util.*;
import javax.swing.*;
-public class Final extends javax.swing.JPanel implements ActionListener, InstallListener {
+public class Final extends javax.swing.JPanel implements ActionListener,
+ InstallListener {
/** Creates new form Welcome */
public Final(InstallWizard wizard) {
@@ -67,10 +68,9 @@ public class Final extends javax.swing.JPanel implements ActionListener, Install
}
public void actionPerformed(ActionEvent e) {
- // navNext is "Install"
- if (e.getSource() == nav.navNext)
- {
- JProgressBar progressBar=new JProgressBar();
+ // navNext is "Install"
+ if (e.getSource() == nav.navNext) {
+ JProgressBar progressBar = new JProgressBar();
progressBar.setMaximum(10);
progressBar.setValue(0);
statusPanel.add(progressBar, java.awt.BorderLayout.SOUTH);
@@ -79,50 +79,50 @@ public class Final extends javax.swing.JPanel implements ActionListener, Install
nav.enableCancel(false);
ArrayList<?> locations = InstallWizard.getLocations();
// Returned 1
- String path=null;
- for (int i =0;i<locations.size();i++){
- path= (String)locations.get(i);
- xud = new XmlUpdater(path, statusLine,progressBar,InstallWizard.bNetworkInstall,InstallWizard.bBindingsInstall);
- xud.addInstallListener(this);
- InstallWizard.setInstallStarted(true);
- InstallWizard.setPatchedTypes(false);
- InstallWizard.setPatchedJava(false);
- InstallWizard.setPatchedRDB(false);
- xud.start();
+ String path = null;
+
+ for (int i = 0; i < locations.size(); i++) {
+ path = (String)locations.get(i);
+ xud = new XmlUpdater(path, statusLine, progressBar,
+ InstallWizard.bNetworkInstall, InstallWizard.bBindingsInstall);
+ xud.addInstallListener(this);
+ InstallWizard.setInstallStarted(true);
+ InstallWizard.setPatchedTypes(false);
+ InstallWizard.setPatchedJava(false);
+ InstallWizard.setPatchedRDB(false);
+ xud.start();
}
}
- // set to "Exit" at end of installation process
- if (e.getSource() == nav.navCancel) {
- int answer = JOptionPane.showConfirmDialog(wizard, "Are you sure you want to exit?");
- if (answer == JOptionPane.YES_OPTION)
- {
- wizard.exitForm();
- }
- else
- {
- return;
+ // set to "Exit" at end of installation process
+ if (e.getSource() == nav.navCancel) {
+ int answer = JOptionPane.showConfirmDialog(wizard,
+ "Are you sure you want to exit?");
+
+ if (answer == JOptionPane.YES_OPTION) {
+ wizard.exitForm();
+ } else {
+ return;
+ }
}
- }
}// actionPerformed
public void installationComplete(InstallationEvent ev) {
- if( InstUtil.hasNetbeansInstallation() ) {
- nav.removeCancelListener(this);
- nav.setCancelListener(nav);
- nav.navCancel.setText("Finish");
- nav.enableIDE(true);
- nav.enableCancel(true);
- xud = null;
- }
- else {
- nav.removeCancelListener(this);
- nav.setCancelListener(nav);
- nav.navCancel.setText("Finish");
- nav.enableCancel(true);
- xud = null;
- }
+ if (InstUtil.hasNetbeansInstallation()) {
+ nav.removeCancelListener(this);
+ nav.setCancelListener(nav);
+ nav.navCancel.setText("Finish");
+ nav.enableIDE(true);
+ nav.enableCancel(true);
+ xud = null;
+ } else {
+ nav.removeCancelListener(this);
+ nav.setCancelListener(nav);
+ nav.navCancel.setText("Finish");
+ nav.enableCancel(true);
+ xud = null;
+ }
}
// Variables declaration - do not modify//GEN-BEGIN:variables
diff --git a/scripting/workben/installer/IdeFinal.java b/scripting/workben/installer/IdeFinal.java
index 33612f1907ef..93159b7b4e2b 100644
--- a/scripting/workben/installer/IdeFinal.java
+++ b/scripting/workben/installer/IdeFinal.java
@@ -22,13 +22,14 @@ import java.awt.event.*;
import java.util.*;
import javax.swing.*;
-public class IdeFinal extends javax.swing.JPanel implements ActionListener, InstallListener {
+public class IdeFinal extends javax.swing.JPanel implements ActionListener,
+ InstallListener {
/** Creates new form Welcome */
public IdeFinal(InstallWizard wizard) {
this.wizard = wizard;
setBackground(java.awt.Color.white);
- ideupdater = null;
+ ideupdater = null;
initComponents();
}
@@ -39,7 +40,7 @@ public class IdeFinal extends javax.swing.JPanel implements ActionListener, Inst
*/
private void initComponents() {//GEN-BEGIN:initComponents
statusPanel = new javax.swing.JPanel();
- statusPanel.setBackground(java.awt.Color.white);
+ statusPanel.setBackground(java.awt.Color.white);
statusLine = new javax.swing.JLabel("Ready", javax.swing.JLabel.CENTER);
setLayout(new java.awt.BorderLayout());
@@ -50,12 +51,12 @@ public class IdeFinal extends javax.swing.JPanel implements ActionListener, Inst
statusPanel.add(statusLine, java.awt.BorderLayout.CENTER);
add(statusPanel, java.awt.BorderLayout.CENTER);
- nav = new NavPanel(wizard, true, true, true, InstallWizard.IDEVERSIONS, "");
- nav.setNextListener(this);
- nav.removeCancelListener(nav);
- nav.setCancelListener(this);
- nav.navNext.setText("Install");
- add(nav, java.awt.BorderLayout.SOUTH);
+ nav = new NavPanel(wizard, true, true, true, InstallWizard.IDEVERSIONS, "");
+ nav.setNextListener(this);
+ nav.removeCancelListener(nav);
+ nav.setCancelListener(this);
+ nav.navNext.setText("Install");
+ add(nav, java.awt.BorderLayout.SOUTH);
}//GEN-END:initComponents
@Override
@@ -64,10 +65,9 @@ public class IdeFinal extends javax.swing.JPanel implements ActionListener, Inst
}
public void actionPerformed(ActionEvent e) {
- // navNext is "Install"
- if (e.getSource() == nav.navNext)
- {
- JProgressBar progressBar=new JProgressBar();
+ // navNext is "Install"
+ if (e.getSource() == nav.navNext) {
+ JProgressBar progressBar = new JProgressBar();
progressBar.setMaximum(10);
progressBar.setValue(0);
statusPanel.add(progressBar, java.awt.BorderLayout.SOUTH);
@@ -76,29 +76,29 @@ public class IdeFinal extends javax.swing.JPanel implements ActionListener, Inst
nav.enableCancel(false);
ArrayList<?> locations = InstallWizard.getLocations();
// Returned 1
- String path=null;
- for (int i =0;i<locations.size();i++){
- path= (String)locations.get(i);
-
- ideupdater = new IdeUpdater( path, statusLine, progressBar );
- ideupdater.addInstallListener(this);
- InstallWizard.setInstallStarted(true);
- ideupdater.start();
+ String path = null;
+
+ for (int i = 0; i < locations.size(); i++) {
+ path = (String)locations.get(i);
+
+ ideupdater = new IdeUpdater(path, statusLine, progressBar);
+ ideupdater.addInstallListener(this);
+ InstallWizard.setInstallStarted(true);
+ ideupdater.start();
}
}
- // set to "Exit" at end of installation process
- if (e.getSource() == nav.navCancel) {
- int answer = JOptionPane.showConfirmDialog(wizard, "Are you sure you want to exit?");
- if (answer == JOptionPane.YES_OPTION)
- {
- wizard.exitForm();
- }
- else
- {
- return;
+ // set to "Exit" at end of installation process
+ if (e.getSource() == nav.navCancel) {
+ int answer = JOptionPane.showConfirmDialog(wizard,
+ "Are you sure you want to exit?");
+
+ if (answer == JOptionPane.YES_OPTION) {
+ wizard.exitForm();
+ } else {
+ return;
+ }
}
- }
}// actionPerformed
diff --git a/scripting/workben/installer/IdeUpdater.java b/scripting/workben/installer/IdeUpdater.java
index b35b519abbe3..b0ec0cd35cbf 100644
--- a/scripting/workben/installer/IdeUpdater.java
+++ b/scripting/workben/installer/IdeUpdater.java
@@ -47,70 +47,65 @@ public class IdeUpdater extends Thread {
if (!installPath.endsWith(File.separator))
installPath += File.separator;
- File netbeansLauncher = new File( installPath + "bin" );
+ File netbeansLauncher = new File(installPath + "bin");
- if( netbeansLauncher.isDirectory() ) {
- isNetbeansPath = true;
- installPath = installPath +"modules" + File.separator;
- }
+ if (netbeansLauncher.isDirectory()) {
+ isNetbeansPath = true;
+ installPath = installPath + "modules" + File.separator;
+ }
- System.out.println( "IdeUpdater installPath is " + installPath + " isNetbeansPath is " + isNetbeansPath );
+ System.out.println("IdeUpdater installPath is " + installPath +
+ " isNetbeansPath is " + isNetbeansPath);
this.installPath = installPath;
this.statusLabel = statusLabel;
- listeners = new ArrayList<InstallListener>();
- threadSuspended = false;
- progressBar=pBar;
- progressBar.setStringPainted(true);
+ listeners = new ArrayList<InstallListener>();
+ threadSuspended = false;
+ progressBar = pBar;
+ progressBar.setStringPainted(true);
}// XmlUpdater
@Override
public void run() {
- internalThread = Thread.currentThread();
+ internalThread = Thread.currentThread();
- progressBar.setString("Unzipping Required Files");
+ progressBar.setString("Unzipping Required Files");
ZipData zd = new ZipData();
- // Adding IDE support
- if( isNetbeansPath ) {
- if (!zd.extractEntry("ide/office.jar",installPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
- }
- else {
- if (!zd.extractEntry("ide/idesupport.jar",installPath, statusLabel))
- {
- onInstallComplete();
- return;
- }
- if (!zd.extractEntry("ide/OfficeScripting.jar",installPath, statusLabel))
- {
- onInstallComplete();
- return;
+ // Adding IDE support
+ if (isNetbeansPath) {
+ if (!zd.extractEntry("ide/office.jar", installPath, statusLabel)) {
+ onInstallComplete();
+ return;
+ }
+ } else {
+ if (!zd.extractEntry("ide/idesupport.jar", installPath, statusLabel)) {
+ onInstallComplete();
+ return;
+ }
+
+ if (!zd.extractEntry("ide/OfficeScripting.jar", installPath, statusLabel)) {
+ onInstallComplete();
+ return;
+ }
}
- }
- statusLabel.setText("Installation Complete");
- progressBar.setString("Installation Complete");
- progressBar.setValue(10);
- onInstallComplete();
+ statusLabel.setText("Installation Complete");
+ progressBar.setString("Installation Complete");
+ progressBar.setValue(10);
+ onInstallComplete();
}// run
- public void addInstallListener(InstallListener listener)
- {
+ public void addInstallListener(InstallListener listener) {
listeners.add(listener);
}// addInstallListener
- private void onInstallComplete()
- {
- for( InstallListener l : listeners)
- {
+ private void onInstallComplete() {
+ for (InstallListener l : listeners) {
l.installationComplete(null);
}
}// onInstallComplete
diff --git a/scripting/workben/installer/IdeVersion.java b/scripting/workben/installer/IdeVersion.java
index ab50752e2cd4..3a7cc5a485a4 100644
--- a/scripting/workben/installer/IdeVersion.java
+++ b/scripting/workben/installer/IdeVersion.java
@@ -26,12 +26,13 @@ import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
-public class IdeVersion extends javax.swing.JPanel implements ActionListener, TableModelListener {
+public class IdeVersion extends javax.swing.JPanel implements ActionListener,
+ TableModelListener {
/** Creates new form Welcome */
public IdeVersion(InstallWizard wizard) {
- this.wizard=wizard;
- setBackground(Color.white);
+ this.wizard = wizard;
+ setBackground(Color.white);
initComponents();
}
@@ -46,47 +47,49 @@ public class IdeVersion extends javax.swing.JPanel implements ActionListener, Ta
setLayout(new BorderLayout());
- try {
- Properties netbeansProps = InstUtil.getNetbeansLocation();
- Properties ideProps = new Properties();
- if(netbeansProps!=null )
- {
+ try {
+ Properties netbeansProps = InstUtil.getNetbeansLocation();
+ Properties ideProps = new Properties();
+
+ if (netbeansProps != null) {
System.out.println("**** Found netbeans install");
- for( int n = 0; n < netbeansProps.size(); n++ ) {
- for( int v = 0; v < InstUtil.versions.length; v++ ) {
- System.out.println("n: " +n+" v: " +v);
- String key = InstUtil.versions[v];
- System.out.println("It got here1");
- String path = null;
- if ( (path = netbeansProps.getProperty(key) ) != null ) {
- ideProps.put(key, path);
+
+ for (int n = 0; n < netbeansProps.size(); n++) {
+ for (int v = 0; v < InstUtil.versions.length; v++) {
+ System.out.println("n: " + n + " v: " + v);
+ String key = InstUtil.versions[v];
+ System.out.println("It got here1");
+ String path = null;
+
+ if ((path = netbeansProps.getProperty(key)) != null) {
+ ideProps.put(key, path);
+ }
+ }
}
}
- }
- }
- props = ideProps;
- }
- catch (Exception e) {
+
+ props = ideProps;
+ } catch (Exception e) {
System.err.println("Exception thrown in initComponents");
}
- tableModel = new MyTableModelIDE (props, InstUtil.versions);
+ tableModel = new MyTableModelIDE(props, InstUtil.versions);
- if (tableModel.getRowCount() == 0)
- {
- JOptionPane.showMessageDialog(this, "No compatible IDEs were found.", "Invalid versions", JOptionPane.ERROR_MESSAGE);
- }
+ if (tableModel.getRowCount() == 0) {
+ JOptionPane.showMessageDialog(this, "No compatible IDEs were found.",
+ "Invalid versions", JOptionPane.ERROR_MESSAGE);
+ }
tableModel.addTableModelListener(this);
JTable tableVersions = new JTable(tableModel) {
@Override
- public String getToolTipText(MouseEvent event)
- {
- int col = columnAtPoint( event.getPoint() );
+ public String getToolTipText(MouseEvent event) {
+ int col = columnAtPoint(event.getPoint());
+
if (col != 2)
return null;
- int row = rowAtPoint( event.getPoint() );
+ int row = rowAtPoint(event.getPoint());
Object o = getValueAt(row, col);
if (o == null)
@@ -99,14 +102,14 @@ public class IdeVersion extends javax.swing.JPanel implements ActionListener, Ta
}
@Override
- public Point getToolTipLocation(MouseEvent event)
- {
- int col = columnAtPoint( event.getPoint() );
+ public Point getToolTipLocation(MouseEvent event) {
+ int col = columnAtPoint(event.getPoint());
+
if (col != 2)
return null;
- int row = rowAtPoint( event.getPoint() );
- Object o = getValueAt(row,col);
+ int row = rowAtPoint(event.getPoint());
+ Object o = getValueAt(row, col);
if (o == null)
return null;
@@ -115,7 +118,7 @@ public class IdeVersion extends javax.swing.JPanel implements ActionListener, Ta
return null;
Point pt = getCellRect(row, col, true).getLocation();
- pt.translate(-1,-2);
+ pt.translate(-1, -2);
return pt;
}
};
@@ -123,7 +126,7 @@ public class IdeVersion extends javax.swing.JPanel implements ActionListener, Ta
JScrollPane scroll = new JScrollPane(tableVersions);
tableVersions.setPreferredSize(
- new Dimension(InstallWizard.DEFWIDTH,InstallWizard.DEFHEIGHT));
+ new Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT));
tableVersions.setRowSelectionAllowed(false);
tableVersions.setColumnSelectionAllowed(false);
@@ -132,12 +135,14 @@ public class IdeVersion extends javax.swing.JPanel implements ActionListener, Ta
initColumnSizes(tableVersions, tableModel);
versionPanel.add(scroll);
- JTextArea area = new JTextArea("Please select IDEs below that you wish to add Scripting support to");
+ JTextArea area = new
+ JTextArea("Please select IDEs below that you wish to add Scripting support to");
area.setLineWrap(true);
area.setEditable(false);
add(area, BorderLayout.NORTH);
add(versionPanel, BorderLayout.CENTER);
- nav = new NavPanel(wizard, true, false, true, InstallWizard.IDEWELCOME, InstallWizard.IDEFINAL);
+ nav = new NavPanel(wizard, true, false, true, InstallWizard.IDEWELCOME,
+ InstallWizard.IDEFINAL);
nav.setNextListener(this);
add(nav, BorderLayout.SOUTH);
@@ -153,8 +158,10 @@ public class IdeVersion extends javax.swing.JPanel implements ActionListener, Ta
public void actionPerformed(ActionEvent ev) {
InstallWizard.clearLocations();
int len = tableModel.data.size();
+
for (int i = 0; i < len; i++) {
ArrayList<?> list = tableModel.data.get(i);
+
if (((Boolean)list.get(0)).booleanValue())
InstallWizard.storeLocation((String)list.get(2));
}
@@ -164,8 +171,7 @@ public class IdeVersion extends javax.swing.JPanel implements ActionListener, Ta
public void tableChanged(TableModelEvent e) {
if (tableModel.isAnySelected()) {
nav.enableNext(true);
- }
- else {
+ } else {
nav.enableNext(false);
}
}
@@ -184,9 +190,9 @@ public class IdeVersion extends javax.swing.JPanel implements ActionListener, Ta
try {
comp = column.getHeaderRenderer().
- getTableCellRendererComponent(
- null, column.getHeaderValue(),
- false, false, 0, 0);
+ getTableCellRendererComponent(
+ null, column.getHeaderValue(),
+ false, false, 0, 0);
headerWidth = comp.getPreferredSize().width;
} catch (NullPointerException e) {
// System.err.println("Null pointer exception!");
@@ -201,19 +207,19 @@ public class IdeVersion extends javax.swing.JPanel implements ActionListener, Ta
System.out.println("longValues: " + longValues[i]);
comp = table.getDefaultRenderer(model.getColumnClass(i)).
- getTableCellRendererComponent(
- table, longValues[i],
- false, false, 0, i);
+ getTableCellRendererComponent(
+ table, longValues[i],
+ false, false, 0, i);
cellWidth = comp.getPreferredSize().width;
preferredWidth = Math.max(headerWidth, cellWidth);
if (false) {
System.out.println("Initializing width of column "
- + i + ". "
- + "preferredWidth = " + preferredWidth
- + "; totalWidth = " + totalWidth
- + "; leftWidth = " + (InstallWizard.DEFWIDTH - totalWidth));
+ + i + ". "
+ + "preferredWidth = " + preferredWidth
+ + "; totalWidth = " + totalWidth
+ + "; leftWidth = " + (InstallWizard.DEFWIDTH - totalWidth));
}
//XXX: Before Swing 1.1 Beta 2, use setMinWidth instead.
@@ -222,8 +228,7 @@ public class IdeVersion extends javax.swing.JPanel implements ActionListener, Ta
column.setPreferredWidth(InstallWizard.DEFWIDTH - totalWidth);
else
column.setPreferredWidth(preferredWidth);
- }
- else {
+ } else {
column.setMinWidth(preferredWidth);
totalWidth += preferredWidth;
}
@@ -236,17 +241,18 @@ public class IdeVersion extends javax.swing.JPanel implements ActionListener, Ta
private NavPanel nav;
// End of variables declaration//GEN-END:variables
- }
+}
class MyTableModelIDE extends AbstractTableModel {
ArrayList<ArrayList<Object>> data;
private String colNames[] = {"", "IDE Name", "IDE Location"};
Object[] longValues = new Object[] {Boolean.TRUE, "Name", "Location"};
- MyTableModelIDE (Properties properties, String [] validVersions) {
+ MyTableModelIDE(Properties properties, String [] validVersions) {
data = new ArrayList<ArrayList<Object>>();
int len = validVersions.length;
+
for (int i = 0; i < len; i++) {
String key = validVersions[i];
String path = null;
@@ -256,11 +262,13 @@ class MyTableModelIDE extends AbstractTableModel {
row.add(0, Boolean.FALSE);
row.add(1, key);
+
if (key.length() > ((String)longValues[1]).length()) {
longValues[1] = key;
}
row.add(2, path);
+
if (path.length() > ((String)longValues[2]).length()) {
longValues[2] = path;
}
@@ -292,35 +300,38 @@ class MyTableModelIDE extends AbstractTableModel {
return aRow.get(col);
}
- @Override
- public Class getColumnClass(int c) {
+ @Override
+ public Class getColumnClass(int c) {
return getValueAt(0, c).getClass();
- }
+ }
- @Override
- public boolean isCellEditable(int row, int col) {
- return (col == 0);
- }
+ @Override
+ public boolean isCellEditable(int row, int col) {
+ return (col == 0);
+ }
- @Override
- public void setValueAt(Object value, int row, int col) {
+ @Override
+ public void setValueAt(Object value, int row, int col) {
ArrayList<Object> aRow = data.get(row);
aRow.set(col, value);
fireTableCellUpdated(row, col);
- }
+ }
- public boolean isAnySelected() {
+ public boolean isAnySelected() {
Iterator iter = data.iterator();
+
while (iter.hasNext()) {
ArrayList<?> row = (ArrayList<?>)iter.next();
+
if (((Boolean)row.get(0)).booleanValue()) {
- return true;
+ return true;
}
}
+
return false;
- }
+ }
}
diff --git a/scripting/workben/installer/IdeWelcome.java b/scripting/workben/installer/IdeWelcome.java
index a0d3a5145ee0..c6852bbd639c 100644
--- a/scripting/workben/installer/IdeWelcome.java
+++ b/scripting/workben/installer/IdeWelcome.java
@@ -25,7 +25,8 @@ public class IdeWelcome extends javax.swing.JPanel implements ActionListener {
/** Creates new form Welcome */
public IdeWelcome(InstallWizard wizard) {
this.wizard = wizard;
- setBorder(new javax.swing.border.EtchedBorder(javax.swing.border.EtchedBorder.RAISED));
+ setBorder(new javax.swing.border.EtchedBorder(
+ javax.swing.border.EtchedBorder.RAISED));
initComponents();
}
@@ -45,13 +46,15 @@ public class IdeWelcome extends javax.swing.JPanel implements ActionListener {
area.setLineWrap(true);
area.setText("\n Click Next to include Scripting Framework support for IDEs.");
area.append("\n Click Cancel exit the Installation process. \n");
- if( InstUtil.hasNetbeansInstallation() ) {
- area.append("\n \tA version of Netbeans has been detected. \n");
- }
+
+ if (InstUtil.hasNetbeansInstallation()) {
+ area.append("\n \tA version of Netbeans has been detected. \n");
+ }
welcomePanel.add(area, java.awt.BorderLayout.CENTER);
add(welcomePanel, java.awt.BorderLayout.CENTER);
- NavPanel nav = new NavPanel(wizard, false, true, true, "", InstallWizard.IDEVERSIONS);
+ NavPanel nav = new NavPanel(wizard, false, true, true, "",
+ InstallWizard.IDEVERSIONS);
nav.setNextListener(this);
add(nav, java.awt.BorderLayout.SOUTH);
@@ -62,8 +65,7 @@ public class IdeWelcome extends javax.swing.JPanel implements ActionListener {
return new java.awt.Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT);
}
- public void actionPerformed(ActionEvent ev)
- {
+ public void actionPerformed(ActionEvent ev) {
//Perform next actions here...
}
diff --git a/scripting/workben/installer/InstUtil.java b/scripting/workben/installer/InstUtil.java
index d9bab179344f..262ce6c01e6b 100644
--- a/scripting/workben/installer/InstUtil.java
+++ b/scripting/workben/installer/InstUtil.java
@@ -35,12 +35,14 @@ public class InstUtil {
String os = System.getProperty("os.name");
if (os.indexOf("Windows") != -1) {
- boolean bSVersionInHomeDir = new File(thePath.toString() + "sversion.ini").exists();
+ boolean bSVersionInHomeDir = new File(thePath.toString() +
+ "sversion.ini").exists();
if (!bSVersionInHomeDir) {
thePath.append("Application Data");
thePath.append(File.separator);
}
+
theFile = findVersionFile(new File(thePath.toString()));
} else if (os.indexOf("SunOS") != -1) {
thePath.append(".sversionrc");
@@ -50,14 +52,14 @@ public class InstUtil {
theFile = new File(thePath.toString());
}
- if (theFile == null)
- {
+ if (theFile == null) {
throw new IOException("Could not locate the OpenOffice settings file.\nAre you sure StarOffice is installed on your system?");
}
- if (!theFile.exists())
- {
+
+ if (!theFile.exists()) {
throw new IOException("Could not locate the OpenOffice settings file.\nAre you sure StarOffice is installed on your system?");
}
+
return theFile;
}
@@ -65,28 +67,28 @@ public class InstUtil {
public static boolean hasNetbeansInstallation() {
boolean result = false;
- result = checkForSupportedVersion( getNetbeansLocation(), versions );
+ result = checkForSupportedVersion(getNetbeansLocation(), versions);
if (!result)
System.out.println("No supported version of NetBeans found.");
+
return result;
}
- private static boolean checkForSupportedVersion( Properties installs, String[] supportedVersions )
- {
- if ( installs != null )
- {
- for ( int index = 0; index < supportedVersions.length; index++ )
- {
+ private static boolean checkForSupportedVersion(Properties installs,
+ String[] supportedVersions) {
+ if (installs != null) {
+ for (int index = 0; index < supportedVersions.length; index++) {
String key = supportedVersions[ index ];
- if ( installs.getProperty(key) != null )
- {
+
+ if (installs.getProperty(key) != null) {
// at least one supported version for netbeans present, so return;
return true;
}
}
}
+
return false;
}
@@ -96,95 +98,93 @@ public class InstUtil {
public static Properties getNetbeansLocation() {
- Properties results = new Properties();
+ Properties results = new Properties();
- StringBuffer str = new StringBuffer();
+ StringBuffer str = new StringBuffer();
str.append(System.getProperty("user.home"));
str.append(File.separator);
- StringBuffer thePath = new StringBuffer(str.toString());
+ StringBuffer thePath = new StringBuffer(str.toString());
String os = System.getProperty("os.name");
- if (os.indexOf("Windows") != -1) {
- thePath.append(".netbeans");
+ if (os.indexOf("Windows") != -1) {
+ thePath.append(".netbeans");
} else if (os.indexOf("SunOS") != -1) {
- thePath.append(".netbeans");
+ thePath.append(".netbeans");
} else if (os.indexOf("Linux") != -1) {
- thePath.append(".netbeans");
- }
-
- if ( thePath.toString().indexOf( ".netbeans" ) == -1 )
- return null;
- else if ( new File( thePath.append( File.separator+"3.4"+File.separator ).toString() ).isDirectory() ) {
-
- System.out.println( "Found NetBeans 3.4 user directory: " + thePath );
- File netbeansLogFile = new File( thePath.toString() + File.separator + "system" + File.separator + "ide.log" );
- if( netbeansLogFile.exists() ) {
- String installPath = getNetbeansInstallation( netbeansLogFile );
- File f = new File(installPath);
- results.put("NetBeans 3.4", f.getPath()+File.separator);
- System.out.println( "NetBeans Installation directory: " + f.getPath());
- }
- else {
- System.out.println( "No NetBeans log file found" );
- return null;
+ thePath.append(".netbeans");
}
- }
- else
- {
- System.out.println( "No NetBeans user directory found" );
- return null;
+
+ if (thePath.toString().indexOf(".netbeans") == -1)
+ return null;
+ else if (new File(thePath.append(File.separator + "3.4" +
+ File.separator).toString()).isDirectory()) {
+
+ System.out.println("Found NetBeans 3.4 user directory: " + thePath);
+ File netbeansLogFile = new File(thePath.toString() + File.separator + "system" +
+ File.separator + "ide.log");
+
+ if (netbeansLogFile.exists()) {
+ String installPath = getNetbeansInstallation(netbeansLogFile);
+ File f = new File(installPath);
+ results.put("NetBeans 3.4", f.getPath() + File.separator);
+ System.out.println("NetBeans Installation directory: " + f.getPath());
+ } else {
+ System.out.println("No NetBeans log file found");
+ return null;
+ }
+ } else {
+ System.out.println("No NetBeans user directory found");
+ return null;
}
- return results;
+ return results;
}
- private static String getNetbeansInstallation( File logFile ) {
+ private static String getNetbeansInstallation(File logFile) {
String installPath = "";
+
try {
- BufferedReader reader = new BufferedReader(new FileReader(logFile));
+ BufferedReader reader = new BufferedReader(new FileReader(logFile));
+
+ for (String s = reader.readLine(); s != null; s = reader.readLine()) {
+ if (s.indexOf("IDE Install") != -1) {
+ int pathStart = s.indexOf("=") + 2;
+ installPath = s.substring(pathStart, s.length());
+ int pathEnd = installPath.indexOf(";");
+ installPath = installPath.substring(0, pathEnd) + File.separator;
+ break;
+ }
+ }
- for (String s = reader.readLine(); s != null; s = reader.readLine()) {
- if( s.indexOf( "IDE Install" ) != -1 ) {
- int pathStart = s.indexOf( "=" ) + 2;
- installPath = s.substring( pathStart, s.length() );
- int pathEnd = installPath.indexOf( ";");
- installPath = installPath.substring( 0, pathEnd ) +File.separator;
- break;
- }
- }
- reader.close();
+ reader.close();
+ } catch (IOException ioe) {
+ System.out.println("Error reading Netbeans location information");
}
- catch( IOException ioe ) {
- System.out.println( "Error reading Netbeans location information" );
- }
return installPath;
}
- private static File findVersionFile(File start)
- {
+ private static File findVersionFile(File start) {
File versionFile = null;
File files[] = start.listFiles(new VersionFilter());
- if (files.length == 0)
- {
+
+ if (files.length == 0) {
File dirs[] = start.listFiles(new DirFilter());
- for (int i=0; i< dirs.length; i++)
- {
+
+ for (int i = 0; i < dirs.length; i++) {
versionFile = findVersionFile(dirs[i]);
- if (versionFile != null)
- {
+
+ if (versionFile != null) {
break;
}
}
- }
- else
- {
+ } else {
versionFile = files[0];
}
@@ -194,10 +194,12 @@ public class InstUtil {
private static boolean verifySversionExists(File sversionFile) {
if (!sversionFile.exists())
return false;
+
return true;
}
- public static Properties getOfficeVersions(File sversionFile) throws IOException {
+ public static Properties getOfficeVersions(File sversionFile) throws
+ IOException {
BufferedReader reader = new BufferedReader(new FileReader(sversionFile));
String sectionName = null;
Properties results = new Properties();
@@ -205,56 +207,60 @@ public class InstUtil {
for (String s = reader.readLine(); s != null; s = reader.readLine()) {
if (s.length() == 0)
continue;
+
if (s.charAt(0) == '[') {
sectionName = s.substring(1, s.length() - 1);
continue;
}
+
if ((sectionName != null) && sectionName.equalsIgnoreCase("Versions")) {
- int equals = s.indexOf( "=" );
- String officeName = s.substring(0, equals );
+ int equals = s.indexOf("=");
+ String officeName = s.substring(0, equals);
- String instPath = s.substring(equals + 8, s.length());
- String [] parts = new String[2];
- parts[0] = officeName;
- parts[1] = instPath + File.separator;
+ String instPath = s.substring(equals + 8, s.length());
+ String [] parts = new String[2];
+ parts[0] = officeName;
+ parts[1] = instPath + File.separator;
if (parts.length == 2) {
- try {
+ try {
URL url = new URL("file://" + parts[1].trim());
- String opSys =System.getProperty("os.name");
- if (opSys.indexOf("Windows")!=-1){
- String windowsPath = URLDecoder.decode( url.getPath() );
- boolean firstSlash = true;
- while( windowsPath.indexOf("/") != -1 ) {
- int forwardSlashPos = windowsPath.indexOf("/");
- String firstPart = windowsPath.substring( 0, forwardSlashPos );
- String lastPart = windowsPath.substring( forwardSlashPos + 1, windowsPath.length() );
- if( firstSlash ) {
- windowsPath = lastPart;
- firstSlash = false;
- }
- else {
- windowsPath = firstPart + "\\" + lastPart;
- }
- }
- int lastSlash = windowsPath.lastIndexOf("\\");
- windowsPath = windowsPath.substring( 0, lastSlash );
- results.put( parts[0].trim(), windowsPath );
- }
- else {
- results.put(parts[0].trim(), URLDecoder.decode(url.getPath()));
- }
+ String opSys = System.getProperty("os.name");
+
+ if (opSys.indexOf("Windows") != -1) {
+ String windowsPath = URLDecoder.decode(url.getPath());
+ boolean firstSlash = true;
+
+ while (windowsPath.indexOf("/") != -1) {
+ int forwardSlashPos = windowsPath.indexOf("/");
+ String firstPart = windowsPath.substring(0, forwardSlashPos);
+ String lastPart = windowsPath.substring(forwardSlashPos + 1,
+ windowsPath.length());
+
+ if (firstSlash) {
+ windowsPath = lastPart;
+ firstSlash = false;
+ } else {
+ windowsPath = firstPart + "\\" + lastPart;
+ }
+ }
+
+ int lastSlash = windowsPath.lastIndexOf("\\");
+ windowsPath = windowsPath.substring(0, lastSlash);
+ results.put(parts[0].trim(), windowsPath);
+ } else {
+ results.put(parts[0].trim(), URLDecoder.decode(url.getPath()));
+ }
+ } catch (MalformedURLException eSyntax) {
+ results.put(parts[0].trim(), parts[1].trim());
+ System.err.println("GotHereException");
}
- catch (MalformedURLException eSyntax) {
- results.put(parts[0].trim(), parts[1].trim());
- System.err.println("GotHereException");
- }
- }
- else {
+ } else {
System.out.println("not splitting on equals");
}
}
}
+
reader.close();
return results;
}
@@ -266,31 +272,34 @@ public class InstUtil {
private static boolean isCorrectJavaVersion() {
if (System.getProperty("java.version").startsWith("1.4"))
return true;
+
return false;
}
public static void main(String args[]) {
InstUtil inst = new InstUtil();
File f = null;
- try
- {
+
+ try {
f = InstUtil.buildSversionLocation();
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
+
if (!InstUtil.verifySversionExists(f)) {
System.err.println("Problem with sversion.ini");
}
+
try {
InstUtil.getOfficeVersions(f);
} catch (IOException e) {
e.printStackTrace();
System.err.println(e);
}
+
System.out.println(InstUtil.getJavaVersion());
+
if (!InstUtil.isCorrectJavaVersion()) {
System.err.println("Not correct Java Version");
}
@@ -301,19 +310,14 @@ public class InstUtil {
-class DirFilter implements java.io.FileFilter
-{
- public boolean accept(File aFile)
- {
+class DirFilter implements java.io.FileFilter {
+ public boolean accept(File aFile) {
return aFile.isDirectory();
}
}
-class VersionFilter implements java.io.FileFilter
-{
- public boolean accept(File aFile)
- {
- if (aFile.getName().compareToIgnoreCase("sversion.ini") == 0)
- {
+class VersionFilter implements java.io.FileFilter {
+ public boolean accept(File aFile) {
+ if (aFile.getName().compareToIgnoreCase("sversion.ini") == 0) {
return true;
}
diff --git a/scripting/workben/installer/InstallListener.java b/scripting/workben/installer/InstallListener.java
index 6dd111559902..81a005668369 100644
--- a/scripting/workben/installer/InstallListener.java
+++ b/scripting/workben/installer/InstallListener.java
@@ -18,7 +18,6 @@
package installer;
-public interface InstallListener
-{
+public interface InstallListener {
void installationComplete(InstallationEvent e);
}
diff --git a/scripting/workben/installer/InstallWizard.java b/scripting/workben/installer/InstallWizard.java
index c02f5f13b904..fc9d3bdf19da 100644
--- a/scripting/workben/installer/InstallWizard.java
+++ b/scripting/workben/installer/InstallWizard.java
@@ -25,77 +25,78 @@ import java.util.*;
import java.net.*;
import java.io.*;
-public class InstallWizard extends javax.swing.JFrame implements ActionListener {
-/*
- private static class ShutdownHook extends Thread {
- public void run()
- {
- if (InstallWizard.isInstallStarted())
- {
- // Check for and backup any config.xml files
- // Check for and backup any StarBasic macro files
- // Check for and backup ProtocolHandler
-
- if (!InstallWizard.isPatchedTypes())
+public class InstallWizard extends javax.swing.JFrame implements
+ ActionListener {
+ /*
+ private static class ShutdownHook extends Thread {
+ public void run()
{
- File backup = new File(InstUtil.getTmpDir(), "TypeDetection.xml");
- File destination = new File(InstallWizard.getTypesPath());
- InstUtil.copy(backup, destination); //Restore typedetection.xml
- }
- if (!InstallWizard.isPatchedJava())
- {
- File backup = new File(InstUtil.getTmpDir(), "Java.xml");
- File destination = new File(InstallWizard.getJavaPath());
- InstUtil.copy(backup, destination); //Restore typedetection.xml
- }
- if (!InstallWizard.isPatchedRDB())
- {
- File backup = new File(InstUtil.getTmpDir(), "applicat.rdb");
- File destination = new File(InstallWizard.getJavaPath());
- //InstUtil.copy(backup, destination); //Restore typedetection.xml
- }
+ if (InstallWizard.isInstallStarted())
+ {
+ // Check for and backup any config.xml files
+ // Check for and backup any StarBasic macro files
+ // Check for and backup ProtocolHandler
- System.out.println( "ShutdownHook" );
+ if (!InstallWizard.isPatchedTypes())
+ {
+ File backup = new File(InstUtil.getTmpDir(), "TypeDetection.xml");
+ File destination = new File(InstallWizard.getTypesPath());
+ InstUtil.copy(backup, destination); //Restore typedetection.xml
+ }
+ if (!InstallWizard.isPatchedJava())
+ {
+ File backup = new File(InstUtil.getTmpDir(), "Java.xml");
+ File destination = new File(InstallWizard.getJavaPath());
+ InstUtil.copy(backup, destination); //Restore typedetection.xml
+ }
+ if (!InstallWizard.isPatchedRDB())
+ {
+ File backup = new File(InstUtil.getTmpDir(), "applicat.rdb");
+ File destination = new File(InstallWizard.getJavaPath());
+ //InstUtil.copy(backup, destination); //Restore typedetection.xml
}
- InstUtil.removeTmpDir();
- }
- }// class ShutdownHook
+ System.out.println( "ShutdownHook" );
+ }
- static {
- Runtime rt=Runtime.getRuntime();
- rt.addShutdownHook(new ShutdownHook());
- }
-*/
+ InstUtil.removeTmpDir();
+ }
+ }// class ShutdownHook
+
+ static {
+ Runtime rt=Runtime.getRuntime();
+ rt.addShutdownHook(new ShutdownHook());
+ }
+ */
/** Creates new form InstallWizard */
public InstallWizard() {
super("Office Scripting Framework Installer - Early Developer Release");
- try {
- System.out.print("All diagnostic output is being redirected to SFrameworkInstall.log\n");
- System.out.print("Location: "+ System.getProperty( "user.dir" ) +
- File.separator + "SFrameworkInstall.log\n");
-
- LogStream log = new LogStream( "SFrameworkInstall.log" );
- System.setErr(log);
-
- System.setOut(log);
- }
- catch( FileNotFoundException fnfe ) {
- System.err.println("Office Scripting Framework Installer - Error: ");
- System.err.println("Unable to create log file for installation.");
- exitForm();
- }
-
- setBackground(new Color(0,0,0));
- locations = new ArrayList<String>();
- Point center = new Point( 400, 400 );
- int windowWidth=200;
- int windowHeight=300;
- setSize(windowWidth,windowHeight);
- setBounds((center.x-windowWidth/2)-115,(center.y-windowWidth/2)-100, windowWidth,windowHeight);
- initComponents();
- setResizable(false);
+ try {
+ System.out.print("All diagnostic output is being redirected to SFrameworkInstall.log\n");
+ System.out.print("Location: " + System.getProperty("user.dir") +
+ File.separator + "SFrameworkInstall.log\n");
+
+ LogStream log = new LogStream("SFrameworkInstall.log");
+ System.setErr(log);
+
+ System.setOut(log);
+ } catch (FileNotFoundException fnfe) {
+ System.err.println("Office Scripting Framework Installer - Error: ");
+ System.err.println("Unable to create log file for installation.");
+ exitForm();
+ }
+
+ setBackground(new Color(0, 0, 0));
+ locations = new ArrayList<String>();
+ Point center = new Point(400, 400);
+ int windowWidth = 200;
+ int windowHeight = 300;
+ setSize(windowWidth, windowHeight);
+ setBounds((center.x - windowWidth / 2) - 115,
+ (center.y - windowWidth / 2) - 100, windowWidth, windowHeight);
+ initComponents();
+ setResizable(false);
}
/** This method is called from within the constructor to
@@ -137,40 +138,39 @@ public class InstallWizard extends javax.swing.JFrame implements ActionListener
screens.add(WELCOME, new Welcome(this));
version = new Version(this);
screens.add(VERSIONS, version);
- _final = new Final(this);
+ _final = new Final(this);
screens.add(FINAL, _final);
- boolean hasIDEInstallation = ( InstUtil.hasNetbeansInstallation() ) ;
+ boolean hasIDEInstallation = (InstUtil.hasNetbeansInstallation()) ;
+
+ if (hasIDEInstallation) {
+ idewelcome = new IdeWelcome(this);
+ screens.add(IDEWELCOME, idewelcome);
+ ideversion = new IdeVersion(this);
+ screens.add(IDEVERSIONS, ideversion);
+ idefinal = new IdeFinal(this);
+ screens.add(IDEFINAL, idefinal);
+ }
- if( hasIDEInstallation )
- {
- idewelcome = new IdeWelcome(this);
- screens.add(IDEWELCOME, idewelcome);
- ideversion = new IdeVersion(this);
- screens.add(IDEVERSIONS, ideversion);
- idefinal = new IdeFinal(this);
- screens.add(IDEFINAL, idefinal);
- }
getContentPane().add(screens, java.awt.BorderLayout.CENTER);
- navNext.addActionListener(this);
- navNext.addActionListener(version);
- navNext.addActionListener(_final);
+ navNext.addActionListener(this);
+ navNext.addActionListener(version);
+ navNext.addActionListener(_final);
- if( hasIDEInstallation )
- {
- navNext.addActionListener(ideversion);
- navNext.addActionListener(idefinal);
- }
+ if (hasIDEInstallation) {
+ navNext.addActionListener(ideversion);
+ navNext.addActionListener(idefinal);
+ }
- navCancel.addActionListener(this);
- navBack.addActionListener(this);
+ navCancel.addActionListener(this);
+ navBack.addActionListener(this);
- URL url = this.getClass().getResource("sidebar.jpg");
- JLabel sideBar = new JLabel();
- sideBar.setIcon(new ImageIcon(url));
- getContentPane().add (sideBar, java.awt.BorderLayout.WEST);
+ URL url = this.getClass().getResource("sidebar.jpg");
+ JLabel sideBar = new JLabel();
+ sideBar.setIcon(new ImageIcon(url));
+ getContentPane().add(sideBar, java.awt.BorderLayout.WEST);
pack();
}// initComponents
@@ -180,41 +180,33 @@ public class InstallWizard extends javax.swing.JFrame implements ActionListener
}
- public void actionPerformed(ActionEvent e)
- {
- if (e.getSource() == navNext)
- {
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource() == navNext) {
((CardLayout)screens.getLayout()).next(screens);
- }
+ }
- if (e.getSource() == navCancel)
- {
+ if (e.getSource() == navCancel) {
exitForm();
- }
+ }
- if (e.getSource() == navBack)
- {
+ if (e.getSource() == navBack) {
((CardLayout)screens.getLayout()).previous(screens);
- }
+ }
}// actionPerformed
- public static void storeLocation(String path)
- {
+ public static void storeLocation(String path) {
locations.add(path);
}
- public static ArrayList<String> getLocations()
- {
+ public static ArrayList<String> getLocations() {
return locations;
}
- public static void clearLocations()
- {
+ public static void clearLocations() {
locations.clear();
}
- public void show(String cardName)
- {
+ public void show(String cardName) {
((CardLayout)screens.getLayout()).show(screens, cardName);
}
@@ -231,14 +223,19 @@ public class InstallWizard extends javax.swing.JFrame implements ActionListener
printUsage();
System.exit(0);
}
+
if (args[i].equals("-office"))
officePath = args[++i];
+
if (args[i].equals("-netbeans"))
netbeansPath = args[++i];
+
if (args[i].equals("-net"))
bNetworkInstall = true;
+
if (args[i].equals("-bindings"))
bBindingsInstall = true;
+
i++;
}
@@ -250,21 +247,21 @@ public class InstallWizard extends javax.swing.JFrame implements ActionListener
try {
System.out.println("Log file is: " +
- System.getProperty("user.dir") +
- File.separator + "SFrameworkInstall.log");
+ System.getProperty("user.dir") +
+ File.separator + "SFrameworkInstall.log");
- LogStream log = new LogStream( "SFrameworkInstall.log" );
+ LogStream log = new LogStream("SFrameworkInstall.log");
System.setErr(log);
System.setOut(log);
- }
- catch( FileNotFoundException fnfe ) {
+ } catch (FileNotFoundException fnfe) {
System.err.println("Error: Unable to create log file: "
- + fnfe.getMessage());
+ + fnfe.getMessage());
System.exit(-1);
}
if (officePath != null) {
- XmlUpdater xud = new XmlUpdater(officePath, label, progressbar, bNetworkInstall, bBindingsInstall );
+ XmlUpdater xud = new XmlUpdater(officePath, label, progressbar, bNetworkInstall,
+ bBindingsInstall);
xud.run();
}
@@ -292,23 +289,19 @@ public class InstallWizard extends javax.swing.JFrame implements ActionListener
- public static synchronized void setPatchedTypes(boolean value)
- {
+ public static synchronized void setPatchedTypes(boolean value) {
bPatchedTypes = value;
}
- public static synchronized void setPatchedJava(boolean value)
- {
+ public static synchronized void setPatchedJava(boolean value) {
bPatchedJava = value;
}
- public static synchronized void setPatchedRDB(boolean value)
- {
+ public static synchronized void setPatchedRDB(boolean value) {
bPatchedRDB = value;
}
- public static synchronized void setInstallStarted(boolean value)
- {
+ public static synchronized void setInstallStarted(boolean value) {
bInstallStarted = value;
}
diff --git a/scripting/workben/installer/InstallationEvent.java b/scripting/workben/installer/InstallationEvent.java
index cdac2dc2cda7..9d91f9bf4505 100644
--- a/scripting/workben/installer/InstallationEvent.java
+++ b/scripting/workben/installer/InstallationEvent.java
@@ -18,23 +18,19 @@
package installer;
-public class InstallationEvent
-{
+public class InstallationEvent {
private Object source;
private String message;
- InstallationEvent(Object source, String message)
- {
+ InstallationEvent(Object source, String message) {
this.source = source;
this.message = message;
}
- public Object getSource()
- {
+ public Object getSource() {
return source;
}
- public String getMessage()
- {
+ public String getMessage() {
return message;
}
}
diff --git a/scripting/workben/installer/LogStream.java b/scripting/workben/installer/LogStream.java
index 3fde653709f3..27f33860d9d2 100644
--- a/scripting/workben/installer/LogStream.java
+++ b/scripting/workben/installer/LogStream.java
@@ -25,46 +25,36 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat;
-public class LogStream extends PrintStream
-{
- static final private DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z: ");
+public class LogStream extends PrintStream {
+ static final private DateFormat formatter = new
+ SimpleDateFormat("yyyy-MM-dd HH:mm:ss z: ");
- private String getTimeStamp()
- {
- String timeStamp = formatter.format( new Date() );
- return timeStamp;
+ private String getTimeStamp() {
+ String timeStamp = formatter.format(new Date());
+ return timeStamp;
}
- public LogStream( String logFileName ) throws java.io.FileNotFoundException
- {
- super( new FileOutputStream( logFileName ) );
+ public LogStream(String logFileName) throws java.io.FileNotFoundException {
+ super(new FileOutputStream(logFileName));
}
@Override
- public void println(String x)
- {
- super.println( getTimeStamp() + x );
+ public void println(String x) {
+ super.println(getTimeStamp() + x);
}
- public static void main(String[] args)
- {
- if ( args.length > 0 )
- {
- try
- {
- LogStream log = new LogStream( args[0] );
+ public static void main(String[] args) {
+ if (args.length > 0) {
+ try {
+ LogStream log = new LogStream(args[0]);
System.setErr(log);
System.setOut(log);
System.out.println("Test from logger from out");
System.err.println("Test from logger from err");
System.out.println("finised test from out");
System.err.println("finised test from err");
- }
- catch( java.io.FileNotFoundException fe )
- {
- System.err.println("Error creating logStream: " + fe );
+ } catch (java.io.FileNotFoundException fe) {
+ System.err.println("Error creating logStream: " + fe);
fe.printStackTrace();
}
- }
- else
- {
+ } else {
System.err.println("specify log file java LogStream [logfile]");
System.exit(1);
}
diff --git a/scripting/workben/installer/NavPanel.java b/scripting/workben/installer/NavPanel.java
index d8718e1257d1..89cfed25b1de 100644
--- a/scripting/workben/installer/NavPanel.java
+++ b/scripting/workben/installer/NavPanel.java
@@ -23,9 +23,11 @@ import java.awt.*;
import java.awt.event.*;
public class NavPanel extends JPanel implements ActionListener {
- NavPanel(InstallWizard wizard, boolean bBack, boolean bNext, boolean bCancel, String prev, String next) {
+ NavPanel(InstallWizard wizard, boolean bBack, boolean bNext, boolean bCancel,
+ String prev, String next) {
setBackground(Color.white);
- setBorder(new javax.swing.border.EtchedBorder(javax.swing.border.EtchedBorder.LOWERED));
+ setBorder(new javax.swing.border.EtchedBorder(
+ javax.swing.border.EtchedBorder.LOWERED));
this.wizard = wizard;
this.next = next;
this.prev = prev;
@@ -36,7 +38,7 @@ public class NavPanel extends JPanel implements ActionListener {
gridBagConstraints1 = new java.awt.GridBagConstraints();
gridBagConstraints1.insets = new java.awt.Insets(1, 1, 1, 1);
- gridBagConstraints1.anchor = GridBagConstraints.WEST;
+ gridBagConstraints1.anchor = GridBagConstraints.WEST;
gridBagConstraints2 = new java.awt.GridBagConstraints();
gridBagConstraints2.gridx = 2;
@@ -70,24 +72,26 @@ public class NavPanel extends JPanel implements ActionListener {
}
public void enableIDE(boolean bEnable) {
- ideDetected = bEnable;
+ ideDetected = bEnable;
}
public void actionPerformed(ActionEvent ev) {
if ((ev.getSource() == navNext) && (next.length() != 0)) {
wizard.show(next);
}
+
if ((ev.getSource() == navBack) && (prev.length() != 0)) {
wizard.show(prev);
}
+
if (ev.getSource() == navCancel) {
- if( ideDetected ) {
- wizard.show(InstallWizard.IDEWELCOME);
- }
- else {
- wizard.exitForm();
- }
- enableIDE(false);
+ if (ideDetected) {
+ wizard.show(InstallWizard.IDEWELCOME);
+ } else {
+ wizard.exitForm();
+ }
+
+ enableIDE(false);
}
}
@@ -107,8 +111,7 @@ public class NavPanel extends JPanel implements ActionListener {
- public void removeCancelListener(ActionListener listener)
- {
+ public void removeCancelListener(ActionListener listener) {
navCancel.removeActionListener(listener);
}
diff --git a/scripting/workben/installer/Register.java b/scripting/workben/installer/Register.java
index a3634143bd2e..afe95f5d1de6 100644
--- a/scripting/workben/installer/Register.java
+++ b/scripting/workben/installer/Register.java
@@ -20,85 +20,88 @@ package installer;
import java.io.*;
import javax.swing.*;
-public class Register{
+public class Register {
public static boolean register(String path, JLabel statusLabel) {
String[] packages = {"ooscriptframe.zip", "bshruntime.zip", "jsruntime.zip"};
- try {
- boolean goodResult = false;
- String env[] = new String[1];
+ try {
+ boolean goodResult = false;
+ String env[] = new String[1];
ExecCmd command = new ExecCmd();
- boolean isWindows =
+ boolean isWindows =
(System.getProperty("os.name").indexOf("Windows") != -1);
- String progpath = path.concat("program" + File.separator);
+ String progpath = path.concat("program" + File.separator);
statusLabel.setText("Registering Scripting Framework...");
// pkgchk Scripting Framework Components
statusLabel.setText("Registering Scripting Framework Components...");
- System.out.println("Registering Scripting Framework Components...");
+ System.out.println("Registering Scripting Framework Components...");
for (int i = 0; i < packages.length; i++) {
String cmd = "";
- if (!isWindows) {
- env[0]="LD_LIBRARY_PATH=" + progpath;
+ if (!isWindows) {
+ env[0] = "LD_LIBRARY_PATH=" + progpath;
- goodResult = command.exec("chmod a+x " + progpath + "pkgchk", null );
+ goodResult = command.exec("chmod a+x " + progpath + "pkgchk", null);
- if ( goodResult ){
+ if (goodResult) {
cmd = progpath + "pkgchk -s -f " + progpath + packages[i];
- System.err.println(cmd);
+ System.err.println(cmd);
goodResult = command.exec(cmd, env);
}
- }
- else {
+ } else {
cmd = "\"" + progpath + "pkgchk.exe\" -s -f \"" + progpath +
- packages[i] + "\"";
+ packages[i] + "\"";
- System.err.println(cmd);
- goodResult =command.exec(cmd,null);
+ System.err.println(cmd);
+ goodResult = command.exec(cmd, null);
+
+ }
- }
if (!goodResult) {
System.err.println("\nPkgChk Failed");
- if(!isWindows)
- System.err.println("Command: " + cmd + "\n" + env[0]);
- else
- System.err.println("Command: \"" + cmd + "\"");
+ if (!isWindows)
+ System.err.println("Command: " + cmd + "\n" + env[0]);
+ else
+ System.err.println("Command: \"" + cmd + "\"");
- statusLabel.setText(
+ statusLabel.setText(
"PkgChk Failed, please view SFrameworkInstall.log");
- return false;
+ return false;
}
- }
+ }
// updating StarBasic libraries
statusLabel.setText("Updating StarBasic libraries...");
- if(!FileUpdater.updateScriptXLC(path, statusLabel)) {
- statusLabel.setText("Updating user/basic/script.xlc failed, please view SFrameworkInstall.log");
- return false;
- }
- if(!FileUpdater.updateDialogXLC(path, statusLabel)) {
- statusLabel.setText("Updating user/basic/dialog.xlc failed, please view SFrameworkInstall.log");
+
+ if (!FileUpdater.updateScriptXLC(path, statusLabel)) {
+ statusLabel.setText("Updating user/basic/script.xlc failed, please view SFrameworkInstall.log");
+ return false;
+ }
+
+ if (!FileUpdater.updateDialogXLC(path, statusLabel)) {
+ statusLabel.setText("Updating user/basic/dialog.xlc failed, please view SFrameworkInstall.log");
+ return false;
+ }
+
+ } catch (Exception e) {
+ String message =
+ "\nError installing scripting package, please view SFrameworkInstall.log.";
+ System.out.println(message);
+ e.printStackTrace();
+ statusLabel.setText(message);
return false;
}
- }
- catch(Exception e){
- String message = "\nError installing scripting package, please view SFrameworkInstall.log.";
- System.out.println(message);
- e.printStackTrace();
- statusLabel.setText(message);
- return false;
- }
- return true;
+ return true;
}// register
}//Register
diff --git a/scripting/workben/installer/Version.java b/scripting/workben/installer/Version.java
index 2540f62f3dd6..8ede6c54527e 100644
--- a/scripting/workben/installer/Version.java
+++ b/scripting/workben/installer/Version.java
@@ -27,12 +27,13 @@ import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
-public class Version extends javax.swing.JPanel implements ActionListener, TableModelListener {
+public class Version extends javax.swing.JPanel implements ActionListener,
+ TableModelListener {
/** Creates new form Welcome */
public Version(InstallWizard wizard) {
- this.wizard=wizard;
- setBackground(Color.white);
+ this.wizard = wizard;
+ setBackground(Color.white);
initComponents();
}
@@ -49,44 +50,46 @@ public class Version extends javax.swing.JPanel implements ActionListener, Table
System.out.println("Initialising versions");
File fileVersions = null;
- try
- {
+
+ try {
fileVersions = InstUtil.buildSversionLocation();
- }
- catch(IOException eFnF)
- {
+ } catch (IOException eFnF) {
System.err.println("Cannot find sversion.ini/.sversionrc");
- JOptionPane.showMessageDialog(this, eFnF.getMessage(), "File not Found", JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showMessageDialog(this, eFnF.getMessage(), "File not Found",
+ JOptionPane.ERROR_MESSAGE);
wizard.exitForm();
- }
+ }
try {
props = InstUtil.getOfficeVersions(fileVersions);
- }
- catch (IOException eIO) {
+ } catch (IOException eIO) {
//Message about no installed versions found
System.err.println("Failed to parse SVERSION");
- JOptionPane.showMessageDialog(this, "There was a problem reading from the Office settings file.", "Parse Error", JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showMessageDialog(this,
+ "There was a problem reading from the Office settings file.", "Parse Error",
+ JOptionPane.ERROR_MESSAGE);
wizard.exitForm();
}
tableModel = new MyTableModel(props);
- if (tableModel.getRowCount() == 0)
- {
- JOptionPane.showMessageDialog(this, "No compatible versions of Office were found.", "Invalid versions", JOptionPane.ERROR_MESSAGE);
+
+ if (tableModel.getRowCount() == 0) {
+ JOptionPane.showMessageDialog(this,
+ "No compatible versions of Office were found.", "Invalid versions",
+ JOptionPane.ERROR_MESSAGE);
wizard.exitForm();
- }
+ }
tableModel.addTableModelListener(this);
JTable tableVersions = new JTable(tableModel) {
@Override
- public String getToolTipText(MouseEvent event)
- {
- int col = columnAtPoint( event.getPoint() );
+ public String getToolTipText(MouseEvent event) {
+ int col = columnAtPoint(event.getPoint());
+
if (col != 2)
return null;
- int row = rowAtPoint( event.getPoint() );
+ int row = rowAtPoint(event.getPoint());
Object o = getValueAt(row, col);
if (o == null)
@@ -99,14 +102,14 @@ public class Version extends javax.swing.JPanel implements ActionListener, Table
}
@Override
- public Point getToolTipLocation(MouseEvent event)
- {
- int col = columnAtPoint( event.getPoint() );
+ public Point getToolTipLocation(MouseEvent event) {
+ int col = columnAtPoint(event.getPoint());
+
if (col != 2)
return null;
- int row = rowAtPoint( event.getPoint() );
- Object o = getValueAt(row,col);
+ int row = rowAtPoint(event.getPoint());
+ Object o = getValueAt(row, col);
if (o == null)
return null;
@@ -115,7 +118,7 @@ public class Version extends javax.swing.JPanel implements ActionListener, Table
return null;
Point pt = getCellRect(row, col, true).getLocation();
- pt.translate(-1,-2);
+ pt.translate(-1, -2);
return pt;
}
};
@@ -123,7 +126,7 @@ public class Version extends javax.swing.JPanel implements ActionListener, Table
JScrollPane scroll = new JScrollPane(tableVersions);
tableVersions.setPreferredSize(
- new Dimension(InstallWizard.DEFWIDTH,InstallWizard.DEFHEIGHT));
+ new Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT));
tableVersions.setRowSelectionAllowed(false);
tableVersions.setColumnSelectionAllowed(false);
@@ -132,13 +135,15 @@ public class Version extends javax.swing.JPanel implements ActionListener, Table
initColumnSizes(tableVersions, tableModel);
versionPanel.add(scroll);
- JTextArea area = new JTextArea("Please select the Office version you wish to Update");
+ JTextArea area = new
+ JTextArea("Please select the Office version you wish to Update");
area.setLineWrap(true);
area.setEditable(false);
add(area, BorderLayout.NORTH);
add(versionPanel, BorderLayout.CENTER);
//nav = new NavPanel(wizard, true, false, true, InstallWizard.WELCOME, InstallWizard.FINAL);
- nav = new NavPanel(wizard, true, false, true, InstallWizard.WELCOME, InstallWizard.FINAL);
+ nav = new NavPanel(wizard, true, false, true, InstallWizard.WELCOME,
+ InstallWizard.FINAL);
nav.setNextListener(this);
add(nav, BorderLayout.SOUTH);
@@ -158,9 +163,9 @@ public class Version extends javax.swing.JPanel implements ActionListener, Table
try {
comp = column.getHeaderRenderer().
- getTableCellRendererComponent(
- null, column.getHeaderValue(),
- false, false, 0, 0);
+ getTableCellRendererComponent(
+ null, column.getHeaderValue(),
+ false, false, 0, 0);
headerWidth = comp.getPreferredSize().width;
} catch (NullPointerException e) {
// System.err.println("Null pointer exception!");
@@ -175,19 +180,19 @@ public class Version extends javax.swing.JPanel implements ActionListener, Table
System.out.println("longValues: " + longValues[i]);
comp = table.getDefaultRenderer(model.getColumnClass(i)).
- getTableCellRendererComponent(
- table, longValues[i],
- false, false, 0, i);
+ getTableCellRendererComponent(
+ table, longValues[i],
+ false, false, 0, i);
cellWidth = comp.getPreferredSize().width;
preferredWidth = Math.max(headerWidth, cellWidth);
if (false) {
System.out.println("Initializing width of column "
- + i + ". "
- + "preferredWidth = " + preferredWidth
- + "; totalWidth = " + totalWidth
- + "; leftWidth = " + (InstallWizard.DEFWIDTH - totalWidth));
+ + i + ". "
+ + "preferredWidth = " + preferredWidth
+ + "; totalWidth = " + totalWidth
+ + "; leftWidth = " + (InstallWizard.DEFWIDTH - totalWidth));
}
//XXX: Before Swing 1.1 Beta 2, use setMinWidth instead.
@@ -196,8 +201,7 @@ public class Version extends javax.swing.JPanel implements ActionListener, Table
column.setPreferredWidth(InstallWizard.DEFWIDTH - totalWidth);
else
column.setPreferredWidth(preferredWidth);
- }
- else {
+ } else {
column.setMinWidth(preferredWidth);
totalWidth += preferredWidth;
}
@@ -213,8 +217,10 @@ public class Version extends javax.swing.JPanel implements ActionListener, Table
public void actionPerformed(ActionEvent ev) {
InstallWizard.clearLocations();
int len = tableModel.data.size();
+
for (int i = 0; i < len; i++) {
ArrayList<?> list = tableModel.data.get(i);
+
if (((Boolean)list.get(0)).booleanValue())
InstallWizard.storeLocation((String)list.get(2));
}
@@ -224,8 +230,7 @@ public class Version extends javax.swing.JPanel implements ActionListener, Table
public void tableChanged(TableModelEvent e) {
if (tableModel.isAnySelected()) {
nav.enableNext(true);
- }
- else {
+ } else {
nav.enableNext(false);
}
}
@@ -244,42 +249,44 @@ class MyTableModel extends AbstractTableModel {
private String colNames[] = {"", "Name", "Location"};
Object[] longValues = new Object[] {Boolean.TRUE, "Name", "Location"};
- MyTableModel (Properties properties) {
+ MyTableModel(Properties properties) {
data = new ArrayList<ArrayList<Object>>();
boolean isWindows =
(System.getProperty("os.name").indexOf("Windows") != -1);
+
for (Enumeration e = properties.propertyNames(); e.hasMoreElements() ;) {
String key = (String)e.nextElement();
String path = null;
- if ( !( key.startsWith("#") ) &&
- ( path = properties.getProperty(key)) != null) {
+ if (!(key.startsWith("#")) &&
+ (path = properties.getProperty(key)) != null) {
String pkgChkPath = path + File.separator + "program" + File.separator;
- if ( isWindows )
- {
+
+ if (isWindows) {
pkgChkPath += "pkgchk.exe";
- }
- else
- {
+ } else {
pkgChkPath += "pkgchk";
}
- File pkgChk = new File( pkgChkPath );
- if ( pkgChk.exists() )
- {
+
+ File pkgChk = new File(pkgChkPath);
+
+ if (pkgChk.exists()) {
ArrayList<Object> row = new ArrayList<Object>();
row.add(0, Boolean.FALSE);
row.add(1, key);
+
if (key.length() > ((String)longValues[1]).length()) {
longValues[1] = key;
}
row.add(2, path);
+
if (path.length() > ((String)longValues[2]).length()) {
longValues[2] = path;
}
- data.add(row);
+ data.add(row);
}
}
}
@@ -328,12 +335,15 @@ class MyTableModel extends AbstractTableModel {
public boolean isAnySelected() {
Iterator iter = data.iterator();
+
while (iter.hasNext()) {
ArrayList<?> row = (ArrayList<?>)iter.next();
+
if (((Boolean)row.get(0)).booleanValue()) {
return true;
}
}
+
return false;
}
diff --git a/scripting/workben/installer/Welcome.java b/scripting/workben/installer/Welcome.java
index a2c5f0f7ed37..c71a7af6b4fb 100644
--- a/scripting/workben/installer/Welcome.java
+++ b/scripting/workben/installer/Welcome.java
@@ -24,8 +24,9 @@ public class Welcome extends javax.swing.JPanel implements ActionListener {
/** Creates new form Welcome */
public Welcome(InstallWizard wizard) {
- this.wizard = wizard;
- setBorder(new javax.swing.border.EtchedBorder(javax.swing.border.EtchedBorder.RAISED));
+ this.wizard = wizard;
+ setBorder(new javax.swing.border.EtchedBorder(
+ javax.swing.border.EtchedBorder.RAISED));
initComponents();
}
@@ -37,7 +38,7 @@ public class Welcome extends javax.swing.JPanel implements ActionListener {
private void initComponents() {//GEN-BEGIN:initComponents
welcomePanel = new javax.swing.JPanel();
area = new javax.swing.JTextArea();
- nextButtonEnable = true;
+ nextButtonEnable = true;
setLayout(new java.awt.BorderLayout());
@@ -46,19 +47,20 @@ public class Welcome extends javax.swing.JPanel implements ActionListener {
area.setLineWrap(true);
String message = "\n\tOffice Scripting Framework Version 0.3" +
- "\n\n\n\tPlease ensure that you have exited from Office";
+ "\n\n\n\tPlease ensure that you have exited from Office";
- setUpWelcomePanel(message);
+ setUpWelcomePanel(message);
}//GEN-END:initComponents
- private void setUpWelcomePanel(String message){
- area.setText( message );
+ private void setUpWelcomePanel(String message) {
+ area.setText(message);
welcomePanel.add(area, java.awt.BorderLayout.CENTER);
add(welcomePanel, java.awt.BorderLayout.CENTER);
- NavPanel nav = new NavPanel(wizard, false, nextButtonEnable, true, "", InstallWizard.VERSIONS);
- nav.setNextListener(this);
- add(nav, java.awt.BorderLayout.SOUTH);
+ NavPanel nav = new NavPanel(wizard, false, nextButtonEnable, true, "",
+ InstallWizard.VERSIONS);
+ nav.setNextListener(this);
+ add(nav, java.awt.BorderLayout.SOUTH);
}
@@ -67,8 +69,7 @@ public class Welcome extends javax.swing.JPanel implements ActionListener {
return new java.awt.Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT);
}
- public void actionPerformed(ActionEvent ev)
- {
+ public void actionPerformed(ActionEvent ev) {
//Perform next actions here...
}
diff --git a/scripting/workben/installer/XmlUpdater.java b/scripting/workben/installer/XmlUpdater.java
index 3424cd57d110..c7bd2ff6ac3a 100644
--- a/scripting/workben/installer/XmlUpdater.java
+++ b/scripting/workben/installer/XmlUpdater.java
@@ -35,8 +35,7 @@ public class XmlUpdater extends Thread {
private boolean threadSuspended;
private JProgressBar progressBar;
- private final String[] bakFiles =
- {
+ private final String[] bakFiles = {
"writermenubar.xml",
"writerkeybinding.xml",
"calcmenubar.xml",
@@ -49,8 +48,7 @@ public class XmlUpdater extends Thread {
"META-INF" + File.separator + "manifest.xml"
};
- private final String[] dirs =
- {
+ private final String[] dirs = {
"java" + File.separator + "Highlight",
"java" + File.separator + "MemoryUsage",
"java" + File.separator + "ScriptFrmwrkHelper",
@@ -62,8 +60,7 @@ public class XmlUpdater extends Thread {
"javascript" + File.separator + "ExportSheetsToHTML"
};
- private final String[] names =
- {
+ private final String[] names = {
"java/Highlight/HighlightUtil.java",
"java/Highlight/HighlightText.java",
"java/Highlight/Highlight.jar",
@@ -94,14 +91,15 @@ public class XmlUpdater extends Thread {
};
- public XmlUpdater(String installPath, JLabel statusLabel,JProgressBar pBar, boolean netInstall, boolean bindingsInstall) {
+ public XmlUpdater(String installPath, JLabel statusLabel, JProgressBar pBar,
+ boolean netInstall, boolean bindingsInstall) {
this.installPath = installPath;
this.statusLabel = statusLabel;
this.netInstall = netInstall;
this.bindingsInstall = bindingsInstall;
listeners = new ArrayList<InstallListener>();
threadSuspended = false;
- progressBar=pBar;
+ progressBar = pBar;
progressBar.setStringPainted(true);
}// XmlUpdater
@@ -109,8 +107,7 @@ public class XmlUpdater extends Thread {
- public void setResume()
- {
+ public void setResume() {
threadSuspended = false;
notify();
}// setResume
@@ -121,156 +118,163 @@ public class XmlUpdater extends Thread {
internalThread = Thread.currentThread();
- String progpath=installPath;
- progpath= progpath.concat(File.separator+"program"+File.separator);
+ String progpath = installPath;
+ progpath = progpath.concat(File.separator + "program" + File.separator);
- String starBasicPath=installPath;
- starBasicPath= starBasicPath.concat(File.separator+"share"+File.separator+"basic"+File.separator+"ScriptBindingLibrary"+File.separator);
+ String starBasicPath = installPath;
+ starBasicPath = starBasicPath.concat(File.separator + "share" + File.separator +
+ "basic" + File.separator + "ScriptBindingLibrary" + File.separator);
- String regSchemaOfficePath=installPath;
- regSchemaOfficePath= regSchemaOfficePath.concat(File.separator+"share"+File.separator+"registry"+File.separator+"schema"+File.separator+"org"+File.separator+"openoffice"+File.separator+"Office"+File.separator);
+ String regSchemaOfficePath = installPath;
+ regSchemaOfficePath = regSchemaOfficePath.concat(File.separator + "share" +
+ File.separator + "registry" + File.separator + "schema" + File.separator + "org"
+ + File.separator + "openoffice" + File.separator + "Office" + File.separator);
progressBar.setString("Unzipping Required Files");
ZipData zd = new ZipData();
- if( (!netInstall) || bindingsInstall) {
- String configPath=installPath;
- configPath= configPath.concat(File.separator+"user"+File.separator+"config"+File.separator+"soffice.cfg"+File.separator);
- String manifestPath=configPath + "META-INF" + File.separator;
+ if ((!netInstall) || bindingsInstall) {
+ String configPath = installPath;
+ configPath = configPath.concat(File.separator + "user" + File.separator +
+ "config" + File.separator + "soffice.cfg" + File.separator);
+ String manifestPath = configPath + "META-INF" + File.separator;
//Adding <Office>/user/config/soffice.cfg/
- File configDir = new File( configPath );
- if( !configDir.isDirectory() ) {
- if( !configDir.mkdir() ) {
- System.out.println( "creating " + configDir + "directory failed");
- }
- else {
- System.out.println( configDir + "directory created");
- }
- }
- else
- System.out.println( "soffice.cfg exists" );
+ File configDir = new File(configPath);
- File manifestDir = new File( manifestPath );
- if( !manifestDir.isDirectory() ) {
- if( !manifestDir.mkdir() ) {
- System.out.println( "creating " + manifestPath + "directory failed");
+ if (!configDir.isDirectory()) {
+ if (!configDir.mkdir()) {
+ System.out.println("creating " + configDir + "directory failed");
+ } else {
+ System.out.println(configDir + "directory created");
}
- else {
- System.out.println( manifestPath + " directory created");
+ } else
+ System.out.println("soffice.cfg exists");
+
+ File manifestDir = new File(manifestPath);
+
+ if (!manifestDir.isDirectory()) {
+ if (!manifestDir.mkdir()) {
+ System.out.println("creating " + manifestPath + "directory failed");
+ } else {
+ System.out.println(manifestPath + " directory created");
}
- }
- else
- System.out.println( manifestPath + " exists" );
+ } else
+ System.out.println(manifestPath + " exists");
// Backup the confguration files in
// <office>/user/config/soffice.cfg/
// If they already exist.
- for( int i=0; i < bakFiles.length; i++ )
- {
+ for (int i = 0; i < bakFiles.length; i++) {
String pathNameBak = configPath + bakFiles[i];
- File origFile = new File( pathNameBak );
- if( origFile.exists() )
- {
- System.out.println( "Attempting to backup " + pathNameBak + " to " + pathNameBak + ".bak" );
- if(! origFile.renameTo( new File( pathNameBak + ".bak" ) ) )
- {
- System.out.println( "Failed to backup " + pathNameBak + " to " + pathNameBak + ".bak" );
+ File origFile = new File(pathNameBak);
+
+ if (origFile.exists()) {
+ System.out.println("Attempting to backup " + pathNameBak + " to " + pathNameBak
+ + ".bak");
+
+ if (! origFile.renameTo(new File(pathNameBak + ".bak"))) {
+ System.out.println("Failed to backup " + pathNameBak + " to " + pathNameBak +
+ ".bak");
}
}
}
// Adding Office configuration files
- if (!zd.extractEntry("bindingdialog/writermenubar.xml",configPath, statusLabel))
- {
+ if (!zd.extractEntry("bindingdialog/writermenubar.xml", configPath,
+ statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("bindingdialog/writerkeybinding.xml",configPath, statusLabel))
- {
+
+ if (!zd.extractEntry("bindingdialog/writerkeybinding.xml", configPath,
+ statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("bindingdialog/calcmenubar.xml",configPath, statusLabel))
- {
+
+ if (!zd.extractEntry("bindingdialog/calcmenubar.xml", configPath,
+ statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("bindingdialog/calckeybinding.xml",configPath, statusLabel))
- {
+
+ if (!zd.extractEntry("bindingdialog/calckeybinding.xml", configPath,
+ statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("bindingdialog/impressmenubar.xml",configPath, statusLabel))
- {
+
+ if (!zd.extractEntry("bindingdialog/impressmenubar.xml", configPath,
+ statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("bindingdialog/impresskeybinding.xml",configPath, statusLabel))
- {
+
+ if (!zd.extractEntry("bindingdialog/impresskeybinding.xml", configPath,
+ statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("bindingdialog/drawmenubar.xml",configPath, statusLabel))
- {
+
+ if (!zd.extractEntry("bindingdialog/drawmenubar.xml", configPath,
+ statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("bindingdialog/drawkeybinding.xml",configPath, statusLabel))
- {
+
+ if (!zd.extractEntry("bindingdialog/drawkeybinding.xml", configPath,
+ statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("bindingdialog/eventbindings.xml",configPath, statusLabel))
- {
+
+ if (!zd.extractEntry("bindingdialog/eventbindings.xml", configPath,
+ statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("bindingdialog/manifest.xml",manifestPath, statusLabel))
- {
+
+ if (!zd.extractEntry("bindingdialog/manifest.xml", manifestPath, statusLabel)) {
onInstallComplete();
return;
}
}
- if(!bindingsInstall) {
+ if (!bindingsInstall) {
// Adding new directories to Office
// Adding <Office>/user/basic/ScriptBindingLibrary/
- File scriptBindingLib = new File( starBasicPath );
- if( !scriptBindingLib.isDirectory() ) {
- if( !scriptBindingLib.mkdir() ) {
- System.out.println( "ScriptBindingLibrary failed");
- }
- else {
- System.out.println( "ScriptBindingLibrary directory created");
+ File scriptBindingLib = new File(starBasicPath);
+
+ if (!scriptBindingLib.isDirectory()) {
+ if (!scriptBindingLib.mkdir()) {
+ System.out.println("ScriptBindingLibrary failed");
+ } else {
+ System.out.println("ScriptBindingLibrary directory created");
}
- }
- else
- System.out.println( "ScriptBindingLibrary exists" );
+ } else
+ System.out.println("ScriptBindingLibrary exists");
// Adding Scripting Framework and tools
- if (!zd.extractEntry("sframework/ooscriptframe.zip",progpath, statusLabel))
- {
+ if (!zd.extractEntry("sframework/ooscriptframe.zip", progpath, statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("sframework/bshruntime.zip",progpath, statusLabel))
- {
+ if (!zd.extractEntry("sframework/bshruntime.zip", progpath, statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("sframework/jsruntime.zip",progpath, statusLabel))
- {
+ if (!zd.extractEntry("sframework/jsruntime.zip", progpath, statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("schema/Scripting.xcs",regSchemaOfficePath, statusLabel))
- {
+ if (!zd.extractEntry("schema/Scripting.xcs", regSchemaOfficePath,
+ statusLabel)) {
onInstallComplete();
return;
}
@@ -279,14 +283,16 @@ public class XmlUpdater extends Thread {
progressBar.setString("Registering Scripting Framework");
progressBar.setValue(3);
- if(!Register.register(installPath+File.separator, statusLabel) ) {
- onInstallComplete();
- return;
+
+ if (!Register.register(installPath + File.separator, statusLabel)) {
+ onInstallComplete();
+ return;
}
+
progressBar.setValue(5);
String path = installPath + File.separator +
- "share" + File.separator + "Scripts" + File.separator;
+ "share" + File.separator + "Scripts" + File.separator;
for (int i = 0; i < dirs.length; i++) {
File dir = new File(path + dirs[i]);
@@ -294,7 +300,7 @@ public class XmlUpdater extends Thread {
if (!dir.exists()) {
if (!dir.mkdirs()) {
System.err.println("Error making dir: " +
- dir.getAbsolutePath());
+ dir.getAbsolutePath());
onInstallComplete();
return;
}
@@ -313,43 +319,48 @@ public class XmlUpdater extends Thread {
// Adding binding dialog
- if (!zd.extractEntry("bindingdialog/ScriptBinding.xba",starBasicPath, statusLabel))
- {
+ if (!zd.extractEntry("bindingdialog/ScriptBinding.xba", starBasicPath,
+ statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("bindingdialog/MenuBinding.xdl",starBasicPath, statusLabel))
- {
+
+ if (!zd.extractEntry("bindingdialog/MenuBinding.xdl", starBasicPath,
+ statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("bindingdialog/KeyBinding.xdl",starBasicPath, statusLabel))
- {
+
+ if (!zd.extractEntry("bindingdialog/KeyBinding.xdl", starBasicPath,
+ statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("bindingdialog/EventsBinding.xdl",starBasicPath, statusLabel))
- {
+
+ if (!zd.extractEntry("bindingdialog/EventsBinding.xdl", starBasicPath,
+ statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("bindingdialog/HelpBinding.xdl",starBasicPath, statusLabel))
- {
+
+ if (!zd.extractEntry("bindingdialog/HelpBinding.xdl", starBasicPath,
+ statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("bindingdialog/EditDebug.xdl",starBasicPath, statusLabel))
- {
+
+ if (!zd.extractEntry("bindingdialog/EditDebug.xdl", starBasicPath,
+ statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("bindingdialog/dialog.xlb",starBasicPath, statusLabel))
- {
+
+ if (!zd.extractEntry("bindingdialog/dialog.xlb", starBasicPath, statusLabel)) {
onInstallComplete();
return;
}
- if (!zd.extractEntry("bindingdialog/script.xlb",starBasicPath, statusLabel))
- {
+
+ if (!zd.extractEntry("bindingdialog/script.xlb", starBasicPath, statusLabel)) {
onInstallComplete();
return;
}
@@ -364,16 +375,13 @@ public class XmlUpdater extends Thread {
}// run
- public void addInstallListener(InstallListener listener)
- {
+ public void addInstallListener(InstallListener listener) {
listeners.add(listener);
}// addInstallListener
- private void onInstallComplete()
- {
- for (InstallListener l : listeners)
- {
+ private void onInstallComplete() {
+ for (InstallListener l : listeners) {
l.installationComplete(null);
}
}// onInstallComplete
diff --git a/scripting/workben/installer/ZipData.java b/scripting/workben/installer/ZipData.java
index 466f87a6e863..6e5d513a16be 100644
--- a/scripting/workben/installer/ZipData.java
+++ b/scripting/workben/installer/ZipData.java
@@ -24,7 +24,7 @@ import javax.swing.*;
public class ZipData {
public boolean extractEntry(String entry, String destination,
- JLabel statusLabel) {
+ JLabel statusLabel) {
OutputStream out = null;
InputStream in = null;
@@ -37,6 +37,7 @@ public class ZipData {
}
String entryName;
+
if (entry.lastIndexOf("/") != -1) {
entryName = entry.substring(entry.lastIndexOf("/") + 1);
} else {
@@ -44,9 +45,10 @@ public class ZipData {
}
String destName;
+
if (destination.lastIndexOf(File.separator) != -1) {
destName = destination.substring(destination
- .lastIndexOf(File.separator) + 1);
+ .lastIndexOf(File.separator) + 1);
} else {
destName = destination;
}
@@ -60,12 +62,13 @@ public class ZipData {
entry = "/" + entry;
in = this.getClass().getResourceAsStream(entry);
+
if (in == null) {
System.err.println("File " + entry + " not found in jar file");
if (statusLabel != null)
statusLabel.setText("Failed extracting " + entry
- + "see SFramework.log for more information");
+ + "see SFramework.log for more information");
return false;
}
@@ -74,11 +77,11 @@ public class ZipData {
out = new FileOutputStream(destination);
} catch (IOException ioe) {
System.err.println("Error opening " + destination + ": "
- + ioe.getMessage());
+ + ioe.getMessage());
if (statusLabel != null)
statusLabel.setText("Error opening" + destination
- + "see SFramework.log for more information");
+ + "see SFramework.log for more information");
return false;
}
@@ -91,11 +94,12 @@ public class ZipData {
out.write(bytes, 0, len);
} catch (IOException ioe) {
System.err.println("Error writing " + destination + ": "
- + ioe.getMessage());
+ + ioe.getMessage());
if (statusLabel != null)
statusLabel.setText("Failed writing " + destination
- + "see SFramework.log for more information");
+ + "see SFramework.log for more information");
+
return false;
} finally {
try {
@@ -104,6 +108,7 @@ public class ZipData {
} catch (IOException ioe) {
}
}
+
return true;
}
}