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 package installer; 23 24 /* 25 * Welcome.java 26 * 27 * Created on 04 July 2002, 15:43 28 */ 29 30 /** 31 * 32 * @author mike 33 */ 34 35 import java.awt.event.*; 36 import java.util.*; 37 import java.net.*; 38 import javax.swing.*; 39 40 public class IdeFinal extends javax.swing.JPanel implements ActionListener, InstallListener { 41 42 /** Creates new form Welcome */ IdeFinal(InstallWizard wizard)43 public IdeFinal(InstallWizard wizard) { 44 this.wizard = wizard; 45 setBackground(java.awt.Color.white); 46 ideupdater = null; 47 initComponents(); 48 } 49 50 /** This method is called from within the constructor to 51 * initialize the form. 52 * WARNING: Do NOT modify this code. The content of this method is 53 * always regenerated by the Form Editor. 54 */ initComponents()55 private void initComponents() {//GEN-BEGIN:initComponents 56 statusPanel = new javax.swing.JPanel(); 57 statusPanel.setBackground(java.awt.Color.white); 58 statusLine = new javax.swing.JLabel("Ready", javax.swing.JLabel.CENTER); 59 60 setLayout(new java.awt.BorderLayout()); 61 62 statusPanel.setLayout(new java.awt.BorderLayout()); 63 64 statusLine.setText("Waiting to install IDE support."); 65 statusPanel.add(statusLine, java.awt.BorderLayout.CENTER); 66 67 add(statusPanel, java.awt.BorderLayout.CENTER); 68 nav = new NavPanel(wizard, true, true, true, InstallWizard.IDEVERSIONS, ""); 69 nav.setNextListener(this); 70 nav.removeCancelListener(nav); 71 nav.setCancelListener(this); 72 nav.navNext.setText("Install"); 73 add(nav, java.awt.BorderLayout.SOUTH); 74 }//GEN-END:initComponents 75 getPreferredSize()76 public java.awt.Dimension getPreferredSize() { 77 return new java.awt.Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT); 78 } 79 actionPerformed(ActionEvent e)80 public void actionPerformed(ActionEvent e) { 81 // navNext is "Install" 82 if (e.getSource() == nav.navNext) 83 { 84 JProgressBar progressBar=new JProgressBar(); 85 progressBar.setMaximum(10); 86 progressBar.setValue(0); 87 statusPanel.add(progressBar, java.awt.BorderLayout.SOUTH); 88 nav.enableNext(false); 89 nav.enableBack(false); 90 nav.enableCancel(false); 91 ArrayList locations = wizard.getLocations(); 92 //System.out.println("here "+locations.size()); 93 // Returned 1 94 String progpath=null; 95 String path=null; 96 String classespath=null; 97 for (int i =0;i<locations.size();i++){ 98 path= (String)locations.get(i); 99 100 //InstallWizard.currentPath = path; 101 ideupdater = new IdeUpdater( path, statusLine, progressBar ); 102 ideupdater.addInstallListener(this); 103 InstallWizard.setInstallStarted(true); 104 //InstallWizard.setPatchedTypes(false); 105 //InstallWizard.setPatchedJava(false); 106 //InstallWizard.setPatchedRDB(false); 107 ideupdater.start(); 108 } 109 } 110 111 // set to "Exit" at end of installation process 112 if (e.getSource() == nav.navCancel) { 113 int answer = JOptionPane.showConfirmDialog(wizard, "Are you sure you want to exit?"); 114 if (answer == JOptionPane.YES_OPTION) 115 { 116 wizard.exitForm(null); 117 } 118 else 119 { 120 return; 121 } 122 } 123 }// actionPerformed 124 125 installationComplete(InstallationEvent ev)126 public void installationComplete(InstallationEvent ev) { 127 //System.out.println("Detected installation complete"); 128 //if( InstUtil.hasNetbeansInstallation() || InstUtil.hasJeditInstallation() ) { 129 //System.out.println("Detected installation complete (IDE(s) detected)"); 130 nav.removeCancelListener(this); 131 nav.setCancelListener(nav); 132 nav.navCancel.setText("Finish"); 133 nav.enableCancel(true); 134 ideupdater = null; 135 } 136 137 // Variables declaration - do not modify//GEN-BEGIN:variables 138 private javax.swing.JPanel statusPanel; 139 private javax.swing.JLabel statusLine; 140 private InstallWizard wizard; 141 private NavPanel nav; 142 //private XmlUpdater xud; 143 private IdeUpdater ideupdater; 144 // End of variables declaration//GEN-END:variables 145 146 } 147