diff options
Diffstat (limited to 'scripting/workben/installer')
26 files changed, 0 insertions, 3330 deletions
diff --git a/scripting/workben/installer/Banner.java b/scripting/workben/installer/Banner.java deleted file mode 100644 index 79e28a7d5af8..000000000000 --- a/scripting/workben/installer/Banner.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.awt.*; - -public class Banner extends Canvas { - Image img; - Banner() { - setBackground(Color.white); - img = Toolkit.getDefaultToolkit().createImage("sidebar.jpg"); - } - - @Override - public void paint(Graphics g) { - g.drawImage(img, 0, 0, Color.white, null); - g.dispose(); - } - - @Override - public Dimension getPreferredSize() { - return new Dimension(137, 358); - } - -} diff --git a/scripting/workben/installer/ExceptionTraceHelper.java b/scripting/workben/installer/ExceptionTraceHelper.java deleted file mode 100644 index ecde5e448072..000000000000 --- a/scripting/workben/installer/ExceptionTraceHelper.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; -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) { - 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) { - baos.close(); - } - - if (ps != null) { - ps.close(); - } - } catch (Exception excp) { - } - } - - return result; - } -} diff --git a/scripting/workben/installer/ExecCmd.java b/scripting/workben/installer/ExecCmd.java deleted file mode 100644 index e52a63aefac0..000000000000 --- a/scripting/workben/installer/ExecCmd.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; -import java.io.*; -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) { - 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 - } - } - } - }).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(); - } catch (Exception e) {} // nothing can be done - } - } - } - }).start(); - int exitcode = p.waitFor(); - - if (exitcode != 0) { - System.out.println("cmd [" + cmd + "] failed"); - result = false; - } else { - System.out.println("cmd [" + cmd + "] completed successfully"); - result = true; - } - } catch (Exception e) { - System.out.println("Exception"); - e.printStackTrace(); - } - - System.out.println("command complete"); - return result; - } -} - diff --git a/scripting/workben/installer/FileUpdater.java b/scripting/workben/installer/FileUpdater.java deleted file mode 100644 index 6ba73692ca99..000000000000 --- a/scripting/workben/installer/FileUpdater.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.io.*; -import javax.swing.JLabel; - -public class FileUpdater { - - - - - public static boolean updateScriptXLC(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 + "script.xlc"); - - 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; - } - - 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(); - - 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"); - } - } - } - } 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); - } - } - - return true; - }// updateScriptXLC - - - 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 { - 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; - } - - 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(); - - out_file = new File(installPath + File.separator + "user" + File.separator + - "basic" + File.separator + "dialog.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/dialog.xlb/\" xlink:type=\"simple\" library:link=\"true\"/>\n"); - } - } - } - } 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); - } - } - - return true; - }// updateScriptXLC - - -} diff --git a/scripting/workben/installer/Final.java b/scripting/workben/installer/Final.java deleted file mode 100644 index b951537e8e0c..000000000000 --- a/scripting/workben/installer/Final.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.awt.event.*; -import java.util.*; -import javax.swing.*; - -public class Final extends javax.swing.JPanel implements ActionListener, - InstallListener { - - /** Creates new form Welcome */ - public Final(InstallWizard wizard) { - this.wizard = wizard; - setBackground(java.awt.Color.white); - xud = null; - initComponents(); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - private void initComponents() {//GEN-BEGIN:initComponents - statusPanel = new javax.swing.JPanel(); - statusPanel.setBackground(java.awt.Color.white); - statusLine = new javax.swing.JLabel("Ready", javax.swing.JLabel.CENTER); - - setLayout(new java.awt.BorderLayout()); - - statusPanel.setLayout(new java.awt.BorderLayout()); - - statusLine.setText("Waiting to install. \n All Office processes must be terminated."); - statusPanel.add(statusLine, java.awt.BorderLayout.CENTER); - - add(statusPanel, java.awt.BorderLayout.CENTER); - nav = new NavPanel(wizard, true, true, true, InstallWizard.VERSIONS, ""); - nav.setNextListener(this); - nav.removeCancelListener(nav); - nav.setCancelListener(this); - nav.navNext.setText("Install"); - add(nav, java.awt.BorderLayout.SOUTH); - - - - }//GEN-END:initComponents - - @Override - public java.awt.Dimension getPreferredSize() { - return new java.awt.Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT); - } - - public void actionPerformed(ActionEvent e) { - // 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); - nav.enableNext(false); - nav.enableBack(false); - 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(); - } - } - - // 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; - } - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JPanel statusPanel; - private javax.swing.JLabel statusLine; - private InstallWizard wizard; - private NavPanel nav; - private XmlUpdater xud; - // End of variables declaration//GEN-END:variables - -} diff --git a/scripting/workben/installer/IdeFinal.java b/scripting/workben/installer/IdeFinal.java deleted file mode 100644 index 93159b7b4e2b..000000000000 --- a/scripting/workben/installer/IdeFinal.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.awt.event.*; -import java.util.*; -import javax.swing.*; - -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; - initComponents(); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - private void initComponents() {//GEN-BEGIN:initComponents - statusPanel = new javax.swing.JPanel(); - statusPanel.setBackground(java.awt.Color.white); - statusLine = new javax.swing.JLabel("Ready", javax.swing.JLabel.CENTER); - - setLayout(new java.awt.BorderLayout()); - - statusPanel.setLayout(new java.awt.BorderLayout()); - - statusLine.setText("Waiting to install IDE support."); - 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); - }//GEN-END:initComponents - - @Override - public java.awt.Dimension getPreferredSize() { - return new java.awt.Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT); - } - - public void actionPerformed(ActionEvent e) { - // 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); - nav.enableNext(false); - nav.enableBack(false); - 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(); - } - } - - // 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) { - nav.removeCancelListener(this); - nav.setCancelListener(nav); - nav.navCancel.setText("Finish"); - nav.enableCancel(true); - ideupdater = null; - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JPanel statusPanel; - private javax.swing.JLabel statusLine; - private InstallWizard wizard; - private NavPanel nav; - private IdeUpdater ideupdater; - // End of variables declaration//GEN-END:variables - -} diff --git a/scripting/workben/installer/IdeUpdater.java b/scripting/workben/installer/IdeUpdater.java deleted file mode 100644 index b0ec0cd35cbf..000000000000 --- a/scripting/workben/installer/IdeUpdater.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.io.*; -import java.util.*; -import javax.swing.*; - -/** - * The <code>XmlUpdater</code> pulls a META-INF/converter.xml - * file out of a jar file and parses it, providing access to this - * information in a <code>Vector</code> of <code>ConverterInfo</code> - * objects. - */ -public class IdeUpdater extends Thread { - - private String installPath; - - private JLabel statusLabel; - - private ArrayList<InstallListener> listeners; - private Thread internalThread; - private boolean threadSuspended; - private JProgressBar progressBar; - - private boolean isNetbeansPath = false; - - - public IdeUpdater(String installPath, JLabel statusLabel, JProgressBar pBar) { - - if (!installPath.endsWith(File.separator)) - installPath += File.separator; - - File netbeansLauncher = new File(installPath + "bin"); - - if (netbeansLauncher.isDirectory()) { - isNetbeansPath = true; - installPath = installPath + "modules" + File.separator; - } - - 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); - }// XmlUpdater - - - @Override - public void run() { - - internalThread = Thread.currentThread(); - - 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; - } - } - - statusLabel.setText("Installation Complete"); - progressBar.setString("Installation Complete"); - progressBar.setValue(10); - onInstallComplete(); - - }// run - - - public void addInstallListener(InstallListener listener) { - listeners.add(listener); - }// addInstallListener - - - private void onInstallComplete() { - for (InstallListener l : listeners) { - l.installationComplete(null); - } - }// onInstallComplete - -}// XmlUpdater class diff --git a/scripting/workben/installer/IdeVersion.java b/scripting/workben/installer/IdeVersion.java deleted file mode 100644 index 3a7cc5a485a4..000000000000 --- a/scripting/workben/installer/IdeVersion.java +++ /dev/null @@ -1,337 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; - -import javax.swing.*; -import javax.swing.event.*; -import javax.swing.table.*; - -public class IdeVersion extends javax.swing.JPanel implements ActionListener, - TableModelListener { - - /** Creates new form Welcome */ - public IdeVersion(InstallWizard wizard) { - this.wizard = wizard; - setBackground(Color.white); - initComponents(); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - private void initComponents() { - Properties props = null; - JPanel versionPanel = new JPanel(); - setLayout(new BorderLayout()); - - - 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); - } - } - } - } - - props = ideProps; - } catch (Exception e) { - System.err.println("Exception thrown in initComponents"); - } - - tableModel = new MyTableModelIDE(props, InstUtil.versions); - - 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()); - - if (col != 2) - return null; - - int row = rowAtPoint(event.getPoint()); - Object o = getValueAt(row, col); - - if (o == null) - return null; - - if (o.toString().equals("")) - return null; - - return o.toString(); - } - - @Override - 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); - - if (o == null) - return null; - - if (o.toString().equals("")) - return null; - - Point pt = getCellRect(row, col, true).getLocation(); - pt.translate(-1, -2); - return pt; - } - }; - - JScrollPane scroll = new JScrollPane(tableVersions); - - tableVersions.setPreferredSize( - new Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT)); - - tableVersions.setRowSelectionAllowed(false); - tableVersions.setColumnSelectionAllowed(false); - tableVersions.setCellSelectionEnabled(false); - - initColumnSizes(tableVersions, tableModel); - versionPanel.add(scroll); - - 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.setNextListener(this); - add(nav, BorderLayout.SOUTH); - - }// initComponents - - - @Override - public java.awt.Dimension getPreferredSize() { - return new java.awt.Dimension(320, 280); - } - - - 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)); - } - } - - - public void tableChanged(TableModelEvent e) { - if (tableModel.isAnySelected()) { - nav.enableNext(true); - } else { - nav.enableNext(false); - } - } - - private void initColumnSizes(JTable table, MyTableModelIDE model) { - TableColumn column = null; - Component comp = null; - int headerWidth = 0; - int cellWidth = 0; - int preferredWidth = 0; - int totalWidth = 0; - Object[] longValues = model.longValues; - - for (int i = 0; i < 3; i++) { - column = table.getColumnModel().getColumn(i); - - try { - comp = column.getHeaderRenderer(). - getTableCellRendererComponent( - null, column.getHeaderValue(), - false, false, 0, 0); - headerWidth = comp.getPreferredSize().width; - } catch (NullPointerException e) { - // System.err.println("Null pointer exception!"); - // System.err.println(" getHeaderRenderer returns null in 1.3."); - // System.err.println(" The replacement is getDefaultRenderer."); - } - - // need to replace spaces in String before getting preferred width - if (longValues[i] instanceof String) { - longValues[i] = ((String)longValues[i]).replace(' ', '_'); - } - - System.out.println("longValues: " + longValues[i]); - comp = table.getDefaultRenderer(model.getColumnClass(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)); - } - - //XXX: Before Swing 1.1 Beta 2, use setMinWidth instead. - if (i == 2) { - if (preferredWidth > InstallWizard.DEFWIDTH - totalWidth) - column.setPreferredWidth(InstallWizard.DEFWIDTH - totalWidth); - else - column.setPreferredWidth(preferredWidth); - } else { - column.setMinWidth(preferredWidth); - totalWidth += preferredWidth; - } - } - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private InstallWizard wizard; - private MyTableModelIDE tableModel; - 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) { - data = new ArrayList<ArrayList<Object>>(); - - int len = validVersions.length; - - for (int i = 0; i < len; i++) { - String key = validVersions[i]; - String path = null; - - if ((path = properties.getProperty(key)) != null) { - 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); - } - } - }// MyTableModel - - public int getColumnCount() { - return 3; - } - - public int getRowCount() { - return data.size(); - } - - @Override - public String getColumnName(int col) { - return colNames[col]; - } - - public Object getValueAt(int row, int col) { - if (row < 0 || row > getRowCount() || - col < 0 || col > getColumnCount()) - return null; - - ArrayList<?> aRow = data.get(row); - return aRow.get(col); - } - - @Override - public Class getColumnClass(int c) { - return getValueAt(0, c).getClass(); - } - - @Override - public boolean isCellEditable(int row, int col) { - return (col == 0); - } - - @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() { - 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/IdeWelcome.java b/scripting/workben/installer/IdeWelcome.java deleted file mode 100644 index c6852bbd639c..000000000000 --- a/scripting/workben/installer/IdeWelcome.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.awt.event.*; - -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)); - initComponents(); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - private void initComponents() {//GEN-BEGIN:initComponents - welcomePanel = new javax.swing.JPanel(); - area = new javax.swing.JTextArea(); - - setLayout(new java.awt.BorderLayout()); - - welcomePanel.setLayout(new java.awt.BorderLayout()); - area.setEditable(false); - 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"); - } - - welcomePanel.add(area, java.awt.BorderLayout.CENTER); - add(welcomePanel, java.awt.BorderLayout.CENTER); - NavPanel nav = new NavPanel(wizard, false, true, true, "", - InstallWizard.IDEVERSIONS); - nav.setNextListener(this); - add(nav, java.awt.BorderLayout.SOUTH); - - }//GEN-END:initComponents - - @Override - public java.awt.Dimension getPreferredSize() { - return new java.awt.Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT); - } - - public void actionPerformed(ActionEvent ev) { - //Perform next actions here... - } - - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JPanel welcomePanel; - private javax.swing.JTextArea area; - private InstallWizard wizard; - - // End of variables declaration//GEN-END:variables -} diff --git a/scripting/workben/installer/InstUtil.java b/scripting/workben/installer/InstUtil.java deleted file mode 100644 index 262ce6c01e6b..000000000000 --- a/scripting/workben/installer/InstUtil.java +++ /dev/null @@ -1,326 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.net.URLDecoder; -import java.io.*; -import java.util.*; -import java.net.*; - -public class InstUtil { - - public static File buildSversionLocation() throws IOException { - File theFile = null; - StringBuffer str = new StringBuffer(); - str.append(System.getProperty("user.home")); - str.append(File.separator); - StringBuffer thePath = new StringBuffer(str.toString()); - - String os = System.getProperty("os.name"); - - if (os.indexOf("Windows") != -1) { - 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"); - theFile = new File(thePath.toString()); - } else if (os.indexOf("Linux") != -1) { - thePath.append(".sversionrc"); - theFile = new File(thePath.toString()); - } - - 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()) { - throw new IOException("Could not locate the OpenOffice settings file.\nAre you sure StarOffice is installed on your system?"); - } - - return theFile; - } - - - - public static boolean hasNetbeansInstallation() { - boolean result = false; - 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++) { - String key = supportedVersions[ index ]; - - if (installs.getProperty(key) != null) { - // at least one supported version for netbeans present, so return; - return true; - } - - } - } - - return false; - } - - - - - - - public static Properties getNetbeansLocation() { - Properties results = new Properties(); - - StringBuffer str = new StringBuffer(); - str.append(System.getProperty("user.home")); - str.append(File.separator); - StringBuffer thePath = new StringBuffer(str.toString()); - - String os = System.getProperty("os.name"); - - if (os.indexOf("Windows") != -1) { - thePath.append(".netbeans"); - } else if (os.indexOf("SunOS") != -1) { - 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; - } - } else { - System.out.println("No NetBeans user directory found"); - return null; - } - - - return results; - } - - - - private static String getNetbeansInstallation(File logFile) { - String installPath = ""; - - try { - 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; - } - } - - reader.close(); - } catch (IOException ioe) { - System.out.println("Error reading Netbeans location information"); - } - - return installPath; - } - - - private static File findVersionFile(File start) { - File versionFile = null; - - File files[] = start.listFiles(new VersionFilter()); - - if (files.length == 0) { - File dirs[] = start.listFiles(new DirFilter()); - - for (int i = 0; i < dirs.length; i++) { - versionFile = findVersionFile(dirs[i]); - - if (versionFile != null) { - break; - } - } - } else { - versionFile = files[0]; - } - - return versionFile; - } - - private static boolean verifySversionExists(File sversionFile) { - if (!sversionFile.exists()) - return false; - - return true; - } - - public static Properties getOfficeVersions(File sversionFile) throws - IOException { - BufferedReader reader = new BufferedReader(new FileReader(sversionFile)); - String sectionName = null; - Properties results = new Properties(); - - 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); - - 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 { - 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())); - } - } catch (MalformedURLException eSyntax) { - results.put(parts[0].trim(), parts[1].trim()); - System.err.println("GotHereException"); - } - } else { - System.out.println("not splitting on equals"); - } - } - } - - reader.close(); - return results; - } - - private static String getJavaVersion() { - return System.getProperty("java.version"); - } - - 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 { - f = InstUtil.buildSversionLocation(); - } 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"); - } - } - - public static final String [] versions = {"NetBeans 3.4", "jEdit 4.0.3", "jEdit 4.1pre5" }; -} - - - -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) { - return true; - } - - return false; - } -} diff --git a/scripting/workben/installer/InstallListener.java b/scripting/workben/installer/InstallListener.java deleted file mode 100644 index 81a005668369..000000000000 --- a/scripting/workben/installer/InstallListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -public interface InstallListener { - void installationComplete(InstallationEvent e); -} diff --git a/scripting/workben/installer/InstallWizard.java b/scripting/workben/installer/InstallWizard.java deleted file mode 100644 index fc9d3bdf19da..000000000000 --- a/scripting/workben/installer/InstallWizard.java +++ /dev/null @@ -1,350 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; -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()) - { - 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 - } - - System.out.println( "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); - } - - /** This method is called from within the constructor to - * initialize the form. - */ - private void initComponents() { - navigation = new javax.swing.JPanel(); - navBack = new javax.swing.JButton(); - navNext = new javax.swing.JButton(); - navCancel = new javax.swing.JButton(); - screens = new javax.swing.JPanel(); - - addWindowListener(new java.awt.event.WindowAdapter() { - @Override - public void windowClosing(java.awt.event.WindowEvent evt) { - exitForm(); - } - }); - - navigation.setLayout(new java.awt.GridBagLayout()); - java.awt.GridBagConstraints gridBagConstraints1; - - navBack.setText("<< Back"); - gridBagConstraints1 = new java.awt.GridBagConstraints(); - gridBagConstraints1.insets = new java.awt.Insets(1, 1, 1, 1); - - navNext.setText("Next >>"); - gridBagConstraints1 = new java.awt.GridBagConstraints(); - gridBagConstraints1.gridx = 2; - gridBagConstraints1.gridy = 0; - - navCancel.setText("Cancel"); - gridBagConstraints1 = new java.awt.GridBagConstraints(); - gridBagConstraints1.gridx = 6; - gridBagConstraints1.gridy = 0; - - getContentPane().add(navigation, java.awt.BorderLayout.SOUTH); - screens.setLayout(new java.awt.CardLayout()); - screens.add(WELCOME, new Welcome(this)); - version = new Version(this); - screens.add(VERSIONS, version); - _final = new Final(this); - screens.add(FINAL, _final); - - 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); - } - - getContentPane().add(screens, java.awt.BorderLayout.CENTER); - - navNext.addActionListener(this); - navNext.addActionListener(version); - navNext.addActionListener(_final); - - if (hasIDEInstallation) { - navNext.addActionListener(ideversion); - navNext.addActionListener(idefinal); - } - - 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); - pack(); - }// initComponents - - /** Exit the Application */ - public void exitForm() { - System.exit(0); - } - - - public void actionPerformed(ActionEvent e) { - if (e.getSource() == navNext) { - ((CardLayout)screens.getLayout()).next(screens); - } - - if (e.getSource() == navCancel) { - exitForm(); - } - - if (e.getSource() == navBack) { - ((CardLayout)screens.getLayout()).previous(screens); - } - }// actionPerformed - - public static void storeLocation(String path) { - locations.add(path); - } - - public static ArrayList<String> getLocations() { - return locations; - } - - public static void clearLocations() { - locations.clear(); - } - - public void show(String cardName) { - ((CardLayout)screens.getLayout()).show(screens, cardName); - } - - /** - * @param args the command line arguments - */ - public static void main(String args[]) { - String officePath = null; - String netbeansPath = null; - int i = 0; - - while (i < args.length) { - if (args[i].equals("-help")) { - 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++; - } - - if (officePath == null && netbeansPath == null) - new InstallWizard().show(); - - JLabel label = new JLabel(); - JProgressBar progressbar = new JProgressBar(); - - try { - System.out.println("Log file is: " + - System.getProperty("user.dir") + - File.separator + "SFrameworkInstall.log"); - - LogStream log = new LogStream("SFrameworkInstall.log"); - System.setErr(log); - System.setOut(log); - } catch (FileNotFoundException fnfe) { - System.err.println("Error: Unable to create log file: " - + fnfe.getMessage()); - System.exit(-1); - } - - if (officePath != null) { - XmlUpdater xud = new XmlUpdater(officePath, label, progressbar, bNetworkInstall, - bBindingsInstall); - xud.run(); - } - - if (netbeansPath != null) { - IdeUpdater ideup = new IdeUpdater(netbeansPath, label, progressbar); - ideup.run(); - } - } - - private static void printUsage() { - System.err.println("java -jar SFrameworkInstall.jar"); - System.err.println("\t[-office <path_to_office_installation]"); - System.err.println("\t[-netbeans <path_to_netbeans_installation]"); - System.err.println("\t[-net]"); - System.err.println("\t[-bindings]"); - System.err.println("\n\n-net indicates that this is the network part of a network install."); - System.err.println("-bindings will only install the menu & key bindings in user/config/soffice.cfg."); - } - - - - - - - - - - public static synchronized void setPatchedTypes(boolean value) { - bPatchedTypes = value; - } - - public static synchronized void setPatchedJava(boolean value) { - bPatchedJava = value; - } - - public static synchronized void setPatchedRDB(boolean value) { - bPatchedRDB = value; - } - - public static synchronized void setInstallStarted(boolean value) { - bInstallStarted = value; - } - - - - - - - - - - private javax.swing.JPanel navigation; - private javax.swing.JButton navBack; - private javax.swing.JButton navNext; - private javax.swing.JButton navCancel; - private javax.swing.JPanel screens; - - private Version version = null; - private Final _final = null; - private IdeVersion ideversion = null; - private IdeFinal idefinal = null; - private IdeWelcome idewelcome = null; - private static ArrayList<String> locations = null; - - public static String VERSIONS = "VERSIONS"; - public static String WELCOME = "WELCOME"; - public static String FINAL = "FINAL"; - public static String IDEVERSIONS = "IDEVERSIONS"; - public static String IDEWELCOME = "IDEWELCOME"; - public static String IDEFINAL = "IDEFINAL"; - - public static int DEFWIDTH = 480; - public static int DEFHEIGHT = 240; - - private static String typesPath = null; - private static String javaPath = null; - - public static boolean bNetworkInstall = false; - public static boolean bBindingsInstall = false; - - private static boolean bPatchedTypes = false; - private static boolean bPatchedJava = false; - private static boolean bPatchedRDB = false; - private static boolean bInstallStarted = false; - -}// InstallWizard diff --git a/scripting/workben/installer/InstallationEvent.java b/scripting/workben/installer/InstallationEvent.java deleted file mode 100644 index 9d91f9bf4505..000000000000 --- a/scripting/workben/installer/InstallationEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -public class InstallationEvent { - private Object source; - private String message; - InstallationEvent(Object source, String message) { - this.source = source; - this.message = message; - } - - public Object getSource() { - return source; - } - - public String getMessage() { - return message; - } -} diff --git a/scripting/workben/installer/LogStream.java b/scripting/workben/installer/LogStream.java deleted file mode 100644 index 27f33860d9d2..000000000000 --- a/scripting/workben/installer/LogStream.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; -import java.io.PrintStream; -import java.io.FileOutputStream; - -import java.util.Date; -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: "); - - private String getTimeStamp() { - String timeStamp = formatter.format(new Date()); - return timeStamp; - } - public LogStream(String logFileName) throws java.io.FileNotFoundException { - super(new FileOutputStream(logFileName)); - } - @Override - 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]); - 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); - fe.printStackTrace(); - } - } 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 deleted file mode 100644 index 89cfed25b1de..000000000000 --- a/scripting/workben/installer/NavPanel.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import javax.swing.*; -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) { - setBackground(Color.white); - setBorder(new javax.swing.border.EtchedBorder( - javax.swing.border.EtchedBorder.LOWERED)); - this.wizard = wizard; - this.next = next; - this.prev = prev; - navBack = new javax.swing.JButton("<< Back"); - navNext = new javax.swing.JButton("Next >>"); - navCancel = new javax.swing.JButton("Cancel"); - setLayout(new GridBagLayout()); - - gridBagConstraints1 = new java.awt.GridBagConstraints(); - gridBagConstraints1.insets = new java.awt.Insets(1, 1, 1, 1); - gridBagConstraints1.anchor = GridBagConstraints.WEST; - - gridBagConstraints2 = new java.awt.GridBagConstraints(); - gridBagConstraints2.gridx = 2; - gridBagConstraints2.gridy = 0; - - gridBagConstraints3 = new java.awt.GridBagConstraints(); - gridBagConstraints3.gridx = 6; - gridBagConstraints3.gridy = 0; - - navNext.setEnabled(bNext); - navBack.setEnabled(bBack); - navCancel.setEnabled(bCancel); - navNext.addActionListener(this); - navBack.addActionListener(this); - navCancel.addActionListener(this); - add(navBack, gridBagConstraints1); - add(navNext, gridBagConstraints2); - add(navCancel, gridBagConstraints3); - } - - public void enableNext(boolean bEnable) { - navNext.setEnabled(bEnable); - } - - public void enableBack(boolean bEnable) { - navBack.setEnabled(bEnable); - } - - public void enableCancel(boolean bEnable) { - navCancel.setEnabled(bEnable); - } - - public void enableIDE(boolean 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); - } - } - - public void setNextListener(ActionListener listener) { - navNext.addActionListener(listener); - } - - public void setBackListener(ActionListener listener) { - navBack.addActionListener(listener); - } - - public void setCancelListener(ActionListener listener) { - navCancel.addActionListener(listener); - } - - - - - - public void removeCancelListener(ActionListener listener) { - navCancel.removeActionListener(listener); - } - - private JButton navBack; - public JButton navNext; - public JButton navCancel; - private GridBagConstraints gridBagConstraints1; - private GridBagConstraints gridBagConstraints2; - private GridBagConstraints gridBagConstraints3; - private InstallWizard wizard; - private String next; - private String prev; - private boolean ideDetected = false; -} diff --git a/scripting/workben/installer/Navigation.java b/scripting/workben/installer/Navigation.java deleted file mode 100644 index 82c63a35ad9b..000000000000 --- a/scripting/workben/installer/Navigation.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -public class Navigation extends javax.swing.JPanel { - - /** Creates new form Navigation */ - public Navigation() { - initComponents(); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - private void initComponents() {//GEN-BEGIN:initComponents - navBack = new javax.swing.JButton(); - navNext = new javax.swing.JButton(); - navCancel = new javax.swing.JButton(); - - setLayout(new java.awt.GridBagLayout()); - java.awt.GridBagConstraints gridBagConstraints1; - - navBack.setText("<< Back"); - gridBagConstraints1 = new java.awt.GridBagConstraints(); - add(navBack, gridBagConstraints1); - - navNext.setText("Next >>"); - gridBagConstraints1 = new java.awt.GridBagConstraints(); - gridBagConstraints1.gridx = 2; - gridBagConstraints1.gridy = 0; - add(navNext, gridBagConstraints1); - - navCancel.setText("Cancel"); - gridBagConstraints1 = new java.awt.GridBagConstraints(); - gridBagConstraints1.gridx = 6; - gridBagConstraints1.gridy = 0; - add(navCancel, gridBagConstraints1); - - }//GEN-END:initComponents - - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton navBack; - private javax.swing.JButton navNext; - private javax.swing.JButton navCancel; - // End of variables declaration//GEN-END:variables - -} diff --git a/scripting/workben/installer/ProtocolHandler.xcu b/scripting/workben/installer/ProtocolHandler.xcu deleted file mode 100644 index fe55294f37da..000000000000 --- a/scripting/workben/installer/ProtocolHandler.xcu +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . ---> -<oor:node xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="ProtocolHandler" oor:package="org.openoffice.Office"> - <node oor:name="HandlerSet"> - <node oor:name="com.sun.star.comp.ScriptProtocolHandler" oor:op="replace"> - <prop oor:name="Protocols" oor:type="oor:string-list"> - <value>script:*</value> - </prop> - </node> - </node> -</oor:node> diff --git a/scripting/workben/installer/Register.java b/scripting/workben/installer/Register.java deleted file mode 100644 index afe95f5d1de6..000000000000 --- a/scripting/workben/installer/Register.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.io.*; -import javax.swing.*; -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]; - ExecCmd command = new ExecCmd(); - boolean isWindows = - (System.getProperty("os.name").indexOf("Windows") != -1); - - 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..."); - - for (int i = 0; i < packages.length; i++) { - String cmd = ""; - - if (!isWindows) { - env[0] = "LD_LIBRARY_PATH=" + progpath; - - goodResult = command.exec("chmod a+x " + progpath + "pkgchk", null); - - if (goodResult) { - cmd = progpath + "pkgchk -s -f " + progpath + packages[i]; - - System.err.println(cmd); - goodResult = command.exec(cmd, env); - } - } else { - cmd = "\"" + progpath + "pkgchk.exe\" -s -f \"" + progpath + - packages[i] + "\""; - - 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 + "\""); - - statusLabel.setText( - "PkgChk Failed, please view SFrameworkInstall.log"); - - 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"); - 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; - }// register - -}//Register diff --git a/scripting/workben/installer/Scripting.BeanShell.xcu b/scripting/workben/installer/Scripting.BeanShell.xcu deleted file mode 100644 index fdcc5d6b8695..000000000000 --- a/scripting/workben/installer/Scripting.BeanShell.xcu +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . ---> -<oor:node xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Scripting" oor:package="org.openoffice.Office"> - <node oor:name="ScriptRuntimes"> - <node oor:name="BeanShell" oor:op="replace"> - <prop oor:name="SupportedFileExtensions"> - <value xml:lang="x-no-translate">bsh</value> - <value xml:lang="en-US">bsh</value> - </prop> - </node> - </node> -</oor:node> diff --git a/scripting/workben/installer/Scripting.JavaScript.xcu b/scripting/workben/installer/Scripting.JavaScript.xcu deleted file mode 100644 index 1849dff273e1..000000000000 --- a/scripting/workben/installer/Scripting.JavaScript.xcu +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . ---> -<oor:node xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Scripting" oor:package="org.openoffice.Office"> - <node oor:name="ScriptRuntimes"> - <node oor:name="JavaScript" oor:op="replace"> - <prop oor:name="SupportedFileExtensions"> - <value xml:lang="x-no-translate">js</value> - <value xml:lang="en-US">js</value> - </prop> - </node> - </node> -</oor:node> diff --git a/scripting/workben/installer/Scripting.xcs b/scripting/workben/installer/Scripting.xcs deleted file mode 100644 index 1daeab8e978d..000000000000 --- a/scripting/workben/installer/Scripting.xcs +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . ---> -<!DOCTYPE oor:component-schema SYSTEM "../../../../component-schema.dtd"> -<oor:component-schema xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oor:name="Scripting" oor:package="org.openoffice.Office" xml:lang="en-US"> - <info> - <author>DF</author> - <desc xml:lang="x-no-translate"></desc> - <desc xml:lang="en-US">Contains the various settings needed by the Scripting Framework and its runtimes.</desc> - </info> - <templates> - <group oor:name="RuntimeNode"> - <info> - <desc xml:lang="x-no-translate"></desc> - <desc xml:lang="en-US">Specifies the runtimes available to the Scripting Framework.</desc> - </info> - <prop oor:name="SupportedFileExtensions" oor:type="oor:string-list"> - <info> - <desc xml:lang="x-no-translate"></desc> - <desc xml:lang="en-US">Lists the file extensions that are recognized by this runtime.</desc> - </info> - </prop> - </group> - </templates> - <component> - <set oor:name="ScriptRuntimes" oor:node-type="RuntimeNode"> - <info> - <desc xml:lang="x-no-translate"></desc> - <desc xml:lang="en-US">Lists the registered Scripting Framework runtimes.</desc> - </info> - </set> - </component> -</oor:component-schema> diff --git a/scripting/workben/installer/Version.java b/scripting/workben/installer/Version.java deleted file mode 100644 index 8ede6c54527e..000000000000 --- a/scripting/workben/installer/Version.java +++ /dev/null @@ -1,350 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.awt.*; -import java.awt.event.*; -import java.io.*; -import java.util.*; - -import javax.swing.*; -import javax.swing.event.*; -import javax.swing.table.*; - -public class Version extends javax.swing.JPanel implements ActionListener, - TableModelListener { - - /** Creates new form Welcome */ - public Version(InstallWizard wizard) { - this.wizard = wizard; - setBackground(Color.white); - initComponents(); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - private void initComponents() { - Properties props = null; - JPanel versionPanel = new JPanel(); - setLayout(new BorderLayout()); - - System.out.println("Initialising versions"); - - File fileVersions = null; - - try { - fileVersions = InstUtil.buildSversionLocation(); - } catch (IOException eFnF) { - System.err.println("Cannot find sversion.ini/.sversionrc"); - JOptionPane.showMessageDialog(this, eFnF.getMessage(), "File not Found", - JOptionPane.ERROR_MESSAGE); - wizard.exitForm(); - } - - try { - props = InstUtil.getOfficeVersions(fileVersions); - } 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); - 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); - wizard.exitForm(); - } - - tableModel.addTableModelListener(this); - JTable tableVersions = new JTable(tableModel) { - @Override - public String getToolTipText(MouseEvent event) { - int col = columnAtPoint(event.getPoint()); - - if (col != 2) - return null; - - int row = rowAtPoint(event.getPoint()); - Object o = getValueAt(row, col); - - if (o == null) - return null; - - if (o.toString().equals("")) - return null; - - return o.toString(); - } - - @Override - 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); - - if (o == null) - return null; - - if (o.toString().equals("")) - return null; - - Point pt = getCellRect(row, col, true).getLocation(); - pt.translate(-1, -2); - return pt; - } - }; - - JScrollPane scroll = new JScrollPane(tableVersions); - - tableVersions.setPreferredSize( - new Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT)); - - tableVersions.setRowSelectionAllowed(false); - tableVersions.setColumnSelectionAllowed(false); - tableVersions.setCellSelectionEnabled(false); - - initColumnSizes(tableVersions, tableModel); - versionPanel.add(scroll); - - 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.setNextListener(this); - add(nav, BorderLayout.SOUTH); - - }// initComponents - - private void initColumnSizes(JTable table, MyTableModel model) { - TableColumn column = null; - Component comp = null; - int headerWidth = 0; - int cellWidth = 0; - int preferredWidth = 0; - int totalWidth = 0; - Object[] longValues = model.longValues; - - for (int i = 0; i < 3; i++) { - column = table.getColumnModel().getColumn(i); - - try { - comp = column.getHeaderRenderer(). - getTableCellRendererComponent( - null, column.getHeaderValue(), - false, false, 0, 0); - headerWidth = comp.getPreferredSize().width; - } catch (NullPointerException e) { - // System.err.println("Null pointer exception!"); - // System.err.println(" getHeaderRenderer returns null in 1.3."); - // System.err.println(" The replacement is getDefaultRenderer."); - } - - // need to replace spaces in String before getting preferred width - if (longValues[i] instanceof String) { - longValues[i] = ((String)longValues[i]).replace(' ', '_'); - } - - System.out.println("longValues: " + longValues[i]); - comp = table.getDefaultRenderer(model.getColumnClass(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)); - } - - //XXX: Before Swing 1.1 Beta 2, use setMinWidth instead. - if (i == 2) { - if (preferredWidth > InstallWizard.DEFWIDTH - totalWidth) - column.setPreferredWidth(InstallWizard.DEFWIDTH - totalWidth); - else - column.setPreferredWidth(preferredWidth); - } else { - column.setMinWidth(preferredWidth); - totalWidth += preferredWidth; - } - } - } - - @Override - public java.awt.Dimension getPreferredSize() { - return new java.awt.Dimension(320, 280); - } - - - 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)); - } - } - - - public void tableChanged(TableModelEvent e) { - if (tableModel.isAnySelected()) { - nav.enableNext(true); - } else { - nav.enableNext(false); - } - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private InstallWizard wizard; - private MyTableModel tableModel; - private NavPanel nav; - private static final String [] versions = {"StarOffice 6.1", "OpenOffice.org 1.1Beta", "OpenOffice.org 644", "OpenOffice.org 1.1"}; - // End of variables declaration//GEN-END:variables - -} - -class MyTableModel extends AbstractTableModel { - ArrayList<ArrayList<Object>> data; - private String colNames[] = {"", "Name", "Location"}; - Object[] longValues = new Object[] {Boolean.TRUE, "Name", "Location"}; - - 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) { - String pkgChkPath = path + File.separator + "program" + File.separator; - - if (isWindows) { - pkgChkPath += "pkgchk.exe"; - } else { - pkgChkPath += "pkgchk"; - } - - 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); - } - } - } - }// MyTableModel - - public int getColumnCount() { - return 3; - } - - public int getRowCount() { - return data.size(); - } - - @Override - public String getColumnName(int col) { - return colNames[col]; - } - - public Object getValueAt(int row, int col) { - if (row < 0 || row > getRowCount() || - col < 0 || col > getColumnCount()) - return null; - - ArrayList<?> aRow = data.get(row); - return aRow.get(col); - } - - @Override - public Class getColumnClass(int c) { - return getValueAt(0, c).getClass(); - } - - @Override - public boolean isCellEditable(int row, int col) { - return (col == 0); - } - - @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() { - 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 deleted file mode 100644 index c71a7af6b4fb..000000000000 --- a/scripting/workben/installer/Welcome.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.awt.event.*; - -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)); - initComponents(); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - private void initComponents() {//GEN-BEGIN:initComponents - welcomePanel = new javax.swing.JPanel(); - area = new javax.swing.JTextArea(); - nextButtonEnable = true; - - setLayout(new java.awt.BorderLayout()); - - welcomePanel.setLayout(new java.awt.BorderLayout()); - area.setEditable(false); - area.setLineWrap(true); - - String message = "\n\tOffice Scripting Framework Version 0.3" + - "\n\n\n\tPlease ensure that you have exited from Office"; - - setUpWelcomePanel(message); - - }//GEN-END:initComponents - - 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); - } - - - @Override - public java.awt.Dimension getPreferredSize() { - return new java.awt.Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT); - } - - public void actionPerformed(ActionEvent ev) { - //Perform next actions here... - } - - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JPanel welcomePanel; - private javax.swing.JTextArea area; - private InstallWizard wizard; - private boolean nextButtonEnable = true; - - // End of variables declaration//GEN-END:variables -} diff --git a/scripting/workben/installer/XmlUpdater.java b/scripting/workben/installer/XmlUpdater.java deleted file mode 100644 index c7bd2ff6ac3a..000000000000 --- a/scripting/workben/installer/XmlUpdater.java +++ /dev/null @@ -1,389 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.io.*; -import java.util.*; -import javax.swing.*; - -public class XmlUpdater extends Thread { - - private String installPath; - private boolean netInstall; - private boolean bindingsInstall; - - private JLabel statusLabel; - - private ArrayList<InstallListener> listeners; - private Thread internalThread; - private boolean threadSuspended; - private JProgressBar progressBar; - - private final String[] bakFiles = { - "writermenubar.xml", - "writerkeybinding.xml", - "calcmenubar.xml", - "calckeybinding.xml", - "impressmenubar.xml", - "impresskeybinding.xml", - "drawmenubar.xml", - "drawkeybinding.xml", - "eventbindings.xml", - "META-INF" + File.separator + "manifest.xml" - }; - - private final String[] dirs = { - "java" + File.separator + "Highlight", - "java" + File.separator + "MemoryUsage", - "java" + File.separator + "ScriptFrmwrkHelper", - "java" + File.separator + "debugger", - "java" + File.separator + "debugger" + File.separator + "rhino", - "beanshell" + File.separator + "InteractiveBeanShell", - "beanshell" + File.separator + "Highlight", - "beanshell" + File.separator + "MemoryUsage", - "javascript" + File.separator + "ExportSheetsToHTML" - }; - - private final String[] names = { - "java/Highlight/HighlightUtil.java", - "java/Highlight/HighlightText.java", - "java/Highlight/Highlight.jar", - "java/Highlight/parcel-descriptor.xml", - "java/MemoryUsage/MemoryUsage.java", - "java/MemoryUsage/MemoryUsage.class", - "java/MemoryUsage/parcel-descriptor.xml", - "java/MemoryUsage/ExampleSpreadSheet.sxc", - "java/ScriptFrmwrkHelper/parcel-descriptor.xml", - "java/ScriptFrmwrkHelper/ScriptFrmwrkHelper.java", - "java/ScriptFrmwrkHelper/ScriptFrmwrkHelper.class", - "java/ScriptFrmwrkHelper/ScriptFrmwrkHelper.jar", - "java/debugger/debugger.jar", - "java/debugger/OOBeanShellDebugger.java", - "java/debugger/OOScriptDebugger.java", - "java/debugger/DebugRunner.java", - "java/debugger/OORhinoDebugger.java", - "java/debugger/parcel-descriptor.xml", - "java/debugger/rhino/Main.java", - "beanshell/InteractiveBeanShell/parcel-descriptor.xml", - "beanshell/InteractiveBeanShell/interactive.bsh", - "beanshell/Highlight/parcel-descriptor.xml", - "beanshell/Highlight/highlighter.bsh", - "beanshell/MemoryUsage/parcel-descriptor.xml", - "beanshell/MemoryUsage/memusage.bsh", - "javascript/ExportSheetsToHTML/parcel-descriptor.xml", - "javascript/ExportSheetsToHTML/exportsheetstohtml.js" - }; - - - 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.setStringPainted(true); - }// XmlUpdater - - - - - - public void setResume() { - threadSuspended = false; - notify(); - }// setResume - - - @Override - public void run() { - - internalThread = Thread.currentThread(); - - 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 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; - - //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 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"); - - // Backup the confguration files in - // <office>/user/config/soffice.cfg/ - // If they already exist. - - 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"); - } - } - } - - // Adding Office configuration files - if (!zd.extractEntry("bindingdialog/writermenubar.xml", configPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/writerkeybinding.xml", configPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/calcmenubar.xml", configPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/calckeybinding.xml", configPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/impressmenubar.xml", configPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/impresskeybinding.xml", configPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/drawmenubar.xml", configPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/drawkeybinding.xml", configPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/eventbindings.xml", configPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/manifest.xml", manifestPath, statusLabel)) { - onInstallComplete(); - return; - } - } - - 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"); - } - } else - System.out.println("ScriptBindingLibrary exists"); - - // Adding Scripting Framework and tools - if (!zd.extractEntry("sframework/ooscriptframe.zip", progpath, statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("sframework/bshruntime.zip", progpath, statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("sframework/jsruntime.zip", progpath, statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("schema/Scripting.xcs", regSchemaOfficePath, - statusLabel)) { - onInstallComplete(); - return; - } - - - - progressBar.setString("Registering Scripting Framework"); - progressBar.setValue(3); - - if (!Register.register(installPath + File.separator, statusLabel)) { - onInstallComplete(); - return; - } - - progressBar.setValue(5); - - String path = installPath + File.separator + - "share" + File.separator + "Scripts" + File.separator; - - for (int i = 0; i < dirs.length; i++) { - File dir = new File(path + dirs[i]); - - if (!dir.exists()) { - if (!dir.mkdirs()) { - System.err.println("Error making dir: " + - dir.getAbsolutePath()); - onInstallComplete(); - return; - } - } - } - - for (int i = 0; i < names.length; i++) { - String source = "/examples/" + names[i]; - String dest = path + names[i].replace('/', File.separatorChar); - - if (!zd.extractEntry(source, dest, statusLabel)) { - onInstallComplete(); - return; - } - } - - - // Adding binding dialog - if (!zd.extractEntry("bindingdialog/ScriptBinding.xba", starBasicPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/MenuBinding.xdl", starBasicPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/KeyBinding.xdl", starBasicPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/EventsBinding.xdl", starBasicPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/HelpBinding.xdl", starBasicPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/EditDebug.xdl", starBasicPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/dialog.xlb", starBasicPath, statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/script.xlb", starBasicPath, statusLabel)) { - onInstallComplete(); - return; - } - } - - - statusLabel.setText("Installation Complete"); - progressBar.setString("Installation Complete"); - progressBar.setValue(10); - onInstallComplete(); - - }// run - - - public void addInstallListener(InstallListener listener) { - listeners.add(listener); - }// addInstallListener - - - private void onInstallComplete() { - for (InstallListener l : listeners) { - l.installationComplete(null); - } - }// onInstallComplete - -}// XmlUpdater class diff --git a/scripting/workben/installer/ZipData.java b/scripting/workben/installer/ZipData.java deleted file mode 100644 index 6e5d513a16be..000000000000 --- a/scripting/workben/installer/ZipData.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.io.*; -import javax.swing.*; - -public class ZipData { - - public boolean extractEntry(String entry, String destination, - JLabel statusLabel) { - - OutputStream out = null; - InputStream in = null; - - System.out.println("Copying: " + entry); - System.out.println("To: " + destination); - - if (statusLabel != null) { - statusLabel.setText("Copying " + entry); - } - - String entryName; - - if (entry.lastIndexOf("/") != -1) { - entryName = entry.substring(entry.lastIndexOf("/") + 1); - } else { - entryName = entry; - } - - String destName; - - if (destination.lastIndexOf(File.separator) != -1) { - destName = destination.substring(destination - .lastIndexOf(File.separator) + 1); - } else { - destName = destination; - } - - if (!destName.equals(entryName)) - destination = destination.concat(entryName); - - System.out.println("Unzipping " + entry + " to " + destination); - - if (!entry.startsWith("/")) - 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"); - - return false; - } - - try { - out = new FileOutputStream(destination); - } catch (IOException ioe) { - System.err.println("Error opening " + destination + ": " - + ioe.getMessage()); - - if (statusLabel != null) - statusLabel.setText("Error opening" + destination - + "see SFramework.log for more information"); - - return false; - } - - try { - byte[] bytes = new byte[1024]; - int len; - - while ((len = in.read(bytes)) != -1) - out.write(bytes, 0, len); - } catch (IOException ioe) { - System.err.println("Error writing " + destination + ": " - + ioe.getMessage()); - - if (statusLabel != null) - statusLabel.setText("Failed writing " + destination - + "see SFramework.log for more information"); - - return false; - } finally { - try { - in.close(); - out.close(); - } catch (IOException ioe) { - } - } - - return true; - } -} diff --git a/scripting/workben/installer/sidebar.jpg b/scripting/workben/installer/sidebar.jpg Binary files differdeleted file mode 100644 index c2b366f74e76..000000000000 --- a/scripting/workben/installer/sidebar.jpg +++ /dev/null |