summaryrefslogtreecommitdiff
path: root/javainstaller2
diff options
context:
space:
mode:
Diffstat (limited to 'javainstaller2')
-rwxr-xr-xjavainstaller2/build.xml105
-rwxr-xr-xjavainstaller2/makefile.mk35
-rwxr-xr-xjavainstaller2/nbproject/private/private.xml4
-rwxr-xr-xjavainstaller2/nbproject/project.xml56
-rwxr-xr-xjavainstaller2/prj/build.lst5
-rwxr-xr-xjavainstaller2/prj/d.lst2
-rwxr-xr-xjavainstaller2/src/Helpfiles/create_helpfiles.pl268
-rwxr-xr-xjavainstaller2/src/Helpfiles/helpfilenames.txt43
-rwxr-xr-xjavainstaller2/src/Helpfiles/makefile.mk57
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Controller/AcceptLicenseCtrl.java77
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseComponentsCtrl.java204
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseDirectoryCtrl.java256
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseInstallationTypeCtrl.java174
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseUninstallationComponentsCtrl.java131
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseUninstallationTypeCtrl.java133
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationCompletedCtrl.java111
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationImminentCtrl.java155
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java195
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Controller/PrologueCtrl.java200
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationCompletedCtrl.java103
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationImminentCtrl.java112
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationOngoingCtrl.java146
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationPrologueCtrl.java186
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/DeckOfPanels.java54
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Dialogs/DatabaseDialog.java64
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Dialogs/DetailsDialog.java139
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Dialogs/HelpDialog.java166
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Back.gifbin0 -> 91 bytes
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Icons/DontInstall.pngbin0 -> 154 bytes
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Icons/DontKnow.pngbin0 -> 180 bytes
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Forward.gifbin0 -> 91 bytes
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Install.pngbin0 -> 163 bytes
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Installed.pngbin0 -> 110 bytes
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Remove.pngbin0 -> 198 bytes
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java719
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Installer/Installer.java79
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Installer/InstallerFactory.java67
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java719
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Installer/SolarisInstaller.java574
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/LinuxHelper.java507
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/SolarisHelper.java404
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Main.java98
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Panel/AcceptLicense.java104
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseComponents.java189
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseDirectory.java185
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseInstallationType.java180
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseUninstallationComponents.java182
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseUninstallationType.java176
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Panel/InstallationImminent.java115
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Panel/InstallationOngoing.java121
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Panel/Prologue.java76
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Panel/UninstallationCompleted.java108
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Panel/UninstallationImminent.java110
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Panel/UninstallationOngoing.java109
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Panel/UninstallationPrologue.java62
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Panel/installationCompleted.java107
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/PanelController.java97
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/PanelLabel.java82
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/PanelTitle.java116
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/TreeNodeRenderer.java89
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/ResourceManager.java171
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/SetupActionListener.java116
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/DisplayPackageDescription.java200
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/PackageDescription.java659
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/ProductDescription.java277
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/SetupDataProvider.java109
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/XMLPackageDescription.java307
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/SetupFrame.java300
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Util/AbortInstaller.java52
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Util/Calculator.java88
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Util/Controller.java291
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Util/Converter.java95
-rw-r--r--javainstaller2/src/JavaSetup/org/openoffice/setup/Util/DialogFocusTraversalPolicy.java115
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Util/Dumper.java202
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Util/ExecuteProcess.java114
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Util/FileExtensionFilter.java53
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Util/InfoCtrl.java163
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Util/InfoDir.java319
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Util/Informer.java45
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Util/InstallChangeCtrl.java137
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Util/LogManager.java105
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Util/ModuleCtrl.java1004
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Util/PackageCollector.java179
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Util/Parser.java49
-rwxr-xr-xjavainstaller2/src/JavaSetup/org/openoffice/setup/Util/SystemManager.java484
-rwxr-xr-xjavainstaller2/src/Localization/makefile.mk54
-rwxr-xr-xjavainstaller2/src/Localization/setupstrings.ulf455
-rwxr-xr-xjavainstaller2/src/Properties/create_property.pl303
-rwxr-xr-xjavainstaller2/src/Properties/makefile.mk50
-rw-r--r--javainstaller2/src/Properties/setupfiles_template.properties26
-rw-r--r--javainstaller2/src/Properties/setupstrings_template.properties123
91 files changed, 15201 insertions, 0 deletions
diff --git a/javainstaller2/build.xml b/javainstaller2/build.xml
new file mode 100755
index 000000000000..477d489f886d
--- /dev/null
+++ b/javainstaller2/build.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0"?>
+
+<!--
+ Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+-->
+
+<project name="javainstaller2" default="build" basedir=".">
+
+ <!-- build output directory -->
+ <property name="name" value="JavaSetup"/>
+ <property name="out" value="build"/>
+ <property name="classes.dir" value="classes"/>
+ <property name="source.dir" location="${basedir}/src/${name}"/>
+ <property name="build.dir" location="${out}/misc"/>
+ <property name="dist.dir" location="${out}/bin"/>
+ <property name="compile.debug" value="true"/>
+ <property name="compile.optimize" value="false"/>
+ <property name="lib.dir" location="{$basedir}/lib"/>
+ <property name="verbose" value="false"/>
+ <property name="javainstaller.jar.file" location="{$basedir}/lib"/>
+
+ <!-- MAIN TARGET -->
+ <target name="build" depends="prepare, info_uptodate, info_notuptodate, compile-javainstaller, jar-javainstaller, clean">
+ <echo message="Done"/>
+ </target>
+
+ <!-- INITIALIZATION TASKS -->
+ <target name="init">
+ <!-- up to date checks -->
+ <uptodate property="jarFile.uptodate" targetfile="${dist.dir}/${name}.jar">
+ <srcfiles dir="${source.dir}" includes="**/*.gif,**/*.png,**/*.java"/>
+ <srcfiles dir="${build.dir}" includes="**/*.properties"/>
+ </uptodate>
+ </target>
+
+ <target name="prepare" depends="init" unless="jarFile.uptodate">
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${build.dir}/${classes.dir}"/>
+ <mkdir dir="${build.dir}/${classes.dir}/${name}"/>
+ <mkdir dir="${dist.dir}"/>
+ </target>
+
+ <!-- show information about current sub target in recursive builds -->
+ <target name="info_uptodate" depends="init" if="jarFile.uptodate">
+ <tstamp prefix="start"/>
+ <echo message="--------------------------------------------------------------------------------" />
+ <echo message="Nothing to do. ${dist.dir}/${name}.jar is up to date."/>
+ <echo message="--------------------------------------------------------------------------------" />
+ </target>
+
+ <!-- show information about current sub target in recursive builds -->
+ <target name="info_notuptodate" depends="init" unless="jarFile.uptodate">
+ <tstamp prefix="start"/>
+ <echo message="--------------------------------------------------------------------------------" />
+ <echo message="Source dir: ${source.dir}"/>
+ <echo message="Build dir: ${build.dir}"/>
+ <echo message="Dist dir: ${dist.dir}"/>
+ <echo message="Debug is ${debug}"/>
+ <echo message="--------------------------------------------------------------------------------" />
+ </target>
+
+ <target name="compile-javainstaller" depends="prepare" unless="jarFile.uptodate">
+ <javac srcdir="${source.dir}" source="1.4" target="1.4"
+ destdir="${build.dir}/${classes.dir}/${name}"
+ debug="${compile.debug}"
+ optimize="${compile.optimize}">
+ </javac>
+ <copy todir="${build.dir}/${classes.dir}/${name}/org/openoffice/setup">
+ <fileset dir="${build.dir}" includes="*.properties"/>
+ </copy>
+ <copy todir="${build.dir}/${classes.dir}/${name}/org/openoffice/setup/Icons">
+ <fileset dir="${source.dir}/org/openoffice/setup/Icons" includes="*.gif,*.png"/>
+ </copy>
+ </target>
+
+ <target name="jar-javainstaller" depends="compile-javainstaller" unless="jarFile.uptodate">
+ <jar file="${dist.dir}/${name}.jar">
+ <fileset dir="${build.dir}/${classes.dir}/${name}" includes="**/*"/>
+ <manifest>
+ <attribute name="Main-Class" value="org.openoffice.setup.Main"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <!-- CLEAN UP OUTPUT TREES -->
+ <target name="clean" unless="jarFile.uptodate">
+ <!-- <delete dir="${build.dir}"/> -->
+ </target>
+
+ <!-- execution section -->
+ <target name="run" depends="jar-javainstaller">
+ <echo message="Starting: java -jar ${dist.dir}/${name}.jar" />
+ <java jar="${dist.dir}/${name}.jar" fork="true"/>
+ <!-- </java> -->
+ </target>
+
+ <target name="debug" depends="jar-javainstaller">
+ <echo message="Starting for debugging: java -jar ${dist.dir}/${name}.jar" />
+ <java jar="${dist.dir}/${name}.jar" fork="true"/>
+ <!-- </java> -->
+</target>
+
+
+</project>
diff --git a/javainstaller2/makefile.mk b/javainstaller2/makefile.mk
new file mode 100755
index 000000000000..99d5bf0b361d
--- /dev/null
+++ b/javainstaller2/makefile.mk
@@ -0,0 +1,35 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+TARGET=javainstaller2
+PRJ=.
+
+.INCLUDE : ant.mk
+
+.IF "$(SOLAR_JAVA)"!=""
+ALLTAR: ANTBUILD
+.ENDIF
diff --git a/javainstaller2/nbproject/private/private.xml b/javainstaller2/nbproject/private/private.xml
new file mode 100755
index 000000000000..c1f155a782bd
--- /dev/null
+++ b/javainstaller2/nbproject/private/private.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+ <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+</project-private>
diff --git a/javainstaller2/nbproject/project.xml b/javainstaller2/nbproject/project.xml
new file mode 100755
index 000000000000..1797bcfba7f3
--- /dev/null
+++ b/javainstaller2/nbproject/project.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.ant.freeform</type>
+ <configuration>
+ <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
+ <!-- Do not use Project Properties customizer when editing this file manually. -->
+ <name>javainstaller2</name>
+ <properties/>
+ <folders>
+ <source-folder>
+ <label>src\JavaSetup</label>
+ <type>java</type>
+ <location>src/JavaSetup</location>
+ </source-folder>
+ </folders>
+ <ide-actions>
+ <action name="build">
+ <target>build</target>
+ </action>
+ <action name="clean">
+ <target>clean</target>
+ </action>
+ <action name="run">
+ <target>run</target>
+ </action>
+ <action name="rebuild">
+ <target>clean</target>
+ <target>build</target>
+ </action>
+ </ide-actions>
+ <view>
+ <items>
+ <source-folder style="packages">
+ <label>src\JavaSetup</label>
+ <location>src/JavaSetup</location>
+ </source-folder>
+ <source-file>
+ <location>build.xml</location>
+ </source-file>
+ </items>
+ <context-menu>
+ <ide-action name="build"/>
+ <ide-action name="clean"/>
+ <ide-action name="run"/>
+ <ide-action name="rebuild"/>
+ </context-menu>
+ </view>
+ </general-data>
+ <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
+ <compilation-unit>
+ <package-root>src/JavaSetup</package-root>
+ <source-level>1.5</source-level>
+ </compilation-unit>
+ </java-data>
+ </configuration>
+</project>
diff --git a/javainstaller2/prj/build.lst b/javainstaller2/prj/build.lst
new file mode 100755
index 000000000000..f6a0ef5b6036
--- /dev/null
+++ b/javainstaller2/prj/build.lst
@@ -0,0 +1,5 @@
+jl2 javainstaller2 : l10n setup_native NULL
+jl2 javainstaller2\src\Localization nmake - u jl2_local NULL
+jl2 javainstaller2\src\Properties nmake - u jl2_properties jl2_local.u NULL
+jl2 javainstaller2\src\Helpfiles nmake - u jl2_helpfiles jl2_local.u NULL
+jl2 javainstaller2 nmake - u jl2_mkout jl2_properties.u jl2_helpfiles.u NULL
diff --git a/javainstaller2/prj/d.lst b/javainstaller2/prj/d.lst
new file mode 100755
index 000000000000..3b1754f1936d
--- /dev/null
+++ b/javainstaller2/prj/d.lst
@@ -0,0 +1,2 @@
+..\%__SRC%\bin\*.jar %_DEST%\bin%_EXT%
+..\%__SRC%\bin\*.html %_DEST%\pck%_EXT%
diff --git a/javainstaller2/src/Helpfiles/create_helpfiles.pl b/javainstaller2/src/Helpfiles/create_helpfiles.pl
new file mode 100755
index 000000000000..7fb1ac836faf
--- /dev/null
+++ b/javainstaller2/src/Helpfiles/create_helpfiles.pl
@@ -0,0 +1,268 @@
+: # -*- perl -*-
+eval 'exec perl -wS $0 ${1+"$@"}'
+ if 0;
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+# create java installer help files in html format for all languages defined in ulf file
+
+use Cwd;
+use File::Copy;
+
+if( $#ARGV < 2 )
+ {
+ print <<ENDHELP;
+USAGE: $0 <separator> <ulf_file_path> <outputpath>
+ <separator>: separator, used on the platform (slash or backslash)
+ <ulf_file_path>: path, in which the ulf file(s) can be found
+ <outputpath>: path, in which the help files will be created
+ENDHELP
+ exit;
+ }
+
+$separator = $ARGV[0];
+$inputpath = $ARGV[1];
+$outputpath = $ARGV[2];
+
+$inputpath =~ s/\Q$separator\E\s*$//;
+$outputpath =~ s/\Q$separator\E\s*$//;
+
+if ( ! -d $outputpath ) { mkdir $outputpath; }
+
+print "Separator: $separator \n";
+print "Input path: $inputpath \n";
+print "Output path: $outputpath \n";
+
+my $localdir = cwd();
+
+my $ulffilename = "setupstrings.ulf";
+my $helpfilename = "helpfilenames.txt";
+my $defaultlanguage = "en-US";
+
+$ulffilename = $inputpath . $separator . $ulffilename;
+my $ulffile = read_file($ulffilename);
+
+my $helpfilenames = read_file($helpfilename);
+my $allhelpfilenames = collect_helpfile_names($helpfilenames);
+
+my $alllanguages = get_all_languages($ulffile);
+my @allnewpropertyfiles = ();
+
+for ( my $i = 0; $i <= $#{$allhelpfilenames}; $i++ )
+{
+ my $helpfilename = ${$allhelpfilenames}[$i];
+
+ for ( my $j = 0; $j <= $#{$alllanguages}; $j++ )
+ {
+ my $language = ${$alllanguages}[$j];
+
+ # Creating content of help file
+ my $helpfilecontent = collect_helpfile_content($helpfilename, $ulffile, $language);
+
+ # Saving helpfile
+ my $savefilename = $helpfilename . "_" . $language . ".html";
+ $savefilename = $outputpath . $separator . $savefilename;
+ save_file($savefilename, $helpfilecontent);
+
+ if ( $language eq $defaultlanguage )
+ {
+ $savefilename = $helpfilename . ".html";
+ $savefilename = $outputpath . $separator . $savefilename;
+ save_file($savefilename, $helpfilecontent);
+ }
+ }
+}
+
+exit;
+
+sub main::read_directory
+{
+ my ($dir, $ext) = @_;
+
+ my @content = ();
+ my $direntry;
+ opendir(DIR, $dir);
+
+ foreach $direntry (readdir (DIR))
+ {
+ next if $direntry eq ".";
+ next if $direntry eq "..";
+ next if ( ! ( $direntry =~ /\.\Q$ext\E\s*$/ ));
+
+ # my $completeentry = $dir . $separator . $direntry;
+ # push(@content, $completeentry);
+ push(@content, $direntry);
+ }
+
+ closedir(DIR);
+ return \@content;
+}
+
+sub main::read_file
+{
+ my ($filename) = @_;
+
+ open( IN, "<$filename" ) || die "cannot open $filename";
+ my @content = <IN>;
+ close( IN );
+
+ return \@content;
+}
+
+sub main::collect_helpfile_content
+{
+ my ($helpfilename, $ulffile, $language) = @_;
+
+ my @helpfilecontent = ();
+ my $stringhash = create_string_hash($ulffile, $language);
+
+ # Collecting all strings for one html file.
+ # For "Prologue_de.html" all files need to begin with "STRING_PROLOGUE_X"
+ # The "X" is the ordering number.
+
+ my $basestring = "STRING_" . uc($helpfilename) . "_";
+
+ for ( my $i = 0; $i <= 10; $i++ ) # 10 strings possible for each html file
+ {
+ my $key = $basestring . $i;
+ if ( exists $stringhash->{$key} )
+ {
+ my $content = $stringhash->{$key} . "\n<p>\n";
+ push(@helpfilecontent, $content);
+ }
+ }
+
+ return \@helpfilecontent;
+}
+
+sub main::collect_helpfile_names
+{
+ my ($helpfilecontent) = @_;
+
+ my @allhelpfiles = ();
+
+ for ( my $i = 0; $i <= $#{$helpfilecontent}; $i++ )
+ {
+ if ( ${$helpfilecontent}[$i] =~ /^\s*#/ ) { next; } # comment line
+ if ( ${$helpfilecontent}[$i] =~ /^\s*$/ ) { next; } # empty line
+ my $filename = ${$helpfilecontent}[$i];
+ $filename =~ s/\s//g;
+ push(@allhelpfiles, $filename);
+ }
+
+ return \@allhelpfiles;
+}
+
+sub main::get_all_languages
+{
+ my ($ulffile) = @_;
+
+ my @languages = ();
+ my $record = 0;
+
+ for ( my $i = 0; $i <= $#{$ulffile}; $i++ )
+ {
+ if (( ${$ulffile}[$i] =~ /^\s*\[.*]\s*$/ ) && ( $record )) { last; }
+ if (( ${$ulffile}[$i] =~ /^\s*\[.*]\s*$/ ) && ( $record == 0 )) { $record = 1; }
+
+ if (( $record ) && ( ${$ulffile}[$i] =~ /^\s*(.+?)\s*\=/ ))
+ {
+ $language = $1;
+ push(@languages, $language);
+ }
+ }
+
+ my $languagestring = "";
+ for ( my $i = 0; $i <= $#languages; $i++ ) { $languagestring = $languagestring . $languages[$i] . ","; }
+ $languagestring =~ s/,\s*$//;
+ print "Languages: $languagestring\n";
+
+ return \@languages;
+}
+
+sub main::create_string_hash
+{
+ my ($ulffile, $language) = @_;
+
+ my %stringhash = ();
+ my $key = "";
+ my $value_defined = 0;
+
+ for ( my $i = 0; $i <= $#{$ulffile}; $i++ )
+ {
+ if ( ${$ulffile}[$i] =~ /^\s*\[(.*)\]\s*$/ )
+ {
+ $key = $1;
+ $value_defined = 0;
+ }
+
+ if (( ${$ulffile}[$i] =~ /^\s*\Q$defaultlanguage\E\s*=\s*\"(.*)\"\s*$/ ) && ( ! $value_defined ))
+ {
+ $value = $1; # defaulting to english
+ $stringhash{$key} = $value;
+ }
+
+ if (( ${$ulffile}[$i] =~ /^\s*\Q$language\E\s*=\s*\"(.*)\"\s*$/ ) && ( ! $value_defined ))
+ {
+ $value = $1;
+ $stringhash{$key} = $value;
+ $value_defined = 1;
+ }
+ }
+
+ # additional replacement for ${LANGUAGE}, not defined in ulf file
+ my $languagekey = "LANGUAGE";
+ $stringhash{$languagekey} = $language;
+
+ # print_hash(\%stringhash);
+
+ return \%stringhash;
+}
+
+sub main::print_hash
+{
+ my ( $hashref ) = @_;
+
+ print "Hash contains:\n";
+
+ my $key;
+ foreach $key (keys %{$hashref} ) { print "Key: $key, Value: $hashref->{$key}\n"; }
+}
+
+sub main::save_file
+{
+ my ($filename, $filecontent) = @_;
+
+ if ( open( OUT, ">$filename" ) )
+ {
+ print OUT @{$filecontent};
+ close( OUT);
+ }
+
+ push(@allnewpropertyfiles, $filename);
+ print "Created file: $filename\n";
+}
diff --git a/javainstaller2/src/Helpfiles/helpfilenames.txt b/javainstaller2/src/Helpfiles/helpfilenames.txt
new file mode 100755
index 000000000000..85fade352c19
--- /dev/null
+++ b/javainstaller2/src/Helpfiles/helpfilenames.txt
@@ -0,0 +1,43 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+# List of all required html files:
+# -> ChooseDirectory.html, ChooseDirectory_de.html, ...
+Prologue
+AcceptLicense
+ChooseDirectory
+ChooseInstallationType
+ChooseComponents
+InstallationImminent
+InstallationOngoing
+# InstallationCompleted
+UninstallationPrologue
+ChooseUninstallationType
+ChooseUninstallationComponents
+UninstallationImminent
+UninstallationOngoing
+# UninstallationCompleted
diff --git a/javainstaller2/src/Helpfiles/makefile.mk b/javainstaller2/src/Helpfiles/makefile.mk
new file mode 100755
index 000000000000..0f77f31a19ed
--- /dev/null
+++ b/javainstaller2/src/Helpfiles/makefile.mk
@@ -0,0 +1,57 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=javainstaller2
+TARGET=create_help_files
+
+INPUT=java_ulffiles
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.IF "$(SOLAR_JAVA)"!=""
+.IF "$(WITH_LANG)"==""
+ULFDIR:=$(PRJ)/src/Localization
+.ELSE #"$(WITH_LANG)"==""
+ULFDIR:=$(COMMONMISC)/$(INPUT)
+.ENDIF #"$(WITH_LANG)"==""
+
+
+ALLTAR: $(BIN)$/Prologue.html
+
+$(BIN)$/Prologue.html : create_helpfiles.pl helpfilenames.txt $(ULFDIR)/setupstrings.ulf
+ $(PERL) create_helpfiles.pl / $(ULFDIR) $(BIN)
+.ENDIF
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/AcceptLicenseCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/AcceptLicenseCtrl.java
new file mode 100755
index 000000000000..025b96a7990d
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/AcceptLicenseCtrl.java
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Controller;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.PanelController;
+import org.openoffice.setup.Panel.AcceptLicense;
+import org.openoffice.setup.ResourceManager;
+
+public class AcceptLicenseCtrl extends PanelController {
+
+ private String helpFile;
+
+ public AcceptLicenseCtrl() {
+ super("AcceptLicense", new AcceptLicense());
+ helpFile = "String_Helpfile_AcceptLicense";
+ }
+
+ public String getNext() {
+ InstallData data = InstallData.getInstance();
+
+ if ( data.isRootInstallation() ) {
+ if ( data.olderVersionExists() ) {
+ return new String("InstallationImminent");
+ } else if ( data.sameVersionExists() ) {
+ return new String("ChooseComponents");
+ } else {
+ return new String("ChooseInstallationType");
+ }
+ } else {
+ return new String("ChooseDirectory");
+ }
+ }
+
+ public String getPrevious() {
+ return new String("Prologue");
+ }
+
+ public final String getHelpFileName () {
+ return this.helpFile;
+ }
+
+ public void beforeShow() {
+ String StringInstall = ResourceManager.getString("String_AcceptLicense");
+ getSetupFrame().setButtonText(StringInstall, getSetupFrame().BUTTON_NEXT);
+ String StringDecline = ResourceManager.getString("String_Decline");
+ getSetupFrame().setButtonText(StringDecline, getSetupFrame().BUTTON_CANCEL);
+
+ getSetupFrame().setButtonSelected(getSetupFrame().BUTTON_CANCEL);
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseComponentsCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseComponentsCtrl.java
new file mode 100755
index 000000000000..e6eeda82d7b6
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseComponentsCtrl.java
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Controller;
+
+import java.util.Vector;
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.PanelController;
+import org.openoffice.setup.Panel.ChooseComponents;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import org.openoffice.setup.Util.Calculator;
+import org.openoffice.setup.Util.Dumper;
+import org.openoffice.setup.Util.Informer;
+import org.openoffice.setup.Util.ModuleCtrl;
+import org.openoffice.setup.Util.PackageCollector;
+
+public class ChooseComponentsCtrl extends PanelController {
+
+ private String helpFile;
+
+ public ChooseComponentsCtrl() {
+ super("ChooseComponents", new ChooseComponents());
+ helpFile = "String_Helpfile_ChooseComponents";
+ }
+
+ public String getNext() {
+ return new String("InstallationImminent");
+ }
+
+ public String getPrevious() {
+
+ InstallData data = InstallData.getInstance();
+
+ if ( data.isRootInstallation() ) {
+ if ( data.sameVersionExists() ) {
+ if ( data.hideEula() ) {
+ return new String("Prologue");
+ } else {
+ return new String("AcceptLicense");
+ }
+ } else {
+ return new String("ChooseInstallationType");
+ }
+ } else {
+ if ( data.sameVersionExists() ) {
+ return new String("ChooseDirectory");
+ } else {
+ return new String("ChooseInstallationType");
+ }
+ }
+ }
+
+ public final String getHelpFileName () {
+ return this.helpFile;
+ }
+
+ public void beforeShow() {
+
+ InstallData data = InstallData.getInstance();
+
+ // Setting the package size for node modules, that have hidden children
+ // -> Java module has three hidden children and 0 byte size
+
+ if ( ! data.moduleSizeSet() ) {
+ PackageDescription packageData = SetupDataProvider.getPackageDescription();
+ ModuleCtrl.setModuleSize(packageData);
+ data.setModuleSizeSet(true);
+ }
+
+ if ( data.sameVersionExists() ) {
+ ChooseComponents panel = (ChooseComponents)getPanel();
+ String dialogTitle = ResourceManager.getString("String_ChooseComponents1_Maintain");
+ panel.setTitleText(dialogTitle);
+ }
+
+ }
+
+ public boolean afterShow(boolean nextButtonPressed) {
+ boolean repeatDialog = false;
+
+ InstallData data = InstallData.getInstance();
+ PackageDescription packageData = SetupDataProvider.getPackageDescription();
+
+ if ( nextButtonPressed ) {
+
+ // Check, if at least one visible module was selected for installation
+ data.setVisibleModulesChecked(false);
+ ModuleCtrl.checkVisibleModulesInstall(packageData, data);
+
+ if ( data.visibleModulesChecked() ) {
+
+ // Check, if at least one application module was selected for installation
+ // (not necessary, if an older product is updated or additional modules are
+ // added in maintenance mode).
+
+ boolean applicationSelected = false;
+ if ( data.olderVersionExists() || data.sameVersionExists() ) {
+ applicationSelected = true;
+ } else {
+ data.setApplicationModulesChecked(false);
+ ModuleCtrl.checkApplicationSelection(packageData, data);
+ applicationSelected = data.applicationModulesChecked();
+ }
+
+ if ( applicationSelected ) {
+
+ // Check, if at least one language module was selected for installation
+ // (not necessary, if an older product is updated or additional modules are
+ // added in maintenance mode).
+
+ boolean languageSelected = false;
+ if ( data.olderVersionExists() || data.sameVersionExists() || ( ! data.isMultiLingual())) {
+ languageSelected = true;
+ } else {
+ data.setLanguageModulesChecked(false);
+ ModuleCtrl.checkLanguageSelection(packageData, data);
+ languageSelected = data.languageModulesChecked();
+ }
+
+ if ( languageSelected ) {
+
+ // Set module settings for hidden modules.
+ // Then it is possible to calculate the size of the installed product,
+ // to show a warning and to set the repeatDialog value to true
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "ChooseComponentsCtrl: Before setHiddenModuleSettingsInstall");
+ }
+
+ ModuleCtrl.setHiddenModuleSettingsInstall(packageData);
+ // Dumper.dumpInstallPackages(packageData);
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "ChooseComponentsCtrl: After setHiddenModuleSettingsInstall");
+ }
+
+ // Collecting packages to install
+ Vector installPackages = new Vector();
+ PackageCollector.collectInstallPackages(packageData, installPackages);
+ data.setInstallPackages(installPackages);
+
+ // Check disc space
+ if ( Calculator.notEnoughDiscSpace(data) ) {
+ repeatDialog = true;
+ System.err.println("Not enough disc space");
+ }
+ } else { // no language modules selected for installation
+ String message = ResourceManager.getString("String_No_Language_Selected_1") + "\n" +
+ ResourceManager.getString("String_No_Language_Selected_2");
+ String title = ResourceManager.getString("String_Change_Selection");
+ Informer.showInfoMessage(message, title);
+ repeatDialog = true;
+ }
+ } else {
+ String message = ResourceManager.getString("String_No_Application_Selected_1") + "\n" +
+ ResourceManager.getString("String_No_Application_Selected_2");
+ String title = ResourceManager.getString("String_Change_Selection");
+ Informer.showInfoMessage(message, title);
+ repeatDialog = true;
+ }
+ } else { // no modules selected for installation
+ String message = ResourceManager.getString("String_No_Components_Selected_1") + "\n" +
+ ResourceManager.getString("String_No_Components_Selected_2");
+ String title = ResourceManager.getString("String_Nothing_To_Install");
+ Informer.showInfoMessage(message, title);
+ repeatDialog = true;
+ }
+ } else { // the back button was pressed
+ // Saving typical selection state values (always if back button is pressed!).
+ // System.err.println("Saving custom selection states");
+ ModuleCtrl.saveCustomSelectionStates(packageData);
+ data.setCustomSelectionStateSaved(true);
+ }
+
+ return repeatDialog;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseDirectoryCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseDirectoryCtrl.java
new file mode 100755
index 000000000000..4a3bfab8452e
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseDirectoryCtrl.java
@@ -0,0 +1,256 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Controller;
+
+import java.awt.Dimension;
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.Installer.Installer;
+import org.openoffice.setup.Installer.InstallerFactory;
+import org.openoffice.setup.PanelController;
+import org.openoffice.setup.Panel.ChooseDirectory;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import org.openoffice.setup.Util.InstallChangeCtrl;
+import org.openoffice.setup.Util.LogManager;
+import org.openoffice.setup.Util.SystemManager;
+import java.io.File;
+import java.util.Vector;
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+import org.openoffice.setup.Dialogs.DatabaseDialog;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.Util.Controller;
+import org.openoffice.setup.Util.Dumper;
+import org.openoffice.setup.Util.Informer;
+import org.openoffice.setup.Util.ModuleCtrl;
+import org.openoffice.setup.Util.PackageCollector;
+
+public class ChooseDirectoryCtrl extends PanelController {
+
+ private String helpFile;
+
+ public ChooseDirectoryCtrl() {
+ super("ChooseDirectory", new ChooseDirectory());
+ helpFile = "String_Helpfile_ChooseDirectory";
+ }
+
+ public String getNext() {
+
+ InstallData data = InstallData.getInstance();
+
+ if ( data.olderVersionExists() ) {
+ return new String("InstallationImminent");
+ } else if ( data.sameVersionExists() ) {
+ return new String("ChooseComponents");
+ } else {
+ return new String("ChooseInstallationType");
+ }
+ }
+
+ public String getPrevious() {
+ InstallData data = InstallData.getInstance();
+
+ if ( data.hideEula() ) {
+ return new String("Prologue");
+ } else {
+ return new String("AcceptLicense");
+ }
+ }
+
+ public final String getHelpFileName () {
+ return this.helpFile;
+ }
+
+ private String removeEndingDelimiter(String s) {
+ s.trim();
+ if (( s.endsWith("/")) || ( s.endsWith("\\"))) {
+ // removing the last character
+ s = s.substring(0, s.length() - 1);
+ }
+ // mask spaces
+ // s.replaceAll(" ", "\\ ");
+
+ return s;
+ }
+
+ public void beforeShow() {
+ ChooseDirectory panel = (ChooseDirectory)getPanel();
+ InstallData data = InstallData.getInstance();
+
+ if ( data.getInstallDir() == null ) {
+ String installDir = data.getDefaultDir();
+
+ if ( data.isUserInstallation() ) {
+ // System.getenv only supported in Java 1.5, property set in shell script
+ // if (( System.getenv("HOME") != null ) && ( ! System.getenv("HOME").equals(""))) {
+ // rootDir = System.getenv("HOME");
+ // }
+ if (( System.getProperty("HOME") != null ) && ( ! System.getProperty("HOME").equals("") )) {
+ installDir = System.getProperty("user.home");
+ }
+ }
+ data.setInstallDir(installDir);
+ }
+
+ panel.setDirectory(data.getInstallDir());
+ }
+
+ public boolean afterShow(boolean nextButtonPressed) {
+ boolean repeatDialog = false;
+ ChooseDirectory panel = (ChooseDirectory)getPanel();
+ String dir = panel.getDirectory();
+ dir = removeEndingDelimiter(dir);
+ InstallData data = InstallData.getInstance();
+ data.setInstallDir(dir);
+
+ File installDefaultDir = new File(dir, data.getDefaultDir());
+ data.setInstallDefaultDir(installDefaultDir.getPath());
+
+ SetupDataProvider.setNewMacro("DIR", installDefaultDir.getPath()); // important for string replacement
+ // SetupDataProvider.dumpMacros();
+
+ // Check existence of directory. Try to create, if it does not exist.
+ // If successufully created, calculate available disc space
+
+ if ( nextButtonPressed ) {
+
+ // If the directory exists, is has to be tested, whether the user has write access
+
+ if ( SystemManager.exists_directory(dir) ) {
+ if ( ! Controller.createdSubDirectory(dir) ) {
+ repeatDialog= true;
+ }
+ }
+
+ // If the directory does not exist, is has to be tested, whether the user can create it
+
+ if ( ! SystemManager.exists_directory(dir)) {
+ String title = ResourceManager.getString("String_ChooseDirectory4_Question_Title");
+ String message = null;
+ message = ResourceManager.getString("String_ChooseDirectory5_Question_Message");
+
+ int returnValue = JOptionPane.showConfirmDialog(null, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
+
+ if ( returnValue == JOptionPane.YES_OPTION ) {
+ if ( ! Controller.createdDirectory(dir) ) {
+ repeatDialog= true;
+ }
+ }
+ else if (returnValue == JOptionPane.NO_OPTION) {
+ repeatDialog = true;
+ }
+ }
+
+ // Additional tasks, if the directory is okay
+
+ if ( ! repeatDialog ) {
+ // Calculate available disc space
+ int discSpace = SystemManager.calculateDiscSpace(dir);
+ data.setAvailableDiscSpace(discSpace);
+
+ Installer installer = InstallerFactory.getInstance();
+
+ // Is this a new directory, or one that was already set before.
+ // In this case, the database does not need to be evaluated again.
+ // -> Testing, whether the database path has changed. This can
+ // only happen in user installations.
+ if ( data.isUserInstallation() ) {
+ String oldDatabasePath = data.getDatabasePath();
+ // Setting the database path
+ installer.defineDatabasePath();
+
+ if (( oldDatabasePath == null ) || ( ! oldDatabasePath.equals(data.getDatabasePath()))) {
+ data.setDatabaseAnalyzed(false);
+ data.setDatabaseQueried(false);
+ } else {
+ data.setDatabaseAnalyzed(true);
+ }
+ }
+
+ // In installations with user privileges, now it can be controlled,
+ // if there are products installed in the selected directory.
+ // Therefore the directory selection dialog has to be shown before.
+ // In installations with root privileges, this can only be checked,
+ // before the destination directory can be set, because it is fix.
+ if ( data.isUserInstallation() ) {
+ LogManager.setCommandsHeaderLine("Checking change installation");
+ InstallChangeCtrl.checkInstallChange(data);
+ // InstallChangeCtrl.checkInstallChange(data, panel);
+ }
+
+ // At this point it is clear, whether the update-Package is installed or not.
+ // If it is installed, it is also clear, in which version it is installed.
+ // Therefore the following dialog is also defined.
+
+ if ( data.newerVersionExists() ) {
+ // This can happen only in installation with user privileges.
+ // Installations with root privileges have cancelled installation
+ // already at first dialog.
+ // Possibility to select a new directory, in which no
+ // newer product exists
+ String message = ResourceManager.getString("String_Newer_Version_Installed_Found") + "\n" + data.getInstallDir() + "\n" +
+ ResourceManager.getString("String_Newer_Version_Database") + ": " + data.getDatabasePath() + "\n" +
+ ResourceManager.getString("String_Newer_Version_Tip");
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+
+ repeatDialog = true;
+ }
+
+ // If an older version is found, and the update is forbidden, the user
+ // can select another installation directory.
+
+ if ( data.olderVersionExists() && data.dontUpdate() ) {
+ // This can happen only in installation with user privileges.
+ // Installations with root privileges have cancelled installation
+ // already at first dialog (InstallChangeCtrl.java).
+ // Possibility to select a new directory, in which no
+ // older product exists
+ String message = ResourceManager.getString("String_Older_Version_Installed_Found") + "\n" + data.getInstallDir() + "\n" +
+ ResourceManager.getString("String_Newer_Version_Database") + ": " + data.getDatabasePath() + "\n" +
+ ResourceManager.getString("String_Newer_Version_Tip");
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+
+ repeatDialog = true;
+ }
+
+ if ( ! repeatDialog ) {
+
+ if ( ! data.databaseAnalyzed()) {
+ ModuleCtrl.defaultDatabaseAnalysis(data);
+ data.setDatabaseAnalyzed(true);
+ }
+ }
+ }
+ }
+
+ return repeatDialog;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseInstallationTypeCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseInstallationTypeCtrl.java
new file mode 100755
index 000000000000..25432ae7def3
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseInstallationTypeCtrl.java
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Controller;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.PanelController;
+import org.openoffice.setup.Panel.ChooseInstallationType;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import org.openoffice.setup.Util.Calculator;
+import org.openoffice.setup.Util.Dumper;
+import org.openoffice.setup.Util.ModuleCtrl;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Vector;
+import org.openoffice.setup.Util.PackageCollector;
+
+public class ChooseInstallationTypeCtrl extends PanelController implements ActionListener {
+
+ private String helpFile;
+
+ public ChooseInstallationTypeCtrl() {
+ super("ChooseInstallationType", new ChooseInstallationType());
+ helpFile = "String_Helpfile_ChooseInstallationType";
+ }
+
+ public String getNext() {
+
+ InstallData data = InstallData.getInstance();
+
+ if ( data.getInstallationType().equals(data.getCustomActionCommand()) ) {
+ return new String("ChooseComponents");
+ } else if ( data.getInstallationType().equals(data.getTypicalActionCommand()) ) {
+ return new String("InstallationImminent");
+ } else {
+ System.err.println("Error: Unknown installation type!" );
+ return new String("Error");
+ }
+ }
+
+ public String getPrevious() {
+
+ InstallData data = InstallData.getInstance();
+
+ if ( data.isRootInstallation() ) {
+ if ( data.hideEula() ) {
+ return new String("Prologue");
+ } else {
+ return new String("AcceptLicense");
+ }
+ } else {
+ return new String("ChooseDirectory");
+ }
+ }
+
+ public final String getHelpFileName () {
+ return this.helpFile;
+ }
+
+ public void beforeShow() {
+
+ InstallData data = InstallData.getInstance();
+
+ ChooseInstallationType panel = (ChooseInstallationType)getPanel();
+ panel.setActionListener((ChooseInstallationTypeCtrl)this);
+ panel.setTypicalActionCommand(data.getTypicalActionCommand());
+ panel.setCustomActionCommand(data.getCustomActionCommand());
+ }
+
+ public boolean afterShow(boolean nextButtonPressed) {
+ boolean repeatDialog = false;
+ ChooseInstallationType panel = (ChooseInstallationType)getPanel();
+ panel.removeActionListener((ChooseInstallationTypeCtrl)this);
+
+ if ( nextButtonPressed ) {
+
+ InstallData data = InstallData.getInstance();
+ PackageDescription packageData = SetupDataProvider.getPackageDescription();
+
+ if ( data.getInstallationType().equals(data.getTypicalActionCommand()) ) {
+
+ // If typical selection state values have been saved before,
+ // it is now time to restore them
+
+ if ( data.typicalSelectionStateSaved()) {
+ // System.err.println("Restoring typical selection states");
+ ModuleCtrl.restoreTypicalSelectionStates(packageData);
+ }
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "ChooseInstallationType: Before setHiddenModuleSettingsInstall");
+ }
+
+ // For standard installation type, the hidden modules have to be defined here.
+ // Then it is possible to calculate the size of the installed product, to show a warning
+ // and to set the repeatDialog value to true
+ ModuleCtrl.setHiddenModuleSettingsInstall(packageData);
+ // Dumper.dumpInstallPackages(packageData);
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "ChooseInstallationType: After setHiddenModuleSettingsInstall");
+ }
+
+ // Collecting packages to install
+ Vector installPackages = new Vector();
+ PackageCollector.collectInstallPackages(packageData, installPackages);
+ data.setInstallPackages(installPackages);
+
+ // Check disc space
+ if ( Calculator.notEnoughDiscSpace(data) ) {
+ repeatDialog = true;
+ }
+ }
+
+ // Custom installation type
+ if (( data.getInstallationType().equals(data.getCustomActionCommand() ))) {
+ // Saving typical selection state values, if they are not already saved.
+ if ( ! data.typicalSelectionStateSaved()) {
+ // System.err.println("Saving typical selection states");
+ ModuleCtrl.saveTypicalSelectionStates(packageData);
+ data.setTypicalSelectionStateSaved(true);
+ }
+
+ // Setting custom selection state values, if they have been saved before.
+ if ( data.customSelectionStateSaved() ) {
+ // System.err.println("Restoring custom selection states");
+ ModuleCtrl.restoreCustomSelectionStates(packageData);
+ }
+ }
+ }
+
+ return repeatDialog;
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+
+ InstallData data = InstallData.getInstance();
+
+ if (evt.getActionCommand().equals(data.getTypicalActionCommand())) {
+ data.setInstallationType(data.getTypicalActionCommand());
+ // System.err.println("Setting installation type: " + data.getTypicalActionCommand());
+ } else if (evt.getActionCommand().equals(data.getCustomActionCommand())) {
+ data.setInstallationType(data.getCustomActionCommand());
+ // System.err.println("Setting installation type: " + data.getCustomActionCommand());
+ }
+
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseUninstallationComponentsCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseUninstallationComponentsCtrl.java
new file mode 100755
index 000000000000..15ae15654d28
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseUninstallationComponentsCtrl.java
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Controller;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.PanelController;
+import org.openoffice.setup.Panel.ChooseUninstallationComponents;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import org.openoffice.setup.Util.Dumper;
+import org.openoffice.setup.Util.Informer;
+import org.openoffice.setup.Util.ModuleCtrl;
+
+public class ChooseUninstallationComponentsCtrl extends PanelController {
+
+ private String helpFile;
+
+ public ChooseUninstallationComponentsCtrl() {
+ super("ChooseUninstallationComponents", new ChooseUninstallationComponents());
+ helpFile = "String_Helpfile_ChooseUninstallationComponents";
+ }
+
+ public String getNext() {
+ return new String("UninstallationImminent");
+ }
+
+ public String getPrevious() {
+ return new String("ChooseUninstallationType");
+ }
+
+ public final String getHelpFileName () {
+ return this.helpFile;
+ }
+
+ public boolean afterShow(boolean nextButtonPressed) {
+ boolean repeatDialog = false;
+
+ InstallData data = InstallData.getInstance();
+ PackageDescription packageData = SetupDataProvider.getPackageDescription();
+
+ if ( nextButtonPressed ) {
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "Choose UninstallationComponents: Before checkVisibleModulesUninstall");
+ }
+
+ // Check, if at least one visible module is selected for uninstallation
+ data.setVisibleModulesChecked(false);
+ ModuleCtrl.checkVisibleModulesUninstall(packageData, data);
+
+ if ( ! data.visibleModulesChecked() ) {
+ String message = ResourceManager.getString("String_No_Uninstallcomponents_Selected_1") + "\n" +
+ ResourceManager.getString("String_No_Uninstallcomponents_Selected_2");
+ String title = ResourceManager.getString("String_Nothing_To_Uninstall");
+ Informer.showInfoMessage(message, title);
+ repeatDialog = true;
+ } else {
+ // Check, if all visible modules are selected for uninstallation.
+ // Then this shall be handled as complete uninstallation
+ // -> The responsible value is InstallData.isMaskedCompleteUninstallation
+ data.setMaskedCompleteUninstallation(true);
+ ModuleCtrl.checkMaskedCompleteUninstallation(packageData, data);
+
+ // If this is not a complete uninstallation, at least one language
+ // module or one application module has to be installed.
+
+ if ( ! data.isMaskedCompleteUninstallation() ) {
+
+ data.setApplicationModulesChecked(false);
+ ModuleCtrl.checkApplicationModulesUninstall(packageData, data);
+
+ if ( ! data.applicationModulesChecked() ) {
+
+ String message = ResourceManager.getString("String_All_Applicationcomponents_Selected_1") + "\n" +
+ ResourceManager.getString("String_All_Applicationcomponents_Selected_2");
+ String title = ResourceManager.getString("String_Change_Selection");
+ Informer.showInfoMessage(message, title);
+ repeatDialog = true;
+ } else {
+ if ( data.isMultiLingual()) {
+ data.setLanguageModulesChecked(false);
+ ModuleCtrl.checkLanguageModulesUninstall(packageData, data);
+
+ if ( ! data.languageModulesChecked() ) {
+
+ String message = ResourceManager.getString("String_All_Languagecomponents_Selected_1") + "\n" +
+ ResourceManager.getString("String_All_Languagecomponents_Selected_2");
+ String title = ResourceManager.getString("String_Change_Selection");
+ Informer.showInfoMessage(message, title);
+ repeatDialog = true;
+ }
+ }
+ }
+ }
+ }
+ } else { // the back button was pressed
+ // Saving typical selection state values (always if back button is pressed!).
+ ModuleCtrl.saveCustomSelectionStates(packageData);
+ data.setCustomSelectionStateSaved(true);
+ }
+
+ return repeatDialog;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseUninstallationTypeCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseUninstallationTypeCtrl.java
new file mode 100755
index 000000000000..d1c5e69430db
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/ChooseUninstallationTypeCtrl.java
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Controller;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.PanelController;
+import org.openoffice.setup.Panel.ChooseUninstallationType;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import org.openoffice.setup.Util.ModuleCtrl;
+
+public class ChooseUninstallationTypeCtrl extends PanelController implements ActionListener {
+
+ private String helpFile;
+
+ public ChooseUninstallationTypeCtrl() {
+ super("ChooseUninstallationType", new ChooseUninstallationType());
+ helpFile = "String_Helpfile_ChooseUninstallationType";
+ }
+
+ public String getNext() {
+
+ InstallData data = InstallData.getInstance();
+
+ if ( data.getInstallationType().equals(data.getCustomActionCommand()) ) {
+ return new String("ChooseUninstallationComponents");
+ } else if ( data.getInstallationType().equals(data.getTypicalActionCommand()) ) {
+ return new String("UninstallationImminent");
+ } else {
+ System.err.println("Error: Unknown uninstallation type!" );
+ return new String("Error");
+ }
+ }
+
+ public String getPrevious() {
+ return new String("UninstallationPrologue");
+ }
+
+ public void beforeShow() {
+
+ InstallData data = InstallData.getInstance();
+
+ ChooseUninstallationType panel = (ChooseUninstallationType)getPanel();
+ panel.setActionListener((ChooseUninstallationTypeCtrl)this);
+ panel.setCompleteActionCommand(data.getTypicalActionCommand());
+ panel.setCustomActionCommand(data.getCustomActionCommand());
+ }
+
+ public boolean afterShow(boolean nextButtonPressed) {
+ boolean repeatDialog = false;
+
+ ChooseUninstallationType panel = (ChooseUninstallationType)getPanel();
+ panel.removeActionListener((ChooseUninstallationTypeCtrl)this);
+
+ if ( nextButtonPressed ) {
+
+ InstallData data = InstallData.getInstance();
+ PackageDescription packageData = SetupDataProvider.getPackageDescription();
+
+ // Typical uninstallation type
+ if ( data.getInstallationType().equals(data.getTypicalActionCommand()) ) {
+ // If typical selection state values have been saved before,
+ // it is now time to restore them
+
+ if ( data.typicalSelectionStateSaved()) {
+ ModuleCtrl.restoreTypicalSelectionStates(packageData);
+ }
+ }
+
+ // Custom uninstallation type
+ if ( data.getInstallationType().equals(data.getCustomActionCommand())) {
+ // Saving typical selection state values, if they are not already saved.
+ if ( ! data.typicalSelectionStateSaved()) {
+ ModuleCtrl.saveTypicalSelectionStates(packageData);
+ data.setTypicalSelectionStateSaved(true);
+ }
+
+ // Setting custom selection state values, if they have been saved before.
+ if ( data.customSelectionStateSaved() ) {
+ ModuleCtrl.restoreCustomSelectionStates(packageData);
+ }
+ }
+ }
+
+ return repeatDialog;
+ }
+
+ public void actionPerformed(ActionEvent evt) {
+
+ InstallData data = InstallData.getInstance();
+
+ if (evt.getActionCommand().equals(data.getTypicalActionCommand())) {
+ data.setInstallationType(data.getTypicalActionCommand());
+ // System.err.println("Setting uninstallation type: " + data.getTypicalActionCommand());
+ } else if (evt.getActionCommand().equals(data.getCustomActionCommand())) {
+ data.setInstallationType(data.getCustomActionCommand());
+ // System.err.println("Setting uninstallation type: " + data.getCustomActionCommand());
+ }
+
+ }
+
+ public final String getHelpFileName () {
+ return this.helpFile;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationCompletedCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationCompletedCtrl.java
new file mode 100755
index 000000000000..fc14c238da0b
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationCompletedCtrl.java
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Controller;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.Installer.Installer;
+import org.openoffice.setup.Installer.InstallerFactory;
+import org.openoffice.setup.PanelController;
+import org.openoffice.setup.Panel.installationCompleted;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.SetupData.ProductDescription;
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import org.openoffice.setup.Util.InfoCtrl;
+
+public class InstallationCompletedCtrl extends PanelController {
+
+ private String helpFile;
+ private String mDialogText;
+ private String htmlInfoText;
+
+ public InstallationCompletedCtrl() {
+ super("InstallationCompleted", new installationCompleted());
+ helpFile = "String_Helpfile_InstallationCompleted";
+ }
+
+ public void beforeShow() {
+ InstallData installData = InstallData.getInstance();
+ ProductDescription productData = SetupDataProvider.getProductDescription();
+
+ getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_PREVIOUS);
+ getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_CANCEL);
+ getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_HELP);
+ getSetupFrame().removeButtonIcon(getSetupFrame().BUTTON_NEXT);
+ getSetupFrame().setButtonSelected(getSetupFrame().BUTTON_NEXT);
+
+ installationCompleted panel = (installationCompleted)getPanel();
+ panel.setDetailsButtonActionCommand(getSetupFrame().ACTION_DETAILS);
+ panel.addDetailsButtonActionListener(getSetupFrame().getSetupActionListener());
+
+ if ( installData.isAbortedInstallation() ) {
+ String titleText = ResourceManager.getString("String_InstallationCompleted1_Abort");
+ panel.setTitleText(titleText);
+ String dialogText = ResourceManager.getString("String_InstallationCompleted2_Abort");
+ panel.setDialogText(dialogText);
+ } else if ( installData.isErrorInstallation() ) {
+ String titleText = ResourceManager.getString("String_InstallationCompleted1_Error");
+ panel.setTitleText(titleText);
+ String dialogText = ResourceManager.getString("String_InstallationCompleted2_Error");
+ panel.setDialogText(dialogText);
+ }
+
+ htmlInfoText = InfoCtrl.setHtmlFrame("header", htmlInfoText);
+ htmlInfoText = InfoCtrl.setInstallLogInfoText(productData, htmlInfoText);
+ htmlInfoText = InfoCtrl.setHtmlFrame("end", htmlInfoText);
+ }
+
+ public void duringShow() {
+ Thread t = new Thread() {
+ public void run() {
+ PackageDescription packageData = SetupDataProvider.getPackageDescription();
+ Installer installer = InstallerFactory.getInstance();
+ installer.postInstall(packageData);
+ }
+ };
+
+ t.start();
+ }
+
+ public String getNext() {
+ return null;
+ }
+
+ public String getPrevious() {
+ return null;
+ }
+
+ public final String getHelpFileName () {
+ return this.helpFile;
+ }
+
+ public String getDialogText() {
+ return htmlInfoText;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationImminentCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationImminentCtrl.java
new file mode 100755
index 000000000000..0130607acc36
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationImminentCtrl.java
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Controller;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.PanelController;
+import org.openoffice.setup.Panel.InstallationImminent;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.SetupData.ProductDescription;
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import org.openoffice.setup.Util.Dumper;
+import org.openoffice.setup.Util.InfoCtrl;
+import org.openoffice.setup.Util.Informer;
+import org.openoffice.setup.Util.LogManager;
+import org.openoffice.setup.Util.ModuleCtrl;
+import java.util.Vector;
+
+public class InstallationImminentCtrl extends PanelController {
+
+ private String helpFile;
+ private String htmlInfoText = "";
+
+ public InstallationImminentCtrl() {
+ super("InstallationImminent", new InstallationImminent());
+ helpFile = "String_Helpfile_InstallationImminent";
+ }
+
+ public String getNext() {
+ return new String("InstallationOngoing");
+ }
+
+ public String getPrevious() {
+
+ InstallData data = InstallData.getInstance();
+
+ if ( data.isRootInstallation() ) {
+ if ( data.olderVersionExists() ) {
+ if ( data.hideEula() ) {
+ return new String("Prologue");
+ } else {
+ return new String("AcceptLicense");
+ }
+ } else if ( data.sameVersionExists() ) {
+ return new String("ChooseComponents");
+ } else {
+ if ( data.getInstallationType().equals(data.getCustomActionCommand()) ) {
+ return new String("ChooseComponents");
+ } else if ( data.getInstallationType().equals(data.getTypicalActionCommand()) ) {
+ return new String("ChooseInstallationType");
+ } else {
+ System.err.println("Error: Unknown installation type!" );
+ return new String("Error");
+ }
+ }
+ } else {
+ if ( data.olderVersionExists() ) {
+ return new String("ChooseDirectory");
+ } else if ( data.sameVersionExists() ) {
+ return new String("ChooseComponents");
+ } else {
+ if ( data.getInstallationType().equals(data.getCustomActionCommand()) ) {
+ return new String("ChooseComponents");
+ } else if ( data.getInstallationType().equals(data.getTypicalActionCommand()) ) {
+ return new String("ChooseInstallationType");
+ } else {
+ System.err.println("Error: Unknown installation type!" );
+ return new String("Error");
+ }
+ }
+ }
+ }
+
+ public final String getHelpFileName () {
+ return this.helpFile;
+ }
+
+ public void beforeShow() {
+ String StringInstall = ResourceManager.getString("String_Install");
+ getSetupFrame().setButtonText(StringInstall, getSetupFrame().BUTTON_NEXT);
+
+ ProductDescription productData = SetupDataProvider.getProductDescription();
+ PackageDescription packageData = SetupDataProvider.getPackageDescription();
+ // Dumper.dumpPackageSettings(packageData);
+ htmlInfoText = InfoCtrl.setHtmlFrame("header", htmlInfoText);
+ htmlInfoText = InfoCtrl.setReadyToInstallInfoText(productData, htmlInfoText);
+ htmlInfoText = InfoCtrl.setReadyToInstallInfoText(packageData, htmlInfoText);
+ htmlInfoText = InfoCtrl.setHtmlFrame("end", htmlInfoText);
+
+ InstallationImminent panel = (InstallationImminent)getPanel();
+ panel.setInfoText(htmlInfoText);
+ panel.setCaretPosition();
+
+ // Update mode
+ InstallData data = InstallData.getInstance();
+ if ( data.olderVersionExists() ) {
+ String dialogTitle = ResourceManager.getString("String_InstallationImminent1_Update");
+ panel.setTitleText(dialogTitle);
+ }
+ }
+
+ public void duringShow() {
+ InstallationImminent panel = (InstallationImminent)getPanel();
+ panel.setTabOrder();
+ }
+
+ public boolean afterShow(boolean nextButtonPressed) {
+ boolean repeatDialog = false;
+
+ if ( nextButtonPressed ) {
+
+ InstallData data = InstallData.getInstance();
+
+ // determining the packagePath
+ if ( data.getPackagePath() != null ) {
+ String log = "<b>Packages path:</b> " + data.getPackagePath() + "<br>";
+ LogManager.addLogfileComment(log);
+ } else {
+ String message = ResourceManager.getString("String_InstallationOngoing_PackagePath_Not_Found");
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+ String log = "<b>Error: No path for packages exists!</b><br>";
+ LogManager.addLogfileComment(log);
+ repeatDialog = true;
+ }
+ }
+
+ return repeatDialog;
+ }
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java
new file mode 100755
index 000000000000..b435b480eaea
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/InstallationOngoingCtrl.java
@@ -0,0 +1,195 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Controller;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.Installer.Installer;
+import org.openoffice.setup.Installer.InstallerFactory;
+import org.openoffice.setup.PanelController;
+import org.openoffice.setup.Panel.InstallationOngoing;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.Util.LogManager;
+import org.openoffice.setup.Util.InfoDir;
+import org.openoffice.setup.Util.PackageCollector;
+import org.openoffice.setup.Util.SystemManager;
+import java.io.File;
+import java.util.Vector;
+
+public class InstallationOngoingCtrl extends PanelController {
+
+ private String helpFile;
+ private String nextDialog = new String("InstallationCompleted");
+ private String previousDialog = new String("InstallationImminent");
+
+ public InstallationOngoingCtrl() {
+ super("InstallationOngoing", new InstallationOngoing());
+ helpFile = "String_Helpfile_InstallationOngoing";
+ }
+
+ public String getNext() {
+ return new String("InstallationCompleted");
+ }
+
+ public String getPrevious() {
+ return new String("InstallationImminent");
+ }
+
+ public final String getHelpFileName () {
+ return this.helpFile;
+ }
+
+ public void beforeShow() {
+ getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_PREVIOUS);
+ getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_NEXT);
+ getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_CANCEL);
+ getSetupFrame().setButtonSelected(getSetupFrame().BUTTON_HELP);
+
+ InstallationOngoing panel = (InstallationOngoing)getPanel();
+ panel.setStopButtonActionCommand(getSetupFrame().ACTION_STOP);
+ panel.addStopButtonActionListener(getSetupFrame().getSetupActionListener());
+
+ // creating sorted list of packages to install
+ InstallData installData = InstallData.getInstance();
+ Vector installPackages = installData.getInstallPackages();
+
+ Vector sortedPackages = new Vector();
+ PackageCollector.sortPackages(installPackages, sortedPackages, "install");
+ installData.setInstallPackages(sortedPackages);
+
+ if ( installData.isMajorUpgrade() ) {
+ // PackageCollector.findOldPackages(installData);
+ // Sorting for correct order of uninstallation
+ Vector sortedUninstallPackages = new Vector();
+ PackageCollector.sortPackages(installData.getOldPackages(), sortedUninstallPackages, "uninstall");
+ installData.setOldPackages(sortedUninstallPackages);
+ }
+
+ Installer installer = InstallerFactory.getInstance();
+ installer.preInstallationOngoing();
+ }
+
+ public void duringShow() {
+
+ Thread t = new Thread() {
+
+ InstallData installData = InstallData.getInstance();
+ InstallationOngoing panel = (InstallationOngoing)getPanel();
+ Vector installPackages = installData.getInstallPackages();
+ Vector removePackages = installData.getOldPackages();
+ private Vector installedPackages = new Vector();
+
+ public void run() {
+ LogManager.setCommandsHeaderLine("Installation");
+ Installer installer = InstallerFactory.getInstance();
+ String titleText = ResourceManager.getString("String_InstallationOngoing1");
+ panel.setTitle(titleText);
+
+ for (int i = 0; i < installPackages.size(); i++) {
+ PackageDescription packageData = (PackageDescription) installPackages.get(i);
+ int progress = java.lang.Math.round((100*(i+1))/installPackages.size());
+ panel.setProgressValue(progress);
+ panel.setProgressText(packageData.getPackageName());
+
+ // Creating an upgrade process for Solaris packages
+ if ( installData.getOSType().equalsIgnoreCase("SunOS") ) {
+ if ( installer.isPackageInstalled(packageData, installData) ) {
+ if ( installer.isInstalledPackageOlder(packageData, installData) ) {
+ packageData.setIgnoreDependsForUninstall(true);
+ installer.uninstallPackage(packageData);
+ } else {
+ continue; // no downgrading
+ }
+ }
+ }
+
+ installer.installPackage(packageData);
+ installedPackages.add(packageData);
+
+ if ( installData.isAbortedInstallation() ) {
+ break;
+ }
+ }
+
+ if ( installData.isMajorUpgrade() ) {
+ for (int i = 0; i < removePackages.size(); i++) {
+ PackageDescription packageData = (PackageDescription) removePackages.get(i);
+ installer.uninstallPackage(packageData);
+ }
+ }
+
+ if ( installData.isAbortedInstallation() ) {
+ // undoing the installation
+ LogManager.setCommandsHeaderLine("Installation aborted!");
+ titleText = ResourceManager.getString("String_UninstallationOngoing1");
+ panel.setTitle(titleText);
+ panel.setStopButtonEnabled(false);
+
+ LogManager.setCommandsHeaderLine("Uninstallation");
+
+ for (int i = 0; i < installedPackages.size(); i++) {
+ PackageDescription packageData = (PackageDescription) installedPackages.get(i);
+ int progress = java.lang.Math.round(100/installedPackages.size()) * (i+1);
+ panel.setProgressValue(progress);
+ panel.setProgressText(packageData.getPackageName());
+ installer.uninstallPackage(packageData);
+ }
+
+ // removing already created helper files (admin files)
+ Vector removeFiles = installData.getRemoveFiles();
+ for (int i = 0; i < removeFiles.size(); i++) {
+ File removeFile = new File((String)removeFiles.get(i));
+ SystemManager.deleteFile(removeFile);
+ }
+ }
+
+ installer.postInstallationOngoing();
+
+ String next = getNext();
+ getSetupFrame().setCurrentPanel(next, false, true);
+ }
+ };
+
+ t.start();
+ }
+
+ public boolean afterShow(boolean nextButtonPressed) {
+ boolean repeatDialog = false;
+ getSetupFrame().setButtonEnabled(true, getSetupFrame().BUTTON_PREVIOUS);
+ getSetupFrame().setButtonEnabled(true, getSetupFrame().BUTTON_NEXT);
+ getSetupFrame().setButtonEnabled(true, getSetupFrame().BUTTON_CANCEL);
+
+ InstallData installData = InstallData.getInstance();
+ if ( ! installData.isAbortedInstallation() ) {
+ InfoDir.prepareUninstallation();
+ }
+
+ return repeatDialog;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/PrologueCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/PrologueCtrl.java
new file mode 100755
index 000000000000..85c682f9dee6
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/PrologueCtrl.java
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Controller;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.Installer.Installer;
+import org.openoffice.setup.Installer.InstallerFactory;
+import org.openoffice.setup.PanelController;
+import org.openoffice.setup.Panel.Prologue;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import org.openoffice.setup.Util.Controller;
+import org.openoffice.setup.Util.Dumper;
+import org.openoffice.setup.Util.ModuleCtrl;
+import org.openoffice.setup.Util.SystemManager;
+
+public class PrologueCtrl extends PanelController {
+
+ private String helpFile;
+
+ public PrologueCtrl() {
+ super("Prologue", new Prologue());
+ helpFile = "String_Helpfile_Prologue";
+ }
+
+ // public void beforeShow() {
+ public void duringShow() {
+ getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_PREVIOUS);
+
+ Thread t = new Thread() {
+ public void run() {
+ InstallData installData = InstallData.getInstance();
+ if ( ! installData.preInstallDone() ) {
+ getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_NEXT);
+
+ Controller.checkPackagePathExistence(installData);
+ Controller.checkPackageFormat(installData);
+
+ if (( installData.getOSType().equalsIgnoreCase("SunOS") ) && ( installData.isMultiLingual() )) {
+ Controller.collectSystemLanguages(installData);
+ }
+
+ PackageDescription packageData = SetupDataProvider.getPackageDescription();
+ Installer installer = InstallerFactory.getInstance();
+ installer.preInstall(packageData);
+
+ installData.setPreInstallDone(true);
+
+ if ( SystemManager.logModuleStates() ) {
+ installData.setLogModuleStates(true);
+ }
+
+ if ( installData.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "Prologue Dialog");
+ }
+
+ if (( installData.getOSType().equalsIgnoreCase("SunOS") ) && ( installData.isMultiLingual() )) {
+ ModuleCtrl.checkLanguagesPackages(packageData, installData);
+
+ // int count = installData.getPreselectedLanguages();
+ // System.err.println("Number of preselected language packages: " + count);
+
+ if ( installData.getPreselectedLanguages() == 0 ) {
+ // Something misterious happened. Setting all languages again.
+ ModuleCtrl.setLanguagesPackages(packageData);
+ }
+
+ if ( installData.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "Prologue Dialog Language Selection");
+ }
+ }
+
+ if ( ! installData.isMultiLingual() ) {
+ ModuleCtrl.setHiddenLanguageModuleDefaultSettings(packageData);
+
+ if ( installData.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "after setHiddenLanguageModuleDefaultSettings");
+ }
+ }
+
+ if (( installData.isRootInstallation() ) && ( installData.getOSType().equalsIgnoreCase("SunOS") )) {
+ // Check, if root has write access in /usr and /etc .
+ // In sparse zones with imported directories this is not always the case.
+ if ( Controller.reducedRootWritePrivileges() ) {
+ ModuleCtrl.setIgnoreNonRelocatablePackages(packageData);
+ }
+
+ if ( installData.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "after setIgnoreNonRelocatablePackages");
+ }
+ }
+
+ if ( installData.isRootInstallation() ) {
+
+ // Setting installation directory!
+ String dir = "/";
+ installData.setInstallDir(dir);
+ installData.setInstallDefaultDir(installData.getDefaultDir());
+
+ Controller.checkForNewerVersion(installData);
+
+ // Check Write privileges in installation directory (installData.getInstallDefaultDir())
+ // If the directory exists, is has to be tested, whether the user has write access
+ dir = installData.getInstallDefaultDir();
+
+ if ( SystemManager.exists_directory(dir) ) {
+ if ( ! Controller.createdSubDirectory(dir) ) {
+ System.err.println("ERROR: No write privileges inside directory: " + dir);
+ System.exit(1);
+ }
+ }
+
+ // If the directory does not exist, is has to be tested, whether the user can create it
+ if ( ! SystemManager.exists_directory(dir)) {
+ if ( ! Controller.createdDirectory(dir) ) {
+ System.err.println("ERROR: No privileges to create directory: " + dir);
+ System.exit(1);
+ }
+ }
+
+ // Setting macro
+ SetupDataProvider.setNewMacro("DIR", dir); // important for string replacement
+
+ // Calculate available disc space
+ int discSpace = SystemManager.calculateDiscSpace(dir);
+ installData.setAvailableDiscSpace(discSpace);
+
+ if ( ! installData.databaseAnalyzed()) {
+ ModuleCtrl.defaultDatabaseAnalysis(installData);
+ installData.setDatabaseAnalyzed(true);
+ }
+ }
+
+ getSetupFrame().setButtonEnabled(true, getSetupFrame().BUTTON_NEXT);
+ }
+ }
+ };
+ t.start();
+ }
+
+ public boolean afterShow(boolean nextButtonPressed) {
+ boolean repeatDialog = false;
+ getSetupFrame().setButtonEnabled(true, getSetupFrame().BUTTON_PREVIOUS);
+ return repeatDialog;
+ }
+
+ public String getNext() {
+ InstallData data = InstallData.getInstance();
+
+ if ( data.hideEula() ) {
+ if ( data.isRootInstallation() ) {
+ if ( data.olderVersionExists() ) {
+ return new String("InstallationImminent");
+ } else if ( data.sameVersionExists() ) {
+ return new String("ChooseComponents");
+ } else {
+ return new String("ChooseInstallationType");
+ }
+ } else {
+ return new String("ChooseDirectory");
+ }
+ } else {
+ return new String("AcceptLicense");
+ }
+ }
+
+ public String getPrevious() {
+ return null;
+ }
+
+ public final String getHelpFileName() {
+ return this.helpFile;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationCompletedCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationCompletedCtrl.java
new file mode 100755
index 000000000000..837f28546728
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationCompletedCtrl.java
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Controller;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.PanelController;
+import org.openoffice.setup.Panel.UninstallationCompleted;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupData.ProductDescription;
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import org.openoffice.setup.Util.InfoCtrl;
+import org.openoffice.setup.Util.LogManager;
+import java.util.Vector;
+
+public class UninstallationCompletedCtrl extends PanelController {
+
+ private String helpFile;
+ private String mDialogText;
+ private String htmlInfoText;
+
+ public UninstallationCompletedCtrl() {
+ super("UninstallationCompleted", new UninstallationCompleted());
+ helpFile = "String_Helpfile_UninstallationCompleted";
+ }
+
+ public void beforeShow() {
+ InstallData installData = InstallData.getInstance();
+ ProductDescription productData = SetupDataProvider.getProductDescription();
+
+ getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_PREVIOUS);
+ getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_CANCEL);
+ getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_HELP);
+ getSetupFrame().removeButtonIcon(getSetupFrame().BUTTON_NEXT);
+ getSetupFrame().setButtonSelected(getSetupFrame().BUTTON_NEXT);
+
+ UninstallationCompleted panel = (UninstallationCompleted)getPanel();
+ panel.setDetailsButtonActionCommand(getSetupFrame().ACTION_DETAILS);
+ panel.addDetailsButtonActionListener(getSetupFrame().getSetupActionListener());
+
+ if (( installData.isCustomInstallation() ) && ( ! installData.isMaskedCompleteUninstallation() )) {
+ String dialogText = ResourceManager.getString("String_UninstallationCompleted2_Partial");
+ panel.setDialogText(dialogText);
+ }
+
+ if ( installData.isAbortedInstallation() ) {
+ String titleText = ResourceManager.getString("String_UninstallationCompleted1_Abort");
+ panel.setTitleText(titleText);
+ String dialogText = ResourceManager.getString("String_UninstallationCompleted2_Abort");
+ panel.setDialogText(dialogText);
+ } else if ( installData.isErrorInstallation() ) {
+ String titleText = ResourceManager.getString("String_UninstallationCompleted1_Error");
+ panel.setTitleText(titleText);
+ String dialogText = ResourceManager.getString("String_UninstallationCompleted2_Error");
+ panel.setDialogText(dialogText);
+ }
+
+ htmlInfoText = InfoCtrl.setHtmlFrame("header", htmlInfoText);
+ htmlInfoText = InfoCtrl.setInstallLogInfoText(productData, htmlInfoText);
+ htmlInfoText = InfoCtrl.setHtmlFrame("end", htmlInfoText);
+ }
+
+ public String getNext() {
+ return null;
+ }
+
+ public String getPrevious() {
+ return null;
+ }
+
+ public final String getHelpFileName () {
+ return this.helpFile;
+ }
+
+ public String getDialogText() {
+ return htmlInfoText;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationImminentCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationImminentCtrl.java
new file mode 100755
index 000000000000..00b7ff25de31
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationImminentCtrl.java
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Controller;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.PanelController;
+import org.openoffice.setup.Panel.UninstallationImminent;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.SetupData.ProductDescription;
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import org.openoffice.setup.Util.InfoCtrl;
+import org.openoffice.setup.Util.ModuleCtrl;
+
+public class UninstallationImminentCtrl extends PanelController {
+
+ private String helpFile;
+ private String htmlInfoText = "";
+
+ public UninstallationImminentCtrl() {
+ super("UninstallationImminent", new UninstallationImminent());
+ helpFile = "String_Helpfile_UninstallationImminent";
+ }
+
+ public String getNext() {
+ return new String("UninstallationOngoing");
+ }
+
+ public String getPrevious() {
+
+ InstallData data = InstallData.getInstance();
+
+ if ( data.getInstallationType().equals(data.getCustomActionCommand()) ) {
+ return new String("ChooseUninstallationComponents");
+ } else if ( data.getInstallationType().equals(data.getTypicalActionCommand()) ) {
+ return new String("ChooseUninstallationType");
+ } else {
+ System.err.println("Error: Unknown uninstallation type!" );
+ return new String("Error");
+ }
+ }
+
+ public final String getHelpFileName () {
+ return this.helpFile;
+ }
+
+ public void beforeShow() {
+ String StringInstall = ResourceManager.getString("String_Uninstall");
+ getSetupFrame().setButtonText(StringInstall, getSetupFrame().BUTTON_NEXT);
+
+ ProductDescription productData = SetupDataProvider.getProductDescription();
+ PackageDescription packageData = SetupDataProvider.getPackageDescription();
+
+ htmlInfoText = InfoCtrl.setHtmlFrame("header", htmlInfoText);
+ htmlInfoText = InfoCtrl.setReadyToInstallInfoText(productData, htmlInfoText);
+ htmlInfoText = InfoCtrl.setReadyToInstallInfoText(packageData, htmlInfoText);
+ htmlInfoText = InfoCtrl.setHtmlFrame("end", htmlInfoText);
+
+ UninstallationImminent panel = (UninstallationImminent)getPanel();
+ panel.setInfoText(htmlInfoText);
+ panel.setCaretPosition();
+
+ // System.err.println("\nUninstallation module state dump 3:");
+ // Dumper.dumpModuleStates(packageData);
+ }
+
+ public void duringShow() {
+ UninstallationImminent panel = (UninstallationImminent)getPanel();
+ panel.setTabOrder();
+ }
+
+ public boolean afterShow(boolean nextButtonPressed) {
+ boolean repeatDialog = false;
+
+ if ( nextButtonPressed ) {
+ PackageDescription packageData = SetupDataProvider.getPackageDescription();
+ ModuleCtrl.setHiddenModuleSettingsUninstall(packageData);
+ // Dumper.dumpUninstallPackages(packageData);
+
+ // System.err.println("\nUninstallation module state dump 4:");
+ // Dumper.dumpModuleStates(packageData);
+ }
+
+ return repeatDialog;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationOngoingCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationOngoingCtrl.java
new file mode 100755
index 000000000000..a5065cc0e905
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationOngoingCtrl.java
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Controller;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.Installer.Installer;
+import org.openoffice.setup.Installer.InstallerFactory;
+import org.openoffice.setup.PanelController;
+import org.openoffice.setup.Panel.UninstallationOngoing;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import org.openoffice.setup.Util.InfoDir;
+import org.openoffice.setup.Util.LogManager;
+import org.openoffice.setup.Util.PackageCollector;
+import java.util.Vector;
+public class UninstallationOngoingCtrl extends PanelController {
+
+ private String helpFile;
+
+ public UninstallationOngoingCtrl() {
+ super("UninstallationOngoing", new UninstallationOngoing());
+ helpFile = "String_Helpfile_UninstallationOngoing";
+ }
+
+ public String getNext() {
+ return new String("UninstallationCompleted");
+ }
+
+ public String getPrevious() {
+ return new String("UninstallationImminent");
+ }
+
+ public final String getHelpFileName () {
+ return this.helpFile;
+ }
+
+ public void beforeShow() {
+ getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_PREVIOUS);
+ getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_NEXT);
+ getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_CANCEL);
+ getSetupFrame().setButtonSelected(getSetupFrame().BUTTON_HELP);
+
+ UninstallationOngoing panel = (UninstallationOngoing)getPanel();
+ panel.setStopButtonActionCommand(getSetupFrame().ACTION_STOP);
+ panel.addStopButtonActionListener(getSetupFrame().getSetupActionListener());
+
+ // creating list of packages to uninstall
+ InstallData data = InstallData.getInstance();
+ Vector uninstallPackages = new Vector();
+ PackageDescription packageData = SetupDataProvider.getPackageDescription();
+ PackageCollector.collectUninstallPackages(packageData, uninstallPackages);
+
+ Vector sortedPackages = new Vector();
+ PackageCollector.sortPackages(uninstallPackages, sortedPackages, "uninstall");
+ data.setInstallPackages(sortedPackages);
+
+ // collectPackages(packageData);
+
+ Installer installer = InstallerFactory.getInstance();
+ installer.preInstallationOngoing();
+ }
+
+ public void duringShow() {
+
+ Thread t = new Thread() {
+
+ UninstallationOngoing panel = (UninstallationOngoing)getPanel();
+ InstallData installData = InstallData.getInstance();
+ Vector uninstallPackages = installData.getInstallPackages();
+
+ public void run() {
+ LogManager.setCommandsHeaderLine("Uninstallation");
+ Installer installer = InstallerFactory.getInstance();
+
+ for (int i = 0; i < uninstallPackages.size(); i++) {
+ PackageDescription packageData = (PackageDescription) uninstallPackages.get(i);
+ int progress = java.lang.Math.round((100*(i+1))/uninstallPackages.size());
+ panel.setProgressValue(progress);
+ panel.setProgressText(packageData.getPackageName());
+
+ installer.uninstallPackage(packageData);
+
+ if ( installData.isAbortedInstallation() ) {
+ break;
+ }
+ }
+
+ if ( installData.isAbortedInstallation() ) {
+ LogManager.setCommandsHeaderLine("Uninstallation aborted!");
+ // undoing the uninstallation is not possible
+ }
+
+ installer.postUninstallationOngoing();
+
+ String next = getNext();
+ getSetupFrame().setCurrentPanel(next, false, true);
+ }
+ };
+
+ t.start();
+
+ }
+
+ public boolean afterShow(boolean nextButtonPressed) {
+ boolean repeatDialog = false;
+ getSetupFrame().setButtonEnabled(true, getSetupFrame().BUTTON_PREVIOUS);
+ getSetupFrame().setButtonEnabled(true, getSetupFrame().BUTTON_NEXT);
+ getSetupFrame().setButtonEnabled(true, getSetupFrame().BUTTON_CANCEL);
+
+ InstallData data = InstallData.getInstance();
+
+ if ( ! data.isAbortedInstallation() ) {
+ if (( data.isTypicalInstallation() ) || ( data.isMaskedCompleteUninstallation() )) {
+ InfoDir.removeUninstallationFiles();
+ }
+ }
+
+ return repeatDialog;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationPrologueCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationPrologueCtrl.java
new file mode 100755
index 000000000000..1e35db23454d
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller/UninstallationPrologueCtrl.java
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Controller;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.Installer.Installer;
+import org.openoffice.setup.Installer.InstallerFactory;
+import org.openoffice.setup.PanelController;
+import org.openoffice.setup.Panel.UninstallationPrologue;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import org.openoffice.setup.Util.Converter;
+import org.openoffice.setup.Util.Dumper;
+import org.openoffice.setup.Util.Informer;
+import org.openoffice.setup.Util.LogManager;
+import org.openoffice.setup.Util.ModuleCtrl;
+import org.openoffice.setup.Util.SystemManager;
+import java.io.File;
+import java.util.HashMap;
+import java.util.Vector;
+import org.openoffice.setup.ResourceManager;
+
+public class UninstallationPrologueCtrl extends PanelController {
+
+ private String helpFile;
+
+ public UninstallationPrologueCtrl() {
+ super("UninstallationPrologue", new UninstallationPrologue());
+ helpFile = "String_Helpfile_UninstallationPrologue";
+ }
+
+ public String getNext() {
+ return new String("ChooseUninstallationType");
+ }
+
+ public String getPrevious() {
+ return null;
+ }
+
+ public final String getHelpFileName () {
+ return this.helpFile;
+ }
+
+ private HashMap getInfoFileData() {
+ InstallData data = InstallData.getInstance();
+ File infoRootDir = data.getInfoRoot();
+ String infoFilename = "infoFile";
+ File infoFile = new File(infoRootDir, infoFilename);
+ Vector infoFileContent = SystemManager.readCharFileVector(infoFile.getPath());
+ HashMap map = Converter.convertVectorToHashmap(infoFileContent);
+
+ // for (int i = 0; i < infoFileContent.size(); i++) {
+ // System.out.println(infoFileContent.get(i));
+ // }
+
+ // Iterator m = map.entrySet().iterator();
+ // while ( m.hasNext() ) {
+ // Map.Entry entry = (Map.Entry) m.next();
+ // System.out.println( "MAP:" + entry.getKey() + ":" + entry.getValue() );
+ // }
+
+ return map;
+ }
+
+ private void setNewInstallData(HashMap map) {
+ InstallData data = InstallData.getInstance();
+ // adding information to installData
+ data.setPackagePath((String)map.get("PackagePath"));
+ data.setAdminFileNameReloc((String)map.get("AdminFileReloc"));
+ data.setAdminFileNameRelocNoDepends((String)map.get("AdminFileRelocNoDepends"));
+ data.setAdminFileNameNoReloc((String)map.get("AdminFileNoReloc"));
+ data.setAdminFileNameNoRelocNoDepends((String)map.get("AdminFileNoRelocNoDepends"));
+ data.setDatabasePath((String)map.get("DatabasePath"));
+ data.setInstallDir((String)map.get("InstallationDir"));
+ data.setStoredInstallationPrivileges((String)map.get("InstallationPrivileges"));
+ data.setGetUidPath((String)map.get("GetUidFile"));
+ }
+
+ private void readInfoFile() {
+ HashMap map = getInfoFileData();
+ setNewInstallData(map);
+ Dumper.dumpNewInstallData();
+ }
+
+ private void checkUninstallPrivileges() {
+ InstallData data = InstallData.getInstance();
+ // data.setStoredInstallationPrivileges((String)map.get("InstallationPrivileges"));
+ String originalPrivileges = data.getStoredInstallationPrivileges();
+ String currentPrivileges = data.getInstallationPrivileges();
+ if ( ! currentPrivileges.equalsIgnoreCase(originalPrivileges) ) {
+ // aborting installation with error message
+ if ( currentPrivileges.equalsIgnoreCase("root")) {
+ String message = ResourceManager.getString("String_UninstallationPrologue_Wrong_Privileges_Current_Root");
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+ String log = "<b>Error: Wrong uninstallation privileges (currently Root)!</b><br>";
+ System.err.println(log);
+ // LogManager.addLogfileComment(log);
+ } else {
+ String message = ResourceManager.getString("String_UninstallationPrologue_Wrong_Privileges_Current_User");
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+ String log = "<b>Error: Wrong uninstallation privileges (currently User)!</b><br>";
+ System.err.println(log);
+ // LogManager.addLogfileComment(log);
+ }
+ System.exit(1);
+ }
+
+ }
+
+ public void beforeShow() {
+ getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_PREVIOUS);
+ // System.err.println("\nUninstallation module state dump 1:");
+ // PackageDescription packageData = SetupDataProvider.getPackageDescription();
+ // ModuleCtrl.dumpModuleStates(packageData);
+ getSetupFrame().setButtonSelected(getSetupFrame().BUTTON_NEXT);
+ }
+
+ public void duringShow() {
+
+ Thread t = new Thread() {
+ public void run() {
+ InstallData installData = InstallData.getInstance();
+ if ( ! installData.databaseAnalyzed() ) {
+ getSetupFrame().setButtonEnabled(false, getSetupFrame().BUTTON_NEXT);
+
+ // now it is time to read the infoFile in directory "installData.getInfoRoot()"
+ readInfoFile();
+
+ // controlling the installation privileges. Are the original installation privileges
+ // identical with the current deinstallation privileges?
+ checkUninstallPrivileges();
+
+ PackageDescription packageData = SetupDataProvider.getPackageDescription();
+ Installer installer = InstallerFactory.getInstance();
+ installer.preUninstall(packageData);
+
+ // searching in the database for already installed packages
+ LogManager.setCommandsHeaderLine("Analyzing system database");
+ ModuleCtrl.setDatabaseSettings(packageData, installData, installer);
+ installData.setDatabaseAnalyzed(true);
+ ModuleCtrl.setDontUninstallFlags(packageData);
+ if ( installData.isRootInstallation() ) { ModuleCtrl.setDontUninstallUserInstallOnylFlags(packageData); }
+ ModuleCtrl.setParentDefaultModuleSettings(packageData);
+ getSetupFrame().setButtonEnabled(true, getSetupFrame().BUTTON_NEXT);
+ getSetupFrame().setButtonSelected(getSetupFrame().BUTTON_NEXT);
+ }
+ }
+ };
+
+ t.start();
+ }
+
+ public boolean afterShow(boolean nextButtonPressed) {
+ boolean repeatDialog = false;
+ getSetupFrame().setButtonEnabled(true, getSetupFrame().BUTTON_PREVIOUS);
+ return repeatDialog;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/DeckOfPanels.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/DeckOfPanels.java
new file mode 100755
index 000000000000..c433307ed2f1
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/DeckOfPanels.java
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup;
+
+import java.util.HashMap;
+
+public class DeckOfPanels {
+
+ private PanelController mCurrent;
+ private HashMap mDeck;
+
+ public DeckOfPanels() {
+ mDeck = new HashMap();
+ mCurrent = null;
+ }
+
+ void addPanel(PanelController panel, String name) {
+ mDeck.put(name, panel);
+ }
+
+ public PanelController getCurrentPanel () {
+ return mCurrent;
+ }
+
+ public PanelController setCurrentPanel(String name) {
+ mCurrent = (PanelController)mDeck.get(name);
+ return mCurrent;
+ }
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Dialogs/DatabaseDialog.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Dialogs/DatabaseDialog.java
new file mode 100755
index 000000000000..9df39ec2d517
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Dialogs/DatabaseDialog.java
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Dialogs;
+
+import org.openoffice.setup.PanelHelper.PanelLabel;
+import org.openoffice.setup.SetupFrame;
+import java.awt.BorderLayout;
+import java.awt.Container;
+import java.awt.Insets;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+import org.openoffice.setup.ResourceManager;
+
+public class DatabaseDialog extends JDialog {
+
+ public DatabaseDialog(SetupFrame setupFrame) {
+
+ // super(setupFrame.getDialog());
+
+ String text1 = ResourceManager.getString("String_Analyzing_Database1");
+ String text2 = ResourceManager.getString("String_Analyzing_Database2");
+
+ setTitle(text1);
+ this.getContentPane().setLayout(new java.awt.BorderLayout());
+
+ JPanel toppanel = new JPanel();
+ toppanel.setLayout(new java.awt.BorderLayout());
+ toppanel.setBorder(new EmptyBorder(new Insets(50, 50, 50, 50)));
+
+ PanelLabel label1 = new PanelLabel(text2);
+ toppanel.add(label1, BorderLayout.NORTH);
+
+ Container contentPane = this.getContentPane();
+ contentPane.add(toppanel);
+ // this.getContentPane().add(toppanel, BorderLayout.CENTER);
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Dialogs/DetailsDialog.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Dialogs/DetailsDialog.java
new file mode 100755
index 000000000000..c21d1e663cae
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Dialogs/DetailsDialog.java
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Dialogs;
+
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupFrame;
+import org.openoffice.setup.Util.DialogFocusTraversalPolicy;
+import java.awt.BorderLayout;
+import java.awt.ComponentOrientation;
+import java.awt.Dimension;
+import java.awt.Insets;
+import java.awt.event.ActionListener;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JEditorPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSeparator;
+import javax.swing.JViewport;
+import javax.swing.ScrollPaneConstants;
+import javax.swing.border.EmptyBorder;
+import org.openoffice.setup.InstallData;
+
+public class DetailsDialog extends JDialog implements ActionListener {
+
+ private JButton okButton;
+ private String helpFileName;
+ private String helpFileString;
+
+ public DetailsDialog(SetupFrame setupFrame) {
+
+ super(setupFrame.getDialog());
+
+ InstallData data = InstallData.getInstance();
+
+ String dialogTitle = ResourceManager.getString("String_InstallationCompleted_Button");
+ String dialogText = setupFrame.getCurrentPanel().getDialogText();
+
+ setTitle(dialogTitle);
+ this.getContentPane().setLayout(new java.awt.BorderLayout());
+
+ JPanel toppanel = new JPanel();
+ toppanel.setLayout(new java.awt.BorderLayout());
+ toppanel.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
+
+ JPanel buttonpanel = new JPanel();
+ buttonpanel.setLayout(new java.awt.FlowLayout());
+ buttonpanel.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
+ if ( data.useRtl() ) { buttonpanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ //Create an editor pane.
+ JEditorPane editorPane = createEditorPane(dialogText);
+ editorPane.setCaretPosition(0);
+ if ( data.useRtl() ) { editorPane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+ JScrollPane editorScrollPane = new JScrollPane(editorPane,
+ ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
+ ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ editorScrollPane.setPreferredSize(new Dimension(250, 145));
+ editorScrollPane.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
+ if ( data.useRtl() ) { editorScrollPane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ JViewport port = editorScrollPane.getViewport();
+ port.getVisibleRect().setLocation(0,0);
+ if ( data.useRtl() ) { port.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+ editorScrollPane.setViewport(port);
+
+ // String helpTitle1 = ResourceManager.getString("String_Details_Title_1");
+ // PanelLabel label1 = new PanelLabel(helpTitle1, true);
+ // String helpTitle2 = ResourceManager.getString("String_Details_Title_2");
+ // PanelLabel label2 = new PanelLabel(helpTitle2);
+
+ String okString = ResourceManager.getString("String_OK");
+ okButton = new JButton(okString);
+ okButton.setEnabled(true);
+ okButton.addActionListener(this);
+
+ JSeparator separator = new JSeparator();
+
+ // toppanel.add(label1, BorderLayout.NORTH);
+ // toppanel.add(label2, BorderLayout.CENTER);
+ buttonpanel.add(okButton);
+
+ this.getContentPane().add(toppanel, BorderLayout.NORTH);
+ this.getContentPane().add(editorScrollPane, BorderLayout.CENTER);
+ this.getContentPane().add(buttonpanel, BorderLayout.SOUTH);
+
+ // JScrollBar ScrollBar = editorScrollPane.getVerticalScrollBar();
+ // if ( ScrollBar.isShowing() ) {
+ // editorPane.setFocusable(false);
+ // } else {
+ // editorPane.setFocusable(true);
+ // }
+
+ // Setting tab-order and focus on okButton
+ DialogFocusTraversalPolicy policy = new DialogFocusTraversalPolicy(new JComponent[] {okButton, editorScrollPane});
+ this.setFocusTraversalPolicy(policy); // set policy
+ this.setFocusCycleRoot(true); // enable policy
+ }
+
+ private JEditorPane createEditorPane(String dialogText) {
+ JEditorPane editorPane = new JEditorPane();
+ editorPane.setEditable(false);
+ editorPane.setContentType("text/html");
+ editorPane.setText(dialogText);
+ return editorPane;
+ }
+
+ public void actionPerformed (java.awt.event.ActionEvent evt) {
+ setVisible(false);
+ dispose();
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Dialogs/HelpDialog.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Dialogs/HelpDialog.java
new file mode 100755
index 000000000000..3fd9b1976e0c
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Dialogs/HelpDialog.java
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Dialogs;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupFrame;
+import org.openoffice.setup.Util.DialogFocusTraversalPolicy;
+import java.awt.BorderLayout;
+import java.awt.ComponentOrientation;
+import java.awt.Dimension;
+import java.awt.Insets;
+import java.awt.event.ActionListener;
+import java.io.File;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JEditorPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSeparator;
+import javax.swing.border.EmptyBorder;
+
+public class HelpDialog extends JDialog implements ActionListener {
+
+ private JButton okButton;
+ private JEditorPane editorPane;
+ private JScrollPane editorScrollPane;
+ private String helpFileName;
+ private String helpFileString;
+
+ public HelpDialog(SetupFrame setupFrame) {
+
+ super(setupFrame.getDialog());
+
+ InstallData data = InstallData.getInstance();
+
+ helpFileString = setupFrame.getCurrentPanel().getHelpFileName();
+ helpFileName = ResourceManager.getFileName(helpFileString);
+ // String dialogName = setupFrame.getCurrentPanel().getName();
+
+ String helpTitle = ResourceManager.getString("String_Help");
+ setTitle(helpTitle);
+ // setLayout(new java.awt.BorderLayout());
+ this.getContentPane().setLayout(new java.awt.BorderLayout());
+
+ JPanel toppanel = new JPanel();
+ toppanel.setLayout(new java.awt.BorderLayout());
+ toppanel.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
+ if ( data.useRtl() ) { toppanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ JPanel buttonpanel = new JPanel();
+ buttonpanel.setLayout(new java.awt.FlowLayout());
+ buttonpanel.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
+ if ( data.useRtl() ) { buttonpanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ //Create an editor pane.
+ editorPane = createEditorPane();
+ editorScrollPane = new JScrollPane(editorPane);
+ editorScrollPane.setPreferredSize(new Dimension(250, 145));
+ editorScrollPane.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
+ if ( data.useRtl() ) { editorScrollPane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ // String helpTitle1 = null;
+ // InstallData data = InstallData.getInstance();
+ // if ( data.isInstallationMode() ) {
+ // helpTitle1 = ResourceManager.getString("String_Help_Title_1");
+ // } else {
+ // helpTitle1 = ResourceManager.getString("String_Help_Title_1_Uninstallation");
+ // }
+
+ // PanelLabel label1 = new PanelLabel(helpTitle1, true);
+ // String helpTitle2 = ResourceManager.getString("String_Help_Title_2");
+ // PanelLabel label2 = new PanelLabel(helpTitle2);
+
+ String okString = ResourceManager.getString("String_OK");
+ okButton = new JButton(okString);
+ okButton.setEnabled(true);
+ okButton.addActionListener(this);
+ if ( data.useRtl() ) { okButton.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ JSeparator separator = new JSeparator();
+
+ // toppanel.add(label1, BorderLayout.NORTH);
+ // toppanel.add(label2, BorderLayout.CENTER);
+ buttonpanel.add(okButton);
+
+ this.getContentPane().add(toppanel, BorderLayout.NORTH);
+ this.getContentPane().add(editorScrollPane, BorderLayout.CENTER);
+ this.getContentPane().add(buttonpanel, BorderLayout.SOUTH);
+
+ // Setting tab-order and focus on okButton
+ DialogFocusTraversalPolicy policy = new DialogFocusTraversalPolicy(new JComponent[] {okButton, editorScrollPane});
+ this.setFocusTraversalPolicy(policy); // set policy
+ this.setFocusCycleRoot(true); // enable policy
+ }
+
+ private JEditorPane createEditorPane() {
+ JEditorPane editorPane = new JEditorPane();
+ editorPane.setEditable(false);
+
+ InstallData data = InstallData.getInstance();
+ File htmlDirectory = data.getInfoRoot("html");
+
+ if ( htmlDirectory != null) {
+ File htmlFile = new File(htmlDirectory, helpFileName);
+ if (! htmlFile.exists()) {
+ System.err.println("Couldn't find file: " + htmlFile.toString());
+ }
+
+ try {
+ // System.err.println("URLPath: " + htmlFile.toURL());
+ editorPane.setContentType("text/html;charset=utf-8");
+ editorPane.setPage(htmlFile.toURL());
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.err.println("Attempted to read a bad URL");
+ }
+ }
+ else {
+ System.err.println("Did not find html directory");
+ }
+
+ return editorPane;
+ }
+
+// public void setTabForScrollPane() {
+// JScrollBar ScrollBar = editorScrollPane.getVerticalScrollBar();
+// editorPane.setFocusable(true);
+// if ( ScrollBar.isShowing() ) {
+// } else {
+// editorPane.setFocusable(false);
+// }
+// }
+
+ public void actionPerformed (java.awt.event.ActionEvent evt) {
+ setVisible(false);
+ dispose();
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Back.gif b/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Back.gif
new file mode 100755
index 000000000000..9fd5902ff33a
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Back.gif
Binary files differ
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/DontInstall.png b/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/DontInstall.png
new file mode 100755
index 000000000000..a641d3523324
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/DontInstall.png
Binary files differ
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/DontKnow.png b/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/DontKnow.png
new file mode 100755
index 000000000000..41e7db388831
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/DontKnow.png
Binary files differ
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Forward.gif b/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Forward.gif
new file mode 100755
index 000000000000..f4f648a582e9
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Forward.gif
Binary files differ
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Install.png b/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Install.png
new file mode 100755
index 000000000000..9ac2ee91b701
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Install.png
Binary files differ
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Installed.png b/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Installed.png
new file mode 100755
index 000000000000..379397c6f2ef
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Installed.png
Binary files differ
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Remove.png b/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Remove.png
new file mode 100755
index 000000000000..0b5b04c02ad0
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Icons/Remove.png
Binary files differ
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java
new file mode 100755
index 000000000000..aefd78e480b7
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java
@@ -0,0 +1,719 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup;
+
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.Util.Controller;
+import org.openoffice.setup.Util.SystemManager;
+import java.io.File;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Vector;
+
+public class InstallData
+{
+ public static final String ACTION_TYPICAL = "ActionTypical";
+ public static final String ACTION_CUSTOM = "ActionCustom";
+
+ private static InstallData instance = null;
+
+ static private boolean isUserInstallation; /* root or user installation? */
+ static private boolean isRootInstallation; /* root or user installation? */
+ static private boolean isInstallationMode; /* installation or uninstallation? */
+ static private boolean isUninstallationMode; /* installation or uninstallation? */
+ static private boolean isCustomInstallation = false; /* custom or typical? */
+ static private boolean isTypicalInstallation = true; /* custom or typical? */
+ static private boolean isSolarisUserInstallation = false;
+ static private boolean isChangeInstallation = false;
+ static private boolean stillRunning = false;
+ static private boolean stillAnalyzing = true;
+ static private boolean databaseAnalyzed = false; /* the database was already analyzed? */
+ static private boolean moduleSizeSet = false; /* the database was already analyzed? */
+ static private boolean preInstallDone = false; /* preInstall script already executed? */
+ static private boolean isAbortedInstallation = false;
+ static private boolean isErrorInstallation = false;
+ static private boolean logModuleStates = false; /* logging the current state of modules */
+ static private boolean visibleModulesChecked = false; /* checking, if the user selected modules */
+ static private boolean languageModulesChecked = false; /* checking, if the user selected language modules */
+ static private boolean applicationModulesChecked = false; /* checking, if the user selected application modules */
+ static private boolean isMaskedCompleteUninstallation = false; /* checking if all visible modules are uninstalled */
+ static private boolean typicalSelectionStateSaved = false;
+ static private boolean customSelectionStateSaved = false;
+ static private boolean startSelectionStateSaved = false;
+ static private boolean olderVersionExists = false;
+ static private boolean sameVersionExists = false;
+ static private boolean newerVersionExists = false;
+ static private boolean majorUpgrade = false;
+ static private boolean isMultiLingual = false;
+ static private boolean dontUpdate = false;
+ static private boolean hideEula = false;
+ static private boolean databaseQueried = false;
+ static private boolean useRtl = false;
+ static private boolean installedProductMinorSet = false;
+ static private String installType; /* custom or typical installation */
+ static private String osType; /* Linux, SunOS, ... */
+ static private String installDir = null;
+ static private String defaultDir = "/opt";
+ static private String installDefaultDir = null;
+ static private String productDir = null;
+ static private String packageFormat = null;
+ static private String architecture = null;
+ static private String packagePath = null;
+ static private String packageSubdir = "packages";
+ static private String adminFileNameReloc = null;
+ static private String adminFileNameRelocNoDepends = null;
+ static private String adminFileNameNoReloc = null;
+ static private String adminFileNameNoRelocNoDepends = null;
+ static private String databasePath = null;
+ static private String getUidPath = null;
+ static private String installationPrivileges = null;
+ static private String storedInstallationPrivileges = null; /* privileges saved in file */
+ static private String localTempPath = null;
+ static private String installDirName = "installdata";
+ static private String uninstallDirName = "uninstalldata";
+ static private int availableDiscSpace = 0;
+ static private int preselectedLanguages = 0;
+ static private int productMinor = 0;
+ static private int installedProductMinor = 0;
+ static private File jarFilePath = null;
+ static private File resourceRoot;
+ static private File infoRoot;
+ static private HashMap shellEnvironment = null; /* Solaris environment for user install */
+ static private HashMap databaseMap = null;
+ static private PackageDescription updatePackage = null;
+ static private Vector removeFiles = new Vector(); /* Files to remove, if installation is aborted */
+ static private Vector installPackages = new Vector();
+ static private Vector oldPackages = new Vector();
+ static private Vector systemLanguages = new Vector();
+
+ public static InstallData getInstance()
+ {
+ if (instance == null) {
+ instance = new InstallData();
+ }
+ return instance;
+ }
+
+ private InstallData()
+ {
+ installType = ACTION_TYPICAL; // default installation type
+ isUserInstallation = SystemManager.isUserInstallation();
+ isRootInstallation = !isUserInstallation;
+ setInstallationPrivileges(isUserInstallation);
+ osType = SystemManager.getOSType();
+ resourceRoot = SystemManager.getResourceRoot();
+ setInstallationMode();
+ setSolarisUserInstall();
+ setHtmlFileExistence();
+ setBidiSupport();
+ }
+
+ public void setInstallationType(String installationtype) {
+ installType = installationtype;
+
+ if ( installType.equals(this.getCustomActionCommand())) {
+ isCustomInstallation = true;
+ isTypicalInstallation = false;
+ }
+
+ if ( installType.equals(this.getTypicalActionCommand())) {
+ isCustomInstallation = false;
+ isTypicalInstallation = true;
+ }
+ }
+
+ private void setInstallationMode() {
+ // Exists a directory "uninstalldata" below the resource root?
+ File uninstallDir = new File(resourceRoot, uninstallDirName);
+ File installDir = new File(resourceRoot, installDirName);
+
+ if ( SystemManager.exists_directory(uninstallDir.getPath())) {
+ isInstallationMode = false;
+ isUninstallationMode = true;
+ infoRoot = uninstallDir;
+ System.err.println("Mode: uninstallation");
+ } else if ( SystemManager.exists_directory(installDir.getPath())) {
+ isInstallationMode = true;
+ isUninstallationMode = false;
+ infoRoot = installDir;
+ System.err.println("Mode: installation");
+ } else {
+ // isInstallationMode = null;
+ // isUninstallationMode = null;
+ infoRoot = null;
+ System.err.println("Error: Did not find info path");
+ System.err.println("Error: No info about installation or uninstallation");
+ System.exit(1);
+ }
+ }
+
+ private void setSolarisUserInstall() {
+ if (( isUserInstallation ) && (osType.equalsIgnoreCase("SunOS"))) {
+ isSolarisUserInstallation = true;
+ if ( isInstallationMode ) {
+ Controller.checkForUidFile(this);
+ }
+ }
+ }
+
+ private void setHtmlFileExistence() {
+ // After inforoot is determined, the existence of files in subdirectory "html" can be checked
+ File htmlDirectory = getInfoRoot("html");
+ ResourceManager.checkFileExistence(htmlDirectory);
+ }
+
+ private void setBidiSupport() {
+ Locale locale = Locale.getDefault();
+ if (( locale.getLanguage().equals(new Locale("he", "", "").getLanguage()) )
+ || ( locale.getLanguage().equals(new Locale("ar", "", "").getLanguage()) )) {
+ useRtl = true;
+ }
+ }
+
+ private void setInstallationPrivileges(boolean isUserInstallation) {
+ if ( isUserInstallation ) {
+ installationPrivileges = "user";
+ } else {
+ installationPrivileges = "root";
+ }
+ }
+
+ public String getInstallationType() {
+ return installType;
+ }
+
+ public String getCustomActionCommand() {
+ return ACTION_CUSTOM;
+ }
+
+ public String getTypicalActionCommand() {
+ return ACTION_TYPICAL;
+ }
+
+ public String getInstallationPrivileges() {
+ return installationPrivileges;
+ }
+
+ public String getOSType() {
+ return osType;
+ }
+
+ public File getResourceRoot() {
+ return resourceRoot;
+ }
+
+ public File getResourceRoot(String subDirectory) {
+
+ File dir = getResourceRoot();
+
+ if (dir != null) {
+ dir = new File(dir, subDirectory);
+ if (!dir.exists()) {
+ dir = null;
+ }
+ }
+
+ return dir;
+ }
+
+ public File getInfoRoot() {
+ return infoRoot;
+ }
+
+ public File getInfoRoot(String subDirectory) {
+ File dir = new File(infoRoot, subDirectory);
+ if (!dir.exists()) {
+ dir = null;
+ }
+
+ return dir;
+ }
+
+ public boolean isUserInstallation() {
+ return isUserInstallation;
+ }
+
+ public boolean isRootInstallation() {
+ return isRootInstallation;
+ }
+
+ public boolean isInstallationMode() {
+ return isInstallationMode;
+ }
+
+ public boolean isUninstallationMode() {
+ return isUninstallationMode;
+ }
+
+ public boolean isSolarisUserInstallation() {
+ return isSolarisUserInstallation;
+ }
+
+ public boolean useRtl() {
+ return useRtl;
+ }
+
+ public String getDefaultDir() {
+ return defaultDir;
+ }
+
+ public void setDefaultDir(String dir) {
+ defaultDir = dir;
+ }
+
+ public String getProductDir() {
+ return productDir;
+ }
+
+ public void setProductDir(String dir) {
+ productDir = dir;
+ }
+
+ public int getProductMinor() {
+ return productMinor;
+ }
+
+ public void setProductMinor(int minor) {
+ productMinor = minor;
+ }
+
+ public int getInstalledProductMinor() {
+ return installedProductMinor;
+ }
+
+ public void setInstalledProductMinor(int minor) {
+ installedProductMinor = minor;
+ }
+
+ public String getInstallDirName() {
+ return installDirName;
+ }
+
+ public String getUninstallDirName() {
+ return uninstallDirName;
+ }
+
+ public String getInstallDir() {
+ return installDir;
+ }
+
+ public void setInstallDir(String dir) {
+ installDir = dir;
+ }
+
+ public String getInstallDefaultDir() {
+ return installDefaultDir;
+ }
+
+ public void setInstallDefaultDir(String dir) {
+ installDefaultDir = dir;
+ }
+
+ public String getDatabasePath() {
+ return databasePath;
+ }
+
+ public void setDatabasePath(String path) {
+ databasePath = path;
+ }
+
+ public String getPackagePath() {
+ if ( packagePath == null ) {
+ packagePath = SystemManager.getPackagePath(packageSubdir);
+ }
+ return packagePath;
+ }
+
+ public void setPackagePath(String path) {
+ packagePath = path;
+ }
+
+ public String getPackageSubdir() {
+ return packageSubdir;
+ }
+
+ public void setPackageSubdir(String dir) {
+ packageSubdir = dir;
+ }
+
+ public String getPackageFormat() {
+ return packageFormat;
+ }
+
+ public void setPackageFormat(String format) {
+ packageFormat = format;
+ }
+
+ public String getArchitecture() {
+ return architecture;
+ }
+
+ public void setArchitecture(String arch) {
+ architecture = arch;
+ }
+
+ public String getLocalTempPath() {
+ return localTempPath;
+ }
+
+ public void setLocalTempPath(String path) {
+ localTempPath = path;
+ }
+
+ public int getAvailableDiscSpace() {
+ return availableDiscSpace;
+ }
+
+ public void setAvailableDiscSpace(int space) {
+ availableDiscSpace = space;
+ }
+
+ public int getPreselectedLanguages() {
+ return preselectedLanguages;
+ }
+
+ public void setPreselectedLanguages(int count) {
+ preselectedLanguages = count;
+ }
+
+ public String getAdminFileNameReloc() {
+ return adminFileNameReloc;
+ }
+
+ public void setAdminFileNameReloc(String fileName) {
+ adminFileNameReloc = fileName;
+ }
+
+ public String getAdminFileNameRelocNoDepends() {
+ return adminFileNameRelocNoDepends;
+ }
+
+ public void setAdminFileNameRelocNoDepends(String fileName) {
+ adminFileNameRelocNoDepends = fileName;
+ }
+
+ public String getAdminFileNameNoReloc() {
+ return adminFileNameNoReloc;
+ }
+
+ public void setAdminFileNameNoReloc(String fileName) {
+ adminFileNameNoReloc = fileName;
+ }
+
+ public String getAdminFileNameNoRelocNoDepends() {
+ return adminFileNameNoRelocNoDepends;
+ }
+
+ public void setAdminFileNameNoRelocNoDepends(String fileName) {
+ adminFileNameNoRelocNoDepends = fileName;
+ }
+
+ public String getGetUidPath() {
+ return getUidPath;
+ }
+
+ public void setGetUidPath(String filePath) {
+ getUidPath = filePath;
+ }
+
+ public String getStoredInstallationPrivileges() {
+ return storedInstallationPrivileges;
+ }
+
+ public void setStoredInstallationPrivileges(String privileges) {
+ storedInstallationPrivileges = privileges;
+ }
+
+ public void setStillRunning(boolean running) {
+ stillRunning = running;
+ }
+
+ public boolean stillRunning() {
+ return stillRunning;
+ }
+
+ public void setStillAnalyzing(boolean running) {
+ stillAnalyzing = running;
+ }
+
+ public boolean stillAnalyzing() {
+ return stillAnalyzing;
+ }
+
+ public void setDatabaseAnalyzed(boolean analyzed) {
+ databaseAnalyzed = analyzed;
+ }
+
+ public boolean databaseAnalyzed() {
+ return databaseAnalyzed;
+ }
+
+ public void setModuleSizeSet(boolean set) {
+ moduleSizeSet = set;
+ }
+
+ public boolean moduleSizeSet() {
+ return moduleSizeSet;
+ }
+
+ public void setPreInstallDone(boolean done) {
+ preInstallDone = done;
+ }
+
+ public boolean preInstallDone() {
+ return preInstallDone;
+ }
+
+ public boolean isChangeInstallation() {
+ return isChangeInstallation;
+ }
+
+ public void setIsChangeInstallation(boolean changeInstallation) {
+ isChangeInstallation = changeInstallation;
+ }
+
+ public boolean isTypicalInstallation() {
+ return isTypicalInstallation;
+ }
+
+ public boolean isCustomInstallation() {
+ return isCustomInstallation;
+ }
+
+ public boolean isAbortedInstallation() {
+ return isAbortedInstallation;
+ }
+
+ public void setIsAbortedInstallation(boolean abortedInstallation) {
+ isAbortedInstallation = abortedInstallation;
+ }
+
+ public boolean isErrorInstallation() {
+ return isErrorInstallation;
+ }
+
+ public void setIsErrorInstallation(boolean errorInstallation) {
+ isErrorInstallation = errorInstallation;
+ }
+
+ public boolean isMultiLingual() {
+ return isMultiLingual;
+ }
+
+ public void setIsMultiLingual(boolean multiLingual) {
+ isMultiLingual = multiLingual;
+ }
+
+ public boolean logModuleStates() {
+ return logModuleStates;
+ }
+
+ public void setLogModuleStates(boolean log) {
+ logModuleStates = log;
+ }
+
+ public boolean visibleModulesChecked() {
+ return visibleModulesChecked;
+ }
+
+ public void setVisibleModulesChecked(boolean checked) {
+ visibleModulesChecked = checked;
+ }
+
+ public boolean languageModulesChecked() {
+ return languageModulesChecked;
+ }
+
+ public void setLanguageModulesChecked(boolean checked) {
+ languageModulesChecked = checked;
+ }
+
+ public boolean applicationModulesChecked() {
+ return applicationModulesChecked;
+ }
+
+ public void setApplicationModulesChecked(boolean checked) {
+ applicationModulesChecked = checked;
+ }
+
+ public boolean isMaskedCompleteUninstallation() {
+ return isMaskedCompleteUninstallation;
+ }
+
+ public void setMaskedCompleteUninstallation(boolean masked) {
+ isMaskedCompleteUninstallation = masked;
+ }
+
+ public boolean typicalSelectionStateSaved() {
+ return typicalSelectionStateSaved;
+ }
+
+ public void setTypicalSelectionStateSaved(boolean saved) {
+ typicalSelectionStateSaved = saved;
+ }
+
+ public boolean customSelectionStateSaved() {
+ return customSelectionStateSaved;
+ }
+
+ public void setCustomSelectionStateSaved(boolean saved) {
+ customSelectionStateSaved = saved;
+ }
+
+ public boolean startSelectionStateSaved() {
+ return startSelectionStateSaved;
+ }
+
+ public void setStartSelectionStateSaved(boolean saved) {
+ startSelectionStateSaved = saved;
+ }
+
+ public boolean olderVersionExists() {
+ return olderVersionExists;
+ }
+
+ public void setOlderVersionExists(boolean exists) {
+ olderVersionExists = exists;
+ }
+
+ public boolean isMajorUpgrade() {
+ return majorUpgrade;
+ }
+
+ public void setMajorUpgrade(boolean upgrade) {
+ majorUpgrade = upgrade;
+ }
+
+ public boolean sameVersionExists() {
+ return sameVersionExists;
+ }
+
+ public void setSameVersionExists(boolean exists) {
+ sameVersionExists = exists;
+ }
+
+ public boolean newerVersionExists() {
+ return newerVersionExists;
+ }
+
+ public void setNewerVersionExists(boolean exists) {
+ newerVersionExists = exists;
+ }
+
+ public boolean dontUpdate() {
+ return dontUpdate;
+ }
+
+ public void setDontUpdate(boolean value) {
+ dontUpdate = value;
+ }
+
+ public boolean hideEula() {
+ return hideEula;
+ }
+
+ public void setHideEula(boolean value) {
+ hideEula = value;
+ }
+
+ public boolean installedProductMinorSet() {
+ return installedProductMinorSet;
+ }
+
+ public void setInstalledProductMinorSet(boolean value) {
+ installedProductMinorSet = value;
+ }
+
+ public boolean databaseQueried() {
+ return databaseQueried;
+ }
+
+ public void setDatabaseQueried(boolean value) {
+ databaseQueried = value;
+ }
+
+ public PackageDescription getUpdatePackage() {
+ return updatePackage;
+ }
+
+ public void setUpdatePackage(PackageDescription onePackage) {
+ updatePackage = onePackage;
+ }
+
+ public HashMap getShellEnvironment() {
+ return shellEnvironment;
+ }
+
+ public HashMap getDatabaseMap() {
+ return databaseMap;
+ }
+
+ public void setDatabaseMap(HashMap map) {
+ databaseMap = map;
+ }
+
+ public Vector getRemoveFiles() {
+ return removeFiles;
+ }
+
+ public Vector getInstallPackages() {
+ return installPackages;
+ }
+
+ public void setInstallPackages(Vector packages) {
+ installPackages = packages;
+ }
+
+ public Vector getOldPackages() {
+ return oldPackages;
+ }
+
+ public void setOldPackages(Vector packages) {
+ oldPackages = packages;
+ }
+
+ public Vector getSystemLanguages() {
+ return systemLanguages;
+ }
+
+ public void setSystemLanguages(Vector languages) {
+ systemLanguages = languages;
+ }
+
+ public void setShellEnvironment(HashMap environment) {
+ shellEnvironment = environment;
+ }
+
+ public File getJarFilePath() {
+ if ( jarFilePath == null ) {
+ jarFilePath = SystemManager.getJarFilePath();
+ }
+ return jarFilePath;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/Installer.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/Installer.java
new file mode 100755
index 000000000000..43ae1a369bd3
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/Installer.java
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Installer;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.SetupData.PackageDescription;
+
+public abstract class Installer {
+
+ public Installer() {
+ }
+
+ public void preInstall(PackageDescription packageData) {
+ }
+
+ public void postInstall(PackageDescription packageData) {
+ }
+
+ public void preUninstall(PackageDescription packageData) {
+ }
+
+ public void postUninstall(PackageDescription packageData) {
+ }
+
+ public void preInstallationOngoing () {
+ }
+
+ public void postInstallationOngoing () {
+ }
+
+ public void postUninstallationOngoing () {
+ }
+
+ public void defineDatabasePath() {
+ }
+
+ public String getChangeInstallDir(PackageDescription packageData) {
+ return null;
+ }
+
+ public boolean isPackageNameInstalled(String packageName, InstallData installData) {
+ return false;
+ }
+
+ public abstract void installPackage(PackageDescription packageData);
+
+ public abstract void uninstallPackage(PackageDescription packageData);
+
+ public abstract boolean isPackageInstalled(PackageDescription packageData, InstallData installData);
+
+ public abstract boolean isInstalledPackageOlder(PackageDescription packageData, InstallData installData);
+
+ public abstract boolean isInstallSetPackageOlder(PackageDescription packageData, InstallData installData);
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/InstallerFactory.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/InstallerFactory.java
new file mode 100755
index 000000000000..04e2cf2b4808
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/InstallerFactory.java
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Installer;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.Util.Informer;
+
+public class InstallerFactory
+{
+ private static Installer instance = null;
+
+ private InstallerFactory() {
+ }
+
+ public static Installer getInstance()
+ {
+ if (instance == null) {
+ instance = createInstaller();
+ }
+ return instance;
+ }
+
+ private static Installer createInstaller() {
+
+ InstallData data = InstallData.getInstance();
+ if ( data.getOSType().equalsIgnoreCase("Linux")) {
+ instance = new LinuxInstaller();
+ } else if ( data.getOSType().equalsIgnoreCase("SunOS")) {
+ instance = new SolarisInstaller();
+ } else {
+ System.err.println("Error: No installer for this OS defined!");
+ String message = ResourceManager.getString("String_InstallerFactory_Os_Not_Supported");
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+ System.exit(1);
+ }
+
+ return instance;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java
new file mode 100755
index 000000000000..fa1ce919245c
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java
@@ -0,0 +1,719 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Installer;
+
+import java.io.File;
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.InstallerHelper.LinuxHelper;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.SetupData.ProductDescription;
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import org.openoffice.setup.Util.ExecuteProcess;
+import org.openoffice.setup.Util.Informer;
+import org.openoffice.setup.Util.LogManager;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Vector;
+
+public class LinuxInstaller extends Installer {
+
+ LinuxHelper helper = new LinuxHelper();
+
+ public LinuxInstaller() {
+ super();
+ }
+
+ public void preInstall(PackageDescription packageData) {
+ InstallData installData = InstallData.getInstance();
+ // Collecting package names
+ helper.getLinuxPackageNamesFromRpmquery(packageData, installData);
+ helper.getLinuxFileInfo(packageData);
+ // Dumper.dumpAllRpmInfo(packageData);
+ }
+
+ public void postInstall(PackageDescription packageData) {
+ InstallData data = InstallData.getInstance();
+
+ if ( ! data.isAbortedInstallation() ) {
+ data.setStillRunning(true);
+ // Collecting information about installed packages
+ // Creating a list containing pairs of package names and rpm file names
+ // that has to be used during uninstallation.
+ helper.createPackageNameFileAtPostinstall(data, packageData);
+ helper.saveModulesLogFile(data);
+ data.setStillRunning(false);
+ }
+ }
+
+ public void preUninstall(PackageDescription packageData) {
+ // Collecting information about installed packages
+ HashMap packageNames = helper.readPackageNamesFile();
+ helper.setFullPackageNameAtUninstall(packageData, packageNames);
+ helper.getLinuxFileInfo(packageData);
+ // Dumper.dumpAllRpmInfo(packageData);
+ }
+
+ public void defineDatabasePath() {
+
+ InstallData data = InstallData.getInstance();
+ String oldDatabasePath = data.getDatabasePath();
+ data.setDatabasePath(null);
+
+ // Determining the database path (only for user installation).
+ // Important if a user installation is done into an existing
+ // user installation -> this methode can only be called after
+ // determination of installation directory.
+
+ if ( data.isUserInstallation() ) {
+ String databasePath = helper.getLinuxDatabasePath(data); // the file does not need to exist!
+ data.setDatabasePath(databasePath);
+
+ // If this is a new path to the database, then this database was
+ // not analyzed before (when going back in installation wizard)
+ if ( ! databasePath.equals(oldDatabasePath) ) {
+ data.setDatabaseAnalyzed(false);
+ data.setDatabaseQueried(false);
+ }
+ }
+ }
+
+ public String getChangeInstallDir(PackageDescription packageData) {
+ String installDir = null;
+ InstallData installData = InstallData.getInstance();
+
+ String packageName = packageData.getPkgRealName();
+
+ if ( packageName != null ) {
+ String rpmCommand = "rpm -q --queryformat %{INSTALLPREFIX} " + packageName;
+ String[] rpmCommandArray = new String[5];
+ rpmCommandArray[0] = "rpm";
+ rpmCommandArray[1] = "-q";
+ rpmCommandArray[2] = "--queryformat";
+ rpmCommandArray[3] = "%{INSTALLPREFIX}";
+ rpmCommandArray[4] = packageName;
+
+ Vector returnVector = new Vector();
+ Vector returnErrorVector = new Vector();
+ int returnValue = ExecuteProcess.executeProcessReturnVector(rpmCommandArray, returnVector, returnErrorVector);
+ String returnString = (String) returnVector.get(0);
+ returnString = returnString.replaceAll("//","/");
+
+ String log = rpmCommand + "<br><b>Returns: " + returnString + "</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+
+ installDir = returnString;
+ }
+
+ return installDir;
+ }
+
+ public void installPackage(PackageDescription packageData) {
+ // get ProductDescription for logging mechanism
+ ProductDescription productData = SetupDataProvider.getProductDescription();
+ InstallData data = InstallData.getInstance();
+
+ // String log = "<br><b>Package: " + packageData.getName() + "</b>";
+ // LogManager.addCommandsLogfileComment(log);
+ String log = "";
+
+ // setting installDir
+ String installDir = data.getInstallDir();
+ String packagePath = data.getPackagePath();
+
+ if (( packageData.getPkgSubdir() != null ) && ( ! packageData.getPkgSubdir().equals("") )) {
+ File completePackageFile = new File(packagePath, packageData.getPkgSubdir());
+ packagePath = completePackageFile.getPath();
+ }
+
+ String packageName = packageData.getPackageName();
+
+ if (( packageName.equals("")) || ( packageName == null )) {
+ log = "<b>No package name specified. Nothing to do</b>";
+ LogManager.addCommandsLogfileComment(log);
+ } else {
+ log = "<b>Package Name: " + packageName + "</b>";
+ LogManager.addCommandsLogfileComment(log);
+
+ File completePackage = new File(packagePath, packageName);
+ packageName = completePackage.getPath();
+ packageName = "\"" + packageName + "\""; // Quoting is necessary, if the path the the packages contains white spaces.
+
+ if ( completePackage.exists() ) {
+ String relocations = helper.getRelocationString(packageData, packageName);
+ if ( relocations != null ) {
+ // Problem: If Prefix = "/" the packages are not relocatable with RPM version 3.x .
+ // Therefore Prefix has to be "/opt" in spec file, although packages shall not be
+ // relocatable (except for installations with root privileges). So /opt has to be
+ // listed left and right of equal sign: --relocate /opt=<installDir>/opt
+ // -> /opt has to be added to the installDir
+ File localInstallDir = new File(installDir, relocations); // "/" -> "/opt"
+ String localInstallDirString = localInstallDir.getPath();
+
+ // Fixing problem with installation directory and RPM version 3.x
+ String fixedInstallDir = helper.fixInstallationDirectory(localInstallDirString);
+ relocations = relocations + "=" + fixedInstallDir;
+ // relocations: "/opt/staroffice8=" + fixedInstallDir;
+ }
+
+ // Some packages have to be installed with parameter "--force", if the link "/usr/bin/soffice"
+ // already exists. These pacakges return true with methode "useForce()".
+ boolean useForce = false;
+ if ( packageData.useForce() ) {
+ File sofficeLink = new File("/usr/bin/soffice");
+ if ( sofficeLink.exists() ) { useForce = true; }
+ }
+
+ String rpmCommand = "";
+ String[] rpmCommandArray;
+ String databasePath = null;
+ String databaseString = "";
+ boolean useLocalDatabase = false;
+
+ if ( data.isUserInstallation() ) {
+ databasePath = data.getDatabasePath();
+ if ( databasePath == null ) {
+ databasePath = helper.getLinuxDatabasePath(data);
+ data.setDatabasePath(databasePath);
+ }
+ }
+
+ if (( databasePath != null ) && (! databasePath.equalsIgnoreCase("null"))) {
+ databaseString = "--dbpath";
+ useLocalDatabase = true;
+ }
+
+ if (useForce) {
+ if (useLocalDatabase) {
+ if ( relocations != null ) {
+ rpmCommand = "rpm --upgrade --ignoresize --force -vh " +
+ "--relocate " + relocations + " " + databaseString +
+ " " + databasePath + " " + packageName;
+ rpmCommandArray = new String[10];
+ rpmCommandArray[0] = "rpm";
+ rpmCommandArray[1] = "--upgrade";
+ rpmCommandArray[2] = "--ignoresize";
+ rpmCommandArray[3] = "--force";
+ rpmCommandArray[4] = "-vh";
+ rpmCommandArray[5] = "--relocate";
+ rpmCommandArray[6] = relocations;
+ rpmCommandArray[7] = databaseString;
+ rpmCommandArray[8] = databasePath;
+ rpmCommandArray[9] = packageName;
+ } else {
+ rpmCommand = "rpm --upgrade --ignoresize --force -vh " +
+ databaseString + " " + databasePath + " " + packageName;
+ rpmCommandArray = new String[8];
+ rpmCommandArray[0] = "rpm";
+ rpmCommandArray[1] = "--upgrade";
+ rpmCommandArray[2] = "--ignoresize";
+ rpmCommandArray[3] = "--force";
+ rpmCommandArray[4] = "-vh";
+ rpmCommandArray[5] = databaseString;
+ rpmCommandArray[6] = databasePath;
+ rpmCommandArray[7] = packageName;
+ }
+ } else {
+ if ( relocations != null )
+ {
+ rpmCommand = "rpm --upgrade --ignoresize --force -vh " +
+ "--relocate " + relocations + " " + packageName;
+ rpmCommandArray = new String[8];
+ rpmCommandArray[0] = "rpm";
+ rpmCommandArray[1] = "--upgrade";
+ rpmCommandArray[2] = "--ignoresize";
+ rpmCommandArray[3] = "--force";
+ rpmCommandArray[4] = "-vh";
+ rpmCommandArray[5] = "--relocate";
+ rpmCommandArray[6] = relocations;
+ rpmCommandArray[7] = packageName;
+ } else {
+ rpmCommand = "rpm --upgrade --ignoresize --force -vh " + packageName;
+ rpmCommandArray = new String[6];
+ rpmCommandArray[0] = "rpm";
+ rpmCommandArray[1] = "--upgrade";
+ rpmCommandArray[2] = "--ignoresize";
+ rpmCommandArray[3] = "--force";
+ rpmCommandArray[4] = "-vh";
+ rpmCommandArray[5] = packageName;
+ }
+ }
+ } else {
+ if (useLocalDatabase) {
+ if ( relocations != null ) {
+ rpmCommand = "rpm --upgrade --ignoresize -vh " +
+ "--relocate " + relocations + " " + databaseString +
+ " " + databasePath + " " + packageName;
+ rpmCommandArray = new String[9];
+ rpmCommandArray[0] = "rpm";
+ rpmCommandArray[1] = "--upgrade";
+ rpmCommandArray[2] = "--ignoresize";
+ rpmCommandArray[3] = "-vh";
+ rpmCommandArray[4] = "--relocate";
+ rpmCommandArray[5] = relocations;
+ rpmCommandArray[6] = databaseString;
+ rpmCommandArray[7] = databasePath;
+ rpmCommandArray[8] = packageName;
+ } else {
+ rpmCommand = "rpm --upgrade --ignoresize -vh " +
+ databaseString + " " + databasePath + " " + packageName;
+ rpmCommandArray = new String[7];
+ rpmCommandArray[0] = "rpm";
+ rpmCommandArray[1] = "--upgrade";
+ rpmCommandArray[2] = "--ignoresize";
+ rpmCommandArray[3] = "-vh";
+ rpmCommandArray[4] = databaseString;
+ rpmCommandArray[5] = databasePath;
+ rpmCommandArray[6] = packageName;
+ }
+ } else {
+ if ( relocations != null )
+ {
+ rpmCommand = "rpm --upgrade --ignoresize -vh " +
+ "--relocate " + relocations + " " + packageName;
+ rpmCommandArray = new String[7];
+ rpmCommandArray[0] = "rpm";
+ rpmCommandArray[1] = "--upgrade";
+ rpmCommandArray[2] = "--ignoresize";
+ rpmCommandArray[3] = "-vh";
+ rpmCommandArray[4] = "--relocate";
+ rpmCommandArray[5] = relocations;
+ rpmCommandArray[6] = packageName;
+ } else {
+ rpmCommand = "rpm --upgrade --ignoresize -vh " + packageName;
+ rpmCommandArray = new String[5];
+ rpmCommandArray[0] = "rpm";
+ rpmCommandArray[1] = "--upgrade";
+ rpmCommandArray[2] = "--ignoresize";
+ rpmCommandArray[3] = "-vh";
+ rpmCommandArray[4] = packageName;
+ }
+ }
+ }
+
+ Vector returnVector = new Vector();
+ Vector returnErrorVector = new Vector();
+ // int returnValue = SystemManager.executeProcessReturnVector(rpmCommand, returnVector, returnErrorVector);
+ int returnValue = ExecuteProcess.executeProcessReturnVector(rpmCommandArray, returnVector, returnErrorVector);
+
+ if ( returnValue == 0 ) {
+ log = rpmCommand + "<br><b>Returns: " + returnValue + " Successful installation</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ } else { // an error occured during installation
+ if ( packageData.installCanFail() ) {
+ log = rpmCommand + "<br><b>Returns: " + returnValue + " Problem during installation. Can be ignored.</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ } else {
+ log = rpmCommand + "<br><b>Returns: " + returnValue + " Error during installation</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ for (int i = 0; i < returnErrorVector.size(); i++) {
+ LogManager.addCommandsLogfileComment((String)returnErrorVector.get(i));
+ }
+ data.setIsErrorInstallation(true);
+ }
+ }
+
+ // saving installation state at package
+ packageData.setIsNewInstalled(true);
+ } else {
+ log = "<b>Error: Did not find package " + packageName + "</b><br>";
+ System.err.println(log);
+ String message = ResourceManager.getString("String_File_Not_Found") + ": " + packageName;
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+ LogManager.addCommandsLogfileComment(log);
+ data.setIsErrorInstallation(true);
+ }
+ }
+ }
+
+ public void uninstallPackage(PackageDescription packageData) {
+ // get ProductDescription for logging mechanism
+ ProductDescription productData = SetupDataProvider.getProductDescription();
+ InstallData data = InstallData.getInstance();
+
+ String log = "";
+ // String log = "<br><b>Package: " + packageData.getName() + "</b>";
+ // LogManager.addCommandsLogfileComment(log);
+
+ String rpmPackageName = packageData.getPackageName();
+
+ if (( rpmPackageName.equals("")) || ( rpmPackageName == null )) {
+ log = "<b>No package name specified. Nothing to do</b>";
+ LogManager.addCommandsLogfileComment(log);
+ } else {
+ log = "<b>Package Name: " + rpmPackageName + "</b>";
+ LogManager.addCommandsLogfileComment(log);
+
+ String packageName = packageData.getPkgRealName();
+ String databasePath = data.getDatabasePath();
+ String databaseString = "";
+ boolean useLocalDatabase = false;
+ String rpmCommand;
+ String[] rpmCommandArray;
+
+ if (( databasePath != null ) && (! databasePath.equalsIgnoreCase("null"))) {
+ databaseString = "--dbpath";
+ useLocalDatabase = true;
+ }
+
+ if (useLocalDatabase) {
+ rpmCommand = "rpm -ev" + " " + databaseString + " " + databasePath + " " + packageName;
+ rpmCommandArray = new String[5];
+ rpmCommandArray[0] = "rpm";
+ rpmCommandArray[1] = "-ev";
+ rpmCommandArray[2] = databaseString;
+ rpmCommandArray[3] = databasePath;
+ rpmCommandArray[4] = packageName;
+ } else {
+ rpmCommand = "rpm -ev" + " " + packageName;
+ rpmCommandArray = new String[3];
+ rpmCommandArray[0] = "rpm";
+ rpmCommandArray[1] = "-ev";
+ rpmCommandArray[2] = packageName;
+ }
+
+ Vector returnVector = new Vector();
+ Vector returnErrorVector = new Vector();
+ int returnValue = ExecuteProcess.executeProcessReturnVector(rpmCommandArray, returnVector, returnErrorVector);
+
+ if ( returnValue == 0 ) {
+ log = rpmCommand + "<br><b>Returns: " + returnValue + " Successful uninstallation</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ } else { // an error occured during installation
+ if ( packageData.uninstallCanFail() ) {
+ log = rpmCommand + "<br><b>Returns: " + returnValue + " Problem during uninstallation. Can be ignored.</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ } else {
+ log = rpmCommand + "<br><b>Returns: " + returnValue + " Error during uninstallation</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ for (int i = 0; i < returnErrorVector.size(); i++) {
+ LogManager.addCommandsLogfileComment((String)returnErrorVector.get(i));
+ }
+ data.setIsErrorInstallation(true);
+ }
+ }
+ }
+ }
+
+ public boolean isPackageInstalledClassic(PackageDescription packageData, InstallData installData) {
+
+ boolean isInstalled = false;
+ boolean doCheck = false;
+
+ // only checking existing packages (and always at uninstallation)
+ if ( (packageData.pkgExists()) || (installData.isUninstallationMode()) ) {
+ doCheck = true;
+ }
+
+ String rpmPackageName = packageData.getPackageName();
+
+ if ( rpmPackageName.equals("") ) {
+ rpmPackageName = null;
+ }
+
+ if (( rpmPackageName != null ) && ( doCheck )) {
+
+ String databaseString = "";
+ String databasePath = null;
+ String packageName = packageData.getPkgRealName();
+ Vector allPackages = null;
+ boolean useLocalDatabase = false;
+
+ if (installData.isUserInstallation()) {
+ databasePath = installData.getDatabasePath();
+ }
+
+ if (( databasePath != null ) && (! databasePath.equals("null"))) {
+ databaseString = "--dbpath";
+ useLocalDatabase = true;
+ }
+
+ if (packageName != null) {
+
+ String rpmCommand;
+ String[] rpmCommandArray;
+
+ if (useLocalDatabase) {
+ rpmCommand = "rpm" + " " + databaseString + " " + databasePath + " --query " + packageName;
+ rpmCommandArray = new String[5];
+ rpmCommandArray[0] = "rpm";
+ rpmCommandArray[1] = databaseString;
+ rpmCommandArray[2] = databasePath;
+ rpmCommandArray[3] = "--query";
+ rpmCommandArray[4] = packageName;
+ } else {
+ rpmCommand = "rpm" + " --query " + packageName;
+ rpmCommandArray = new String[3];
+ rpmCommandArray[0] = "rpm";
+ rpmCommandArray[1] = "--query";
+ rpmCommandArray[2] = packageName;
+ }
+
+ int returnValue = ExecuteProcess.executeProcessReturnValue(rpmCommandArray);
+
+ if ( returnValue == 0 ) {
+ isInstalled = true;
+ packageData.setWasAlreadyInstalled(true); // needed for logging
+ String log = rpmCommand + "<br><b>Returns: " + returnValue + " Package is installed" + "</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ } else {
+ String log = rpmCommand + "<br><b>Returns: " + returnValue + " Package is not installed" + "</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ }
+ }
+ }
+
+ return isInstalled;
+ }
+
+ private void queryAllDatabase(InstallData installData) {
+
+ String databaseString = "";
+ String databasePath = null;
+ HashMap map = new HashMap();;
+ boolean useLocalDatabase = false;
+
+ if (installData.isUserInstallation()) {
+ databasePath = installData.getDatabasePath();
+ }
+
+ if (( databasePath != null ) && (! databasePath.equals("null"))) {
+ databaseString = "--dbpath";
+ useLocalDatabase = true;
+ }
+
+ String rpmCommand;
+ String[] rpmCommandArray;
+
+ if (useLocalDatabase) {
+ rpmCommand = "rpm" + " " + databaseString + " " + databasePath + " --query" + " -a";
+ rpmCommandArray = new String[5];
+ rpmCommandArray[0] = "rpm";
+ rpmCommandArray[1] = databaseString;
+ rpmCommandArray[2] = databasePath;
+ rpmCommandArray[3] = "--query";
+ rpmCommandArray[4] = "-a";
+ } else {
+ rpmCommand = "rpm" + " --query" + " -a";
+ rpmCommandArray = new String[3];
+ rpmCommandArray[0] = "rpm";
+ rpmCommandArray[1] = "--query";
+ rpmCommandArray[2] = "-a";
+ }
+
+ Vector returnVector = new Vector();
+ Vector returnErrorVector = new Vector();
+ int returnValue = ExecuteProcess.executeProcessReturnVector(rpmCommandArray, returnVector, returnErrorVector);
+
+ String log = rpmCommand + "<br><b>Returns: " + returnValue + "</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ String value = "1";
+
+ if ( ! returnVector.isEmpty()) {
+ for (int i = 0; i < returnVector.size(); i++) {
+ String onePackage = (String)returnVector.get(i);
+ int pos1 = onePackage.lastIndexOf("-");
+ int pos2 = onePackage.substring(0, pos1).lastIndexOf("-");
+ String key = onePackage.substring(0, pos2);
+ map.put(key, value);
+ }
+ }
+
+ installData.setDatabaseQueried(true);
+ installData.setDatabaseMap(map);
+ }
+
+ public boolean isPackageInstalled(PackageDescription packageData, InstallData installData) {
+
+ boolean isInstalled = false;
+ boolean doCheck = false;
+
+ // only checking existing packages (and always at uninstallation)
+ if ( (packageData.pkgExists()) || (installData.isUninstallationMode()) ) {
+ doCheck = true;
+ }
+
+ String rpmPackageName = packageData.getPackageName();
+
+ if ( rpmPackageName.equals("") ) {
+ rpmPackageName = null;
+ }
+
+ if (( rpmPackageName != null ) && ( doCheck )) {
+ String packageName = packageData.getPkgRealName();
+
+ if (packageName != null) {
+
+ HashMap map = null;
+ if ( ! installData.databaseQueried() ) {
+ queryAllDatabase(installData);
+ }
+
+ map = installData.getDatabaseMap();
+
+ if ( map.containsKey(packageName)) {
+ isInstalled = true;
+ }
+ } else {
+ System.err.println("Error: No packageName defined for package: " + packageData.getPackageName());
+ }
+ }
+
+ return isInstalled;
+ }
+
+ public boolean isInstallSetPackageOlder(PackageDescription packageData, InstallData installData) {
+ boolean installSetPackageIsOlder = false;
+ boolean checkIfInstalledIsOlder = false;
+ installSetPackageIsOlder = findOlderPackage(packageData, installData, checkIfInstalledIsOlder);
+ return installSetPackageIsOlder;
+ }
+
+ public boolean isInstalledPackageOlder(PackageDescription packageData, InstallData installData) {
+ boolean installedPackageIsOlder = false;
+ boolean checkIfInstalledIsOlder = true;
+ installedPackageIsOlder = findOlderPackage(packageData, installData, checkIfInstalledIsOlder);
+ return installedPackageIsOlder;
+ }
+
+ private boolean findOlderPackage(PackageDescription packageData, InstallData installData, boolean checkIfInstalledIsOlder) {
+
+ // The information about the new package is stored in packageData (the version and the release).
+ // This information can be stored in xpd files. If it is not stored in xpd files, it is determined
+ // during installation process by querying the rpm file. This process costs much time and should
+ // therefore be done by the process, that creates the xpd files. On the other hand this requires,
+ // that the xpd files contain the correct information.
+
+ boolean isOlder = false;
+
+ // get the version of the installed package
+ String rpmPackageName = packageData.getPackageName();
+ String log;
+
+ if ( rpmPackageName.equals("")) {
+ rpmPackageName = null;
+ }
+
+ if ( rpmPackageName != null ) {
+ String databaseString = "";
+ String databasePath = null;
+ String packageName = packageData.getPkgRealName();
+ Vector allPackages = null;
+ boolean useLocalDatabase = false;
+
+ if (installData.isUserInstallation()) {
+ databasePath = installData.getDatabasePath();
+ }
+
+ if (( databasePath != null ) && (! databasePath.equals("null"))) {
+ databaseString = "--dbpath";
+ useLocalDatabase = true;
+ }
+
+ if (packageName != null) {
+ // Collect information about the installed package by querying the database.
+ // Instead of rpm file name, the real package name has to be used.
+
+ String rpmCommand;
+ String[] rpmCommandArray;
+
+ if (useLocalDatabase) {
+ rpmCommand = "rpm" + " " + databaseString + " " + databasePath + " -q --queryformat %{VERSION}\\n " + packageName;
+ rpmCommandArray = new String[7];
+ rpmCommandArray[0] = "rpm";
+ rpmCommandArray[1] = databaseString;
+ rpmCommandArray[2] = databasePath;
+ rpmCommandArray[3] = "-q";
+ rpmCommandArray[4] = "--queryformat";
+ rpmCommandArray[5] = "%{VERSION}\\n";
+ rpmCommandArray[6] = packageName;
+ } else {
+ rpmCommand = "rpm" + " -q --queryformat %{VERSION}\\n " + packageName;
+ rpmCommandArray = new String[5];
+ rpmCommandArray[0] = "rpm";
+ rpmCommandArray[1] = "-q";
+ rpmCommandArray[2] = "--queryformat";
+ rpmCommandArray[3] = "%{VERSION}\\n";
+ rpmCommandArray[4] = packageName;
+ }
+
+ Vector versionVector = new Vector();
+ Vector returnErrorVector = new Vector();
+ int returnValue = ExecuteProcess.executeProcessReturnVector(rpmCommandArray, versionVector, returnErrorVector);
+ String version = (String) versionVector.lastElement();
+ log = rpmCommand + "<br><b>Returns: " + version + "</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+
+ if ( ! installData.installedProductMinorSet() ) {
+ int productMinor = helper.getInstalledMinor(version);
+ installData.setInstalledProductMinor(productMinor);
+ installData.setInstalledProductMinorSet(true);
+ }
+
+ if (useLocalDatabase) {
+ rpmCommand = "rpm" + " " + databaseString + " " + databasePath + " -q --queryformat %{RELEASE}\\n " + packageName;
+ rpmCommandArray[5] = "%{RELEASE}\\n";
+ } else {
+ rpmCommand = "rpm" + " -q --queryformat %{RELEASE}\\n " + packageName;
+ rpmCommandArray[3] = "%{RELEASE}\\n";
+ }
+
+ Vector releaseVector = new Vector();
+ returnValue = ExecuteProcess.executeProcessReturnVector(rpmCommandArray, releaseVector, returnErrorVector);
+ String release = (String) releaseVector.lastElement();
+
+ log = rpmCommand + "<br><b>Returns: " + release + "</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+
+ isOlder = helper.compareVersionAndRelease(version, release, packageData, checkIfInstalledIsOlder);
+
+ if ( checkIfInstalledIsOlder ) {
+ if ( isOlder ) {
+ LogManager.addCommandsLogfileComment("<b>-> Installed package is older</b><br>");
+ } else {
+ LogManager.addCommandsLogfileComment("<b>-> Installed package is not older</b><br>");
+ }
+ } else {
+ if ( isOlder ) {
+ LogManager.addCommandsLogfileComment("<b>-> Package in installation set is older</b><br>");
+ } else {
+ LogManager.addCommandsLogfileComment("<b>-> Package in installation set is not older</b><br>");
+ }
+ }
+
+ } else {
+ System.err.println("Error: No packageName defined for package: " + rpmPackageName);
+ }
+ }
+
+ return isOlder;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/SolarisInstaller.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/SolarisInstaller.java
new file mode 100755
index 000000000000..7aacc5557fa6
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/SolarisInstaller.java
@@ -0,0 +1,574 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Installer;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.InstallerHelper.SolarisHelper;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.Util.Converter;
+import org.openoffice.setup.Util.ExecuteProcess;
+import org.openoffice.setup.Util.Informer;
+import org.openoffice.setup.Util.LogManager;
+import org.openoffice.setup.Util.SystemManager;
+import java.io.File;
+import java.util.HashMap;
+import java.util.Vector;
+
+public class SolarisInstaller extends Installer {
+
+ SolarisHelper helper = new SolarisHelper();
+
+ public SolarisInstaller() {
+ super();
+ }
+
+ public void defineDatabasePath() {
+
+ InstallData data = InstallData.getInstance();
+ String oldDatabasePath = data.getDatabasePath();
+ data.setDatabasePath(null);
+
+ // Determining the database path (only for user installation).
+ // Important if a user installation is done into an existing
+ // user installation -> this methode can only be called after
+ // determination of installation directory.
+
+ if ( data.isUserInstallation() ) {
+ String databasePath = helper.getSolarisDatabasePath(data); // the file does not need to exist!
+ data.setDatabasePath(databasePath);
+
+ // If this is a new path to the database, then this database was
+ // not analyzed before (when going back in installation wizard)
+ if ( ! databasePath.equals(oldDatabasePath) ) {
+ data.setDatabaseAnalyzed(false);
+ data.setDatabaseQueried(false);
+ }
+ }
+ }
+
+ public void preInstallationOngoing() {
+ // an admin file has to be created for user and for root installation
+ InstallData data = InstallData.getInstance();
+
+ if ( data.isInstallationMode()) {
+ boolean makeRelocatableAdminFile = true;
+ boolean removeDepends = true;
+ helper.createAdminFile(makeRelocatableAdminFile, removeDepends);
+ helper.createAdminFile(makeRelocatableAdminFile, ! removeDepends);
+ helper.createAdminFile(! makeRelocatableAdminFile, removeDepends);
+ helper.createAdminFile(! makeRelocatableAdminFile, ! removeDepends);
+ }
+
+ if ( data.isUserInstallation() ) {
+ // LD_PRELOAD_32 needs to be set for user installation
+ helper.setEnvironmentForUserInstall();
+ // Solaris 10 needs to have local temp directory for pkgadd
+ // createLocalTempDir();
+ }
+ }
+
+ public void postInstallationOngoing() {
+ InstallData data = InstallData.getInstance();
+ // if ( data.isUserInstallation() ) {
+ // Solaris 10 needs to have local temp directory for pkgadd
+ // removeLocalTempDir();
+ // }
+
+ helper.removeSolarisLockFile();
+ }
+
+ public void postInstall(PackageDescription packageData) {
+ InstallData data = InstallData.getInstance();
+
+ if ( ! data.isAbortedInstallation() ) {
+ data.setStillRunning(true);
+ // Collecting information about installed packages
+ // Creating a list containing pairs of package names and rpm file names
+ // that has to be used during uninstallation.
+ helper.saveModulesLogFile(data);
+ data.setStillRunning(false);
+ }
+ }
+
+ public void postUninstallationOngoing() {
+ helper.removeSolarisLockFile();
+ }
+
+ public String getChangeInstallDir(PackageDescription packageData) {
+ String installDir = null;
+ String packageName = packageData.getPackageName();
+
+ if ( packageName != null ) {
+ String pkgCommand = "pkginfo -r" + " " + packageName;
+ String[] pkgCommandArray = new String[3];
+ pkgCommandArray[0] = "pkginfo";
+ pkgCommandArray[1] = "-r";
+ pkgCommandArray[2] = packageName;
+ Vector returnVector = new Vector();
+ Vector returnErrorVector = new Vector();
+ int returnValue = ExecuteProcess.executeProcessReturnVector(pkgCommandArray, returnVector, returnErrorVector);
+ String returnString = (String) returnVector.get(0);
+
+ String log = pkgCommand + "<br><b>Returns: " + returnString + "</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+
+ installDir = returnString;
+ }
+
+ return installDir;
+ }
+
+ public void installPackage(PackageDescription packageData) {
+ InstallData data = InstallData.getInstance();
+
+ String log = "<br><b>Package: " + packageData.getName() + "</b>";
+ LogManager.addCommandsLogfileComment(log);
+
+ String rootDir = data.getInstallDir();
+ String packagePath = data.getPackagePath();
+
+ if (( packageData.getPkgSubdir() != null ) && ( ! packageData.getPkgSubdir().equals("") )) {
+ File completePackageFile = new File(packagePath, packageData.getPkgSubdir());
+ packagePath = completePackageFile.getPath();
+ }
+
+ String packageName = packageData.getPackageName();
+
+ if (( packageName.equals("")) || ( packageName == null )) {
+ log = "<b>No package name specified. Nothing to do</b>";
+ LogManager.addCommandsLogfileComment(log);
+ } else {
+ log = "<b>Package Name: " + packageName + "</b>";
+ LogManager.addCommandsLogfileComment(log);
+
+ File completePackage = new File(packagePath, packageName);
+
+ if ( completePackage.exists() ) {
+
+ String pkgCommand = "";
+ String[] pkgCommandArray;
+ String adminFileName = "";
+ Vector returnVector = new Vector();
+ Vector returnErrorVector = new Vector();
+ int returnValue;
+
+ // is package relocatable or not?
+ if ( packageData.isRelocatable() ) {
+ adminFileName = data.getAdminFileNameReloc();
+ } else {
+ adminFileName = data.getAdminFileNameNoReloc();
+ }
+
+ if ( data.isUserInstallation() ) {
+ HashMap env = data.getShellEnvironment();
+ String[] envStringArray = Converter.convertHashmapToStringArray(env);
+ pkgCommand = "/usr/sbin/pkgadd -n -d " + packagePath + " -R " +
+ rootDir + " -a " + adminFileName + " " + packageName;
+ pkgCommandArray = new String[9];
+ pkgCommandArray[0] = "/usr/sbin/pkgadd";
+ pkgCommandArray[1] = "-n";
+ pkgCommandArray[2] = "-d";
+ pkgCommandArray[3] = packagePath;
+ pkgCommandArray[4] = "-R";
+ pkgCommandArray[5] = rootDir;
+ pkgCommandArray[6] = "-a";
+ pkgCommandArray[7] = adminFileName;
+ pkgCommandArray[8] = packageName;
+ returnValue = ExecuteProcess.executeProcessReturnVectorEnv(pkgCommandArray, envStringArray, returnVector, returnErrorVector);
+ } else {
+ // shifting of the installation root (-R) is only wanted for user installation
+ pkgCommand = "/usr/sbin/pkgadd -n -d " + packagePath +
+ " -a " + adminFileName + " " + packageName;
+ pkgCommandArray = new String[7];
+ pkgCommandArray[0] = "/usr/sbin/pkgadd";
+ pkgCommandArray[1] = "-n";
+ pkgCommandArray[2] = "-d";
+ pkgCommandArray[3] = packagePath;
+ pkgCommandArray[4] = "-a";
+ pkgCommandArray[5] = adminFileName;
+ pkgCommandArray[6] = packageName;
+ returnValue = ExecuteProcess.executeProcessReturnVector(pkgCommandArray, returnVector, returnErrorVector);
+ }
+
+ if ( returnValue == 0 ) {
+ log = pkgCommand + "<br><b>Returns: " + returnValue + " Successful installation</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ } else { // an error occured during installation
+ if ( packageData.installCanFail() ) {
+ log = pkgCommand + "<br><b>Returns: " + returnValue + " Problem during installation. Can be ignored.</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ } else {
+ log = pkgCommand + "<br><b>Returns: " + returnValue + " Error during installation</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ System.err.println("Error during installation:");
+ for (int i = 0; i < returnErrorVector.size(); i++) {
+ LogManager.addCommandsLogfileComment((String)returnErrorVector.get(i));
+ System.err.println(returnErrorVector.get(i));
+ }
+ data.setIsErrorInstallation(true);
+ }
+ }
+ }
+ else {
+ log = "<b>Error: Did not find package " + packageName + "</b><br>";
+ System.err.println(log);
+ String message = ResourceManager.getString("String_File_Not_Found") + ": " + packageName;
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+ LogManager.addCommandsLogfileComment(log);
+ data.setIsErrorInstallation(true);
+ }
+ }
+ }
+
+ public void uninstallPackage(PackageDescription packageData) {
+ InstallData data = InstallData.getInstance();
+
+ String log = "<br><b>Package: " + packageData.getName() + "</b>";
+ LogManager.addCommandsLogfileComment(log);
+
+ String installRoot = data.getInstallDir();
+ String packageName = packageData.getPackageName();
+ String adminFileName = "";
+
+ // is package relocatable or not?
+ if ( packageData.isRelocatable() ) {
+ if ( packageData.ignoreDependsForUninstall() ) { // Force removal of older packages during installation
+ adminFileName = data.getAdminFileNameRelocNoDepends();
+ } else {
+ adminFileName = data.getAdminFileNameReloc();
+ }
+ } else {
+ if ( packageData.ignoreDependsForUninstall() ) { // Force removal of older packages during installation
+ adminFileName = data.getAdminFileNameNoRelocNoDepends();
+ } else {
+ adminFileName = data.getAdminFileNameNoReloc();
+ }
+ }
+
+ String pkgCommand = "";
+ String[] pkgCommandArray;
+ int returnValue;
+ Vector returnVector = new Vector();
+ Vector returnErrorVector = new Vector();
+
+ if ( data.isUserInstallation() ) {
+ pkgCommand = "/usr/sbin/pkgrm -n " + "-R " + installRoot + " -a " + adminFileName + " " + packageName;
+ pkgCommandArray = new String[7];
+ pkgCommandArray[0] = "/usr/sbin/pkgrm";
+ pkgCommandArray[1] = "-n";
+ pkgCommandArray[2] = "-R";
+ pkgCommandArray[3] = installRoot;
+ pkgCommandArray[4] = "-a";
+ pkgCommandArray[5] = adminFileName;
+ pkgCommandArray[6] = packageName;
+ HashMap env = data.getShellEnvironment();
+ String[] envStringArray = Converter.convertHashmapToStringArray(env);
+ // SystemManager.dumpStringArray(envStringArray);
+ returnValue = ExecuteProcess.executeProcessReturnVectorEnv(pkgCommandArray, envStringArray, returnVector, returnErrorVector);
+ } else {
+ // shifting of the installation root (-R) is only wanted for user installation
+ pkgCommand = "/usr/sbin/pkgrm -n " + "-a " + adminFileName + " " + packageName;
+ pkgCommandArray = new String[5];
+ pkgCommandArray[0] = "/usr/sbin/pkgrm";
+ pkgCommandArray[1] = "-n";
+ pkgCommandArray[2] = "-a";
+ pkgCommandArray[3] = adminFileName;
+ pkgCommandArray[4] = packageName;
+ returnValue = ExecuteProcess.executeProcessReturnVector(pkgCommandArray, returnVector, returnErrorVector);
+ }
+
+ if ( returnValue == 0 ) {
+ log = pkgCommand + "<br><b>Returns: " + returnValue + " Successful uninstallation</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ } else { // an error occured during installation
+ if ( packageData.uninstallCanFail() ) {
+ log = pkgCommand + "<br><b>Returns: " + returnValue + " Problem during uninstallation. Can be ignored.</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ } else {
+ log = pkgCommand + "<br><b>Returns: " + returnValue + " Error during uninstallation</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ System.err.println("Error during uninstallation:");
+ for (int i = 0; i < returnErrorVector.size(); i++) {
+ LogManager.addCommandsLogfileComment((String)returnErrorVector.get(i));
+ System.err.println(returnErrorVector.get(i));
+ }
+ data.setIsErrorInstallation(true);
+ }
+ }
+ }
+
+ public boolean isPackageNameInstalledClassic(String packageName, InstallData installData) {
+ String rootString = "";
+ String rootPath = null;
+ String pkgCommand;
+ String[] pkgCommandArray;
+ boolean useLocalRoot = false;
+ boolean isInstalled = false;
+
+ if (installData.isUserInstallation()) {
+ rootPath = installData.getDatabasePath();
+ }
+
+ if (( rootPath != null ) && (! rootPath.equals("null"))) {
+ rootString = "-R";
+ useLocalRoot = true;
+ }
+
+ if (useLocalRoot) {
+ pkgCommand = "pkginfo " + rootString + " " + rootPath + " " + packageName;
+ pkgCommandArray = new String[4];
+ pkgCommandArray[0] = "pkginfo";
+ pkgCommandArray[1] = rootString;
+ pkgCommandArray[2] = rootPath;
+ pkgCommandArray[3] = packageName;
+ } else {
+ pkgCommand = "pkginfo " + packageName;
+ pkgCommandArray = new String[2];
+ pkgCommandArray[0] = "pkginfo";
+ pkgCommandArray[1] = packageName;
+ }
+
+ // Vector returnVector = new Vector();
+ int returnValue = ExecuteProcess.executeProcessReturnValue(pkgCommandArray);
+
+ if ( returnValue == 0 ) {
+ isInstalled = true;
+ String log = pkgCommand + "<br><b>Returns: " + returnValue + " Package is installed" + "</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ } else {
+ String log = pkgCommand + "<br><b>Returns: " + returnValue + " Package is not installed" + "</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ }
+
+ return isInstalled;
+ }
+
+ private void queryAllDatabase(InstallData installData) {
+
+ String rootString = "";
+ String rootPath = null;
+ String pkgCommand;
+ String[] pkgCommandArray;
+ boolean useLocalRoot = false;
+ HashMap map = new HashMap();;
+
+ if (installData.isUserInstallation()) {
+ rootPath = installData.getDatabasePath();
+ }
+
+ if (( rootPath != null ) && (! rootPath.equals("null"))) {
+ rootString = "-R";
+ useLocalRoot = true;
+ }
+
+ if (useLocalRoot) {
+ pkgCommand = "pkginfo " + rootString + " " + rootPath;
+ pkgCommandArray = new String[4];
+ pkgCommandArray[0] = "pkginfo";
+ pkgCommandArray[1] = "-x";
+ pkgCommandArray[2] = rootString;
+ pkgCommandArray[3] = rootPath;
+ } else {
+ pkgCommand = "pkginfo -x";
+ pkgCommandArray = new String[2];
+ pkgCommandArray[0] = "pkginfo";
+ pkgCommandArray[1] = "-x";
+ }
+
+ Vector returnVector = new Vector();
+ Vector returnErrorVector = new Vector();
+ int returnValue = ExecuteProcess.executeProcessReturnVector(pkgCommandArray, returnVector, returnErrorVector);
+
+ String log = pkgCommand + "<br><b>Returns: " + returnValue + "</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ String value = "1";
+
+ if ( ! returnVector.isEmpty()) {
+ for (int i = 0; i < returnVector.size(); i++) {
+ String onePackage = (String)returnVector.get(i);
+ int pos1 = onePackage.indexOf(" ");
+ String key = onePackage.substring(0, pos1);
+ map.put(key, value);
+ }
+ }
+
+ installData.setDatabaseQueried(true);
+ installData.setDatabaseMap(map);
+
+ }
+
+ public boolean isPackageNameInstalled(String packageName, InstallData installData) {
+
+ boolean isInstalled = false;
+
+ HashMap map = null;
+ if ( ! installData.databaseQueried() ) {
+ queryAllDatabase(installData);
+ }
+
+ map = installData.getDatabaseMap();
+
+ if ( map.containsKey(packageName)) {
+ isInstalled = true;
+ }
+
+ return isInstalled;
+ }
+
+ public boolean isPackageInstalled(PackageDescription packageData, InstallData installData) {
+ boolean isInstalled = false;
+
+ String packageName = packageData.getPackageName();
+
+ if ( packageName.equals("")) {
+ packageName = null;
+ }
+
+ if ( packageName != null ) {
+ isInstalled = isPackageNameInstalled(packageName, installData);
+ }
+
+ return isInstalled;
+ }
+
+ public boolean isInstallSetPackageOlder(PackageDescription packageData, InstallData installData) {
+ boolean installSetPackageIsOlder = false;
+ boolean checkIfInstalledIsOlder = false;
+ installSetPackageIsOlder = findOlderPackage(packageData, installData, checkIfInstalledIsOlder);
+ return installSetPackageIsOlder;
+ }
+
+ public boolean isInstalledPackageOlder(PackageDescription packageData, InstallData installData) {
+ boolean installedPackageIsOlder = false;
+ boolean checkIfInstalledIsOlder = true;
+ installedPackageIsOlder = findOlderPackage(packageData, installData, checkIfInstalledIsOlder);
+ return installedPackageIsOlder;
+ }
+
+ private boolean findOlderPackage(PackageDescription packageData, InstallData installData, boolean checkIfInstalledIsOlder) {
+
+ boolean firstPackageIsOlder = false;
+ String packageName = packageData.getPackageName();
+ String log;
+
+ if ( packageName.equals("")) {
+ packageName = null;
+ }
+
+ if ( packageName != null ) {
+ String rootString = "";
+ String rootPath = null;
+ String pkgCommand;
+ String[] pkgCommandArray;
+ boolean useLocalRoot = false;
+
+ if (installData.isUserInstallation()) {
+ rootPath = installData.getDatabasePath();
+ }
+
+ if (( rootPath != null ) && (! rootPath.equals("null"))) {
+ rootString = "-R";
+ useLocalRoot = true;
+ }
+
+ if (useLocalRoot) {
+ // String pkgCommand = "pkginfo -l" + rootString + " " + rootPath + " " + packageName + " | grep VERSION:";
+ pkgCommand = "pkginfo -x " + rootString + " " + rootPath + " " + packageName;
+ pkgCommandArray = new String[5];
+ pkgCommandArray[0] = "pkginfo";
+ pkgCommandArray[1] = "-x";
+ pkgCommandArray[2] = rootString;
+ pkgCommandArray[3] = rootPath;
+ pkgCommandArray[4] = packageName;
+
+ } else {
+ // String pkgCommand = "pkginfo -l" + rootString + " " + rootPath + " " + packageName + " | grep VERSION:";
+ pkgCommand = "pkginfo -x " + packageName;
+ pkgCommandArray = new String[3];
+ pkgCommandArray[0] = "pkginfo";
+ pkgCommandArray[1] = "-x";
+ pkgCommandArray[2] = packageName;
+ }
+
+ Vector returnVector = new Vector();
+ Vector returnErrorVector = new Vector();
+
+ int returnValue = ExecuteProcess.executeProcessReturnVector(pkgCommandArray, returnVector, returnErrorVector);
+
+ log = pkgCommand + "<br><b>Returns:</b>";
+ LogManager.addCommandsLogfileComment(log);
+ for (int i = 0; i < returnVector.size(); i++) {
+ log = "<b>" + returnVector.get(i) + "</b>";
+ LogManager.addCommandsLogfileComment(log);
+ }
+
+ // log = "<br>";
+ // LogManager.addCommandsLogfileComment(log);
+
+ String installedPackageVersion = helper.getVersionString(returnVector);
+ String newPackageVersion = packageData.getPkgVersion();
+
+ if ( ! installData.installedProductMinorSet() ) {
+ int productMinor = helper.getInstalledMinor(installedPackageVersion);
+ installData.setInstalledProductMinor(productMinor);
+ installData.setInstalledProductMinorSet(true);
+ }
+
+ if (( installedPackageVersion != null ) && ( newPackageVersion != null )) {
+ if ( checkIfInstalledIsOlder ) {
+ firstPackageIsOlder = helper.comparePackageVersions(installedPackageVersion, newPackageVersion);
+ } else {
+ firstPackageIsOlder = helper.comparePackageVersions(newPackageVersion, installedPackageVersion);
+ }
+ }
+ }
+
+ if ( checkIfInstalledIsOlder ) {
+ if ( firstPackageIsOlder ) {
+ log = "<b>-> Installed package is older</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ } else {
+ log = "<b>-> Installed package is not older</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ }
+ } else {
+ if ( firstPackageIsOlder ) {
+ log = "<b>-> Package in installation set is older</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ } else {
+ log = "<b>-> Package in installation set is not older</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ }
+ }
+
+ return firstPackageIsOlder;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/LinuxHelper.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/LinuxHelper.java
new file mode 100755
index 000000000000..1640ae706a46
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/LinuxHelper.java
@@ -0,0 +1,507 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.InstallerHelper;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.Util.Converter;
+import org.openoffice.setup.Util.ExecuteProcess;
+import org.openoffice.setup.Util.LogManager;
+import org.openoffice.setup.Util.SystemManager;
+import java.io.File;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Vector;public class LinuxHelper {
+
+ public LinuxHelper() {
+ super();
+ }
+
+ private void getPackageNamesContent(PackageDescription packageData, Vector packageNames) {
+ if (( packageData.getPackageName() != null ) && ( ! packageData.getPackageName().equals(""))) {
+ packageNames.add(packageData.getPackageName() + "=" + packageData.getFullPackageName());
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ getPackageNamesContent(child, packageNames);
+ }
+ }
+
+ private String getPackageNameFromRpm(PackageDescription packageData, InstallData installData) {
+ String fullPackageName = null;
+ String packagePath = installData.getPackagePath();
+
+ if (( packageData.getPkgSubdir() != null ) && ( ! packageData.getPkgSubdir().equals("") )) {
+ File completePackageFile = new File(packagePath, packageData.getPkgSubdir());
+ packagePath = completePackageFile.getPath();
+ }
+
+ String rpmFileName = packageData.getPackageName();
+ File rpmFile = new File(packagePath, rpmFileName);
+
+ if ( rpmFile.exists() ) {
+ String rpmCommand = "rpm -qp " + rpmFile.getPath();
+ String[] rpmCommandArray = new String[3];
+ rpmCommandArray[0] = "rpm";
+ rpmCommandArray[1] = "-qp";
+ rpmCommandArray[2] = rpmFile.getPath();
+
+ Vector returnVector = new Vector();
+ Vector returnErrorVector = new Vector();
+ int returnValue = ExecuteProcess.executeProcessReturnVector(rpmCommandArray, returnVector, returnErrorVector);
+ String returnString = (String) returnVector.get(0);
+
+ String log = rpmCommand + "<br><b>Returns: " + returnString + "</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+
+ fullPackageName = returnString;
+
+ } else {
+ System.err.println("Error: Could not find file " + rpmFile.getPath());
+ }
+
+ return fullPackageName;
+ }
+
+ private boolean checkPackageExistence(PackageDescription packageData, InstallData installData) {
+ boolean fileExists = false;
+
+ String packagePath = installData.getPackagePath();
+
+ if (( packageData.getPkgSubdir() != null ) && ( ! packageData.getPkgSubdir().equals("") )) {
+ File completePackageFile = new File(packagePath, packageData.getPkgSubdir());
+ packagePath = completePackageFile.getPath();
+ }
+
+ String rpmFileName = packageData.getPackageName();
+
+ File rpmFile = new File(packagePath, rpmFileName);
+ if ( rpmFile.exists() ) {
+ fileExists = true;
+ }
+
+ return fileExists;
+ }
+
+ private HashMap analyzeVersionString(String versionString) {
+
+ boolean errorOccured = false;
+
+ Integer micro = null;
+ Integer minor = null;
+ Integer major = null;
+ Integer release = null;
+
+ String microString = null;
+ String minorString = null;
+ String majorString = null;
+ String releaseString = null;
+
+ int pos = versionString.lastIndexOf("_"); // this is a jre RPM (1.5.0_06)
+
+ if ( pos > -1 ) {
+ try {
+ releaseString = versionString.substring(pos+1, versionString.length());
+ versionString = versionString.substring(0, pos);
+ } catch (IndexOutOfBoundsException ex) {
+ System.err.println("Error: Could not get substring from " + versionString);
+ errorOccured = true;
+ }
+ try {
+ int releaseInt = Integer.parseInt(releaseString);
+ release = new Integer(releaseInt);
+ } catch (NumberFormatException ex) {
+ System.err.println("Error: Could not convert " + releaseString + " to integer");
+ errorOccured = true;
+ }
+ }
+
+ // Problem: Some rpms have "2.3" instead of "2.3.0"
+ String compareString = versionString;
+ pos = compareString.lastIndexOf("."); // returns "-1", if not found
+ if ( pos > -1 ) {
+ String substring = compareString.substring(0, pos);
+ pos = substring.lastIndexOf("."); // returns "-1", if not found
+ if ( pos == -1 ) {
+ versionString = versionString + ".0";
+ // System.err.println("Warning: Changing from " + compareString + " to " + versionString);
+ }
+ } else {
+ versionString = versionString + ".0.0";
+ }
+
+ // the standard analyzing mechanism
+ pos = versionString.lastIndexOf("."); // returns "-1", if not found
+
+ if ( pos > -1 )
+ {
+ try {
+ microString = versionString.substring(pos+1, versionString.length());
+ versionString = versionString.substring(0, pos);
+ } catch (IndexOutOfBoundsException ex) {
+ System.err.println("Error: Could not get substring from " + versionString);
+ errorOccured = true;
+ }
+
+ pos = versionString.lastIndexOf(".");
+ if ( pos > -1 ) {
+ try {
+ minorString = versionString.substring(pos+1, versionString.length());
+ majorString = versionString.substring(0, pos);
+ } catch (IndexOutOfBoundsException ex) {
+ System.err.println("Error: Could not get substring from " + versionString);
+ errorOccured = true;
+ }
+ try {
+ int microInt = Integer.parseInt(microString);
+ int minorInt = Integer.parseInt(minorString);
+ int majorInt = Integer.parseInt(majorString);
+ micro = new Integer(microInt);
+ minor = new Integer(minorInt);
+ major = new Integer(majorInt);
+ } catch (NumberFormatException ex) {
+ System.err.println("Error: Could not convert " + microString + "," +
+ minorString + " or " + majorString + " to integer");
+ errorOccured = true;
+ }
+ }
+ }
+
+ // if ( microString == null ) { microString = ""; }
+ // if ( majorString == null ) { majorString = ""; }
+ // if ( releaseString == null ) { releaseString = ""; }
+ // if ( minorString == null ) { minorString = ""; }
+ // System.err.println("Major " + majorString + " Minor: " + minorString + " Micro: " + microString + " Release: " + releaseString);
+
+ if ( errorOccured ) {
+ micro = null;
+ minor = null;
+ major = null;
+ release = null;
+ }
+
+ HashMap hashRpm = new HashMap();
+
+ hashRpm.put("micro", micro);
+ hashRpm.put("minor", minor);
+ hashRpm.put("major", major);
+ hashRpm.put("release", release);
+
+ // If one of this values is "null", procedure "compareTwoRpms" always delivers false.
+ // This means, that the installed package is not older.
+
+ // System.err.println("Analyzed: " + "micro: " + hashRpm.get("micro").toString() + " minor: " + hashRpm.get("minor").toString() + " major: " + hashRpm.get("major").toString());
+
+ return hashRpm;
+ }
+
+ private HashMap analyzeReleaseString(HashMap hashRpm, String releaseString) {
+ int release;
+
+ try {
+ release = Integer.parseInt(releaseString);
+ Integer releaseObj = new Integer(release);
+ hashRpm.put("release", releaseObj);
+ }
+ catch (NumberFormatException ex) {
+ // JRE often contain a string like "FCS"
+ // System.err.println("Error: Could not convert " + releaseString + " to integer");
+ hashRpm.put("release", null);
+ }
+
+ return hashRpm;
+ }
+
+ public int getInstalledMinor(String version) {
+
+ int minor = 0;
+ int pos = version.indexOf(".");
+ if ( pos > -1 ) {
+ String reduced = version.substring(pos + 1, version.length());
+
+ pos = reduced.indexOf(".");
+ if ( pos > -1 ) {
+ reduced = reduced.substring(0, pos);
+ minor = Integer.parseInt(reduced);
+ }
+ }
+
+ return minor;
+ }
+
+ private boolean compareTwoRpms(HashMap hash1, HashMap hash2) {
+ boolean hash1IsOlder = false;
+
+ if (( hash1.get("major") != null ) && ( hash2.get("major") != null )) {
+ if ( ((Integer)hash1.get("major")).intValue() < ((Integer)hash2.get("major")).intValue() ) {
+ hash1IsOlder = true;
+ } else {
+ if (( hash1.get("minor") != null ) && ( hash2.get("minor") != null )) {
+ if ( ((Integer)hash1.get("minor")).intValue() < ((Integer)hash2.get("minor")).intValue() ) {
+ hash1IsOlder = true;
+ } else {
+ if (( hash1.get("micro") != null ) && ( hash2.get("micro") != null )) {
+ if ( ((Integer)hash1.get("micro")).intValue() < ((Integer)hash2.get("micro")).intValue() ) {
+ hash1IsOlder = true;
+ } else {
+ if (( hash1.get("release") != null ) && ( hash2.get("release") != null )) {
+ if ( ((Integer)hash1.get("release")).intValue() < ((Integer)hash2.get("release")).intValue() ) {
+ hash1IsOlder = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return hash1IsOlder;
+ }
+
+ public boolean compareVersionAndRelease(String versionString, String releaseString, PackageDescription packageData, boolean checkIfInstalledIsOlder) {
+ // version and release are gotten from the rpm database. packageData contains
+ // the information about the rpm, that shall be installed. It has to be installed,
+ // if the installed product defined by version and release is older.
+ // version is something like "2.0.3", release something like "164".
+ // An exception is the jre package, where version is "1.5.0_06" and release "fcs".
+
+ HashMap installedRpm = analyzeVersionString(versionString);
+ if ( installedRpm.get("release") == null ) {
+ installedRpm = analyzeReleaseString(installedRpm, releaseString);
+ }
+
+ // System.err.println("Package: " + packageData.getPackageName());
+ // String outputString = "Installed RPM: ";
+ // if ( installedRpm.get("major") != null ) { outputString = outputString + " major: " + installedRpm.get("major").toString(); }
+ // else { outputString = outputString + " major is null"; }
+ // if ( installedRpm.get("minor") != null ) { outputString = outputString + " minor: " + installedRpm.get("minor").toString(); }
+ // else { outputString = outputString + " minor is null"; }
+ // if ( installedRpm.get("micro") != null ) { outputString = outputString + " micro: " + installedRpm.get("micro").toString(); }
+ // else { outputString = outputString + " micro is null"; }
+ // if ( installedRpm.get("release") != null ) { outputString = outputString + " release: " + installedRpm.get("release").toString(); }
+ // else { outputString = outputString + " release is null"; }
+ // System.err.println(outputString);
+
+ HashMap notInstalledRpm = analyzeVersionString(packageData.getPkgVersion());
+ if ( notInstalledRpm.get("release") == null ) {
+ notInstalledRpm = analyzeReleaseString(notInstalledRpm, packageData.getPkgRelease());
+ }
+
+ // outputString = "Not installed RPM: ";
+ // if ( notInstalledRpm.get("major") != null ) { outputString = outputString + " major: " + notInstalledRpm.get("major").toString(); }
+ // else { outputString = outputString + " major is null"; }
+ // if ( notInstalledRpm.get("minor") != null ) { outputString = outputString + " minor: " + notInstalledRpm.get("minor").toString(); }
+ // else { outputString = outputString + " minor is null"; }
+ // if ( notInstalledRpm.get("micro") != null ) { outputString = outputString + " micro: " + notInstalledRpm.get("micro").toString(); }
+ // else { outputString = outputString + " micro is null"; }
+ // if ( notInstalledRpm.get("release") != null ) { outputString = outputString + " release: " + notInstalledRpm.get("release").toString(); }
+ // else { outputString = outputString + " release is null"; }
+ // System.err.println(outputString);
+
+ boolean firstIsOlder = false;
+
+ if ( checkIfInstalledIsOlder ) {
+ firstIsOlder = compareTwoRpms(installedRpm, notInstalledRpm);
+ // System.err.println("Result: Installed RPM is older: " + firstIsOlder);
+ } else {
+ firstIsOlder = compareTwoRpms(notInstalledRpm, installedRpm);
+ // System.err.println("Result: Not installed RPM is older: " + firstIsOlder);
+ }
+
+ return firstIsOlder;
+ }
+
+ public void getLinuxPackageNamesFromRpmquery(PackageDescription packageData, InstallData installData) {
+
+ if ((packageData.getPackageName() != null) && ( ! packageData.getPackageName().equals(""))) {
+
+ boolean rpmExists = checkPackageExistence(packageData, installData);
+
+ if ( rpmExists ) {
+ // Full package name not defined in xpd file
+ if (( packageData.getFullPackageName() == null ) || ( packageData.getFullPackageName().equals(""))) {
+ // Now it is possible to query the rpm database for the packageName, if it is not defined in xpd file!
+ String fullPackageName = getPackageNameFromRpm(packageData, installData);
+ if ( fullPackageName != null ) {
+ packageData.setFullPackageName(fullPackageName);
+ } else {
+ System.err.println("Error: Linux package name not defined in xpd file and could not be determined: "
+ + packageData.getPackageName());
+ }
+ }
+ packageData.setPkgExists(true);
+
+ } else {
+ packageData.setPkgExists(false);
+ }
+
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ getLinuxPackageNamesFromRpmquery(child, installData);
+ }
+ }
+
+ public String getLinuxDatabasePath(InstallData data) {
+ String databasePath = null;
+ String installDir = data.getInstallDir();
+ String databaseDir = installDir;
+ // String databaseDir = SystemManager.getParentDirectory(installDir);
+ String linuxDatabaseName = ".RPM_OFFICE_DATABASE";
+ File databaseFile = new File(databaseDir, linuxDatabaseName);
+ databasePath = databaseFile.getPath();
+ return databasePath;
+ }
+
+ public void getLinuxFileInfo(PackageDescription packageData) {
+ // analyzing a string like "openoffice-core01-2.0.3-159" as "name-version-release"
+ InstallData data = InstallData.getInstance();
+ if ( packageData.pkgExists() ) {
+ if (( packageData.getFullPackageName() != null ) && ( ! packageData.getFullPackageName().equals(""))) {
+ String longName = packageData.getFullPackageName();
+
+ int pos = longName.lastIndexOf("-");
+ if (data.isInstallationMode()) {
+ // not saving at uninstallation, because it can be updated without GUI installer
+ packageData.setPkgRelease(longName.substring(pos+1, longName.length()));
+ }
+ longName = longName.substring(0, pos);
+
+ pos = longName.lastIndexOf("-");
+ if (data.isInstallationMode()) {
+ // not saving at uninstallation, because it can be updated without GUI installer
+ packageData.setPkgVersion(longName.substring(pos+1, longName.length()));
+ }
+ packageData.setPkgRealName(longName.substring(0, pos));
+ }
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ getLinuxFileInfo(child);
+ }
+
+ }
+
+ public void setFullPackageNameAtUninstall(PackageDescription packageData, HashMap packageNames) {
+
+ if (( packageData.getPackageName() != null ) && ( ! packageData.getPackageName().equals(""))) {
+ if (( packageData.getFullPackageName() == null ) || ( packageData.getFullPackageName().equals(""))) {
+ String packageName = packageData.getPackageName();
+ // Does this always exist? Should not be required!
+ // But is there another way to get the packageNames, without this file?
+ // During installation the packageNames can be determined by querying the rpm file
+ // -> this is not possible during uninstallation
+ String fullPackageName = (String) packageNames.get(packageName);
+ packageData.setFullPackageName(fullPackageName);
+ }
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ setFullPackageNameAtUninstall(child, packageNames);
+ }
+ }
+
+ public String getRelocationString(PackageDescription packageData, String packageName) {
+ String relocationString = null;
+
+ if ( packageData.isRelocatable() ) {
+ // String rpmQuery = "rpm -qp --qf %{PREFIXES}" + " " + packageName;
+ String[] rpmQueryArray = new String[5];
+ rpmQueryArray[0] = "rpm";
+ rpmQueryArray[1] = "-qp";
+ rpmQueryArray[2] = "--qf";
+ rpmQueryArray[3] = "%{PREFIXES}";
+ rpmQueryArray[4] = packageName;
+
+ Vector returnVector = new Vector();
+ Vector returnErrorVector = new Vector();
+ int returnValue = ExecuteProcess.executeProcessReturnVector(rpmQueryArray, returnVector, returnErrorVector);
+ relocationString = (String) returnVector.get(0);
+ }
+
+ return relocationString;
+ }
+
+ public void createPackageNameFileAtPostinstall(InstallData data, PackageDescription packageData) {
+
+ // The file "packageNames" must not be an own database! It must be possible to install
+ // and deinstall RPMs without this GUI installer. Therefore the file packageNames is
+ // not always up to date. Nevertheless it makes the deinstallation faster, because of
+ // all packages, whose "real" package name is not defined in xpd files (for example
+ // "openoffice-core01-2.0.3-159.rpm" hat the "real" name "openoffice-core01" that is
+ // used for deinstallation) this can be read in this file. Otherwise it would be
+ // neccessary to determine the "real" name with a database question.
+ // The version and release that are also stored in file "packageNames" must not be
+ // used for deinstallation because they are probably not up to date.
+
+ File destDir = new File(data.getInstallDefaultDir(), data.getProductDir());
+ File uninstallDir = new File(destDir, data.getUninstallDirName());
+ String fileName = "packageNames";
+ File packageNamesFile = new File(uninstallDir, fileName);
+ Vector packageNames = new Vector();
+ getPackageNamesContent(packageData, packageNames);
+ SystemManager.saveCharFileVector(packageNamesFile.getPath(), packageNames);
+ }
+
+ public HashMap readPackageNamesFile() {
+ // package names are stored in file "packageNames" in data.getInfoRoot() directory
+ String fileName = "packageNames";
+ InstallData data = InstallData.getInstance();
+ File dir = data.getInfoRoot();
+ File file = new File(dir, fileName);
+ Vector fileContent = SystemManager.readCharFileVector(file.getPath());
+ HashMap map = Converter.convertVectorToHashmap(fileContent);
+ return map;
+ }
+
+ public void saveModulesLogFile(InstallData data) {
+ if ( data.logModuleStates() ) {
+ Vector logContent = LogManager.getModulesLogFile();
+ File destDir = new File(data.getInstallDefaultDir(), data.getProductDir());
+ File uninstallDir = new File(destDir, data.getUninstallDirName());
+ File modulesLogFile = new File(uninstallDir, "moduleSettingsLog.txt");
+ SystemManager.saveCharFileVector(modulesLogFile.getPath(), logContent);
+ }
+ }
+
+ public String fixInstallationDirectory(String installDir) {
+ // inject a second slash to the last path segment to avoid rpm 3 concatenation bug
+ int lastSlashPos = installDir.lastIndexOf('/');
+ String sub1 = installDir.substring(0,lastSlashPos);
+ String sub2 = installDir.substring(lastSlashPos);
+ String fixedInstallDir = sub1 + "/" + sub2;
+ // fixedInstallDir.replaceAll(" ", "%20");
+ return fixedInstallDir;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/SolarisHelper.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/SolarisHelper.java
new file mode 100755
index 000000000000..ad3460159262
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/InstallerHelper/SolarisHelper.java
@@ -0,0 +1,404 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.InstallerHelper;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.Util.Controller;
+import org.openoffice.setup.Util.Converter;
+import org.openoffice.setup.Util.ExecuteProcess;
+import org.openoffice.setup.Util.Informer;
+import org.openoffice.setup.Util.LogManager;
+import org.openoffice.setup.Util.SystemManager;
+import java.io.File;
+import java.util.HashMap;
+import java.util.Vector;
+
+public class SolarisHelper {
+
+ public SolarisHelper() {
+ }
+
+ private void createLocalTempDir() {
+ String mktempString = "/usr/bin/mktemp";
+ File mktemp = new File(mktempString);
+ if ( mktemp.exists() ) {
+ // this is Solaris 10
+ LogManager.setCommandsHeaderLine("Preparing Solaris 10 user installation");
+ InstallData data = InstallData.getInstance();
+ String mktempCommand = mktempString + " -d";
+ String[] mktempCommandArray = new String[2];
+ mktempCommandArray[0] = mktempString;
+ mktempCommandArray[1] = "-d";
+ Vector returnVector = new Vector();
+ Vector returnErrorVector = new Vector();
+ int returnValue = ExecuteProcess.executeProcessReturnVector(mktempCommandArray, returnVector, returnErrorVector);
+ String uniqueLocalDir = (String) returnVector.get(0);
+
+ data.setLocalTempPath(uniqueLocalDir);
+
+ String log = mktempCommand + "<br><b>Returns: " + uniqueLocalDir + "</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+
+ String installRoot = data.getInstallDir();
+ File installRootTemp = new File(installRoot, "tmp");
+
+ if ( installRootTemp.exists() ) {
+ SystemManager.removeDirectory(installRootTemp);
+ }
+
+ String linkCommand = "ln -s " + uniqueLocalDir + " " + installRootTemp.getPath();
+ String[] linkCommandArray = new String[4];
+ linkCommandArray[0] = "ln";
+ linkCommandArray[1] = "-s";
+ linkCommandArray[2] = uniqueLocalDir;
+ linkCommandArray[3] = installRootTemp.getPath();
+
+ // Vector returnVector = new Vector();
+ returnValue = ExecuteProcess.executeProcessReturnValue(linkCommandArray);
+
+ log = linkCommand + "<br><b>Returns: " + returnValue + "</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ }
+ }
+
+ private void removeLocalTempDir() {
+ InstallData data = InstallData.getInstance();
+
+ if ( data.getLocalTempPath() != null ) {
+ File installRootTemp = new File(data.getInstallDir(), "tmp");
+ if ( installRootTemp.exists() ) {
+ installRootTemp.delete(); // removing the link
+ SystemManager.createDirectory(installRootTemp);
+ }
+
+ File localTemp = new File(data.getLocalTempPath());
+ if ( localTemp.exists() ) {
+ SystemManager.removeDirectory(localTemp);
+ }
+ }
+ }
+
+ private Vector getAdminFileContent(boolean relocatable, boolean rdepends) {
+
+ Vector adminFile = new Vector();
+ InstallData data = InstallData.getInstance();
+
+ // if ( relocatable ) {
+ // String installDir = data.getInstallDir();
+ // // installDir = installDir.replace(" ", "\\ ");
+ // String baseDirLine = "basedir=" + installDir;
+ // adminFile.add(baseDirLine);
+ // }
+
+ String mailLine = "mail=";
+ adminFile.add(mailLine);
+
+ String conflictLine = "conflict=nochange";
+ if ( data.isUserInstallation() ) { conflictLine = "conflict=nochange"; }
+ adminFile.add(conflictLine);
+
+ String runlevelLine = "runlevel=nocheck";
+ adminFile.add(runlevelLine);
+
+ String setuidLine = "setuid=quit";
+ if ( data.isUserInstallation() ) { setuidLine = "setuid=nocheck"; }
+ adminFile.add(setuidLine);
+
+ String actionLine = "action=nocheck";
+ adminFile.add(actionLine);
+
+ String partialLine = "partial=quit";
+ if ( data.isUserInstallation() ) { partialLine = "partial=nocheck"; }
+ adminFile.add(partialLine);
+
+ String instanceLine = "instance=unique";
+ adminFile.add(instanceLine);
+
+ // String idependLine = "idepend=quit";
+ String idependLine = "idepend=nocheck";
+ // if ( data.isUserInstallation() ) { idependLine = "idepend=nocheck"; }
+ adminFile.add(idependLine);
+
+ // String rdependLine = "rdepend=nocheck";
+ String rdependLine = "rdepend=quit";
+ if ( ! rdepends ) { rdependLine = "rdepend=nocheck"; }
+ if ( data.isUserInstallation() ) { rdependLine = "rdepend=nocheck"; }
+ adminFile.add(rdependLine);
+
+ String spaceLine = "space=quit";
+ if ( data.isUserInstallation() ) { spaceLine = "space=nocheck"; }
+ adminFile.add(spaceLine);
+
+ return adminFile;
+ }
+
+ private String getMainVersion (String version) {
+ String mainVersion = null;
+
+ int pos = version.indexOf(",");
+ if ( pos > -1 ) {
+ mainVersion = version.substring(0, pos);
+ }
+
+ return mainVersion;
+ }
+
+ private String getPackageRevision(String version) {
+ String revision = null;
+
+ int pos = version.indexOf("=");
+ if ( pos > -1 ) {
+ revision = version.substring(pos + 1, version.length() );
+ }
+
+ return revision;
+ }
+
+ private Vector getVectorOfNumbers(String version) {
+ Vector numbers = new Vector();
+ int pos = -1;
+ // getting number from a string in format 2.0.0
+ do {
+ pos = version.indexOf(".");
+ if ( pos > -1 ) {
+ String number = version.substring(0, pos);
+ version = version.substring(pos + 1, version.length());
+ numbers.add(number);
+ }
+ } while ( pos > -1 );
+
+ numbers.add(version);
+ return numbers;
+ }
+
+ private int getMinimum(int a, int b) {
+ int minimum;
+
+ if ( a < b ) {
+ minimum = a;
+ } else {
+ minimum = b;
+ }
+
+ return minimum;
+ }
+
+ private String compareVersion(String firstVersion, String secondVersion) {
+ // comparing strings with syntax 2.0.0
+ String comparison = "bothPackagesAreEqual";
+ Vector firstVector = getVectorOfNumbers(firstVersion);
+ Vector secondVector = getVectorOfNumbers(secondVersion);
+
+ int firstLength = firstVector.size();
+ int secondLength = secondVector.size();
+ int minimum = getMinimum(firstLength, secondLength);
+
+ for (int i = 0; i < minimum; i++) {
+ String firstS = (String)firstVector.get(i);
+ String secondS = (String)secondVector.get(i);
+
+ int first = Integer.parseInt(firstS);
+ int second_ = Integer.parseInt(secondS);
+
+ if ( second_ > first ) {
+ comparison = "firstPackageIsOlder";
+ break;
+ } else if ( second_ < first ) {
+ comparison = "secondPackageIsOlder";
+ break;
+ }
+ }
+
+ return comparison;
+ }
+
+ public void saveModulesLogFile(InstallData data) {
+ if ( data.logModuleStates() ) {
+ Vector logContent = LogManager.getModulesLogFile();
+ File baseDir = new File(data.getInstallDefaultDir(), data.getProductDir());
+ File uninstallDir = new File(baseDir, data.getUninstallDirName());
+ File modulesLogFile = new File(uninstallDir, "moduleSettingsLog.txt");
+ // System.err.println("Saving file: " + modulesLogFile.getPath());
+ SystemManager.saveCharFileVector(modulesLogFile.getPath(), logContent);
+ }
+ }
+
+ public void removeSolarisLockFile() {
+ String lockFileName = "/tmp/.ai.pkg.zone.lock-afdb66cf-1dd1-11b2-a049-000d560ddc3e";
+ File lockFile = new File(lockFileName);
+
+ if ( lockFile.exists() ) {
+ // System.err.println("Found file: " + lockFileName);
+ boolean deleted = lockFile.delete();
+ }
+ }
+
+ public String getSolarisDatabasePath(InstallData data) {
+ String databasePath = null;
+ databasePath = data.getInstallDir();
+ return databasePath;
+ }
+
+ public void createAdminFile(boolean relocatable, boolean rdepends) {
+ InstallData data = InstallData.getInstance();
+ Vector removeFiles = data.getRemoveFiles();
+ String adminFileName = "";
+
+ if ( relocatable ) {
+ if ( rdepends ) {
+ adminFileName = "adminFileReloc";
+ } else {
+ adminFileName = "adminFileRelocNoDepends";
+ }
+ } else {
+ if ( rdepends ) {
+ adminFileName = "adminFileNoReloc";
+ } else {
+ adminFileName = "adminFileNoRelocNoDepends";
+ }
+ }
+
+ Vector fileContent = getAdminFileContent(relocatable, rdepends);
+ File adminFile = new File(data.getInstallDir(), adminFileName);
+ String completeAdminFileName = adminFile.getPath();
+
+ if ( relocatable ) {
+ if ( rdepends ) {
+ data.setAdminFileNameReloc(completeAdminFileName);
+ } else {
+ data.setAdminFileNameRelocNoDepends(completeAdminFileName);
+ }
+ } else {
+ if ( rdepends ) {
+ data.setAdminFileNameNoReloc(completeAdminFileName);
+ } else {
+ data.setAdminFileNameNoRelocNoDepends(completeAdminFileName);
+ }
+ }
+
+ if ( ! adminFile.exists() ) {
+ // only saving, if it did not exist
+ SystemManager.saveCharFileVector(completeAdminFileName, fileContent);
+ // only removing file in aborted installation, if it was created before
+ removeFiles.add(completeAdminFileName);
+ }
+
+ // File dumpFile = new File(data.getInstallDir(), "dumpFile");
+ // String dumpFileName = dumpFile.getPath();
+ // SystemManager.dumpFile(adminFileName, dumpFileName);
+ }
+
+ // for user installations an environment hashmap is used
+ public void setEnvironmentForUserInstall() {
+ InstallData data = InstallData.getInstance();
+ HashMap env = SystemManager.getEnvironmentHashMap();
+ env.put("LD_PRELOAD_32", data.getGetUidPath());
+ data.setShellEnvironment(env);
+ }
+
+ public String getVersionString(Vector returnVector) {
+ String versionString = null;
+ String versionLine = null;
+
+ for (int i = 0; i < returnVector.size(); i++) {
+ String line = (String) returnVector.get(i);
+ int pos = line.indexOf("REV=");
+ if ( pos > -1 ) {
+ versionLine = line;
+ break;
+ }
+ }
+
+ if ( versionLine != null ) {
+ versionLine = versionLine.trim();
+ int pos = versionLine.lastIndexOf(" ");
+ versionString = versionLine.substring(pos + 1, versionLine.length());
+ }
+
+ return versionString;
+ }
+
+ public int getInstalledMinor(String version) {
+
+ int minor = 0;
+
+ int pos = version.indexOf(".");
+ if ( pos > -1 ) {
+ String reduced = version.substring(pos + 1, version.length());
+
+ pos = reduced.indexOf(".");
+ if ( pos > -1 ) {
+ reduced = reduced.substring(0, pos);
+ minor = Integer.parseInt(reduced);
+ }
+ }
+
+ return minor;
+ }
+
+ public boolean comparePackageVersions(String firstPackageVersion, String secondPackageVersion) {
+ // Analyzing strings: version, 2.0.0,REV=106.2005.05.26
+
+ boolean firstPackageIsOlder = false;
+ String comparison = null;
+
+ String firstPackageMainVersion = getMainVersion(firstPackageVersion); // 2.0.0
+ String secondPackageMainVersion = getMainVersion(secondPackageVersion); // 2.0.0
+
+ if (( firstPackageMainVersion != null ) && ( secondPackageMainVersion != null )) {
+ comparison = compareVersion(firstPackageMainVersion, secondPackageMainVersion);
+ }
+
+ if ( comparison.equals("firstPackageIsOlder") ) {
+ firstPackageIsOlder = true;
+ } else if ( comparison.equals("secondPackageIsOlder") ) {
+ firstPackageIsOlder = false;
+ } else if ( comparison.equals("bothPackagesAreEqual") ) {
+ String firstPackageRevision = getPackageRevision(firstPackageVersion); // 106.2005.05.26
+ String secondPackageRevision = getPackageRevision(secondPackageVersion); // 106.2005.05.26
+
+ if (( firstPackageRevision != null ) && ( secondPackageRevision != null )) {
+ comparison = compareVersion(firstPackageRevision, secondPackageRevision);
+ if ( comparison.equals("firstPackageIsOlder") ) {
+ firstPackageIsOlder = true;
+ } else {
+ firstPackageIsOlder = false;
+ }
+ }
+ }
+
+ // If version is equal, the patchlevel has to be analyzed
+ // -> pkginfo does not offer this information
+ // -> looking into file <root>/opt/var/sadm/pkg/<package>/pkginfo?
+
+ return firstPackageIsOlder;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Main.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Main.java
new file mode 100755
index 000000000000..75a2af9b3117
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Main.java
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup;
+
+import org.openoffice.setup.Controller.AcceptLicenseCtrl;
+import org.openoffice.setup.Controller.ChooseComponentsCtrl;
+import org.openoffice.setup.Controller.ChooseUninstallationComponentsCtrl;
+import org.openoffice.setup.Controller.ChooseUninstallationTypeCtrl;
+import org.openoffice.setup.Controller.ChooseDirectoryCtrl;
+import org.openoffice.setup.Controller.ChooseInstallationTypeCtrl;
+import org.openoffice.setup.Controller.UninstallationCompletedCtrl;
+import org.openoffice.setup.Controller.UninstallationImminentCtrl;
+import org.openoffice.setup.Controller.UninstallationOngoingCtrl;
+import org.openoffice.setup.Controller.UninstallationPrologueCtrl;
+import org.openoffice.setup.Controller.InstallationCompletedCtrl;
+import org.openoffice.setup.Controller.InstallationImminentCtrl;
+import org.openoffice.setup.Controller.InstallationOngoingCtrl;
+import org.openoffice.setup.Controller.PrologueCtrl;
+// import org.openoffice.setup.Util.Dumper;
+
+public class Main {
+
+ public static void main(String[] args) {
+ // try {
+ // UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
+ // } catch (Exception e) { }
+
+ // Dumper.dumpAllProperties();
+ SetupFrame frame = new SetupFrame();
+ InstallData data = InstallData.getInstance();
+ if ( data.isInstallationMode() ) {
+ PanelController controller1 = new PrologueCtrl();
+ frame.addPanel(controller1, controller1.getName());
+ PanelController controller2 = new AcceptLicenseCtrl();
+ frame.addPanel(controller2, controller2.getName());
+ PanelController controller3 = new ChooseDirectoryCtrl();
+ frame.addPanel(controller3, controller3.getName());
+ PanelController controller4 = new ChooseInstallationTypeCtrl();
+ frame.addPanel(controller4, controller4.getName());
+ PanelController controller5 = new ChooseComponentsCtrl();
+ frame.addPanel(controller5, controller5.getName());
+ PanelController controller6 = new InstallationImminentCtrl();
+ frame.addPanel(controller6, controller6.getName());
+ PanelController controller7 = new InstallationOngoingCtrl();
+ frame.addPanel(controller7, controller7.getName());
+ PanelController controller8 = new InstallationCompletedCtrl();
+ frame.addPanel(controller8, controller8.getName());
+ frame.setCurrentPanel(controller1.getName(), false, true);
+ } else {
+ PanelController controller1 = new UninstallationPrologueCtrl();
+ frame.addPanel(controller1, controller1.getName());
+ PanelController controller2 = new ChooseUninstallationTypeCtrl();
+ frame.addPanel(controller2, controller2.getName());
+ PanelController controller3 = new ChooseUninstallationComponentsCtrl();
+ frame.addPanel(controller3, controller3.getName());
+ PanelController controller4 = new UninstallationImminentCtrl();
+ frame.addPanel(controller4, controller4.getName());
+ PanelController controller5 = new UninstallationOngoingCtrl();
+ frame.addPanel(controller5, controller5.getName());
+ PanelController controller6 = new UninstallationCompletedCtrl();
+ frame.addPanel(controller6, controller6.getName());
+ frame.setCurrentPanel(controller1.getName(), false, true);
+ }
+
+ int ret = frame.showFrame();
+
+ while ( data.stillRunning() ) {
+ for (int i = 0; i < 100; i++) {} // why?
+ }
+
+ System.exit(0);
+ }
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/AcceptLicense.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/AcceptLicense.java
new file mode 100755
index 000000000000..42c1f91cdb13
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/AcceptLicense.java
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Panel;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.PanelHelper.PanelLabel;
+import org.openoffice.setup.PanelHelper.PanelTitle;
+import org.openoffice.setup.ResourceManager;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Insets;
+import java.io.File;
+import javax.swing.JPanel;
+import javax.swing.JEditorPane;
+import javax.swing.JScrollPane;
+import javax.swing.border.EmptyBorder;
+public class AcceptLicense extends JPanel {
+
+ public AcceptLicense() {
+
+ setLayout(new java.awt.BorderLayout());
+ setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
+
+ String titletext = ResourceManager.getString("String_AcceptLicense1");
+ PanelTitle titlebox = new PanelTitle(titletext);
+ add(titlebox, BorderLayout.NORTH);
+
+ JPanel contentpanel = new JPanel();
+ contentpanel.setLayout(new java.awt.BorderLayout());
+
+ String text1 = ResourceManager.getString("String_AcceptLicense2");
+ PanelLabel label1 = new PanelLabel(text1);
+
+ String text2 = ResourceManager.getString("String_AcceptLicense3");
+ PanelLabel label2 = new PanelLabel(text2, true);
+
+ JEditorPane editorPane = createEditorPane();
+ JScrollPane editorScrollPane = new JScrollPane(editorPane);
+
+ editorScrollPane.setPreferredSize(new Dimension(250, 145));
+ editorScrollPane.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
+
+ contentpanel.add(label1, BorderLayout.NORTH);
+ contentpanel.add(editorScrollPane, BorderLayout.CENTER);
+ contentpanel.add(label2, BorderLayout.SOUTH);
+
+ add(contentpanel, BorderLayout.CENTER);
+ }
+
+ private JEditorPane createEditorPane() {
+ JEditorPane editorPane = new JEditorPane();
+ editorPane.setEditable(false);
+
+ InstallData data = InstallData.getInstance();
+ File htmlDirectory = data.getInfoRoot("html");
+ String licenseFile = ResourceManager.getFileName("String_License_Filename");
+
+ if ( htmlDirectory != null) {
+ File htmlFile = new File(htmlDirectory, licenseFile);
+ if (! htmlFile.exists()) {
+ System.err.println("Couldn't find file: " + htmlFile.toString());
+ }
+
+ try {
+ // System.err.println("URLPath: " + htmlFile.toURL());
+ editorPane.setContentType("text/html;charset=utf-8");
+ editorPane.setPage(htmlFile.toURL());
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.err.println("Attempted to read a bad URL");
+ }
+ } else {
+ System.err.println("Did not find html directory");
+ }
+
+ return editorPane;
+ }
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseComponents.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseComponents.java
new file mode 100755
index 000000000000..89f76db06227
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseComponents.java
@@ -0,0 +1,189 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Panel;
+
+import org.openoffice.setup.PanelHelper.PanelLabel;
+import org.openoffice.setup.PanelHelper.PanelTitle;
+import org.openoffice.setup.PanelHelper.TreeNodeRenderer;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupData.DisplayPackageDescription;
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import java.awt.BorderLayout;
+import java.awt.ComponentOrientation;
+import java.awt.Insets;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import javax.swing.BorderFactory;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTree;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreePath;
+import javax.swing.tree.TreeSelectionModel;
+import org.openoffice.setup.InstallData;
+
+public class ChooseComponents extends JPanel implements MouseListener, KeyListener, TreeSelectionListener {
+
+ private JTree componentTree;
+ private PanelLabel descriptionLabel;
+ private PanelLabel sizeLabel;
+
+ private String sizeString;
+ private PanelTitle titleBox;
+
+ public ChooseComponents() {
+
+ InstallData data = InstallData.getInstance();
+
+ setLayout(new BorderLayout());
+ setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
+
+ String titleText = ResourceManager.getString("String_ChooseComponents1");
+ String subtitleText = ResourceManager.getString("String_ChooseComponents2");
+ titleBox = new PanelTitle(titleText, subtitleText, 2, 40);
+ titleBox.addVerticalStrut(20);
+ add(titleBox, BorderLayout.NORTH);
+
+ DefaultMutableTreeNode root = SetupDataProvider.createTree();
+
+ componentTree = new JTree(root);
+ componentTree.setShowsRootHandles(true);
+ componentTree.setRootVisible(false);
+ componentTree.setVisibleRowCount(3);
+ componentTree.setCellRenderer(new TreeNodeRenderer());
+ componentTree.addMouseListener( this );
+ componentTree.addKeyListener( this );
+ componentTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+ componentTree.addTreeSelectionListener(this);
+ // if ( data.useRtl() ) { componentTree.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ String BorderTitle = ResourceManager.getString("String_ChooseComponents3");
+ TitledBorder PanelBorder = BorderFactory.createTitledBorder(BorderTitle);
+
+ BorderLayout PanelLayout = new BorderLayout();
+ PanelLayout.setHgap(20);
+ JPanel DescriptionPanel = new JPanel();
+ DescriptionPanel.setBorder(PanelBorder);
+ DescriptionPanel.setLayout(PanelLayout);
+
+ String DescriptionText = "";
+ descriptionLabel = new PanelLabel(DescriptionText, 3, 20);
+ sizeString = ResourceManager.getString("String_ChooseComponents4");
+ sizeLabel = new PanelLabel(sizeString, 1, 5);
+
+ DescriptionPanel.add(descriptionLabel, BorderLayout.CENTER);
+ DescriptionPanel.add(sizeLabel, BorderLayout.EAST);
+ if ( data.useRtl() ) { DescriptionPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ add(new JScrollPane(componentTree), BorderLayout.CENTER);
+ add(DescriptionPanel, BorderLayout.SOUTH);
+ }
+
+ public void setTitleText(String s) {
+ titleBox.setTitle(s);
+ }
+
+ private void updateNode(DefaultMutableTreeNode node) {
+ if (node != null) {
+ DisplayPackageDescription nodeInfo = (DisplayPackageDescription)node.getUserObject();
+ nodeInfo.toggleState(node);
+
+ DefaultTreeModel model = (DefaultTreeModel)componentTree.getModel();
+ // model.nodeChanged(node);
+
+ // The following line was included because of task i78481.
+ // In Java 1.6 nodeChanged does not work correctly.
+ model.nodeStructureChanged(node);
+
+ descriptionLabel.setText(nodeInfo.getDescription());
+ sizeLabel.setText(sizeString + nodeInfo.getSize());
+ }
+ }
+
+ /**
+ * Implement the MouseListener Interface
+ */
+ public void mouseClicked(MouseEvent event) {
+ }
+ public void mouseEntered(MouseEvent event) {
+ }
+ public void mouseExited(MouseEvent event) {
+ }
+ public void mousePressed(MouseEvent event) {
+ TreePath selPath = componentTree.getPathForLocation( event.getX(), event.getY() );
+ if ((selPath != null) && (componentTree.getPathBounds(selPath).getX() + 20 >= event.getX())) {
+ updateNode((DefaultMutableTreeNode)selPath.getLastPathComponent());
+ }
+ }
+ public void mouseReleased(MouseEvent e) {
+ }
+
+ /**
+ * Implement the KeyListener Interface
+ */
+ public void keyPressed(KeyEvent event) {
+ }
+ public void keyReleased(KeyEvent event) {
+ }
+ public void keyTyped(KeyEvent event) {
+ if ( event.getKeyChar() == ' ' ) {
+ TreePath selPath = componentTree.getAnchorSelectionPath();
+ if ( selPath != null ) {
+ updateNode((DefaultMutableTreeNode)selPath.getLastPathComponent());
+ }
+ }
+ }
+
+ /**
+ * Implement the TreeSelectionListener Interface.
+ */
+ public void valueChanged(TreeSelectionEvent event) {
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode)componentTree.getLastSelectedPathComponent();
+ if (node == null) {
+ descriptionLabel.setText("");
+ sizeLabel.setText("");
+ } else {
+ DisplayPackageDescription nodeInfo = (DisplayPackageDescription)node.getUserObject();
+
+ nodeInfo.updateSize(node); // important to set default values for nodes
+ DefaultTreeModel model = (DefaultTreeModel)componentTree.getModel();
+ model.nodeChanged(node);
+
+ descriptionLabel.setText(nodeInfo.getDescription());
+ sizeLabel.setText(sizeString + nodeInfo.getSize());
+ }
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseDirectory.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseDirectory.java
new file mode 100755
index 000000000000..15d44fa2d179
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseDirectory.java
@@ -0,0 +1,185 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Panel;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.PanelHelper.PanelLabel;
+import org.openoffice.setup.PanelHelper.PanelTitle;
+import org.openoffice.setup.ResourceManager;
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.border.EmptyBorder;
+
+public class ChooseDirectory extends JPanel implements ActionListener {
+
+ private JFileChooser directoryChooser;
+ private JFileChooser directoryChooserRootdir;
+ private JButton directoryButton;
+ private JButton directoryButtonRootdir;
+ private JTextField directoryField;
+ private JTextField directoryFieldRootdir;
+ private PanelLabel databaseProgress;
+ private PanelTitle titleBox;
+
+ public ChooseDirectory() {
+
+ setLayout(new java.awt.BorderLayout());
+ setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
+
+ String titleText = ResourceManager.getString("String_ChooseDirectory1");
+ String subtitleText = ResourceManager.getString("String_ChooseDirectory2");
+
+ titleBox = new PanelTitle(titleText, subtitleText);
+ titleBox.addVerticalStrut(10);
+ add(titleBox, BorderLayout.NORTH);
+
+ Box contentBox = new Box(BoxLayout.Y_AXIS);
+
+ JPanel contentPanel = new JPanel();
+ contentPanel.setLayout(new GridBagLayout());
+
+ directoryChooser = new JFileChooser();
+ directoryChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+
+ String browseText = ResourceManager.getString("String_ChooseDirectory3");
+ directoryButton = new JButton(browseText);
+ directoryButton.addActionListener(this);
+
+ directoryField = new JTextField();
+
+ GridBagConstraints constraints = new GridBagConstraints();
+
+ constraints.gridx = 0;
+ constraints.gridy = 0;
+ constraints.weightx = 1;
+ constraints.weighty = 0;
+ constraints.fill = GridBagConstraints.HORIZONTAL;
+
+ contentPanel.add(directoryField, constraints);
+
+ constraints.gridx = 1;
+ constraints.gridy = 0;
+ constraints.weightx = 0;
+ constraints.weighty = 0;
+ constraints.fill = GridBagConstraints.HORIZONTAL;
+
+ contentPanel.add(directoryButton, constraints);
+
+ constraints.gridx = 0;
+ constraints.gridy = 1;
+ constraints.weightx = 0;
+ constraints.weighty = 1;
+ constraints.fill = GridBagConstraints.VERTICAL;
+
+ contentPanel.add(new JPanel(), constraints);
+
+ contentBox.add(contentPanel);
+
+ // defining a place for text output
+ databaseProgress = new PanelLabel(""); // planned for database progress
+ contentBox.add(databaseProgress);
+
+ add(contentBox, BorderLayout.CENTER);
+ }
+
+ public void setDatabaseText(String s) {
+ databaseProgress.setText(s);
+ }
+
+ public void setTitleText(String s) {
+ titleBox.setTitle(s);
+ }
+
+ public void setDirectory(String dir) {
+ directoryField.setText(dir);
+ }
+
+ public void disableDirectoryField() {
+ directoryField.setEditable(false) ;
+ }
+
+ public void disableBrowseButton() {
+ directoryButton.setEnabled(false);
+ }
+
+ public void enableDirectoryField() {
+ directoryField.setEditable(true) ;
+ }
+
+ public String getDirectory() {
+ return directoryField.getText();
+ }
+
+ public void setRootDirectory(String dir) {
+ directoryFieldRootdir.setText(dir);
+ }
+
+ public String getRootDirectory() {
+ return directoryFieldRootdir.getText();
+ }
+
+ public void actionPerformed(ActionEvent e) {
+
+ //Handle open button action.
+ if (e.getSource() == directoryButton) {
+ int ReturnValue = directoryChooser.showOpenDialog(ChooseDirectory.this);
+
+ if (ReturnValue == JFileChooser.APPROVE_OPTION) {
+ File file = directoryChooser.getSelectedFile();
+ directoryField.setText(file.getAbsolutePath());
+ } else {
+ // do nothing for now
+ }
+ }
+
+ if (e.getSource() == directoryButtonRootdir) {
+ int ReturnValue = directoryChooserRootdir.showOpenDialog(ChooseDirectory.this);
+
+ if (ReturnValue == JFileChooser.APPROVE_OPTION) {
+ File file = directoryChooserRootdir.getSelectedFile();
+ directoryFieldRootdir.setText(file.getAbsolutePath());
+ } else {
+ // do nothing for now
+ }
+ }
+
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseInstallationType.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseInstallationType.java
new file mode 100755
index 000000000000..74a72c936800
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseInstallationType.java
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Panel;
+
+import org.openoffice.setup.Controller.ChooseInstallationTypeCtrl;
+import org.openoffice.setup.PanelHelper.PanelLabel;
+import org.openoffice.setup.PanelHelper.PanelTitle;
+import org.openoffice.setup.ResourceManager;
+import java.awt.BorderLayout;
+import java.awt.ComponentOrientation;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.KeyEvent;
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+import org.openoffice.setup.InstallData;
+
+public class ChooseInstallationType extends JPanel {
+
+ private JRadioButton custom;
+ private JRadioButton typical;
+
+ public ChooseInstallationType() {
+
+ InstallData data = InstallData.getInstance();
+
+ setLayout(new BorderLayout());
+ setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
+
+ String titleText = ResourceManager.getString("String_ChooseInstallationType1");
+ String subtitleText = ResourceManager.getString("String_ChooseInstallationType2");
+ PanelTitle titleBox = new PanelTitle(titleText, subtitleText);
+ titleBox.addVerticalStrut(20);
+
+ if ( data.useRtl() ) { titleBox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ add(titleBox, BorderLayout.NORTH);
+
+ String borderTitle = ResourceManager.getString("String_ChooseInstallationType3");
+ TitledBorder PanelBorder = BorderFactory.createTitledBorder(borderTitle);
+
+ JPanel contentPanel = new JPanel();
+ contentPanel.setBorder(PanelBorder);
+ contentPanel.setLayout(new GridBagLayout());
+ if ( data.useRtl() ) { contentPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ GridBagConstraints constraints = new GridBagConstraints();
+ constraints.insets = new Insets(0, 0, 0, 10);
+ // constraints.anchor = GridBagConstraints.NORTHWEST;
+
+ String typicalText = ResourceManager.getString("String_ChooseInstallationType4");
+ PanelLabel typicalComment = new PanelLabel(typicalText, true);
+ if ( data.useRtl() ) { typicalComment.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+ String customText = ResourceManager.getString("String_ChooseInstallationType5");
+ PanelLabel customComment = new PanelLabel(customText, true);
+ if ( data.useRtl() ) { customComment.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ ButtonGroup group = new ButtonGroup();
+
+ String typicalButtonText = ResourceManager.getString("String_ChooseInstallationType6");
+ typical = new JRadioButton(typicalButtonText, true);
+ typical.setMnemonic(KeyEvent.VK_C);
+ if ( data.useRtl() ) { typical.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ String customButtonText = ResourceManager.getString("String_ChooseInstallationType7");
+ custom = new JRadioButton(customButtonText, false);
+ custom.setMnemonic(KeyEvent.VK_U);
+ if ( data.useRtl() ) { custom.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ group.add(typical);
+ group.add(custom);
+
+ constraints.gridx = 0;
+ constraints.gridy = 0;
+ constraints.weightx = 0;
+ constraints.weighty = 1;
+ constraints.fill = GridBagConstraints.VERTICAL;
+
+ contentPanel.add(new JPanel(), constraints);
+
+ constraints.gridx = 0;
+ constraints.gridy = 1;
+ constraints.weightx = 0;
+ constraints.weighty = 0;
+ constraints.fill = GridBagConstraints.HORIZONTAL;
+
+ contentPanel.add(typical, constraints);
+
+ constraints.gridx = 1;
+ constraints.gridy = 1;
+ constraints.weightx = 1;
+ constraints.weighty = 0;
+ constraints.fill = GridBagConstraints.HORIZONTAL;
+
+ contentPanel.add(typicalComment, constraints);
+
+ constraints.gridx = 0;
+ constraints.gridy = 2;
+ constraints.weightx = 0;
+ constraints.weighty = 1;
+ constraints.fill = GridBagConstraints.VERTICAL;
+
+ contentPanel.add(new JPanel(), constraints);
+
+ constraints.gridx = 0;
+ constraints.gridy = 3;
+ constraints.weightx = 0;
+ constraints.weighty = 0;
+ constraints.fill = GridBagConstraints.HORIZONTAL;
+
+ contentPanel.add(custom, constraints);
+
+ constraints.gridx = 1;
+ constraints.gridy = 3;
+ constraints.weightx = 1;
+ constraints.weighty = 0;
+ constraints.fill = GridBagConstraints.HORIZONTAL;
+
+ contentPanel.add(customComment, constraints);
+
+ constraints.gridx = 0;
+ constraints.gridy = 4;
+ constraints.weightx = 0;
+ constraints.weighty = 1;
+ constraints.fill = GridBagConstraints.VERTICAL;
+
+ contentPanel.add(new JPanel(), constraints);
+
+ add(contentPanel, BorderLayout.CENTER);
+ }
+
+ public void setActionListener(ChooseInstallationTypeCtrl actionListener) {
+ typical.addActionListener(actionListener);
+ custom.addActionListener(actionListener);
+ }
+
+ public void removeActionListener(ChooseInstallationTypeCtrl actionListener) {
+ typical.removeActionListener(actionListener);
+ custom.removeActionListener(actionListener);
+ }
+
+ public void setTypicalActionCommand(String typicalActionCommand) {
+ typical.setActionCommand(typicalActionCommand);
+ }
+
+ public void setCustomActionCommand(String customActionCommand) {
+ custom.setActionCommand(customActionCommand);
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseUninstallationComponents.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseUninstallationComponents.java
new file mode 100755
index 000000000000..81de5505bc3c
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseUninstallationComponents.java
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Panel;
+
+import org.openoffice.setup.PanelHelper.PanelLabel;
+import org.openoffice.setup.PanelHelper.PanelTitle;
+import org.openoffice.setup.PanelHelper.TreeNodeRenderer;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupData.DisplayPackageDescription;
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import java.awt.BorderLayout;
+import java.awt.ComponentOrientation;
+import java.awt.Insets;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import javax.swing.BorderFactory;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTree;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreePath;
+import javax.swing.tree.TreeSelectionModel;
+import org.openoffice.setup.InstallData;
+
+
+public class ChooseUninstallationComponents extends JPanel implements MouseListener, KeyListener, TreeSelectionListener {
+
+ private JTree componentTree;
+ private PanelLabel descriptionLabel;
+ private PanelLabel sizeLabel;
+
+ private String sizeString;
+
+ public ChooseUninstallationComponents() {
+
+ InstallData data = InstallData.getInstance();
+
+ setLayout(new BorderLayout());
+ setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
+
+ String titleText = ResourceManager.getString("String_ChooseComponents1");
+ String subtitleText = ResourceManager.getString("String_ChooseUninstallationComponents2");
+ PanelTitle titleBox = new PanelTitle(titleText, subtitleText, 2, 40);
+ // PanelTitle titleBox = new PanelTitle(titleText, subtitleText);
+ titleBox.addVerticalStrut(20);
+ add(titleBox, BorderLayout.NORTH);
+
+ DefaultMutableTreeNode root = SetupDataProvider.createTree();
+
+ componentTree = new JTree(root);
+ componentTree.setShowsRootHandles(true);
+ componentTree.setRootVisible(false);
+ componentTree.setVisibleRowCount(3);
+ componentTree.setCellRenderer(new TreeNodeRenderer());
+ componentTree.addMouseListener( this );
+ componentTree.addKeyListener( this );
+ componentTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+ componentTree.addTreeSelectionListener(this);
+ // if ( data.useRtl() ) { componentTree.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ String BorderTitle = ResourceManager.getString("String_ChooseComponents3");
+ TitledBorder PanelBorder = BorderFactory.createTitledBorder(BorderTitle);
+
+ BorderLayout PanelLayout = new BorderLayout();
+ PanelLayout.setHgap(20);
+ JPanel DescriptionPanel = new JPanel();
+ DescriptionPanel.setBorder(PanelBorder);
+ DescriptionPanel.setLayout(PanelLayout);
+
+ String DescriptionText = "";
+ descriptionLabel = new PanelLabel(DescriptionText, 3, 20);
+ sizeString = ResourceManager.getString("String_ChooseComponents4");
+ sizeLabel = new PanelLabel(sizeString, 1, 5);
+ if ( data.useRtl() ) { descriptionLabel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ DescriptionPanel.add(descriptionLabel, BorderLayout.CENTER);
+ DescriptionPanel.add(sizeLabel, BorderLayout.EAST);
+ if ( data.useRtl() ) { DescriptionPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ add(new JScrollPane(componentTree), BorderLayout.CENTER);
+ add(DescriptionPanel, BorderLayout.SOUTH);
+ }
+
+ private void updateNode(DefaultMutableTreeNode node) {
+ if (node != null) {
+ DisplayPackageDescription nodeInfo = (DisplayPackageDescription)node.getUserObject();
+ nodeInfo.toggleState(node);
+
+ DefaultTreeModel model = (DefaultTreeModel)componentTree.getModel();
+ model.nodeChanged(node);
+
+ descriptionLabel.setText(nodeInfo.getDescription());
+ sizeLabel.setText(sizeString + nodeInfo.getSize());
+ }
+ }
+
+ /**
+ * Implement the MouseListener Interface
+ */
+ public void mouseClicked(MouseEvent event) {
+ }
+ public void mouseEntered(MouseEvent event) {
+ }
+ public void mouseExited(MouseEvent event) {
+ }
+ public void mousePressed(MouseEvent event) {
+ TreePath selPath = componentTree.getPathForLocation( event.getX(), event.getY() );
+ if ((selPath != null) && (componentTree.getPathBounds(selPath).getX() + 20 >= event.getX())) {
+ updateNode((DefaultMutableTreeNode)selPath.getLastPathComponent());
+ }
+ }
+ public void mouseReleased(MouseEvent e) {
+ }
+
+ /**
+ * Implement the KeyListener Interface
+ */
+ public void keyPressed(KeyEvent event) {
+ }
+ public void keyReleased(KeyEvent event) {
+ }
+ public void keyTyped(KeyEvent event) {
+ if ( event.getKeyChar() == ' ' ) {
+ TreePath selPath = componentTree.getAnchorSelectionPath();
+ if ( selPath != null ) {
+ updateNode((DefaultMutableTreeNode)selPath.getLastPathComponent());
+ }
+ }
+ }
+
+ /**
+ * Implement the TreeSelectionListener Interface.
+ */
+ public void valueChanged(TreeSelectionEvent event) {
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode)componentTree.getLastSelectedPathComponent();
+ if (node == null) {
+ descriptionLabel.setText("");
+ sizeLabel.setText("");
+ } else {
+ DisplayPackageDescription nodeInfo = (DisplayPackageDescription)node.getUserObject();
+
+ nodeInfo.updateSize(node); // important to set default values for nodes
+ DefaultTreeModel model = (DefaultTreeModel)componentTree.getModel();
+ model.nodeChanged(node);
+
+ descriptionLabel.setText(nodeInfo.getDescription());
+ sizeLabel.setText(sizeString + nodeInfo.getSize());
+ }
+ }
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseUninstallationType.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseUninstallationType.java
new file mode 100755
index 000000000000..45e29ba575de
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/ChooseUninstallationType.java
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Panel;
+
+import org.openoffice.setup.Controller.ChooseUninstallationTypeCtrl;
+import org.openoffice.setup.PanelHelper.PanelLabel;
+import org.openoffice.setup.PanelHelper.PanelTitle;
+import org.openoffice.setup.ResourceManager;
+import java.awt.BorderLayout;
+import java.awt.ComponentOrientation;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.KeyEvent;
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+import org.openoffice.setup.InstallData;
+
+public class ChooseUninstallationType extends JPanel {
+
+ private JRadioButton custom;
+ private JRadioButton complete;
+
+ public ChooseUninstallationType() {
+
+ InstallData data = InstallData.getInstance();
+
+ setLayout(new BorderLayout());
+ setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
+
+ String titleText = ResourceManager.getString("String_ChooseUninstallationType1");
+ String subtitleText = ResourceManager.getString("String_ChooseUninstallationType2");
+ PanelTitle titleBox = new PanelTitle(titleText, subtitleText);
+ titleBox.addVerticalStrut(20);
+ add(titleBox, BorderLayout.NORTH);
+
+ String borderTitle = ResourceManager.getString("String_ChooseUninstallationType1");
+ TitledBorder PanelBorder = BorderFactory.createTitledBorder(borderTitle);
+
+ JPanel contentPanel = new JPanel();
+ contentPanel.setBorder(PanelBorder);
+ contentPanel.setLayout(new GridBagLayout());
+ if ( data.useRtl() ) { contentPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ GridBagConstraints constraints = new GridBagConstraints();
+ constraints.insets = new Insets(0, 0, 0, 10);
+ // constraints.anchor = GridBagConstraints.NORTHWEST;
+
+ String completeText = ResourceManager.getString("String_ChooseUninstallationType4");
+ PanelLabel completeComment = new PanelLabel(completeText, true);
+ if ( data.useRtl() ) { completeComment.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+ String customText = ResourceManager.getString("String_ChooseUninstallationType5");
+ PanelLabel customComment = new PanelLabel(customText, true);
+ if ( data.useRtl() ) { customComment.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ ButtonGroup group = new ButtonGroup();
+
+ String completeButtonText = ResourceManager.getString("String_ChooseUninstallationType6");
+ complete = new JRadioButton(completeButtonText, true);
+ complete.setMnemonic(KeyEvent.VK_C);
+ if ( data.useRtl() ) { complete.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+ String customButtonText = ResourceManager.getString("String_ChooseUninstallationType3");
+ custom = new JRadioButton(customButtonText, false);
+ custom.setMnemonic(KeyEvent.VK_U);
+ if ( data.useRtl() ) { custom.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ group.add(complete);
+ group.add(custom);
+
+ constraints.gridx = 0;
+ constraints.gridy = 0;
+ constraints.weightx = 0;
+ constraints.weighty = 1;
+ constraints.fill = GridBagConstraints.VERTICAL;
+
+ contentPanel.add(new JPanel(), constraints);
+
+ constraints.gridx = 0;
+ constraints.gridy = 1;
+ constraints.weightx = 0;
+ constraints.weighty = 0;
+ constraints.fill = GridBagConstraints.HORIZONTAL;
+
+ contentPanel.add(complete, constraints);
+
+ constraints.gridx = 1;
+ constraints.gridy = 1;
+ constraints.weightx = 1;
+ constraints.weighty = 0;
+ constraints.fill = GridBagConstraints.HORIZONTAL;
+
+ contentPanel.add(completeComment, constraints);
+
+ constraints.gridx = 0;
+ constraints.gridy = 2;
+ constraints.weightx = 0;
+ constraints.weighty = 1;
+ constraints.fill = GridBagConstraints.VERTICAL;
+
+ contentPanel.add(new JPanel(), constraints);
+
+ constraints.gridx = 0;
+ constraints.gridy = 3;
+ constraints.weightx = 0;
+ constraints.weighty = 0;
+ constraints.fill = GridBagConstraints.HORIZONTAL;
+
+ contentPanel.add(custom, constraints);
+
+ constraints.gridx = 1;
+ constraints.gridy = 3;
+ constraints.weightx = 1;
+ constraints.weighty = 0;
+ constraints.fill = GridBagConstraints.HORIZONTAL;
+
+ contentPanel.add(customComment, constraints);
+
+ constraints.gridx = 0;
+ constraints.gridy = 4;
+ constraints.weightx = 0;
+ constraints.weighty = 1;
+ constraints.fill = GridBagConstraints.VERTICAL;
+
+ contentPanel.add(new JPanel(), constraints);
+
+ add(contentPanel, BorderLayout.CENTER);
+ }
+
+ public void setActionListener(ChooseUninstallationTypeCtrl actionListener) {
+ complete.addActionListener(actionListener);
+ custom.addActionListener(actionListener);
+ }
+
+ public void removeActionListener(ChooseUninstallationTypeCtrl actionListener) {
+ complete.removeActionListener(actionListener);
+ custom.removeActionListener(actionListener);
+ }
+
+ public void setCompleteActionCommand(String completeActionCommand) {
+ complete.setActionCommand(completeActionCommand);
+ }
+
+ public void setCustomActionCommand(String customActionCommand) {
+ custom.setActionCommand(customActionCommand);
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/InstallationImminent.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/InstallationImminent.java
new file mode 100755
index 000000000000..7fda225f55d9
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/InstallationImminent.java
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Panel;
+
+import org.openoffice.setup.PanelHelper.PanelLabel;
+import org.openoffice.setup.PanelHelper.PanelTitle;
+import org.openoffice.setup.ResourceManager;
+import java.awt.BorderLayout;
+import java.awt.ComponentOrientation;
+import java.awt.Dimension;
+import java.awt.Insets;
+import javax.swing.JEditorPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollBar;
+import javax.swing.JScrollPane;
+import javax.swing.border.EmptyBorder;
+import org.openoffice.setup.InstallData;
+
+public class InstallationImminent extends JPanel {
+
+ private String infoText;
+ private JEditorPane ProductInformation;
+ private JScrollPane ProductPane;
+ private PanelTitle titlebox;
+
+ public InstallationImminent() {
+
+ InstallData data = InstallData.getInstance();
+
+ setLayout(new java.awt.BorderLayout());
+ setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
+
+ String titletext = ResourceManager.getString("String_InstallationImminent1");
+ titlebox = new PanelTitle(titletext);
+ add(titlebox, BorderLayout.NORTH);
+
+ JPanel contentpanel = new JPanel();
+ contentpanel.setLayout(new java.awt.BorderLayout());
+ if ( data.useRtl() ) { contentpanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ String text1 = ResourceManager.getString("String_InstallationImminent2");
+ PanelLabel label1 = new PanelLabel(text1);
+ if ( data.useRtl() ) { label1.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ ProductInformation = new JEditorPane("text/html", getInfoText());
+ ProductInformation.setEditable(false);
+ if ( data.useRtl() ) { ProductInformation.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ ProductPane = new JScrollPane(ProductInformation);
+ ProductPane.setPreferredSize(new Dimension(250, 145));
+ ProductPane.setBorder(new EmptyBorder(10, 0, 10, 0));
+ if ( data.useRtl() ) { ProductPane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ contentpanel.add(label1, BorderLayout.NORTH);
+ contentpanel.add(ProductPane, BorderLayout.CENTER);
+
+ add(contentpanel, BorderLayout.CENTER);
+ }
+
+ public void setInfoText(String text) {
+ infoText = text;
+ updateInfoText();
+ }
+
+ public void setTitleText(String s) {
+ titlebox.setTitle(s);
+ }
+
+ public String getInfoText() {
+ return infoText;
+ }
+
+ public void updateInfoText() {
+ ProductInformation.setText(infoText);
+ }
+
+ public void setTabOrder() {
+ JScrollBar ScrollBar = ProductPane.getVerticalScrollBar();
+ if ( ScrollBar.isShowing() ) {
+ ProductInformation.setFocusable(true);
+ } else {
+ ProductInformation.setFocusable(false);
+ }
+ }
+
+ public void setCaretPosition() {
+ ProductInformation.setCaretPosition(0);
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/InstallationOngoing.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/InstallationOngoing.java
new file mode 100755
index 000000000000..7daf033ab3bd
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/InstallationOngoing.java
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Panel;
+
+import org.openoffice.setup.PanelHelper.PanelLabel;
+import org.openoffice.setup.PanelHelper.PanelTitle;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupActionListener;
+import java.awt.BorderLayout;
+import java.awt.ComponentOrientation;
+import java.awt.Container;
+import java.awt.Insets;
+import javax.swing.Box;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JProgressBar;
+import javax.swing.border.EmptyBorder;
+import org.openoffice.setup.InstallData;
+
+public class InstallationOngoing extends JPanel {
+
+ private PanelLabel currentProgress;
+ private JProgressBar progressBar;
+ private JButton mStopButton;
+ private String mTitle = "";
+ private PanelTitle mTitlebox;
+
+ public InstallationOngoing() {
+
+ InstallData data = InstallData.getInstance();
+
+ setLayout(new java.awt.BorderLayout());
+ setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
+
+ // String titleText = ResourceManager.getString("String_InstallationOngoing1");
+ // PanelTitle titlebox = new PanelTitle(titleText);
+ // PanelTitle titlebox = new PanelTitle(mTitle);
+ mTitlebox = new PanelTitle(mTitle);
+ mTitlebox.addVerticalStrut(20);
+ add(mTitlebox, BorderLayout.NORTH);
+
+ Container contentbox = Box.createVerticalBox();
+ if ( data.useRtl() ) { contentbox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ // String progressText = ResourceManager.getString("String_InstallationOngoing2");
+ String progressText = "";
+ currentProgress = new PanelLabel(progressText);
+
+ Container innerbox = Box.createHorizontalBox();
+ if ( data.useRtl() ) { innerbox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+ progressBar = new JProgressBar(0, 100);
+ if ( data.useRtl() ) { progressBar.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+ mStopButton = new JButton();
+ String progressButtonText = ResourceManager.getString("String_InstallationOngoing3");
+ mStopButton.setText(progressButtonText);
+ mStopButton.setEnabled(true);
+ if ( data.useRtl() ) { mStopButton.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ innerbox.add(progressBar);
+ innerbox.add(Box.createHorizontalStrut(10));
+ innerbox.add(mStopButton);
+
+ contentbox.add(currentProgress);
+ contentbox.add(Box.createVerticalStrut(10));
+ contentbox.add(innerbox);
+ contentbox.add(Box.createVerticalStrut(20));
+
+ add(contentbox, BorderLayout.SOUTH);
+ }
+
+ public void setProgressText(String s) {
+ currentProgress.setText(s);
+ }
+
+ public void setProgressValue(int i) {
+ progressBar.setValue(i);
+ }
+
+ public void setTitle(String title) {
+ mTitlebox.setTitle(title);
+ mTitle = title;
+ }
+
+ public void setStopButtonActionCommand(String actionCommand) {
+ mStopButton.setActionCommand(actionCommand);
+ }
+
+ public void addStopButtonActionListener(SetupActionListener actionListener) {
+ mStopButton.addActionListener(actionListener);
+ }
+
+ public void setStopButtonEnabled(boolean enabled) {
+ mStopButton.setEnabled(enabled);
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/Prologue.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/Prologue.java
new file mode 100755
index 000000000000..5209c98241ee
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/Prologue.java
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Panel;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.PanelHelper.PanelLabel;
+import org.openoffice.setup.PanelHelper.PanelTitle;
+import org.openoffice.setup.ResourceManager;
+import java.awt.BorderLayout;
+import java.awt.ComponentOrientation;
+import java.awt.Insets;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+
+public class Prologue extends JPanel {
+
+ public Prologue() {
+
+ InstallData data = InstallData.getInstance();
+
+ setLayout(new java.awt.BorderLayout());
+ setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
+
+ String titleText = ResourceManager.getString("String_Prologue1");
+ PanelTitle titleBox = new PanelTitle(titleText);
+ if ( data.useRtl() ) { titleBox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+ add(titleBox, BorderLayout.NORTH);
+
+ JPanel contentPanel = new JPanel();
+ contentPanel.setLayout(new java.awt.BorderLayout());
+
+ String text1 = ResourceManager.getString("String_Prologue2");
+ PanelLabel label1 = new PanelLabel(text1, true);
+ if ( data.useRtl() ) { label1.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+ String text2 = ResourceManager.getString("String_Prologue3");
+ PanelLabel label2 = new PanelLabel(text2);
+ if ( data.useRtl() ) { label2.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ contentPanel.add(label1, BorderLayout.NORTH);
+ contentPanel.add(label2, BorderLayout.CENTER);
+
+ if ( data.isUserInstallation() ) {
+ String text3 = ResourceManager.getString("String_Prologue4");
+ PanelLabel label3 = new PanelLabel(text3, true);
+ if ( data.useRtl() ) { label3.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+ contentPanel.add(label3, BorderLayout.SOUTH);
+ }
+
+ add(contentPanel, BorderLayout.CENTER);
+ }
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/UninstallationCompleted.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/UninstallationCompleted.java
new file mode 100755
index 000000000000..1c724fc47c86
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/UninstallationCompleted.java
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Panel;
+
+import org.openoffice.setup.PanelHelper.PanelLabel;
+import org.openoffice.setup.PanelHelper.PanelTitle;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupActionListener;
+import java.awt.BorderLayout;
+import java.awt.ComponentOrientation;
+import java.awt.Dimension;
+import java.awt.Insets;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+import org.openoffice.setup.InstallData;
+
+public class UninstallationCompleted extends JPanel {
+
+ public static final String ACTION_DETAILS = "ActionDetails";
+ public static final int BUTTON_DETAILS = 5;
+ private JButton mDetailsButton;
+ private PanelLabel varLabel;
+ private PanelTitle titleBox;
+
+ public UninstallationCompleted() {
+
+ InstallData data = InstallData.getInstance();
+
+ setLayout(new java.awt.BorderLayout());
+ setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
+
+ String titleText = ResourceManager.getString("String_UninstallationCompleted1");
+ titleBox = new PanelTitle(titleText);
+ add(titleBox, BorderLayout.NORTH);
+
+ JPanel contentPanel = new JPanel();
+ contentPanel.setLayout(new java.awt.BorderLayout());
+ if ( data.useRtl() ) { contentPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ String dialogText = ResourceManager.getString("String_UninstallationCompleted2");
+ varLabel = new PanelLabel(dialogText, true);
+ String text2 = ResourceManager.getString("String_InstallationCompleted3");
+ PanelLabel label2 = new PanelLabel(text2);
+ if ( data.useRtl() ) { label2.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ mDetailsButton = new JButton();
+ String buttonText = ResourceManager.getString("String_InstallationCompleted_Button");
+ mDetailsButton.setText(buttonText);
+ mDetailsButton.setEnabled(true);
+ if ( data.useRtl() ) { mDetailsButton.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ JPanel ButtonPanel = new JPanel();
+ ButtonPanel.setLayout(new BorderLayout());
+ ButtonPanel.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
+ ButtonPanel.setPreferredSize(new Dimension(120, 44));
+ ButtonPanel.add(mDetailsButton, BorderLayout.NORTH);
+ if ( data.useRtl() ) { ButtonPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ contentPanel.add(varLabel, BorderLayout.NORTH);
+ contentPanel.add(ButtonPanel, BorderLayout.EAST);
+ contentPanel.add(label2, BorderLayout.CENTER);
+
+ add(contentPanel, BorderLayout.CENTER);
+ }
+
+ public void setDetailsButtonActionCommand(String actionCommand) {
+ mDetailsButton.setActionCommand(actionCommand);
+ }
+
+ public void addDetailsButtonActionListener(SetupActionListener actionListener) {
+ mDetailsButton.addActionListener(actionListener);
+ }
+
+ public void setTitleText(String s) {
+ titleBox.setTitle(s);
+ }
+
+ public void setDialogText(String text) {
+ varLabel.setText(text);
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/UninstallationImminent.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/UninstallationImminent.java
new file mode 100755
index 000000000000..fdef8958a676
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/UninstallationImminent.java
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Panel;
+
+import org.openoffice.setup.PanelHelper.PanelLabel;
+import org.openoffice.setup.PanelHelper.PanelTitle;
+import org.openoffice.setup.ResourceManager;
+import java.awt.BorderLayout;
+import java.awt.ComponentOrientation;
+import java.awt.Dimension;
+import java.awt.Insets;
+import javax.swing.JEditorPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollBar;
+import javax.swing.JScrollPane;
+import javax.swing.border.EmptyBorder;
+import org.openoffice.setup.InstallData;
+
+public class UninstallationImminent extends JPanel {
+
+ private String infoText;
+ private JEditorPane ProductInformation;
+ private JScrollPane ProductPane;
+
+ public UninstallationImminent() {
+
+ InstallData data = InstallData.getInstance();
+
+ setLayout(new java.awt.BorderLayout());
+ setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
+
+ String titletext = ResourceManager.getString("String_UninstallationImminent1");
+ PanelTitle titlebox = new PanelTitle(titletext);
+ add(titlebox, BorderLayout.NORTH);
+
+ JPanel contentpanel = new JPanel();
+ contentpanel.setLayout(new java.awt.BorderLayout());
+ if ( data.useRtl() ) { contentpanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ String text1 = ResourceManager.getString("String_UninstallationImminent2");
+ PanelLabel label1 = new PanelLabel(text1);
+ if ( data.useRtl() ) { label1.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ ProductInformation = new JEditorPane("text/html", getInfoText());
+ ProductInformation.setEditable(false);
+ if ( data.useRtl() ) { ProductInformation.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ ProductPane = new JScrollPane(ProductInformation);
+ ProductPane.setPreferredSize(new Dimension(250, 145));
+ ProductPane.setBorder(new EmptyBorder(10, 0, 10, 0));
+ if ( data.useRtl() ) { ProductPane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ contentpanel.add(label1, BorderLayout.NORTH);
+ contentpanel.add(ProductPane, BorderLayout.CENTER);
+
+ add(contentpanel, BorderLayout.CENTER);
+ }
+
+ public void setInfoText(String text) {
+ infoText = text;
+ updateInfoText();
+ }
+
+ public String getInfoText() {
+ return infoText;
+ }
+
+ public void updateInfoText() {
+ ProductInformation.setText(infoText);
+ }
+
+ public void setTabOrder() {
+ JScrollBar ScrollBar = ProductPane.getVerticalScrollBar();
+ if ( ScrollBar.isShowing() ) {
+ ProductInformation.setFocusable(true);
+ } else {
+ ProductInformation.setFocusable(false);
+ }
+ }
+
+ public void setCaretPosition() {
+ ProductInformation.setCaretPosition(0);
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/UninstallationOngoing.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/UninstallationOngoing.java
new file mode 100755
index 000000000000..6934308d6b47
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/UninstallationOngoing.java
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Panel;
+
+import org.openoffice.setup.PanelHelper.PanelLabel;
+import org.openoffice.setup.PanelHelper.PanelTitle;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupActionListener;
+import java.awt.BorderLayout;
+import java.awt.ComponentOrientation;
+import java.awt.Container;
+import java.awt.Insets;
+import javax.swing.Box;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JProgressBar;
+import javax.swing.border.EmptyBorder;
+import org.openoffice.setup.InstallData;
+
+public class UninstallationOngoing extends JPanel {
+
+ private PanelLabel currentProgress;
+ private JProgressBar progressBar;
+ private JButton mStopButton;
+
+ public UninstallationOngoing() {
+
+ InstallData data = InstallData.getInstance();
+
+ setLayout(new java.awt.BorderLayout());
+ setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
+
+ String titleText = ResourceManager.getString("String_UninstallationOngoing1");
+ PanelTitle titlebox = new PanelTitle(titleText);
+ titlebox.addVerticalStrut(20);
+ add(titlebox, BorderLayout.NORTH);
+
+ Container contentbox = Box.createVerticalBox();
+ if ( data.useRtl() ) { contentbox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ // String progressText = ResourceManager.getString("String_UninstallationOngoing2");
+ String progressText = "";
+ currentProgress = new PanelLabel(progressText);
+
+ Container innerbox = Box.createHorizontalBox();
+ if ( data.useRtl() ) { innerbox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ progressBar = new JProgressBar(0, 100);
+ if ( data.useRtl() ) { progressBar.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+ mStopButton = new JButton();
+ if ( data.useRtl() ) { mStopButton.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+ String progressButtonText = ResourceManager.getString("String_InstallationOngoing3");
+ mStopButton.setText(progressButtonText);
+ mStopButton.setEnabled(true);
+
+ innerbox.add(progressBar);
+ innerbox.add(Box.createHorizontalStrut(10));
+ innerbox.add(mStopButton);
+
+ contentbox.add(currentProgress);
+ contentbox.add(Box.createVerticalStrut(10));
+ contentbox.add(innerbox);
+ contentbox.add(Box.createVerticalStrut(20));
+
+ add(contentbox, BorderLayout.SOUTH);
+ }
+
+ public void setProgressText(String s) {
+ currentProgress.setText(s);
+ }
+
+ public void setProgressValue(int i) {
+ progressBar.setValue(i);
+ }
+
+ public void setStopButtonActionCommand(String actionCommand) {
+ mStopButton.setActionCommand(actionCommand);
+ }
+
+ public void addStopButtonActionListener(SetupActionListener actionListener) {
+ mStopButton.addActionListener(actionListener);
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/UninstallationPrologue.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/UninstallationPrologue.java
new file mode 100755
index 000000000000..d8ec108298b4
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/UninstallationPrologue.java
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Panel;
+
+import org.openoffice.setup.PanelHelper.PanelLabel;
+import org.openoffice.setup.PanelHelper.PanelTitle;
+import org.openoffice.setup.ResourceManager;
+import java.awt.BorderLayout;
+import java.awt.Insets;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+
+public class UninstallationPrologue extends JPanel {
+
+ public UninstallationPrologue() {
+
+ setLayout(new java.awt.BorderLayout());
+ setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
+
+ String titleText = ResourceManager.getString("String_Prologue1");
+ PanelTitle titleBox = new PanelTitle(titleText);
+ add(titleBox, BorderLayout.NORTH);
+
+ JPanel contentPanel = new JPanel();
+ contentPanel.setLayout(new java.awt.BorderLayout());
+
+ String text1 = ResourceManager.getString("String_UninstallationPrologue2");
+ PanelLabel label1 = new PanelLabel(text1, true);
+ String text2 = ResourceManager.getString("String_Prologue3");
+ PanelLabel label2 = new PanelLabel(text2);
+
+ contentPanel.add(label1, BorderLayout.NORTH);
+ contentPanel.add(label2, BorderLayout.CENTER);
+
+ add(contentPanel, BorderLayout.CENTER);
+ }
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/installationCompleted.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/installationCompleted.java
new file mode 100755
index 000000000000..e34636da8d6f
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Panel/installationCompleted.java
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Panel;
+
+import org.openoffice.setup.PanelHelper.PanelLabel;
+import org.openoffice.setup.PanelHelper.PanelTitle;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupActionListener;
+import java.awt.BorderLayout;
+import java.awt.ComponentOrientation;
+import java.awt.Dimension;
+import java.awt.Insets;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+import org.openoffice.setup.InstallData;
+
+public class installationCompleted extends JPanel {
+
+ public static final String ACTION_DETAILS = "ActionDetails";
+ public static final int BUTTON_DETAILS = 5;
+ private JButton mDetailsButton;
+ private PanelLabel varLabel;
+ private PanelTitle titleBox;
+
+ public installationCompleted() {
+
+ InstallData data = InstallData.getInstance();
+
+ setLayout(new java.awt.BorderLayout());
+ setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
+
+ String titleText = ResourceManager.getString("String_InstallationCompleted1");
+ titleBox = new PanelTitle(titleText);
+ add(titleBox, BorderLayout.NORTH);
+
+ JPanel contentPanel = new JPanel();
+ contentPanel.setLayout(new java.awt.BorderLayout());
+ if ( data.useRtl() ) { contentPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ String dialogText = ResourceManager.getString("String_InstallationCompleted2");
+ varLabel = new PanelLabel(dialogText, true);
+ String text2 = ResourceManager.getString("String_InstallationCompleted3");
+ PanelLabel label2 = new PanelLabel(text2);
+ if ( data.useRtl() ) { label2.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ mDetailsButton = new JButton();
+ String buttonText = ResourceManager.getString("String_InstallationCompleted_Button");
+ mDetailsButton.setText(buttonText);
+ mDetailsButton.setEnabled(true);
+ if ( data.useRtl() ) { mDetailsButton.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ JPanel ButtonPanel = new JPanel();
+ ButtonPanel.setLayout(new BorderLayout());
+ ButtonPanel.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
+ ButtonPanel.setPreferredSize(new Dimension(120, 44));
+ ButtonPanel.add(mDetailsButton, BorderLayout.NORTH);
+ if ( data.useRtl() ) { ButtonPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ contentPanel.add(varLabel, BorderLayout.NORTH);
+ contentPanel.add(ButtonPanel, BorderLayout.EAST);
+ contentPanel.add(label2, BorderLayout.CENTER);
+
+ add(contentPanel, BorderLayout.CENTER);
+ }
+
+ public void setDetailsButtonActionCommand(String actionCommand) {
+ mDetailsButton.setActionCommand(actionCommand);
+ }
+
+ public void addDetailsButtonActionListener(SetupActionListener actionListener) {
+ mDetailsButton.addActionListener(actionListener);
+ }
+
+ public void setTitleText(String s) {
+ titleBox.setTitle(s);
+ }
+
+ public void setDialogText(String text) {
+ varLabel.setText(text);
+ }
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelController.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelController.java
new file mode 100755
index 000000000000..51a063e9ebd4
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelController.java
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup;
+
+import javax.swing.JPanel;
+
+public abstract class PanelController {
+
+ private SetupFrame frame;
+ private JPanel panel;
+ private String name;
+ private String next;
+ private String prev;
+
+ private PanelController () {
+ }
+
+ public PanelController (String name, JPanel panel) {
+ this.name = name;
+ this.panel = panel;
+ }
+
+ public final JPanel getPanel () {
+ return this.panel;
+ }
+
+ public final void setPanel (JPanel panel) {
+ this.panel = panel;
+ }
+
+ public final String getName () {
+ return this.name;
+ }
+
+ public final void setName (String name) {
+ this.name = name;
+ }
+
+ final void setSetupFrame (SetupFrame frame) {
+ this.frame = frame;
+ }
+
+ public final SetupFrame getSetupFrame () {
+ return this.frame;
+ }
+
+ public String getNext () {
+ return null;
+ }
+
+ public String getDialogText () {
+ return null;
+ }
+
+ public String getPrevious () {
+ return null;
+ }
+
+ public void beforeShow () {
+ }
+
+ public void duringShow () {
+ }
+
+ public boolean afterShow (boolean nextButtonPressed) {
+ boolean repeatDialog = false;
+ return repeatDialog;
+ }
+
+ public abstract String getHelpFileName();
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/PanelLabel.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/PanelLabel.java
new file mode 100755
index 000000000000..4fec3cfdb1c5
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/PanelLabel.java
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.PanelHelper;
+
+import java.awt.Color;
+import java.awt.ComponentOrientation;
+import java.awt.Font;
+import javax.swing.JTextArea;
+import javax.swing.UIManager;
+import org.openoffice.setup.InstallData;
+
+public class PanelLabel extends JTextArea {
+
+ static private Color BackgroundColor;
+ static private Color TextColor;
+ static private Font TextFont;
+
+ public PanelLabel() {
+ }
+
+ public PanelLabel(String text, int rows, int columns) {
+ super(text, rows, columns);
+ init(true);
+ }
+
+ public PanelLabel(String text, boolean multiline) {
+ super(text);
+ init(multiline);
+ }
+
+ public PanelLabel(String text) {
+ super(text);
+ init(false);
+ }
+
+ private void init(boolean multiline) {
+ setEditable(false);
+ setBackground(BackgroundColor);
+ setForeground(TextColor);
+ setFont(TextFont);
+ setFocusable(false);
+
+ InstallData data = InstallData.getInstance();
+ if ( data.useRtl() ) { setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); }
+
+ if (multiline) {
+ setLineWrap(true);
+ setWrapStyleWord(true);
+ }
+ }
+
+ static {
+ BackgroundColor = (Color)UIManager.get("Label.background");
+ TextColor = (Color)UIManager.get("Label.foreground");
+ TextFont = ((Font)UIManager.get("Label.font")).deriveFont(Font.PLAIN);
+ }
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/PanelTitle.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/PanelTitle.java
new file mode 100755
index 000000000000..6b383473e541
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/PanelTitle.java
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.PanelHelper;
+
+import java.awt.ComponentOrientation;
+import java.awt.FlowLayout;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JSeparator;
+import org.openoffice.setup.InstallData;
+
+public class PanelTitle extends Box {
+
+ private JLabel TitleLabel;
+
+ public PanelTitle() {
+ super(BoxLayout.PAGE_AXIS);
+ }
+
+ public PanelTitle(String title, String subtitle, int rows, int columns) {
+ super(BoxLayout.PAGE_AXIS);
+ init(title, subtitle, rows, columns);
+ }
+
+ public PanelTitle(String title, String subtitle) {
+ super(BoxLayout.PAGE_AXIS);
+ init(title, subtitle, 0, 0);
+ }
+
+ public PanelTitle(String title) {
+ super (BoxLayout.PAGE_AXIS);
+ init(title, null, 0, 0);
+ }
+
+ public void addVerticalStrut(int strut) {
+ add(createVerticalStrut(strut));
+ }
+
+ public void setTitle(String title) {
+ TitleLabel.setText(title);
+ }
+
+ // public void setSubtitle(String subtitle) {
+ // SubtitleLabel.setText(subtitle);
+ // }
+
+ private void init(String title, String subtitle, int rows, int columns) {
+
+ InstallData data = InstallData.getInstance();
+
+ TitleLabel = new JLabel(title);
+ TitleLabel.setFocusable(false);
+ JPanel TitlePanel = new JPanel();
+ if ( data.useRtl() ) {
+ TitlePanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
+ TitleLabel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ } else {
+ TitlePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
+ }
+ TitlePanel.add(TitleLabel);
+
+ add(createVerticalStrut(10));
+ add(TitlePanel);
+ add(createVerticalStrut(10));
+ add(new JSeparator());
+ add(createVerticalStrut(20));
+
+ if (subtitle != null) {
+ PanelLabel SubtitleLabel = null;
+ if ( rows > 0 ) {
+ SubtitleLabel = new PanelLabel(subtitle, rows, columns );
+ } else {
+ SubtitleLabel = new PanelLabel(subtitle);
+ }
+ SubtitleLabel.setFocusable(false);
+ // PanelLabel SubtitleLabel = new PanelLabel(subtitle, true);
+ JPanel SubtitlePanel = new JPanel();
+ if ( data.useRtl() ) {
+ SubtitlePanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
+ SubtitleLabel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ } else {
+ SubtitlePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
+ }
+ SubtitlePanel.add(SubtitleLabel);
+
+ add(SubtitlePanel);
+ }
+ }
+} \ No newline at end of file
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/TreeNodeRenderer.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/TreeNodeRenderer.java
new file mode 100755
index 000000000000..7b9253d60ba8
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/PanelHelper/TreeNodeRenderer.java
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.PanelHelper;
+
+import org.openoffice.setup.SetupData.DisplayPackageDescription;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.ResourceManager;
+import java.awt.Component;
+import javax.swing.ImageIcon;
+import javax.swing.JTree;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeCellRenderer;
+
+public class TreeNodeRenderer extends DefaultTreeCellRenderer {
+
+ ImageIcon InstallIcon;
+ ImageIcon InstalledIcon;
+ ImageIcon DontInstallIcon;
+ ImageIcon DontKnowIcon;
+ ImageIcon RemoveIcon;
+
+ public TreeNodeRenderer() {
+ InstallIcon = ResourceManager.getIcon("Icon_Install");
+ InstalledIcon = ResourceManager.getIcon("Icon_Installed");
+ DontInstallIcon = ResourceManager.getIcon("Icon_DontInstall");
+ DontKnowIcon = ResourceManager.getIcon("Icon_DontKnow");
+ RemoveIcon = ResourceManager.getIcon("Icon_Remove");
+ }
+
+ public Component getTreeCellRendererComponent(
+ JTree tree, Object value, boolean sel, boolean expanded,
+ boolean leaf, int row, boolean hasFocus) {
+
+ super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
+
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
+ Object nodeObject = node.getUserObject();
+
+ if (DisplayPackageDescription.is(nodeObject)) {
+ DisplayPackageDescription nodeInfo = (DisplayPackageDescription)nodeObject;
+
+ switch (nodeInfo.getState()) {
+ case PackageDescription.INSTALL: setIcon(InstallIcon); break;
+ case PackageDescription.DONT_REMOVE: setIcon(InstallIcon); break;
+ case PackageDescription.IGNORE: setIcon(InstalledIcon); break;
+ case PackageDescription.INSTALL_SOME: setIcon(DontKnowIcon); break;
+ case PackageDescription.REMOVE_SOME: setIcon(DontKnowIcon); break;
+ case PackageDescription.DONT_INSTALL: setIcon(DontInstallIcon); break;
+ case PackageDescription.REMOVE: setIcon(RemoveIcon); break;
+ default: setIcon(InstalledIcon); break;
+ }
+ }
+
+ if (sel) {
+ setBackground(super.getBackgroundSelectionColor());
+ setForeground(textSelectionColor);
+ } else {
+ setBackground(super.getBackgroundNonSelectionColor());
+ setForeground(textSelectionColor);
+ }
+
+ return this;
+ }
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/ResourceManager.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/ResourceManager.java
new file mode 100755
index 000000000000..e0c28b96b512
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/ResourceManager.java
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup;
+
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
+import java.util.ResourceBundle;
+import javax.swing.ImageIcon;
+
+public class ResourceManager {
+
+ static PropertyResourceBundle stringResourceBundle;
+ static PropertyResourceBundle fileNameResourceBundle;
+ static HashMap setupFiles = new HashMap(); // required, because it is not possible to set values in fileNameResourceBundle
+
+ private ResourceManager() {
+ }
+
+ static public void checkFileExistence(File htmlDirectory) {
+
+ for (Enumeration e = fileNameResourceBundle.getKeys(); e.hasMoreElements(); ) {
+ String key = (String) e.nextElement();
+ String fileName = (String)(fileNameResourceBundle.getObject(key));
+
+ if ( ! fileName.endsWith("html") ) {
+ // no check of existence for non-html files
+ setupFiles.put(key, fileName);
+ // System.err.println("Using file: " + fileName);
+ }
+
+ if ( fileName.endsWith("html") ) {
+ boolean fileExists = true;
+
+ File file = new File(htmlDirectory, fileName);
+ File newFile = null;
+
+ if ( file.exists() ) {
+ setupFiles.put(key, fileName);
+ // System.err.println("Using file: " + fileName);
+ } else {
+ fileExists = false;
+ // try to use english version
+ int pos1 = fileName.lastIndexOf("_");
+
+ if ( pos1 > 0 ) {
+ int pos2 = fileName.lastIndexOf(".");
+ String newFileName = fileName.substring(0, pos1) + fileName.substring(pos2, fileName.length());
+ newFile = new File(htmlDirectory, newFileName);
+ if ( newFile.exists() ) {
+ fileExists = true;
+ setupFiles.put(key, newFileName);
+ // System.err.println("Using file: " + fileName);
+ } else {
+ // Introducing fallback to a very special simple html page
+ String simplePage = "Excuse.html";
+ File simpleFile = new File(htmlDirectory, simplePage);
+ if ( simpleFile.exists() ) {
+ fileExists = true;
+ setupFiles.put(key, simplePage);
+ // System.err.println("Using file: " + fileName);
+ }
+ }
+ }
+ }
+
+ if ( ! fileExists ) {
+ if ( newFile != null ) {
+ System.err.println("ERROR: Neither file \"" + file.getPath() +
+ "\" nor file \"" + newFile.getPath() + "\" do exist!");
+ } else {
+ System.err.println("ERROR: File \"" + file.getPath() + "\" does not exist!");
+ }
+ System.exit(1);
+ }
+ }
+ }
+ }
+
+ static public String getString(String key) {
+ String value = (String)(stringResourceBundle.getObject(key));
+ if (value != null && (value.indexOf('$') >= 0)) {
+ value = SetupDataProvider.replaceMacros(value);
+ }
+ return value;
+ }
+
+ static public String getFileName(String key) {
+ String value = (String)setupFiles.get(key);
+ // String value = (String)(fileNameResourceBundle.getObject(key));
+ return value;
+ }
+
+ static public ImageIcon getIcon(String key) {
+
+ String name = getFileName(key);
+
+ try {
+ Class c = Class.forName("org.openoffice.setup.ResourceManager");
+ URL url = c.getResource(name);
+ if (url != null) {
+ return new ImageIcon(url);
+ } else {
+ System.err.println("Error: file not found: " + name);
+ }
+ } catch (ClassNotFoundException e) {
+ System.err.println(e);
+ }
+
+ return new ImageIcon();
+ }
+
+ static public ImageIcon getIconFromPath(File file) {
+
+ try {
+ URL url = file.toURL();
+ if (url != null) {
+ return new ImageIcon(url);
+ } else {
+ System.err.println("Error: file not found: " + file.getPath());
+ }
+ } catch (MalformedURLException e) {
+ System.err.println(e);
+ }
+
+ return new ImageIcon();
+ }
+
+ static {
+ Locale locale = Locale.getDefault();
+ System.err.println("System locale: " + locale );
+ try {
+ stringResourceBundle = (PropertyResourceBundle) ResourceBundle.getBundle("org.openoffice.setup.setupstrings", locale);
+ fileNameResourceBundle = (PropertyResourceBundle) ResourceBundle.getBundle("org.openoffice.setup.setupfiles", locale);
+ } catch (MissingResourceException ex) {
+ ex.printStackTrace();
+ System.exit(1);
+ }
+ }
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupActionListener.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupActionListener.java
new file mode 100755
index 000000000000..1fd8aa72ac2e
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupActionListener.java
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup;
+
+import org.openoffice.setup.Dialogs.DetailsDialog;
+import org.openoffice.setup.Dialogs.HelpDialog;
+import org.openoffice.setup.Util.AbortInstaller;
+import java.awt.Dimension;
+import java.awt.event.ActionListener;
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+
+public class SetupActionListener implements ActionListener {
+
+ private SetupFrame setupFrame;
+
+ public SetupActionListener(SetupFrame setup) {
+ setupFrame = setup;
+ }
+
+ public void actionPerformed (java.awt.event.ActionEvent evt) {
+ if (evt.getActionCommand().equals(SetupFrame.ACTION_CANCEL)) {
+ String StringCancelDialog;
+ String StringCancelDialogTitle;
+ InstallData data = InstallData.getInstance();
+ if ( data.isInstallationMode() ) {
+ StringCancelDialog = ResourceManager.getString("String_Cancel_Dialog");
+ } else {
+ StringCancelDialog = ResourceManager.getString("String_Cancel_Dialog_Uninstallation");
+ }
+ StringCancelDialogTitle = ResourceManager.getString("String_Cancel_Dialog_Title");
+ JDialog dialog = setupFrame.getDialog();
+ int n = JOptionPane.showConfirmDialog(dialog, StringCancelDialog, StringCancelDialogTitle,
+ JOptionPane.YES_NO_OPTION);
+ if ( n == 0 ) {
+ setupFrame.close(SetupFrame.CODE_CANCEL);
+ }
+ setupFrame.setButtonSelected(setupFrame.BUTTON_CANCEL);
+ } else if (evt.getActionCommand().equals(SetupFrame.ACTION_STOP)) {
+ String StringStopDialog;
+ String StringStopDialogTitle;
+ InstallData data = InstallData.getInstance();
+ if ( data.isInstallationMode() ) {
+ StringStopDialog = ResourceManager.getString("String_Stop_Dialog");
+ StringStopDialogTitle = ResourceManager.getString("String_Stop_Dialog_Title");
+ } else {
+ StringStopDialog = ResourceManager.getString("String_Stop_Dialog_Uninstallation");
+ StringStopDialogTitle = ResourceManager.getString("String_Stop_Dialog_Title_Uninstallation");
+ }
+ JDialog dialog = setupFrame.getDialog();
+ int n = JOptionPane.showConfirmDialog(dialog, StringStopDialog, StringStopDialogTitle,
+ JOptionPane.YES_NO_OPTION);
+ if ( n == 0 ) {
+ AbortInstaller.abortInstallProcess();
+ }
+ // setting focus on help button, if not aborted
+ setupFrame.setButtonSelected(setupFrame.BUTTON_HELP);
+ // PanelController panel = setupFrame.getCurrentPanel();
+ // panel.setStopButtonSelected();
+ } else if (evt.getActionCommand().equals(SetupFrame.ACTION_PREVIOUS)) {
+ PanelController panel = setupFrame.getCurrentPanel();
+ String previous = panel.getPrevious();
+ setupFrame.setCurrentPanel(previous, true, false);
+ } else if (evt.getActionCommand().equals(SetupFrame.ACTION_NEXT)) {
+ PanelController panel = setupFrame.getCurrentPanel();
+ String next = panel.getNext();
+ if (next == null) {
+ setupFrame.close(SetupFrame.CODE_OK);
+ } else {
+ setupFrame.setCurrentPanel(next, false, true);
+ }
+ } else if (evt.getActionCommand().equals(SetupFrame.ACTION_DETAILS)) {
+ JDialog dialog = setupFrame.getDialog();
+ DetailsDialog detailsdialog = new DetailsDialog(setupFrame);
+ detailsdialog.setModal(true);
+ detailsdialog.setSize(new Dimension(600, 300));
+ detailsdialog.setLocationRelativeTo(dialog);
+ detailsdialog.setVisible(true);
+ // setting focus on next button, if details dialog is closed
+ setupFrame.setButtonSelected(setupFrame.BUTTON_NEXT);
+ } else if (evt.getActionCommand().equals(SetupFrame.ACTION_HELP)) {
+ JDialog dialog = setupFrame.getDialog();
+ HelpDialog helpdialog = new HelpDialog(setupFrame);
+ helpdialog.setModal(true);
+ helpdialog.setSize(new Dimension(400, 300));
+ helpdialog.setLocationRelativeTo(dialog);
+ helpdialog.setVisible(true);
+ setupFrame.setButtonSelected(setupFrame.BUTTON_HELP);
+ }
+ }
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/DisplayPackageDescription.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/DisplayPackageDescription.java
new file mode 100755
index 000000000000..f7926c4fd314
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/DisplayPackageDescription.java
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.SetupData;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.Util.ModuleCtrl;
+import java.util.Enumeration;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.TreeNode;
+
+public class DisplayPackageDescription {
+
+ private PackageDescription data;
+ private int size = 0;
+
+ public DisplayPackageDescription(PackageDescription data) {
+ this.data = data;
+ // Setting default module settings for modules, that are not hidden
+ ModuleCtrl.setDefaultModuleSettings(data);
+ // The size is set dynamically, when a module is selected.
+ // This is better for the nodes, which have a changing size.
+ }
+
+ public String getDescription() {
+ return data.getDescription();
+ }
+
+ public int getSize() {
+ return size; // using local size
+ }
+
+ public int getState() {
+ return data.getSelectionState();
+ }
+
+ private int getSize(TreeNode peerNode) {
+ // return peerNode.isLeaf() ? data.getAccumulatedSize() : data.getSize();
+ // using size from PackageDescription, which is pkgSize (and that is defined in xpd file)
+ return data.getSize();
+ }
+
+ public void setState(TreeNode node, int newState) {
+ if ((data.getSelectionState() != PackageDescription.IGNORE) && data.isOptional()) {
+ data.setSelectionState(newState);
+ }
+
+ if (!node.isLeaf()) {
+ size = data.getSize(); // -> that is the value defined in xpd file
+
+ for (Enumeration e = node.children(); e.hasMoreElements();) {
+ TreeNode child = (TreeNode)e.nextElement();
+ DisplayPackageDescription childInfo = getInfo(child);
+
+ childInfo.setState(child, newState);
+
+ if (childInfo.isSelected()) {
+ size += childInfo.getSize(child);
+ }
+ }
+ } else if (isSelected()) {
+ size = data.getSize(); // -> that is the value defined in xpd file
+ }
+ }
+
+ public void toggleState(TreeNode node) {
+
+ int state = data.getSelectionState();
+
+ if (state != PackageDescription.IGNORE) {
+
+ if (state == PackageDescription.REMOVE) {
+ setState(node, PackageDescription.DONT_REMOVE);
+ } else if ((state == PackageDescription.DONT_REMOVE) || (state == PackageDescription.REMOVE_SOME)) {
+ setState(node, PackageDescription.REMOVE );
+ } else if ((state == PackageDescription.DONT_INSTALL) || (state == PackageDescription.INSTALL_SOME)) {
+ setState(node, PackageDescription.INSTALL);
+ } else {
+ setState(node, PackageDescription.DONT_INSTALL);
+ }
+
+ if (!node.isLeaf()) {
+ updateState(node);
+ }
+
+ try {
+ TreeNode parent = node.getParent();
+ DisplayPackageDescription parentInfo = getInfo(parent);
+
+ parentInfo.updateState(parent);
+ try {
+ TreeNode grandpa = parent.getParent();
+ DisplayPackageDescription grandpaInfo = getInfo(grandpa);
+
+ grandpaInfo.updateState(grandpa);
+ } catch (java.lang.IllegalArgumentException e) {
+ /* ignore */
+ }
+
+ } catch (java.lang.IllegalArgumentException e) {
+ /* ignore */
+ }
+ }
+ }
+
+ public void updateState(TreeNode node)
+ {
+ int state = PackageDescription.DONT_KNOW;
+ InstallData installdata = InstallData.getInstance();
+ size = data.getSize(); // -> that is the value defined in xpd file
+
+ for (Enumeration e = node.children(); e.hasMoreElements();) {
+ TreeNode child = (TreeNode) e.nextElement();
+ DisplayPackageDescription childInfo = getInfo(child);
+
+ int childState = childInfo.getState();
+
+ if ((state == PackageDescription.DONT_KNOW) || (state == PackageDescription.IGNORE)) {
+ state = childState;
+ } else if ((state != childState) && (childState != PackageDescription.IGNORE)) {
+ if ( installdata.isUninstallationMode() ) {
+ state = PackageDescription.REMOVE_SOME;
+ } else {
+ state = PackageDescription.INSTALL_SOME;
+ }
+ }
+ if (childInfo.isSelected()) {
+ size += childInfo.getSize(child);
+ }
+ }
+
+ data.setSelectionState(state);
+
+ }
+
+ public void updateSize(TreeNode node)
+ {
+ size = data.getSize(); // -> that is the value defined in xpd file
+
+ for (Enumeration e = node.children(); e.hasMoreElements();) {
+ TreeNode child = (TreeNode) e.nextElement();
+ DisplayPackageDescription childInfo = getInfo(child);
+ if (childInfo.isSelected()) {
+ size += childInfo.getSize(child);
+ }
+ }
+ }
+
+ public String toString() {
+ return data.getName();
+ }
+
+ static public boolean is(Object o) {
+ return (o != null)
+ && (o.getClass().getName().equals("org.openoffice.setup.SetupData.DisplayPackageDescription"));
+ }
+
+ public boolean isSelected() {
+ int state = data.getSelectionState();
+ return (state == PackageDescription.INSTALL) || (state == PackageDescription.INSTALL_SOME)
+ || (state == PackageDescription.REMOVE) || (state == PackageDescription.REMOVE_SOME);
+ }
+
+ private DisplayPackageDescription getInfo(TreeNode node) throws java.lang.IllegalArgumentException {
+ if (node == null) {
+ throw new java.lang.IllegalArgumentException();
+ }
+
+ DisplayPackageDescription info = (DisplayPackageDescription)((DefaultMutableTreeNode)node).getUserObject();
+ if ((info != null) && is(info)) {
+ return info;
+ } else {
+ throw new java.lang.IllegalArgumentException();
+ }
+ }
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/PackageDescription.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/PackageDescription.java
new file mode 100755
index 000000000000..4ed331bff2d7
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/PackageDescription.java
@@ -0,0 +1,659 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.SetupData;
+
+import org.openoffice.setup.Util.Parser;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Vector;
+import javax.swing.tree.TreeNode;
+
+/**
+ *
+ * @author Ingo Schmidt
+ */
+public class PackageDescription implements TreeNode {
+
+ public final static int NOTA_UNIT= 0;
+ public final static int RPM_UNIT = 1;
+ public final static int PKG_UNIT = 2;
+ /* public final static int MSI_UNIT = 3;
+ * public final static int TAR_UNIT = 4;
+ * public final static int TGZ_UNIT = 5;
+ */
+
+ public final static int DONT_INSTALL = 0;
+ public final static int INSTALL = 1;
+ public final static int INSTALL_SOME = 2;
+ public final static int REMOVE = 3;
+ public final static int DONT_REMOVE = 4;
+ public final static int REMOVE_SOME = 5;
+ public final static int IGNORE = 6;
+ public final static int DONT_KNOW = 7;
+
+ /* hierarchy information */
+ private Vector children = null;
+ private PackageDescription parent = null;
+
+ /* did the user select this package */
+ private int usrSelectionState = DONT_KNOW;
+
+ /* display information */
+ private String dpyName = "";
+ private String dpyDescription = "";
+ private String checkSolaris = "";
+ private int instSize = 0;
+ private int dpySortKey = 0;
+ private boolean isDefault = true;
+ private boolean isHidden = false;
+ private boolean showInUserInstall = true;
+ private boolean showInUserInstallOnly = false;
+ private boolean isOptional = true;
+ private boolean dontUninstall = false;
+ private boolean allChildrenHidden = false;
+
+ /* package information */
+ private String pkgMD5Sum = "";
+ private String pkgFileName = "";
+ private String pkgFullName = null;
+ private String pkgVersion = null;
+ private String pkgRelease = null;
+ private String pkgRealName = null;
+ private String pkgSubdir = null;
+ private String pkgLanguage = null;
+ private int pkgSize = 0;
+ private int pkgOrder = 0;
+ private int pkgType = NOTA_UNIT;
+ private boolean pkgExists = true; // must be default, especially for uninstallation
+ private boolean isRelocatable = true;
+ private boolean isUpdatePackage = false;
+ private boolean showMultiLingualOnly = false;
+ private boolean isApplicationPackage = false;
+ private boolean isJavaPackage = false;
+ private boolean installCanFail = false;
+ private boolean uninstallCanFail = false;
+ private boolean forceIntoUpdate = false;
+ private boolean useForce = false;
+ private boolean isNewInstalled = false;
+ private boolean wasAlreadyInstalled = false;
+ private boolean ignoreDependsForUninstall = false;
+
+ /* Saving the default selection state. This is necessary, if the user chooses
+ * the custom installation type, makes changes, and then changes into
+ * the typical installation set. Then all user settings have to be removed again.
+ * On the other hand, if the user then changes to the custom installation type
+ * again, he probably wants to see the settings he has done before.
+ */
+
+ private int typicalSelectionState = DONT_KNOW; // Saving settings for typical installation
+ private int customSelectionState = DONT_KNOW; // Saving settings for custom installation
+ private int startSelectionState = DONT_KNOW; // Saving settings at start of installation
+
+ public PackageDescription() {}
+
+ /**
+ * construct only with package information to wrap
+ */
+ protected PackageDescription(XMLPackageDescription p) {
+ this(p, (PackageDescription)null);
+ }
+
+ private PackageDescription(XMLPackageDescription descriptionData, PackageDescription parent) {
+
+ this.parent = parent;
+ children = new Vector();
+ parse(descriptionData);
+
+ /* sort according to display sort key */
+ Collections.sort(children, new PackageComparator());
+ }
+
+ /**
+ * retrieve information about the package properties
+ */
+
+ public String getName() {
+ return dpyName;
+ }
+
+ public void setName(String name) {
+ dpyName = name;
+ }
+
+ public String getDescription() {
+ return dpyDescription;
+ }
+
+ public String getCheckSolaris() {
+ return checkSolaris;
+ }
+
+ public int getSize() {
+ return pkgSize;
+ }
+
+ public void setSize(int size) {
+ pkgSize = size;
+ }
+
+ public int getOrder() {
+ return pkgOrder;
+ }
+
+ public void setOrder(int order) {
+ pkgOrder = order;
+ }
+
+ // public int getAccumulatedSize() {
+ // int size = getSize();
+ //
+ // for (Enumeration e = this.children(); e.hasMoreElements(); ) {
+ // // Should only be accumulated for selected modules
+ // PackageDescription data = (PackageDescription) e.nextElement();
+ // size += data.getSize();
+ // }
+ //
+ // return size;
+ // }
+
+ public boolean isOptional() {
+ return isOptional;
+ }
+
+ public boolean isHidden() {
+ return isHidden;
+ }
+
+ public boolean showInUserInstall() {
+ return showInUserInstall;
+ }
+
+ public boolean showInUserInstallOnly() {
+ return showInUserInstallOnly;
+ }
+
+ public boolean dontUninstall() {
+ return dontUninstall;
+ }
+
+ public boolean isUpdatePackage() {
+ return isUpdatePackage;
+ }
+
+ public boolean showMultiLingualOnly() {
+ return showMultiLingualOnly;
+ }
+
+ public boolean isApplicationPackage() {
+ return isApplicationPackage;
+ }
+
+ public boolean isJavaPackage() {
+ return isJavaPackage;
+ }
+
+ public boolean installCanFail() {
+ return installCanFail;
+ }
+
+ public boolean uninstallCanFail() {
+ return uninstallCanFail;
+ }
+
+ public void setUninstallCanFail(boolean canFail) {
+ uninstallCanFail = canFail;
+ }
+
+ public boolean forceIntoUpdate() {
+ return forceIntoUpdate;
+ }
+
+ public boolean useForce() {
+ return useForce;
+ }
+
+ public void setIsNewInstalled(boolean installed) {
+ isNewInstalled = installed;
+ }
+
+ public boolean isNewInstalled() {
+ return isNewInstalled;
+ }
+
+ public void setWasAlreadyInstalled(boolean installed) {
+ wasAlreadyInstalled = installed;
+ }
+
+ public boolean wasAlreadyInstalled() {
+ return wasAlreadyInstalled;
+ }
+
+ public void setIgnoreDependsForUninstall(boolean ignore) {
+ ignoreDependsForUninstall = ignore;
+ }
+
+ public boolean ignoreDependsForUninstall() {
+ return ignoreDependsForUninstall;
+ }
+
+ public boolean isDefault() {
+ return isDefault;
+ }
+
+ public String getMD5() {
+ return pkgMD5Sum;
+ }
+
+ public boolean isRelocatable() {
+ return isRelocatable;
+ }
+
+ public void setIsRelocatable(boolean relocatable) {
+ isRelocatable = relocatable;
+ }
+
+ public String getPackageName() {
+ return pkgFileName;
+ }
+
+ public void setPackageName(String name) {
+ pkgFileName = name;
+ }
+
+
+ public String getFullPackageName() {
+ return pkgFullName;
+ }
+
+ public void setFullPackageName(String fullPackageName) {
+ pkgFullName = fullPackageName;
+ }
+
+ public int getSelectionState() {
+ return usrSelectionState;
+ }
+
+ public void setSelectionState(int state) {
+ usrSelectionState = state;
+ }
+
+ public int getCustomSelectionState() {
+ return customSelectionState;
+ }
+
+ public void setCustomSelectionState(int state) {
+ customSelectionState = state;
+ }
+
+ public int getTypicalSelectionState() {
+ return typicalSelectionState;
+ }
+
+ public void setTypicalSelectionState(int state) {
+ typicalSelectionState = state;
+ }
+
+ public int getStartSelectionState() {
+ return startSelectionState;
+ }
+
+ public void setStartSelectionState(int state) {
+ startSelectionState = state;
+ }
+
+ public boolean isAllChildrenHidden() {
+ return allChildrenHidden;
+ }
+
+ public void setAllChildrenHidden(boolean hidden) {
+ allChildrenHidden = hidden;
+ }
+
+ public void setIsHidden(boolean hidden) {
+ isHidden = hidden;
+ }
+
+ public boolean pkgExists() {
+ return pkgExists;
+ }
+
+ public void setPkgExists(boolean exists) {
+ pkgExists = exists;
+ }
+
+ public String getPkgVersion() {
+ return pkgVersion;
+ }
+
+ public void setPkgVersion(String version) {
+ pkgVersion = version;
+ }
+
+ public String getPkgRelease() {
+ return pkgRelease;
+ }
+
+ public void setPkgRelease(String release) {
+ pkgRelease = release;
+ }
+
+ public String getPkgRealName() {
+ return pkgRealName;
+ }
+
+ public void setPkgRealName(String realName) {
+ pkgRealName = realName;
+ }
+
+ public String getPkgSubdir() {
+ return pkgSubdir;
+ }
+
+ public void setPkgSubdir(String subdir) {
+ pkgSubdir = subdir;
+ }
+
+ public String getPkgLanguage() {
+ return pkgLanguage;
+ }
+
+ public void setPkgLanguage(String language) {
+ pkgLanguage = language;
+ }
+
+ /**
+ * extract the name and the description according to the locale
+ */
+ private String getLocalizedValue(XMLPackageDescription packageData, String section, Locale l) {
+ String localizedValue = "";
+
+ String countryString = l.getCountry();
+ String languageString = l.getLanguage();
+ String localeString = languageString + "_" + countryString;
+
+ XMLPackageDescription subPackage = packageData.getElement(section, "lang", localeString);
+ if (subPackage == null) {
+ subPackage = packageData.getElement(section, "lang", languageString);
+ if (subPackage == null) {
+ subPackage = packageData.getElement(section, "lang", "en_US");
+ }
+ }
+ if (subPackage != null) {
+ localizedValue = subPackage.getValue();
+ }
+
+ return localizedValue;
+ }
+
+ /**
+ * parse the wrapped package description
+ */
+
+ private void parse(XMLPackageDescription data) {
+
+ XMLPackageDescription section;
+ XMLPackageDescription subSection;
+
+ /* information about how to display the node */
+ section = data.getElement("display");
+ if (section != null) {
+ /* display types: hidden, visible */
+ String displayType = section.getAttribute("type");
+ if (displayType != null) {
+ isHidden = displayType.equals("hidden");
+ }
+
+ /* name and description according to the current locale */
+ Locale locale = Locale.getDefault();
+ dpyName = getLocalizedValue(section, "name", locale);
+ dpyDescription = getLocalizedValue(section, "description", locale);
+
+ subSection = section.getElement("sortkey");
+ if (subSection != null) {
+ String sort = subSection.getValue();
+ dpySortKey = Integer.parseInt(sort);
+ }
+
+ subSection = section.getElement("default");
+ if (subSection != null) {
+ String defaultValue = subSection.getValue();
+ isDefault = Parser.parseBoolean(defaultValue);
+ // isDefault = Boolean.parseBoolean(defaultValue);
+ }
+
+ subSection = section.getElement("showinuserinstall");
+ if (subSection != null) {
+ String showInUserInstallValue = subSection.getValue();
+ showInUserInstall = Parser.parseBoolean(showInUserInstallValue);
+ // showInUserInstall = Boolean.parseBoolean(showInUserInstallValue);
+ }
+
+ subSection = section.getElement("showinuserinstallonly");
+ if (subSection != null) {
+ String showInUserInstallValueOnly = subSection.getValue();
+ showInUserInstallOnly = Parser.parseBoolean(showInUserInstallValueOnly);
+ }
+
+ subSection = section.getElement("dontuninstall");
+ if (subSection != null) {
+ String dontUninstallValue = subSection.getValue();
+ dontUninstall = Parser.parseBoolean(dontUninstallValue);
+ // dontUninstall = Boolean.parseBoolean(dontUninstallValue);
+ }
+
+ subSection = section.getElement("checksolaris");
+ if (subSection != null) {
+ checkSolaris = subSection.getValue();
+ }
+
+ subSection = section.getElement("isupdatepackage");
+ if (subSection != null) {
+ String isUpdatePackageValue = subSection.getValue();
+ isUpdatePackage = Parser.parseBoolean(isUpdatePackageValue);
+ // isUpdatePackage = Boolean.parseBoolean(isUpdatePackageValue);
+ }
+
+ subSection = section.getElement("showmultilingualonly");
+ if (subSection != null) {
+ String showMultiLingualOnlyValue = subSection.getValue();
+ showMultiLingualOnly = Parser.parseBoolean(showMultiLingualOnlyValue);
+ }
+
+ subSection = section.getElement("applicationmodule");
+ if (subSection != null) {
+ String isApplicationPackageValue = subSection.getValue();
+ isApplicationPackage = Parser.parseBoolean(isApplicationPackageValue);
+ }
+
+ subSection = section.getElement("isjavapackage");
+ if (subSection != null) {
+ String isJavaPackageValue = subSection.getValue();
+ isJavaPackage = Parser.parseBoolean(isJavaPackageValue);
+ // isJavaPackage = Boolean.parseBoolean(isJavaPackageValue);
+ }
+
+ subSection = section.getElement("installcanfail");
+ if (subSection != null) {
+ String installCanFailValue = subSection.getValue();
+ installCanFail = Parser.parseBoolean(installCanFailValue);
+ }
+
+ subSection = section.getElement("forceintoupdate");
+ if (subSection != null) {
+ String forceIntoUpdateValue = subSection.getValue();
+ forceIntoUpdate = Parser.parseBoolean(forceIntoUpdateValue);
+ }
+
+ subSection = section.getElement("useforce");
+ if (subSection != null) {
+ String useForceValue = subSection.getValue();
+ useForce = Parser.parseBoolean(useForceValue);
+ }
+
+ }
+
+ /* query information about the physical (rpm/pkg/msi...) package itself */
+ section = data.getElement("installunit");
+ if (section != null) {
+ String pkgTypeName = section.getAttribute("type");
+ if (pkgTypeName != null) {
+ if (pkgTypeName.equals("rpm")) {
+ pkgType = RPM_UNIT;
+ } else if (pkgTypeName.equals("pkg")) {
+ pkgType = PKG_UNIT;
+ }
+ }
+
+ subSection = section.getElement("size");
+ if (subSection != null) {
+ String sz = subSection.getValue();
+ pkgSize = Integer.parseInt(sz);
+ }
+ subSection = section.getElement("installorder");
+ if (subSection != null) {
+ String order = subSection.getValue();
+ pkgOrder = Integer.parseInt(order);
+ } else {
+ // Setting the default for packages without order
+ pkgOrder = 1000;
+ }
+ subSection = section.getElement("md5");
+ if (subSection != null) {
+ pkgMD5Sum = subSection.getValue();
+ }
+ subSection = section.getElement("name");
+ if (subSection != null) {
+ pkgFileName = subSection.getValue();
+ }
+ subSection = section.getElement("fullpkgname");
+ if (subSection != null) {
+ pkgFullName = subSection.getValue();
+ }
+ subSection = section.getElement("pkgversion");
+ if (subSection != null) {
+ pkgVersion = subSection.getValue();
+ }
+ subSection = section.getElement("subdir");
+ if (subSection != null) {
+ pkgSubdir = subSection.getValue();
+ }
+ subSection = section.getElement("relocatable");
+ if (subSection != null) {
+ String relocatableValue = subSection.getValue();
+ isRelocatable = Parser.parseBoolean(relocatableValue);
+ // isRelocatable = Boolean.parseBoolean(relocatableValue);
+ }
+ subSection = section.getElement("solarislanguage");
+ if (subSection != null) {
+ pkgLanguage = subSection.getValue();
+ }
+
+ }
+
+ /* line up the subpackages */
+ for (Enumeration enumPackages = data.elements(); enumPackages.hasMoreElements(); ) {
+ XMLPackageDescription p = (XMLPackageDescription) enumPackages.nextElement();
+ if (p.getKey().equals("package")) {
+ children.add(new PackageDescription(p, this));
+ }
+ }
+ }
+
+ /**
+ * sort according to the display sortkey
+ */
+
+ private class PackageComparator implements Comparator {
+ public int compare(Object w1, Object w2) {
+ return ((PackageDescription) w1).dpySortKey - ((PackageDescription) w2).dpySortKey;
+ }
+ }
+
+ /**
+ * implement a TreeNode interface for convenient travelling through the data
+ */
+
+ private class PackageEnumeration implements Enumeration {
+
+ Enumeration e;
+
+ protected PackageEnumeration() {
+ e = children.elements();
+ }
+ public boolean hasMoreElements() {
+ return e.hasMoreElements();
+ }
+ public Object nextElement() {
+ return e.nextElement();
+ }
+ }
+
+ /**
+ * TreeNode interface
+ */
+ public Enumeration children() {
+ return new PackageEnumeration();
+ }
+
+ public boolean getAllowsChildren() {
+ return true;
+ }
+
+// public PackageDescription getChildAt(int childIndex) {
+// return (PackageDescription) children.elementAt(childIndex);
+// }
+
+ public TreeNode getChildAt(int childIndex) {
+ return (TreeNode)children.elementAt(childIndex);
+ }
+
+ public int getChildCount() {
+ return children.size();
+ }
+
+ public int getIndex(TreeNode node) {
+ return children.indexOf(node);
+ }
+
+// public PackageDescription getParent() {
+// return parent;
+// }
+
+ public TreeNode getParent() {
+ return (TreeNode)parent;
+ }
+
+ public boolean isLeaf() {
+ return children.size() == 0;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/ProductDescription.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/ProductDescription.java
new file mode 100755
index 000000000000..e5933a996834
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/ProductDescription.java
@@ -0,0 +1,277 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.SetupData;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.Util.Parser;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Vector;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+/**
+ *
+ * @author Christof Pintaske
+ */
+public class ProductDescription {
+
+ private class Pair {
+ public Pattern search;
+ public String replacement;
+
+ public Pair(Pattern key, String value) {
+ search = key;
+ replacement = value;
+ }
+ }
+
+ private Vector macro; /* macro list with precompiled regex patterns */
+ private HashMap map; /* conventional key-value pairs */
+ private String backslashText = "THIS_IS_A_BACKSLASH";
+
+ /**
+ * read properties from package description data
+ */
+
+ protected ProductDescription(XMLPackageDescription descriptionData) {
+ macro = new Vector();
+ map = new HashMap();
+ parse(descriptionData);
+ }
+
+ /**
+ * retrieve information about general installation properties
+ */
+
+ public void setNewMacro(String key, String value) {
+ if ((key != null) && (value != null)) {
+ String match = "\\$\\{" + key + "\\}";
+ Pattern pattern = Pattern.compile(match, Pattern.CASE_INSENSITIVE);
+
+ map.put(key, value);
+ Iterator m = map.entrySet().iterator();
+ // while ( m.hasNext() ) {
+ // Map.Entry entry = (Map.Entry) m.next();
+ // System.out.println( "MAP:" + entry.getKey() + ":" + entry.getValue() );
+ // }
+
+ // Does the pair with the same pattern already exist? Then it has to be removed
+ for (int i = 0; i < macro.size(); i++) {
+ Pair pair = (Pair) macro.get(i);
+ if ( pair.search.pattern().equals(match) ) {
+ macro.remove(i);
+ }
+ }
+
+ macro.add(new Pair(pattern, value));
+
+ // Inserting new Pair at the beginning of the macro vector. Then it will
+ // be used instead of older version during macro replacement.
+ // For example ${DIR} in the select dir dialog, if this is set more than once.
+ // macro.add(0, new Pair(pattern, value));
+ }
+ }
+
+ public void dumpMacros() {
+ for (int i = 0; i < macro.size(); i++) {
+ Pair pair = (Pair) macro.get(i);
+ System.out.println("Key: " + pair.search.pattern() + " Value: " + pair.replacement );
+ }
+ }
+
+ public String get(String key) {
+ return (String) map.get(key);
+ }
+
+ private boolean doMaskBackslash(String[] arr) {
+ boolean changed = false;
+
+ int index = arr[0].indexOf('\\');
+ if ( index >= 0 ) {
+ arr[0] = arr[0].replaceAll("\\", backslashText);
+ // arr[0] = arr[0].replace("\\", backslashText);
+ changed = true;
+ }
+
+ return changed;
+ }
+
+ private String doUnmaskBackslash(String s) {
+ s = s.replaceAll(backslashText, "\\");
+ // s = s.replace(backslashText, "\\");
+ return s;
+ }
+
+ public String replaceMacros(String s) {
+
+ String result = s;
+
+ for (int i = 0; i < macro.size(); i++) {
+ Pair pair = (Pair) macro.get(i);
+ Pattern pattern = pair.search;
+
+ Matcher matcher = pattern.matcher(result);
+
+ String replace = pair.replacement;
+ result = matcher.replaceAll(replace);
+
+ // masquerading backslashes in String replace (important for Windows pathes)
+ // String[] arr1 = { replace };
+ // boolean masked = doMaskBackslash(arr1);
+ // result = matcher.replaceAll(arr1[0]);
+ // if (masked) {
+ // result = doUnmaskBackslash(result);
+ // }
+ }
+
+ return result;
+ }
+
+ /**
+ * parse the wrapped package description
+ */
+
+ private void parse(XMLPackageDescription data) {
+
+ XMLPackageDescription section;
+
+ /* product description is a leaf at the root */
+ if (!data.getKey().equals("product")) {
+ section = data.getElement("product");
+ if (section != null) {
+ parse(section);
+ }
+ } else {
+ InstallData installData = InstallData.getInstance();
+
+ /* check for a default installation directory */
+ section = data.getElement("defaultdir");
+ if (section != null) {
+ String value = section.getValue();
+ if (value != null) {
+ installData.setDefaultDir(value);
+ // installData.setInstallDir(value);
+ }
+ }
+
+ /* check for a default product directory */
+ section = data.getElement("productdir");
+ if (section != null) {
+ String value = section.getValue();
+ if (value != null) {
+ installData.setProductDir(value);
+ }
+ }
+
+ /* check for the package format of this installation set */
+ section = data.getElement("packageformat");
+ if (section != null) {
+ String value = section.getValue();
+ if (value != null) {
+ installData.setPackageFormat(value);
+ }
+ }
+
+ /* check for the package directory of this installation set */
+ section = data.getElement("packagedirectory");
+ if (section != null) {
+ String value = section.getValue();
+ if ((value != null) && (! value.equals(""))) {
+ installData.setPackageSubdir(value);
+ }
+ }
+
+ /* check for the architecture of this installation set */
+ section = data.getElement("architecture");
+ if (section != null) {
+ String value = section.getValue();
+ if ((value != null) && (! value.equals(""))) {
+ installData.setArchitecture(value);
+ }
+ }
+
+ section = data.getElement("multilingual");
+ if (section != null) {
+ String value = section.getValue();
+ if ((value != null) && (! value.equals(""))) {
+ boolean multilingualValue = Parser.parseBoolean(value);
+ installData.setIsMultiLingual(multilingualValue);
+ }
+ }
+
+ /* check for the update behaviour of this installation set */
+ section = data.getElement("dontupdate");
+ if (section != null) {
+ String value = section.getValue();
+ boolean dontupdate = false;
+ if ((value != null) && (! value.equals(""))) {
+ dontupdate = Parser.parseBoolean(value);
+ }
+ installData.setDontUpdate(dontupdate);
+ }
+
+ /* check for the Product Minor of this installation set */
+ section = data.getElement("productminor");
+ if (section != null) {
+ String value = section.getValue();
+ if (value != null) {
+ int intValue = Integer.parseInt(value);
+ installData.setProductMinor(intValue);
+ }
+ }
+
+ section = data.getElement("hideeula");
+ if (section != null) {
+ String value = section.getValue();
+ if ((value != null) && (! value.equals(""))) {
+ boolean hideeulaValue = Parser.parseBoolean(value);
+ installData.setHideEula(hideeulaValue);
+ }
+ }
+
+ /* check for any macro definitions */
+ for (Enumeration e = data.elements(); e.hasMoreElements(); ) {
+ XMLPackageDescription p = (XMLPackageDescription) e.nextElement();
+ if (p.getKey().equals("macro")) {
+ String key = p.getAttribute("key");
+ String value = p.getValue();
+
+ if ((key != null) && (value != null)) {
+ String match = "\\$\\{" + key + "\\}";
+ Pattern pattern = Pattern.compile(match, Pattern.CASE_INSENSITIVE);
+
+ map.put(key, value);
+ macro.add(new Pair(pattern, value));
+ }
+ }
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/SetupDataProvider.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/SetupDataProvider.java
new file mode 100755
index 000000000000..55b6b06a86e0
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/SetupDataProvider.java
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.SetupData;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.Installer.Installer;
+import org.openoffice.setup.Installer.InstallerFactory;
+import java.util.Enumeration;
+import java.util.Vector;
+import javax.swing.tree.DefaultMutableTreeNode;
+
+/**
+ *
+ * @author Christof Pintaske
+ */
+public class SetupDataProvider {
+
+ static private PackageDescription packageData;
+ static private ProductDescription productData;
+
+ private SetupDataProvider() {
+ }
+
+ public static PackageDescription getPackageDescription() {
+ return packageData;
+ }
+
+ public static ProductDescription getProductDescription() {
+ return productData;
+ }
+
+ public static String replaceMacros(String s) {
+ return productData.replaceMacros(s);
+ }
+
+ public static String getString(String key) {
+ return productData.get(key);
+ }
+
+ public static void setNewMacro(String key, String value) {
+ productData.setNewMacro(key, value);
+ }
+
+ public static void dumpMacros() {
+ productData.dumpMacros();
+ }
+
+ private static DefaultMutableTreeNode createTree(PackageDescription data, InstallData installData) {
+ DefaultMutableTreeNode node = new DefaultMutableTreeNode();
+
+ node.setUserObject(new DisplayPackageDescription(data));
+
+ for (Enumeration e = data.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+
+ // Do not display modules with "showinuserinstall" set to false in xpd file
+ // if this is a user installation.
+ if (( installData.isUserInstallation() ) && ( ! child.showInUserInstall() )) {
+ child.setIsHidden(true);
+ child.setSelectionState(PackageDescription.IGNORE);
+ }
+
+ // Only add modules, if they have not display type="hidden" in xpd file
+ if (!child.isHidden()) {
+ node.add(createTree(child, installData));
+ }
+ }
+
+ return node;
+ }
+
+ public static DefaultMutableTreeNode createTree() {
+ InstallData installData = InstallData.getInstance();
+ return createTree(getPackageDescription(), installData);
+ }
+
+ static {
+ XMLPackageDescription rawData = new XMLPackageDescription();
+ rawData.read();
+ // rawData.dump();
+ packageData = new PackageDescription(rawData);
+ productData = new ProductDescription(rawData);
+ }
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/XMLPackageDescription.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/XMLPackageDescription.java
new file mode 100755
index 000000000000..ab7aef57b526
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/XMLPackageDescription.java
@@ -0,0 +1,307 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.SetupData;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.Util.FileExtensionFilter;
+import java.io.File;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Stack;
+import java.util.Vector;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+public class XMLPackageDescription {
+
+ /**
+ * fill the package description tree by handling the SAXParser events
+ */
+ private class PackageDescriptionHandler extends DefaultHandler {
+
+ private XMLPackageDescription root;
+ private Stack stack;
+
+ public PackageDescriptionHandler(XMLPackageDescription base) {
+ root = base;
+ stack = new Stack();
+ }
+
+ private PackageDescriptionHandler() {
+ /* forbidden */
+ }
+
+ public XMLPackageDescription getDescription() {
+ return root;
+ }
+
+ /* implement the DefaultHandler interface */
+
+ public void characters(char[] ch, int start, int length) {
+ XMLPackageDescription entity = (XMLPackageDescription) stack.peek();
+ entity.value = entity.value == null ? new String(ch, start, length)
+ : entity.value + new String(ch, start, length);
+ }
+ public void startDocument() {
+ stack.push(root);
+ }
+ public void endDocument() {
+ stack.pop();
+ }
+ public void startElement(String uri, String localName, String qName, Attributes attributes) {
+ XMLPackageDescription parent = (XMLPackageDescription) stack.peek();
+ XMLPackageDescription entity = new XMLPackageDescription();
+
+ entity.key = qName;
+ for (int i = 0; i < attributes.getLength(); i++) {
+ entity.attributes.put(attributes.getQName(i), attributes.getValue(i));
+ }
+
+ parent.add(entity);
+ stack.push(entity);
+ }
+ public void endElement(String uri, String localName, String qName) {
+ stack.pop();
+ }
+ public void error(SAXParseException e) {
+ System.err.println("Parse Error:" + e);
+ }
+ public void processingInstruction(String target, String data) {
+ /* ignore */
+ }
+ public void skippedEntity(String name) {
+ /* ignore */
+ }
+ public void warning(SAXParseException e) {
+ System.err.println("Warning:" + e);
+ }
+ }
+
+ /**
+ * general storage for XML elements
+ */
+
+ private String key; /* XML element name */
+ private String value; /* XML element characters */
+ private Hashtable attributes; /* XML element attributes */
+ private Vector children; /* children are of type XMLPackageDescription */
+
+ protected XMLPackageDescription() {
+ key = "";
+ value = null;
+ attributes = new Hashtable();
+ children = new Vector();
+ }
+
+ private void add(XMLPackageDescription p) {
+ children.add(p);
+ }
+
+ /**
+ * helper routines to find content information
+ */
+ protected String getKey() {
+ return key;
+ }
+ protected String getAttribute(String key) {
+ return (String) attributes.get(key);
+ }
+ protected String getValue() {
+ return value;
+ }
+ protected XMLPackageDescription getElement(String key) {
+ return getElement(key, null, null);
+ }
+ protected XMLPackageDescription getElement(String key, String attrKey, String attrValue) {
+ for (Enumeration e = children.elements(); e.hasMoreElements();) {
+ XMLPackageDescription child = (XMLPackageDescription) e.nextElement();
+ if (child.key.equals(key)) {
+ if (attrKey == null) {
+ return child;
+ } else if (attrValue.equals(child.getAttribute(attrKey))) {
+ return child;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * find a PackageDescription of type package that has the given name,
+ * recurses into the children
+ */
+ private XMLPackageDescription findPackage(String name) {
+ String self = (String) attributes.get("name");
+
+ if ((self != null) && self.equals(name))
+ return this;
+
+ XMLPackageDescription found = null;
+ for (Enumeration e = children.elements(); e.hasMoreElements();) {
+ XMLPackageDescription child = (XMLPackageDescription) e.nextElement();
+ if (child.getAttribute("parent") != null) {
+ found = child.findPackage(name);
+ if (found != null) {
+ break;
+ }
+ }
+ }
+ return found;
+ }
+
+ /**
+ * adjust the tree so that all children have a matching parent and not just
+ * the ones they got by reading files in random order
+ */
+ private void adjust(XMLPackageDescription root) {
+ String self = (String) attributes.get("name");
+
+ for (int i = children.size() - 1; i >= 0; --i) {
+ XMLPackageDescription child = (XMLPackageDescription) children.elementAt(i);
+ String childParentName = child.getAttribute("parent");
+ if (childParentName != null) {
+
+ child.adjust(root);
+
+ if ((childParentName != null) && (childParentName.length() > 0) && (! childParentName.equals(self))) {
+ XMLPackageDescription newParent = root.findPackage(childParentName);
+ if (newParent != null) {
+ newParent.add(child);
+ children.remove(i);
+ }
+ }
+ }
+ }
+ }
+
+ protected void read() {
+ PackageDescriptionHandler handler = new PackageDescriptionHandler(this);
+
+ try {
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ SAXParser parser = factory.newSAXParser();
+
+ InstallData data = InstallData.getInstance();
+ File xpdRoot = data.getInfoRoot("xpd");
+
+ if ( xpdRoot != null ) {
+ File[] file = xpdRoot.listFiles(new FileExtensionFilter("xpd"));
+
+ if (file != null) {
+ for (int i = 0; i < file.length; i++) {
+ parser.parse(file[i], handler);
+ }
+ } else {
+ key = "";
+ value = "no package file found";
+ }
+ }
+ else {
+ System.err.println("Did not find xpd directory");
+ }
+ } catch (ParserConfigurationException ex) {
+ ex.printStackTrace();
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ } catch (SAXException ex) {
+ ex.printStackTrace();
+ }
+
+ adjust(this);
+ }
+
+ /* provide an iterator through the children */
+ protected class Elements implements Enumeration {
+
+ Enumeration e;
+
+ protected Elements() {
+ e = children.elements();
+ }
+ public boolean hasMoreElements() {
+ return e.hasMoreElements();
+ }
+ public Object nextElement() {
+ return e.nextElement();
+ }
+ }
+
+ protected Enumeration elements() {
+ return new Elements();
+ }
+
+
+ // FIXME: remove it, dump() is for testing only
+ public void dump() {
+ dump("");
+ }
+
+ // FIXME: remove it, dump(String) is for testing only
+ public void dump(String indent) {
+ final String space = " ";
+ if (key != null) {
+ System.out.print(indent + "<" + key);
+ }
+ for (Enumeration e = attributes.keys() ; e.hasMoreElements() ;) {
+ String key = (String) e.nextElement();
+ String value = (String) attributes.get(key);
+ System.out.print(" " + key + "=\"" + value + "\"");
+ }
+ if (key != null) {
+ System.out.print(">");
+ }
+
+ if ((value != null) && (value.length() > 0)) {
+ String trimmedValue = value.trim();
+ if (trimmedValue.length() > 60) {
+ trimmedValue = trimmedValue.substring(0, 57) + "...";
+ }
+ if (trimmedValue.length() > 0) {
+ System.out.print(trimmedValue);
+ }
+ }
+
+ for (Enumeration e = children.elements() ; e.hasMoreElements() ;) {
+ XMLPackageDescription current = (XMLPackageDescription) e.nextElement();
+ System.out.println();
+ current.dump(indent + space);
+ }
+ if (children.size() > 0) {
+ System.out.println();
+ System.out.print(indent);
+ }
+ if (key != null) {
+ System.out.print("</" + key + ">");
+ }
+ }
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupFrame.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupFrame.java
new file mode 100755
index 000000000000..98b7e0a1b7fc
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupFrame.java
@@ -0,0 +1,300 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup;
+import java.awt.BorderLayout;
+import java.awt.CardLayout;
+import java.awt.ComponentOrientation;
+import java.awt.Dimension;
+import java.awt.Insets;
+import java.awt.event.WindowAdapter;
+import java.io.File;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JSeparator;
+import javax.swing.border.EmptyBorder;
+
+public class SetupFrame extends WindowAdapter {
+
+ String StringPrevious;
+ String StringNext;
+ String StringCancel;
+ String StringFinish;
+ String StringHelp;
+ String StringAppTitle;
+
+ Icon IconStarOffice;
+
+ public static final String ACTION_NEXT = "ActionNext";
+ public static final String ACTION_PREVIOUS = "ActionPrevious";
+ public static final String ACTION_CANCEL = "ActionCancel";
+ public static final String ACTION_HELP = "ActionHelp";
+ public static final String ACTION_DETAILS = "ActionDetails";
+ public static final String ACTION_STOP = "ActionStop";
+
+ public static final int CODE_OK = 0;
+ public static final int CODE_CANCEL = 1;
+ public static final int CODE_ERROR = 2;
+
+ public static final int BUTTON_NEXT = 1;
+ public static final int BUTTON_PREVIOUS = 2;
+ public static final int BUTTON_CANCEL = 3;
+ public static final int BUTTON_HELP = 4;
+
+ private JButton mNextButton;
+ private JButton mPreviousButton;
+ private JButton mCancelButton;
+ private JButton mHelpButton;
+
+ private JDialog mDialog;
+
+ private JPanel mCardPanel;
+ private CardLayout mCardLayout;
+
+ private SetupActionListener mActionListener;
+ private DeckOfPanels mDeck;
+
+ public SetupFrame() {
+
+ StringPrevious = ResourceManager.getString("String_Previous");
+ StringNext = ResourceManager.getString("String_Next");
+ StringCancel = ResourceManager.getString("String_Cancel");
+ StringFinish = ResourceManager.getString("String_Finish");
+ StringHelp = ResourceManager.getString("String_Help");
+
+ InstallData data = InstallData.getInstance();
+ if ( data.isInstallationMode() ) {
+ StringAppTitle = ResourceManager.getString("String_ApplicationTitle");
+ } else {
+ StringAppTitle = ResourceManager.getString("String_ApplicationTitleUninstallation");
+ }
+
+ // The setup icon has to be flexible for customization, not included into the jar file
+ File iconFile = data.getInfoRoot("images");
+ iconFile = new File(iconFile, "Setup.gif");
+ IconStarOffice = ResourceManager.getIconFromPath(iconFile);
+
+ mActionListener = new SetupActionListener(this);
+ mDeck = new DeckOfPanels();
+
+ mDialog = new JDialog();
+ mDialog.setTitle(StringAppTitle);
+ initFrame();
+ }
+
+ public void addPanel(PanelController panel, String name) {
+ mCardPanel.add(panel.getPanel(), name);
+ panel.setSetupFrame(this);
+ mDeck.addPanel(panel, name);
+ }
+
+ public PanelController getCurrentPanel() {
+ return mDeck.getCurrentPanel();
+ }
+
+ public void setCurrentPanel(String name, boolean ignoreRepeat, boolean isNext) {
+ if (name == null)
+ close(CODE_ERROR);
+
+ PanelController panel = mDeck.getCurrentPanel();
+ boolean repeatDialog = false;
+ if (panel != null) {
+ repeatDialog = panel.afterShow(isNext);
+ if ( isNext ) {
+ name = panel.getNext(); // afterShow() could have changed the "next" dialog
+ }
+ if ( ignoreRepeat ) {
+ repeatDialog = false;
+ }
+ }
+
+ if ( repeatDialog ) {
+ name = panel.getName();
+ }
+
+ panel = mDeck.setCurrentPanel(name);
+ if (panel != null)
+ {
+ setButtonsForPanel(panel);
+ panel.beforeShow();
+ mCardLayout.show(mCardPanel, name);
+ panel.duringShow();
+ }
+ }
+
+ void setButtonsForPanel(PanelController panel) {
+
+ setButtonText(StringCancel, BUTTON_CANCEL);
+ setButtonText(StringHelp, BUTTON_HELP);
+ setButtonText(StringPrevious, BUTTON_PREVIOUS);
+ // setButtonEnabled((panel.getPrevious() != null), BUTTON_PREVIOUS);
+ // setButtonEnabled((panel.getNext() != null), BUTTON_CANCEL);
+ if (panel.getNext() == null) {
+ setButtonText(StringFinish, BUTTON_NEXT);
+ } else {
+ setButtonText(StringNext, BUTTON_NEXT);
+ }
+ }
+
+ public void setButtonText(String text, int button) {
+ switch (button) {
+ case BUTTON_NEXT: mNextButton.setText(text); break;
+ case BUTTON_PREVIOUS: mPreviousButton.setText(text); break;
+ case BUTTON_CANCEL: mCancelButton.setText(text); break;
+ case BUTTON_HELP: mHelpButton.setText(text); break;
+ }
+ }
+
+ public void setButtonSelected(int button) {
+ switch (button) {
+ case BUTTON_NEXT: mNextButton.grabFocus(); break;
+ case BUTTON_PREVIOUS: mPreviousButton.grabFocus(); break;
+ case BUTTON_CANCEL: mCancelButton.grabFocus(); break;
+ case BUTTON_HELP: mHelpButton.grabFocus(); break;
+ }
+ }
+
+ public void setButtonEnabled(boolean enabled, int button) {
+ switch (button) {
+ case BUTTON_NEXT: mNextButton.setEnabled(enabled); break;
+ case BUTTON_PREVIOUS: mPreviousButton.setEnabled(enabled); break;
+ case BUTTON_CANCEL: mCancelButton.setEnabled(enabled); break;
+ case BUTTON_HELP: mHelpButton.setEnabled(enabled); break;
+ }
+ }
+
+ public void removeButtonIcon(int button) {
+ switch (button) {
+ case BUTTON_NEXT: mNextButton.setIcon(null); break;
+ case BUTTON_PREVIOUS: mPreviousButton.setIcon(null); break;
+ case BUTTON_CANCEL: mCancelButton.setIcon(null); break;
+ case BUTTON_HELP: mHelpButton.setIcon(null); break;
+ }
+ }
+
+ public SetupActionListener getSetupActionListener() {
+ return mActionListener;
+ }
+
+ void close(int code) {
+ mDialog.dispose();
+ }
+
+ public JDialog getDialog() {
+ return mDialog;
+ }
+
+ public int showFrame() {
+ mDialog.pack();
+ mDialog.setLocationRelativeTo(null);
+ mDialog.setModal(true);
+ mDialog.setResizable(false);
+ // mDialog.setMinimumSize(new Dimension(679, 459));
+ mDialog.setVisible(true);
+ // System.err.println("Width: " + mDialog.getWidth() + ", Height: " + mDialog.getHeight());
+
+ return 0;
+ }
+
+ private void initFrame() {
+
+ mDialog.getContentPane().setLayout(new BorderLayout());
+
+ mCardLayout = new CardLayout();
+ mCardPanel = new JPanel();
+ mCardPanel.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
+ mCardPanel.setLayout(mCardLayout);
+
+ mPreviousButton = new JButton();
+ mNextButton = new JButton();
+ mCancelButton = new JButton();
+ mHelpButton = new JButton();
+
+ mPreviousButton.setHorizontalTextPosition(JButton.RIGHT);
+ mNextButton.setHorizontalTextPosition(JButton.LEFT);
+
+ mPreviousButton.setIcon(ResourceManager.getIcon("Icon_Previous"));
+ mNextButton.setIcon(ResourceManager.getIcon("Icon_Next"));
+
+ mPreviousButton.setActionCommand(ACTION_PREVIOUS);
+ mNextButton.setActionCommand(ACTION_NEXT);
+ mCancelButton.setActionCommand(ACTION_CANCEL);
+ mHelpButton.setActionCommand(ACTION_HELP);
+
+ mPreviousButton.addActionListener(mActionListener);
+ mNextButton.addActionListener(mActionListener);
+ mCancelButton.addActionListener(mActionListener);
+ mHelpButton.addActionListener(mActionListener);
+
+ InstallData data = InstallData.getInstance();
+
+ if (data.useRtl()) {
+ mPreviousButton.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ mNextButton.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ mCancelButton.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ mHelpButton.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ }
+
+ Box ButtonBox = new Box(BoxLayout.X_AXIS);
+ ButtonBox.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
+ ButtonBox.add(mPreviousButton);
+ ButtonBox.add(Box.createHorizontalStrut(10));
+ ButtonBox.add(mNextButton);
+ ButtonBox.add(Box.createHorizontalStrut(30));
+ ButtonBox.add(mCancelButton);
+ ButtonBox.add(Box.createHorizontalStrut(10));
+ ButtonBox.add(mHelpButton);
+ if (data.useRtl()) {
+ ButtonBox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ }
+
+ JPanel ButtonPanel = new JPanel();
+ JSeparator Separator = new JSeparator();
+ ButtonPanel.setLayout(new BorderLayout());
+ ButtonPanel.setPreferredSize(new Dimension(612, 44));
+ ButtonPanel.add(Separator, BorderLayout.NORTH);
+ ButtonPanel.add(ButtonBox, java.awt.BorderLayout.EAST);
+
+ JPanel IconPanel = new JPanel();
+ JLabel Icon = new JLabel();
+ Icon.setIcon(IconStarOffice);
+// IconPanel.setPreferredSize(new Dimension(142, 372));
+// IconPanel.setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
+ IconPanel.setLayout(new BorderLayout());
+ IconPanel.add(Icon);
+
+ mDialog.getContentPane().add(ButtonPanel, java.awt.BorderLayout.SOUTH);
+ mDialog.getContentPane().add(mCardPanel, java.awt.BorderLayout.CENTER);
+ mDialog.getContentPane().add(IconPanel, java.awt.BorderLayout.WEST);
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/AbortInstaller.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/AbortInstaller.java
new file mode 100755
index 000000000000..7df874a31fbc
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/AbortInstaller.java
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Util;
+
+import org.openoffice.setup.InstallData;
+import java.util.Vector;
+
+public class AbortInstaller {
+
+ private AbortInstaller() {
+ }
+
+ static public void abortInstallProcess() {
+ InstallData installData = InstallData.getInstance();
+ installData.setIsAbortedInstallation(true);
+
+ if ( installData.isInstallationMode() ) {
+ String log = "<b>Installation was aborted</b><br>";
+ LogManager.addLogfileComment(log);
+ } else {
+ String log = "<b>Uninstallation was aborted</b><br>";
+ LogManager.addLogfileComment(log);
+ }
+
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Calculator.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Calculator.java
new file mode 100755
index 000000000000..2042cc738c52
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Calculator.java
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Util;
+
+import org.openoffice.setup.SetupData.PackageDescription;
+import java.util.Vector;
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.ResourceManager;
+
+public class Calculator {
+
+ private Calculator() {
+ }
+
+ static private int calculateInstallSize(Vector allPackages) {
+
+ int value = 0;
+
+ for (int i = 0; i < allPackages.size(); i++) {
+ PackageDescription packageData = (PackageDescription)allPackages.get(i);
+ int size = packageData.getSize();
+ value = value + size;
+ }
+
+ return value;
+ }
+
+ static private boolean missingDiscSpace(int required, int available) {
+ boolean missingDiscSpace = true;
+
+ if ( required < available ) {
+ missingDiscSpace = false;
+ }
+
+ // missingDiscSpace = true; // for testing reasons
+ return missingDiscSpace;
+ }
+
+ static public boolean notEnoughDiscSpace(InstallData data) {
+
+ Vector installPackages = data.getInstallPackages();
+ // Calculate size of selected modules
+ int installationSize = calculateInstallSize(installPackages);
+
+ // Compare with available space
+ int availableDiscSpace = data.getAvailableDiscSpace();
+
+ // Show warning and repeat dialog, if not sufficient disc space available
+ boolean insufficientDiscSpace = missingDiscSpace(installationSize, availableDiscSpace);
+
+ if ( insufficientDiscSpace ) {
+ String message = ResourceManager.getString("String_Discspace_Insufficient") + "\n" +
+ ResourceManager.getString("String_Discspace_Required") + ": " + installationSize + " kB." + "\n" +
+ ResourceManager.getString("String_Discspace_Available") + ": " + availableDiscSpace + " kB." + "\n" +
+ ResourceManager.getString("String_Discspace_Tip");
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+ }
+
+ return insufficientDiscSpace;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Controller.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Controller.java
new file mode 100755
index 000000000000..bbca464fd72a
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Controller.java
@@ -0,0 +1,291 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Util;
+
+import java.io.File;
+import java.util.Vector;
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import org.openoffice.setup.Util.LogManager;
+
+public class Controller {
+
+ private Controller() {
+ }
+
+ static public void checkPackagePathExistence(InstallData installData) {
+ String packagePath = installData.getPackagePath();
+ if (( packagePath == null ) || ( packagePath.equals(""))) {
+ String message = ResourceManager.getString("String_InstallationOngoing_PackagePath_Not_Found");
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+ System.exit(1);
+ }
+ }
+
+ static public void checkPackageFormat(InstallData installData) {
+ String packageFormat = installData.getPackageFormat();
+ String os = installData.getOSType();
+
+ boolean notSupportedPackageFormat = true;
+
+ // Show warnings for currently not supported combinations of OS and package format.
+ // This has to be adapted if further OS or package formats are supported.
+
+ if (( os.equalsIgnoreCase("SunOS") ) && ( packageFormat.equalsIgnoreCase("pkg") )) {
+ notSupportedPackageFormat = false;
+ }
+
+ if (( os.equalsIgnoreCase("Linux") ) && ( packageFormat.equalsIgnoreCase("rpm") )) {
+ notSupportedPackageFormat = false;
+ }
+
+ // Inform user about not supported package format and exit program
+
+ if ( notSupportedPackageFormat ) {
+ System.err.println("Error: Package format not supported by this OS!");
+ String mainmessage = ResourceManager.getString("String_Packageformat_Not_Supported");
+ String osstring = ResourceManager.getString("String_Operating_System");
+ String formatstring = ResourceManager.getString("String_Packageformat");
+ String message = mainmessage + "\n" + osstring + ": " + os + "\n" + formatstring + ": " + packageFormat;
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+ System.exit(1);
+ }
+ }
+
+ static public void collectSystemLanguages(InstallData installData) {
+ String pkgCommand = "";
+ String[] pkgCommandArray;
+ String adminFileName = "";
+ String log = "";
+ Vector returnVector = new Vector();
+ Vector returnErrorVector = new Vector();
+ int returnValue;
+
+ pkgCommand = "locale -a";
+ pkgCommandArray = new String[2];
+ pkgCommandArray[0] = "locale";
+ pkgCommandArray[1] = "-a";
+ returnValue = ExecuteProcess.executeProcessReturnVector(pkgCommandArray, returnVector, returnErrorVector);
+
+ if ( returnValue == 0 ) {
+ log = pkgCommand + "<br><b>Returns: " + returnValue + " Successful command</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+
+ // System.err.println("Available languages 1: ");
+ // for (int i = 0; i < returnVector.size(); i++) {
+ // System.err.println(returnVector.get(i));
+ // }
+
+ // Collecting "en-US" instead of "en-US.UTF8"
+ Vector realVector = new Vector();
+
+ for (int i = 0; i < returnVector.size(); i++) {
+ String oneLang = (String)returnVector.get(i);
+ int position = oneLang.indexOf(".");
+ if ( position > -1 ) {
+ oneLang = oneLang.substring(0, position);
+ }
+ if ( ! realVector.contains(oneLang)) {
+ realVector.add(oneLang);
+ }
+ }
+
+ // System.err.println("Available languages 2: ");
+ // for (int i = 0; i < realVector.size(); i++) {
+ // System.err.println(realVector.get(i));
+ // }
+
+ installData.setSystemLanguages(realVector);
+ } else { // an error occured
+ log = pkgCommand + "<br><b>Returns: " + returnValue + " An error occured</b><br>";
+ LogManager.addCommandsLogfileComment(log);
+ System.err.println("Error in command: " + pkgCommand);
+ for (int i = 0; i < returnErrorVector.size(); i++) {
+ LogManager.addCommandsLogfileComment((String)returnErrorVector.get(i));
+ System.err.println(returnErrorVector.get(i));
+ }
+ }
+ }
+
+ static public boolean createdSubDirectory(String dir) {
+ boolean createdDirectory = false;
+ boolean errorShown = false;
+ String subDirName = "testdir";
+ File testDir = new File(dir, subDirName);
+ try {
+ createdDirectory = SystemManager.create_directory(testDir.getPath());
+ }
+ catch (SecurityException ex) {
+ String message = ResourceManager.getString("String_ChooseDirectory_No_Write_Access") + ": " + dir;
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+ errorShown = true;
+ }
+
+ if (( ! createdDirectory ) && ( ! errorShown )) {
+ String message = ResourceManager.getString("String_ChooseDirectory_No_Write_Access") + ": " + dir;
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+ errorShown = true;
+ }
+
+ if ( SystemManager.exists_directory(testDir.getPath()) ) {
+ testDir.delete();
+ }
+
+ return createdDirectory;
+ }
+
+ static public boolean createdDirectory(String dir) {
+ boolean createdDirectory = false;
+ try {
+ createdDirectory = SystemManager.create_directory(dir);
+ }
+ catch (SecurityException ex) {
+ // message = ResourceManager.getString("String_ChooseDirectory_Not_Allowed") + ": " + dir;
+ // title = ResourceManager.getString("String_Error");
+ // Informer.showErrorMessage(message, title);
+ }
+
+ if ( ! createdDirectory ) {
+ String message = ResourceManager.getString("String_ChooseDirectory_No_Success") + ": " + dir;
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+ }
+
+ return createdDirectory;
+ }
+
+ static public boolean reducedRootWritePrivileges() {
+ Vector vec = new Vector();
+ File dir = new File("/usr");
+ vec.add(dir);
+ dir = new File("/etc");
+ vec.add(dir);
+
+ boolean restrictedWritePrivilges = false;
+
+ // Check for zones. If "zonename" is successful and the name is not "global",
+ // this is a "sparse zone".
+ // Alternative: Simply always check, if root has write access in selected directories.
+
+ for (int i = 0; i < vec.size(); i++) {
+ File directory = (File)vec.get(i);
+ if ( directory.exists() ) {
+ // do we have write privileges inside the directory
+ String tempDirName = "temptestdir";
+ File tempDir = new File(directory, tempDirName);
+
+ if ( SystemManager.createDirectory(tempDir) ) {
+ SystemManager.removeDirectory(tempDir);
+ } else {
+ restrictedWritePrivilges = true;
+ System.err.println("Restricted Root privileges. No write access in " + directory.getPath());
+ break;
+ }
+ }
+ }
+
+ return restrictedWritePrivilges;
+ }
+
+ static public void checkForNewerVersion(InstallData installData) {
+ LogManager.setCommandsHeaderLine("Checking change installation");
+ InstallChangeCtrl.checkInstallChange(installData);
+
+ if ( installData.newerVersionExists() ) {
+ // Inform user about a newer version installed
+ SetupDataProvider.setNewMacro("DIR", installData.getInstallDefaultDir()); // important for string replacement
+
+ System.err.println("Error: A newer version is already installed in " + installData.getInstallDefaultDir() + " !");
+ String message1 = ResourceManager.getString("String_Newer_Version_Installed_Found")
+ + "\n" + installData.getInstallDefaultDir() + "\n";
+ String message2 = ResourceManager.getString("String_Newer_Version_Installed_Remove");
+ String message = message1 + "\n" + message2;
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+ System.exit(1);
+ }
+ }
+
+ static public void checkForUidFile(InstallData installData) {
+ // check existence of getuid.so
+ File getuidFile = Controller.findUidFile(installData);
+
+ if (( getuidFile == null ) || (! getuidFile.exists()) ) {
+ // Root privileges required -> abort installation
+ System.err.println("Root privileges required for installation!");
+ String message = ResourceManager.getString("String_Root_Privileges_Required_1") + "\n"
+ + ResourceManager.getString("String_Root_Privileges_Required_2");
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+ System.exit(1);
+ } else {
+ installData.setGetUidPath(getuidFile.getPath());
+ }
+ }
+
+ static private File findUidFile(InstallData data) {
+
+ File getuidFile = null;
+
+ if ( data.isInstallationMode()) {
+ String getuidpath = System.getProperty("GETUID_PATH");
+
+ if ( getuidpath != null ) {
+ getuidFile = new File(getuidpath);
+
+ if (( getuidFile.isDirectory() ) && ( ! getuidFile.isFile() )) {
+ // Testing, if GETUID_PATH only contains the path, not the filename
+ String defaultfilename = "getuid.so";
+ getuidFile = new File(getuidpath, defaultfilename);
+
+ if ( ! getuidFile.exists() ) {
+ getuidFile = null;
+ }
+ }
+ }
+
+ // File resourceRoot = data.getResourceRoot();
+ // String getuidString = "getuid.so";
+ // if ( resourceRoot != null ) {
+ // File getuidDir = new File (data.getInfoRoot(), "getuid");
+ // getuidFile = new File(getuidDir, getuidString);
+ // }
+
+ } else {
+ getuidFile = new File(data.getGetUidPath());
+ }
+
+ return getuidFile;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Converter.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Converter.java
new file mode 100755
index 000000000000..411351b1139d
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Converter.java
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Util;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Vector;
+
+public class Converter {
+
+ private Converter() {
+ }
+
+ static public String[] convertHashmapToStringArray(HashMap map) {
+
+ int size = map.size();
+ String[] myStringArray = new String[size];
+
+ Iterator m = map.entrySet().iterator();
+ int counter = 0;
+
+ while ( m.hasNext() ) {
+ Map.Entry entry = (Map.Entry) m.next();
+ String env = entry.getKey() + "=" + entry.getValue();
+ myStringArray[counter] = env;
+ counter = counter + 1;
+ }
+
+ return myStringArray;
+ }
+
+ static public HashMap convertVectorToHashmap(Vector vec) {
+ HashMap map = new HashMap();
+
+ for (int i = 0; i < vec.size(); i++) {
+ String key = null;
+ String value = null;
+
+ String line = (String)vec.get(i);
+ int position = line.indexOf("=");
+ if ( position > -1 ) {
+ key = line.substring(0, position);
+ value = line.substring(position + 1, line.length());
+ } else {
+ key = line;
+ value = null;
+ }
+
+ map.put(key, value);
+ }
+
+ return map;
+ }
+
+ static public Vector convertHashMapToVector(HashMap hash) {
+ Vector vec = new Vector();
+
+ Iterator m = hash.entrySet().iterator();
+
+ while ( m.hasNext() ) {
+ Map.Entry entry = (Map.Entry) m.next();
+ String line = entry.getKey() + "=" + entry.getValue();
+ vec.add(line);
+ }
+
+ return vec;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/DialogFocusTraversalPolicy.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/DialogFocusTraversalPolicy.java
new file mode 100644
index 000000000000..ae9950841968
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/DialogFocusTraversalPolicy.java
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Util;
+
+import java.awt.FocusTraversalPolicy;
+import javax.swing.JComponent;
+
+public class DialogFocusTraversalPolicy extends FocusTraversalPolicy {
+
+ private JComponent order[];
+ private java.util.List list;
+
+ public DialogFocusTraversalPolicy(JComponent _order[]) {
+ order = _order;
+ list = java.util.Arrays.asList(order);
+ }
+
+ public java.awt.Component getFirstComponent(java.awt.Container focusCycleRoot) {
+ return order[0];
+ }
+
+ public java.awt.Component getLastComponent(java.awt.Container focusCycleRoot) {
+ return order[order.length - 1];
+ }
+
+ public java.awt.Component getComponentAfter(java.awt.Container focusCycleRoot, java.awt.Component aComponent) {
+ int index = 0,x = -1;
+ index = list.indexOf(aComponent);
+ index++; // increasing automatically
+ if(!order[index % order.length].isEnabled() ||
+ !order[index % order.length].isVisible()) {
+ x = index;
+ index = -1;
+ for (; x != order.length; x++) {
+ if(order[x].isEnabled() && order[x].isVisible()) {
+ index = x;
+ break;
+ }
+ }
+ if(index == -1) {
+ x = list.indexOf(aComponent);
+ for(int y = 0; y <= x; y++) {
+ if(order[y].isEnabled() && order[x].isVisible()) {
+ index = y;
+ break;
+ }
+ }
+ }
+ }
+ return order[ index % order.length];
+ }
+
+ public java.awt.Component getComponentBefore(java.awt.Container focusCycleRoot, java.awt.Component aComponent) {
+ int index = list.indexOf(aComponent), x = -1;
+ index--;
+ if(!order[(index + order.length) % order.length].isEnabled() ||
+ !order[(index + order.length) % order.length].isVisible()) {
+ x = index;
+ index = -1;
+ for(; x >= 0; x--) {
+ if(order[x].isEnabled() && order[x].isVisible()) {
+ index = x;
+ break;
+ }
+ }
+ // if nothing has changed
+ if(index == -1) {
+ x = list.indexOf(aComponent);
+ for(int y = order.length -1; y >= x; y--) {
+ if(order[y].isEnabled() && order[x].isVisible()) {
+ index = y;
+ break;
+ }
+ }
+ }
+ }
+ return order[ (index + order.length) % order.length];
+ }
+
+ public java.awt.Component getDefaultComponent(java.awt.Container focusCycleRoot) {
+ return order[0];
+ }
+
+ public java.awt.Component getInitialComponent(java.awt.Window window) {
+ return order[0];
+ }
+
+}
+
+
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Dumper.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Dumper.java
new file mode 100755
index 000000000000..3024b0f1a676
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Dumper.java
@@ -0,0 +1,202 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Util;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.SetupData.PackageDescription;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Vector;
+
+
+public class Dumper {
+
+ private Dumper() {
+ }
+
+ static public void dumpPackageSettings(PackageDescription packageData) {
+
+ if ( packageData.isLeaf() ) {
+ System.out.println("Name: " + packageData.getName() +
+ " State: " + packageData.getSelectionState() +
+ " " + packageData.getPackageName());
+ } else {
+ System.out.println("Nod-Name: " + packageData.getName() +
+ " State: " + packageData.getSelectionState());
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ dumpPackageSettings(child);
+ }
+
+ }
+
+ static public void dumpModuleStates(PackageDescription packageData) {
+
+ System.err.println("Name: " + packageData.getName() +
+ " State: " + packageData.getSelectionState() +
+ " " + packageData.getPackageName());
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ dumpModuleStates(child);
+ }
+ }
+
+ static private String getStateString(int state) {
+ String stateString = null;
+
+ if ( state == 0 ) {
+ stateString = "DONT_INSTALL";
+ } else if ( state == 1 ) {
+ stateString = "INSTALL";
+ } else if ( state == 2 ) {
+ stateString = "INSTALL_SOME";
+ } else if ( state == 3 ) {
+ stateString = "REMOVE";
+ } else if ( state == 4 ) {
+ stateString = "DONT_REMOVE";
+ } else if ( state == 5 ) {
+ stateString = "REMOVE_SOME";
+ } else if ( state == 6 ) {
+ stateString = "IGNORE";
+ } else if ( state == 7 ) {
+ stateString = "DONT_KNOW";
+ } else {
+ stateString = null;
+ }
+
+ return stateString;
+ }
+
+ static private void logModuleStatesHelper(PackageDescription packageData) {
+ int state = packageData.getSelectionState();
+ String stateStr = getStateString(state);
+
+ LogManager.addModulesLogfileComment("Name: " + packageData.getName() +
+ " State: " + stateStr +
+ " " + packageData.getPackageName());
+
+ // System.err.println("Name: " + packageData.getName() +
+ // " State: " + stateStr +
+ // " " + packageData.getPackageName());
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ logModuleStatesHelper(child);
+ }
+ }
+
+ static public void logModuleStates(PackageDescription packageData, String text) {
+ LogManager.setModulesLogFileHeaderLine(text);
+ logModuleStatesHelper(packageData);
+ }
+
+ static public void logPackagesToInstall(Vector packages, String text) {
+ PackageDescription packageData = null;
+ LogManager.setModulesLogFileHeaderLine(text);
+ for (int i = 0; i < packages.size(); i++) {
+ packageData = (PackageDescription)packages.get(i);
+ LogManager.addModulesLogfileComment("Name: " + packageData.getName() +
+ " " + packageData.getPackageName());
+ }
+ }
+
+ static public void dumpInstallPackages(PackageDescription packageData) {
+
+ if (( packageData.isLeaf() ) && ( packageData.getSelectionState() == packageData.INSTALL )) {
+ System.out.println("Now installing: " + packageData.getPackageName());
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ dumpInstallPackages(child);
+ }
+ }
+
+ static public void dumpUninstallPackages(PackageDescription packageData) {
+
+ if (( packageData.isLeaf() ) && ( packageData.getSelectionState() == packageData.REMOVE )) {
+ System.out.println("Now uninstalling: " + packageData.getPackageName());
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ dumpUninstallPackages(child);
+ }
+ }
+
+ static public void dumpAllRpmInfo(PackageDescription packageData) {
+
+ if (( packageData.getPackageName() != null ) && ( ! packageData.getPackageName().equals(""))) {
+ if ( packageData.pkgExists() ) {
+ System.err.println("RPM data: " + packageData.getPkgRealName() + " : " +
+ packageData.getPkgVersion() + " : " +
+ packageData.getPkgRelease() + " : " +
+ packageData.getPackageName() );
+ }
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ dumpAllRpmInfo(child);
+ }
+
+ }
+
+ static public void dumpNewInstallData() {
+ InstallData data = InstallData.getInstance();
+ System.err.println("PackagePath: " + data.getPackagePath());
+ System.err.println("AdminFileReloc: " + data.getAdminFileNameReloc());
+ System.err.println("AdminFileRelocNoDepends: " + data.getAdminFileNameRelocNoDepends());
+ System.err.println("AdminFileNoReloc: " + data.getAdminFileNameNoReloc());
+ System.err.println("AdminFileNoRelocNoDepends: " + data.getAdminFileNameNoRelocNoDepends());
+ System.err.println("DatabasePath: " + data.getDatabasePath());
+ System.err.println("InstallDir: " + data.getInstallDir());
+ System.err.println("Original privileges: " + data.getStoredInstallationPrivileges());
+ System.err.println("getuid.so File: " + data.getGetUidPath());
+ }
+
+ static public void dumpAllProperties() {
+ Properties properties = System.getProperties();
+
+ int size = properties.size();
+ Iterator m = properties.entrySet().iterator();
+ int counter = 0;
+
+ while ( m.hasNext() ) {
+ Map.Entry entry = (Map.Entry) m.next();
+ String env = entry.getKey() + "=" + entry.getValue();
+ System.err.println(env);
+ }
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/ExecuteProcess.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/ExecuteProcess.java
new file mode 100755
index 000000000000..c86d4204fcc1
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/ExecuteProcess.java
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Util;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Vector;
+
+public class ExecuteProcess {
+
+ private ExecuteProcess() {
+ }
+
+ static public int executeProcessReturnValue(String[] command) {
+ // usage of String arrays because of blanks in pathes
+ int returnValue = 0;
+
+ try {
+ Process p = Runtime.getRuntime().exec(command);
+ p.waitFor();
+ returnValue = p.exitValue();
+ } catch ( IOException ioe ) {
+ System.err.println("IOError:" + ioe );
+ } catch ( InterruptedException ie ) {
+ System.err.println("Interrupted Exception:" + ie );
+ }
+
+ return returnValue;
+ }
+
+ static public int executeProcessReturnVector(String[] command, Vector returnVector, Vector returnErrorVector) {
+ // usage of String arrays because of blanks in pathes
+ int returnValue = -3;
+
+ try {
+ Process p = Runtime.getRuntime().exec(command);
+
+ BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ BufferedReader errorIn = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+ for ( String s; ( s = in.readLine()) != null; ) {
+ returnVector.add(s);
+ }
+ for ( String t; ( t = errorIn.readLine()) != null; ) {
+ returnErrorVector.add(t);
+ }
+
+ p.waitFor();
+ returnValue = p.exitValue();
+
+ } catch ( InterruptedException ioe ) {
+ System.err.println("Interrupted Exception Error: " + ioe );
+ } catch ( IOException ioe ) {
+ System.err.println("IOError: " + ioe );
+ }
+
+ return returnValue;
+ }
+
+ static public int executeProcessReturnVectorEnv(String[] command, String[] envP, Vector returnVector, Vector returnErrorVector) {
+ // usage of String arrays because of blanks in pathes
+ int returnValue = -3;
+
+ try {
+ Process p = Runtime.getRuntime().exec(command, envP);
+
+ // Solaris has to use the ErrorStream (do not log license texts), Linux the InputStream
+ BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ BufferedReader errorIn = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+ for ( String s; ( s = in.readLine()) != null; ) {
+ returnVector.add(s);
+ }
+ for ( String t; ( t = errorIn.readLine()) != null; ) {
+ returnErrorVector.add(t);
+ }
+
+ p.waitFor();
+ returnValue = p.exitValue();
+
+ } catch ( InterruptedException ioe ) {
+ System.err.println("Interrupted Exception Error: " + ioe );
+ } catch ( IOException ioe ) {
+ System.err.println("IOError: " + ioe );
+ }
+
+ return returnValue;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/FileExtensionFilter.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/FileExtensionFilter.java
new file mode 100755
index 000000000000..35a7c0b6dcbc
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/FileExtensionFilter.java
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Util;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+public class FileExtensionFilter implements FilenameFilter {
+
+ private String fileExtension;
+
+ public FileExtensionFilter(String extension) {
+ fileExtension = extension;
+ if ( ! fileExtension.startsWith(".") ) {
+ fileExtension = "." + fileExtension;
+ }
+ }
+
+ public boolean accept(File dir, String name) {
+ if (name.endsWith(fileExtension)) {
+ File candidate = new File(dir, name);
+ if (candidate.isFile() && candidate.canRead()) {
+ return true;
+ }
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InfoCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InfoCtrl.java
new file mode 100755
index 000000000000..d5e9023a821e
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InfoCtrl.java
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Util;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.SetupData.ProductDescription;
+import java.util.Enumeration;
+import java.util.Vector;
+
+public class InfoCtrl {
+
+ private InfoCtrl() {
+ }
+
+ static public String setHtmlFrame(String position, String htmlInfoText) {
+ if ( position.equals("header") ) {
+ htmlInfoText = "<HTML><BODY><FONT FACE=\"sans-serif\" SIZE=3>";
+ }
+ else if ( position.equals("end")) {
+ htmlInfoText = htmlInfoText + "</FONT></BODY></HTML>";
+ }
+
+ return htmlInfoText;
+ }
+
+ static public String setReadyToInstallInfoText(ProductDescription productData, String htmlInfoText) {
+ // String oneline = "-------------------------------------------------------------------";
+ String oneline = "-------------------------------------------------------------";
+ htmlInfoText = htmlInfoText + "<b>Product</b>: " + productData.get("product_fullname") + "<br>";
+ InstallData data = InstallData.getInstance();
+ htmlInfoText = htmlInfoText + "<b>Location</b>: " + data.getInstallDefaultDir() + "<br>";
+ htmlInfoText = htmlInfoText + oneline + "<br>";
+
+ return htmlInfoText;
+ }
+
+ static public String setReadyToInstallInfoText(PackageDescription packageData, String htmlInfoText) {
+ // setHtmlInfoText(packageData, 0);
+ InstallData data = InstallData.getInstance();
+ if ( data.isInstallationMode() ) {
+ htmlInfoText = setReadyToInstallInfoText(packageData, "", htmlInfoText);
+ } else {
+ htmlInfoText = setReadyToUninstallInfoText(packageData, "", htmlInfoText);
+ }
+ return htmlInfoText;
+ }
+
+ // private void setReadyToInstallInfoText(PackageDescription packageData, Integer indent) {
+ static private String setReadyToInstallInfoText(PackageDescription packageData, String indent, String htmlInfoText) {
+ // String spacer = "<spacer type=horizontal size=" + indent.toString() + ">";
+ // System.out.println(ind);
+ if (( packageData.isLeaf() ) || ( packageData.isAllChildrenHidden() )) {
+ if ( ! packageData.isHidden() ) {
+ if ( packageData.getSelectionState() == packageData.INSTALL ) {
+ // htmlInfoText = htmlInfoText + spacer + packageData.getName() + "<br>";
+ htmlInfoText = htmlInfoText + indent + packageData.getName() + "<br>";
+ }
+ }
+ }
+
+ if (( ! packageData.isLeaf() ) && ( ! packageData.isAllChildrenHidden() )) {
+ if ( ! packageData.isHidden() ) {
+ if (( packageData.getSelectionState() == packageData.INSTALL ) ||
+ ( packageData.getSelectionState() == packageData.INSTALL_SOME )) {
+ // htmlInfoText = htmlInfoText + spacer + "<b>" + packageData.getName() + "</b>" + "<br>";
+ // htmlInfoText = htmlInfoText + indent + "<b>" + packageData.getName() + "</b>" + "<br>";
+ htmlInfoText = htmlInfoText + indent + packageData.getName() + "<br>";
+ }
+ }
+
+ indent = indent + "..";
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ htmlInfoText = setReadyToInstallInfoText(child, indent, htmlInfoText);
+ }
+ }
+
+ return htmlInfoText;
+ }
+
+ // private void setReadyToUninstallInfoText(PackageDescription packageData, Integer indent, String htmlInfoText) {
+ static private String setReadyToUninstallInfoText(PackageDescription packageData, String indent, String htmlInfoText) {
+ // String spacer = "<spacer type=horizontal size=" + indent.toString() + ">";
+ // System.out.println(ind);
+ if (( packageData.isLeaf() ) || ( packageData.isAllChildrenHidden() )) {
+ if ( ! packageData.isHidden() ) {
+ if ( packageData.getSelectionState() == packageData.REMOVE ) {
+ // htmlInfoText = htmlInfoText + spacer + packageData.getName() + "<br>";
+ htmlInfoText = htmlInfoText + indent + packageData.getName() + "<br>";
+ }
+ }
+ }
+
+ if (( ! packageData.isLeaf() ) && ( ! packageData.isAllChildrenHidden() )) {
+ if ( ! packageData.isHidden() ) {
+ if (( packageData.getSelectionState() == packageData.REMOVE ) ||
+ ( packageData.getSelectionState() == packageData.REMOVE_SOME )) {
+ // htmlInfoText = htmlInfoText + spacer + "<b>" + packageData.getName() + "</b>" + "<br>";
+ // htmlInfoText = htmlInfoText + indent + "<b>" + packageData.getName() + "</b>" + "<br>";
+ htmlInfoText = htmlInfoText + indent + packageData.getName() + "<br>";
+ }
+ }
+
+ indent = indent + "..";
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ htmlInfoText = setReadyToUninstallInfoText(child, indent, htmlInfoText);
+ }
+ }
+
+ return htmlInfoText;
+ }
+
+ static public String setInstallLogInfoText(ProductDescription productData, String htmlInfoText) {
+ // String separatorline = "-------------------------------------------------------------------";
+ String separatorline = "-------------------------------------------------------------";
+ htmlInfoText = htmlInfoText + "<b>Product</b>: " + productData.get("product_fullname") + "<br>";
+ InstallData data = InstallData.getInstance();
+ htmlInfoText = htmlInfoText + "<b>Location</b>: " + data.getInstallDir() + "<br>";
+ htmlInfoText = htmlInfoText + "<b>Operating system</b>: " + data.getOSType() + "<br>";
+ if ( data.isUserInstallation() ) {
+ htmlInfoText = htmlInfoText + "<b>Installation type</b>: " + "User installation" + "<br>";
+ } else {
+ htmlInfoText = htmlInfoText + "<b>Installation type</b>: " + "Root installation" + "<br>";
+ }
+
+ htmlInfoText = htmlInfoText + separatorline + "<br>";
+
+ htmlInfoText = LogManager.publishLogfileContent(htmlInfoText, separatorline);
+ htmlInfoText = LogManager.publishCommandsLogfileContent(htmlInfoText);
+
+ return htmlInfoText;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InfoDir.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InfoDir.java
new file mode 100755
index 000000000000..97b3073c3c32
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InfoDir.java
@@ -0,0 +1,319 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Util;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.ResourceManager;
+import java.io.File;
+import java.util.Vector;
+
+public class InfoDir {
+
+ private InfoDir() {
+ }
+
+ static private String copySourceFile(String fileName) {
+ InstallData data = InstallData.getInstance();
+ File jarFile = data.getJarFilePath();
+ String destFile = null;
+
+ if ( jarFile != null ) {
+ String sourceDir = jarFile.getParent();
+ File sourceFileFile = new File(sourceDir, fileName);
+ String sourceFile = sourceFileFile.getPath();
+
+ // String jarFileName = jarFile.getName();
+ File destDir = new File(data.getInstallDefaultDir(), data.getProductDir());
+ File destFileFile = new File(destDir, fileName);
+ destFile = destFileFile.getPath();
+
+ boolean success = SystemManager.copy(sourceFile, destFile);
+ }
+
+ return destFile;
+ }
+
+ static private void copyInstallDirectoryWithExtension(File destBaseDir, String subDirName, String fileExtension) {
+ InstallData data = InstallData.getInstance();
+ File sourceDir = data.getInfoRoot(subDirName);
+ if ( sourceDir != null ) {
+ File destDir = new File(destBaseDir, subDirName);
+ destDir.mkdir();
+ SystemManager.copyAllFiles(sourceDir, destDir, fileExtension);
+ }
+ }
+
+ static private void copyInstallDirectoryWithExtension(File destBaseDir, String subDirName, String fileExtension, String unixRights) {
+ InstallData data = InstallData.getInstance();
+ File sourceDir = data.getInfoRoot(subDirName);
+ if ( sourceDir != null ) {
+ File destDir = new File(destBaseDir, subDirName);
+ destDir.mkdir();
+ SystemManager.copyAllFiles(sourceDir, destDir, fileExtension);
+ SystemManager.setUnixPrivilegesDirectory(destDir, fileExtension, unixRights);
+ }
+ }
+
+ static private void copyInstallDirectoryDoubleSubdir(File destBaseDir, String dir1, String dir2) {
+ InstallData data = InstallData.getInstance();
+ File sourceDir1 = data.getInfoRoot(dir1);
+ File sourceDir = new File(sourceDir1, dir2);
+
+ destBaseDir.mkdir();
+ File destDir1 = new File(destBaseDir, dir1);
+ destDir1.mkdir();
+ File destDir = new File(destDir1, dir2);
+ destDir.mkdir();
+
+ SystemManager.copyAllFiles(sourceDir, destDir);
+ }
+
+ static private File createUninstallDir() {
+ InstallData data = InstallData.getInstance();
+ File baseDir = new File(data.getInstallDefaultDir(), data.getProductDir());
+ baseDir = new File(baseDir, data.getUninstallDirName());
+ baseDir.mkdir();
+ return baseDir;
+ }
+
+ static private void copyGetUidSoFile(File dir) {
+ InstallData data = InstallData.getInstance();
+ String uidFileSource = data.getGetUidPath();
+ if ( uidFileSource != null ) {
+ // Copying the "getuid.so" file into installation
+ String fileName = "getuid.so";
+ File destFile = new File(dir, fileName);
+ String uidFileDest = destFile.getPath();
+ boolean success = SystemManager.copy(uidFileSource, uidFileDest);
+ data.setGetUidPath(uidFileDest);
+ }
+ }
+
+ static private void copyJreFile(File dir) {
+ InstallData data = InstallData.getInstance();
+ String jrefilename = System.getProperty("JRE_FILE");
+
+ if ( jrefilename != null ) {
+ // For Solaris, JRE_FILE can already contain the complete path.
+ // Otherwise it contains only the filename
+ File jreFile = new File(jrefilename);
+
+ if ( ! jreFile.exists()) {
+ jreFile = new File(data.getPackagePath(), jrefilename);
+ }
+
+ if ( jreFile.exists() ) {
+ String jreFileSource = jreFile.getPath();
+ File destDir = new File(dir, "jre");
+ destDir.mkdir();
+ String onlyFileName = jreFile.getName();
+ File destFile = new File(destDir, onlyFileName);
+
+ // In maintenance mode the file already exists
+ if ( ! destFile.exists() ) {
+ String jreFileDest = destFile.getPath();
+ boolean success = SystemManager.copy(jreFileSource, jreFileDest);
+ }
+ }
+ }
+ }
+
+ static private void moveAdminFiles(File dir) {
+ InstallData data = InstallData.getInstance();
+
+ if ( data.getAdminFileNameReloc() != null ) {
+ File sourceFile = new File(data.getAdminFileNameReloc());
+ String fileName = sourceFile.getName();
+ File destFile = new File(dir, fileName);
+ boolean success = SystemManager.copy(sourceFile.getPath(), destFile.getPath());
+ data.setAdminFileNameReloc(destFile.getPath());
+ sourceFile.delete();
+ }
+
+ if ( data.getAdminFileNameRelocNoDepends() != null ) {
+ File sourceFile = new File(data.getAdminFileNameRelocNoDepends());
+ String fileName = sourceFile.getName();
+ File destFile = new File(dir, fileName);
+ boolean success = SystemManager.copy(sourceFile.getPath(), destFile.getPath());
+ data.setAdminFileNameRelocNoDepends(destFile.getPath());
+ sourceFile.delete();
+ }
+
+ if ( data.getAdminFileNameNoReloc() != null ) {
+ File sourceFile = new File(data.getAdminFileNameNoReloc());
+ String fileName = sourceFile.getName();
+ File destFile = new File(dir, fileName);
+ boolean success = SystemManager.copy(sourceFile.getPath(), destFile.getPath());
+ data.setAdminFileNameNoReloc(destFile.getPath());
+ sourceFile.delete();
+ }
+
+ if ( data.getAdminFileNameNoRelocNoDepends() != null ) {
+ File sourceFile = new File(data.getAdminFileNameNoRelocNoDepends());
+ String fileName = sourceFile.getName();
+ File destFile = new File(dir, fileName);
+ boolean success = SystemManager.copy(sourceFile.getPath(), destFile.getPath());
+ data.setAdminFileNameNoRelocNoDepends(destFile.getPath());
+ sourceFile.delete();
+ }
+ }
+
+ static private void createInfoFile(File dir) {
+ Vector fileContent = new Vector();
+ String line = null;
+ InstallData data = InstallData.getInstance();
+
+ line = "PackagePath=" + data.getPackagePath();
+ fileContent.add(line);
+ line = "InstallationPrivileges=" + data.getInstallationPrivileges();
+ fileContent.add(line);
+ line = "AdminFileReloc=" + data.getAdminFileNameReloc();
+ fileContent.add(line);
+ line = "AdminFileRelocNoDepends=" + data.getAdminFileNameRelocNoDepends();
+ fileContent.add(line);
+ line = "AdminFileNoReloc=" + data.getAdminFileNameNoReloc();
+ fileContent.add(line);
+ line = "AdminFileNoRelocNoDepends=" + data.getAdminFileNameNoRelocNoDepends();
+ fileContent.add(line);
+ line = "InstallationDir=" + data.getInstallDir();
+ fileContent.add(line);
+ line = "DatabasePath=" + data.getDatabasePath();
+ fileContent.add(line);
+ line = "GetUidFile=" + data.getGetUidPath();
+ fileContent.add(line);
+
+ String infoFileName = "infoFile";
+ File infoFile = new File(dir, infoFileName);
+ SystemManager.saveCharFileVector(infoFile.getPath(), fileContent);
+ }
+
+ static private void removeSpecialFiles() {
+ InstallData data = InstallData.getInstance();
+ File jarFile = data.getJarFilePath();
+ SystemManager.deleteFile(jarFile);
+
+ String jarFilePath = jarFile.getParent();
+ File setupFile = new File(jarFilePath, "setup");
+ SystemManager.deleteFile(setupFile);
+
+ if ( ! data.getAdminFileNameReloc().equals("null") ) {
+ SystemManager.deleteFile(new File(data.getAdminFileNameReloc()));
+ }
+
+ if ( ! data.getAdminFileNameRelocNoDepends().equals("null") ) {
+ SystemManager.deleteFile(new File(data.getAdminFileNameRelocNoDepends()));
+ }
+
+ if ( ! data.getAdminFileNameNoReloc().equals("null") ) {
+ SystemManager.deleteFile(new File(data.getAdminFileNameNoReloc()));
+ }
+
+ if ( ! data.getAdminFileNameNoRelocNoDepends().equals("null") ) {
+ SystemManager.deleteFile(new File(data.getAdminFileNameNoRelocNoDepends()));
+ }
+
+ if ( ! data.getGetUidPath().equals("null") ) {
+ SystemManager.deleteFile(new File(data.getGetUidPath()));
+ }
+ }
+
+ static private void removeInforootSubdir(String dir1, String dir2) {
+ InstallData data = InstallData.getInstance();
+ File subdir1 = data.getInfoRoot(dir1);
+ File subdir2 = new File(subdir1, dir2);
+ if (subdir2 != null) {
+ if ( subdir2.exists() ) {
+ SystemManager.removeDirectory(subdir2);
+ }
+ }
+ }
+
+ static private void removeInforootSubdir(String dir) {
+ InstallData data = InstallData.getInstance();
+ File subdir = data.getInfoRoot(dir);
+ if (subdir != null) {
+ if ( subdir.exists() ) {
+ SystemManager.removeDirectory(subdir);
+ }
+ }
+ }
+
+ static private void removeInforoot() {
+ InstallData data = InstallData.getInstance();
+ SystemManager.removeDirectory(data.getInfoRoot());
+ }
+
+ static public void prepareUninstallation() {
+ // additional tasks for uninstallation
+ // Directory destDir has to exist!
+ InstallData data = InstallData.getInstance();
+ File destDir = new File(data.getInstallDefaultDir(), data.getProductDir());
+ boolean directoryExists = true;
+
+ if ( ! destDir.exists() ) {
+ try {
+ directoryExists = SystemManager.create_directory(destDir.getPath());
+ }
+ catch (SecurityException ex) {
+ String message = ResourceManager.getString("String_ChooseDirectory_No_Write_Access") + ": " + destDir.getPath();
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+ }
+ }
+
+ if ( directoryExists ) {
+ String setupPath = copySourceFile("setup");
+ SystemManager.setUnixPrivileges(setupPath, "775");
+ File jarFile = data.getJarFilePath();
+ copySourceFile(jarFile.getName());
+
+ File uninstallDir = createUninstallDir();
+ copyInstallDirectoryWithExtension(uninstallDir, "xpd", "xpd");
+ copyInstallDirectoryWithExtension(uninstallDir, "html", "html");
+ copyInstallDirectoryWithExtension(uninstallDir, "images", "gif");
+ copyInstallDirectoryDoubleSubdir(uninstallDir, "html", "images");
+ copyGetUidSoFile(uninstallDir);
+ copyJreFile(uninstallDir);
+ moveAdminFiles(uninstallDir);
+ createInfoFile(uninstallDir);
+ }
+ }
+
+ static public void removeUninstallationFiles() {
+ // removing selected File
+ removeSpecialFiles();
+ // removing directories html/images, html and xpd
+ removeInforootSubdir("html", "images");
+ removeInforootSubdir("html");
+ removeInforootSubdir("xpd");
+ removeInforootSubdir("images");
+ removeInforootSubdir("jre");
+ removeInforoot();
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Informer.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Informer.java
new file mode 100755
index 000000000000..7a3046a1dda0
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Informer.java
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Util;
+
+import javax.swing.JOptionPane;
+
+public class Informer {
+
+ private Informer() {
+ }
+
+ static public void showErrorMessage(String message, String title) {
+ JOptionPane.showMessageDialog(null, message, title, JOptionPane.ERROR_MESSAGE );
+ }
+
+ static public void showInfoMessage(String message, String title) {
+ JOptionPane.showMessageDialog(null, message, title, JOptionPane.INFORMATION_MESSAGE );
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InstallChangeCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InstallChangeCtrl.java
new file mode 100755
index 000000000000..55d2c0a8d0cb
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/InstallChangeCtrl.java
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Util;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.Installer.Installer;
+import org.openoffice.setup.Installer.InstallerFactory;
+import org.openoffice.setup.Panel.ChooseDirectory;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import java.util.Enumeration;
+
+
+public class InstallChangeCtrl {
+
+ private InstallChangeCtrl() {
+ }
+
+ static private void setUpdatePackage(PackageDescription packageData, InstallData installData) {
+ if (( packageData.isUpdatePackage() == true )) {
+ installData.setUpdatePackage(packageData);
+ } else {
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ setUpdatePackage(child, installData);
+ }
+ }
+ }
+
+ static private void setChangeInstallDir(InstallData installData, Installer installer) {
+ // setting the new install dir after analyzing the installation directory
+ // of the installed update package.
+ if ( installData.isRootInstallation() ) {
+ String changeInstallDir = "/";
+ installData.setInstallDir(changeInstallDir);
+ } else {
+ String changeInstallDir = installer.getChangeInstallDir(installData.getUpdatePackage());
+ installData.setInstallDir(changeInstallDir);
+ }
+ }
+
+ // static public void checkInstallChange(InstallData data, ChooseDirectory panel) {
+ static public void checkInstallChange(InstallData data) {
+
+ Installer installer = InstallerFactory.getInstance();
+ PackageDescription packageData = SetupDataProvider.getPackageDescription();
+
+ if ( data.getUpdatePackage() == null ) {
+ setUpdatePackage(packageData, data);
+ }
+
+ if ( data.getUpdatePackage() != null ) {
+
+ // resetting values, if database was changed during user installation
+ data.setOlderVersionExists(false);
+ data.setNewerVersionExists(false);
+ data.setSameVersionExists(false);
+
+ boolean packageIsInstalled = installer.isPackageInstalled(data.getUpdatePackage(), data);
+ if ( packageIsInstalled ) {
+
+ // Checking version of installed package:
+ // If installed package is older: Force update mode, no selection of packages
+ // If installed package is equal: Force maintenance mode, only selection of packages
+ // If installed package is newer: Abort installation with message
+
+ // Setting specific values for the different update scenarios
+ if ( installer.isInstalledPackageOlder(data.getUpdatePackage(), data) ) {
+ data.setOlderVersionExists(true);
+ // All installed packages will be updated -> determining which packages are installed
+ System.err.println("An older product is installed");
+ // But if this is a kind of Major Upgrade with different Minor and therefore different package names,
+ // it is necessary to remove the old product.
+ if ( data.getProductMinor() > data.getInstalledProductMinor() )
+ {
+ data.setMajorUpgrade(true);
+ System.err.println("Major Upgrade");
+ }
+ } else if ( installer.isInstallSetPackageOlder(data.getUpdatePackage(), data) ) {
+ data.setNewerVersionExists(true);
+ System.err.println("A newer product is installed");
+ } else {
+ data.setSameVersionExists(true);
+ System.err.println("Same product is installed");
+ }
+
+ // If installed package is older or equal, the installdir has to be fixed
+ // if this is a root installation
+ if ( data.isRootInstallation() ) {
+ setChangeInstallDir(data, installer);
+ data.setIsChangeInstallation(true);
+ }
+
+ // Exit installation, if update is not wanted and this is a root installation.
+ // In installations without root privileges, the user can choose another installation
+ // directory (ChooseDirectoryCtrl.java).
+ if ( data.isRootInstallation() && data.dontUpdate() && data.olderVersionExists() ) {
+ System.err.println("Error: An older version is already installed in directory " + data.getInstallDir() + "!");
+ String message1 = ResourceManager.getString("String_Older_Version_Installed_Found")
+ + "\n" + data.getInstallDir() + "\n";
+ String message2 = ResourceManager.getString("String_Older_Version_Installed_Remove");
+ String message = message1 + "\n" + message2;
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+ System.exit(1);
+ }
+ }
+ }
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/LogManager.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/LogManager.java
new file mode 100755
index 000000000000..3be95469b532
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/LogManager.java
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Util;
+
+import java.util.Vector;
+
+public class LogManager {
+
+ static private Vector logfile; /* collects all logging information during installation */
+ static private Vector commandsLogFile; /* collects all system commands information during installation */
+ static private Vector saveLogFile; /* contains the content of the saved log file */
+ static private Vector modulesLogFile;
+
+ private LogManager() {
+ }
+
+ static public Vector getSaveLogfile() {
+ return saveLogFile;
+ }
+
+ static public void addLogfileComment(String text) {
+ logfile.add(text);
+ }
+
+ static public void addCommandsLogfileComment(String text) {
+ commandsLogFile.add(text);
+ }
+
+ static public void addModulesLogfileComment(String text) {
+ modulesLogFile.add(text);
+ }
+
+ static public void setCommandsHeaderLine(String text) {
+ String line = "*************************************";
+ commandsLogFile.add("");
+ commandsLogFile.add(line);
+ commandsLogFile.add("<b>" + text + "</b>");
+ commandsLogFile.add(line);
+ commandsLogFile.add("");
+ }
+
+ static public void setModulesLogFileHeaderLine(String text) {
+ String line = "*************************************";
+ modulesLogFile.add(line);
+ modulesLogFile.add(text);
+ modulesLogFile.add(line);
+ }
+
+ static public String publishLogfileContent(String text, String separatorline) {
+ for (int i = 0; i < logfile.size(); i++) {
+ text = text + logfile.get(i) + "<br>";
+ }
+
+ if ( ! logfile.isEmpty() ) {
+ text = text + separatorline + "<br>";
+ }
+
+ return text;
+ }
+
+ static public String publishCommandsLogfileContent(String text) {
+ for (int i = 0; i < commandsLogFile.size(); i++) {
+ text = text + commandsLogFile.get(i) + "<br>";
+ }
+
+ return text;
+ }
+
+ static public Vector getModulesLogFile() {
+ return modulesLogFile;
+ }
+
+ static {
+ logfile = new Vector();
+ commandsLogFile = new Vector();
+ saveLogFile = new Vector();
+ modulesLogFile = new Vector();
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/ModuleCtrl.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/ModuleCtrl.java
new file mode 100755
index 000000000000..8d43fb4d01f1
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/ModuleCtrl.java
@@ -0,0 +1,1004 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Util;
+
+import java.io.File;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.Installer.Installer;
+import org.openoffice.setup.Installer.InstallerFactory;
+import org.openoffice.setup.Panel.ChooseDirectory;
+import org.openoffice.setup.ResourceManager;
+import org.openoffice.setup.SetupData.PackageDescription;
+import org.openoffice.setup.SetupData.SetupDataProvider;
+import org.openoffice.setup.Util.Informer;
+
+public class ModuleCtrl {
+
+ private ModuleCtrl() {
+ }
+
+ static public void setModuleSize(PackageDescription packageData) {
+ // Setting the package size for visible node modules, that have hidden children
+ // -> Java module has three hidden children and 0 byte size
+
+ if (( ! packageData.isLeaf() ) && ( ! packageData.isHidden() )) {
+ boolean setNewSize = false;
+ int size = packageData.getSize();
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ // if (( child.isHidden() ) && ( child.getSelectionState() == PackageDescription.DONT_KNOW )) {
+ if ( child.isHidden() ) {
+ setNewSize = true;
+ size = size + child.getSize();
+ }
+ }
+
+ if ( setNewSize ) {
+ packageData.setSize(size);
+ }
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ setModuleSize(child);
+ }
+
+ }
+
+ static public void setDefaultModuleSettings(PackageDescription data) {
+ // Setting default module settings for modules, that are not hidden
+ // Hidden modules do not get a defined state now
+ boolean isInstalled = false;
+ InstallData installdata = InstallData.getInstance();
+ boolean isUninstall = installdata.isUninstallationMode();
+
+ if (isUninstall) {
+ isInstalled = true;
+ }
+
+ if (isUninstall) {
+ if (isInstalled) {
+ data.setSelectionState(PackageDescription.REMOVE);
+ } else {
+ data.setSelectionState(PackageDescription.IGNORE);
+ System.err.println("NEVER");
+ }
+ } else {
+ if (isInstalled) {
+ data.setSelectionState(PackageDescription.IGNORE);
+ System.err.println("NEVER");
+ } else if (data.isDefault()) {
+ data.setSelectionState(PackageDescription.INSTALL);
+ } else if ( ! data.isDefault()) {
+ data.setSelectionState(PackageDescription.DONT_INSTALL);
+ } else {
+ data.setSelectionState(PackageDescription.DONT_INSTALL);
+ }
+ }
+ }
+
+ static public void setParentDefaultModuleSettings(PackageDescription packageData) {
+ // Setting the module states of parent modules.
+ // Called after ChooseDirectoryCtrl.java, because
+ // the database has to be known. In user installation it is important,
+ // that the installation directory is known, to find the database.
+ // Called during uninstallation in UninstallationPrologueCtrl.java
+
+ // Iteration before setting the module states. Because of this, all children
+ // get their final setting before the parent.
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ setParentDefaultModuleSettings(child);
+ }
+
+ if ( ! packageData.isLeaf() ) {
+ // System.err.println("setParentDefaultModuleSettings: " + packageData.getName());
+ int state = packageData.getSelectionState();
+ InstallData installdata = InstallData.getInstance();
+ boolean allChildrenIgnored = true;
+ boolean atLeastOneInstalled = false;
+ boolean allChildrenHidden = true;
+
+ // System.err.println(" STATE before iterating over children: " + state);
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements();) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ int childState = child.getSelectionState();
+
+ // System.err.println(" Child: " + child.getName() + " : " + childState);
+
+ if ( childState != PackageDescription.IGNORE) {
+ allChildrenIgnored = false;
+ }
+
+ if (( childState == PackageDescription.INSTALL) || ( childState == PackageDescription.INSTALL_SOME)) {
+ atLeastOneInstalled = true;
+ }
+
+ if ( ! child.isHidden() ) {
+ allChildrenHidden = false;
+ }
+
+ if ((state == PackageDescription.DONT_KNOW) || (state == PackageDescription.IGNORE)) {
+ state = childState;
+ // } else if ((state != childState) && (childState != PackageDescription.IGNORE)) {
+ } else if ((state != childState) && (childState != PackageDescription.IGNORE) && (childState != PackageDescription.DONT_KNOW)) {
+ if ( installdata.isUninstallationMode() ) {
+ state = PackageDescription.REMOVE_SOME;
+ } else {
+ state = PackageDescription.INSTALL_SOME;
+ }
+ }
+
+ // System.err.println(" NEW state after child: " + state);
+ }
+
+ if ( allChildrenIgnored ) {
+ state = PackageDescription.IGNORE;
+ }
+
+ if ( installdata.isInstallationMode() ) {
+ if (( state == PackageDescription.INSTALL_SOME ) && ( ! atLeastOneInstalled )) {
+ state = PackageDescription.DONT_INSTALL;
+ }
+ }
+
+ if ( allChildrenHidden ) {
+ packageData.setAllChildrenHidden(true);
+ // System.err.println("Setting allChildrenHidden for module " + packageData.getName() );
+ }
+
+ // If older version exist, only modules without packages shall be updated,
+ // because all packages are already determined by querying the database.
+ if ( installdata.olderVersionExists() ) {
+ if ( packageData.getPackageName().equals("") ) {
+ packageData.setSelectionState(state);
+ }
+ } else {
+ packageData.setSelectionState(state);
+ }
+ }
+ }
+
+ static public void setHiddenModuleSettingsInstall(PackageDescription packageData) {
+ // update selection states for hidden modules during installation
+ if (( packageData.isHidden() ) && ( packageData.getSelectionState() != packageData.IGNORE )) {
+ PackageDescription parent = (PackageDescription)packageData.getParent();
+ if ( parent != null ) {
+ packageData.setSelectionState(parent.getSelectionState());
+ // hidden modules at root module always have to be installed, if they are not already installed
+ if ( parent.getName() == "" ) {
+ packageData.setSelectionState(packageData.INSTALL);
+ // System.err.println("Setting 1 INSTALL flag to: " + packageData.getName());
+ }
+ }
+
+ // INSTALL_SOME is not valid for leaves
+ if (( packageData.getSelectionState() == packageData.INSTALL_SOME ) && ( packageData.isLeaf() )) {
+ packageData.setSelectionState(packageData.INSTALL);
+ // System.err.println("Setting 2 INSTALL flag to: " + packageData.getName());
+ }
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ setHiddenModuleSettingsInstall(child);
+ }
+ }
+
+ static public void setHiddenModuleSettingsUninstall(PackageDescription packageData) {
+ InstallData data = InstallData.getInstance();
+ // update selection states for hidden modules during uninstallation
+ if (( packageData.isHidden() ) && ( packageData.getSelectionState() != packageData.IGNORE )) {
+ // System.err.println("Package name: " + packageData.getName());
+ // System.err.println("Selection: " + packageData.getSelectionState());
+
+ PackageDescription parent = (PackageDescription)packageData.getParent();
+ if ( parent != null ) {
+ packageData.setSelectionState(parent.getSelectionState());
+ // Hidden modules at root module have to be uninstalled at complete uninstallation
+ // In Uninstallation the complete is the typical installation type
+ if (( parent.getName() == "" ) && ( data.isTypicalInstallation() )) {
+ packageData.setSelectionState(packageData.REMOVE);
+ }
+ // Hidden modules at root module must not be uninstalled at custom uninstallation
+ // But if all visible modules are selected for uninstallation, this shall be handled
+ // as complete uninstallation.
+ if ( ! data.isMaskedCompleteUninstallation() )
+ {
+ if (( parent.getName() == "" ) && ( data.isCustomInstallation() )) {
+ packageData.setSelectionState(packageData.IGNORE);
+ }
+ }
+ }
+
+ // REMOVE_SOME is not valid for leaves
+ // if ( data.isTypicalInstallation() ) {
+ if (( packageData.getSelectionState() == packageData.REMOVE_SOME ) && ( packageData.isLeaf() )) {
+ packageData.setSelectionState(packageData.REMOVE);
+ }
+ // }
+
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ setHiddenModuleSettingsUninstall(child);
+ }
+ }
+
+ static private boolean checkRequiredCoreModule(PackageDescription packageData) {
+
+ // This function uses a similar mechanism to determine
+ // core modules as function "setHiddenModuleSettingsInstall"
+ // -> only hidden parents, until there is a module without name (getName)
+ // Only searching until grandpa.
+
+ boolean requiredCoreModule = false;
+
+ // if packageData.getSelectionState() DONT_KNOW && parent auch DONT_KNOW
+ if (( packageData.isHidden() ) &&
+ ( packageData.getSelectionState() != packageData.IGNORE ) &&
+ ( packageData.getPackageName() != null )) {
+ //( packageData.isLeaf() )) {
+ PackageDescription parent = (PackageDescription)packageData.getParent();
+ if ( parent != null ) {
+ if (( parent.getName().equals("") ) || ( parent.getName() == null )) {
+ requiredCoreModule = true;
+ } else {
+ if ( parent.isHidden() ) {
+ PackageDescription grandpa = (PackageDescription)parent.getParent();
+ if ( grandpa != null ) {
+ if (( grandpa.getName().equals("") ) || ( grandpa.getName() == null )) {
+ requiredCoreModule = true;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return requiredCoreModule;
+ }
+
+ static public void setDatabaseSettings(PackageDescription packageData, InstallData installData, Installer installer) {
+ // Analyzing the system database and setting the module states.
+ // Called during installation in ChooseInstallationTypeCtrl.java, because
+ // the database has to be known. In user installation it is important,
+ // the the installation directory is known, to find the database.
+ // Called during uninstallation in UninstallationPrologueCtrl.java
+
+ boolean isUninstall = installData.isUninstallationMode();
+ boolean isInstalled = installer.isPackageInstalled(packageData, installData);
+
+ if (isUninstall) {
+ if (isInstalled) {
+ packageData.setSelectionState(PackageDescription.REMOVE);
+ // The following is no longer required !? (IS, 06/05/08)
+ // PackageDescription parent = packageData.getParent();
+ // if ( parent != null ) {
+ // if ( parent.getSelectionState() != PackageDescription.REMOVE ) {
+ // parent.setSelectionState(PackageDescription.REMOVE);
+ // System.err.println("Setting remove to " + parent.getName());
+ // }
+ // }
+ } else {
+ // Attention: Setting all nodes to ignore! If a children gets REMOVE,
+ // then REMOVE is also set to the parent. Setting REMOVE happens after
+ // setting IGNORE, because children are evaluated after the parents.
+ // The default for uninstallation is set in setDefaultModuleSettings to REMOVE.
+ packageData.setSelectionState(PackageDescription.IGNORE);
+ }
+ } else {
+ boolean goodDepends = true;
+ if ( installData.getOSType().equalsIgnoreCase("SunOS") ) {
+ if (( installData.isRootInstallation() ) && ( packageData.getCheckSolaris() != null ) && ( ! packageData.getCheckSolaris().equals("") )) {
+ // the package has to be installed. Creating a new package with only packagename
+ if ( ! installer.isPackageNameInstalled(packageData.getCheckSolaris(), installData) ) {
+ goodDepends = false;
+ }
+ }
+ }
+
+ if ( ! goodDepends ) {
+ // The package dependencies are not valid -> ignoring package.
+ packageData.setSelectionState(PackageDescription.IGNORE);
+ // too late to hide the module
+ // packageData.setIsHidden(true);
+ }
+ else {
+ if ( isInstalled ) {
+ if ( packageData.isJavaPackage() ) { // only selected checks, because of performance reasons
+ boolean installedPackageIsOlder = installer.isInstalledPackageOlder(packageData, installData);
+ if ( ! installedPackageIsOlder ) {
+ // The package is already installed in the same or in a newer version
+ packageData.setSelectionState(PackageDescription.IGNORE);
+ } else {
+ // This is also something like migrating feature states
+ packageData.setSelectionState(PackageDescription.INSTALL);
+ }
+ } else { // no version check done -> so what is a good setting for already installed packages?
+ if ( installData.olderVersionExists() ) { // should never be the case in this function
+ packageData.setSelectionState(PackageDescription.INSTALL);
+ } else {
+ packageData.setSelectionState(PackageDescription.IGNORE);
+ }
+ }
+ }
+ else {
+ // Special handling for core modules, which are required, but not installed.
+ // This can be deinstalled by hand for example.
+ boolean isRequiredCoreModule = checkRequiredCoreModule(packageData);
+ if ( isRequiredCoreModule ) {
+ if ( packageData.getSelectionState() != PackageDescription.INSTALL ) {
+ packageData.setSelectionState(PackageDescription.INSTALL);
+ LogManager.addLogfileComment("<b>Adding required package:</b> " + packageData.getPackageName() + "</br>");
+ }
+ // This package has to exist!
+ if ( ! packageExists(packageData, installData) ) {
+
+ String packagePath = installData.getPackagePath();
+ if (( packageData.getPkgSubdir() != null ) && ( ! packageData.getPkgSubdir().equals("") )) {
+ File completePackageFile = new File(packagePath, packageData.getPkgSubdir());
+ packagePath = completePackageFile.getPath();
+ }
+ String packageName = packageData.getPackageName();
+ File packageFile = new File(packagePath, packageName);
+
+ String log = "<b>Error: Missing required package " + packageFile.getPath() + "</b><br>";
+ System.err.println(log);
+ String message = ResourceManager.getString("String_File_Not_Found") + ": " + packageFile.getPath();
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+ System.exit(1);
+ }
+ }
+ }
+ }
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ setDatabaseSettings(child, installData, installer);
+ }
+ }
+
+ static public void setShowInUserInstallFlags(PackageDescription packageData) {
+
+ // This function is not needed during deinstallation, because a
+ // module that could not be selected during installation, is always
+ // not installed during deinstallation and therefore gets "IGNORE"
+ // in function setDatabaseSettings
+
+ if ( ! packageData.showInUserInstall() ) {
+ packageData.setSelectionState(PackageDescription.IGNORE);
+ // too late to hide the module
+ // packageData.setIsHidden(true);
+ // packageData.setAllChildrenHidden(true);
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ setShowInUserInstallFlags(child);
+ }
+ }
+
+ static public void setForcedUpdateProductSettings(PackageDescription packageData) {
+
+ if ( packageData.forceIntoUpdate() ) {
+ packageData.setSelectionState(PackageDescription.INSTALL);
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ setForcedUpdateProductSettings(child);
+ }
+ }
+
+ static public void setShowInUserInstallOnlyFlags(PackageDescription packageData) {
+
+ // This function is not needed during deinstallation, because a
+ // module that could not be selected during installation, is always
+ // not installed during deinstallation and therefore gets "IGNORE"
+ // in function setDatabaseSettings
+
+ if ( packageData.showInUserInstallOnly() ) {
+ packageData.setSelectionState(PackageDescription.IGNORE);
+ // too late to hide the module
+ // packageData.setIsHidden(true);
+ // packageData.setAllChildrenHidden(true);
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ setShowInUserInstallOnlyFlags(child);
+ }
+ }
+
+ static public void setIgnoreNonRelocatablePackages(PackageDescription packageData) {
+ if ( ! packageData.isRelocatable() ) {
+ packageData.setSelectionState(PackageDescription.IGNORE);
+ System.err.println("Ignoring package " + packageData.getName() + " " + packageData.getPackageName());
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ setIgnoreNonRelocatablePackages(child);
+ }
+ }
+
+ static public void setHiddenLanguageModuleDefaultSettings(PackageDescription packageData) {
+
+ // This function is needed during installation for the language modules,
+ // if there is only one language in the installation set. In this case the language
+ // modules are hidden (no selection possible) and therefore get no value in
+ // setDefaultModuleSettings(). This default value is set now.
+
+ if ( packageData.showMultiLingualOnly() ) {
+ packageData.setSelectionState(PackageDescription.INSTALL);
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ setHiddenLanguageModuleDefaultSettings(child);
+ }
+ }
+
+ static private boolean packageExists(PackageDescription packageData, InstallData installData) {
+ boolean fileExists = false;
+ String packagePath = installData.getPackagePath();
+
+ if (( packageData.getPkgSubdir() != null ) && ( ! packageData.getPkgSubdir().equals("") )) {
+ File completePackageFile = new File(packagePath, packageData.getPkgSubdir());
+ packagePath = completePackageFile.getPath();
+ }
+
+ String packageName = packageData.getPackageName();
+ File packageFile = new File(packagePath, packageName);
+
+ if ( packageFile.exists() ) {
+ fileExists = true;
+ }
+
+ return fileExists;
+ }
+
+ static public void disableNonExistingPackages(PackageDescription packageData, InstallData installData) {
+ if ((( packageData.getPackageName() == null ) || ( packageData.getPackageName().equals("") ))
+ && packageData.isLeaf() ) {
+ packageData.setSelectionState(PackageDescription.IGNORE);
+ } else if ( ! packageExists(packageData, installData) ) {
+ packageData.setSelectionState(PackageDescription.IGNORE);
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ disableNonExistingPackages(child, installData);
+ }
+ }
+
+ static public void setDontUninstallFlags(PackageDescription packageData) {
+ if ( packageData.dontUninstall() ) {
+ packageData.setSelectionState(PackageDescription.IGNORE);
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ setDontUninstallFlags(child);
+ }
+ }
+
+ static public void setDontUninstallUserInstallOnylFlags(PackageDescription packageData) {
+ if ( packageData.showInUserInstallOnly() ) {
+ packageData.setSelectionState(PackageDescription.IGNORE);
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ setDontUninstallUserInstallOnylFlags(child);
+ }
+ }
+
+ static public void checkVisibleModulesInstall(PackageDescription packageData, InstallData data) {
+ boolean setToTrue = false;
+
+ if (( ! packageData.isHidden() ) && ( packageData.getSelectionState() == packageData.INSTALL )) {
+ setToTrue = true;
+ data.setVisibleModulesChecked(true);
+ }
+
+ if ( ! setToTrue ) {
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ checkVisibleModulesInstall(child, data);
+ }
+ }
+ }
+
+ static public void checkApplicationSelection(PackageDescription packageData, InstallData data) {
+ boolean setToTrue = false;
+
+ if (( packageData.isApplicationPackage() ) &&
+ ( ! packageData.isHidden() ) &&
+ ( packageData.getSelectionState() == packageData.INSTALL )) {
+ setToTrue = true;
+ data.setApplicationModulesChecked(true);
+ }
+
+ if ( ! setToTrue ) {
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ checkApplicationSelection(child, data);
+ }
+ }
+ }
+
+ static public void checkLanguageSelection(PackageDescription packageData, InstallData data) {
+ boolean setToTrue = false;
+
+ if (( packageData.showMultiLingualOnly() ) &&
+ ( ! packageData.isHidden() ) &&
+ ( packageData.getSelectionState() == packageData.INSTALL )) {
+ setToTrue = true;
+ data.setLanguageModulesChecked(true);
+ }
+
+ if ( ! setToTrue ) {
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ checkLanguageSelection(child, data);
+ }
+ }
+ }
+
+ static public void checkVisibleModulesUninstall(PackageDescription packageData, InstallData data) {
+ boolean setToTrue = false;
+
+ if (( ! packageData.isHidden() ) && ( packageData.getSelectionState() == packageData.REMOVE )) {
+ // ignoring the top level module, that has the state REMOVE (but no name)
+ if (( packageData.getName() != null ) && ( ! packageData.getName().equals("") )) {
+ setToTrue = true;
+ data.setVisibleModulesChecked(true);
+ }
+ }
+
+ if ( ! setToTrue ) {
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ checkVisibleModulesUninstall(child, data);
+ }
+ }
+ }
+
+ static public void checkApplicationModulesUninstall(PackageDescription packageData, InstallData data) {
+ boolean setToTrue = false;
+
+ // At least one language module should not be uninstalled. Then this function returns true.
+ // An exeption is the complete uninstallation or the masked complete uninstallation.
+
+ if (( packageData.isApplicationPackage() ) &&
+ ( ! packageData.isHidden() ) &&
+ ( packageData.getSelectionState() != packageData.IGNORE ) &&
+ ( packageData.getSelectionState() != packageData.REMOVE )) {
+ setToTrue = true;
+ data.setApplicationModulesChecked(true);
+ }
+
+ if ( ! setToTrue ) {
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ checkApplicationModulesUninstall(child, data);
+ }
+ }
+ }
+
+ static public void checkLanguageModulesUninstall(PackageDescription packageData, InstallData data) {
+ boolean setToTrue = false;
+
+ // At least one language module should not be uninstalled. Then this function returns true.
+ // An exeption is the complete uninstallation or the masked complete uninstallation.
+
+ if (( packageData.showMultiLingualOnly() ) &&
+ ( ! packageData.isHidden() ) &&
+ ( packageData.getSelectionState() != packageData.IGNORE ) &&
+ ( packageData.getSelectionState() != packageData.REMOVE )) {
+ setToTrue = true;
+ data.setLanguageModulesChecked(true);
+ }
+
+ if ( ! setToTrue ) {
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ checkLanguageModulesUninstall(child, data);
+ }
+ }
+ }
+
+ static public void checkMaskedCompleteUninstallation(PackageDescription packageData, InstallData data) {
+ boolean setToFalse = false;
+
+ // If there is at least one visible module, that is not selected for removal
+ // this is no masked complete uninstallation
+
+ if (( ! packageData.isHidden() )
+ && ( packageData.getSelectionState() != packageData.REMOVE )
+ && ( packageData.getSelectionState() != packageData.IGNORE )) {
+ // ignoring the top level module, that has no name
+ if (( packageData.getName() != null ) && ( ! packageData.getName().equals("") )) {
+ setToFalse = true;
+ data.setMaskedCompleteUninstallation(false);
+ // System.err.println("This is no masked complete uninstallation!");
+ // System.err.println("Caused by: " + packageData.getName() + " with " + packageData.getSelectionState());
+ }
+ }
+
+ if ( ! setToFalse ) {
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ checkMaskedCompleteUninstallation(child, data);
+ }
+ }
+ }
+
+ static public void saveTypicalSelectionStates(PackageDescription packageData) {
+ packageData.setTypicalSelectionState(packageData.getSelectionState());
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ saveTypicalSelectionStates(child);
+ }
+ }
+
+ static public void saveCustomSelectionStates(PackageDescription packageData) {
+ packageData.setCustomSelectionState(packageData.getSelectionState());
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ saveCustomSelectionStates(child);
+ }
+ }
+
+ static public void saveStartSelectionStates(PackageDescription packageData) {
+ packageData.setStartSelectionState(packageData.getSelectionState());
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ saveStartSelectionStates(child);
+ }
+ }
+
+ static public void restoreTypicalSelectionStates(PackageDescription packageData) {
+ packageData.setSelectionState(packageData.getTypicalSelectionState());
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ restoreTypicalSelectionStates(child);
+ }
+ }
+
+ static public void restoreCustomSelectionStates(PackageDescription packageData) {
+ packageData.setSelectionState(packageData.getCustomSelectionState());
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ restoreCustomSelectionStates(child);
+ }
+ }
+
+ static public void restoreStartSelectionStates(PackageDescription packageData) {
+ packageData.setSelectionState(packageData.getStartSelectionState());
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ restoreStartSelectionStates(child);
+ }
+ }
+
+ static public void setUpdateOlderProductSettings(PackageDescription packageData, InstallData data, Installer installer) {
+ if (( packageData.getPackageName() != null ) && ( ! packageData.getPackageName().equals(""))) {
+ if ( installer.isPackageInstalled(packageData, data) ) {
+ packageData.setSelectionState(PackageDescription.INSTALL);
+
+ // Special handling for jre package, because this is not necessarily older, if an older product is updated.
+ if ( packageData.isJavaPackage() ) {
+ if ( ! installer.isInstalledPackageOlder(packageData, data) ) {
+ packageData.setSelectionState(PackageDescription.DONT_INSTALL);
+ }
+ }
+ } else {
+ packageData.setSelectionState(PackageDescription.DONT_INSTALL);
+ // Special handling for Major Upgrade
+ if ( data.isMajorUpgrade() ) {
+ String basis = "ooobasis3";
+ if ( data.getOSType().equalsIgnoreCase("Linux") ) { basis = basis + "."; }
+ String search = basis + data.getProductMinor();
+ String replacestring = basis + data.getInstalledProductMinor();
+ int pos = packageData.getPackageName().indexOf(search);
+ if ( pos > -1 ) {
+ // Check if this package is installed with a lower product minor
+ // Creating new package for removal, very simple PackageDescription
+ PackageDescription localPackage = new PackageDescription();
+ localPackage.setUninstallCanFail(true);
+ localPackage.setIsRelocatable(packageData.isRelocatable());
+ String localName = packageData.getPackageName();
+ localName = localName.replace(search, replacestring);
+ localPackage.setPackageName(localName);
+
+ if ( ( packageData.getPkgRealName() != null ) && ( ! packageData.getPkgRealName().equals("") )) {
+ localName = packageData.getPkgRealName();
+ localName = localName.replace(search, replacestring);
+ localPackage.setPkgRealName(localName);
+ }
+
+ if (( packageData.getName() != null ) && ( ! packageData.getName().equals("") )) {
+ localName = packageData.getName();
+ localName = localName.replace(search, replacestring);
+ localPackage.setName(localName);
+ }
+
+ // saving also the order, needed for order of uninstallation
+ localPackage.setOrder(packageData.getOrder());
+
+ // If the old package is installed, the new package can be installed, too,
+ // and the old package can be marked for removal (with dependency check).
+ if ( installer.isPackageInstalled(localPackage, data) ) {
+ packageData.setSelectionState(PackageDescription.INSTALL);
+
+ // Collecting all installed older packages for uninstallation
+ Vector oldPackages = data.getOldPackages();
+ oldPackages.add(localPackage);
+ data.setOldPackages(oldPackages);
+ }
+ }
+ }
+ }
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ setUpdateOlderProductSettings(child, data, installer);
+ }
+ }
+
+ static public void checkLanguagesPackages(PackageDescription packageData, InstallData installData) {
+ if (( packageData.getPkgLanguage() != null ) && ( ! packageData.getPkgLanguage().equals(""))) {
+ // This is a package with a specific language.
+ // pkgLanguage can be a comma separated list, for example "ja,ja_JP.PCK,ja_JP.UTF-8"
+ String allLang = packageData.getPkgLanguage();
+ String[] allLangs = allLang.split(",");
+
+ Vector systemLanguages = installData.getSystemLanguages();
+
+ boolean foundLang = false;
+ for (int i = 0; i < allLangs.length; i++) {
+ String oneLang = allLangs[i];
+ oneLang = oneLang.trim();
+ if ( systemLanguages.contains(oneLang)) {
+ foundLang = true;
+ int count = installData.getPreselectedLanguages();
+ count++;
+ installData.setPreselectedLanguages(count);
+ break;
+ }
+ }
+
+ if ( ! foundLang ) {
+ packageData.setSelectionState(PackageDescription.DONT_INSTALL);
+ }
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ checkLanguagesPackages(child, installData);
+ }
+ }
+
+ static public void setLanguagesPackages(PackageDescription packageData) {
+ if (( packageData.getPkgLanguage() != null ) && ( ! packageData.getPkgLanguage().equals(""))) {
+ // This is a package with a specific language.
+ packageData.setSelectionState(PackageDescription.INSTALL);
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ setLanguagesPackages(child);
+ }
+ }
+
+ static public void setRequiredNewCoreModules(PackageDescription packageData, InstallData installData) {
+ // Special handling for core modules, which are required, but not installed.
+ boolean isRequiredCoreModule = checkRequiredCoreModule(packageData);
+ if ( isRequiredCoreModule ) {
+ if ( packageData.getSelectionState() != PackageDescription.INSTALL ) {
+ packageData.setSelectionState(PackageDescription.INSTALL);
+ LogManager.addLogfileComment("<b>Adding required package:</b> " + packageData.getPackageName() + "</br>");
+ }
+ // This package has to exist!
+ if ( ! packageExists(packageData, installData) ) {
+
+ String packagePath = installData.getPackagePath();
+ if (( packageData.getPkgSubdir() != null ) && ( ! packageData.getPkgSubdir().equals("") )) {
+ File completePackageFile = new File(packagePath, packageData.getPkgSubdir());
+ packagePath = completePackageFile.getPath();
+ }
+ String packageName = packageData.getPackageName();
+ File packageFile = new File(packagePath, packageName);
+
+ String log = "<b>Error: Missing required package " + packageFile.getPath() + "</b><br>";
+ System.err.println(log);
+ String message = ResourceManager.getString("String_File_Not_Found") + ": " + packageFile.getPath();
+ String title = ResourceManager.getString("String_Error");
+ Informer.showErrorMessage(message, title);
+ System.exit(1);
+ }
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ setRequiredNewCoreModules(child, installData);
+ }
+ }
+
+ static public void defaultDatabaseAnalysis(InstallData data) {
+
+ PackageDescription packageData = SetupDataProvider.getPackageDescription();
+ Installer installer = InstallerFactory.getInstance();
+
+ // restore default settings
+ if ( data.startSelectionStateSaved() ) {
+ // System.err.println("Restoring start selection states");
+ ModuleCtrl.restoreStartSelectionStates(packageData);
+ } else {
+ ModuleCtrl.saveStartSelectionStates(packageData);
+ data.setStartSelectionStateSaved(true);
+ }
+
+ // Special ToDos, if this is an update installation of an older product.
+ // In this case, "chooseInstallationType" and "chooseComponents" are not called.
+ // Is it necessary to call "analyzeDatabase" ?
+ if ( data.olderVersionExists() ) {
+ // Calculation of size is not necessary, because only
+ // already installed packages will be updated.
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "ChooseDirectory: Before setUpdateOlderProductSettings");
+ }
+
+ // Updating only those packages that are installed.
+ ModuleCtrl.setUpdateOlderProductSettings(packageData, data, installer);
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "ChooseDirectory: After setUpdateOlderProductSettings");
+ }
+
+ // Setting packages that are forced into update, because they did not exist in older version.
+ ModuleCtrl.setForcedUpdateProductSettings(packageData);
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "ChooseDirectory: After setForcedUpdateProductSettings");
+ }
+
+ // Setting required root module packages (that are new in the update product).
+ ModuleCtrl.setRequiredNewCoreModules(packageData, data);
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "ChooseDirectory: After setRequiredNewCoreModules");
+ }
+
+ // Checking, if all packages are available
+ ModuleCtrl.disableNonExistingPackages(packageData, data);
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "ChooseDirectory: After disableNonExistingPackages");
+ }
+
+ // disable packages, that are not valid in user installation
+ if ( data.isUserInstallation() ) {
+ ModuleCtrl.setShowInUserInstallFlags(packageData);
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "ChooseDirectory: After setShowInUserInstallFlags");
+ }
+ }
+ else { // disable packages, that are not valid in root installation
+ ModuleCtrl.setShowInUserInstallOnlyFlags(packageData);
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "ChooseDirectory: After setShowInUserInstallOnlyFlags");
+ }
+ }
+
+ // Setting parent module settings. Only required for displaying correct module settings before starting installation.
+ ModuleCtrl.setParentDefaultModuleSettings(packageData);
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "ChooseDirectory: After setParentDefaultModuleSettings");
+ }
+
+ // Collecting packages to install
+ // This has to be done here, because "ChooseInstallationType" and "ChooseComponents"
+ // are not called.
+ Vector installPackages = new Vector();
+ PackageCollector.collectInstallPackages(packageData, installPackages);
+ data.setInstallPackages(installPackages);
+
+ } else { // same version exists or no version exists
+
+ // database changed -> ignore saved states
+ data.setTypicalSelectionStateSaved(false);
+ data.setCustomSelectionStateSaved(false);
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "analyzeDatabase: Start");
+ }
+
+ // searching in the database for already installed packages
+ LogManager.setCommandsHeaderLine("Analyzing system database");
+ ModuleCtrl.setDatabaseSettings(packageData, data, installer);
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "analyzeDatabase: After setDatabaseSettings");
+ }
+
+ // ModuleCtrl.analyzeDatabase();
+ ModuleCtrl.disableNonExistingPackages(packageData, data);
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "ChooseDirectory: After disableNonExistingPackages");
+ }
+
+ // disable packages, that are not valid in user installation
+ if ( data.isUserInstallation() ) {
+ ModuleCtrl.setShowInUserInstallFlags(packageData);
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "ChooseDirectory: After setShowInUserInstallFlags");
+ }
+ } else { // disable packages, that are not valid in root installation
+ ModuleCtrl.setShowInUserInstallOnlyFlags(packageData);
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "ChooseDirectory: After setShowInUserInstallOnlyFlags");
+ }
+ }
+
+ // Problem: If all submodules have flag IGNORE, the parent can also get IGNORE
+ // That is interesting for language packs with three submodules.
+ ModuleCtrl.setParentDefaultModuleSettings(packageData);
+
+ if ( data.logModuleStates() ) {
+ Dumper.logModuleStates(packageData, "ChooseDirectory: After setParentDefaultModuleSettings");
+ }
+ }
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/PackageCollector.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/PackageCollector.java
new file mode 100755
index 000000000000..4e1c4d5866e2
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/PackageCollector.java
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Util;
+
+import org.openoffice.setup.InstallData;
+import org.openoffice.setup.SetupData.PackageDescription;
+import java.util.Enumeration;
+import java.util.Vector;
+
+public class PackageCollector {
+
+ private PackageCollector() {
+ }
+
+ static public void collectInstallPackages(PackageDescription packageData, Vector allPackages) {
+
+ if (( packageData.isLeaf() ) && ( packageData.getSelectionState() == packageData.INSTALL )) {
+ allPackages.add(packageData);
+ // System.err.println("Adding to collector 1: " + packageData.getPackageName());
+ }
+
+ // also allowing packages at nodes!
+ if (( ! packageData.isLeaf() ) &&
+ ( packageData.getPackageName() != null ) &&
+ ( ! packageData.getPackageName().equals("")) &&
+ (( packageData.getSelectionState() == packageData.INSTALL ) ||
+ ( packageData.getSelectionState() == packageData.INSTALL_SOME ))) {
+ allPackages.add(packageData);
+ // System.err.println("Adding to collector 2: " + packageData.getPackageName());
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ collectInstallPackages(child, allPackages);
+ }
+
+ }
+
+ static public void collectUninstallPackages(PackageDescription packageData, Vector allPackages) {
+ if (( packageData.isLeaf() ) && ( packageData.getSelectionState() == packageData.REMOVE )) {
+ allPackages.add(0, packageData);
+ }
+
+ // also allowing packages at nodes!
+ if (( ! packageData.isLeaf() ) &&
+ ( packageData.getPackageName() != null ) &&
+ ( ! packageData.getPackageName().equals("")) &&
+ ( packageData.getSelectionState() == packageData.REMOVE )) {
+ allPackages.add(0, packageData);
+ }
+
+ for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
+ PackageDescription child = (PackageDescription) e.nextElement();
+ collectUninstallPackages(child, allPackages);
+ }
+ }
+
+ // Special handling for packages, that change their name, and therefore need to be uninstalled
+
+ // static public void findOldPackages( InstallData installData ) {
+ //
+ // String basis = "ooobasis3";
+ // if ( installData.getOSType().equalsIgnoreCase("Linux") ) { basis = basis + "."; }
+ // String search = basis + installData.getProductMinor();
+
+ // Vector allPackages = installData.getInstallPackages();
+ // Vector oldPackages = new Vector();
+
+ // for (int i = 0; i < allPackages.size(); i++) {
+ // PackageDescription packageData = (PackageDescription) allPackages.get(i);
+ // int pos = packageData.getPackageName().indexOf(search);
+
+ // if ( pos > -1 ) {
+ // String substring = packageData.getPackageName().substring(pos, pos + 1);
+ // for (int j = 0; j < installData.getProductMinor(); j++) {
+ // String replace = basis + j;
+ // // Creating new package for removal, very simple PackageDescription
+ // PackageDescription localPackage = new PackageDescription();
+ // localPackage.setUninstallCanFail(true);
+ // localPackage.setIsRelocatable(packageData.isRelocatable());
+ // String localName = packageData.getPackageName();
+ // localName = localName.replace(search, replace);
+ // localPackage.setPackageName(localName);
+
+ // if ( ( packageData.getPkgRealName() != null ) && ( ! packageData.getPkgRealName().equals("") )) {
+ // localName = packageData.getPkgRealName();
+ // localName = localName.replace(search, replace);
+ // localPackage.setPkgRealName(localName);
+ // }
+
+ // if (( packageData.getName() != null ) && ( ! packageData.getName().equals("") )) {
+ // localName = packageData.getName();
+ // localName = localName.replace(search, replace);
+ // localPackage.setName(localName);
+ // }
+
+ // oldPackages.add(localPackage);
+ // }
+ // }
+ // }
+
+ // // reverse order for uninstallation
+ // int number = oldPackages.size();
+ // for (int i = 0; i < number; i++) {
+ // if ( i > 0 ) {
+ // PackageDescription oldPackageData = (PackageDescription) oldPackages.remove(i);
+ // oldPackages.add(0,oldPackageData);
+ // }
+ // }
+
+ // installData.setOldPackages(oldPackages);
+ // }
+
+ static public void sortPackages(Vector allPackages, Vector sortedPackages, String mode) {
+ for (int i = 0; i < allPackages.size(); i++) {
+ boolean integrated = false;
+ PackageDescription packageData = (PackageDescription) allPackages.get(i);
+
+ if ( i == 0 ) {
+ sortedPackages.add(packageData);
+ integrated = true;
+ } else {
+ int position = packageData.getOrder();
+ for (int j = 0; j < sortedPackages.size(); j++) {
+ PackageDescription sortedPackageData = (PackageDescription) sortedPackages.get(j);
+ int compare = sortedPackageData.getOrder();
+
+ if ( position < compare ) {
+ sortedPackages.add(j, packageData);
+ integrated = true;
+ break;
+ }
+ }
+
+ // no break used -> adding at the end
+ if ( ! integrated ) {
+ sortedPackages.add(packageData);
+ }
+ }
+ }
+
+ // reverse order for uninstallation
+ if ( mode.equalsIgnoreCase("uninstall")) {
+ int number = sortedPackages.size();
+ for (int i = 0; i < number; i++) {
+ if ( i > 0 ) {
+ PackageDescription sortPackageData = (PackageDescription) sortedPackages.remove(i);
+ sortedPackages.add(0,sortPackageData);
+ }
+ }
+ }
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Parser.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Parser.java
new file mode 100755
index 000000000000..6c22222fa27d
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/Parser.java
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Util;
+
+public class Parser {
+
+ private Parser() {
+ }
+
+ static public boolean parseBoolean(String input) {
+ boolean value;
+ if ( input.equalsIgnoreCase("true")) {
+ value = true;
+ } else if ( input.equalsIgnoreCase("false")) {
+ value = false;
+ } else {
+ value = false;
+ System.err.println("Cannot convert String to boolean: " + input);
+ System.exit(1);
+ }
+ return value;
+ }
+
+}
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/SystemManager.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/SystemManager.java
new file mode 100755
index 000000000000..f0a3619054bb
--- /dev/null
+++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/Util/SystemManager.java
@@ -0,0 +1,484 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.setup.Util;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Properties;
+import java.util.Vector;
+
+public class SystemManager {
+
+ private SystemManager() {
+ }
+
+ /* the installation root is where the classes reside */
+ static public File getJarFilePath() {
+
+ File jarFile = null;
+
+ try {
+ Class c = Class.forName("org.openoffice.setup.ResourceManager");
+ URL url = c.getResource("setupfiles.properties");
+
+ String urlString = url.toString();
+
+ if (urlString.startsWith("jar:")) {
+ /* ResourceManager.class resides in a jar file. Strip it down to the "file:" part */
+ urlString = urlString.substring(4, urlString.lastIndexOf("!"));
+ jarFile = new File(new URI(urlString));
+ }
+
+ } catch (Exception ex) {
+ /* handle URISyntaxException and ClassNotFoundException */
+ ex.printStackTrace();
+ System.exit(1);
+ }
+
+ if ( jarFile != null ) {
+ System.err.println("Jar file: " + jarFile.getPath());
+ } else {
+ System.err.println("No jar file used for installation!");
+ }
+
+ return jarFile;
+ }
+
+ /* the installation root is where the classes reside */
+ static public File getResourceRoot() {
+
+ File dir = null;
+
+ try {
+ Class c = Class.forName("org.openoffice.setup.ResourceManager");
+ URL url = c.getResource("setupfiles.properties");
+
+ String urlString = url.toString();
+
+ if (urlString.startsWith("jar:")) {
+ /* ResourceManager.class resides in a jar file. Strip it down to the "file:" part */
+ urlString = urlString.substring(4, urlString.lastIndexOf("!"));
+ } else {
+ /* ResourceManager.class resides in a directory tree. */
+ urlString = urlString.substring(0, urlString.lastIndexOf("/org/openoffice/setup/setupfiles.properties"));
+ }
+
+ dir = new File(new URI(urlString));
+ dir = dir.getParentFile();
+
+ } catch (Exception ex) {
+ /* handle URISyntaxException and ClassNotFoundException */
+ ex.printStackTrace();
+ System.exit(1);
+ }
+ // }
+
+ if ( dir != null ) {
+ // System.err.println("Resource Root: " + dir.getPath());
+ } else {
+ System.err.println("No resource root found!");
+ }
+
+ return dir;
+ }
+
+ static public String getPackagePath(String subdir) {
+
+ String path = null;
+
+ File dir = getResourceRoot();
+ if (dir != null) {
+ // System.err.println("Resource root: " + dir.getPath());
+ dir = new File(dir, subdir);
+ if (! dir.exists()) {
+ System.err.println("Error: Directory \"" + subdir + "\" does not exist at resouce root");
+ } else {
+ path = dir.getPath();
+ }
+ }
+
+ if ( path != null ) {
+ if ( ! path.endsWith("/")) {
+ path = path + "/";
+ }
+ }
+
+ if ( path != null ) {
+ System.err.println("Path to packages: " + path);
+ } else {
+ System.err.println("No path to packages found!");
+ }
+
+ return path;
+ }
+
+ static public boolean find_file(String fileName) {
+ boolean found = false;
+ File file = new File(fileName);
+ found = file.exists();
+ return found;
+ }
+
+ static public boolean exists_directory(String directory) {
+ File dir = new File(directory);
+ return dir.exists();
+ }
+
+ static public boolean create_directory(String directory) throws SecurityException {
+ boolean created = false;
+ File dir = new File(directory);
+ try {
+ created = dir.mkdirs();
+ }
+ catch (SecurityException ex) {
+ throw ex;
+ }
+
+ return created;
+ }
+
+ static public String getParentDirectory(String dir) {
+ File installFile = new File(dir);
+ String parentDir = installFile.getParent();
+ if ( parentDir == null ) {
+ parentDir = "/";
+ }
+ return parentDir;
+ }
+
+ static public String getInstallationPrivileges() {
+
+ String type = "";
+ String user = java.lang.System.getProperty("user.name");
+ // System.out.println("UserHome: " + java.lang.System.getProperty("user.home"));
+
+ if ( user.equalsIgnoreCase("root")) {
+ type = "root";
+ System.err.println("Root privileges");
+ } else {
+ type = "user";
+ System.err.println("User privileges");
+ }
+
+ return type;
+ }
+
+ static public boolean isUserInstallation() {
+
+ boolean isUserInstallation = false;
+ String user = java.lang.System.getProperty("user.name");
+
+ if ( user.equalsIgnoreCase("root")) {
+ isUserInstallation = false;
+ System.err.println("Root privileges");
+ } else {
+ isUserInstallation = true;
+ System.err.println("User privileges");
+ }
+
+ return isUserInstallation;
+ }
+
+ static public boolean isRootInstallation() {
+
+ boolean isRootInstallation = false;
+ String user = java.lang.System.getProperty("user.name");
+
+ if ( user.equalsIgnoreCase("root")) {
+ isRootInstallation = true;
+ } else {
+ isRootInstallation = false;
+ }
+
+ return isRootInstallation;
+ }
+
+ static public String getOSType() {
+ String osVersion = java.lang.System.getProperty("os.name");
+ System.err.println("OS: " + osVersion);
+ return osVersion;
+ }
+
+ static public String getOSArchitecture() {
+ String osArchitecture = java.lang.System.getProperty("os.arch");
+ System.out.println("OSArchitecture: " + osArchitecture);
+ return osArchitecture;
+ }
+
+ static public String getOSVersion() {
+ String osVersion = java.lang.System.getProperty("os.version");
+ System.out.println("OSVersion: " + osVersion);
+ return osVersion;
+ }
+
+ static public HashMap getEnvironmentHashMap() {
+ // readonly map from getenv()
+ // System.getenv only supported in Java 1.5, properties have to be set in shell script
+ // Map map = java.lang.System.getenv();
+ // HashMap myMap = new HashMap(map);
+ Properties props = System.getProperties();
+ HashMap myMap = new HashMap(props);
+ return myMap;
+ }
+
+ static public void dumpStringArray(String[] myStringArray) {
+ for (int i = 0; i < myStringArray.length; i++) {
+ System.out.println(myStringArray[i]);
+ }
+ }
+
+ static public void dumpFile(String baseFileName, String dumpFileName) {
+ Vector fileContent = readCharFileVector(baseFileName);
+ saveCharFileVector(dumpFileName, fileContent);
+ }
+
+ static public Vector readCharFileVector(String fileName) {
+ Vector fileContent = new Vector();
+
+ File file = new File(fileName);
+ if ( file.exists()) {
+ try {
+ FileInputStream fs = new FileInputStream(file);
+ BufferedReader bs = new BufferedReader(new InputStreamReader(fs));
+ String zeile;
+ while((zeile = bs.readLine())!=null) {
+ fileContent.addElement(zeile);
+ }
+ }
+ catch (IOException e) {
+ System.out.println(e);
+ }
+ } else {
+ System.out.println( "Error: File not found: " + fileName);
+ }
+
+ return fileContent;
+ }
+
+
+ static public void saveCharFileVector(String fileName, Vector fileContent) {
+ FileWriter fw = null;
+ try
+ {
+ fw = new FileWriter(fileName);
+ String fileContentStr = "";
+ for (int i = 0; i < fileContent.size() ; i++) {
+ fileContentStr = fileContentStr + fileContent.get(i) + "\n";
+ // System.out.println(fileContent.get(i));
+ }
+ fw.write(fileContentStr);
+ }
+ catch ( IOException e ) {
+ System.out.println( "Could not create file: " + fileName);
+ }
+ finally {
+ try {
+ if ( fw != null ) fw.close();
+ } catch (IOException e) {}
+ }
+ }
+
+ static public void copyAllFiles(File source, File dest) {
+ File[] file = source.listFiles();
+ if (file != null) {
+ for (int i = 0; i < file.length; i++) {
+ copy(file[i].getPath(), dest.getPath());
+ }
+ }
+ }
+
+ static public void copyAllFiles(File source, File dest, String ext) {
+ File[] file = source.listFiles(new FileExtensionFilter(ext));
+ if (file != null) {
+ for (int i = 0; i < file.length; i++) {
+ copy(file[i].getPath(), dest.getPath());
+ }
+ }
+ }
+
+ // second parameter can be a complete file name or an existing directory
+ static public boolean copy(String source, String dest) {
+
+ // is the second parameter a file name or a directory?
+ File dir = new File(dest);
+ if ( dir.isDirectory() ) {
+ File sourceFile = new File(source);
+ String fileName = sourceFile.getName();
+ File destFile = new File(dest, fileName);
+ dest = destFile.getPath();
+ }
+
+ boolean file_copied = false;
+ FileInputStream fis;
+ BufferedInputStream bis;
+ FileOutputStream fos;
+ BufferedOutputStream bos;
+ byte[] b;
+ try {
+ fis = new FileInputStream(source);
+ fos = new FileOutputStream(dest);
+ } catch (FileNotFoundException ex) {
+ throw new Error("File not found");
+ }
+ // put file into buffer
+ bis = new BufferedInputStream(fis);
+ bos = new BufferedOutputStream(fos);
+ try { // read file, write and close
+ b = new byte[bis.available()];
+ bis.read(b);
+ bos.write(b);
+ bis.close();
+ bos.close();
+ file_copied = true;
+ } catch (IOException e) {
+ System.out.println("Dateien wurden nicht kopiert!");
+ }
+
+ return file_copied;
+ }
+
+ static public boolean deleteFile(File file) {
+ boolean success = false;
+ if ( file.exists() && file != null ) {
+ success = file.delete();
+ }
+ return success;
+ }
+
+ static public boolean createDirectory(File dir) throws SecurityException {
+ boolean created = false;
+ try {
+ created = dir.mkdirs();
+ }
+ catch (SecurityException ex) {
+ throw ex;
+ }
+
+ return created;
+ }
+
+ static public void removeDirectory(File dir) {
+ if ( dir.exists() && dir.isDirectory() ) {
+ File[] file = dir.listFiles();
+ if (file != null) {
+ for (int i = 0; i < file.length; i++) {
+ deleteFile(file[i]);
+ }
+ }
+ dir.delete();
+ }
+ }
+
+ static public boolean logModuleStates() {
+ boolean logStates = false;
+ // System.getenv only supported in Java 1.5, property set in shell script
+ // String logStatesEnv = System.getenv("LOG_MODULE_STATES");
+ String logStatesEnv = System.getProperty("LOG_MODULE_STATES");
+
+ if ( logStatesEnv != null ) {
+ logStates = true;
+ }
+
+ return logStates;
+ }
+
+ static public void setUnixPrivileges(String fileName, String unixRights) {
+ // String command = "chmod " + unixRights + " " + fileName;
+ String[] commandArray = new String[3];
+ commandArray[0] = "chmod";
+ commandArray[1] = unixRights;
+ commandArray[2] = fileName;
+ int value = ExecuteProcess.executeProcessReturnValue(commandArray);
+ }
+
+ static public void setUnixPrivilegesDirectory(File directoryName, String ext, String unixRights) {
+ File[] file = directoryName.listFiles(new FileExtensionFilter(ext));
+ if (file != null) {
+ for (int i = 0; i < file.length; i++) {
+ setUnixPrivileges(file[i].getPath(), unixRights);
+ }
+ }
+ }
+
+ static public int calculateDiscSpace(String directory) {
+ String command = "df -k " + directory;
+ String[] commandArray = new String[3];
+ commandArray[0] = "df";
+ commandArray[1] = "-k";
+ commandArray[2] = directory;
+
+ int size = 0;
+ Vector returnVector = new Vector();
+ Vector returnErrorVector = new Vector();
+ int returnValue = ExecuteProcess.executeProcessReturnVector(commandArray, returnVector, returnErrorVector);
+ if ( returnValue == 0) {
+ int max = returnVector.size();
+ if ( max > 0 ) {
+ String returnLine = (String) returnVector.get(max-1);
+
+ // The fourth value is the available disc space (if the first value is a path)
+ // Otherwise it can also be the third value, if the first is not a path.
+ // If the first value is not a path, the string starts with white spaces.
+
+ int position = 3;
+ if ( returnLine.startsWith(" ")) {
+ position = 2;
+ }
+
+ returnLine = returnLine.trim();
+ String[] returnArray = returnLine.split("\\s+");
+
+ if ( returnArray.length > 3 ) {
+ String sizeString = returnArray[position];
+
+ // Special handling for very large hard discs that cannot be converted to int
+ if ( sizeString.length() >= Integer.toString(Integer.MAX_VALUE).length() ) {
+ sizeString = Integer.toString(Integer.MAX_VALUE);
+ }
+
+ // Converting from String to int
+ size = Integer.parseInt(sizeString);
+ }
+ }
+ }
+
+ return size;
+ }
+
+}
diff --git a/javainstaller2/src/Localization/makefile.mk b/javainstaller2/src/Localization/makefile.mk
new file mode 100755
index 000000000000..30161590cdb8
--- /dev/null
+++ b/javainstaller2/src/Localization/makefile.mk
@@ -0,0 +1,54 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=javainstaller2
+TARGET=java_ulffiles
+
+.IF "$(WITH_LANG)"!=""
+WITH_LANG!:=ALL
+.ENDIF # "$(WITH_LANG)"!=""
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# ------------------------------------------------------------------
+
+ULFFILES = \
+ setupstrings.ulf
+
+JLFFILES = $(foreach,i,$(ULFFILES) $(COMMONMISC)$/$(TARGET)$/$(i:b).jlf)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.IF "$(SOLAR_JAVA)"!=""
+ALLTAR : $(JLFFILES)
+.ENDIF
diff --git a/javainstaller2/src/Localization/setupstrings.ulf b/javainstaller2/src/Localization/setupstrings.ulf
new file mode 100755
index 000000000000..6038f978c8ad
--- /dev/null
+++ b/javainstaller2/src/Localization/setupstrings.ulf
@@ -0,0 +1,455 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+[STRING_PREVIOUS]
+en-US = "Back"
+
+[STRING_NEXT]
+en-US = "Next"
+
+[STRING_CANCEL]
+en-US = "Cancel"
+
+[STRING_FINISH]
+en-US = "Finish"
+
+[STRING_DECLINE]
+en-US = "Decline"
+
+[STRING_INSTALL]
+en-US = "Install now"
+
+[STRING_UNINSTALL]
+en-US = "Remove Now"
+
+[STRING_HELP]
+en-US = "Help"
+
+[STRING_OK]
+en-US = "OK"
+
+[STRING_ERROR]
+en-US = "Error"
+
+[STRING_FILE_NOT_FOUND]
+en-US = "Error: File not found"
+
+[STRING_APPLICATIONTITLE]
+en-US = "${PRODUCT_FULLNAME} Installation Wizard"
+
+[STRING_APPLICATIONTITLEUNINSTALLATION]
+en-US = "${PRODUCT_FULLNAME} Uninstallation Wizard"
+
+[STRING_CANCEL_DIALOG_TITLE]
+en-US = "Exit"
+
+[STRING_CANCEL_DIALOG]
+en-US = "Do you really want to exit the Installation Wizard?"
+
+[STRING_CANCEL_DIALOG_UNINSTALLATION]
+en-US = "Do you really want to exit the Uninstallation Wizard?"
+
+[STRING_STOP_DIALOG]
+en-US = "Do you really want to abort the installation process?"
+
+[STRING_STOP_DIALOG_TITLE]
+en-US = "Abort installation?"
+
+[STRING_STOP_DIALOG_UNINSTALLATION]
+en-US = "Do you really want to abort the uninstallation process?"
+
+[STRING_STOP_DIALOG_TITLE_UNINSTALLATION]
+en-US = "Abort uninstallation?"
+
+[STRING_ACCEPTLICENSE]
+en-US = "Accept License"
+
+[STRING_ACCEPTLICENSE1]
+en-US = "Software License Agreement"
+
+[STRING_ACCEPTLICENSE2]
+en-US = "Please read the following license agreement carefully."
+
+[STRING_ACCEPTLICENSE3]
+en-US = "If you have read and accept all the terms of the entire Software License Agreement, click 'Accept License' to continue with the installation."
+
+[STRING_CHOOSEDIRECTORY1]
+en-US = "Select Installation Directory"
+
+[STRING_CHOOSEDIRECTORY1_UPDATE]
+en-US = "Update the Installed Version"
+
+[STRING_CHOOSEDIRECTORY1_MAINTAIN]
+en-US = "Adding Components to the Installed Version"
+
+[STRING_CHOOSEDIRECTORY2]
+en-US = "Install ${PRODUCT_FULLNAME} in this directory"
+
+[STRING_CHOOSEDIRECTORY3]
+en-US = "Browse..."
+
+[STRING_CHOOSEDIRECTORY4_QUESTION_TITLE]
+en-US = "Create New Directory"
+
+[STRING_CHOOSEDIRECTORY5_QUESTION_MESSAGE]
+en-US = "The directory '${DIR}' does not exist.\nDo you want to create it now?"
+
+[STRING_CHOOSEDIRECTORY5_QUESTION_MESSAGE2]
+en-US = "The directory '${DIR}' does not exist.\nDo you want to create it now or choose another directory?"
+
+[STRING_CHOOSEDIRECTORY6]
+en-US = "Select root directory"
+
+[STRING_CHOOSEDIRECTORY_NO_WRITE_ACCESS]
+en-US = "You do not have write access in the directory"
+
+[STRING_CHOOSEDIRECTORY_NOT_ALLOWED]
+en-US = "You are not allowed to create the directory"
+
+[STRING_CHOOSEDIRECTORY_NO_SUCCESS]
+en-US = "Failed to create the directory"
+
+[STRING_CHOOSECOMPONENTS1]
+en-US = "Select Components"
+
+[STRING_CHOOSECOMPONENTS1_MAINTAIN]
+en-US = "Select Additional Components"
+
+[STRING_CHOOSECOMPONENTS2]
+en-US = "Marked components will be installed. Please mark them accordingly"
+
+[STRING_CHOOSECOMPONENTS3]
+en-US = "Feature Description"
+
+[STRING_CHOOSECOMPONENTS4]
+en-US = "Size (kB):"
+
+[STRING_CHOOSEINSTALLATIONTYPE1]
+en-US = "Select the Type of Installation"
+
+[STRING_CHOOSEINSTALLATIONTYPE2]
+en-US = "Select the type of installation that best suits your needs:"
+
+[STRING_CHOOSEINSTALLATIONTYPE3]
+en-US = "Select the Type of Installation"
+
+[STRING_CHOOSEINSTALLATIONTYPE4]
+en-US = "The main components will be installed. Recommended for most users."
+
+[STRING_CHOOSEINSTALLATIONTYPE5]
+en-US = "You choose the components you want to install and where they are stored. Recommended for advanced users."
+
+[STRING_CHOOSEINSTALLATIONTYPE6]
+en-US = "Typical"
+
+[STRING_CHOOSEINSTALLATIONTYPE7]
+en-US = "Custom"
+
+[STRING_INSTALLATIONIMMINENT1]
+en-US = "Ready to Install"
+
+[STRING_INSTALLATIONIMMINENT1_UPDATE]
+en-US = "Ready to Update"
+
+[STRING_INSTALLATIONIMMINENT2]
+en-US = "The following ${PRODUCT_FULLNAME} components will be installed:"
+
+[STRING_INSTALLATIONONGOING1]
+en-US = "Installing..."
+
+[STRING_INSTALLATIONONGOING3]
+en-US = "Stop"
+
+[STRING_INSTALLATIONONGOING_PACKAGEPATH_NOT_FOUND]
+en-US = "ERROR: Path with installation packages not found!"
+
+[STRING_PROLOGUE1]
+en-US = "Welcome"
+
+[STRING_PROLOGUE2]
+en-US = "This Installation Wizard will install ${PRODUCT_FULLNAME} on your computer."
+
+[STRING_PROLOGUE3]
+en-US = "To continue, click 'Next'."
+
+[STRING_PROLOGUE4]
+en-US = "Note: This installation will be done without root privileges. Therefore you will have a reduced functionality (Java Runtime Environment (JRE) not installable, system integration not possible).\nClick 'Cancel' and change your privileges to root privileges, if you want to use the complete functionality."
+
+[STRING_INSTALLATIONCOMPLETED1]
+en-US = "Installation Completed"
+
+[STRING_INSTALLATIONCOMPLETED1_ABORT]
+en-US = "Installation Aborted"
+
+[STRING_INSTALLATIONCOMPLETED1_ERROR]
+en-US = "Installation Failed"
+
+[STRING_INSTALLATIONCOMPLETED2]
+en-US = "The Installation Wizard has successfully installed ${PRODUCT_FULLNAME} on your computer."
+
+[STRING_INSTALLATIONCOMPLETED2_ABORT]
+en-US = "The Installation Wizard was aborted. ${PRODUCT_NAME} is not installed on your computer."
+
+[STRING_INSTALLATIONCOMPLETED2_ERROR]
+en-US = "An error has occurred. Thus the Installation Wizard could not install ${PRODUCT_NAME} on your computer successfully. Click 'Details...' for more information."
+
+[STRING_INSTALLATIONCOMPLETED3]
+en-US = "Click 'Finish' to exit the Wizard."
+
+[STRING_INSTALLATIONCOMPLETED_BUTTON]
+en-US = "Details..."
+
+[STRING_UNINSTALLATIONPROLOGUE2]
+en-US = "The ${PRODUCT_FULLNAME} Uninstallation Wizard will remove ${PRODUCT_FULLNAME} from your computer."
+
+[STRING_UNINSTALLATION_PROLOGUE_WRONG_PRIVILEGES_CURRENT_ROOT]
+en-US= "Sorry, wrong privileges. Installation was done with User privilges, but you have Root privileges."
+
+[STRING_UNINSTALLATION_PROLOGUE_WRONG_PRIVILEGES_CURRENT_USER]
+en-US= "Sorry, wrong privileges. Installation was done with Root privilges, but you have User privileges."
+
+[STRING_CHOOSEUNINSTALLATIONTYPE1]
+en-US = "Select the Type of Uninstallation"
+
+[STRING_CHOOSEUNINSTALLATIONTYPE2]
+en-US = "Select the type of uninstallation that best suits your needs:"
+
+[STRING_CHOOSEUNINSTALLATIONTYPE3]
+en-US = "Partial"
+
+[STRING_CHOOSEUNINSTALLATIONTYPE4]
+en-US = "Completely removes ${PRODUCT_FULLNAME} and all its components from your system."
+
+[STRING_CHOOSEUNINSTALLATIONTYPE5]
+en-US = "You choose the program features you want to remove."
+
+[STRING_CHOOSEUNINSTALLATIONTYPE6]
+en-US = "Complete"
+
+[STRING_CHOOSEUNINSTALLATIONCOMPONENTS2]
+en-US = "Components marked with an X will be removed. Mark the components you want to remove."
+
+[STRING_UNINSTALLATIONIMMINENT1]
+en-US = "Ready to Remove"
+
+[STRING_UNINSTALLATIONIMMINENT2]
+en-US = "The following ${PRODUCT_FULLNAME} components will be removed: "
+
+[STRING_UNINSTALLATIONONGOING1]
+en-US = "Uninstalling..."
+
+[STRING_UNINSTALLATIONCOMPLETED1]
+en-US = "Uninstallation Completed"
+
+[STRING_UNINSTALLATIONCOMPLETED1_ABORT]
+en-US = "Uninstallation Aborted"
+
+[STRING_UNINSTALLATIONCOMPLETED1_ERROR]
+en-US = "Uninstallation Failed"
+
+[STRING_UNINSTALLATIONCOMPLETED2]
+en-US = "The Uninstallation Wizard has successfully removed ${PRODUCT_FULLNAME} from your computer."
+
+[STRING_UNINSTALLATIONCOMPLETED2_PARTIAL]
+en-US = "The Uninstallation Wizard has successfully removed the selected components of ${PRODUCT_NAME} from your computer."
+
+[STRING_UNINSTALLATIONCOMPLETED2_ABORT]
+en-US = "The Uninstallation Wizard was aborted before completely removing ${PRODUCT_NAME} from your computer."
+
+[STRING_UNINSTALLATIONCOMPLETED2_ERROR]
+en-US = "An error has occurred. Thus the Uninstallation Wizard could not remove ${PRODUCT_NAME} from your computer successfully. Click 'Details...' for more information."
+
+[STRING_INSTALLERFACTORY_OS_NOT_SUPPORTED]
+en-US = "Sorry, this Operating System is not supported yet."
+
+[STRING_OLDER_VERSION_INSTALLED_FOUND]
+en-US = "An older version of ${PRODUCT_NAME} was found on your system in:"
+
+[STRING_OLDER_VERSION_INSTALLED_REMOVE]
+en-US = "You have to remove the older version of ${PRODUCT_NAME} before you can install the newer one."
+
+[STRING_NEWER_VERSION_INSTALLED_FOUND]
+en-US = "A newer version of ${PRODUCT_NAME} was found on your system in:"
+
+[STRING_NEWER_VERSION_INSTALLED_REMOVE]
+en-US = "You have to remove the newer version of ${PRODUCT_NAME} before you can install the older one."
+
+[STRING_NEWER_VERSION_DATABASE]
+en-US = "Database"
+
+[STRING_NEWER_VERSION_TIP]
+en-US = "Please choose another installation directory."
+
+[STRING_ROOT_PRIVILEGES_REQUIRED_1]
+en-US = "The user you are logged in as cannot run the Installation Wizard."
+
+[STRING_ROOT_PRIVILEGES_REQUIRED_2]
+en-US = "Please log out and log back in as a user with system administrator rights."
+
+[STRING_DISCSPACE_INSUFFICIENT]
+en-US = "Not enough discspace available for installation."
+
+[STRING_DISCSPACE_REQUIRED]
+en-US = "Required disc space"
+
+[STRING_DISCSPACE_AVAILABLE]
+en-US = "Available disc space"
+
+[STRING_DISCSPACE_TIP]
+en-US = "Please use another directory for installation or change your module selection."
+
+[STRING_ANALYZING_DATABASE1]
+en-US = "Analyzing ..."
+
+[STRING_ANALYZING_DATABASE2]
+en-US = "Analyzing database\nPlease wait a moment ..."
+
+[STRING_PROLOGUE_1]
+en-US = "Welcome to the Installation Wizard.<p>This wizard asks you to supply configuration settings.<p>At the bottom of each page are navigation buttons that let you move through the Installation Wizard:"
+
+[STRING_PROLOGUE_2]
+en-US = "'Back' returns you to the previous page."
+
+[STRING_PROLOGUE_3]
+en-US = "'Next' takes you to the next page. "
+
+[STRING_PROLOGUE_4]
+en-US = "'Cancel' ends the Installation Wizard without installing this software."
+
+[STRING_PROLOGUE_5]
+en-US = "'Help' displays the Help with further information about the page currently displayed."
+
+[STRING_PROLOGUE_6]
+en-US = "'OK' exits the Help page and returns you to the Installation Wizard."
+
+[STRING_UNINSTALLATIONPROLOGUE_1]
+en-US = "Welcome to the Uninstallation Wizard.<p>This wizard asks you to supply configuration settings.<p>At the bottom of each page are navigation buttons that let you move through the Uninstallation Wizard:"
+
+[STRING_UNINSTALLATIONPROLOGUE_2]
+en-US = "'Back' returns you to the previous page."
+
+[STRING_UNINSTALLATIONPROLOGUE_3]
+en-US = "'Next' takes you to the next page. "
+
+[STRING_UNINSTALLATIONPROLOGUE_4]
+en-US = "'Cancel' ends the Uninstallation Wizard without removing this software."
+
+[STRING_UNINSTALLATIONPROLOGUE_5]
+en-US = "'Help' displays the Help with further information about the page currently displayed."
+
+[STRING_UNINSTALLATIONPROLOGUE_6]
+en-US = "'OK' exits the Help page and returns you to the Uninstallation Wizard."
+
+[STRING_ACCEPTLICENSE_1]
+en-US = "Before you install this product, you must read and accept the entire Software License Agreement under which this software is licensed for your use."
+
+[STRING_ACCEPTLICENSE_2]
+en-US = "If you have read and accept all the terms of the entire Software License Agreement, click 'Accept License' to continue with the installation."
+
+[STRING_ACCEPTLICENSE_3]
+en-US = "If you do not accept all the terms of the Software License Agreement, click 'Decline' to end the Installation Wizard without installing this product."
+
+[STRING_CHOOSEINSTALLATIONTYPE_1]
+en-US = "Select the type of product installation to perform from the following choices. This will determine how much information you need to provide for product configuration."
+
+[STRING_CHOOSEDIRECTORY_1]
+en-US = "It is recommended that you install this product in the directory suggested by this Installation Wizard. <p>To choose a different location, click 'Browse...' or specify the full path of the directory to use in the text box below. <p>If this product is already installed, you cannot change the destination directory."
+
+[STRING_CHOOSECOMPONENTS_1]
+en-US = "Components marked in color will be installed. Click the icon of a component to mark or unmark the component.<p>All already installed components cannot be selected for installation."
+
+[STRING_INSTALLATIONIMMINENT_1]
+en-US = "The listed components are ready for installation based on your configuration settings. <p>If you are satisfied with your selection, click 'Install Now' to begin. <p>To check or modify your settings on the previous pages, click 'Back'."
+
+[STRING_UNINSTALLATIONIMMINENT_1]
+en-US = "The listed components are ready for uninstallation based on your configuration settings. <p>If you are satisfied with your selection, click 'Remove Now' to begin. <p>To check or modify your settings on the previous pages, click 'Back'."
+
+[STRING_INSTALLATIONONGOING_1]
+en-US = "This page indicates the progress of the installation with the aid of a progress bar. To abort the installation process, click 'Stop'."
+
+[STRING_UNINSTALLATIONONGOING_1]
+en-US = "This page indicates the progress of the uninstallation with the aid of a progress bar. To abort the uninstallation, click 'Stop'."
+
+[STRING_CHOOSEUNINSTALLATIONTYPE_1]
+en-US = "Complete: This will remove all installed components of your version.<p>Partial: This removes only the components you will choose out of the components list."
+
+[STRING_CHOOSEUNINSTALLATIONCOMPONENTS_1]
+en-US = "Components marked with an X will be removed. Click next to a component to mark or unmark it with an X."
+
+[STRING_PACKAGEFORMAT_NOT_SUPPORTED]
+en-US = "This package format is currently not supported for your operating system!"
+
+[STRING_OPERATING_SYSTEM]
+en-US = "Operating system"
+
+[STRING_PACKAGEFORMAT]
+en-US = "Package format"
+
+[STRING_NOTHING_TO_INSTALL]
+en-US = "Nothing to install"
+
+[STRING_NO_COMPONENTS_SELECTED_1]
+en-US = "No components have been selected for installation."
+
+[STRING_NO_COMPONENTS_SELECTED_2]
+en-US = "Click 'OK' to select one or more components for installation or to exit the Installation Wizard."
+
+[STRING_NO_LANGUAGE_SELECTED_1]
+en-US = "No languages have been selected for installation."
+
+[STRING_NO_LANGUAGE_SELECTED_2]
+en-US = "Click 'OK' to select one or more languages for installation or to exit the Installation Wizard."
+
+[STRING_NO_APPLICATION_SELECTED_1]
+en-US = "No applications have been selected for installation."
+
+[STRING_NO_APPLICATION_SELECTED_2]
+en-US = "Click 'OK' to select one or more application for installation or to exit the Installation Wizard."
+
+[STRING_NOTHING_TO_UNINSTALL]
+en-US = "Nothing to uninstall"
+
+[STRING_NO_UNINSTALLCOMPONENTS_SELECTED_1]
+en-US = "No components have been selected for uninstallation."
+
+[STRING_NO_UNINSTALLCOMPONENTS_SELECTED_2]
+en-US = "Click 'OK' to select one or more components for uninstallation or to exit the Uninstallation Wizard."
+
+[STRING_ALL_LANGUAGECOMPONENTS_SELECTED_1]
+en-US = "All language components have been selected for uninstallation."
+
+[STRING_ALL_LANGUAGECOMPONENTS_SELECTED_2]
+en-US = "Click 'OK' to select one or more language components not for uninstallation or to exit the Uninstallation Wizard."
+
+[STRING_ALL_APPLICATIONCOMPONENTS_SELECTED_1]
+en-US = "All application components have been selected for uninstallation."
+
+[STRING_ALL_APPLICATIONCOMPONENTS_SELECTED_2]
+en-US = "Click 'OK' to select one or more application components not for uninstallation or to exit the Uninstallation Wizard."
+
+[STRING_CHANGE_SELECTION]
+en-US = "Please change selection"
diff --git a/javainstaller2/src/Properties/create_property.pl b/javainstaller2/src/Properties/create_property.pl
new file mode 100755
index 000000000000..02712bb234c5
--- /dev/null
+++ b/javainstaller2/src/Properties/create_property.pl
@@ -0,0 +1,303 @@
+: # -*- perl -*-
+eval 'exec perl -wS $0 ${1+"$@"}'
+ if 0;
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+# create java installer property files for all languages defined in jlf file
+
+use Cwd;
+use File::Copy;
+
+if( $#ARGV < 2 )
+ {
+ print <<ENDHELP;
+USAGE: $0 <separator> <jlf_file_path> <outputpath>
+ <separator>: separator, used on the platform (slash or backslash)
+ <jlf_file_path>: path, in which the jlf file(s) can be found
+ <outputpath>: path, in which the property files will be created
+ENDHELP
+ exit;
+ }
+
+$separator = $ARGV[0];
+$inputpath = $ARGV[1];
+$outputpath = $ARGV[2];
+
+$inputpath =~ s/\Q$separator\E\s*$//;
+$outputpath =~ s/\Q$separator\E\s*$//;
+
+if ( ! -d $outputpath ) { mkdir $outputpath; }
+
+print "Separator: $separator \n";
+print "Input path: $inputpath \n";
+print "Output path: $outputpath \n";
+
+my $localdir = cwd();
+my $all_template_files = read_directory($localdir, "properties");
+my $all_jlf_files = read_directory($inputpath, "jlf");
+my $defaultlanguage = "en-US";
+my $missing_jlf_file = "setupfiles.jlf";
+my $alllanguages = get_all_languages($all_jlf_files);
+my @allnewpropertyfiles = ();
+
+for ( my $i = 0; $i <= $#{$all_template_files}; $i++ )
+{
+ my $template_file_name = ${$all_template_files}[$i];
+ my $complete_template_file_name = $localdir . $separator . $template_file_name;
+ my $jlf_file_name = get_jlf_file_name($template_file_name);
+ my $complete_jlf_file_name = $inputpath . $separator . $jlf_file_name;
+ print "Using template file: $complete_template_file_name\n";
+ my $jlf_file = "";
+ if ( ! ( $jlf_file_name eq $missing_jlf_file ))
+ {
+ print "Using translation file: $complete_jlf_file_name\n";
+ $jlf_file = read_file($complete_jlf_file_name);
+ }
+
+ for ( my $j = 0; $j <= $#{$alllanguages}; $j++ )
+ {
+ my $language = ${$alllanguages}[$j];
+ my $template_file = read_file($complete_template_file_name);
+ my $stringhash = create_string_hash($jlf_file, $language);
+ create_property_file($template_file, $stringhash);
+ my $filename = generate_filename($template_file_name, $language);
+
+ if ( $language eq $defaultlanguage )
+ {
+ # Creating language indenpendent english file
+ make_propertyfile_language_independent($template_file);
+ $filename = generate_filename($template_file_name, "");
+ save_file($outputpath, $filename, $template_file);
+ }
+ else
+ {
+ # Saving the non-english files
+ save_file($outputpath, $filename, $template_file);
+ }
+ }
+}
+
+exit;
+
+sub main::read_directory
+{
+ my ($dir, $ext) = @_;
+
+ my @content = ();
+ my $direntry;
+ opendir(DIR, $dir);
+
+ foreach $direntry (readdir (DIR))
+ {
+ next if $direntry eq ".";
+ next if $direntry eq "..";
+ next if ( ! ( $direntry =~ /\.\Q$ext\E\s*$/ ));
+
+ # my $completeentry = $dir . $separator . $direntry;
+ # push(@content, $completeentry);
+ push(@content, $direntry);
+ }
+
+ closedir(DIR);
+ return \@content;
+}
+
+sub main::read_file
+{
+ my ($filename) = @_;
+
+ open( IN, "<$filename" ) || die "cannot open $filename";
+ my @content = <IN>;
+ close( IN );
+
+ return \@content;
+}
+
+sub main::get_jlf_file_name
+{
+ my ($tempfilename) = @_;
+
+ my $jlffilename = "";
+
+ if ( $tempfilename =~ /^\s*(\w+)_template/ ) { $tempfilename = $1; }
+ $jlffilename = $tempfilename . "\.jlf";
+
+ return $jlffilename;
+}
+
+sub main::get_all_languages
+{
+ my ($alljlffiles) = @_;
+
+ my @languages = ();
+ my $record = 0;
+
+ my $first_jlf_file_name = $inputpath . $separator . ${$alljlffiles}[0];
+ my $jlffile = read_file($first_jlf_file_name);
+
+ for ( my $i = 0; $i <= $#{$jlffile}; $i++ )
+ {
+ if (( ${$jlffile}[$i] =~ /^\s*\[.*]\s*$/ ) && ( $record )) { last; }
+ if (( ${$jlffile}[$i] =~ /^\s*\[.*]\s*$/ ) && ( $record == 0 )) { $record = 1; }
+
+ if (( $record ) && ( ${$jlffile}[$i] =~ /^\s*(.+?)\s*\=/ ))
+ {
+ $language = $1;
+ push(@languages, $language);
+ }
+ }
+
+ my $languagestring = "";
+ for ( my $i = 0; $i <= $#languages; $i++ ) { $languagestring = $languagestring . $languages[$i] . ","; }
+ $languagestring =~ s/,\s*$//;
+ print "Languages: $languagestring\n";
+
+ return \@languages;
+}
+
+sub main::create_string_hash
+{
+ my ($jlffile, $language) = @_;
+
+ my %stringhash = ();
+ my $key = "";
+ my $value_defined = 0;
+
+ for ( my $i = 0; $i <= $#{$jlffile}; $i++ )
+ {
+ if ( ${$jlffile}[$i] =~ /^\s*\[(.*)\]\s*$/ )
+ {
+ $key = $1;
+ $value_defined = 0;
+ }
+
+ if (( ${$jlffile}[$i] =~ /^\s*\Q$defaultlanguage\E\s*=\s*\"(.*)\"\s*$/ ) && ( ! $value_defined ))
+ {
+ $value = $1; # defaulting to english
+ $stringhash{$key} = $value;
+ }
+
+ if (( ${$jlffile}[$i] =~ /^\s*\Q$language\E\s*=\s*\"(.*)\"\s*$/ ) && ( ! $value_defined ))
+ {
+ $value = $1;
+ $stringhash{$key} = $value;
+ $value_defined = 1;
+ }
+ }
+
+ # additional replacement for ${LANGUAGE}, not defined in jlf file
+ my $languagekey = "LANGUAGE";
+ $stringhash{$languagekey} = $language;
+
+ # print_hash(\%stringhash);
+
+ return \%stringhash;
+}
+
+sub main::print_hash
+{
+ my ( $hashref ) = @_;
+
+ print "Hash contains:\n";
+
+ my $key;
+ foreach $key (keys %{$hashref} ) { print "Key: $key, Value: $hashref->{$key}\n"; }
+}
+
+sub main::create_property_file
+{
+ my ($template_file, $stringhash) = @_;
+
+ for ( my $i = 0; $i <= $#{$template_file}; $i++ )
+ {
+ if ( ${$template_file}[$i] =~ /\$\{(\w+)\}/ )
+ {
+ my $key = $1;
+
+ if ( exists($stringhash->{$key}) )
+ {
+ my $value = $stringhash->{$key};
+ ${$template_file}[$i] =~ s/\$\{\Q$key\E\}/$value/g;
+ }
+ else
+ {
+ print "Error: No value found for key: $key\n";
+ exit;
+ }
+ }
+ }
+}
+
+sub main::generate_filename
+{
+ my ($template_file_name, $onelanguage) = @_;
+
+ my $filename = $template_file_name;
+
+ if ( $onelanguage )
+ {
+ $onelanguage =~ s/-/_/; # zh-TW -> zh_TW
+ $onelanguage = "_" . $onelanguage;
+ $filename =~ s/_template\./$onelanguage\./;
+ }
+ else
+ {
+ $filename =~ s/_template//;
+ }
+
+ return $filename;
+}
+
+sub make_propertyfile_language_independent
+{
+ my ($property_file) = @_;
+
+ for ( my $i = 0; $i <= $#{$property_file}; $i++ )
+ {
+# if ( ${$property_file}[$i] =~ /^\s*#/ ) # only comment lines
+# {
+ ${$property_file}[$i] =~ s/_\Q$defaultlanguage\E//;
+# }
+ }
+}
+
+sub main::save_file
+{
+ my ($outputpath, $filename, $filecontent) = @_;
+
+ $filename = $outputpath . $separator . $filename;
+
+ if ( open( OUT, ">$filename" ) )
+ {
+ print OUT @{$filecontent};
+ close( OUT);
+ }
+
+ push(@allnewpropertyfiles, $filename);
+ print "Created file: $filename\n";
+}
diff --git a/javainstaller2/src/Properties/makefile.mk b/javainstaller2/src/Properties/makefile.mk
new file mode 100755
index 000000000000..c700bd3a7607
--- /dev/null
+++ b/javainstaller2/src/Properties/makefile.mk
@@ -0,0 +1,50 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=javainstaller2
+TARGET=create_property_files
+
+INPUT=java_ulffiles
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.IF "$(SOLAR_JAVA)"!=""
+ALLTAR: $(MISC)$/setupstrings.properties
+
+$(MISC)$/setupstrings.properties : create_property.pl $(COMMONMISC)$/$(INPUT)$/setupstrings.jlf setupstrings_template.properties setupfiles_template.properties
+ $(PERL) create_property.pl $/ $(COMMONMISC)$/$(INPUT) $(MISC)
+.ENDIF
diff --git a/javainstaller2/src/Properties/setupfiles_template.properties b/javainstaller2/src/Properties/setupfiles_template.properties
new file mode 100644
index 000000000000..04852635e784
--- /dev/null
+++ b/javainstaller2/src/Properties/setupfiles_template.properties
@@ -0,0 +1,26 @@
+#
+# setupfiles_${LANGUAGE}.properties
+#
+# x-no-translate
+
+String_Helpfile_AcceptLicense=AcceptLicense_${LANGUAGE}.html
+String_Helpfile_ChooseComponents=ChooseComponents_${LANGUAGE}.html
+String_Helpfile_ChooseDirectory=ChooseDirectory_${LANGUAGE}.html
+String_Helpfile_ChooseInstallationType=ChooseInstallationType_${LANGUAGE}.html
+String_Helpfile_InstallationImminent=InstallationImminent_${LANGUAGE}.html
+String_Helpfile_InstallationOngoing=InstallationOngoing_${LANGUAGE}.html
+String_Helpfile_Prologue=Prologue_${LANGUAGE}.html
+String_Helpfile_UninstallationPrologue=UninstallationPrologue_${LANGUAGE}.html
+String_Helpfile_ChooseUninstallationType=ChooseUninstallationType_${LANGUAGE}.html
+String_Helpfile_ChooseUninstallationComponents=ChooseUninstallationComponents_${LANGUAGE}.html
+String_Helpfile_UninstallationImminent=UninstallationImminent_${LANGUAGE}.html
+String_Helpfile_UninstallationOngoing=UninstallationOngoing_${LANGUAGE}.html
+String_License_Filename=LICENSE_${LANGUAGE}.html
+Icon_Previous=Icons/Back.gif
+Icon_Next=Icons/Forward.gif
+Icon_Install=Icons/Install.png
+Icon_Installed=Icons/Installed.png
+Icon_DontInstall=Icons/DontInstall.png
+Icon_DontKnow=Icons/DontKnow.png
+Icon_Remove=Icons/Remove.png
+
diff --git a/javainstaller2/src/Properties/setupstrings_template.properties b/javainstaller2/src/Properties/setupstrings_template.properties
new file mode 100644
index 000000000000..07bfa3ec192f
--- /dev/null
+++ b/javainstaller2/src/Properties/setupstrings_template.properties
@@ -0,0 +1,123 @@
+#
+# setupstrings_${LANGUAGE}.properties
+#
+# x-no-translate
+
+String_Previous=${STRING_PREVIOUS}
+String_Next=${STRING_NEXT}
+String_Cancel=${STRING_CANCEL}
+String_Decline=${STRING_DECLINE}
+String_Finish=${STRING_FINISH}
+String_Install=${STRING_INSTALL}
+String_Uninstall=${STRING_UNINSTALL}
+String_Help=${STRING_HELP}
+String_OK=${STRING_OK}
+String_Error=${STRING_ERROR}
+String_File_Not_Found=${STRING_FILE_NOT_FOUND}
+String_ApplicationTitle=${STRING_APPLICATIONTITLE}
+String_ApplicationTitleUninstallation=${STRING_APPLICATIONTITLEUNINSTALLATION}
+String_Cancel_Dialog_Title=${STRING_CANCEL_DIALOG_TITLE}
+String_Cancel_Dialog=${STRING_CANCEL_DIALOG}
+String_Cancel_Dialog_Uninstallation=${STRING_CANCEL_DIALOG_UNINSTALLATION}
+String_Stop_Dialog=${STRING_STOP_DIALOG}
+String_Stop_Dialog_Title=${STRING_STOP_DIALOG_TITLE}
+String_Stop_Dialog_Uninstallation=${STRING_STOP_DIALOG_UNINSTALLATION}
+String_Stop_Dialog_Title_Uninstallation=${STRING_STOP_DIALOG_TITLE_UNINSTALLATION}
+String_AcceptLicense=${STRING_ACCEPTLICENSE}
+String_AcceptLicense1=${STRING_ACCEPTLICENSE1}
+String_AcceptLicense2=${STRING_ACCEPTLICENSE2}
+String_AcceptLicense3=${STRING_ACCEPTLICENSE3}
+String_ChooseDirectory1=${STRING_CHOOSEDIRECTORY1}
+String_ChooseDirectory1_Update=${STRING_CHOOSEDIRECTORY1_UPDATE}
+String_ChooseDirectory1_Maintain=${STRING_CHOOSEDIRECTORY1_MAINTAIN}
+String_ChooseDirectory2=${STRING_CHOOSEDIRECTORY2}
+String_ChooseDirectory3=${STRING_CHOOSEDIRECTORY3}
+String_ChooseDirectory4_Question_Title=${STRING_CHOOSEDIRECTORY4_QUESTION_TITLE}
+String_ChooseDirectory5_Question_Message=${STRING_CHOOSEDIRECTORY5_QUESTION_MESSAGE}
+String_ChooseDirectory6=${STRING_CHOOSEDIRECTORY6}
+String_ChooseDirectory_No_Write_Access=${STRING_CHOOSEDIRECTORY_NO_WRITE_ACCESS}
+String_ChooseDirectory_Not_Allowed=${STRING_CHOOSEDIRECTORY_NOT_ALLOWED}
+String_ChooseDirectory_No_Success=${STRING_CHOOSEDIRECTORY_NO_SUCCESS}
+String_ChooseComponents1=${STRING_CHOOSECOMPONENTS1}
+String_ChooseComponents1_Maintain=${STRING_CHOOSECOMPONENTS1_MAINTAIN}
+String_ChooseComponents2=${STRING_CHOOSECOMPONENTS2}
+String_ChooseComponents3=${STRING_CHOOSECOMPONENTS3}
+String_ChooseComponents4=${STRING_CHOOSECOMPONENTS4}
+String_ChooseInstallationType1=${STRING_CHOOSEINSTALLATIONTYPE1}
+String_ChooseInstallationType2=${STRING_CHOOSEINSTALLATIONTYPE2}
+String_ChooseInstallationType3=${STRING_CHOOSEINSTALLATIONTYPE3}
+String_ChooseInstallationType4=${STRING_CHOOSEINSTALLATIONTYPE4}
+String_ChooseInstallationType5=${STRING_CHOOSEINSTALLATIONTYPE5}
+String_ChooseInstallationType6=${STRING_CHOOSEINSTALLATIONTYPE6}
+String_ChooseInstallationType7=${STRING_CHOOSEINSTALLATIONTYPE7}
+String_InstallationImminent1=${STRING_INSTALLATIONIMMINENT1}
+String_InstallationImminent1_Update=${STRING_INSTALLATIONIMMINENT1_UPDATE}
+String_InstallationImminent2=${STRING_INSTALLATIONIMMINENT2}
+String_InstallationOngoing1=${STRING_INSTALLATIONONGOING1}
+String_InstallationOngoing3=${STRING_INSTALLATIONONGOING3}
+String_InstallationOngoing_PackagePath_Not_Found=${STRING_INSTALLATIONONGOING_PACKAGEPATH_NOT_FOUND}
+String_Analyzing_Database1=${STRING_ANALYZING_DATABASE1}
+String_Analyzing_Database2=${STRING_ANALYZING_DATABASE2}
+String_Prologue1=${STRING_PROLOGUE1}
+String_Prologue2=${STRING_PROLOGUE2}
+String_Prologue3=${STRING_PROLOGUE3}
+String_Prologue4=${STRING_PROLOGUE4}
+String_InstallationCompleted1=${STRING_INSTALLATIONCOMPLETED1}
+String_InstallationCompleted1_Abort=${STRING_INSTALLATIONCOMPLETED1_ABORT}
+String_InstallationCompleted1_Error=${STRING_INSTALLATIONCOMPLETED1_ERROR}
+String_InstallationCompleted2=${STRING_INSTALLATIONCOMPLETED2}
+String_InstallationCompleted2_Abort=${STRING_INSTALLATIONCOMPLETED2_ABORT}
+String_InstallationCompleted2_Error=${STRING_INSTALLATIONCOMPLETED2_ERROR}
+String_InstallationCompleted3=${STRING_INSTALLATIONCOMPLETED3}
+String_InstallationCompleted_Button=${STRING_INSTALLATIONCOMPLETED_BUTTON}
+String_UninstallationPrologue2=${STRING_UNINSTALLATIONPROLOGUE2}
+String_UninstallationPrologue_Wrong_Privileges_Current_Root=${STRING_UNINSTALLATION_PROLOGUE_WRONG_PRIVILEGES_CURRENT_ROOT}
+String_UninstallationPrologue_Wrong_Privileges_Current_User=${STRING_UNINSTALLATION_PROLOGUE_WRONG_PRIVILEGES_CURRENT_USER}
+String_ChooseUninstallationType1=${STRING_CHOOSEUNINSTALLATIONTYPE1}
+String_ChooseUninstallationType2=${STRING_CHOOSEUNINSTALLATIONTYPE2}
+String_ChooseUninstallationType3=${STRING_CHOOSEUNINSTALLATIONTYPE3}
+String_ChooseUninstallationType4=${STRING_CHOOSEUNINSTALLATIONTYPE4}
+String_ChooseUninstallationType5=${STRING_CHOOSEUNINSTALLATIONTYPE5}
+String_ChooseUninstallationType6=${STRING_CHOOSEUNINSTALLATIONTYPE6}
+String_ChooseUninstallationComponents2=${STRING_CHOOSEUNINSTALLATIONCOMPONENTS2}
+String_UninstallationImminent1=${STRING_UNINSTALLATIONIMMINENT1}
+String_UninstallationImminent2=${STRING_UNINSTALLATIONIMMINENT2}
+String_UninstallationOngoing1=${STRING_UNINSTALLATIONONGOING1}
+String_UninstallationCompleted1=${STRING_UNINSTALLATIONCOMPLETED1}
+String_UninstallationCompleted1_Abort=${STRING_UNINSTALLATIONCOMPLETED1_ABORT}
+String_UninstallationCompleted1_Error=${STRING_UNINSTALLATIONCOMPLETED1_ERROR}
+String_UninstallationCompleted2=${STRING_UNINSTALLATIONCOMPLETED2}
+String_UninstallationCompleted2_Partial=${STRING_UNINSTALLATIONCOMPLETED2_PARTIAL}
+String_UninstallationCompleted2_Abort=${STRING_UNINSTALLATIONCOMPLETED2_ABORT}
+String_UninstallationCompleted2_Error=${STRING_UNINSTALLATIONCOMPLETED2_ERROR}
+String_InstallerFactory_Os_Not_Supported=${STRING_INSTALLERFACTORY_OS_NOT_SUPPORTED}
+String_Older_Version_Installed_Found=${STRING_OLDER_VERSION_INSTALLED_FOUND}
+String_Older_Version_Installed_Remove=${STRING_OLDER_VERSION_INSTALLED_REMOVE}
+String_Newer_Version_Installed_Found=${STRING_NEWER_VERSION_INSTALLED_FOUND}
+String_Newer_Version_Installed_Remove=${STRING_NEWER_VERSION_INSTALLED_REMOVE}
+String_Newer_Version_Database=${STRING_NEWER_VERSION_DATABASE}
+String_Newer_Version_Tip=${STRING_NEWER_VERSION_TIP}
+String_Root_Privileges_Required_1=${STRING_ROOT_PRIVILEGES_REQUIRED_1}
+String_Root_Privileges_Required_2=${STRING_ROOT_PRIVILEGES_REQUIRED_2}
+String_Discspace_Insufficient=${STRING_DISCSPACE_INSUFFICIENT}
+String_Discspace_Required=${STRING_DISCSPACE_REQUIRED}
+String_Discspace_Available=${STRING_DISCSPACE_AVAILABLE}
+String_Discspace_Tip=${STRING_DISCSPACE_TIP}
+String_Packageformat_Not_Supported=${STRING_PACKAGEFORMAT_NOT_SUPPORTED}
+String_Operating_System=${STRING_OPERATING_SYSTEM}
+String_Packageformat=${STRING_PACKAGEFORMAT}
+String_Nothing_To_Install=${STRING_NOTHING_TO_INSTALL}
+String_No_Components_Selected_1=${STRING_NO_COMPONENTS_SELECTED_1}
+String_No_Components_Selected_2=${STRING_NO_COMPONENTS_SELECTED_2}
+String_No_Language_Selected_1=${STRING_NO_LANGUAGE_SELECTED_1}
+String_No_Language_Selected_2=${STRING_NO_LANGUAGE_SELECTED_2}
+String_No_Application_Selected_1=${STRING_NO_APPLICATION_SELECTED_1}
+String_No_Application_Selected_2=${STRING_NO_APPLICATION_SELECTED_2}
+String_Nothing_To_Uninstall=${STRING_NOTHING_TO_UNINSTALL}
+String_No_Uninstallcomponents_Selected_1=${STRING_NO_UNINSTALLCOMPONENTS_SELECTED_1}
+String_No_Uninstallcomponents_Selected_2=${STRING_NO_UNINSTALLCOMPONENTS_SELECTED_2}
+String_All_Languagecomponents_Selected_1=${STRING_ALL_LANGUAGECOMPONENTS_SELECTED_1}
+String_All_Languagecomponents_Selected_2=${STRING_ALL_LANGUAGECOMPONENTS_SELECTED_2}
+String_All_Applicationcomponents_Selected_1=${STRING_ALL_APPLICATIONCOMPONENTS_SELECTED_1}
+String_All_Applicationcomponents_Selected_2=${STRING_ALL_APPLICATIONCOMPONENTS_SELECTED_2}
+String_Change_Selection=${STRING_CHANGE_SELECTION}