1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package org.openoffice.setup.Controller; 25 26 import org.openoffice.setup.InstallData; 27 import org.openoffice.setup.PanelController; 28 import org.openoffice.setup.Panel.ChooseUninstallationComponents; 29 import org.openoffice.setup.ResourceManager; 30 import org.openoffice.setup.SetupData.PackageDescription; 31 import org.openoffice.setup.SetupData.SetupDataProvider; 32 import org.openoffice.setup.Util.Dumper; 33 import org.openoffice.setup.Util.Informer; 34 import org.openoffice.setup.Util.ModuleCtrl; 35 36 public class ChooseUninstallationComponentsCtrl extends PanelController { 37 38 private String helpFile; 39 ChooseUninstallationComponentsCtrl()40 public ChooseUninstallationComponentsCtrl() { 41 super("ChooseUninstallationComponents", new ChooseUninstallationComponents()); 42 helpFile = "String_Helpfile_ChooseUninstallationComponents"; 43 } 44 getNext()45 public String getNext() { 46 return new String("UninstallationImminent"); 47 } 48 getPrevious()49 public String getPrevious() { 50 return new String("ChooseUninstallationType"); 51 } 52 getHelpFileName()53 public final String getHelpFileName () { 54 return this.helpFile; 55 } 56 afterShow(boolean nextButtonPressed)57 public boolean afterShow(boolean nextButtonPressed) { 58 boolean repeatDialog = false; 59 60 InstallData data = InstallData.getInstance(); 61 PackageDescription packageData = SetupDataProvider.getPackageDescription(); 62 63 if ( nextButtonPressed ) { 64 65 if ( data.logModuleStates() ) { 66 Dumper.logModuleStates(packageData, "Choose UninstallationComponents: Before checkVisibleModulesUninstall"); 67 } 68 69 // Check, if at least one visible module is selected for uninstallation 70 data.setVisibleModulesChecked(false); 71 ModuleCtrl.checkVisibleModulesUninstall(packageData, data); 72 73 if ( ! data.visibleModulesChecked() ) { 74 String message = ResourceManager.getString("String_No_Uninstallcomponents_Selected_1") + "\n" + 75 ResourceManager.getString("String_No_Uninstallcomponents_Selected_2"); 76 String title = ResourceManager.getString("String_Nothing_To_Uninstall"); 77 Informer.showInfoMessage(message, title); 78 repeatDialog = true; 79 } else { 80 // Check, if all visible modules are selected for uninstallation. 81 // Then this shall be handled as complete uninstallation 82 // -> The responsible value is InstallData.isMaskedCompleteUninstallation 83 data.setMaskedCompleteUninstallation(true); 84 ModuleCtrl.checkMaskedCompleteUninstallation(packageData, data); 85 86 // If this is not a complete uninstallation, at least one language 87 // module or one application module has to be installed. 88 89 if ( ! data.isMaskedCompleteUninstallation() ) { 90 91 data.setApplicationModulesChecked(false); 92 ModuleCtrl.checkApplicationModulesUninstall(packageData, data); 93 94 if ( ! data.applicationModulesChecked() ) { 95 96 String message = ResourceManager.getString("String_All_Applicationcomponents_Selected_1") + "\n" + 97 ResourceManager.getString("String_All_Applicationcomponents_Selected_2"); 98 String title = ResourceManager.getString("String_Change_Selection"); 99 Informer.showInfoMessage(message, title); 100 repeatDialog = true; 101 } else { 102 if ( data.isMultiLingual()) { 103 data.setLanguageModulesChecked(false); 104 ModuleCtrl.checkLanguageModulesUninstall(packageData, data); 105 106 if ( ! data.languageModulesChecked() ) { 107 108 String message = ResourceManager.getString("String_All_Languagecomponents_Selected_1") + "\n" + 109 ResourceManager.getString("String_All_Languagecomponents_Selected_2"); 110 String title = ResourceManager.getString("String_Change_Selection"); 111 Informer.showInfoMessage(message, title); 112 repeatDialog = true; 113 } 114 } 115 } 116 } 117 } 118 } else { // the back button was pressed 119 // Saving typical selection state values (always if back button is pressed!). 120 ModuleCtrl.saveCustomSelectionStates(packageData); 121 data.setCustomSelectionStateSaved(true); 122 } 123 124 return repeatDialog; 125 } 126 127 } 128