1*cd519653SAndrew Rist /**************************************************************
2*cd519653SAndrew Rist  *
3*cd519653SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*cd519653SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*cd519653SAndrew Rist  * distributed with this work for additional information
6*cd519653SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*cd519653SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*cd519653SAndrew Rist  * "License"); you may not use this file except in compliance
9*cd519653SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*cd519653SAndrew Rist  *
11*cd519653SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*cd519653SAndrew Rist  *
13*cd519653SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*cd519653SAndrew Rist  * software distributed under the License is distributed on an
15*cd519653SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*cd519653SAndrew Rist  * KIND, either express or implied.  See the License for the
17*cd519653SAndrew Rist  * specific language governing permissions and limitations
18*cd519653SAndrew Rist  * under the License.
19*cd519653SAndrew Rist  *
20*cd519653SAndrew Rist  *************************************************************/
21*cd519653SAndrew Rist 
22cdf0e10cSrcweir package installer;
23cdf0e10cSrcweir 
24cdf0e10cSrcweir /*
25cdf0e10cSrcweir  * Welcome.java
26cdf0e10cSrcweir  *
27cdf0e10cSrcweir  * Created on 04 July 2002, 15:43
28cdf0e10cSrcweir  */
29cdf0e10cSrcweir 
30cdf0e10cSrcweir /**
31cdf0e10cSrcweir  *
32cdf0e10cSrcweir  * @author  mike
33cdf0e10cSrcweir  */
34cdf0e10cSrcweir 
35cdf0e10cSrcweir import java.awt.event.*;
36cdf0e10cSrcweir import java.util.*;
37cdf0e10cSrcweir import java.net.*;
38cdf0e10cSrcweir import javax.swing.*;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir public class IdeFinal extends javax.swing.JPanel implements ActionListener, InstallListener {
41cdf0e10cSrcweir 
42cdf0e10cSrcweir     /** Creates new form Welcome */
IdeFinal(InstallWizard wizard)43cdf0e10cSrcweir     public IdeFinal(InstallWizard wizard) {
44cdf0e10cSrcweir         this.wizard = wizard;
45cdf0e10cSrcweir         setBackground(java.awt.Color.white);
46cdf0e10cSrcweir 	ideupdater = null;
47cdf0e10cSrcweir         initComponents();
48cdf0e10cSrcweir     }
49cdf0e10cSrcweir 
50cdf0e10cSrcweir     /** This method is called from within the constructor to
51cdf0e10cSrcweir      * initialize the form.
52cdf0e10cSrcweir      * WARNING: Do NOT modify this code. The content of this method is
53cdf0e10cSrcweir      * always regenerated by the Form Editor.
54cdf0e10cSrcweir      */
initComponents()55cdf0e10cSrcweir     private void initComponents() {//GEN-BEGIN:initComponents
56cdf0e10cSrcweir         statusPanel = new javax.swing.JPanel();
57cdf0e10cSrcweir 	statusPanel.setBackground(java.awt.Color.white);
58cdf0e10cSrcweir         statusLine = new javax.swing.JLabel("Ready", javax.swing.JLabel.CENTER);
59cdf0e10cSrcweir 
60cdf0e10cSrcweir         setLayout(new java.awt.BorderLayout());
61cdf0e10cSrcweir 
62cdf0e10cSrcweir         statusPanel.setLayout(new java.awt.BorderLayout());
63cdf0e10cSrcweir 
64cdf0e10cSrcweir         statusLine.setText("Waiting to install IDE support.");
65cdf0e10cSrcweir         statusPanel.add(statusLine, java.awt.BorderLayout.CENTER);
66cdf0e10cSrcweir 
67cdf0e10cSrcweir         add(statusPanel, java.awt.BorderLayout.CENTER);
68cdf0e10cSrcweir 	nav = new NavPanel(wizard, true, true, true, InstallWizard.IDEVERSIONS, "");
69cdf0e10cSrcweir 	nav.setNextListener(this);
70cdf0e10cSrcweir 	nav.removeCancelListener(nav);
71cdf0e10cSrcweir 	nav.setCancelListener(this);
72cdf0e10cSrcweir 	nav.navNext.setText("Install");
73cdf0e10cSrcweir 	add(nav, java.awt.BorderLayout.SOUTH);
74cdf0e10cSrcweir     }//GEN-END:initComponents
75cdf0e10cSrcweir 
getPreferredSize()76cdf0e10cSrcweir     public java.awt.Dimension getPreferredSize() {
77cdf0e10cSrcweir         return new java.awt.Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT);
78cdf0e10cSrcweir     }
79cdf0e10cSrcweir 
actionPerformed(ActionEvent e)80cdf0e10cSrcweir     public void actionPerformed(ActionEvent e) {
81cdf0e10cSrcweir 	// navNext is "Install"
82cdf0e10cSrcweir         if (e.getSource() == nav.navNext)
83cdf0e10cSrcweir 	{
84cdf0e10cSrcweir             JProgressBar progressBar=new JProgressBar();
85cdf0e10cSrcweir             progressBar.setMaximum(10);
86cdf0e10cSrcweir             progressBar.setValue(0);
87cdf0e10cSrcweir             statusPanel.add(progressBar, java.awt.BorderLayout.SOUTH);
88cdf0e10cSrcweir             nav.enableNext(false);
89cdf0e10cSrcweir             nav.enableBack(false);
90cdf0e10cSrcweir             nav.enableCancel(false);
91cdf0e10cSrcweir             ArrayList locations = wizard.getLocations();
92cdf0e10cSrcweir             //System.out.println("here "+locations.size());
93cdf0e10cSrcweir             // Returned 1
94cdf0e10cSrcweir             String progpath=null;
95cdf0e10cSrcweir             String path=null;
96cdf0e10cSrcweir             String classespath=null;
97cdf0e10cSrcweir             for (int i =0;i<locations.size();i++){
98cdf0e10cSrcweir                 path= (String)locations.get(i);
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 	        //InstallWizard.currentPath = path;
101cdf0e10cSrcweir 	        ideupdater = new IdeUpdater( path, statusLine, progressBar );
102cdf0e10cSrcweir 		ideupdater.addInstallListener(this);
103cdf0e10cSrcweir 		InstallWizard.setInstallStarted(true);
104cdf0e10cSrcweir 		//InstallWizard.setPatchedTypes(false);
105cdf0e10cSrcweir 		//InstallWizard.setPatchedJava(false);
106cdf0e10cSrcweir 		//InstallWizard.setPatchedRDB(false);
107cdf0e10cSrcweir 		ideupdater.start();
108cdf0e10cSrcweir             }
109cdf0e10cSrcweir         }
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	// set to "Exit" at end of installation process
112cdf0e10cSrcweir 	if (e.getSource() == nav.navCancel) {
113cdf0e10cSrcweir 		int answer = JOptionPane.showConfirmDialog(wizard, "Are you sure you want to exit?");
114cdf0e10cSrcweir 		if (answer == JOptionPane.YES_OPTION)
115cdf0e10cSrcweir 		{
116cdf0e10cSrcweir 			wizard.exitForm(null);
117cdf0e10cSrcweir 		}
118cdf0e10cSrcweir 		else
119cdf0e10cSrcweir 		{
120cdf0e10cSrcweir 			return;
121cdf0e10cSrcweir 		}
122cdf0e10cSrcweir 	}
123cdf0e10cSrcweir     }// actionPerformed
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 
installationComplete(InstallationEvent ev)126cdf0e10cSrcweir     public void installationComplete(InstallationEvent ev) {
127cdf0e10cSrcweir         //System.out.println("Detected installation complete");
128cdf0e10cSrcweir 	//if( InstUtil.hasNetbeansInstallation() || InstUtil.hasJeditInstallation() ) {
129cdf0e10cSrcweir 		//System.out.println("Detected installation complete (IDE(s) detected)");
130cdf0e10cSrcweir 		nav.removeCancelListener(this);
131cdf0e10cSrcweir 		nav.setCancelListener(nav);
132cdf0e10cSrcweir 		nav.navCancel.setText("Finish");
133cdf0e10cSrcweir 		nav.enableCancel(true);
134cdf0e10cSrcweir 		ideupdater = null;
135cdf0e10cSrcweir     }
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     // Variables declaration - do not modify//GEN-BEGIN:variables
138cdf0e10cSrcweir     private javax.swing.JPanel statusPanel;
139cdf0e10cSrcweir     private javax.swing.JLabel statusLine;
140cdf0e10cSrcweir     private InstallWizard wizard;
141cdf0e10cSrcweir     private NavPanel nav;
142cdf0e10cSrcweir     //private XmlUpdater xud;
143cdf0e10cSrcweir     private IdeUpdater ideupdater;
144cdf0e10cSrcweir     // End of variables declaration//GEN-END:variables
145cdf0e10cSrcweir 
146cdf0e10cSrcweir }
147