xref: /AOO41X/main/scripting/workben/installer/XmlUpdater.java (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir package installer;
2*cdf0e10cSrcweir 
3*cdf0e10cSrcweir import java.io.*;
4*cdf0e10cSrcweir import java.util.*;
5*cdf0e10cSrcweir import java.util.jar.*;
6*cdf0e10cSrcweir import java.net.URL;
7*cdf0e10cSrcweir import java.net.JarURLConnection;
8*cdf0e10cSrcweir import javax.swing.*;
9*cdf0e10cSrcweir 
10*cdf0e10cSrcweir /**
11*cdf0e10cSrcweir  *
12*cdf0e10cSrcweir  *
13*cdf0e10cSrcweir  *  @author  Aidan Butler
14*cdf0e10cSrcweir  */
15*cdf0e10cSrcweir public class XmlUpdater extends Thread {
16*cdf0e10cSrcweir 
17*cdf0e10cSrcweir     private String classesPath = null;
18*cdf0e10cSrcweir     private String jarfilename;
19*cdf0e10cSrcweir     private String installPath;
20*cdf0e10cSrcweir     private boolean netInstall;
21*cdf0e10cSrcweir     private boolean bindingsInstall;
22*cdf0e10cSrcweir 
23*cdf0e10cSrcweir     private JLabel statusLabel;
24*cdf0e10cSrcweir 
25*cdf0e10cSrcweir     private Vector listeners;
26*cdf0e10cSrcweir     private Thread internalThread;
27*cdf0e10cSrcweir     private boolean threadSuspended;
28*cdf0e10cSrcweir     private JProgressBar progressBar;
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir     private final String[] bakFiles =
31*cdf0e10cSrcweir     {
32*cdf0e10cSrcweir         "writermenubar.xml",
33*cdf0e10cSrcweir         "writerkeybinding.xml",
34*cdf0e10cSrcweir         "calcmenubar.xml",
35*cdf0e10cSrcweir         "calckeybinding.xml",
36*cdf0e10cSrcweir         "impressmenubar.xml",
37*cdf0e10cSrcweir         "impresskeybinding.xml",
38*cdf0e10cSrcweir         "drawmenubar.xml",
39*cdf0e10cSrcweir         "drawkeybinding.xml",
40*cdf0e10cSrcweir         "eventbindings.xml",
41*cdf0e10cSrcweir         "META-INF" + File.separator + "manifest.xml"
42*cdf0e10cSrcweir     };
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir     private final String[] dirs =
45*cdf0e10cSrcweir     {
46*cdf0e10cSrcweir         "java" + File.separator + "Highlight",
47*cdf0e10cSrcweir         "java" + File.separator + "MemoryUsage",
48*cdf0e10cSrcweir         "java" + File.separator + "ScriptFrmwrkHelper",
49*cdf0e10cSrcweir         "java" + File.separator + "debugger",
50*cdf0e10cSrcweir         "java" + File.separator + "debugger" + File.separator + "rhino",
51*cdf0e10cSrcweir         "beanshell" + File.separator + "InteractiveBeanShell",
52*cdf0e10cSrcweir         "beanshell" + File.separator + "Highlight",
53*cdf0e10cSrcweir         "beanshell" + File.separator + "MemoryUsage",
54*cdf0e10cSrcweir         "javascript" + File.separator + "ExportSheetsToHTML"
55*cdf0e10cSrcweir     };
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir     private final String[] names =
58*cdf0e10cSrcweir     {
59*cdf0e10cSrcweir         "java/Highlight/HighlightUtil.java",
60*cdf0e10cSrcweir         "java/Highlight/HighlightText.java",
61*cdf0e10cSrcweir         "java/Highlight/Highlight.jar",
62*cdf0e10cSrcweir         "java/Highlight/parcel-descriptor.xml",
63*cdf0e10cSrcweir         "java/MemoryUsage/MemoryUsage.java",
64*cdf0e10cSrcweir         "java/MemoryUsage/MemoryUsage.class",
65*cdf0e10cSrcweir         "java/MemoryUsage/parcel-descriptor.xml",
66*cdf0e10cSrcweir         "java/MemoryUsage/ExampleSpreadSheet.sxc",
67*cdf0e10cSrcweir         "java/ScriptFrmwrkHelper/parcel-descriptor.xml",
68*cdf0e10cSrcweir         "java/ScriptFrmwrkHelper/ScriptFrmwrkHelper.java",
69*cdf0e10cSrcweir         "java/ScriptFrmwrkHelper/ScriptFrmwrkHelper.class",
70*cdf0e10cSrcweir         "java/ScriptFrmwrkHelper/ScriptFrmwrkHelper.jar",
71*cdf0e10cSrcweir         "java/debugger/debugger.jar",
72*cdf0e10cSrcweir         "java/debugger/OOBeanShellDebugger.java",
73*cdf0e10cSrcweir         "java/debugger/OOScriptDebugger.java",
74*cdf0e10cSrcweir         "java/debugger/DebugRunner.java",
75*cdf0e10cSrcweir         "java/debugger/OORhinoDebugger.java",
76*cdf0e10cSrcweir         "java/debugger/parcel-descriptor.xml",
77*cdf0e10cSrcweir         "java/debugger/rhino/Main.java",
78*cdf0e10cSrcweir         "beanshell/InteractiveBeanShell/parcel-descriptor.xml",
79*cdf0e10cSrcweir         "beanshell/InteractiveBeanShell/interactive.bsh",
80*cdf0e10cSrcweir         "beanshell/Highlight/parcel-descriptor.xml",
81*cdf0e10cSrcweir         "beanshell/Highlight/highlighter.bsh",
82*cdf0e10cSrcweir         "beanshell/MemoryUsage/parcel-descriptor.xml",
83*cdf0e10cSrcweir         "beanshell/MemoryUsage/memusage.bsh",
84*cdf0e10cSrcweir         "javascript/ExportSheetsToHTML/parcel-descriptor.xml",
85*cdf0e10cSrcweir         "javascript/ExportSheetsToHTML/exportsheetstohtml.js"
86*cdf0e10cSrcweir     };
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir     public XmlUpdater(String installPath, JLabel statusLabel,JProgressBar pBar, boolean netInstall, boolean bindingsInstall) {
90*cdf0e10cSrcweir         this.installPath = installPath;
91*cdf0e10cSrcweir         this.statusLabel = statusLabel;
92*cdf0e10cSrcweir         this.netInstall = netInstall;
93*cdf0e10cSrcweir         this.bindingsInstall = bindingsInstall;
94*cdf0e10cSrcweir         listeners = new Vector();
95*cdf0e10cSrcweir         threadSuspended = false;
96*cdf0e10cSrcweir         progressBar=pBar;
97*cdf0e10cSrcweir         progressBar.setStringPainted(true);
98*cdf0e10cSrcweir     }// XmlUpdater
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir 	public boolean checkStop()
102*cdf0e10cSrcweir 	{
103*cdf0e10cSrcweir         if (internalThread == Thread.currentThread())
104*cdf0e10cSrcweir             return false;
105*cdf0e10cSrcweir         return true;
106*cdf0e10cSrcweir 	}// checkStop
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 	public void checkSuspend()
110*cdf0e10cSrcweir 	{
111*cdf0e10cSrcweir         if (threadSuspended) {
112*cdf0e10cSrcweir             synchronized(this) {
113*cdf0e10cSrcweir                 while (threadSuspended) {
114*cdf0e10cSrcweir                     try	{
115*cdf0e10cSrcweir                         wait();
116*cdf0e10cSrcweir                     } catch (InterruptedException eInt) {
117*cdf0e10cSrcweir                         //...
118*cdf0e10cSrcweir                     }
119*cdf0e10cSrcweir                 }
120*cdf0e10cSrcweir             }
121*cdf0e10cSrcweir         }
122*cdf0e10cSrcweir 	}// checkSuspend
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir 	public void setSuspend()
126*cdf0e10cSrcweir 	{
127*cdf0e10cSrcweir         threadSuspended = true;
128*cdf0e10cSrcweir 	}// setSuspend
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir 	public void setResume()
132*cdf0e10cSrcweir 	{
133*cdf0e10cSrcweir         threadSuspended = false;
134*cdf0e10cSrcweir         notify();
135*cdf0e10cSrcweir 	}// setResume
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir 	public void setStop()
139*cdf0e10cSrcweir 	{
140*cdf0e10cSrcweir         internalThread = null;
141*cdf0e10cSrcweir 	}// setStop
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir     public void run() {
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir         InputStream            istream;
147*cdf0e10cSrcweir         //InputSource            isource;
148*cdf0e10cSrcweir         //DocumentBuilderFactory builderFactory;
149*cdf0e10cSrcweir         //DocumentBuilder        builder = null;
150*cdf0e10cSrcweir         URL                    url;
151*cdf0e10cSrcweir         String                 fileName = null;
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir         internalThread = Thread.currentThread();
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir         //System.out.println("\n\n\n\nFileName: "+installPath);
156*cdf0e10cSrcweir         classesPath= installPath.concat(File.separator+"program"+File.separator+"classes"+File.separator);
157*cdf0e10cSrcweir         String opSys =System.getProperty("os.name");
158*cdf0e10cSrcweir         //System.out.println("\n System "+opSys);
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir         String progpath=installPath;
161*cdf0e10cSrcweir         progpath= progpath.concat(File.separator+"program"+File.separator);
162*cdf0e10cSrcweir         //System.out.println("Office progpath" + progpath );
163*cdf0e10cSrcweir         //System.out.println("\nModifying Installation "+installPath);
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir         String starBasicPath=installPath;
166*cdf0e10cSrcweir         starBasicPath= starBasicPath.concat(File.separator+"share"+File.separator+"basic"+File.separator+"ScriptBindingLibrary"+File.separator);
167*cdf0e10cSrcweir         //System.out.println( "Office StarBasic path: " + starBasicPath );
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir         String regSchemaOfficePath=installPath;
170*cdf0e10cSrcweir         regSchemaOfficePath= regSchemaOfficePath.concat(File.separator+"share"+File.separator+"registry"+File.separator+"schema"+File.separator+"org"+File.separator+"openoffice"+File.separator+"Office"+File.separator);
171*cdf0e10cSrcweir         //System.out.println( "Office schema path: " + regSchemaOfficePath );
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir         // Get the NetBeans installation
174*cdf0e10cSrcweir         //String netbeansPath=
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir         progressBar.setString("Unzipping Required Files");
177*cdf0e10cSrcweir         ZipData zd = new ZipData("SFrameworkInstall.jar");
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir         if( (!netInstall) || bindingsInstall) {
181*cdf0e10cSrcweir             String configPath=installPath;
182*cdf0e10cSrcweir             configPath= configPath.concat(File.separator+"user"+File.separator+"config"+File.separator+"soffice.cfg"+File.separator);
183*cdf0e10cSrcweir             //System.out.println( "Office configuration path: " + configPath );
184*cdf0e10cSrcweir             String manifestPath=configPath + "META-INF" + File.separator;
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir             //Adding <Office>/user/config/soffice.cfg/
187*cdf0e10cSrcweir             File configDir = new File( configPath );
188*cdf0e10cSrcweir             if( !configDir.isDirectory() ) {
189*cdf0e10cSrcweir                 if( !configDir.mkdir() ) {
190*cdf0e10cSrcweir                     System.out.println( "creating  " + configDir + "directory failed");
191*cdf0e10cSrcweir                 }
192*cdf0e10cSrcweir                 else {
193*cdf0e10cSrcweir                     System.out.println( configDir + "directory created");
194*cdf0e10cSrcweir                 }
195*cdf0e10cSrcweir             }
196*cdf0e10cSrcweir             else
197*cdf0e10cSrcweir                 System.out.println( "soffice.cfg exists" );
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir             File manifestDir = new File( manifestPath );
200*cdf0e10cSrcweir             if( !manifestDir.isDirectory() ) {
201*cdf0e10cSrcweir                 if( !manifestDir.mkdir() ) {
202*cdf0e10cSrcweir                     System.out.println( "creating " + manifestPath + "directory failed");
203*cdf0e10cSrcweir                 }
204*cdf0e10cSrcweir                 else {
205*cdf0e10cSrcweir                     System.out.println( manifestPath + " directory created");
206*cdf0e10cSrcweir                 }
207*cdf0e10cSrcweir             }
208*cdf0e10cSrcweir             else
209*cdf0e10cSrcweir                 System.out.println( manifestPath + " exists" );
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir             // Backup the confguration files in
212*cdf0e10cSrcweir             // <office>/user/config/soffice.cfg/
213*cdf0e10cSrcweir             // If they already exist.
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir             for( int i=0; i < bakFiles.length; i++ )
216*cdf0e10cSrcweir             {
217*cdf0e10cSrcweir                 String pathNameBak = configPath + bakFiles[i];
218*cdf0e10cSrcweir                 File origFile = new File( pathNameBak );
219*cdf0e10cSrcweir                 if( origFile.exists() )
220*cdf0e10cSrcweir                 {
221*cdf0e10cSrcweir                     System.out.println( "Attempting to backup " + pathNameBak + " to " + pathNameBak + ".bak" );
222*cdf0e10cSrcweir                     if(! origFile.renameTo( new File( pathNameBak + ".bak" ) ) )
223*cdf0e10cSrcweir                     {
224*cdf0e10cSrcweir                         System.out.println( "Failed to backup " + pathNameBak + " to " + pathNameBak + ".bak" );
225*cdf0e10cSrcweir                     }
226*cdf0e10cSrcweir                 }
227*cdf0e10cSrcweir             }
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir             // Adding Office configuration files
230*cdf0e10cSrcweir             if (!zd.extractEntry("bindingdialog/writermenubar.xml",configPath, statusLabel))
231*cdf0e10cSrcweir             {
232*cdf0e10cSrcweir                 onInstallComplete();
233*cdf0e10cSrcweir                 return;
234*cdf0e10cSrcweir             }
235*cdf0e10cSrcweir             if (!zd.extractEntry("bindingdialog/writerkeybinding.xml",configPath, statusLabel))
236*cdf0e10cSrcweir             {
237*cdf0e10cSrcweir                 onInstallComplete();
238*cdf0e10cSrcweir                 return;
239*cdf0e10cSrcweir             }
240*cdf0e10cSrcweir             if (!zd.extractEntry("bindingdialog/calcmenubar.xml",configPath, statusLabel))
241*cdf0e10cSrcweir             {
242*cdf0e10cSrcweir                 onInstallComplete();
243*cdf0e10cSrcweir                 return;
244*cdf0e10cSrcweir             }
245*cdf0e10cSrcweir             if (!zd.extractEntry("bindingdialog/calckeybinding.xml",configPath, statusLabel))
246*cdf0e10cSrcweir             {
247*cdf0e10cSrcweir                 onInstallComplete();
248*cdf0e10cSrcweir                 return;
249*cdf0e10cSrcweir             }
250*cdf0e10cSrcweir             if (!zd.extractEntry("bindingdialog/impressmenubar.xml",configPath, statusLabel))
251*cdf0e10cSrcweir             {
252*cdf0e10cSrcweir                 onInstallComplete();
253*cdf0e10cSrcweir                 return;
254*cdf0e10cSrcweir             }
255*cdf0e10cSrcweir             if (!zd.extractEntry("bindingdialog/impresskeybinding.xml",configPath, statusLabel))
256*cdf0e10cSrcweir             {
257*cdf0e10cSrcweir                 onInstallComplete();
258*cdf0e10cSrcweir                 return;
259*cdf0e10cSrcweir             }
260*cdf0e10cSrcweir             if (!zd.extractEntry("bindingdialog/drawmenubar.xml",configPath, statusLabel))
261*cdf0e10cSrcweir             {
262*cdf0e10cSrcweir                 onInstallComplete();
263*cdf0e10cSrcweir                 return;
264*cdf0e10cSrcweir             }
265*cdf0e10cSrcweir             if (!zd.extractEntry("bindingdialog/drawkeybinding.xml",configPath, statusLabel))
266*cdf0e10cSrcweir             {
267*cdf0e10cSrcweir                 onInstallComplete();
268*cdf0e10cSrcweir                 return;
269*cdf0e10cSrcweir             }
270*cdf0e10cSrcweir             if (!zd.extractEntry("bindingdialog/eventbindings.xml",configPath, statusLabel))
271*cdf0e10cSrcweir             {
272*cdf0e10cSrcweir                 onInstallComplete();
273*cdf0e10cSrcweir                 return;
274*cdf0e10cSrcweir             }
275*cdf0e10cSrcweir             if (!zd.extractEntry("bindingdialog/manifest.xml",manifestPath, statusLabel))
276*cdf0e10cSrcweir             {
277*cdf0e10cSrcweir                 onInstallComplete();
278*cdf0e10cSrcweir                 return;
279*cdf0e10cSrcweir             }
280*cdf0e10cSrcweir         }
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir         if(!bindingsInstall) {
283*cdf0e10cSrcweir             // Adding new directories to Office
284*cdf0e10cSrcweir             // Adding <Office>/user/basic/ScriptBindingLibrary/
285*cdf0e10cSrcweir             File scriptBindingLib = new File( starBasicPath );
286*cdf0e10cSrcweir             if( !scriptBindingLib.isDirectory() ) {
287*cdf0e10cSrcweir                 if( !scriptBindingLib.mkdir() ) {
288*cdf0e10cSrcweir                     System.out.println( "ScriptBindingLibrary failed");
289*cdf0e10cSrcweir                 }
290*cdf0e10cSrcweir                 else {
291*cdf0e10cSrcweir                     System.out.println( "ScriptBindingLibrary directory created");
292*cdf0e10cSrcweir                 }
293*cdf0e10cSrcweir             }
294*cdf0e10cSrcweir             else
295*cdf0e10cSrcweir                 System.out.println( "ScriptBindingLibrary exists" );
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir             // Adding Scripting Framework and tools
298*cdf0e10cSrcweir             if (!zd.extractEntry("sframework/ooscriptframe.zip",progpath, statusLabel))
299*cdf0e10cSrcweir             {
300*cdf0e10cSrcweir                 onInstallComplete();
301*cdf0e10cSrcweir                 return;
302*cdf0e10cSrcweir             }
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir             if (!zd.extractEntry("sframework/bshruntime.zip",progpath, statusLabel))
305*cdf0e10cSrcweir             {
306*cdf0e10cSrcweir                 onInstallComplete();
307*cdf0e10cSrcweir                 return;
308*cdf0e10cSrcweir             }
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir             if (!zd.extractEntry("sframework/jsruntime.zip",progpath, statusLabel))
311*cdf0e10cSrcweir             {
312*cdf0e10cSrcweir                 onInstallComplete();
313*cdf0e10cSrcweir                 return;
314*cdf0e10cSrcweir             }
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir             if (!zd.extractEntry("schema/Scripting.xcs",regSchemaOfficePath, statusLabel))
317*cdf0e10cSrcweir             {
318*cdf0e10cSrcweir                 onInstallComplete();
319*cdf0e10cSrcweir                 return;
320*cdf0e10cSrcweir             }
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir     //--------------------------------
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir             progressBar.setString("Registering Scripting Framework");
325*cdf0e10cSrcweir             progressBar.setValue(3);
326*cdf0e10cSrcweir             if(!Register.register(installPath+File.separator, statusLabel) ) {
327*cdf0e10cSrcweir                onInstallComplete();
328*cdf0e10cSrcweir                return;
329*cdf0e10cSrcweir             }
330*cdf0e10cSrcweir             progressBar.setValue(5);
331*cdf0e10cSrcweir 
332*cdf0e10cSrcweir             String path = installPath + File.separator +
333*cdf0e10cSrcweir                 "share" + File.separator + "Scripts" + File.separator;
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir             for (int i = 0; i < dirs.length; i++) {
336*cdf0e10cSrcweir                 File dir = new File(path + dirs[i]);
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir                 if (!dir.exists()) {
339*cdf0e10cSrcweir                     if (!dir.mkdirs()) {
340*cdf0e10cSrcweir                         System.err.println("Error making dir: " +
341*cdf0e10cSrcweir                             dir.getAbsolutePath());
342*cdf0e10cSrcweir                         onInstallComplete();
343*cdf0e10cSrcweir                         return;
344*cdf0e10cSrcweir                     }
345*cdf0e10cSrcweir                 }
346*cdf0e10cSrcweir             }
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir             for (int i = 0; i < names.length; i++) {
349*cdf0e10cSrcweir                 String source = "/examples/" + names[i];
350*cdf0e10cSrcweir                 String dest = path + names[i].replace('/', File.separatorChar);
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir                 if (!zd.extractEntry(source, dest, statusLabel)) {
353*cdf0e10cSrcweir                     onInstallComplete();
354*cdf0e10cSrcweir                     return;
355*cdf0e10cSrcweir                 }
356*cdf0e10cSrcweir             }
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir             // Adding binding dialog
360*cdf0e10cSrcweir             if (!zd.extractEntry("bindingdialog/ScriptBinding.xba",starBasicPath, statusLabel))
361*cdf0e10cSrcweir             {
362*cdf0e10cSrcweir                 onInstallComplete();
363*cdf0e10cSrcweir                 return;
364*cdf0e10cSrcweir             }
365*cdf0e10cSrcweir             if (!zd.extractEntry("bindingdialog/MenuBinding.xdl",starBasicPath, statusLabel))
366*cdf0e10cSrcweir             {
367*cdf0e10cSrcweir                 onInstallComplete();
368*cdf0e10cSrcweir                 return;
369*cdf0e10cSrcweir             }
370*cdf0e10cSrcweir             if (!zd.extractEntry("bindingdialog/KeyBinding.xdl",starBasicPath, statusLabel))
371*cdf0e10cSrcweir             {
372*cdf0e10cSrcweir                 onInstallComplete();
373*cdf0e10cSrcweir                 return;
374*cdf0e10cSrcweir             }
375*cdf0e10cSrcweir             if (!zd.extractEntry("bindingdialog/EventsBinding.xdl",starBasicPath, statusLabel))
376*cdf0e10cSrcweir             {
377*cdf0e10cSrcweir                 onInstallComplete();
378*cdf0e10cSrcweir                 return;
379*cdf0e10cSrcweir             }
380*cdf0e10cSrcweir             if (!zd.extractEntry("bindingdialog/HelpBinding.xdl",starBasicPath, statusLabel))
381*cdf0e10cSrcweir             {
382*cdf0e10cSrcweir                 onInstallComplete();
383*cdf0e10cSrcweir                 return;
384*cdf0e10cSrcweir             }
385*cdf0e10cSrcweir             if (!zd.extractEntry("bindingdialog/EditDebug.xdl",starBasicPath, statusLabel))
386*cdf0e10cSrcweir             {
387*cdf0e10cSrcweir                 onInstallComplete();
388*cdf0e10cSrcweir                 return;
389*cdf0e10cSrcweir             }
390*cdf0e10cSrcweir             if (!zd.extractEntry("bindingdialog/dialog.xlb",starBasicPath, statusLabel))
391*cdf0e10cSrcweir             {
392*cdf0e10cSrcweir                 onInstallComplete();
393*cdf0e10cSrcweir                 return;
394*cdf0e10cSrcweir             }
395*cdf0e10cSrcweir             if (!zd.extractEntry("bindingdialog/script.xlb",starBasicPath, statusLabel))
396*cdf0e10cSrcweir             {
397*cdf0e10cSrcweir                 onInstallComplete();
398*cdf0e10cSrcweir                 return;
399*cdf0e10cSrcweir             }
400*cdf0e10cSrcweir         }
401*cdf0e10cSrcweir 
402*cdf0e10cSrcweir 
403*cdf0e10cSrcweir         statusLabel.setText("Installation Complete");
404*cdf0e10cSrcweir         progressBar.setString("Installation Complete");
405*cdf0e10cSrcweir         progressBar.setValue(10);
406*cdf0e10cSrcweir         onInstallComplete();
407*cdf0e10cSrcweir 
408*cdf0e10cSrcweir     }// run
409*cdf0e10cSrcweir 
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir     public void addInstallListener(InstallListener listener)
412*cdf0e10cSrcweir     {
413*cdf0e10cSrcweir         listeners.addElement(listener);
414*cdf0e10cSrcweir     }// addInstallListener
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir 
417*cdf0e10cSrcweir     private void onInstallComplete()
418*cdf0e10cSrcweir     {
419*cdf0e10cSrcweir         Enumeration e = listeners.elements();
420*cdf0e10cSrcweir         while (e.hasMoreElements())
421*cdf0e10cSrcweir         {
422*cdf0e10cSrcweir             InstallListener listener = (InstallListener)e.nextElement();
423*cdf0e10cSrcweir             listener.installationComplete(null);
424*cdf0e10cSrcweir         }
425*cdf0e10cSrcweir     }// onInstallComplete
426*cdf0e10cSrcweir 
427*cdf0e10cSrcweir }// XmlUpdater class
428