diff options
author | Duncan Foster <dfoster@openoffice.org> | 2003-06-18 12:49:12 +0000 |
---|---|---|
committer | Duncan Foster <dfoster@openoffice.org> | 2003-06-18 12:49:12 +0000 |
commit | ce27b0c266fb2121b9daa23f4c44f221821dd8ba (patch) | |
tree | 5affcd86dda391880f90e4497658a90212abe320 /scripting/workben | |
parent | a2cfa6350557178f3cb5fe63895bbb4266040dfd (diff) |
Added javascript example to install
Diffstat (limited to 'scripting/workben')
-rwxr-xr-x | scripting/workben/build.xml | 871 | ||||
-rw-r--r-- | scripting/workben/installer/XmlUpdater.java | 861 |
2 files changed, 869 insertions, 863 deletions
diff --git a/scripting/workben/build.xml b/scripting/workben/build.xml index 06baf1db3db7..d2b51fcb0381 100755 --- a/scripting/workben/build.xml +++ b/scripting/workben/build.xml @@ -1,434 +1,437 @@ -<!--
-#*************************************************************************
-#
-# $RCSfile: build.xml,v $
-#
-# $Revision: 1.26 $
-#
-# last change: $Author: toconnor $ $Date: 2003-06-03 09:32:49 $
-#
-# The Contents of this file are made available subject to the terms of
-# either of the following licenses
-#
-# - GNU Lesser General Public License Version 2.1
-# - Sun Industry Standards Source License Version 1.1
-#
-# Sun Microsystems Inc., October, 2000
-#
-# GNU Lesser General Public License Version 2.1
-# =============================================
-# Copyright 2000 by Sun Microsystems, Inc.
-# 901 San Antonio Road, Palo Alto, CA 94303, USA
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License version 2.1, as published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-#
-# Sun Industry Standards Source License Version 1.1
-# =================================================
-# The contents of this file are subject to the Sun Industry Standards
-# Source License Version 1.1 (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.openoffice.org/license.html.
-#
-# Software provided under this License is provided on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
-# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
-# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
-# See the License for the specific provisions governing your rights and
-# obligations concerning the Software.
-#
-# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
-#
-# Copyright: 2000 by Sun Microsystems, Inc.
-#
-# All Rights Reserved.
-#
-# Contributor(s): _______________________________________
-#
-#
-#
-#*************************************************************************
--->
-<project name="Scipting Framework Installer" default="jar" basedir=".">
-
- <!-- =================== Environmental Properties ======================= -->
-
- <property name="prj" value=".."/>
- <property file="${prj}/java/build.env"/>
- <property name="build.compiler" value="classic"/>
- <property name="optimize" value="on"/>
- <property name="debug" value="on"/>
- <property name="installerclasses" value="${out}/class/sframeworkinstall"/>
- <property name="jardir" value="${out}/class"/>
- <property name="bindir" value="${out}/bin"/>
- <property name="sfversion" value="0.3"/>
- <property name="installerjarname" value="SFrameworkInstall.jar"/>
- <property environment="env"/>
-
- <!-- ==================== classpath setting ============================ -->
- <path id="idlclasspath">
- <pathelement location="${solar.jar}/unoil.jar"/>
- <!-- <pathelement location="${prj}/../unoil/${inpath}/class/unoil.jar"/> -->
- <pathelement location="${solar.jar}/jurt.jar"/>
- <pathelement location="${solar.jar}/jut.jar"/>
- <pathelement location="${solar.jar}/juh.jar"/>
- <pathelement location="${solar.jar}/java_uno.jar"/>
- <pathelement location="${solar.jar}/ridl.jar"/>
- <pathelement location="${solar.jar}/sandbox.jar"/>
- </path>
- <path id="scriptexampleclasspath">
- <pathelement location="${solar.jar}/unoil.jar"/>
- <!-- pathelement location="${prj}/../unoil/${inpath}/class/unoil.jar"/ -->
- <pathelement location="${solar.jar}/jurt.jar"/>
- <pathelement location="${solar.jar}/jut.jar"/>
- <pathelement location="${solar.jar}/juh.jar"/>
- <pathelement location="${solar.jar}/java_uno.jar"/>
- <pathelement location="${solar.jar}/ridl.jar"/>
- <pathelement location="${solar.jar}/sandbox.jar"/>
- <pathelement location="${out}/class/ScriptRuntimeForJava.jar"/>
- </path>
-
- <path id="debuggerclasspath">
- <pathelement location="${out}/class/ScriptRuntimeForJava.jar"/>
- <pathelement location="${solar.jar}/ridl.jar"/>
- <pathelement location="${solar.jar}/unoil.jar"/>
- <pathelement location="${out}/class/jsruntime/skip_registration/js.jar"/>
- <pathelement location="${install.dir}/bsh-1.2b7.jar"/>
- </path>
- <!-- ===================== Set up build conditionals ========================= -->
- <target name="product.test">
- <condition property="noproext">
- <equals arg1="$${env.PROEXT}" arg2="${env.PROEXT}"/>
- </condition>
- </target>
- <target name="nonproduct.set" if="noproext">
- <echo message="non-product build"/>
- <property name="proext" value=""/>
- </target>
- <target name="product.set" unless="noproext">
- <echo message="product build"/>
- <property name="proext" value="${env.PROEXT}"/>
- </target>
- <target name="build.conditions" depends="product.test,nonproduct.set,product.set">
- <condition property="win9.build">
- <available file="${prj}/wntmsci9${proext}"/>
- </condition>
- <condition property="win8.build">
- <available file="${prj}/wntmsci8${proext}"/>
- </condition>
- <condition property="win7.build">
- <available file="${prj}/wntmsci7${proext}"/>
- </condition>
- <condition property="linx86.build">
- <available file="${prj}/unxlngi5${proext}"/>
- </condition>
- <condition property="solsparc.build">
- <available file="${prj}/unxsols4${proext}"/>
- </condition>
- <!-- <condition property="openoffice.build">
- </condition> -->
- </target>
- <!-- ===================== Build the examples ========================= -->
- <target name="buildexamples">
-
- <mkdir dir="${out}/class/examples/java/debugger"/>
- <javac srcdir="${prj}/examples/java/debugger"
- destdir="${out}/class/examples/java/debugger"
- includes="*.java"
- classpathref="debuggerclasspath"
- debug="${debug}" optimize="${optimize}" deprecation="on"/>
-
- <copy todir="${out}/class/examples/java/debugger">
- <fileset dir="${prj}/examples/java/debugger">
- <include name="**/*.java"/>
- <include name="*.xml"/>
- </fileset>
- </copy>
-
- <jar jarfile="${out}/class/examples/java/debugger/debugger.jar"
- basedir="${out}/class/examples/java/debugger" includes="*.class">
- <manifest>
- <attribute name="Built-By" value="Sun Microsystems"/>
- <attribute name="ScriptFramework-Version" value="${sfversion}"/>
- </manifest>
- </jar>
-
- <delete>
- <fileset dir="${out}/class/examples/java/debugger" includes="*.class"/>
- </delete>
-
- <mkdir dir="${out}/class/examples/java/Highlight"/>
- <javac srcdir="${prj}/examples/java/" destdir="${out}/class/examples/java/Highlight/"
- includes="**/Highlight*.java" classpathref="idlclasspath"
- debug="${debug}" optimize="${optimize}" deprecation="on"/>
- <copy todir="${out}/class/examples/java/Highlight/">
- <fileset dir="${prj}/examples/java/">
- <include name="**/Highlight*.java"/>
- </fileset>
- </copy>
- <copy file="${prj}/examples/java/HighlightTextParcel.xml" tofile="${out}/class/examples/java/Highlight/parcel-descriptor.xml"/>
- <jar jarfile="${out}/class/examples/java/Highlight/Highlight.jar"
- basedir="${out}/class/examples/java/Highlight"
- includes="**/*.java,**/*.class,**/*.xml"
- excludes="${out}/class/examples/java/Highlight/Highlight.jar">
- <manifest>
- <attribute name="Built-By" value="Sun Microsystems"/>
- <attribute name="ScriptFramework-Version" value="${sfversion}"/>
- </manifest>
- </jar>
- <mkdir dir="${out}/class/examples/java/MemoryUsage"/>
- <javac srcdir="${prj}/examples/java/" destdir="${out}/class/examples/java/MemoryUsage/"
- includes="**/MemoryUsage.java" classpathref="idlclasspath"
- debug="${debug}" optimize="${optimize}" deprecation="on"/>
- <copy file="${prj}/examples/java/MemoryUsage.java" todir="${out}/class/examples/java/MemoryUsage/"/>
- <copy file="${prj}/examples/java/MemoryUsageParcel.xml" tofile="${out}/class/examples/java/MemoryUsage/parcel-descriptor.xml"/>
- <copy file="${prj}/examples/java/MemoryUsage.java" todir="${out}/class/examples/java/MemoryUsage/"/>
- <copy file="${prj}/examples/java/ExampleSpreadSheet.sxc" todir="${out}/class/examples/java/MemoryUsage/"/>
-
- <mkdir dir="${out}/class/examples/java/ScriptFrmwrkHelper"/>
- <javac srcdir="${prj}/examples/java/" destdir="${out}/class/examples/java/ScriptFrmwrkHelper/"
- includes="**/ScriptFrmwrkHelper.java" classpathref="scriptexampleclasspath"
- debug="${debug}" optimize="${optimize}" deprecation="on"/>
- <copy todir="${out}/class/examples/java/ScriptFrmwrkHelper/">
- <fileset dir="${prj}/examples/java/">
- <include name="**/ScriptFrmwrkHelper.java"/>
- </fileset>
- </copy>
- <copy file="${prj}/examples/java/ScriptFrameWkHelperParcel.xml" tofile="${out}/class/examples/java/ScriptFrmwrkHelper/parcel-descriptor.xml"/>
- <jar jarfile="${out}/class/examples/java/ScriptFrmwrkHelper/ScriptFrmwrkHelper.jar"
- basedir="${out}/class/examples/java/ScriptFrmwrkHelper"
- includes="**/*.java,**/*.class,**/*.xml"
- excludes="${out}/class/examples/java/ScriptFrmwrkHelper/ScriptFrmwrkHelper.jar">
- <manifest>
- <attribute name="Built-By" value="Sun Microsystems"/>
- <attribute name="ScriptFramework-Version" value="${sfversion}"/>
- </manifest>
- </jar>
- <mkdir dir="${out}/class/examples/beanshell"/>
- <copy todir="${out}/class/examples/beanshell">
- <fileset dir="${prj}/examples/beanshell" includes="**"/>
- </copy>
- </target>
-
- <!-- ===================== Build UNO package ========================= -->
- <target name="buildunopackage_win9" depends="build.conditions" if="win9.build">
- <mkdir dir="${out}/class/sframeworkinstall/sframework"/>
- <mkdir dir="${out}/class/sframework"/>
- <copy file="${solar.bin}/ScriptFramework.rdb"
- todir="${out}/class/sframework/"/>
- <copy file="${out}/class/ScriptRuntimeForJava.jar"
- todir="${out}/class/sframework/"/>
- <copy file="${out}/class/ScriptFramework.jar"
- todir="${out}/class/sframework/"/>
- <mkdir dir="${out}/class/sframework/windows.plt"/>
- <copy todir="${out}/class/sframework/windows.plt">
- <fileset dir="${prj}/wntmsci9${proext}/bin/">
- <include name="**/*.dll"/>
- </fileset>
- </copy>
- <mkdir dir="${out}/class/sframework/skip_registration"/>
- <copy file="${solar.jar}/unoil.jar"
- todir="${out}/class/sframework/skip_registration"/>
- </target>
- <target name="buildunopackage_win8" depends="build.conditions" if="win8.build">
- <mkdir dir="${out}/class/sframeworkinstall/sframework"/>
- <mkdir dir="${out}/class/sframework"/>
- <copy file="${solar.bin}/ScriptFramework.rdb"
- todir="${out}/class/sframework/"/>
- <copy file="${out}/class/ScriptRuntimeForJava.jar"
- todir="${out}/class/sframework/"/>
- <copy file="${out}/class/ScriptFramework.jar"
- todir="${out}/class/sframework/"/>
- <mkdir dir="${out}/class/sframework/windows.plt"/>
- <copy todir="${out}/class/sframework/windows.plt">
- <fileset dir="${prj}/wntmsci8${proext}/bin/">
- <include name="**/*.dll"/>
- </fileset>
- </copy>
- <mkdir dir="${out}/class/sframework/skip_registration"/>
- <copy file="${solar.jar}/unoil.jar"
- todir="${out}/class/sframework/skip_registration"/>
- </target>
-<!-- <target name="buildunopackage_win7" depends="build.conditions" if="win7.build">
- <mkdir dir="${out}/class/sframeworkinstall/sframework"/>
- <mkdir dir="${out}/class/sframework"/>
- <copy file="${solar.bin}/ScriptFramework.rdb"
- todir="${out}/class/sframework/"/>
- <copy file="${out}/class/ScriptRuntimeForJava.jar"
- todir="${out}/class/sframework/"/>
- <copy file="${out}/class/ScriptFramework.jar"
- todir="${out}/class/sframework/"/>
- <mkdir dir="${out}/class/sframework/windows.plt"/>
- <copy todir="${out}/class/sframework/windows.plt">
- <fileset dir="${prj}/wntmsci7${proext}/bin/">
- <include name="**/*.dll"/>
- </fileset>
- </copy>
- <mkdir dir="${out}/class/sframework/skip_registration"/>
- <copy file="${solar.jar}/unoil.jar"
- todir="${out}/class/sframework/skip_registration"/>
- </target> -->
- <target name="buildunopackage_linux" depends="build.conditions" if="linx86.build">
- <mkdir dir="${out}/class/sframeworkinstall/sframework"/>
- <mkdir dir="${out}/class/sframework"/>
- <copy file="${solar.bin}/ScriptFramework.rdb"
- todir="${out}/class/sframework/"/>
- <copy file="${out}/class/ScriptRuntimeForJava.jar"
- todir="${out}/class/sframework/"/>
- <copy file="${out}/class/ScriptFramework.jar"
- todir="${out}/class/sframework/"/>
- <mkdir dir="${out}/class/sframework/linux_x86.plt"/>
- <copy todir="${out}/class/sframework/linux_x86.plt">
- <fileset dir="${prj}/unxlngi5${proext}/lib/">
- <include name="**/lib*.so"/>
- </fileset>
- </copy>
- <mkdir dir="${out}/class/sframework/skip_registration"/>
- <copy file="${solar.jar}/unoil.jar"
- todir="${out}/class/sframework/skip_registration"/>
- </target>
- <target name="buildunopackage_solaris" depends="build.conditions" if="solsparc.build">
- <mkdir dir="${out}/class/sframeworkinstall/sframework"/>
- <mkdir dir="${out}/class/sframework"/>
- <copy file="${solar.bin}/ScriptFramework.rdb"
- todir="${out}/class/sframework/"/>
- <copy file="${out}/class/ScriptRuntimeForJava.jar"
- todir="${out}/class/sframework/"/>
- <copy file="${out}/class/ScriptFramework.jar"
- todir="${out}/class/sframework/"/>
- <mkdir dir="${out}/class/sframework/solaris_sparc.plt"/>
- <copy todir="${out}/class/sframework/solaris_sparc.plt">
- <fileset dir="${prj}/unxsols4${proext}/lib/">
- <include name="**/lib*.so"/>
- </fileset>
- </copy>
- <mkdir dir="${out}/class/sframework/skip_registration"/>
- <copy file="${solar.jar}/unoil.jar"
- todir="${out}/class/sframework/skip_registration"/>
- </target>
- <target name="buildunopackage" depends="buildunopackage_win8,buildunopackage_linux,buildunopackage_solaris">
- <!-- <target name="buildunopackage" depends="buildunopackage_win9,buildunopackage_win7,buildunopackage_linux,buildunopackage_solaris"> -->
- <copy file="installer/ProtocolHandler.xcu"
- todir="${out}/class/sframework/"/>
- <zip zipfile="${out}/class/sframeworkinstall/sframework/ooscriptframe.zip"
- basedir="${out}/class/sframework">
- </zip>
- </target>
-
- <!-- ================== Build JavaScript UNO package ===================== -->
- <target name="buildjsuno">
- <mkdir dir="${out}/class/sframeworkinstall/sframework"/>
-
- <mkdir dir="${out}/class/jsruntime"/>
- <mkdir dir="${out}/class/jsruntime/skip_registration"/>
- <mkdir dir="${out}/class/jsruntimetmp"/>
-
- <copy file="${out}/class/ScriptRuntimeForJavaScript.jar"
- todir="${out}/class/jsruntime/"/>
- <copy file="installer/Scripting.JavaScript.xcu"
- tofile="${out}/class/jsruntime/Scripting.xcu"/>
-
- <unzip src="${install.dir}/js.jar"
- dest="${out}/class/jsruntimetmp"/>
-
- <javac srcdir="${prj}/examples/java/debugger"
- destdir="${out}/class/jsruntimetmp"
- includes="rhino/Main.java" classpathref="debuggerclasspath"
- debug="${debug}" optimize="${optimize}" deprecation="on"/>
-
- <zip destfile="${out}/class/jsruntime/skip_registration/js.jar"
- basedir="${out}/class/jsruntimetmp" includes="**"/>
-
- <zip zipfile="${out}/class/sframeworkinstall/sframework/jsruntime.zip"
- basedir="${out}/class/jsruntime">
- </zip>
- </target>
-
- <!-- =================== Build BeanShell UNO package ===================== -->
- <target name="buildbshuno">
- <mkdir dir="${out}/class/bshruntime"/>
- <copy file="${out}/class/ScriptRuntimeForBeanShell.jar"
- todir="${out}/class/bshruntime/"/>
- <copy file="installer/Scripting.BeanShell.xcu"
- tofile="${out}/class/bshruntime/Scripting.xcu"/>
- <mkdir dir="${out}/class/bshruntime/skip_registration"/>
- <copy file="${install.dir}/bsh-1.2b7.jar"
- todir="${out}/class/bshruntime/skip_registration"/>
- <zip zipfile="${out}/class/sframeworkinstall/sframework/bshruntime.zip"
- basedir="${out}/class/bshruntime">
- </zip>
- </target>
-
- <!-- ========= Package schema, scripts, dialogs & examples =========== -->
- <target name="packagedialogsandexamples" depends="buildexamples">
- <mkdir dir="${out}/class/sframeworkinstall/schema"/>
- <copy file="installer/Scripting.xcs"
- todir="${out}/class/sframeworkinstall/schema/"/>
- <mkdir dir="${out}/class/sframeworkinstall/bindingdialog"/>
- <copy todir="${out}/class/sframeworkinstall/bindingdialog">
- <fileset dir="bindings/">
- <include name="**/*.x*"/>
- </fileset>
- </copy>
- <mkdir dir="${out}/class/sframeworkinstall/examples"/>
- <copy todir="${out}/class/sframeworkinstall/examples">
- <fileset dir="${out}/class/examples/"/>
- </copy>
- </target>
-
- <!-- ===================== Package IDEs ================================== -->
- <target name="packageide">
- <mkdir dir="${out}/class/sframeworkinstall/ide"/>
- <copy todir="${out}/class/sframeworkinstall/ide">
- <fileset dir="${out}/class/">
- <include name="idesupport.jar"/>
- <include name="office.jar"/>
- </fileset>
- </copy>
- </target>
-
- <!-- ======================== Compile Classes ========================== -->
- <target name="compileinstaller">
- <mkdir dir="${installerclasses}"/>
- <javac srcdir="installer/" destdir="${installerclasses}"
- includes="**/*.java" classpathref="idlclasspath"
- debug="${debug}" optimize="${optimize}" deprecation="on"/>
- <copy file="installer/sidebar.jpg" todir="${out}/class/sframeworkinstall/installer"/>
- </target>
-
- <!-- ===================== jar ========================= -->
- <target name="jar" depends="buildunopackage,buildbshuno,buildjsuno,compileinstaller,packagedialogsandexamples,packageide">
- <jar jarfile="${jardir}/${installerjarname}"
- basedir="${installerclasses}">
- <manifest>
- <attribute name="Built-By" value="Sun Microsystems"/>
- <attribute name="ScriptFramework-Version" value="${sfversion}"/>
- <attribute name="Main-Class" value="installer.InstallWizard"/>
- </manifest>
- </jar>
- </target>
-
- <!-- ====================== Clean Generated Files ===================== -->
- <target name="clean">
- <delete dir="${scriptingclasses}"/>
- <delete dir="${storageclasses}"/>
- <delete dir="${jardir}/${scriptingjarname}"/>
- </target>
-
- <!-- ========================= All In One Build ======================= -->
- <target name="all" depends="clean,jar"/>
-
-
-</project>
+<!-- +#************************************************************************* +# +# $RCSfile: build.xml,v $ +# +# $Revision: 1.27 $ +# +# last change: $Author: dfoster $ $Date: 2003-06-18 13:49:11 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (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.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* +--> +<project name="Scipting Framework Installer" default="jar" basedir="."> + + <!-- =================== Environmental Properties ======================= --> + + <property name="prj" value=".."/> + <property file="${prj}/java/build.env"/> + <property name="build.compiler" value="classic"/> + <property name="optimize" value="on"/> + <property name="debug" value="on"/> + <property name="installerclasses" value="${out}/class/sframeworkinstall"/> + <property name="jardir" value="${out}/class"/> + <property name="bindir" value="${out}/bin"/> + <property name="sfversion" value="0.3"/> + <property name="installerjarname" value="SFrameworkInstall.jar"/> + <property environment="env"/> + + <!-- ==================== classpath setting ============================ --> + <path id="idlclasspath"> + <pathelement location="${solar.jar}/unoil.jar"/> + <!-- <pathelement location="${prj}/../unoil/${inpath}/class/unoil.jar"/> --> + <pathelement location="${solar.jar}/jurt.jar"/> + <pathelement location="${solar.jar}/jut.jar"/> + <pathelement location="${solar.jar}/juh.jar"/> + <pathelement location="${solar.jar}/java_uno.jar"/> + <pathelement location="${solar.jar}/ridl.jar"/> + <pathelement location="${solar.jar}/sandbox.jar"/> + </path> + <path id="scriptexampleclasspath"> + <pathelement location="${solar.jar}/unoil.jar"/> + <!-- pathelement location="${prj}/../unoil/${inpath}/class/unoil.jar"/ --> + <pathelement location="${solar.jar}/jurt.jar"/> + <pathelement location="${solar.jar}/jut.jar"/> + <pathelement location="${solar.jar}/juh.jar"/> + <pathelement location="${solar.jar}/java_uno.jar"/> + <pathelement location="${solar.jar}/ridl.jar"/> + <pathelement location="${solar.jar}/sandbox.jar"/> + <pathelement location="${out}/class/ScriptRuntimeForJava.jar"/> + </path> + + <path id="debuggerclasspath"> + <pathelement location="${out}/class/ScriptRuntimeForJava.jar"/> + <pathelement location="${solar.jar}/ridl.jar"/> + <pathelement location="${solar.jar}/unoil.jar"/> + <pathelement location="${out}/class/jsruntime/skip_registration/js.jar"/> + <pathelement location="${install.dir}/bsh-1.2b7.jar"/> + </path> + <!-- ===================== Set up build conditionals ========================= --> + <target name="product.test"> + <condition property="noproext"> + <equals arg1="$${env.PROEXT}" arg2="${env.PROEXT}"/> + </condition> + </target> + <target name="nonproduct.set" if="noproext"> + <echo message="non-product build"/> + <property name="proext" value=""/> + </target> + <target name="product.set" unless="noproext"> + <echo message="product build"/> + <property name="proext" value="${env.PROEXT}"/> + </target> + <target name="build.conditions" depends="product.test,nonproduct.set,product.set"> + <condition property="win9.build"> + <available file="${prj}/wntmsci9${proext}"/> + </condition> + <condition property="win8.build"> + <available file="${prj}/wntmsci8${proext}"/> + </condition> + <condition property="win7.build"> + <available file="${prj}/wntmsci7${proext}"/> + </condition> + <condition property="linx86.build"> + <available file="${prj}/unxlngi5${proext}"/> + </condition> + <condition property="solsparc.build"> + <available file="${prj}/unxsols4${proext}"/> + </condition> + <!-- <condition property="openoffice.build"> + </condition> --> + </target> + <!-- ===================== Build the examples ========================= --> + <target name="buildexamples"> + + <mkdir dir="${out}/class/examples/java/debugger"/> + <javac srcdir="${prj}/examples/java/debugger" + destdir="${out}/class/examples/java/debugger" + includes="*.java" + classpathref="debuggerclasspath" + debug="${debug}" optimize="${optimize}" deprecation="on"/> + + <copy todir="${out}/class/examples/java/debugger"> + <fileset dir="${prj}/examples/java/debugger"> + <include name="**/*.java"/> + <include name="*.xml"/> + </fileset> + </copy> + + <jar jarfile="${out}/class/examples/java/debugger/debugger.jar" + basedir="${out}/class/examples/java/debugger" includes="*.class"> + <manifest> + <attribute name="Built-By" value="Sun Microsystems"/> + <attribute name="ScriptFramework-Version" value="${sfversion}"/> + </manifest> + </jar> + + <delete> + <fileset dir="${out}/class/examples/java/debugger" includes="*.class"/> + </delete> + + <mkdir dir="${out}/class/examples/java/Highlight"/> + <javac srcdir="${prj}/examples/java/" destdir="${out}/class/examples/java/Highlight/" + includes="**/Highlight*.java" classpathref="idlclasspath" + debug="${debug}" optimize="${optimize}" deprecation="on"/> + <copy todir="${out}/class/examples/java/Highlight/"> + <fileset dir="${prj}/examples/java/"> + <include name="**/Highlight*.java"/> + </fileset> + </copy> + <copy file="${prj}/examples/java/HighlightTextParcel.xml" tofile="${out}/class/examples/java/Highlight/parcel-descriptor.xml"/> + <jar jarfile="${out}/class/examples/java/Highlight/Highlight.jar" + basedir="${out}/class/examples/java/Highlight" + includes="**/*.java,**/*.class,**/*.xml" + excludes="${out}/class/examples/java/Highlight/Highlight.jar"> + <manifest> + <attribute name="Built-By" value="Sun Microsystems"/> + <attribute name="ScriptFramework-Version" value="${sfversion}"/> + </manifest> + </jar> + <mkdir dir="${out}/class/examples/java/MemoryUsage"/> + <javac srcdir="${prj}/examples/java/" destdir="${out}/class/examples/java/MemoryUsage/" + includes="**/MemoryUsage.java" classpathref="idlclasspath" + debug="${debug}" optimize="${optimize}" deprecation="on"/> + <copy file="${prj}/examples/java/MemoryUsage.java" todir="${out}/class/examples/java/MemoryUsage/"/> + <copy file="${prj}/examples/java/MemoryUsageParcel.xml" tofile="${out}/class/examples/java/MemoryUsage/parcel-descriptor.xml"/> + <copy file="${prj}/examples/java/MemoryUsage.java" todir="${out}/class/examples/java/MemoryUsage/"/> + <copy file="${prj}/examples/java/ExampleSpreadSheet.sxc" todir="${out}/class/examples/java/MemoryUsage/"/> + + <mkdir dir="${out}/class/examples/java/ScriptFrmwrkHelper"/> + <javac srcdir="${prj}/examples/java/" destdir="${out}/class/examples/java/ScriptFrmwrkHelper/" + includes="**/ScriptFrmwrkHelper.java" classpathref="scriptexampleclasspath" + debug="${debug}" optimize="${optimize}" deprecation="on"/> + <copy todir="${out}/class/examples/java/ScriptFrmwrkHelper/"> + <fileset dir="${prj}/examples/java/"> + <include name="**/ScriptFrmwrkHelper.java"/> + </fileset> + </copy> + <copy file="${prj}/examples/java/ScriptFrameWkHelperParcel.xml" tofile="${out}/class/examples/java/ScriptFrmwrkHelper/parcel-descriptor.xml"/> + <jar jarfile="${out}/class/examples/java/ScriptFrmwrkHelper/ScriptFrmwrkHelper.jar" + basedir="${out}/class/examples/java/ScriptFrmwrkHelper" + includes="**/*.java,**/*.class,**/*.xml" + excludes="${out}/class/examples/java/ScriptFrmwrkHelper/ScriptFrmwrkHelper.jar"> + <manifest> + <attribute name="Built-By" value="Sun Microsystems"/> + <attribute name="ScriptFramework-Version" value="${sfversion}"/> + </manifest> + </jar> + <mkdir dir="${out}/class/examples/beanshell"/> + <copy todir="${out}/class/examples/beanshell"> + <fileset dir="${prj}/examples/beanshell" includes="**"/> + </copy> + <mkdir dir="${out}/class/examples/javascript"/> + <copy todir="${out}/class/examples/javascript"> + <fileset dir="${prj}/examples/javascript" includes="**"/> + </target> + + <!-- ===================== Build UNO package ========================= --> + <target name="buildunopackage_win9" depends="build.conditions" if="win9.build"> + <mkdir dir="${out}/class/sframeworkinstall/sframework"/> + <mkdir dir="${out}/class/sframework"/> + <copy file="${solar.bin}/ScriptFramework.rdb" + todir="${out}/class/sframework/"/> + <copy file="${out}/class/ScriptRuntimeForJava.jar" + todir="${out}/class/sframework/"/> + <copy file="${out}/class/ScriptFramework.jar" + todir="${out}/class/sframework/"/> + <mkdir dir="${out}/class/sframework/windows.plt"/> + <copy todir="${out}/class/sframework/windows.plt"> + <fileset dir="${prj}/wntmsci9${proext}/bin/"> + <include name="**/*.dll"/> + </fileset> + </copy> + <mkdir dir="${out}/class/sframework/skip_registration"/> + <copy file="${solar.jar}/unoil.jar" + todir="${out}/class/sframework/skip_registration"/> + </target> + <target name="buildunopackage_win8" depends="build.conditions" if="win8.build"> + <mkdir dir="${out}/class/sframeworkinstall/sframework"/> + <mkdir dir="${out}/class/sframework"/> + <copy file="${solar.bin}/ScriptFramework.rdb" + todir="${out}/class/sframework/"/> + <copy file="${out}/class/ScriptRuntimeForJava.jar" + todir="${out}/class/sframework/"/> + <copy file="${out}/class/ScriptFramework.jar" + todir="${out}/class/sframework/"/> + <mkdir dir="${out}/class/sframework/windows.plt"/> + <copy todir="${out}/class/sframework/windows.plt"> + <fileset dir="${prj}/wntmsci8${proext}/bin/"> + <include name="**/*.dll"/> + </fileset> + </copy> + <mkdir dir="${out}/class/sframework/skip_registration"/> + <copy file="${solar.jar}/unoil.jar" + todir="${out}/class/sframework/skip_registration"/> + </target> +<!-- <target name="buildunopackage_win7" depends="build.conditions" if="win7.build"> + <mkdir dir="${out}/class/sframeworkinstall/sframework"/> + <mkdir dir="${out}/class/sframework"/> + <copy file="${solar.bin}/ScriptFramework.rdb" + todir="${out}/class/sframework/"/> + <copy file="${out}/class/ScriptRuntimeForJava.jar" + todir="${out}/class/sframework/"/> + <copy file="${out}/class/ScriptFramework.jar" + todir="${out}/class/sframework/"/> + <mkdir dir="${out}/class/sframework/windows.plt"/> + <copy todir="${out}/class/sframework/windows.plt"> + <fileset dir="${prj}/wntmsci7${proext}/bin/"> + <include name="**/*.dll"/> + </fileset> + </copy> + <mkdir dir="${out}/class/sframework/skip_registration"/> + <copy file="${solar.jar}/unoil.jar" + todir="${out}/class/sframework/skip_registration"/> + </target> --> + <target name="buildunopackage_linux" depends="build.conditions" if="linx86.build"> + <mkdir dir="${out}/class/sframeworkinstall/sframework"/> + <mkdir dir="${out}/class/sframework"/> + <copy file="${solar.bin}/ScriptFramework.rdb" + todir="${out}/class/sframework/"/> + <copy file="${out}/class/ScriptRuntimeForJava.jar" + todir="${out}/class/sframework/"/> + <copy file="${out}/class/ScriptFramework.jar" + todir="${out}/class/sframework/"/> + <mkdir dir="${out}/class/sframework/linux_x86.plt"/> + <copy todir="${out}/class/sframework/linux_x86.plt"> + <fileset dir="${prj}/unxlngi5${proext}/lib/"> + <include name="**/lib*.so"/> + </fileset> + </copy> + <mkdir dir="${out}/class/sframework/skip_registration"/> + <copy file="${solar.jar}/unoil.jar" + todir="${out}/class/sframework/skip_registration"/> + </target> + <target name="buildunopackage_solaris" depends="build.conditions" if="solsparc.build"> + <mkdir dir="${out}/class/sframeworkinstall/sframework"/> + <mkdir dir="${out}/class/sframework"/> + <copy file="${solar.bin}/ScriptFramework.rdb" + todir="${out}/class/sframework/"/> + <copy file="${out}/class/ScriptRuntimeForJava.jar" + todir="${out}/class/sframework/"/> + <copy file="${out}/class/ScriptFramework.jar" + todir="${out}/class/sframework/"/> + <mkdir dir="${out}/class/sframework/solaris_sparc.plt"/> + <copy todir="${out}/class/sframework/solaris_sparc.plt"> + <fileset dir="${prj}/unxsols4${proext}/lib/"> + <include name="**/lib*.so"/> + </fileset> + </copy> + <mkdir dir="${out}/class/sframework/skip_registration"/> + <copy file="${solar.jar}/unoil.jar" + todir="${out}/class/sframework/skip_registration"/> + </target> + <target name="buildunopackage" depends="buildunopackage_win8,buildunopackage_linux,buildunopackage_solaris"> + <!-- <target name="buildunopackage" depends="buildunopackage_win9,buildunopackage_win7,buildunopackage_linux,buildunopackage_solaris"> --> + <copy file="installer/ProtocolHandler.xcu" + todir="${out}/class/sframework/"/> + <zip zipfile="${out}/class/sframeworkinstall/sframework/ooscriptframe.zip" + basedir="${out}/class/sframework"> + </zip> + </target> + + <!-- ================== Build JavaScript UNO package ===================== --> + <target name="buildjsuno"> + <mkdir dir="${out}/class/sframeworkinstall/sframework"/> + + <mkdir dir="${out}/class/jsruntime"/> + <mkdir dir="${out}/class/jsruntime/skip_registration"/> + <mkdir dir="${out}/class/jsruntimetmp"/> + + <copy file="${out}/class/ScriptRuntimeForJavaScript.jar" + todir="${out}/class/jsruntime/"/> + <copy file="installer/Scripting.JavaScript.xcu" + tofile="${out}/class/jsruntime/Scripting.xcu"/> + + <unzip src="${install.dir}/js.jar" + dest="${out}/class/jsruntimetmp"/> + + <javac srcdir="${prj}/examples/java/debugger" + destdir="${out}/class/jsruntimetmp" + includes="rhino/Main.java" classpathref="debuggerclasspath" + debug="${debug}" optimize="${optimize}" deprecation="on"/> + + <zip destfile="${out}/class/jsruntime/skip_registration/js.jar" + basedir="${out}/class/jsruntimetmp" includes="**"/> + + <zip zipfile="${out}/class/sframeworkinstall/sframework/jsruntime.zip" + basedir="${out}/class/jsruntime"> + </zip> + </target> + + <!-- =================== Build BeanShell UNO package ===================== --> + <target name="buildbshuno"> + <mkdir dir="${out}/class/bshruntime"/> + <copy file="${out}/class/ScriptRuntimeForBeanShell.jar" + todir="${out}/class/bshruntime/"/> + <copy file="installer/Scripting.BeanShell.xcu" + tofile="${out}/class/bshruntime/Scripting.xcu"/> + <mkdir dir="${out}/class/bshruntime/skip_registration"/> + <copy file="${install.dir}/bsh-1.2b7.jar" + todir="${out}/class/bshruntime/skip_registration"/> + <zip zipfile="${out}/class/sframeworkinstall/sframework/bshruntime.zip" + basedir="${out}/class/bshruntime"> + </zip> + </target> + + <!-- ========= Package schema, scripts, dialogs & examples =========== --> + <target name="packagedialogsandexamples" depends="buildexamples"> + <mkdir dir="${out}/class/sframeworkinstall/schema"/> + <copy file="installer/Scripting.xcs" + todir="${out}/class/sframeworkinstall/schema/"/> + <mkdir dir="${out}/class/sframeworkinstall/bindingdialog"/> + <copy todir="${out}/class/sframeworkinstall/bindingdialog"> + <fileset dir="bindings/"> + <include name="**/*.x*"/> + </fileset> + </copy> + <mkdir dir="${out}/class/sframeworkinstall/examples"/> + <copy todir="${out}/class/sframeworkinstall/examples"> + <fileset dir="${out}/class/examples/"/> + </copy> + </target> + + <!-- ===================== Package IDEs ================================== --> + <target name="packageide"> + <mkdir dir="${out}/class/sframeworkinstall/ide"/> + <copy todir="${out}/class/sframeworkinstall/ide"> + <fileset dir="${out}/class/"> + <include name="idesupport.jar"/> + <include name="office.jar"/> + </fileset> + </copy> + </target> + + <!-- ======================== Compile Classes ========================== --> + <target name="compileinstaller"> + <mkdir dir="${installerclasses}"/> + <javac srcdir="installer/" destdir="${installerclasses}" + includes="**/*.java" classpathref="idlclasspath" + debug="${debug}" optimize="${optimize}" deprecation="on"/> + <copy file="installer/sidebar.jpg" todir="${out}/class/sframeworkinstall/installer"/> + </target> + + <!-- ===================== jar ========================= --> + <target name="jar" depends="buildunopackage,buildbshuno,buildjsuno,compileinstaller,packagedialogsandexamples,packageide"> + <jar jarfile="${jardir}/${installerjarname}" + basedir="${installerclasses}"> + <manifest> + <attribute name="Built-By" value="Sun Microsystems"/> + <attribute name="ScriptFramework-Version" value="${sfversion}"/> + <attribute name="Main-Class" value="installer.InstallWizard"/> + </manifest> + </jar> + </target> + + <!-- ====================== Clean Generated Files ===================== --> + <target name="clean"> + <delete dir="${scriptingclasses}"/> + <delete dir="${storageclasses}"/> + <delete dir="${jardir}/${scriptingjarname}"/> + </target> + + <!-- ========================= All In One Build ======================= --> + <target name="all" depends="clean,jar"/> + + +</project> diff --git a/scripting/workben/installer/XmlUpdater.java b/scripting/workben/installer/XmlUpdater.java index 68911af3635a..6212894ded24 100644 --- a/scripting/workben/installer/XmlUpdater.java +++ b/scripting/workben/installer/XmlUpdater.java @@ -1,429 +1,432 @@ -package installer;
-
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import java.net.URL;
-import java.net.JarURLConnection;
-import javax.swing.*;
-
-/**
- *
- *
- * @author Aidan Butler
- */
-public class XmlUpdater extends Thread {
-
- private String classesPath = null;
- private String jarfilename;
- private String installPath;
-
- private JLabel statusLabel;
-
- private Vector 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"
- };
-
- 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"
- };
-
-
- public XmlUpdater(String installPath, JLabel statusLabel,JProgressBar pBar) {
- this.installPath = installPath;
- this.statusLabel = statusLabel;
- listeners = new Vector();
- threadSuspended = false;
- progressBar=pBar;
- progressBar.setStringPainted(true);
- }// XmlUpdater
-
-
- public boolean checkStop()
- {
- if (internalThread == Thread.currentThread())
- return false;
- return true;
- }// checkStop
-
-
- public void checkSuspend()
- {
- if (threadSuspended)
- {
- synchronized(this)
- {
- while (threadSuspended)
- {
- try {
- wait();
- } catch (InterruptedException eInt) {
- //...
- }
- }
- }
- }
- }// checkSuspend
-
-
- public void setSuspend()
- {
- threadSuspended = true;
- }// setSuspend
-
-
- public void setResume()
- {
- threadSuspended = false;
- notify();
- }// setResume
-
-
- public void setStop()
- {
- internalThread = null;
- }// setStop
-
-
- public void run() {
-
- InputStream istream;
- //InputSource isource;
- //DocumentBuilderFactory builderFactory;
- //DocumentBuilder builder = null;
- URL url;
- String fileName = null;
-
- internalThread = Thread.currentThread();
-
- //System.out.println("\n\n\n\nFileName: "+installPath);
- classesPath= installPath.concat(File.separator+"program"+File.separator+"classes"+File.separator);
- String opSys =System.getProperty("os.name");
- //System.out.println("\n System "+opSys);
-
- String progpath=installPath;
- progpath= progpath.concat(File.separator+"program"+File.separator);
- //System.out.println("Office progpath" + progpath );
- //System.out.println("\nModifying Installation "+installPath);
-
- String configPath=installPath;
- configPath= configPath.concat(File.separator+"user"+File.separator+"config"+File.separator+"soffice.cfg"+File.separator);
- //System.out.println( "Office configuration path: " + configPath );
- String manifestPath=configPath + File.separator + "META-INF" + File.separator;
-
- String starBasicPath=installPath;
- starBasicPath= starBasicPath.concat(File.separator+"user"+File.separator+"basic"+File.separator+"ScriptBindingLibrary"+File.separator);
- //System.out.println( "Office StarBasic path: " + starBasicPath );
-
- 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);
- //System.out.println( "Office schema path: " + regSchemaOfficePath );
-
- // Get the NetBeans installation
- //String netbeansPath=
-
- progressBar.setString("Unzipping Required Files");
- ZipData zd = new ZipData("SFrameworkInstall.jar");
-
-
- // 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 <Office>/user/config/soffice.cfg/
- File configDir = new File( configPath );
- if( !configDir.isDirectory() ) {
- if( !configDir.mkdir() ) {
- System.out.println( "soffice.cfg directory failed");
- }
- else {
- System.out.println( "soffice.cfg 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 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);
-
-//--------------------------------
-// Robert Kinsella test 2
-
- String path = installPath + File.separator +
- "user" + 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;
- }
- }
-
-// Robert Kinsella test 2 end
-//--------------------------------
-
- // 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;
- }
-
-//--------------------------------
-
- // 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;
- }
-
- statusLabel.setText("Installation Complete");
- progressBar.setString("Installation Complete");
- progressBar.setValue(10);
- onInstallComplete();
-
- }// run
-
-
- public void addInstallListener(InstallListener listener)
- {
- listeners.addElement(listener);
- }// addInstallListener
-
-
- private void onInstallComplete()
- {
- Enumeration e = listeners.elements();
- while (e.hasMoreElements())
- {
- InstallListener listener = (InstallListener)e.nextElement();
- listener.installationComplete(null);
- }
- }// onInstallComplete
-
-}// XmlUpdater class
+package installer; + +import java.io.*; +import java.util.*; +import java.util.jar.*; +import java.net.URL; +import java.net.JarURLConnection; +import javax.swing.*; + +/** + * + * + * @author Aidan Butler + */ +public class XmlUpdater extends Thread { + + private String classesPath = null; + private String jarfilename; + private String installPath; + + private JLabel statusLabel; + + private Vector 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) { + this.installPath = installPath; + this.statusLabel = statusLabel; + listeners = new Vector(); + threadSuspended = false; + progressBar=pBar; + progressBar.setStringPainted(true); + }// XmlUpdater + + + public boolean checkStop() + { + if (internalThread == Thread.currentThread()) + return false; + return true; + }// checkStop + + + public void checkSuspend() + { + if (threadSuspended) + { + synchronized(this) + { + while (threadSuspended) + { + try { + wait(); + } catch (InterruptedException eInt) { + //... + } + } + } + } + }// checkSuspend + + + public void setSuspend() + { + threadSuspended = true; + }// setSuspend + + + public void setResume() + { + threadSuspended = false; + notify(); + }// setResume + + + public void setStop() + { + internalThread = null; + }// setStop + + + public void run() { + + InputStream istream; + //InputSource isource; + //DocumentBuilderFactory builderFactory; + //DocumentBuilder builder = null; + URL url; + String fileName = null; + + internalThread = Thread.currentThread(); + + //System.out.println("\n\n\n\nFileName: "+installPath); + classesPath= installPath.concat(File.separator+"program"+File.separator+"classes"+File.separator); + String opSys =System.getProperty("os.name"); + //System.out.println("\n System "+opSys); + + String progpath=installPath; + progpath= progpath.concat(File.separator+"program"+File.separator); + //System.out.println("Office progpath" + progpath ); + //System.out.println("\nModifying Installation "+installPath); + + String configPath=installPath; + configPath= configPath.concat(File.separator+"user"+File.separator+"config"+File.separator+"soffice.cfg"+File.separator); + //System.out.println( "Office configuration path: " + configPath ); + String manifestPath=configPath + File.separator + "META-INF" + File.separator; + + String starBasicPath=installPath; + starBasicPath= starBasicPath.concat(File.separator+"user"+File.separator+"basic"+File.separator+"ScriptBindingLibrary"+File.separator); + //System.out.println( "Office StarBasic path: " + starBasicPath ); + + 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); + //System.out.println( "Office schema path: " + regSchemaOfficePath ); + + // Get the NetBeans installation + //String netbeansPath= + + progressBar.setString("Unzipping Required Files"); + ZipData zd = new ZipData("SFrameworkInstall.jar"); + + + // 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 <Office>/user/config/soffice.cfg/ + File configDir = new File( configPath ); + if( !configDir.isDirectory() ) { + if( !configDir.mkdir() ) { + System.out.println( "soffice.cfg directory failed"); + } + else { + System.out.println( "soffice.cfg 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 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); + +//-------------------------------- +// Robert Kinsella test 2 + + String path = installPath + File.separator + + "user" + 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; + } + } + +// Robert Kinsella test 2 end +//-------------------------------- + + // 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; + } + +//-------------------------------- + + // 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; + } + + statusLabel.setText("Installation Complete"); + progressBar.setString("Installation Complete"); + progressBar.setValue(10); + onInstallComplete(); + + }// run + + + public void addInstallListener(InstallListener listener) + { + listeners.addElement(listener); + }// addInstallListener + + + private void onInstallComplete() + { + Enumeration e = listeners.elements(); + while (e.hasMoreElements()) + { + InstallListener listener = (InstallListener)e.nextElement(); + listener.installationComplete(null); + } + }// onInstallComplete + +}// XmlUpdater class |