summaryrefslogtreecommitdiff
path: root/javainstaller2/src/JavaSetup/org/openoffice/setup/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'javainstaller2/src/JavaSetup/org/openoffice/setup/Controller')
-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
14 files changed, 2183 insertions, 0 deletions
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;
+ }
+
+}