From 4d5c08cb4d1e58390ecaa7fb4edb099d501c8af8 Mon Sep 17 00:00:00 2001 From: Akihiro Ono Date: Fri, 27 Nov 2009 19:17:55 +0900 Subject: [PATCH] =?utf8?q?=E7=B5=82=E4=BA=86=E3=83=9C=E3=82=BF=E3=83=B3?= =?utf8?q?=E3=81=8B=C3=97=E3=83=9C=E3=82=BF=E3=83=B3=E3=82=92=E6=8A=BC?= =?utf8?q?=E3=81=99=E3=81=A8=E3=80=81=E7=A2=BA=E8=AA=8D=E3=81=AE=E3=83=80?= =?utf8?q?=E3=82=A4=E3=82=A2=E3=83=AD=E3=82=B0=E3=82=92=E8=A1=A8=E7=A4=BA?= =?utf8?q?=E3=81=95=E3=81=9B=E3=82=8B=E3=82=88=E3=81=86=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../izforge/izpack/installer/InstallerFrame.java | 88 +++++++++++++--------- 1 file changed, 54 insertions(+), 34 deletions(-) diff --git a/installer/IzPack/src/lib/com/izforge/izpack/installer/InstallerFrame.java b/installer/IzPack/src/lib/com/izforge/izpack/installer/InstallerFrame.java index c1da682..a14c95e 100644 --- a/installer/IzPack/src/lib/com/izforge/izpack/installer/InstallerFrame.java +++ b/installer/IzPack/src/lib/com/izforge/izpack/installer/InstallerFrame.java @@ -1,18 +1,18 @@ /* * $Id: InstallerFrame.java 2692 2009-03-25 09:29:40Z fbuehlmann $ * IzPack - Copyright 2001-2008 Julien Ponge, All Rights Reserved. - * + * * http://izpack.org/ * http://izpack.codehaus.org/ - * + * * Copyright 2002 Jan Blok - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -135,7 +135,7 @@ public class InstallerFrame extends JFrame { * Registered GUICreationListener. */ protected ArrayList guiListener; - + /** * Heading major text. */ @@ -211,13 +211,13 @@ public class InstallerFrame extends JFrame { // Builds the GUI loadIcons(); loadCustomIcons(); - loadPanels(); + loadPanels(); buildGUI(); // We show the frame showFrame(); switchPanel(0); - } + } public Debugger getDebugger() { return this.debugger; @@ -283,7 +283,7 @@ public class InstallerFrame extends JFrame { } panel.setHelps(p.getHelpsMap()); - + List preActivateActions = p.getPreActivationActions(); if (preActivateActions != null) { @@ -510,9 +510,9 @@ public class InstallerFrame extends JFrame { debugger = new Debugger(installdata, icons, rules); // this needed to fully initialize the debugger. JPanel debugpanel = debugger.getDebugPanel(); - + // create a debug panel if TRACE is enabled - if (Debug.isTRACE()) { + if (Debug.isTRACE()) { if (installdata.guiPrefs.modifier.containsKey("showDebugWindow") && Boolean.valueOf(installdata.guiPrefs.modifier.get("showDebugWindow"))) { JFrame debugframe = new JFrame("Debug information"); @@ -731,7 +731,7 @@ public class InstallerFrame extends JFrame { IzPanel panel = installdata.panels.get(installdata.curPanelNumber); IzPanel l_panel = installdata.panels.get(last); showHelpButton(panel.canShowHelp()); - if (Debug.isTRACE()) { + if (Debug.isTRACE()) { debugger.switchPanel(panel.getMetadata(), l_panel.getMetadata()); } Log.getInstance().addDebugMessage( @@ -1158,33 +1158,26 @@ public class InstallerFrame extends JFrame { || ((!nextButton.isVisible() || !nextButton.isEnabled()) && (!prevButton .isVisible() || !prevButton.isEnabled()))) { // this does nothing if the uninstaller was not included - writeUninstallData(); - Housekeeper.getInstance().shutDown(0); + + int panelNum = this.installdata.panels.size(); + if(panelNum == (this.installdata.curPanelNumber + 1)) { + // Last Panel(maybe, SimpleFinishPanel or FinishPanel) no dialog + writeUninstallData(); + Housekeeper.getInstance().shutDown(0); + } else { + int res = getExitCnfirmDialogReturnCode(); + if (res == JOptionPane.YES_OPTION) { + writeUninstallData(); + Housekeeper.getInstance().shutDown(0); + } + } } else { // The installation is not over if (Unpacker.isDiscardInterrupt() && interruptCount < MAX_INTERRUPT) { // But we should not interrupt. interruptCount++; return; } - // Use a alternate message and title if defined. - final String mkey = "installer.quit.reversemessage"; - final String tkey = "installer.quit.reversetitle"; - String message = langpack.getString(mkey); - String title = langpack.getString(tkey); - // message equal to key -> no alternate message defined. - if (message.indexOf(mkey) > -1) { - message = langpack.getString("installer.quit.message"); - } - // title equal to key -> no alternate title defined. - if (title.indexOf(tkey) > -1) { - title = langpack.getString("installer.quit.title"); - } - // Now replace variables in message or title. - VariableSubstitutor vs = new VariableSubstitutor(installdata.getVariables()); - message = vs.substitute(message, null); - title = vs.substitute(title, null); - int res = JOptionPane - .showConfirmDialog(this, message, title, JOptionPane.YES_NO_OPTION); + int res = getExitCnfirmDialogReturnCode(); if (res == JOptionPane.YES_OPTION) { wipeAborted(); Housekeeper.getInstance().shutDown(0); @@ -1193,6 +1186,33 @@ public class InstallerFrame extends JFrame { } /** + * + * @return JOptionPane.showConfirmDialog return code + */ + private int getExitCnfirmDialogReturnCode() { + // Use a alternate message and title if defined. + final String mkey = "installer.quit.reversemessage"; + final String tkey = "installer.quit.reversetitle"; + String message = langpack.getString(mkey); + String title = langpack.getString(tkey); + // message equal to key -> no alternate message defined. + if (message.indexOf(mkey) > -1) { + message = langpack.getString("installer.quit.message"); + } + // title equal to key -> no alternate title defined. + if (title.indexOf(tkey) > -1) { + title = langpack.getString("installer.quit.title"); + } + // Now replace variables in message or title. + VariableSubstitutor vs = new VariableSubstitutor(installdata.getVariables()); + message = vs.substitute(message, null); + title = vs.substitute(title, null); + int res = JOptionPane + .showConfirmDialog(this, message, title, JOptionPane.YES_NO_OPTION); + return res; + } + + /** * Wipes the written files when you abort the installation. */ protected void wipeAborted() { @@ -1433,7 +1453,7 @@ public class InstallerFrame extends JFrame { panel.executePreValidationActions(); boolean isValid = doValidation ? panel.panelValidated() : true; panel.executePostValidationActions(); - + // check if we can display the next panel or if there was an error during actions that // disables the next button if (!nextButton.isEnabled()) { return; } -- 2.11.0